Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / Location / location-override-valueOf.html
blob2d28c2e80dd0f8473c574ed47cbc7e95b31fab16
1 <html>
2 <head>
3 <script src="../../../../resources/js-test.js"></script>
4 <script src="resources/location-tests-functions.js"></script>
5 </head>
6 <body>
7 <script>
8 window.location.valueOf = function() { return "haxored"; }
10 var result = normalizeURL(String(window.location));
11 var correctValue = normalizeURL(document.URL);
12 shouldBe("result", "correctValue");
13 result = normalizeURL(String(window.location.valueOf()));
14 shouldBe("result", "correctValue");
15 shouldThrow("(function() { 'use strict'; location.valueOf = 'haxored'; return location.valueOf(); }())");
16 shouldNotThrow("(function() { location.valueOf = 'haxored'; return location.valueOf(); }())");
17 shouldThrow("(function() { 'use strict'; delete location.valueOf; }())");
18 shouldBe("(function() { delete location.valueOf; return !!location.valueOf}())", "true");
19 </script>
20 </body>
21 </html>