Reviewed by Sam Weinig.
authorcmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Mar 2009 18:48:41 +0000 (18:48 +0000)
committercmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Mar 2009 18:48:41 +0000 (18:48 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=24257

        Added prototype properties for several classes with constructors that
        were missing them, including the one mentioned in the bug.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41396 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/custom-constructors-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Window/custom-constructors.html [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-properties-expected.txt
WebCore/ChangeLog
WebCore/bindings/js/JSAudioConstructor.cpp
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSImageConstructor.cpp
WebCore/bindings/js/JSOptionConstructor.cpp
WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp
WebCore/bindings/js/JSWebKitCSSMatrixConstructor.h
WebCore/bindings/js/JSWebKitPointConstructor.cpp
WebCore/bindings/js/JSWorkerConstructor.cpp

index ae7b30c337eff1b187bfb2def5a2d3b775a5eb60..f6b0094faed6d78ddd47d4ecaaaa5e9801756f06 100644 (file)
@@ -1,3 +1,17 @@
+2009-03-02  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=24257
+
+        Test for all newly added constructor prototypes.
+        This addition also changes window-properties.html
+        results, so that is updated as well.
+
+        * fast/dom/Window/custom-constructors-expected.txt: Added.
+        * fast/dom/Window/custom-constructors.html: Added.
+        * fast/dom/Window/window-properties-expected.txt:
+
 2009-03-03  Jungshik Shin  <jshin@chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/dom/Window/custom-constructors-expected.txt b/LayoutTests/fast/dom/Window/custom-constructors-expected.txt
new file mode 100644 (file)
index 0000000..3d27c4f
--- /dev/null
@@ -0,0 +1,15 @@
+Test constructors for classes in Window
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS Audio.prototype.toString.call(new Audio) is '[object HTMLAudioElement]'
+PASS Image.prototype.toString.call(new Image) is '[object HTMLImageElement]'
+PASS Option.prototype.toString.call(new Option) is '[object HTMLOptionElement]'
+PASS WebKitPoint.prototype.toString.call(new WebKitPoint) is '[object WebKitPoint]'
+PASS WebKitCSSMatrix.prototype.toString.call(new WebKitCSSMatrix) is 'matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)'
+PASS XMLHttpRequest.prototype.toString.call(new XMLHttpRequest) is '[object XMLHttpRequest]'
+PASS XSLTProcessor.prototype.toString.call(new XSLTProcessor) is '[object XSLTProcessor]'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Window/custom-constructors.html b/LayoutTests/fast/dom/Window/custom-constructors.html
new file mode 100644 (file)
index 0000000..efd611c
--- /dev/null
@@ -0,0 +1,27 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+    description('Test constructors for classes in Window');
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+    }
+
+    shouldBe("Audio.prototype.toString.call(new Audio)", "'[object HTMLAudioElement]'");
+    shouldBe("Image.prototype.toString.call(new Image)", "'[object HTMLImageElement]'");
+    shouldBe("Option.prototype.toString.call(new Option)", "'[object HTMLOptionElement]'");
+    shouldBe("WebKitPoint.prototype.toString.call(new WebKitPoint)", "'[object WebKitPoint]'");
+    shouldBe("WebKitCSSMatrix.prototype.toString.call(new WebKitCSSMatrix)", "'matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)'");
+    shouldBe("XMLHttpRequest.prototype.toString.call(new XMLHttpRequest)", "'[object XMLHttpRequest]'");
+    shouldBe("XSLTProcessor.prototype.toString.call(new XSLTProcessor)", "'[object XSLTProcessor]'");
+
+    successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
index 5454270bdc1286a6edd1a1aea65857de4b290654..d1375515fa329e53c68069710ac9f72b298546d8 100644 (file)
@@ -40,6 +40,85 @@ window.Attr.prototype.removeChild [function]
 window.Attr.prototype.removeEventListener [function]
 window.Attr.prototype.replaceChild [function]
 window.Audio [object AudioConstructor]
+window.Audio.prototype [object HTMLAudioElementPrototype]
+window.Audio.prototype.ATTRIBUTE_NODE [number]
+window.Audio.prototype.CAN_PLAY [number]
+window.Audio.prototype.CAN_PLAY_THROUGH [number]
+window.Audio.prototype.CAN_SHOW_CURRENT_FRAME [number]
+window.Audio.prototype.CDATA_SECTION_NODE [number]
+window.Audio.prototype.COMMENT_NODE [number]
+window.Audio.prototype.DATA_UNAVAILABLE [number]
+window.Audio.prototype.DOCUMENT_FRAGMENT_NODE [number]
+window.Audio.prototype.DOCUMENT_NODE [number]
+window.Audio.prototype.DOCUMENT_POSITION_CONTAINED_BY [number]
+window.Audio.prototype.DOCUMENT_POSITION_CONTAINS [number]
+window.Audio.prototype.DOCUMENT_POSITION_DISCONNECTED [number]
+window.Audio.prototype.DOCUMENT_POSITION_FOLLOWING [number]
+window.Audio.prototype.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC [number]
+window.Audio.prototype.DOCUMENT_POSITION_PRECEDING [number]
+window.Audio.prototype.DOCUMENT_TYPE_NODE [number]
+window.Audio.prototype.ELEMENT_NODE [number]
+window.Audio.prototype.EMPTY [number]
+window.Audio.prototype.ENTITY_NODE [number]
+window.Audio.prototype.ENTITY_REFERENCE_NODE [number]
+window.Audio.prototype.LOADED [number]
+window.Audio.prototype.LOADED_FIRST_FRAME [number]
+window.Audio.prototype.LOADED_METADATA [number]
+window.Audio.prototype.LOADING [number]
+window.Audio.prototype.NOTATION_NODE [number]
+window.Audio.prototype.PROCESSING_INSTRUCTION_NODE [number]
+window.Audio.prototype.TEXT_NODE [number]
+window.Audio.prototype.addEventListener [function]
+window.Audio.prototype.appendChild [function]
+window.Audio.prototype.blur [function]
+window.Audio.prototype.cloneNode [function]
+window.Audio.prototype.compareDocumentPosition [function]
+window.Audio.prototype.contains [function]
+window.Audio.prototype.dispatchEvent [function]
+window.Audio.prototype.focus [function]
+window.Audio.prototype.getAttribute [function]
+window.Audio.prototype.getAttributeNS [function]
+window.Audio.prototype.getAttributeNode [function]
+window.Audio.prototype.getAttributeNodeNS [function]
+window.Audio.prototype.getBoundingClientRect [function]
+window.Audio.prototype.getClientRects [function]
+window.Audio.prototype.getElementsByClassName [function]
+window.Audio.prototype.getElementsByTagName [function]
+window.Audio.prototype.getElementsByTagNameNS [function]
+window.Audio.prototype.hasAttribute [function]
+window.Audio.prototype.hasAttributeNS [function]
+window.Audio.prototype.hasAttributes [function]
+window.Audio.prototype.hasChildNodes [function]
+window.Audio.prototype.insertAdjacentElement [function]
+window.Audio.prototype.insertAdjacentHTML [function]
+window.Audio.prototype.insertAdjacentText [function]
+window.Audio.prototype.insertBefore [function]
+window.Audio.prototype.isDefaultNamespace [function]
+window.Audio.prototype.isEqualNode [function]
+window.Audio.prototype.isSameNode [function]
+window.Audio.prototype.isSupported [function]
+window.Audio.prototype.load [function]
+window.Audio.prototype.lookupNamespaceURI [function]
+window.Audio.prototype.lookupPrefix [function]
+window.Audio.prototype.normalize [function]
+window.Audio.prototype.pause [function]
+window.Audio.prototype.play [function]
+window.Audio.prototype.querySelector [function]
+window.Audio.prototype.querySelectorAll [function]
+window.Audio.prototype.removeAttribute [function]
+window.Audio.prototype.removeAttributeNS [function]
+window.Audio.prototype.removeAttributeNode [function]
+window.Audio.prototype.removeChild [function]
+window.Audio.prototype.removeEventListener [function]
+window.Audio.prototype.replaceChild [function]
+window.Audio.prototype.scrollByLines [function]
+window.Audio.prototype.scrollByPages [function]
+window.Audio.prototype.scrollIntoView [function]
+window.Audio.prototype.scrollIntoViewIfNeeded [function]
+window.Audio.prototype.setAttribute [function]
+window.Audio.prototype.setAttributeNS [function]
+window.Audio.prototype.setAttributeNode [function]
+window.Audio.prototype.setAttributeNodeNS [function]
 window.CDATASection [object CDATASectionConstructor]
 window.CDATASection.prototype [object CDATASectionPrototype]
 window.CDATASection.prototype.ATTRIBUTE_NODE [number]
@@ -782,7 +861,7 @@ window.HTMLAppletElement.prototype [printed above as window.Element.prototype]
 window.HTMLAreaElement [object HTMLAreaElementConstructor]
 window.HTMLAreaElement.prototype [printed above as window.Element.prototype]
 window.HTMLAudioElement [object HTMLAudioElementConstructor]
-window.HTMLAudioElement.prototype [printed above as window.Element.prototype]
+window.HTMLAudioElement.prototype [printed above as window.Audio.prototype]
 window.HTMLBRElement [object HTMLBRElementConstructor]
 window.HTMLBRElement.prototype [printed above as window.Element.prototype]
 window.HTMLBaseElement [object HTMLBaseElementConstructor]
@@ -912,6 +991,7 @@ 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 ImageConstructor]
+window.Image.prototype [printed above as window.Element.prototype]
 window.KeyboardEvent [object KeyboardEventConstructor]
 window.KeyboardEvent.prototype [printed above as window.Event.prototype]
 window.MediaError [object MediaErrorConstructor]
