Skip to content

Commit 02e85ee

Browse files
committed
delete property "global"
1 parent 6d40813 commit 02e85ee

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/htmlunit/javascript/JavaScriptEngine.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,9 @@ public static void configureRhino(final WebClient webClient,
413413
final ScriptableObject console = (ScriptableObject) ScriptableObject.getProperty(scope, "console");
414414
console.defineFunctionProperties(new String[] {"timeStamp"}, ConsoleCustom.class, ScriptableObject.DONTENUM);
415415

416+
// remove some objects, that Rhino defines in top scope but that we don't want
417+
deleteProperties(scope, "Continuation", "StopIteration", "uneval", "global");
418+
416419
// Rhino defines too many methods for us, particularly since implementation of ECMAScript5
417420
final ScriptableObject stringPrototype = (ScriptableObject) ScriptableObject.getClassPrototype(scope, "String");
418421
deleteProperties(stringPrototype, "equals", "equalsIgnoreCase", "toSource");
@@ -422,7 +425,6 @@ public static void configureRhino(final WebClient webClient,
422425
final ScriptableObject datePrototype = (ScriptableObject) ScriptableObject.getClassPrototype(scope, "Date");
423426
deleteProperties(datePrototype, "toSource");
424427

425-
deleteProperties(scope, "uneval");
426428
removePrototypeProperties(scope, "Object", "toSource");
427429
removePrototypeProperties(scope, "Array", "toSource");
428430
removePrototypeProperties(scope, "Function", "toSource");
@@ -434,9 +436,6 @@ public static void configureRhino(final WebClient webClient,
434436
numberPrototype.defineFunctionProperties(new String[] {"toLocaleString"},
435437
NumberCustom.class, ScriptableObject.DONTENUM);
436438

437-
// remove some objects, that Rhino defines in top scope but that we don't want
438-
deleteProperties(scope, "Continuation", "StopIteration");
439-
440439
final ScriptableObject errorObject = (ScriptableObject) ScriptableObject.getProperty(scope, "Error");
441440
if (browserVersion.hasFeature(JS_ERROR_STACK_TRACE_LIMIT)) {
442441
errorObject.defineProperty("stackTraceLimit", 10, ScriptableObject.EMPTY);

0 commit comments

Comments
 (0)