Skip to content

Commit

Permalink
Harden StudyUtils to go blind on a browser window being present and p…
Browse files Browse the repository at this point in the history
…revent errors during a second shutdown during browser startup. Fixes #33.
  • Loading branch information
mikedeboer committed Aug 23, 2018
1 parent a024ed7 commit 58d41a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion addon/StudyUtils.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
713a714,716
714c714,718
< if (!Services.wm.getMostRecentWindow("navigator:browser").gBrowser) {
---
> if (!("triggeringPrincipal" in params)) {
> params.triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({});
> }
> const window = Services.wm.getMostRecentWindow("navigator:browser");
> if (!window || !window.gBrowser) {
4 changes: 3 additions & 1 deletion addon/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ this.Bootstrap = {
.AddonManager.getAddonByID(addonData.id);
// This is needed even for onUninstalling, because it nukes the addon
// from UI. If we don't do this, the user has a chance to "undo".
addon.uninstall();
if (addon) {
addon.uninstall();
}
}

// Unload addon-specific modules
Expand Down

0 comments on commit 58d41a6

Please sign in to comment.