Title: [203845] trunk
Revision
203845
Author
[email protected]
Date
2016-07-28 15:05:49 -0700 (Thu, 28 Jul 2016)

Log Message

First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160312

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

* web-platform-tests/html/dom/interfaces-expected.txt:
* web-platform-tests/html/semantics/embedded-content/the-canvas-element/context.arguments.missing-expected.txt:

Source/WebCore:

First parameter to canvas.getContext() / probablySupportsContext()
should be mandatory:
- http://w3c.github.io/html/semantics-scripting.html#the-canvas-element

Firefox and Chrome agree with the specification for getContext().
Neither of them supports probablySupportsContext().

No new tests, rebaselined existing tests.

* bindings/js/JSHTMLCanvasElementCustom.cpp:
(WebCore::JSHTMLCanvasElement::getContext):
(WebCore::JSHTMLCanvasElement::probablySupportsContext):
* html/HTMLCanvasElement.idl:

Source/WebInspectorUI:

Update WebInspector accordingly.

* UserInterface/Models/NativeFunctionParameters.js:

LayoutTests:

Update existing test to reflect behavior change.

* fast/canvas/webgl/canvas-supports-context-expected.txt:
* fast/canvas/webgl/canvas-supports-context.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203844 => 203845)


--- trunk/LayoutTests/ChangeLog	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/LayoutTests/ChangeLog	2016-07-28 22:05:49 UTC (rev 203845)
@@ -1,5 +1,17 @@
 2016-07-28  Chris Dumez  <[email protected]>
 
+        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160312
+
+        Reviewed by Darin Adler.
+
+        Update existing test to reflect behavior change.
+
+        * fast/canvas/webgl/canvas-supports-context-expected.txt:
+        * fast/canvas/webgl/canvas-supports-context.html:
+
+2016-07-28  Chris Dumez  <[email protected]>
+
         Parameter to table.deleteRow() / body.deleteRow() should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=160307
 

Modified: trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context-expected.txt (203844 => 203845)


--- trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context-expected.txt	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context-expected.txt	2016-07-28 22:05:49 UTC (rev 203845)
@@ -112,7 +112,7 @@
 FAIL getContext('webkit-3d' ,{ get preserveDrawingBUffer() { throw 'Test preserveDrawingBuffer Error'; } }) returns false (context does not exist)
 
 Testing how probablySupportsContext handles no parameters
-PASS document.createElement('canvas').probablySupportsContext() is false
+PASS document.createElement('canvas').probablySupportsContext() threw exception TypeError: Not enough arguments.
 
 PASS successfullyParsed is true
 Some tests failed.

Modified: trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context.html (203844 => 203845)


--- trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context.html	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context.html	2016-07-28 22:05:49 UTC (rev 203845)
@@ -158,7 +158,7 @@
 
     debug("");
     debug("Testing how probablySupportsContext handles no parameters");
-    shouldBeFalse("document.createElement('canvas').probablySupportsContext()");
+    shouldThrow("document.createElement('canvas').probablySupportsContext()");
 
     debug("");
 }
@@ -166,4 +166,4 @@
 run_tests();
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203844 => 203845)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-28 22:05:49 UTC (rev 203845)
@@ -1,5 +1,17 @@
 2016-07-28  Chris Dumez  <[email protected]>
 
+        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160312
+
+        Reviewed by Darin Adler.
+
+        Rebaseline several W3C tests now that more checks are passing.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+        * web-platform-tests/html/semantics/embedded-content/the-canvas-element/context.arguments.missing-expected.txt:
+
+2016-07-28  Chris Dumez  <[email protected]>
+
         Parameter to table.deleteRow() / body.deleteRow() should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=160307
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (203844 => 203845)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-28 22:05:49 UTC (rev 203845)
@@ -4803,8 +4803,8 @@
 PASS HTMLCanvasElement interface: existence and properties of interface prototype object's "constructor" property 
 PASS HTMLCanvasElement interface: attribute width 
 PASS HTMLCanvasElement interface: attribute height 
-FAIL HTMLCanvasElement interface: operation getContext(DOMString,any) assert_equals: property has wrong .length expected 1 but got 0
-FAIL HTMLCanvasElement interface: operation probablySupportsContext(DOMString,any) assert_equals: property has wrong .length expected 1 but got 0
+PASS HTMLCanvasElement interface: operation getContext(DOMString,any) 
+PASS HTMLCanvasElement interface: operation probablySupportsContext(DOMString,any) 
 FAIL HTMLCanvasElement interface: operation setContext(RenderingContext) assert_own_property: interface prototype object missing non-static operation expected property "setContext" missing
 FAIL HTMLCanvasElement interface: operation transferControlToProxy() assert_own_property: interface prototype object missing non-static operation expected property "transferControlToProxy" missing
 PASS HTMLCanvasElement interface: operation toDataURL(DOMString,any) 
@@ -4814,13 +4814,9 @@
 PASS HTMLCanvasElement interface: document.createElement("canvas") must inherit property "width" with the proper type (0) 
 PASS HTMLCanvasElement interface: document.createElement("canvas") must inherit property "height" with the proper type (1) 
 PASS HTMLCanvasElement interface: document.createElement("canvas") must inherit property "getContext" with the proper type (2) 
-FAIL HTMLCanvasElement interface: calling getContext(DOMString,any) on document.createElement("canvas") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS HTMLCanvasElement interface: calling getContext(DOMString,any) on document.createElement("canvas") with too few arguments must throw TypeError 
 PASS HTMLCanvasElement interface: document.createElement("canvas") must inherit property "probablySupportsContext" with the proper type (3) 
