From 91d14fc04cc4c17e3087364d7564715f7103598d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Feb 2015 15:31:37 -0500 Subject: [PATCH] Use 'self' instead of 'global' as global object in Bluebird This fixes an error when other errors occur in recent versions of Bluebird. --- resource/bluebird.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/resource/bluebird.js b/resource/bluebird.js index ef118c6e6..9c85e6e54 100644 --- a/resource/bluebird.js +++ b/resource/bluebird.js @@ -33,10 +33,10 @@ EXPORTED_SYMBOLS = ["Promise"]; // Set BackstagePass (which contains .Error, etc.) as global object - global = this; + self = this; // Provide an implementation of setTimeout - global.setTimeout = new function() { + self.setTimeout = new function() { // We need to maintain references to running nsITimers. Otherwise, they can // get garbage collected before they fire. var _runningTimers = []; @@ -70,15 +70,15 @@ Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService) .logMessage(scriptError); - global.debug(err, 1); - global.debug(err.stack, 1); + self.debug(err, 1); + self.debug(err.stack, 1); } }}, ms, Components.interfaces.nsITimer.TYPE_ONE_SHOT); _runningTimers.push(timer); } }; - global.debug = function (msg) { + self.debug = function (msg) { dump(msg + "\n\n"); }; @@ -86,9 +86,9 @@ // TEMP: Only turn on if debug logging enabled? Promise.longStackTraces(); Promise.onPossiblyUnhandledRejection(function(error) { - global.debug('==========='); - global.debug(error); - global.debug(error.stack); + self.debug('==========='); + self.debug(error); + self.debug(error.stack); throw error; }); return;