chromium/third_party/blink/web_tests/fast/dom/Window/Location/location-override-valueOf.html

<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>