blob: 2d28c2e80dd0f8473c574ed47cbc7e95b31fab16 [file] [log] [blame]
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
<script src="resources/location-tests-functions.js"></script>
</head>
<body>
<script>
window.location.valueOf = function() { return "haxored"; }
var result = normalizeURL(String(window.location));
var correctValue = normalizeURL(document.URL);
shouldBe("result", "correctValue");
result = normalizeURL(String(window.location.valueOf()));
shouldBe("result", "correctValue");
shouldThrow("(function() { 'use strict'; location.valueOf = 'haxored'; return location.valueOf(); }())");
shouldNotThrow("(function() { location.valueOf = 'haxored'; return location.valueOf(); }())");
shouldThrow("(function() { 'use strict'; delete location.valueOf; }())");
shouldBe("(function() { delete location.valueOf; return !!location.valueOf}())", "true");
</script>
</body>
</html>