Reviewed by Darin Adler.
Add ClassInfo to custom constructors so that they toString properly
- Take this chance to remove the "Imp" from the end of JSXMLHttpRequestConstructorImp,
and XSLTProcessorConstructorImp and prefix all the classes with JS.
* bindings/js/JSAudioConstructor.cpp:
(WebCore::): Added ClassInfo definition.
(WebCore::JSAudioConstructor::JSAudioConstructor):
(WebCore::JSAudioConstructor::construct): Cleanup.
* bindings/js/JSAudioConstructor.h: Rename m_doc to m_document.
(WebCore::JSAudioConstructor::classInfo): Added.
* bindings/js/JSHTMLInputElementBase.cpp: Rename HTMLInputElementBasePrototype
to JSHTMLInputElementBasePrototype as seen if toString'ed.
(WebCore::):
* bindings/js/JSHTMLOptionElementConstructor.cpp:
(WebCore::): Added ClassInfo definition.
* bindings/js/JSHTMLOptionElementConstructor.h:
(WebCore::JSHTMLOptionElementConstructor::classInfo): Added.
* bindings/js/JSImageConstructor.cpp:
(WebCore::): Added ClassInfo definition.
(WebCore::JSImageConstructor::implementsConstruct): Moved here from header.
* bindings/js/JSImageConstructor.h:
(WebCore::JSImageConstructor::classInfo): Added.
* bindings/js/JSXMLHttpRequest.cpp:
(WebCore::): Rename XMLHttpRequestPrototype to JSXMLHttpRequestPrototype
as seen if toString'ed.
(WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
(WebCore::JSXMLHttpRequestConstructor::implementsConstruct):
(WebCore::JSXMLHttpRequestConstructor::construct):
* bindings/js/JSXMLHttpRequest.h: Renamed JSXMLHttpRequestConstructorImp to
JSXMLHttpRequestConstructor and doc to m_document and
(WebCore::JSXMLHttpRequestConstructor::classInfo): Added.
* bindings/js/JSXSLTProcessor.cpp:
(WebCore::): Renamed XSLTProcessorPrototype to JSXSLTProcessorPrototype and
XSLTProcessorConstructorImp to JSXSLTProcessorConstructor.
(WebCore::JSXSLTProcessorConstructor::JSXSLTProcessorConstructor):
(WebCore::JSXSLTProcessorConstructor::implementsConstruct):
(WebCore::JSXSLTProcessorConstructor::construct):
* bindings/js/JSXSLTProcessor.h:
(WebCore::JSXSLTProcessorConstructor::classInfo): Added.
* bindings/js/kjs_window.cpp:
(WebCore::JSDOMWindowBase::getValueProperty): Fixed to work with the new class names.
WebKitTools:
Reviewed by Darin Adler.
* Scripts/do-webcore-rename: Update renaming plan.
LayoutTests:
Reviewed by Darin Adler.
Update results for fixed class names.
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/xmlhttprequest-get-expected.txt:
* http/tests/xmlhttprequest/event-target-expected.txt:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30763
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-03-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Update results for fixed class names.
+
+ * fast/dom/Window/window-properties-expected.txt:
+ * fast/dom/xmlhttprequest-get-expected.txt:
+ * http/tests/xmlhttprequest/event-target-expected.txt:
+
2008-03-04 Dan Bernstein <mitz@apple.com>
Reviewed by Oliver Hunt and Geoffrey Garen.
window.Attr.prototype.removeChild [function]
window.Attr.prototype.removeEventListener [function]
window.Attr.prototype.replaceChild [function]
-window.Audio [object Object]
+window.Audio [object AudioConstructor]
window.CDATASection [object CDATASectionConstructor]
window.CDATASection.prototype [object CDATASectionPrototype]
window.CDATASection.prototype.ATTRIBUTE_NODE [number]
window.HTMLUListElement.prototype [printed above as window.Element.prototype]
window.HTMLVideoElement [object HTMLVideoElementConstructor]
window.HTMLVideoElement.prototype [printed above as window.Element.prototype]
-window.Image [object Object]
+window.Image [object ImageConstructor]
window.KeyboardEvent [object KeyboardEventConstructor]
window.KeyboardEvent.prototype [printed above as window.Event.prototype]
window.MediaError [object MediaErrorConstructor]
window.NodeList.prototype.item [function]
window.Notation [object NotationConstructor]
window.Notation.prototype [printed above as window.Node.prototype]
-window.Option [object Object]
+window.Option [object OptionConstructor]
window.OverflowEvent [object OverflowEventConstructor]
window.OverflowEvent.BOTH [number]
window.OverflowEvent.HORIZONTAL [number]
window.WheelEvent [object WheelEventConstructor]
window.WheelEvent.prototype [printed above as window.Event.prototype]
window.XMLDocument [printed above as window.Document]
-window.XMLHttpRequest [object Object]
-window.XMLHttpRequest.prototype [object JSXMLHttpRequestPrototype]
+window.XMLHttpRequest [object XMLHttpRequestConstructor]
+window.XMLHttpRequest.prototype [object XMLHttpRequestPrototype]
window.XMLHttpRequest.prototype.abort [function]
window.XMLHttpRequest.prototype.addEventListener [function]
window.XMLHttpRequest.prototype.dispatchEvent [function]
window.XPathResult.prototype.UNORDERED_NODE_SNAPSHOT_TYPE [number]
window.XPathResult.prototype.iterateNext [function]
window.XPathResult.prototype.snapshotItem [function]
-window.XSLTProcessor [object Object]
+window.XSLTProcessor [object XSLTProcessorConsructor]
window.XSLTProcessor.prototype [object XSLTProcessorPrototype]
window.XSLTProcessor.prototype.clearParameters [function]
window.XSLTProcessor.prototype.getParameter [function]
cancelBubble : 'false'
cancelable : 'false'
clipboardData : 'undefined'
-currentTarget : '[object JSXMLHttpRequest]'
+currentTarget : '[object XMLHttpRequest]'
eventPhase : '0'
initEvent : 'function initEvent() {
[native code]
[native code]
}'
returnValue : 'true'
-srcElement : '[object JSXMLHttpRequest]'
+srcElement : '[object XMLHttpRequest]'
stopPropagation : 'function stopPropagation() {
[native code]
}'
-target : '[object JSXMLHttpRequest]'
+target : '[object XMLHttpRequest]'
type : 'load'
Tests for bug 11053 - XMLHttpRequest should be an EventTarget.
-fooListener: this = [object JSXMLHttpRequest]
-onload: this = [object JSXMLHttpRequest]
-eventListener: this = [object JSXMLHttpRequest]
-eventListener2: this = [object JSXMLHttpRequest]
-eventListener3: this = [object JSXMLHttpRequest]
-onload: this = [object JSXMLHttpRequest]
-eventListener: this = [object JSXMLHttpRequest]
-eventListener2: this = [object JSXMLHttpRequest]
+fooListener: this = [object XMLHttpRequest]
+onload: this = [object XMLHttpRequest]
+eventListener: this = [object XMLHttpRequest]
+eventListener2: this = [object XMLHttpRequest]
+eventListener3: this = [object XMLHttpRequest]
+onload: this = [object XMLHttpRequest]
+eventListener: this = [object XMLHttpRequest]
+eventListener2: this = [object XMLHttpRequest]
+2008-03-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add ClassInfo to custom constructors so that they toString properly
+
+ - Take this chance to remove the "Imp" from the end of JSXMLHttpRequestConstructorImp,
+ and XSLTProcessorConstructorImp and prefix all the classes with JS.
+
+ * bindings/js/JSAudioConstructor.cpp:
+ (WebCore::): Added ClassInfo definition.
+ (WebCore::JSAudioConstructor::JSAudioConstructor):
+ (WebCore::JSAudioConstructor::construct): Cleanup.
+ * bindings/js/JSAudioConstructor.h: Rename m_doc to m_document.
+ (WebCore::JSAudioConstructor::classInfo): Added.
+
+ * bindings/js/JSHTMLInputElementBase.cpp: Rename HTMLInputElementBasePrototype
+ to JSHTMLInputElementBasePrototype as seen if toString'ed.
+ (WebCore::):
+
+ * bindings/js/JSHTMLOptionElementConstructor.cpp:
+ (WebCore::): Added ClassInfo definition.
+ * bindings/js/JSHTMLOptionElementConstructor.h:
+ (WebCore::JSHTMLOptionElementConstructor::classInfo): Added.
+
+ * bindings/js/JSImageConstructor.cpp:
+ (WebCore::): Added ClassInfo definition.
+ (WebCore::JSImageConstructor::implementsConstruct): Moved here from header.
+ * bindings/js/JSImageConstructor.h:
+ (WebCore::JSImageConstructor::classInfo): Added.
+
+ * bindings/js/JSXMLHttpRequest.cpp:
+ (WebCore::): Rename XMLHttpRequestPrototype to JSXMLHttpRequestPrototype
+ as seen if toString'ed.
+ (WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
+ (WebCore::JSXMLHttpRequestConstructor::implementsConstruct):
+ (WebCore::JSXMLHttpRequestConstructor::construct):
+ * bindings/js/JSXMLHttpRequest.h: Renamed JSXMLHttpRequestConstructorImp to
+ JSXMLHttpRequestConstructor and doc to m_document and
+ (WebCore::JSXMLHttpRequestConstructor::classInfo): Added.
+
+ * bindings/js/JSXSLTProcessor.cpp:
+ (WebCore::): Renamed XSLTProcessorPrototype to JSXSLTProcessorPrototype and
+ XSLTProcessorConstructorImp to JSXSLTProcessorConstructor.
+ (WebCore::JSXSLTProcessorConstructor::JSXSLTProcessorConstructor):
+ (WebCore::JSXSLTProcessorConstructor::implementsConstruct):
+ (WebCore::JSXSLTProcessorConstructor::construct):
+ * bindings/js/JSXSLTProcessor.h:
+ (WebCore::JSXSLTProcessorConstructor::classInfo): Added.
+
+ * bindings/js/kjs_window.cpp:
+ (WebCore::JSDOMWindowBase::getValueProperty): Fixed to work with the new class names.
+
2008-03-04 Dan Bernstein <mitz@apple.com>
Reviewed by Oliver Hunt and Geoffrey Garen.
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
-JSAudioConstructor::JSAudioConstructor(ExecState* exec, Document* d)
+const ClassInfo JSAudioConstructor::info = { "AudioConstructor", 0, 0 };
+
+JSAudioConstructor::JSAudioConstructor(ExecState* exec, Document* document)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
- , m_doc(d)
+ , m_document(document)
{
putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
}
JSObject* JSAudioConstructor::construct(ExecState* exec, const List& args)
{
- int exception = 0;
- RefPtr<Element> el(m_doc->createElement("audio", exception));
+ ExceptionCode exception = 0;
+ RefPtr<Element> element = m_document->createElement("audio", exception);
HTMLAudioElement* audio = 0;
- if (el && !exception) {
- audio = static_cast<HTMLAudioElement*>(el.get());
- int sz = args.size();
- if (sz > 0) {
+ if (element && !exception) {
+ audio = static_cast<HTMLAudioElement*>(element.get());
+ if (args.size() > 0) {
audio->setSrc(args[0]->toString(exec));
audio->scheduleLoad();
}
return static_cast<JSObject*>(toJS(exec, audio));
}
-}
-#endif
+} // namespace WebCore
+
+#endif // ENABLE(VIDEO)
class JSAudioConstructor : public DOMObject {
public:
JSAudioConstructor(KJS::ExecState*, Document*);
+
virtual bool implementsConstruct() const;
- virtual KJS::JSObject *construct(KJS::ExecState*, const KJS::List& args);
+ virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
+
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
+
private:
- RefPtr<Document> m_doc;
+ RefPtr<Document> m_document;
};
-}
+} // namespace WebCore
-#endif
-#endif
+#endif // ENABLE(VIDEO)
+#endif // JSAudioConstructor_h
@end
*/
-KJS_IMPLEMENT_PROTOTYPE("JSHTMLInputElementBase", JSHTMLInputElementBasePrototype)
+KJS_IMPLEMENT_PROTOTYPE("HTMLInputElementBase", JSHTMLInputElementBasePrototype)
JSValue* jsHTMLInputElementBaseFunctionSetSelectionRange(ExecState* exec, JSObject* thisObj, const List& args)
{
return jsUndefined();
}
-const ClassInfo JSHTMLInputElementBase::info = { "JSHTMLInputElementBase", &JSHTMLElement::info, &JSHTMLInputElementBaseTable };
+const ClassInfo JSHTMLInputElementBase::info = { "HTMLInputElementBase", &JSHTMLElement::info, &JSHTMLInputElementBaseTable };
JSHTMLInputElementBase::JSHTMLInputElementBase(KJS::JSObject* prototype, PassRefPtr<HTMLInputElement> e)
: JSHTMLElement(prototype, e.get())
namespace WebCore {
+const ClassInfo JSHTMLOptionElementConstructor::info = { "OptionConstructor", 0, 0 };
+
JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* document)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
, m_document(document)
class JSHTMLOptionElementConstructor : public DOMObject {
public:
JSHTMLOptionElementConstructor(KJS::ExecState*, Document*);
+
virtual bool implementsConstruct() const;
- virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List& args);
+ virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
+
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
+
private:
RefPtr<Document> m_document;
};
-}
+} // namespace WebCore
-#endif
+#endif // JSHTMLOptionElementConstructor_h
namespace WebCore {
+const ClassInfo JSImageConstructor::info = { "ImageConstructor", 0, 0 };
+
JSImageConstructor::JSImageConstructor(ExecState* exec, Document* document)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
, m_document(document)
{
}
+bool JSImageConstructor::implementsConstruct() const
+{
+ return true;
+}
+
JSObject* JSImageConstructor::construct(ExecState* exec, const List& args)
{
bool widthSet = false;
public:
JSImageConstructor(KJS::ExecState*, Document*);
- virtual bool implementsConstruct() const { return true; }
+ virtual bool implementsConstruct() const;
virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
+
private:
RefPtr<Document> m_document;
};
/*
- * Copyright (C) 2004, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
*
* This library is free software; you can redistribute it and/or
@end
*/
KJS_DEFINE_PROTOTYPE(JSXMLHttpRequestPrototype)
-KJS_IMPLEMENT_PROTOTYPE("JSXMLHttpRequest", JSXMLHttpRequestPrototype)
+KJS_IMPLEMENT_PROTOTYPE("XMLHttpRequest", JSXMLHttpRequestPrototype)
-JSXMLHttpRequestConstructorImp::JSXMLHttpRequestConstructorImp(ExecState* exec, Document* d)
+const ClassInfo JSXMLHttpRequestConstructor::info = { "XMLHttpRequestConstructor", 0, 0 };
+
+JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, Document* document)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
- , doc(d)
+ , m_document(document)
{
putDirect(exec->propertyNames().prototype, JSXMLHttpRequestPrototype::self(exec), None);
}
-bool JSXMLHttpRequestConstructorImp::implementsConstruct() const
+bool JSXMLHttpRequestConstructor::implementsConstruct() const
{
return true;
}
-JSObject* JSXMLHttpRequestConstructorImp::construct(ExecState* exec, const List&)
+JSObject* JSXMLHttpRequestConstructor::construct(ExecState* exec, const List&)
{
- return new JSXMLHttpRequest(JSXMLHttpRequestPrototype::self(exec), doc.get());
+ return new JSXMLHttpRequest(JSXMLHttpRequestPrototype::self(exec), m_document.get());
}
-const ClassInfo JSXMLHttpRequest::info = { "JSXMLHttpRequest", 0, &JSXMLHttpRequestTable };
+const ClassInfo JSXMLHttpRequest::info = { "XMLHttpRequest", 0, &JSXMLHttpRequestTable };
/* Source for JSXMLHttpRequestTable.
@begin JSXMLHttpRequestTable 7
class XMLHttpRequest;
class Document;
-class JSXMLHttpRequestConstructorImp : public DOMObject {
+class JSXMLHttpRequestConstructor : public DOMObject {
public:
- JSXMLHttpRequestConstructorImp(KJS::ExecState*, Document*);
+ JSXMLHttpRequestConstructor(KJS::ExecState*, Document*);
virtual bool implementsConstruct() const;
virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
+
private:
- RefPtr<Document> doc;
+ RefPtr<Document> m_document;
};
class JSXMLHttpRequest : public DOMObject {
const ClassInfo JSXSLTProcessor::info = { "XSLTProcessor", 0, 0 };
/*
-@begin XSLTProcessorPrototypeTable 7
+@begin JSXSLTProcessorPrototypeTable 7
importStylesheet jsXSLTProcessorPrototypeFunctionImportStylesheet DontDelete|Function 1
transformToFragment jsXSLTProcessorPrototypeFunctionTransformToFragment DontDelete|Function 2
transformToDocument jsXSLTProcessorPrototypeFunctionTransformToDocument DontDelete|Function 2
@end
*/
-KJS_DEFINE_PROTOTYPE(XSLTProcessorPrototype)
-KJS_IMPLEMENT_PROTOTYPE("XSLTProcessor", XSLTProcessorPrototype)
+KJS_DEFINE_PROTOTYPE(JSXSLTProcessorPrototype)
+KJS_IMPLEMENT_PROTOTYPE("XSLTProcessor", JSXSLTProcessorPrototype)
JSXSLTProcessor::JSXSLTProcessor(JSObject* prototype)
: DOMObject(prototype)
return jsUndefined();
}
-XSLTProcessorConstructorImp::XSLTProcessorConstructorImp(ExecState* exec)
+const ClassInfo JSXSLTProcessorConstructor::info = { "XSLTProcessorConsructor", 0, 0 };
+
+JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(ExecState* exec)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
{
- putDirect(exec->propertyNames().prototype, XSLTProcessorPrototype::self(exec), None);
+ putDirect(exec->propertyNames().prototype, JSXSLTProcessorPrototype::self(exec), None);
}
-bool XSLTProcessorConstructorImp::implementsConstruct() const
+bool JSXSLTProcessorConstructor::implementsConstruct() const
{
return true;
}
-JSObject* XSLTProcessorConstructorImp::construct(ExecState* exec, const List& args)
+JSObject* JSXSLTProcessorConstructor::construct(ExecState* exec, const List& args)
{
- return new JSXSLTProcessor(XSLTProcessorPrototype::self(exec));
+ return new JSXSLTProcessor(JSXSLTProcessorPrototype::self(exec));
}
-} // namespace KJS
+} // namespace WebCore
#endif // ENABLE(XSLT)
RefPtr<XSLTProcessor> m_impl;
};
-class XSLTProcessorConstructorImp : public DOMObject {
+class JSXSLTProcessorConstructor : public DOMObject {
public:
- XSLTProcessorConstructorImp(KJS::ExecState*);
+ JSXSLTProcessorConstructor(KJS::ExecState*);
virtual bool implementsConstruct() const;
virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
+
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
};
KJS::JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
case XMLHttpRequest:
if (!allowsAccessFrom(exec))
return jsUndefined();
- return new JSXMLHttpRequestConstructorImp(exec, impl()->frame()->document());
+ return new JSXMLHttpRequestConstructor(exec, impl()->frame()->document());
case Audio:
#if ENABLE(VIDEO)
if (!allowsAccessFrom(exec))
#else
return jsUndefined();
#endif
-#if ENABLE(XSLT)
case XSLTProcessor_:
+#if ENABLE(XSLT)
if (!allowsAccessFrom(exec))
return jsUndefined();
- return new XSLTProcessorConstructorImp(exec);
+ return new JSXSLTProcessorConstructor(exec);
#else
- case XSLTProcessor_:
return jsUndefined();
#endif
}
+2008-03-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ * Scripts/do-webcore-rename: Update renaming plan.
+
2008-03-02 Brent Fulgham <bfulgham@gmail.com>
Reviewed by Alp Toker.
"ImageConstructorImp" => "JSImageConstructor",
"ImageTokenizer" => "ImageDocumentBuilder",
"InternalFunctionImp" => "InternalFunction",
- "JSXMLHttpRequestConstructorImp" => "JSXMLHttpRequestConstructor",
+ "JSHTMLOptionElementConstructor" => "JSOptionConstructor",
"KURL" => "URL",
"KURLCFNet" => "URLCF",
"KURLMac" => "URLMac",
"Tokenizer" => "DocumentBuilder",
"Tokenizer_h" => "DocumentBuilder_h",
"XMLTokenizer" => "XMLDocumentBuilder",
- "XSLTProcessorConstructorImp" => "JSXSLTProcessorConstructor",
- "XSLTProcessorPrototype" => "JSXSLTProcessorPrototype",
"animationController" => "animation",
"branchfirstbyte" => "branchFirstByte",
"branchreqbyte" => "branchReqByte",