Changeset 203845 in webkit


Ignore:
Timestamp:
Jul 28, 2016 3:05:49 PM (8 years ago)
Author:
Chris Dumez
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:

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:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r203840 r203845  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
     4        https://bugs.webkit.org/show_bug.cgi?id=160312
     5
     6        Reviewed by Darin Adler.
     7
     8        Update existing test to reflect behavior change.
     9
     10        * fast/canvas/webgl/canvas-supports-context-expected.txt:
     11        * fast/canvas/webgl/canvas-supports-context.html:
     12
    1132016-07-28  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context-expected.txt

    r202609 r203845  
    113113
    114114Testing how probablySupportsContext handles no parameters
    115 PASS document.createElement('canvas').probablySupportsContext() is false
     115PASS document.createElement('canvas').probablySupportsContext() threw exception TypeError: Not enough arguments.
    116116
    117117PASS successfullyParsed is true
  • trunk/LayoutTests/fast/canvas/webgl/canvas-supports-context.html

    r177772 r203845  
    159159    debug("");
    160160    debug("Testing how probablySupportsContext handles no parameters");
    161     shouldBeFalse("document.createElement('canvas').probablySupportsContext()");
     161    shouldThrow("document.createElement('canvas').probablySupportsContext()");
    162162
    163163    debug("");
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r203840 r203845  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
     4        https://bugs.webkit.org/show_bug.cgi?id=160312
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline several W3C tests now that more checks are passing.
     9
     10        * web-platform-tests/html/dom/interfaces-expected.txt:
     11        * web-platform-tests/html/semantics/embedded-content/the-canvas-element/context.arguments.missing-expected.txt:
     12
    1132016-07-28  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r203840 r203845  
    48044804PASS HTMLCanvasElement interface: attribute width
    48054805PASS HTMLCanvasElement interface: attribute height
    4806 FAIL HTMLCanvasElement interface: operation getContext(DOMString,any) assert_equals: property has wrong .length expected 1 but got 0
    4807 FAIL HTMLCanvasElement interface: operation probablySupportsContext(DOMString,any) assert_equals: property has wrong .length expected 1 but got 0
     4806PASS HTMLCanvasElement interface: operation getContext(DOMString,any)
     4807PASS HTMLCanvasElement interface: operation probablySupportsContext(DOMString,any)
    48084808FAIL HTMLCanvasElement interface: operation setContext(RenderingContext) assert_own_property: interface prototype object missing non-static operation expected property "setContext" missing
    48094809FAIL HTMLCanvasElement interface: operation transferControlToProxy() assert_own_property: interface prototype object missing non-static operation expected property "transferControlToProxy" missing
     
    48154815PASS HTMLCanvasElement interface: document.createElement("canvas") must inherit property "height" with the proper type (1)
    48164816PASS HTMLCanvasElement interface: document.createElement("canvas") must inherit property "getContext" with the proper type (2)
    4817 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 () {
    4818             fn.apply(obj, args);
    4819         }" did not throw
     4817PASS HTMLCanvasElement interface: calling getContext(DOMString,any) on document.createElement("canvas") with too few arguments must throw TypeError
    48204818PASS HTMLCanvasElement interface: document.createElement("canvas") must inherit property "probablySupportsContext" with the proper type (3)
    4821 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 () {
    4822             fn.apply(obj, args);
    4823         }" did not throw
     4819PASS HTMLCanvasElement interface: calling probablySupportsContext(DOMString,any) on document.createElement("canvas") with too few arguments must throw TypeError
    48244820FAIL HTMLCanvasElement interface: document.createElement("canvas") must inherit property "setContext" with the proper type (4) assert_inherits: property "setContext" not found in prototype chain
    48254821FAIL 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
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/context.arguments.missing-expected.txt

    r189476 r203845  
    33Actual output:
    44
    5 FAIL Canvas test: context.arguments.missing assert_throws: function "function () { canvas.getContext(); }" did not throw
     5PASS Canvas test: context.arguments.missing
    66
  • trunk/Source/WebCore/ChangeLog

    r203840 r203845  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
     4        https://bugs.webkit.org/show_bug.cgi?id=160312
     5
     6        Reviewed by Darin Adler.
     7
     8        First parameter to canvas.getContext() / probablySupportsContext()
     9        should be mandatory:
     10        - http://w3c.github.io/html/semantics-scripting.html#the-canvas-element
     11
     12        Firefox and Chrome agree with the specification for getContext().
     13        Neither of them supports probablySupportsContext().
     14
     15        No new tests, rebaselined existing tests.
     16
     17        * bindings/js/JSHTMLCanvasElementCustom.cpp:
     18        (WebCore::JSHTMLCanvasElement::getContext):
     19        (WebCore::JSHTMLCanvasElement::probablySupportsContext):
     20        * html/HTMLCanvasElement.idl:
     21
    1222016-07-28  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp

    r200775 r203845  
    7070JSValue JSHTMLCanvasElement::getContext(ExecState& state)
    7171{
     72    if (UNLIKELY(state.argumentCount() < 1))
     73        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
     74
    7275    HTMLCanvasElement& canvas = wrapped();
    73     const String& contextId = state.argument(0).toString(&state)->value(&state);
     76    const String& contextId = state.uncheckedArgument(0).toWTFString(&state);
    7477   
    7578    RefPtr<CanvasContextAttributes> attrs;
     
    9093JSValue JSHTMLCanvasElement::probablySupportsContext(ExecState& state)
    9194{
     95    if (UNLIKELY(state.argumentCount() < 1))
     96        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
     97
    9298    HTMLCanvasElement& canvas = wrapped();
    93     if (!state.argumentCount())
    94         return jsBoolean(false);
    95     const String& contextId = state.uncheckedArgument(0).toString(&state)->value(&state);
     99    const String& contextId = state.uncheckedArgument(0).toWTFString(&state);
    96100    if (state.hadException())
    97101        return jsUndefined();
  • trunk/Source/WebCore/html/HTMLCanvasElement.idl

    r202394 r203845  
    4242#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
    4343    // The custom binding is needed to handle context creation attributes.
    44     [Custom] any getContext(optional DOMString contextId);
    45     [Custom] any probablySupportsContext(optional DOMString contextId);
     44    [Custom] any getContext(DOMString contextId, any... arguments);
     45    [Custom] boolean probablySupportsContext(DOMString contextId, any... arguments);
    4646#endif
    4747
  • trunk/Source/WebInspectorUI/ChangeLog

    r203844 r203845  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        First parameter to canvas.getContext() / probablySupportsContext() should be mandatory
     4        https://bugs.webkit.org/show_bug.cgi?id=160312
     5
     6        Reviewed by Darin Adler.
     7
     8        Update WebInspector accordingly.
     9
     10        * UserInterface/Models/NativeFunctionParameters.js:
     11
    1122016-07-28  Matt Baker  <mattbaker@apple.com>
    213
  • trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js

    r203840 r203845  
    872872
    873873    HTMLCanvasElement: {
    874         getContext: "[contextId]",
    875         probablySupportsContext: "[contextId]",
     874        getContext: "contextId",
     875        probablySupportsContext: "contextId",
    876876        toDataURL: "[type]",
    877877        __proto__: null,
Note: See TracChangeset for help on using the changeset viewer.