diff options
Diffstat (limited to 'webkit/data')
-rw-r--r-- | webkit/data/layout_tests/chrome/fast/dom/location-shadowing-expected.txt | 5 | ||||
-rw-r--r-- | webkit/data/layout_tests/chrome/fast/dom/location-shadowing.html | 49 |
2 files changed, 54 insertions, 0 deletions
diff --git a/webkit/data/layout_tests/chrome/fast/dom/location-shadowing-expected.txt b/webkit/data/layout_tests/chrome/fast/dom/location-shadowing-expected.txt new file mode 100644 index 0000000..a9b2554 --- /dev/null +++ b/webkit/data/layout_tests/chrome/fast/dom/location-shadowing-expected.txt @@ -0,0 +1,5 @@ +PASS +PASS +PASS +PASS + diff --git a/webkit/data/layout_tests/chrome/fast/dom/location-shadowing.html b/webkit/data/layout_tests/chrome/fast/dom/location-shadowing.html new file mode 100644 index 0000000..6e9bac4 --- /dev/null +++ b/webkit/data/layout_tests/chrome/fast/dom/location-shadowing.html @@ -0,0 +1,49 @@ +<html> +<body onload="test()"> +<script> +// This tests that the location property on the window object +// cannot be overwritten by using accessors defined using +// __defineGetter__ and __defineSetter__ and that functions +//on location objects are read-only. + +if (window.layoutTestController) { + layoutTestController.dumpAsText(); +} + +function check(passed) { + if (passed) { + document.write("PASS<br>"); + } else { + document.write("FAIL<br>"); + } +} + +var locationFunctions = ["reload", "replace", "assign", "toString"]; + +function overwrite() { return 'overwrite'; }; + +function testFunctionOverwrite() { + for (var i = 0; i < locationFunctions.length; i++) { + location[locationFunctions[i]] = overwrite; + check(location[locationFunctions[i]] != overwrite); + } +} + +function failIfCalled() { check(false); } + +function testAccessorOverwrite() { + __defineGetter__("location", failIfCalled); + var l = location; + window.__defineGetter__("location", failIfCalled); + l = window.location; + this.__defineGetter__("location", failIfCalled); + l = this.location; +} + +function test() { + testFunctionOverwrite(); + testAccessorOverwrite(); +} +</script> +</body> +</html> |