Fix window.name being unset when loading include.js. Closes #1645

This commit is contained in:
Adomas Venčkauskas 2019-02-25 11:45:42 +02:00
parent 6929125708
commit 6d82ac3970
2 changed files with 14 additions and 3 deletions

View file

@ -9,7 +9,18 @@ var Zotero = Components.classes['@zotero.org/Zotero;1']
// Components.utils.import('resource://zotero/require.js');
// Not using Cu.import here since we don't want the require module to be cached
// for includes within ZoteroPane or other code, where we want the window instance available to modules.
// for includes within ZoteroPane or other code, where we want the window
// instance available to modules.
// However, doing this unsets `window.name` (and possibly other window props)
// so we're manually handling it here
var winName;
if (typeof window != 'undefined') {
winName = window.name;
}
Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader)
.loadSubScript('resource://zotero/require.js');
if (winName) {
window.name = winName;
}

View file

@ -97,6 +97,6 @@ var require = (function() {
},
globals
});
return Require(loader, requirer);
let require = Require(loader, requirer);
return require
})();