@@ -1049,6 +1129,7 @@ window.NodeList.prototype.item [function]
 window.Notation [object NotationConstructor]
 window.Notation.prototype [printed above as window.Node.prototype]
 window.Option [object OptionConstructor]
+window.Option.prototype [printed above as window.Element.prototype]
 window.OverflowEvent [object OverflowEventConstructor]
 window.OverflowEvent.BOTH [number]
 window.OverflowEvent.HORIZONTAL [number]
@@ -1354,6 +1435,14 @@ window.WebKitCSSKeyframeRule.prototype [printed above as window.CSSRule.prototyp
 window.WebKitCSSKeyframesRule [object WebKitCSSKeyframesRuleConstructor]
 window.WebKitCSSKeyframesRule.prototype [printed above as window.CSSRule.prototype]
 window.WebKitCSSMatrix [object WebKitCSSMatrixConstructor]
+window.WebKitCSSMatrix.prototype [object WebKitCSSMatrixPrototype]
+window.WebKitCSSMatrix.prototype.inverse [function]
+window.WebKitCSSMatrix.prototype.multiply [function]
+window.WebKitCSSMatrix.prototype.rotate [function]
+window.WebKitCSSMatrix.prototype.rotateAxisAngle [function]
+window.WebKitCSSMatrix.prototype.scale [function]
+window.WebKitCSSMatrix.prototype.setMatrixValue [function]
+window.WebKitCSSMatrix.prototype.translate [function]
 window.WebKitCSSTransformValue [object WebKitCSSTransformValueConstructor]
 window.WebKitCSSTransformValue.CSS_MATRIX [number]
 window.WebKitCSSTransformValue.CSS_MATRIX3D [number]
@@ -1378,11 +1467,18 @@ window.WebKitCSSTransformValue.CSS_TRANSLATEY [number]
 window.WebKitCSSTransformValue.CSS_TRANSLATEZ [number]
 window.WebKitCSSTransformValue.prototype [printed above as window.CSSValue.prototype]
 window.WebKitPoint [object WebKitPointConstructor]
+window.WebKitPoint.prototype [object WebKitPointPrototype]
 window.WebKitTransitionEvent [object WebKitTransitionEventConstructor]
 window.WebKitTransitionEvent.prototype [printed above as window.Event.prototype]
 window.WheelEvent [object WheelEventConstructor]
 window.WheelEvent.prototype [printed above as window.Event.prototype]
 window.Worker [object WorkerConstructor]
+window.Worker.prototype [object WorkerPrototype]
+window.Worker.prototype.addEventListener [function]
+window.Worker.prototype.dispatchEvent [function]
+window.Worker.prototype.postMessage [function]
+window.Worker.prototype.removeEventListener [function]
+window.Worker.prototype.terminate [function]
 window.XMLDocument [printed above as window.Document]
 window.XMLHttpRequest [object XMLHttpRequestConstructor]
 window.XMLHttpRequest.prototype [object XMLHttpRequestPrototype]
index 2592cf2b5491dc4b3964ee1a4065df03dc2f8c80..64f684d513f0530150967fb6af37bca0d7d45e5d 100644 (file)
@@ -1,3 +1,30 @@
+2009-03-02  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=24257
+
+        Added prototype properties for several classes with constructors that
+        were missing them, including the one mentioned in the bug.
+
+        Test: fast/dom/Window/custom-constructors.html
+
+        * bindings/js/JSAudioConstructor.cpp:
+        (WebCore::JSAudioConstructor::JSAudioConstructor):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (jsDOMWindowBaseWebKitCSSMatrix):
+        * bindings/js/JSImageConstructor.cpp:
+        (WebCore::JSImageConstructor::JSImageConstructor):
+        * bindings/js/JSOptionConstructor.cpp:
+        (WebCore::JSOptionConstructor::JSOptionConstructor):
+        * bindings/js/JSWebKitCSSMatrixConstructor.cpp:
+        (WebCore::JSWebKitCSSMatrixConstructor::JSWebKitCSSMatrixConstructor):
+        * bindings/js/JSWebKitCSSMatrixConstructor.h:
+        * bindings/js/JSWebKitPointConstructor.cpp:
+        (WebCore::JSWebKitPointConstructor::JSWebKitPointConstructor):
+        * bindings/js/JSWorkerConstructor.cpp:
+        (WebCore::JSWorkerConstructor::JSWorkerConstructor):
+
 2009-03-03  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Reviewed by Darin Fisher.
index f0bdbe8f634f3b0bd40ea5d5923ca1e8dc865f00..60f14a93f434f2112a1f13e2c17e5f961cdf0400 100644 (file)
@@ -47,6 +47,7 @@ JSAudioConstructor::JSAudioConstructor(ExecState* exec, ScriptExecutionContext*
     ASSERT(context->isDocument());
     m_document = static_cast<JSDocument*>(asObject(toJS(exec, static_cast<Document*>(context))));
 
+    putDirect(exec->propertyNames().prototype, JSHTMLAudioElementPrototype::self(exec), None);
     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
 }
 
index c234fbf21a06267d1d5a14417adb0c87273267cb..4157787cb0f025d673d936dd50ef75ffef4bf44e 100644 (file)
@@ -410,7 +410,7 @@ JSValuePtr jsDOMWindowBaseWebKitCSSMatrix(ExecState* exec, const Identifier&, co
 {
     if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
-    return getDOMConstructor<JSWebKitCSSMatrixConstructor>(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase())));
+    return getDOMConstructor<JSWebKitCSSMatrixConstructor>(exec);
 }
  
 JSValuePtr jsDOMWindowBaseXMLHttpRequest(ExecState* exec, const Identifier&, const PropertySlot& slot)
