Commit 534bb7ba authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

Update tests whose result depends on __defineGetter__ throwing behavior

V8's current behavior is to not throw when __defineGetter__ fails, but
it is being changed to throw. The tests now pass whether or not
__defineGetter__ throws.

Bug: v8:5070
Change-Id: I219a4d2665edc886c040578ba1108c36cafa3bc6
Reviewed-on: https://chromium-review.googlesource.com/595240
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491310}
parent 3666256d
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
</head> </head>
<body> <body>
<script> <script>
window.location.__defineGetter__("toString", function () { try {
return function() { return "haxored"; } window.location.__defineGetter__("toString", function () {
}); return function() { return "haxored"; }
});
} catch (e) { }
var result = normalizeURL(String(window.location)); var result = normalizeURL(String(window.location));
var correctValue = normalizeURL(document.URL); var correctValue = normalizeURL(document.URL);
......
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
</head> </head>
<body> <body>
<script> <script>
window.location.__defineGetter__("valueOf", function () { try {
return function() { return "haxored"; } window.location.__defineGetter__("valueOf", function () {
}); return function() { return "haxored"; }
});
} catch (e) { }
var result = normalizeURL(String(window.location)); var result = normalizeURL(String(window.location));
var correctValue = normalizeURL(document.URL); var correctValue = normalizeURL(document.URL);
shouldBe("result", "correctValue"); shouldBe("result", "correctValue");
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
</head> </head>
<body> <body>
<script> <script>
window.__defineGetter__("location", function() { return "haxored"; }); try {
window.__defineGetter__("location", function() { return "haxored"; });
} catch (e) { }
var result = normalizeURL(String(window.location)); var result = normalizeURL(String(window.location));
var correctValue = normalizeURL(document.URL); var correctValue = normalizeURL(document.URL);
shouldBe("result", "correctValue"); shouldBe("result", "correctValue");
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
</head> </head>
<body> <body>
<script> <script>
window.__defineGetter__("window", function() { try {
return { location: "haxored" }; window.__defineGetter__("window", function() {
}); return { location: "haxored" };
});
} catch (e) { }
var result = normalizeURL(String(window.location)); var result = normalizeURL(String(window.location));
var correctValue = normalizeURL(document.URL); var correctValue = normalizeURL(document.URL);
......
...@@ -6,7 +6,7 @@ description("This page tests what happens when a getter / setter on the window o ...@@ -6,7 +6,7 @@ description("This page tests what happens when a getter / setter on the window o
var x = 1; var x = 1;
try { try {
window.__defineGetter__("x", function() { return "window.x __getter__"; }); window.__defineGetter__("x", function() { return "window.x __getter__"; });
} catch(e) { debug(e); } } catch(e) { }
shouldBe("window.x", "1"); shouldBe("window.x", "1");
shouldBe("typeof window.__lookupGetter__('x')", "'undefined'"); shouldBe("typeof window.__lookupGetter__('x')", "'undefined'");
...@@ -16,7 +16,7 @@ debug(""); ...@@ -16,7 +16,7 @@ debug("");
try { try {
window.__defineSetter__("x", function() { debug("window.x __setter__ called"); }); window.__defineSetter__("x", function() { debug("window.x __setter__ called"); });
} catch(e) { debug(e); } } catch(e) { }
x = 2; x = 2;
shouldBe("window.x", "2"); shouldBe("window.x", "2");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment