haikuwebkit/LayoutTests/fast/dom/location-valueOf-after-obje...

16 lines
479 B
HTML
Raw Permalink Normal View History

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: - 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): 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. Canonical link: https://commits.webkit.org/185404@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-15 18:23:33 +00:00
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<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="../../resources/js-test-post.js"></script>
</body>
</html>