index 0dc55b42657f00e9abdcb78a0a4316da9b9147d4..0e0bb5f15eb94a5fd8345fbcde9ee80c2ce50e53 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
+#include "JSHTMLImageElement.h"
 #include "JSNode.h"
 #include "ScriptExecutionContext.h"
 
@@ -38,6 +39,7 @@ JSImageConstructor::JSImageConstructor(ExecState* exec, ScriptExecutionContext*
 {
     ASSERT(context->isDocument());
     m_document = static_cast<JSDocument*>(asObject(toJS(exec, static_cast<Document*>(context))));
+    putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec), None);
 }
 
 static JSObject* constructImage(ExecState* exec, JSObject* constructor, const ArgList& args)
index 4522dcf93eccb55179787d2e7597af81fafb1d92..2e9b19a151e1544e58ec0c11e75b9535217c56e0 100644 (file)
@@ -40,6 +40,7 @@ JSOptionConstructor::JSOptionConstructor(ExecState* exec, ScriptExecutionContext
     ASSERT(context->isDocument());
     m_document = static_cast<JSDocument*>(asObject(toJS(exec, static_cast<Document*>(context))));
 
+    putDirect(exec->propertyNames().prototype, JSHTMLOptionElementPrototype::self(exec), None);
     putDirect(exec->propertyNames().length, jsNumber(exec, 4), ReadOnly|DontDelete|DontEnum);
 }
 
