Skip to content
This repository
Browse code

Fix notification bar in Firefox 3.

  • Loading branch information...
commit 4f84fa64a46ba2a030fb02744592492ab6b86061 1 parent d864571
arantius arantius authored

Showing 1 changed file with 22 additions and 18 deletions. Show diff stats Hide diff stats

  1. +22 18 modules/remoteScript.js
40 modules/remoteScript.js
@@ -284,24 +284,28 @@ RemoteScript.prototype.showSource = function(aTabBrowser) {
284 284 var tab = aTabBrowser.loadOneTab(
285 285 ioService.newFileURI(this._scriptFile).spec,
286 286 {'inBackground': false});
287   - var notificationBox = aTabBrowser.getNotificationBox();
288   - notificationBox.appendNotification(
289   - stringBundleBrowser.GetStringFromName('greeting.msg'),
290   - "install-userscript",
291   - "chrome://greasemonkey/skin/icon16.png",
292   - notificationBox.PRIORITY_WARNING_MEDIUM,
293   - [{
294   - 'label': stringBundleBrowser.GetStringFromName('greeting.btn'),
295   - 'accessKey': stringBundleBrowser.GetStringFromName('greeting.btnAccess'),
296   - 'popup': null,
297   - 'callback': GM_util.hitch(this, function() {
298   - GM_util.showInstallDialog(this, aTabBrowser, GM_util.getService());
299   - // Timeout puts this after the notification closes itself for the
300   - // button click, avoiding an error inside that (Firefox) code.
301   - GM_util.timeout(0, function() { aTabBrowser.removeTab(tab); });
302   - })
303   - }]
304   - );
  287 + function addNotification() {
  288 + var notificationBox = aTabBrowser.getNotificationBox();
  289 + notificationBox.appendNotification(
  290 + stringBundleBrowser.GetStringFromName('greeting.msg'),
  291 + "install-userscript",
  292 + "chrome://greasemonkey/skin/icon16.png",
  293 + notificationBox.PRIORITY_WARNING_MEDIUM,
  294 + [{
  295 + 'label': stringBundleBrowser.GetStringFromName('greeting.btn'),
  296 + 'accessKey': stringBundleBrowser.GetStringFromName('greeting.btnAccess'),
  297 + 'popup': null,
  298 + 'callback': GM_util.hitch(this, function() {
  299 + GM_util.showInstallDialog(this, aTabBrowser, GM_util.getService());
  300 + // Timeout puts this after the notification closes itself for the
  301 + // button click, avoiding an error inside that (Firefox) code.
  302 + GM_util.timeout(0, function() { aTabBrowser.removeTab(tab); });
  303 + })
  304 + }]
  305 + );
  306 + }
  307 + // Timeout necessary only for Firefox 3 as a dirty hack around timing issues.
  308 + GM_util.timeout(0, GM_util.hitch(this, addNotification));
305 309 };
306 310
307 311 RemoteScript.prototype.toString = function() {

0 comments on commit 4f84fa6

Please sign in to comment.
Something went wrong with that request. Please try again.