Commit ab989898 authored by stefan.penner's avatar stefan.penner Committed by Commit bot

Don’t smash globals used by the test helper itself.

Since https://codereview.chromium.org/366103005 the promise tests null out
various globals, to ensure the promise implementation doesn’t itself rely
on functions patchable by monkeys.

Unfortunately, doing so breaks test assertion failures which rely on
those globals.

This isn’t the ideal solution, but does improve the current state.

R=littledan@chromium.org,domenic@chromium.org
LOG=N
BUG=

Review URL: https://codereview.chromium.org/1370583002

Cr-Commit-Position: refs/heads/master@{#30922}
parent 1c5e511d
...@@ -96,6 +96,7 @@ Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com> ...@@ -96,6 +96,7 @@ Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>
Sandro Santilli <strk@keybit.net> Sandro Santilli <strk@keybit.net>
Sanjoy Das <sanjoy@playingwithpointers.com> Sanjoy Das <sanjoy@playingwithpointers.com>
Seo Sanghyeon <sanxiyn@gmail.com> Seo Sanghyeon <sanxiyn@gmail.com>
Stefan Penner <stefan.penner@gmail.com>
Tobias Burnus <burnus@net-b.de> Tobias Burnus <burnus@net-b.de>
Victor Costan <costan@gmail.com> Victor Costan <costan@gmail.com>
Vlad Burlik <vladbph@gmail.com> Vlad Burlik <vladbph@gmail.com>
......
...@@ -62,7 +62,15 @@ function clearProp(o, name) { ...@@ -62,7 +62,15 @@ function clearProp(o, name) {
// Find intrinsics and null them out. // Find intrinsics and null them out.
var globals = Object.getOwnPropertyNames(this) var globals = Object.getOwnPropertyNames(this)
var whitelist = {Promise: true, TypeError: true} var whitelist = {
Promise: true,
TypeError: true,
String: true,
JSON: true,
Error: true,
MjsUnitAssertionError: true
};
for (var i in globals) { for (var i in globals) {
var name = globals[i] var name = globals[i]
if (name in whitelist || name[0] === name[0].toLowerCase()) delete globals[i] if (name in whitelist || name[0] === name[0].toLowerCase()) delete globals[i]
...@@ -97,7 +105,6 @@ function assertAsyncDone(iteration) { ...@@ -97,7 +105,6 @@ function assertAsyncDone(iteration) {
}); });
} }
(function() { (function() {
assertThrows(function() { Promise(function() {}) }, TypeError) assertThrows(function() { Promise(function() {}) }, TypeError)
})(); })();
......
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