Changeset 212378 in webkit


Ignore:
Timestamp:
Feb 15, 2017 10:23:33 AM (7 years ago)
Author:
Chris Dumez
Message:

Expose Symbol.toPrimitive / valueOf on Location instances
https://bugs.webkit.org/show_bug.cgi?id=168295

Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.

LayoutTests/imported/w3c:

Import test coverage from upstream web-platform-tests.

  • web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive-expected.txt: Added.
  • web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html: Added.
  • web-platform-tests/html/browsers/history/the-location-interface/location-valueof-expected.txt: Added.
  • web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html: Added.
  • web-platform-tests/html/browsers/history/the-location-interface/w3c-import.log:

Source/JavaScriptCore:

Cache origin objectProtoValueOf function on JSGlobalObject.

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::objectProtoValueOfFunction):

Source/WebCore:

Expose Symbol.toPrimitive / valueOf on Location instances as per:

Firefox and Chrome already comply with the specification.

Tests: fast/dom/location-valueOf-after-object-prototype-update.html

fast/dom/location-valueOf-after-object-prototype-update2.html
imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

LayoutTests:

Add test coverage for cases where the Object prototype has been updated before
the Location object is constructed.

  • fast/dom/location-valueOf-after-object-prototype-update-expected.txt: Added.
  • fast/dom/location-valueOf-after-object-prototype-update.html: Added.
  • fast/dom/location-valueOf-after-object-prototype-update2-expected.txt: Added.
  • fast/dom/location-valueOf-after-object-prototype-update2.html: Added.
Location:
trunk
Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r212377 r212378  
     12017-02-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Expose Symbol.toPrimitive / valueOf on Location instances
     4        https://bugs.webkit.org/show_bug.cgi?id=168295
     5
     6        Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
     7
     8        Add test coverage for cases where the Object prototype has been updated before
     9        the Location object is constructed.
     10
     11        * fast/dom/location-valueOf-after-object-prototype-update-expected.txt: Added.
     12        * fast/dom/location-valueOf-after-object-prototype-update.html: Added.
     13        * fast/dom/location-valueOf-after-object-prototype-update2-expected.txt: Added.
     14        * fast/dom/location-valueOf-after-object-prototype-update2.html: Added.
     15
    1162017-02-15  Ryan Haddad  <ryanhaddad@apple.com>
    217
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r212355 r212378  
     12017-02-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Expose Symbol.toPrimitive / valueOf on Location instances
     4        https://bugs.webkit.org/show_bug.cgi?id=168295
     5
     6        Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
     7
     8        Import test coverage from upstream web-platform-tests.
     9
     10        * web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive-expected.txt: Added.
     11        * web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html: Added.
     12        * web-platform-tests/html/browsers/history/the-location-interface/location-valueof-expected.txt: Added.
     13        * web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html: Added.
     14        * web-platform-tests/html/browsers/history/the-location-interface/w3c-import.log:
     15
    1162017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
    217
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/w3c-import.log

    r210823 r212378  
    3030/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting.html
    3131/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-stringifier.html
     32/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
     33/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
    3234/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html
    3335/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_assign_about_blank.html
  • trunk/Source/JavaScriptCore/ChangeLog

    r212365 r212378  
     12017-02-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Expose Symbol.toPrimitive / valueOf on Location instances
     4        https://bugs.webkit.org/show_bug.cgi?id=168295
     5
     6        Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
     7
     8        Cache origin objectProtoValueOf function on JSGlobalObject.
     9
     10        * runtime/JSGlobalObject.cpp:
     11        (JSC::JSGlobalObject::init):
     12        * runtime/JSGlobalObject.h:
     13        (JSC::JSGlobalObject::objectProtoValueOfFunction):
     14
    1152017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>
    216
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r212365 r212378  
    459459    m_functionPrototype->structure()->setPrototypeWithoutTransition(vm, m_objectPrototype.get());
    460460    m_objectStructureForObjectConstructor.set(vm, this, vm.prototypeMap.emptyObjectStructureForPrototype(this, m_objectPrototype.get(), JSFinalObject::defaultInlineCapacity()));
     461    m_objectProtoValueOfFunction.set(vm, this, jsCast<JSFunction*>(objectPrototype()->getDirect(vm, vm.propertyNames->valueOf)));
    461462   
    462463    JSFunction* thrower = JSFunction::create(vm, this, 0, String(), globalFuncThrowTypeErrorArgumentsCalleeAndCaller);
     
    11941195    thisObject->m_initializePromiseFunction.visit(visitor);
    11951196    thisObject->m_iteratorProtocolFunction.visit(visitor);
     1197    visitor.append(thisObject->m_objectProtoValueOfFunction);
    11961198    visitor.append(thisObject->m_newPromiseCapabilityFunction);
    11971199    visitor.append(thisObject->m_functionProtoHasInstanceSymbolFunction);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r212365 r212378  
    262262    LazyProperty<JSGlobalObject, JSFunction> m_initializePromiseFunction;
    263263    LazyProperty<JSGlobalObject, JSFunction> m_iteratorProtocolFunction;
     264    WriteBarrier<JSFunction> m_objectProtoValueOfFunction;
    264265    WriteBarrier<JSFunction> m_newPromiseCapabilityFunction;
    265266    WriteBarrier<JSFunction> m_functionProtoHasInstanceSymbolFunction;
     
    509510    JSFunction* initializePromiseFunction() const { return m_initializePromiseFunction.get(this); }
    510511    JSFunction* iteratorProtocolFunction() const { return m_iteratorProtocolFunction.get(this); }
     512    JSFunction* objectProtoValueOfFunction() const { return m_objectProtoValueOfFunction.get(); }
    511513    JSFunction* newPromiseCapabilityFunction() const { return m_newPromiseCapabilityFunction.get(); }
    512514    JSFunction* functionProtoHasInstanceSymbolFunction() const { return m_functionProtoHasInstanceSymbolFunction.get(); }
  • trunk/Source/WebCore/ChangeLog

    r212376 r212378  
     12017-02-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Expose Symbol.toPrimitive / valueOf on Location instances
     4        https://bugs.webkit.org/show_bug.cgi?id=168295
     5
     6        Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
     7
     8        Expose Symbol.toPrimitive / valueOf on Location instances as per:
     9        - https://html.spec.whatwg.org/#the-location-interface
     10
     11        Firefox and Chrome already comply with the specification.
     12
     13        Tests: fast/dom/location-valueOf-after-object-prototype-update.html
     14               fast/dom/location-valueOf-after-object-prototype-update2.html
     15               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
     16               imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
     17
     18        * bindings/scripts/CodeGeneratorJS.pm:
     19        (GenerateImplementation):
     20
    1212017-02-15  Aakash Jain  <aakash_jain@apple.com>
    222
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r212344 r212378  
    34303430    }
    34313431
     3432    if ($interfaceName eq "Location") {
     3433        push(@implContent, "    putDirect(vm, vm.propertyNames->valueOf, globalObject()->objectProtoValueOfFunction(), DontDelete | ReadOnly | DontEnum);\n");
     3434        push(@implContent, "    putDirect(vm, vm.propertyNames->toPrimitiveSymbol, jsUndefined(), DontDelete | ReadOnly | DontEnum);\n");
     3435    }
     3436
    34323437    # Support for RuntimeEnabled attributes on instances.
    34333438    foreach my $attribute (@{$interface->attributes}) {
Note: See TracChangeset for help on using the changeset viewer.