Diff
Modified: trunk/LayoutTests/ChangeLog (212377 => 212378)
--- trunk/LayoutTests/ChangeLog 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/LayoutTests/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
@@ -1,3 +1,18 @@
+2017-02-15 Chris Dumez <cdu...@apple.com>
+
+ 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.
+
+ 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.
+
2017-02-15 Ryan Haddad <ryanhad...@apple.com>
Mark media/modern-media-controls/media-controller/media-controller-resize.html as flaky.
Added: trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update-expected.txt (0 => 212378)
--- trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update-expected.txt 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,10 @@
+Tests the value of location.valueOf after Object.prototype.valueOf has been deleted.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS location.valueOf is objectProtoValueOf
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update.html (0 => 212378)
--- trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update.html (rev 0)
+++ trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update.html 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests the value of location.valueOf after Object.prototype.valueOf has been deleted.");
+
+var objectProtoValueOf = Object.prototype.valueOf;
+delete Object.prototype.valueOf;
+shouldBe("location.valueOf", "objectProtoValueOf");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update2-expected.txt (0 => 212378)
--- trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update2-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update2-expected.txt 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,10 @@
+Tests the value of location.valueOf after Object.prototype.valueOf has been replaced.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS location.valueOf is objectProtoValueOf
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update2.html (0 => 212378)
--- trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update2.html (rev 0)
+++ trunk/LayoutTests/fast/dom/location-valueOf-after-object-prototype-update2.html 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests the value of location.valueOf after Object.prototype.valueOf has been replaced.");
+
+var objectProtoValueOf = Object.prototype.valueOf;
+delete Object.prototype.valueOf;
+Object.defineProperty(Object.prototype, "valueOf", {value: 3});
+shouldBe("location.valueOf", "objectProtoValueOf");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (212377 => 212378)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
@@ -1,3 +1,18 @@
+2017-02-15 Chris Dumez <cdu...@apple.com>
+
+ 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.
+
+ 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:
+
2017-02-15 Carlos Garcia Campos <cgar...@igalia.com>
REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive-expected.txt (0 => 212378)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive-expected.txt 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,3 @@
+
+PASS Location Symbol.toPrimitive
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html (0 => 212378)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<title>Location Symbol.toPrimitive</title>
+<script src=""
+<script src=""
+<div id=log></div>
+<script>
+test(() => {
+ assert_equals(location[Symbol.toPrimitive], undefined)
+ const prop = Object.getOwnPropertyDescriptor(location, Symbol.toPrimitive)
+ assert_false(prop.enumerable)
+ assert_false(prop.writable)
+ assert_false(prop.configurable)
+})
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof-expected.txt (0 => 212378)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof-expected.txt 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,3 @@
+
+PASS Location valueOf
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html (0 => 212378)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html 2017-02-15 18:23:33 UTC (rev 212378)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<title>Location valueOf</title>
+<script src=""
+<script src=""
+<div id=log></div>
+<script>
+test(() => {
+ assert_equals(location.valueOf, Object.prototype.valueOf)
+ assert_equals(typeof location.valueOf.call(5), "object")
+ const prop = Object.getOwnPropertyDescriptor(location, "valueOf")
+ assert_false(prop.enumerable)
+ assert_false(prop.writable)
+ assert_false(prop.configurable)
+})
+</script>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/w3c-import.log (212377 => 212378)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/w3c-import.log 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/w3c-import.log 2017-02-15 18:23:33 UTC (rev 212378)
@@ -29,6 +29,8 @@
/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter.html
/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting.html
/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-stringifier.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html
/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_assign_about_blank.html
/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash.html
Modified: trunk/Source/_javascript_Core/ChangeLog (212377 => 212378)
--- trunk/Source/_javascript_Core/ChangeLog 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
@@ -1,3 +1,17 @@
+2017-02-15 Chris Dumez <cdu...@apple.com>
+
+ 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.
+
+ Cache origin objectProtoValueOf function on JSGlobalObject.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::objectProtoValueOfFunction):
+
2017-02-15 Yusuke Suzuki <utatane....@gmail.com>
[JSC] Drop PassRefPtr
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (212377 => 212378)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2017-02-15 18:23:33 UTC (rev 212378)
@@ -458,6 +458,7 @@
m_objectPrototype->putDirectNonIndexAccessor(vm, vm.propertyNames->underscoreProto, protoAccessor, Accessor | DontEnum);
m_functionPrototype->structure()->setPrototypeWithoutTransition(vm, m_objectPrototype.get());
m_objectStructureForObjectConstructor.set(vm, this, vm.prototypeMap.emptyObjectStructureForPrototype(this, m_objectPrototype.get(), JSFinalObject::defaultInlineCapacity()));
+ m_objectProtoValueOfFunction.set(vm, this, jsCast<JSFunction*>(objectPrototype()->getDirect(vm, vm.propertyNames->valueOf)));
JSFunction* thrower = JSFunction::create(vm, this, 0, String(), globalFuncThrowTypeErrorArgumentsCalleeAndCaller);
GetterSetter* getterSetter = GetterSetter::create(vm, this);
@@ -1193,6 +1194,7 @@
thisObject->m_arrayProtoValuesFunction.visit(visitor);
thisObject->m_initializePromiseFunction.visit(visitor);
thisObject->m_iteratorProtocolFunction.visit(visitor);
+ visitor.append(thisObject->m_objectProtoValueOfFunction);
visitor.append(thisObject->m_newPromiseCapabilityFunction);
visitor.append(thisObject->m_functionProtoHasInstanceSymbolFunction);
thisObject->m_throwTypeErrorGetterSetter.visit(visitor);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (212377 => 212378)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2017-02-15 18:23:33 UTC (rev 212378)
@@ -261,6 +261,7 @@
LazyProperty<JSGlobalObject, JSFunction> m_arrayProtoValuesFunction;
LazyProperty<JSGlobalObject, JSFunction> m_initializePromiseFunction;
LazyProperty<JSGlobalObject, JSFunction> m_iteratorProtocolFunction;
+ WriteBarrier<JSFunction> m_objectProtoValueOfFunction;
WriteBarrier<JSFunction> m_newPromiseCapabilityFunction;
WriteBarrier<JSFunction> m_functionProtoHasInstanceSymbolFunction;
LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorGetterSetter;
@@ -508,6 +509,7 @@
JSFunction* arrayProtoValuesFunction() const { return m_arrayProtoValuesFunction.get(this); }
JSFunction* initializePromiseFunction() const { return m_initializePromiseFunction.get(this); }
JSFunction* iteratorProtocolFunction() const { return m_iteratorProtocolFunction.get(this); }
+ JSFunction* objectProtoValueOfFunction() const { return m_objectProtoValueOfFunction.get(); }
JSFunction* newPromiseCapabilityFunction() const { return m_newPromiseCapabilityFunction.get(); }
JSFunction* functionProtoHasInstanceSymbolFunction() const { return m_functionProtoHasInstanceSymbolFunction.get(); }
JSObject* regExpProtoExecFunction() const { return m_regExpProtoExec.get(); }
Modified: trunk/Source/WebCore/ChangeLog (212377 => 212378)
--- trunk/Source/WebCore/ChangeLog 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/Source/WebCore/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
@@ -1,3 +1,23 @@
+2017-02-15 Chris Dumez <cdu...@apple.com>
+
+ 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.
+
+ Expose Symbol.toPrimitive / valueOf on Location instances as per:
+ - https://html.spec.whatwg.org/#the-location-interface
+
+ 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):
+
2017-02-15 Aakash Jain <aakash_j...@apple.com>
Remove WebIOSEvent interface
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (212377 => 212378)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-02-15 18:22:13 UTC (rev 212377)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-02-15 18:23:33 UTC (rev 212378)
@@ -3429,6 +3429,11 @@
push(@implContent, " ASSERT(inherits(vm, info()));\n\n");
}
+ if ($interfaceName eq "Location") {
+ push(@implContent, " putDirect(vm, vm.propertyNames->valueOf, globalObject()->objectProtoValueOfFunction(), DontDelete | ReadOnly | DontEnum);\n");
+ push(@implContent, " putDirect(vm, vm.propertyNames->toPrimitiveSymbol, jsUndefined(), DontDelete | ReadOnly | DontEnum);\n");
+ }
+
# Support for RuntimeEnabled attributes on instances.
foreach my $attribute (@{$interface->attributes}) {
next unless NeedsRuntimeCheck($attribute);