Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Suppress some errors that are happening during teardown, when the doc…
Browse files Browse the repository at this point in the history
…ument is no longer valid
  • Loading branch information
ianb committed Nov 14, 2016
1 parent 4db54be commit e99a2bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion addon/data/error-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

/** Call with an error object (with .name, .message, .help, etc) */
function unhandled(error) {
console.error("Internal error", location.href);
try {
console.error("Internal error", location.href);
} catch (e) {
// Something location.href doesn't work
}
self.port.emit("alertError", error);
}

Expand Down
4 changes: 4 additions & 0 deletions addon/data/selector-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,14 @@ const ui = (function () { // eslint-disable-line no-unused-vars
/** Removes every UI this module creates */
exports.remove = function () {
for (let name in exports) {
if (name == "iframe") {
continue;
}
if (typeof exports[name] == "object" && exports[name].remove) {
exports[name].remove();
}
}
exports.iframe.remove();
};

exports.ChromeInterface = {
Expand Down
11 changes: 8 additions & 3 deletions addon/data/shooter-interactive-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,14 @@ function activate() {

function deactivate() {
ui.Box.remove();
ui.remove();
removeHandlers();
setState("cancel");
try {
ui.remove();
removeHandlers();
setState("cancel");
} catch (e) {
// Sometimes this fires so late that the document isn't available
// We don't care about the exception, so we swallow it here
}
}

/***********************************************
Expand Down

0 comments on commit e99a2bc

Please sign in to comment.