Changeset 203831 in webkit


Ignore:
Timestamp:
Jul 28, 2016 1:18:42 PM (8 years ago)
Author:
Chris Dumez
Message:

[Bindings] "length" value of overloaded operations may be wrong
https://bugs.webkit.org/show_bug.cgi?id=160303

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

  • web-platform-tests/html/dom/interfaces-expected.txt:

Source/WebCore:

"length" value of overloaded operations may be wrong because we fail to
account for overloads when computing the length of a function:

No new tests, rebaselined existing test.

  • bindings/scripts/CodeGeneratorJS.pm:

(GetFunctionLength):

  • bindings/scripts/test/JS/JSTestObj.cpp:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r203820 r203831  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        [Bindings] "length" value of overloaded operations may be wrong
     4        https://bugs.webkit.org/show_bug.cgi?id=160303
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Rebaseline W3C test now that more checks are passing.
     9
     10        * web-platform-tests/html/dom/interfaces-expected.txt:
     11
    1122016-07-28  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r203820 r203831  
    49054905PASS CanvasRenderingContext2D interface: operation strokeRect(unrestricted double,unrestricted double,unrestricted double,unrestricted double)
    49064906PASS CanvasRenderingContext2D interface: operation beginPath()
    4907 FAIL CanvasRenderingContext2D interface: operation fill(CanvasFillRule) assert_equals: property has wrong .length expected 0 but got 1
    4908 FAIL CanvasRenderingContext2D interface: operation fill(Path2D,CanvasFillRule) assert_equals: property has wrong .length expected 0 but got 1
    4909 FAIL CanvasRenderingContext2D interface: operation stroke() assert_equals: property has wrong .length expected 0 but got 1
    4910 FAIL CanvasRenderingContext2D interface: operation stroke(Path2D) assert_equals: property has wrong .length expected 0 but got 1
     4907PASS CanvasRenderingContext2D interface: operation fill(CanvasFillRule)
     4908PASS CanvasRenderingContext2D interface: operation fill(Path2D,CanvasFillRule)
     4909PASS CanvasRenderingContext2D interface: operation stroke()
     4910PASS CanvasRenderingContext2D interface: operation stroke(Path2D)
    49114911FAIL CanvasRenderingContext2D interface: operation drawSystemFocusRing(Element) assert_own_property: interface prototype object missing non-static operation expected property "drawSystemFocusRing" missing
    49124912FAIL CanvasRenderingContext2D interface: operation drawSystemFocusRing(Path2D,Element) assert_own_property: interface prototype object missing non-static operation expected property "drawSystemFocusRing" missing
     
    49154915FAIL CanvasRenderingContext2D interface: operation scrollPathIntoView() assert_own_property: interface prototype object missing non-static operation expected property "scrollPathIntoView" missing
    49164916FAIL CanvasRenderingContext2D interface: operation scrollPathIntoView(Path2D) assert_own_property: interface prototype object missing non-static operation expected property "scrollPathIntoView" missing
    4917 FAIL CanvasRenderingContext2D interface: operation clip(CanvasFillRule) assert_equals: property has wrong .length expected 0 but got 1
    4918 FAIL CanvasRenderingContext2D interface: operation clip(Path2D,CanvasFillRule) assert_equals: property has wrong .length expected 0 but got 1
     4917PASS CanvasRenderingContext2D interface: operation clip(CanvasFillRule)
     4918PASS CanvasRenderingContext2D interface: operation clip(Path2D,CanvasFillRule)
    49194919FAIL CanvasRenderingContext2D interface: operation resetClip() assert_own_property: interface prototype object missing non-static operation expected property "resetClip" missing
    4920 FAIL CanvasRenderingContext2D interface: operation isPointInPath(unrestricted double,unrestricted double,CanvasFillRule) assert_equals: property has wrong .length expected 2 but got 3
    4921 FAIL CanvasRenderingContext2D interface: operation isPointInPath(Path2D,unrestricted double,unrestricted double,CanvasFillRule) assert_equals: property has wrong .length expected 2 but got 3
    4922 FAIL CanvasRenderingContext2D interface: operation isPointInStroke(unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 2 but got 3
    4923 FAIL CanvasRenderingContext2D interface: operation isPointInStroke(Path2D,unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 2 but got 3
     4920PASS CanvasRenderingContext2D interface: operation isPointInPath(unrestricted double,unrestricted double,CanvasFillRule)
     4921PASS CanvasRenderingContext2D interface: operation isPointInPath(Path2D,unrestricted double,unrestricted double,CanvasFillRule)
     4922PASS CanvasRenderingContext2D interface: operation isPointInStroke(unrestricted double,unrestricted double)
     4923PASS CanvasRenderingContext2D interface: operation isPointInStroke(Path2D,unrestricted double,unrestricted double)
    49244924PASS CanvasRenderingContext2D interface: operation fillText(DOMString,unrestricted double,unrestricted double,unrestricted double)
    49254925PASS CanvasRenderingContext2D interface: operation strokeText(DOMString,unrestricted double,unrestricted double,unrestricted double)
  • trunk/Source/WebCore/ChangeLog

    r203826 r203831  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        [Bindings] "length" value of overloaded operations may be wrong
     4        https://bugs.webkit.org/show_bug.cgi?id=160303
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        "length" value of overloaded operations may be wrong because we fail to
     9        account for overloads when computing the length of a function:
     10        - https://heycam.github.io/webidl/#es-operations
     11
     12        No new tests, rebaselined existing test.
     13
     14        * bindings/scripts/CodeGeneratorJS.pm:
     15        (GetFunctionLength):
     16        * bindings/scripts/test/JS/JSTestObj.cpp:
     17
    1182016-07-28  George Ruan  <gruan@apple.com>
    219
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r203707 r203831  
    17081708    my $function = shift;
    17091709
    1710     my $length = 0;
    1711     foreach my $parameter (@{$function->parameters}) {
    1712         # Abort as soon as we find the first optional parameter as no mandatory
    1713         # parameter can follow an optional one.
    1714         last if $parameter->isOptional || $parameter->isVariadic;
    1715         $length++;
     1710    my $getOverloadLength = sub {
     1711        my $function = shift;
     1712
     1713        my $length = 0;
     1714        foreach my $parameter (@{$function->parameters}) {
     1715            last if $parameter->isOptional || $parameter->isVariadic;
     1716            $length++;
     1717        }
     1718        return $length;
     1719    };
     1720
     1721    my $length = &$getOverloadLength($function);
     1722    foreach my $overload (@{$function->{overloads}}) {
     1723        my $newLength = &$getOverloadLength($overload);
     1724        $length = $newLength if $newLength < $length;
    17161725    }
    17171726    return $length;
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r203337 r203831  
    12491249    { 0, 0, NoIntrinsic, { 0, 0 } },
    12501250#endif
    1251     { "overloadedMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t) (2) } },
     1251    { "overloadedMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t) (0) } },
    12521252    { "overloadedMethodWithOptionalParameter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter), (intptr_t) (1) } },
    12531253    { "classMethodWithClamp", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithClamp), (intptr_t) (2) } },
Note: See TracChangeset for help on using the changeset viewer.