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

Side by Side 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, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 test(function() {
6 // The property descriptor of location[Symbol.toPrimitive] must be
7 // {configurable: false, enumerable: false, writable: false,
8 // value: undefined}.
9 assert_own_property(location, Symbol.toPrimitive,
10 "location does not have Symbol.toPrimitive property.");
11 var pd = Object.getOwnPropertyDescriptor(location, Symbol.toPrimitive);
12 assert_false(pd.configurable,
13 "location's Symbol.toPrimitive is configurable.");
14 assert_false(pd.enumerable, "location's Symbol.toPrimitive is enumerable.");
15 assert_false(pd.writable, "location's Symbol.toPrimitive is writable.");
16 assert_true('value' in pd,
17 "location's Symbol.toPrimitive is not a data property.");
18 assert_equals(pd.value, undefined,
19 "The value of location's Symbol.toPrimitive is not undefined.");
20
21 // location's Symbol.toPrimitive supersedes Object.prototype's one.
22 // https://crbug.com/680409
23 Object.prototype[Symbol.toPrimitive] = function() { return "hacked"; };
24 assert_equals(String({}), "hacked",
25 "Object.prototype doesn't have a hacked Symbol.toPrimitive " +
26 "property.");
27 assert_not_equals(String(location), "hacked",
28 "location's Symbol.toPrimitive gets hacked.");
29 }, "Location objects must have Symbol.toPrimitive property defined.");
30
31 done();
32 </script>
OLDNEW
« 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