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}
This commit is contained in:
stefan.penner 2015-09-24 14:46:35 -07:00 committed by Commit bot
parent 1c5e511dc2
commit ab9898980e
2 changed files with 10 additions and 2 deletions

View File

@ -96,6 +96,7 @@ Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>
Sandro Santilli <strk@keybit.net>
Sanjoy Das <sanjoy@playingwithpointers.com>
Seo Sanghyeon <sanxiyn@gmail.com>
Stefan Penner <stefan.penner@gmail.com>
Tobias Burnus <burnus@net-b.de>
Victor Costan <costan@gmail.com>
Vlad Burlik <vladbph@gmail.com>

View File

@ -62,7 +62,15 @@ function clearProp(o, name) {
// Find intrinsics and null them out.
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) {
var name = globals[i]
if (name in whitelist || name[0] === name[0].toLowerCase()) delete globals[i]
@ -97,7 +105,6 @@ function assertAsyncDone(iteration) {
});
}
(function() {
assertThrows(function() { Promise(function() {}) }, TypeError)
})();