Don’t smash globals used by the test helper itself.
authorstefan.penner <stefan.penner@gmail.com>
Thu, 24 Sep 2015 21:46:35 +0000 (14:46 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 24 Sep 2015 21:47:17 +0000 (21:47 +0000)
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}

AUTHORS
test/mjsunit/es6/promises.js

diff --git a/AUTHORS b/AUTHORS
index 8f331b3..9dfb073 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -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>
index 19239b6..405da02 100644 (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)
 })();