Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bug fix: watchWindows in utils.js would run callback on windows after…

… shutdown if shutdown occured after a window opened and before the window's loaded event occured

(cherry picked from commit 547b8e0)
  • Loading branch information...
commit d82a780add9559a6aad4f4ea36a9b465c93b5f93 1 parent daffa93
@erikvold erikvold authored Mardak committed
View
4 awesomeBarHD/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
View
4 findSuggest/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
View
4 homeDash/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
View
4 instantPreview/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
View
4 lessChromeHD/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
View
4 predictiveNewtab/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
View
4 queryStats/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
View
4 speakWords/scripts/utils.js
@@ -372,6 +372,9 @@ function unload(callback, container) {
* @param [function] callback: 1-parameter function that gets a browser window.
*/
function watchWindows(callback) {
+ var unloaded = false;
+ unload(function() unloaded = true);
+
// Wrap the callback in a function that ignores failures
function watcher(window) {
try {
@@ -388,6 +391,7 @@ function watchWindows(callback) {
// Listen for one load event before checking the window type
window.addEventListener("load", function runOnce() {
window.removeEventListener("load", runOnce, false);
+ if (unloaded) return; // the extension has shutdown
watcher(window);
}, false);
}
Please sign in to comment.
Something went wrong with that request. Please try again.