this addresses `Cu.import` throwing as reported in #1004

This commit is contained in:
gorhill 2015-12-04 12:05:02 -05:00
parent 27f87fb57b
commit 7ada31a545
1 changed files with 10 additions and 3 deletions

View File

@ -122,9 +122,16 @@ window.addEventListener('unload', function() {
// frameModule needs to be cleared too // frameModule needs to be cleared too
var frameModuleURL = vAPI.getURL('frameModule.js'); var frameModuleURL = vAPI.getURL('frameModule.js');
var frameModule = {}; var frameModule = {};
Cu.import(frameModuleURL, frameModule);
frameModule.contentObserver.unregister(); // https://github.com/gorhill/uBlock/issues/1004
Cu.unload(frameModuleURL); // For whatever reason, `Cu.import` can throw -- at least this was
// reported as happening for Pale Moon 25.8.
try {
Cu.import(frameModuleURL, frameModule);
frameModule.contentObserver.unregister();
Cu.unload(frameModuleURL);
} catch (ex) {
}
}); });
/******************************************************************************/ /******************************************************************************/