default settings for globalEvaluationScope

This commit is contained in:
guybedford 2015-10-17 12:50:20 +02:00
parent c9ef9e6a7b
commit a75bc78490
2 changed files with 8 additions and 7 deletions

View File

@ -38,6 +38,13 @@ hookConstructor(function(constructor) {
this.globalEvaluationScope = true;
this.pluginFirst = false;
// Default settings for globalEvaluationScope:
// Disabled for WebWorker, Chrome Extensions and jsdom
if (isWorker
|| isBrowser && window.chrome && window.chrome.extension
|| isBrowser && navigator.userAgent.match(/^Node\.js/))
this.globalEvaluationScope = false;
// support the empty module, as a concept
this.set('@empty', this.newModule({}));

View File

@ -63,14 +63,8 @@ var __exec;
}
}
// Web Worker and Chrome Extensions use original ESML eval
// this may lead to some global module execution differences (eg var not defining onto global)
if (isWorker || isBrowser && window.chrome && window.chrome.extension) {
__exec = evalExec;
}
// use script injection eval to get identical global script behaviour
else if (typeof document != 'undefined' && document.getElementsByTagName) {
if (typeof document != 'undefined' && document.getElementsByTagName) {
var head;
var scripts = document.getElementsByTagName('script');