[Pkg-mozext-commits] [firetray] 334/399: address v0.4.4 reviewer comments about namespace pollution
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:24:09 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch dfsg-clean
in repository firetray.
commit 2215aa43d1c1005bf4a32bccd07dc1a5d58a3436
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Thu Dec 20 13:38:38 2012 +0100
address v0.4.4 reviewer comments about namespace pollution
---
src/chrome/content/overlay.js | 32 +++++++++++++++++---------------
src/chrome/content/overlay.xul | 2 +-
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index 80e7210..0153dde 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -1,4 +1,5 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+"use strict";
Components.utils.import("resource://firetray/commons.js");
Components.utils.import("resource://firetray/FiretrayHandler.jsm");
@@ -8,7 +9,7 @@ if ("undefined" == typeof(Ci)) var Ci = Components.interfaces;
if ("undefined" == typeof(Cu)) var Cu = Components.utils;
// can't use 'log': don't pollute global (chrome) namespace
-let ftlog = firetray.Logging.getLogger("firetray.Chrome");
+let firetray_log = firetray.Logging.getLogger("firetray.Chrome");
// https://groups.google.com/group/mozilla.dev.extensions/browse_thread/thread/e89e9c2a834ff2b6#
var firetrayChrome = { // each new window gets a new firetrayChrome !
@@ -19,15 +20,15 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
onLoad: function(win) {
this.strings = document.getElementById("firetray-strings"); // chrome-specific
- ftlog.debug("Handler initialized: "+firetray.Handler.initialized);
+ firetray_log.debug("Handler initialized: "+firetray.Handler.initialized);
let init = firetray.Handler.initialized || firetray.Handler.init();
- ftlog.debug("ONLOAD"); firetray.Handler.dumpWindows();
+ firetray_log.debug("ONLOAD"); firetray.Handler.dumpWindows();
this.winId = firetray.Handler.registerWindow(win);
win.addEventListener('close', firetrayChrome.onClose, true);
- ftlog.debug('Firetray LOADED: ' + init);
+ firetray_log.debug('Firetray LOADED: ' + init);
return true;
},
@@ -37,8 +38,8 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
icon) */
onQuit: function(win) {
firetray.Handler.unregisterWindow(win);
- ftlog.info("windowsCount="+firetray.Handler.windowsCount+", visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
- ftlog.debug('Firetray UNLOADED !');
+ firetray_log.info("windowsCount="+firetray.Handler.windowsCount+", visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
+ firetray_log.debug('Firetray UNLOADED !');
},
/* until we find a fix (TODO), we need to set browser.tabs.warnOnClose=false
@@ -47,23 +48,24 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
use trying to set warnOnClose=false temporarily in onClose, since onClose is
called *after* the popup */
onClose: function(event) {
- ftlog.debug('Firetray CLOSE');
+ firetray_log.debug('Firetray CLOSE');
let win = event.originalTarget;
if (!win instanceof ChromeWindow)
throw new TypeError('originalTarget not a ChromeWindow');
let hides_on_close = firetray.Utils.prefService.getBoolPref('hides_on_close');
- ftlog.debug('hides_on_close: '+hides_on_close);
+ firetray_log.debug('hides_on_close: '+hides_on_close);
if (hides_on_close) {
let hides_single_window = firetray.Utils.prefService.getBoolPref('hides_single_window');
let hides_last_only = firetray.Utils.prefService.getBoolPref('hides_last_only');
- ftlog.debug('hides_single_window='+hides_single_window+', windowsCount='+firetray.Handler.windowsCount);
+ firetray_log.debug('hides_single_window='+hides_single_window+', windowsCount='+firetray.Handler.windowsCount);
if (hides_last_only && (firetray.Handler.windowsCount > 1)) return;
- if (hides_single_window) {
+ if (hides_single_window)
firetray.Handler.hideWindow(firetrayChrome.winId);
- } else
+ else
firetray.Handler.hideAllWindows();
+
event && event.preventDefault();
}
}
@@ -74,12 +76,12 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
// https://developer.mozilla.org/en/XUL_School/JavaScript_Object_Management.html
// https://developer.mozilla.org/en/Extensions/Performance_best_practices_in_extensions#Removing_Event_Listeners
window.addEventListener(
- 'load', function (e) {
- removeEventListener('load', arguments.callee, true);
+ 'load', function removeOnloadListener(e) {
+ removeEventListener('load', removeOnloadListener, true);
firetrayChrome.onLoad(this); },
false);
window.addEventListener(
- 'unload', function (e) {
- removeEventListener('unload', arguments.callee, true);
+ 'unload', function removeOnUnloadListener(e) {
+ removeEventListener('unload', removeOnUnloadListener, true);
firetrayChrome.onQuit(this); },
false);
diff --git a/src/chrome/content/overlay.xul b/src/chrome/content/overlay.xul
index 1b7251c..b5ec2ad 100644
--- a/src/chrome/content/overlay.xul
+++ b/src/chrome/content/overlay.xul
@@ -9,7 +9,7 @@
</stringbundleset>
<keyset>
- <key id="key_debug" key="P" modifiers="control alt shift"
+ <key id="firetray_key_debug" key="P" modifiers="control alt shift"
oncommand="window.openDialog('chrome://firetray/content/options.xul',
'', 'chrome,titlebar,toolbar,centerscreen', 'pane3');" />
</keyset>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git
More information about the Pkg-mozext-commits
mailing list