index ba864eaaf812a89b2b2a8f80389f2eefe2e13aa1..3b97eb18fca9463b7c07a55c92655e70ea5a3703 100644 (file)
@@ -35,10 +35,10 @@ namespace WebCore {
 
 const ClassInfo JSWebKitCSSMatrixConstructor::s_info = { "WebKitCSSMatrixConstructor", 0, 0, 0 };
 
-JSWebKitCSSMatrixConstructor::JSWebKitCSSMatrixConstructor(ExecState* exec, ScriptExecutionContext* context)
+JSWebKitCSSMatrixConstructor::JSWebKitCSSMatrixConstructor(ExecState* exec)
     : DOMObject(JSWebKitCSSMatrixConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
 {
-    ASSERT_UNUSED(context, context->isDocument());
+    putDirect(exec->propertyNames().prototype, JSWebKitCSSMatrixPrototype::self(exec), None);
     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
 }
 
index b280241a4c2dbc0141d764592dbf2e95f849871d..d0e0bd1bee1683e32d533ae7f2a8363bf900bf41 100644 (file)
@@ -33,7 +33,7 @@ namespace WebCore {
 
 class JSWebKitCSSMatrixConstructor : public DOMObject {
 public:
-    JSWebKitCSSMatrixConstructor(JSC::ExecState*, ScriptExecutionContext*);
+    JSWebKitCSSMatrixConstructor(JSC::ExecState*);
     static const JSC::ClassInfo s_info;
 
 private:
index d57c362cb8d18578b6dec392d6f5680840c1bbca..c3a8ea6b93e05ac4b2409b985f151a6aaad2b893 100644 (file)
@@ -39,6 +39,7 @@ const ClassInfo JSWebKitPointConstructor::s_info = { "WebKitPointConstructor", 0
 JSWebKitPointConstructor::JSWebKitPointConstructor(ExecState* exec)
     : DOMObject(JSWebKitPointConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
 {
+    putDirect(exec->propertyNames().prototype, JSWebKitPointPrototype::self(exec), None);
     putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
 }
 
index 52147a2eecbdc38d2b4eace557be249514539b6d..a9f2f746af329bfef6827c66fba2cfc7fa1efce2 100644 (file)
@@ -44,6 +44,7 @@ const ClassInfo JSWorkerConstructor::s_info = { "WorkerConstructor", 0, 0, 0 };
 JSWorkerConstructor::JSWorkerConstructor(ExecState* exec)
     : DOMObject(JSWorkerConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
 {
+    putDirect(exec->propertyNames().prototype, JSWorkerPrototype::self(exec), None);
     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
 }