Skip to content

Commit

Permalink
[embedlite-components] Guard removeEventListener and sendAsyncMessage…
Browse files Browse the repository at this point in the history
… service calls. Fixes JB#21694
  • Loading branch information
rainemak committed May 6, 2016
1 parent f0f9c6b commit 7e6a20b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions jscomps/EmbedLiteErrorPageHandler.js
Expand Up @@ -44,8 +44,13 @@ EventLinkListener.prototype = {
ErrorPageEventHandler._targetWindow = this._targetWindow;
Services.embedlite.chromeEventHandler(this._targetWindow).addEventListener("click", ErrorPageEventHandler, true);
let listener = function() {
Services.embedlite.chromeEventHandler(this._targetWindow).removeEventListener("click", ErrorPageEventHandler, true);
Services.embedlite.chromeEventHandler(this._targetWindow).removeEventListener("pagehide", listener, true);
try {
Services.embedlite.chromeEventHandler(this._targetWindow).removeEventListener("click", ErrorPageEventHandler, true);
} catch (e) {}

try {
Services.embedlite.chromeEventHandler(this._targetWindow).removeEventListener("pagehide", listener, true);
} catch (e) {}
ErrorPageEventHandler._targetWindow = null;
}.bind(this);

Expand Down
4 changes: 3 additions & 1 deletion jsscripts/embedhelper.js
Expand Up @@ -577,7 +577,9 @@ EmbedHelper.prototype = {
let window = aEvent.target.defaultView;
if (window) {
let winid = Services.embedlite.getIDByWindow(window);
Services.embedlite.sendAsyncMessage(winid, "embed:domcontentloaded", JSON.stringify({ "rootFrame": window.parent === window }));
try {
Services.embedlite.sendAsyncMessage(winid, "embed:domcontentloaded", JSON.stringify({ "rootFrame": window.parent === window }));
} catch (e) {}
}
},

Expand Down

0 comments on commit 7e6a20b

Please sign in to comment.