-FAIL HTMLCanvasElement interface: calling probablySupportsContext(DOMString,any) on document.createElement("canvas") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS HTMLCanvasElement interface: calling probablySupportsContext(DOMString,any) on document.createElement("canvas") with too few arguments must throw TypeError 
 FAIL HTMLCanvasElement interface: document.createElement("canvas") must inherit property "setContext" with the proper type (4) assert_inherits: property "setContext" not found in prototype chain
 FAIL HTMLCanvasElement interface: calling setContext(RenderingContext) on document.createElement("canvas") with too few arguments must throw TypeError assert_inherits: property "setContext" not found in prototype chain
 FAIL HTMLCanvasElement interface: document.createElement("canvas") must inherit property "transferControlToProxy" with the proper type (5) assert_inherits: property "transferControlToProxy" not found in prototype chain

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/context.arguments.missing-expected.txt (203844 => 203845)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/context.arguments.missing-expected.txt	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/context.arguments.missing-expected.txt	2016-07-28 22:05:49 UTC (rev 203845)
@@ -2,5 +2,5 @@
 Defined in "Web IDL" (draft)
 Actual output:
 
-FAIL Canvas test: context.arguments.missing assert_throws: function "function () { canvas.getContext(); }" did not throw
+PASS Canvas test: context.arguments.missing 
 

Modified: trunk/Source/WebCore/ChangeLog (203844 => 203845)


--- trunk/Source/WebCore/ChangeLog	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/Source/WebCore/ChangeLog	2016-07-28 22:05:49 UTC (rev 203845)
@@ -1,5 +1,26 @@
 2016-07-28  Chris Dumez  <[email protected]>
 
+        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160312
+
+        Reviewed by Darin Adler.
+
+        First parameter to canvas.getContext() / probablySupportsContext()
+        should be mandatory:
+        - http://w3c.github.io/html/semantics-scripting.html#the-canvas-element
+
+        Firefox and Chrome agree with the specification for getContext().
+        Neither of them supports probablySupportsContext().
+
+        No new tests, rebaselined existing tests.
+
+        * bindings/js/JSHTMLCanvasElementCustom.cpp:
+        (WebCore::JSHTMLCanvasElement::getContext):
+        (WebCore::JSHTMLCanvasElement::probablySupportsContext):
+        * html/HTMLCanvasElement.idl:
+
+2016-07-28  Chris Dumez  <[email protected]>
+
         Parameter to table.deleteRow() / body.deleteRow() should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=160307
 

Modified: trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp (203844 => 203845)


--- trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp	2016-07-28 22:05:49 UTC (rev 203845)
@@ -69,8 +69,11 @@
 
 JSValue JSHTMLCanvasElement::getContext(ExecState& state)
 {
+    if (UNLIKELY(state.argumentCount() < 1))
+        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
     HTMLCanvasElement& canvas = wrapped();
-    const String& contextId = state.argument(0).toString(&state)->value(&state);
+    const String& contextId = state.uncheckedArgument(0).toWTFString(&state);
     
     RefPtr<CanvasContextAttributes> attrs;
 #if ENABLE(WEBGL)
@@ -89,10 +92,11 @@
 
 JSValue JSHTMLCanvasElement::probablySupportsContext(ExecState& state)
 {
+    if (UNLIKELY(state.argumentCount() < 1))
+        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
     HTMLCanvasElement& canvas = wrapped();
-    if (!state.argumentCount())
-        return jsBoolean(false);
-    const String& contextId = state.uncheckedArgument(0).toString(&state)->value(&state);
+    const String& contextId = state.uncheckedArgument(0).toWTFString(&state);
     if (state.hadException())
         return jsUndefined();
     

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.idl (203844 => 203845)


--- trunk/Source/WebCore/html/HTMLCanvasElement.idl	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.idl	2016-07-28 22:05:49 UTC (rev 203845)
@@ -41,8 +41,8 @@
 
 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
     // The custom binding is needed to handle context creation attributes.
-    [Custom] any getContext(optional DOMString contextId);
-    [Custom] any probablySupportsContext(optional DOMString contextId);
+    [Custom] any getContext(DOMString contextId, any... arguments);
+    [Custom] boolean probablySupportsContext(DOMString contextId, any... arguments);
 #endif
 
 };

Modified: trunk/Source/WebInspectorUI/ChangeLog (203844 => 203845)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-07-28 22:05:49 UTC (rev 203845)
@@ -1,3 +1,14 @@
+2016-07-28  Chris Dumez  <[email protected]>
+
+        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160312
+
+        Reviewed by Darin Adler.
+
+        Update WebInspector accordingly.
+
+        * UserInterface/Models/NativeFunctionParameters.js:
+
 2016-07-28  Matt Baker  <[email protected]>
 
         Web Inspector: Hiding a column which contains a TimelineRuler as the headerview, doesn't hide the headerView

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (203844 => 203845)


--- trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js	2016-07-28 21:51:50 UTC (rev 203844)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js	2016-07-28 22:05:49 UTC (rev 203845)
@@ -871,8 +871,8 @@
     },
 
     HTMLCanvasElement: {
-        getContext: "[contextId]",
-        probablySupportsContext: "[contextId]",
+        getContext: "contextId",
+        probablySupportsContext: "contextId",
         toDataURL: "[type]",
         __proto__: null,
     },
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to