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

Commit

Permalink
Element fix (#3157)
Browse files Browse the repository at this point in the history
* Do not re-wrap onResize when adding and removing the listener
This caused the removeEventListener to silently fail, as the wrapped functions did not match (by identity)
Fixes #3153

* Suppress error popups for all errors in resize handlers
Errors still go to Sentry
  • Loading branch information
ianb authored and jaredhirsch committed Jul 20, 2017
1 parent b469873 commit b0e1662
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions addon/webextension/selector/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
initSizeWatch() {
this.stopSizeWatch();
this.sizeTracking.timer = setInterval(watchFunction(this.updateElementSize.bind(this)), 2000);
window.addEventListener("resize", watchFunction(assertIsTrusted(this.onResize)), true);
window.addEventListener("resize", this.onResize, true);
},

stopSizeWatch() {
Expand All @@ -177,7 +177,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
this.sizeTracking.windowDelayer = null;
}
this.sizeTracking.lastHeight = this.sizeTracking.lastWidth = null;
window.removeEventListener("resize", watchFunction(assertIsTrusted(this.onResize)), true);
window.removeEventListener("resize", this.onResize, true);
},

getElementFromPoint(x, y) {
Expand All @@ -198,7 +198,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
}
};

iframeSelection.onResize = watchFunction(assertIsTrusted(onResize.bind(iframeSelection)));
iframeSelection.onResize = watchFunction(assertIsTrusted(onResize.bind(iframeSelection)), true);

let iframePreSelection = exports.iframePreSelection = {
element: null,
Expand Down Expand Up @@ -322,7 +322,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
}
};

iframePreSelection.onResize = watchFunction(onResize.bind(iframePreSelection));
iframePreSelection.onResize = watchFunction(onResize.bind(iframePreSelection), true);

let iframe = exports.iframe = {
currentIframe: iframePreSelection,
Expand Down

0 comments on commit b0e1662

Please sign in to comment.