mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-18 14:53:14 +00:00
chrome extension eval support
This commit is contained in:
parent
79a81e923a
commit
be2db270a3
@ -28,8 +28,23 @@ var __exec;
|
||||
'\n//# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(load.metadata.sourceMap))) || '')
|
||||
}
|
||||
|
||||
// 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 = function(load) {
|
||||
try {
|
||||
preExec(this);
|
||||
new Function(getSource(load)).call(__global);
|
||||
postExec();
|
||||
}
|
||||
catch(e) {
|
||||
throw addToError(e, 'Evaluating ' + load.address);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// use script injection eval to get identical global script behaviour
|
||||
if (typeof document != 'undefined') {
|
||||
else if (typeof document != 'undefined') {
|
||||
var head;
|
||||
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
@ -55,20 +70,6 @@ var __exec;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
// Web Worker uses original ESML eval
|
||||
// this may lead to some global module execution differences (eg var not defining onto global)
|
||||
else if (isWorker) {
|
||||
__exec = function(load) {
|
||||
try {
|
||||
preExec(this);
|
||||
new Function(getSource(load)).call(__global);
|
||||
postExec();
|
||||
}
|
||||
catch(e) {
|
||||
throw addToError(e, 'Evaluating ' + load.address);
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
// global scoped eval for node
|
||||
var vmModule = 'vm';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user