Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/location-toprimitive.html

Issue 2656973002: binding: Sets location[Symbol.toPrimitive]. (Closed)
Patch Set: Added a layout test. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/dom/location-toprimitive.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/location-toprimitive.html b/third_party/WebKit/LayoutTests/fast/dom/location-toprimitive.html
new file mode 100644
index 0000000000000000000000000000000000000000..a4f1c9826fab0f0d564d861855dc36de99b1cbbc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/location-toprimitive.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // The property descriptor of location[Symbol.toPrimitive] must be
+ // {configurable: false, enumerable: false, writable: false,
+ // value: undefined}.
+ assert_own_property(location, Symbol.toPrimitive,
+ "location does not have Symbol.toPrimitive property.");
+ var pd = Object.getOwnPropertyDescriptor(location, Symbol.toPrimitive);
+ assert_false(pd.configurable,
+ "location's Symbol.toPrimitive is configurable.");
+ assert_false(pd.enumerable, "location's Symbol.toPrimitive is enumerable.");
+ assert_false(pd.writable, "location's Symbol.toPrimitive is writable.");
+ assert_true('value' in pd,
+ "location's Symbol.toPrimitive is not a data property.");
+ assert_equals(pd.value, undefined,
+ "The value of location's Symbol.toPrimitive is not undefined.");
+
+ // location's Symbol.toPrimitive supersedes Object.prototype's one.
+ // https://crbug.com/680409
+ Object.prototype[Symbol.toPrimitive] = function() { return "hacked"; };
+ assert_equals(String({}), "hacked",
+ "Object.prototype doesn't have a hacked Symbol.toPrimitive " +
+ "property.");
+ assert_not_equals(String(location), "hacked",
+ "location's Symbol.toPrimitive gets hacked.");
+}, "Location objects must have Symbol.toPrimitive property defined.");
+
+done();
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698