Changeset 203849 in webkit


Ignore:
Timestamp:
Jul 28, 2016 4:29:37 PM (8 years ago)
Author:
Chris Dumez
Message:

window.open.length should be 0
https://bugs.webkit.org/show_bug.cgi?id=160323

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

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

Source/WebCore:

window.open.length should be 0 as all its parameters are optional:

It is 2 in WebKit. Firefox and Chrome agree with the specification and return 0.

No new tests, rebaselined existing test.

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::open):
Minor code optimization.

  • page/DOMWindow.idl:

Update IDL to match the specification and our custom implementation.
This makes us return the right "length" value.

LayoutTests:

Update existing test to reflect behavior change.

  • js/dom/function-length-expected.txt:
  • js/dom/function-length.html:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r203848 r203849  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        window.open.length should be 0
     4        https://bugs.webkit.org/show_bug.cgi?id=160323
     5
     6        Reviewed by Darin Adler.
     7
     8        Update existing test to reflect behavior change.
     9
     10        * js/dom/function-length-expected.txt:
     11        * js/dom/function-length.html:
     12
    1132016-07-28  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r203848 r203849  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        window.open.length should be 0
     4        https://bugs.webkit.org/show_bug.cgi?id=160323
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline W3C test now that one more check is 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

    r203848 r203849  
    51825182PASS Window interface: attribute parent
    51835183PASS Window interface: attribute frameElement
    5184 FAIL Window interface: operation open(DOMString,DOMString,DOMString,boolean) assert_equals: property has wrong .length expected 0 but got 2
     5184PASS Window interface: operation open(DOMString,DOMString,DOMString,boolean)
    51855185PASS Window interface: attribute navigator
    51865186FAIL Window interface: attribute external assert_own_property: The global object must have a property "external" expected property "external" missing
  • trunk/LayoutTests/js/dom/function-length-expected.txt

    r156066 r203849  
    55
    66PASS window.confirm.length is 0
    7 PASS window.open.length is 2
     7PASS window.open.length is 0
    88PASS window.showModalDialog.length is 1
    99PASS window.setTimeout.length is 1
  • trunk/LayoutTests/js/dom/function-length.html

    r156066 r203849  
    99
    1010shouldBe('window.confirm.length', '0');
    11 shouldBe('window.open.length', '2');
     11shouldBe('window.open.length', '0');
    1212shouldBe('window.showModalDialog.length', '1');
    1313shouldBe('window.setTimeout.length', '1');
  • trunk/Source/WebCore/ChangeLog

    r203848 r203849  
     12016-07-28  Chris Dumez  <cdumez@apple.com>
     2
     3        window.open.length should be 0
     4        https://bugs.webkit.org/show_bug.cgi?id=160323
     5
     6        Reviewed by Darin Adler.
     7
     8        window.open.length should be 0 as all its parameters are optional:
     9        - https://html.spec.whatwg.org/multipage/browsers.html#the-window-object
     10
     11        It is 2 in WebKit. Firefox and Chrome agree with the specification and return 0.
     12
     13        No new tests, rebaselined existing test.
     14
     15        * bindings/js/JSDOMWindowCustom.cpp:
     16        (WebCore::JSDOMWindow::open):
     17        Minor code optimization.
     18
     19        * page/DOMWindow.idl:
     20        Update IDL to match the specification and our custom implementation.
     21        This makes us return the right "length" value.
     22
    1232016-07-28  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r203846 r203849  
    445445    if (state.hadException())
    446446        return jsUndefined();
    447     AtomicString frameName = state.argument(1).isUndefinedOrNull() ? "_blank" : state.argument(1).toString(&state)->value(&state);
     447    JSValue targetValue = state.argument(1);
     448    AtomicString target = targetValue.isUndefinedOrNull() ? AtomicString("_blank", AtomicString::ConstructFromLiteral) : targetValue.toString(&state)->toAtomicString(&state);
    448449    if (state.hadException())
    449450        return jsUndefined();
     
    452453        return jsUndefined();
    453454
    454     RefPtr<DOMWindow> openedWindow = wrapped().open(urlString, frameName, windowFeaturesString, activeDOMWindow(&state), firstDOMWindow(&state));
     455    RefPtr<DOMWindow> openedWindow = wrapped().open(urlString, target, windowFeaturesString, activeDOMWindow(&state), firstDOMWindow(&state));
    455456    if (!openedWindow)
    456457        return jsUndefined();
  • trunk/Source/WebCore/page/DOMWindow.idl

    r203623 r203849  
    6666    void stop();
    6767
    68     [Custom] DOMWindow open(DOMString url,
    69                             DOMString name,
    70                             optional DOMString options);
     68    [Custom] DOMWindow open(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "");
    7169
    7270    [Custom] any showModalDialog(DOMString url,
Note: See TracChangeset for help on using the changeset viewer.