mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 15:27:30 +09:00
[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/modules.
This commit is contained in:
parent
addf7b2fb1
commit
95492157f1
6 changed files with 74 additions and 74 deletions
|
|
@ -49,18 +49,18 @@ function clearTimer(timer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.BrowserNewTabPreloader = {
|
this.BrowserNewTabPreloader = {
|
||||||
init: function Preloader_init() {
|
init: function () {
|
||||||
Initializer.start();
|
Initializer.start();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function Preloader_uninit() {
|
uninit: function () {
|
||||||
Initializer.stop();
|
Initializer.stop();
|
||||||
HostFrame.destroy();
|
HostFrame.destroy();
|
||||||
Preferences.uninit();
|
Preferences.uninit();
|
||||||
HiddenBrowsers.uninit();
|
HiddenBrowsers.uninit();
|
||||||
},
|
},
|
||||||
|
|
||||||
newTab: function Preloader_newTab(aTab) {
|
newTab: function (aTab) {
|
||||||
let win = aTab.ownerDocument.defaultView;
|
let win = aTab.ownerDocument.defaultView;
|
||||||
if (win.gBrowser) {
|
if (win.gBrowser) {
|
||||||
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
|
@ -83,12 +83,12 @@ var Initializer = {
|
||||||
_timer: null,
|
_timer: null,
|
||||||
_observing: false,
|
_observing: false,
|
||||||
|
|
||||||
start: function Initializer_start() {
|
start: function () {
|
||||||
Services.obs.addObserver(this, TOPIC_DELAYED_STARTUP, false);
|
Services.obs.addObserver(this, TOPIC_DELAYED_STARTUP, false);
|
||||||
this._observing = true;
|
this._observing = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
stop: function Initializer_stop() {
|
stop: function () {
|
||||||
this._timer = clearTimer(this._timer);
|
this._timer = clearTimer(this._timer);
|
||||||
|
|
||||||
if (this._observing) {
|
if (this._observing) {
|
||||||
|
|
@ -97,7 +97,7 @@ var Initializer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function Initializer_observe(aSubject, aTopic, aData) {
|
observe: function (aSubject, aTopic, aData) {
|
||||||
if (aTopic == TOPIC_DELAYED_STARTUP) {
|
if (aTopic == TOPIC_DELAYED_STARTUP) {
|
||||||
Services.obs.removeObserver(this, TOPIC_DELAYED_STARTUP);
|
Services.obs.removeObserver(this, TOPIC_DELAYED_STARTUP);
|
||||||
this._observing = false;
|
this._observing = false;
|
||||||
|
|
@ -108,11 +108,11 @@ var Initializer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_startTimer: function Initializer_startTimer() {
|
_startTimer: function () {
|
||||||
this._timer = createTimer(this, PRELOADER_INIT_DELAY_MS);
|
this._timer = createTimer(this, PRELOADER_INIT_DELAY_MS);
|
||||||
},
|
},
|
||||||
|
|
||||||
_startPreloader: function Initializer_startPreloader() {
|
_startPreloader: function () {
|
||||||
Preferences.init();
|
Preferences.init();
|
||||||
if (Preferences.enabled) {
|
if (Preferences.enabled) {
|
||||||
HiddenBrowsers.init();
|
HiddenBrowsers.init();
|
||||||
|
|
@ -133,19 +133,19 @@ var Preferences = {
|
||||||
return this._enabled;
|
return this._enabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function Preferences_init() {
|
init: function () {
|
||||||
this._branch = Services.prefs.getBranch(PREF_BRANCH);
|
this._branch = Services.prefs.getBranch(PREF_BRANCH);
|
||||||
this._branch.addObserver("", this, false);
|
this._branch.addObserver("", this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function Preferences_uninit() {
|
uninit: function () {
|
||||||
if (this._branch) {
|
if (this._branch) {
|
||||||
this._branch.removeObserver("", this);
|
this._branch.removeObserver("", this);
|
||||||
this._branch = null;
|
this._branch = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function Preferences_observe() {
|
observe: function () {
|
||||||
let prevEnabled = this._enabled;
|
let prevEnabled = this._enabled;
|
||||||
this._enabled = null;
|
this._enabled = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,13 +65,13 @@ function _handleEvent(aEvent) {
|
||||||
|
|
||||||
// Methods that impact a browser. Put into single object for organization.
|
// Methods that impact a browser. Put into single object for organization.
|
||||||
var BrowserHelper = {
|
var BrowserHelper = {
|
||||||
onOpen: function NP_BH_onOpen(aBrowser) {
|
onOpen: function (aBrowser) {
|
||||||
// If the tab is in the focused window, leave priority as it is
|
// If the tab is in the focused window, leave priority as it is
|
||||||
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
|
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
|
||||||
this.decreasePriority(aBrowser);
|
this.decreasePriority(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function NP_BH_onSelect(aBrowser) {
|
onSelect: function (aBrowser) {
|
||||||
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
|
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
|
||||||
if (windowEntry.lastSelectedBrowser)
|
if (windowEntry.lastSelectedBrowser)
|
||||||
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
||||||
|
|
@ -80,11 +80,11 @@ var BrowserHelper = {
|
||||||
windowEntry.lastSelectedBrowser = aBrowser;
|
windowEntry.lastSelectedBrowser = aBrowser;
|
||||||
},
|
},
|
||||||
|
|
||||||
increasePriority: function NP_BH_increasePriority(aBrowser) {
|
increasePriority: function (aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA);
|
aBrowser.adjustPriority(PRIORITY_DELTA);
|
||||||
},
|
},
|
||||||
|
|
||||||
decreasePriority: function NP_BH_decreasePriority(aBrowser) {
|
decreasePriority: function (aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -92,7 +92,7 @@ var BrowserHelper = {
|
||||||
|
|
||||||
// Methods that impact a window. Put into single object for organization.
|
// Methods that impact a window. Put into single object for organization.
|
||||||
var WindowHelper = {
|
var WindowHelper = {
|
||||||
addWindow: function NP_WH_addWindow(aWindow) {
|
addWindow: function (aWindow) {
|
||||||
// Build internal data object
|
// Build internal data object
|
||||||
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ var WindowHelper = {
|
||||||
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeWindow: function NP_WH_removeWindow(aWindow) {
|
removeWindow: function (aWindow) {
|
||||||
if (aWindow == _lastFocusedWindow)
|
if (aWindow == _lastFocusedWindow)
|
||||||
_lastFocusedWindow = null;
|
_lastFocusedWindow = null;
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ var WindowHelper = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onActivate: function NP_WH_onActivate(aWindow, aHasFocus) {
|
onActivate: function (aWindow, aHasFocus) {
|
||||||
// If this window was the last focused window, we don't need to do anything
|
// If this window was the last focused window, we don't need to do anything
|
||||||
if (aWindow == _lastFocusedWindow)
|
if (aWindow == _lastFocusedWindow)
|
||||||
return;
|
return;
|
||||||
|
|
@ -143,7 +143,7 @@ var WindowHelper = {
|
||||||
this.increasePriority(aWindow);
|
this.increasePriority(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleFocusedWindow: function NP_WH_handleFocusedWindow(aWindow) {
|
handleFocusedWindow: function (aWindow) {
|
||||||
// If we have a last focused window, we need to deprioritize it first
|
// If we have a last focused window, we need to deprioritize it first
|
||||||
if (_lastFocusedWindow)
|
if (_lastFocusedWindow)
|
||||||
this.decreasePriority(_lastFocusedWindow);
|
this.decreasePriority(_lastFocusedWindow);
|
||||||
|
|
@ -153,23 +153,23 @@ var WindowHelper = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Auxiliary methods
|
// Auxiliary methods
|
||||||
increasePriority: function NP_WH_increasePriority(aWindow) {
|
increasePriority: function (aWindow) {
|
||||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||||
BrowserHelper.increasePriority(aBrowser);
|
BrowserHelper.increasePriority(aBrowser);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
decreasePriority: function NP_WH_decreasePriority(aWindow) {
|
decreasePriority: function (aWindow) {
|
||||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||||
BrowserHelper.decreasePriority(aBrowser);
|
BrowserHelper.decreasePriority(aBrowser);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getEntry: function NP_WH_getEntry(aWindow) {
|
getEntry: function (aWindow) {
|
||||||
return _windows[this.getEntryIndex(aWindow)];
|
return _windows[this.getEntryIndex(aWindow)];
|
||||||
},
|
},
|
||||||
|
|
||||||
getEntryIndex: function NP_WH_getEntryAtIndex(aWindow) {
|
getEntryIndex: function (aWindow) {
|
||||||
// Assumes that every object has a unique window & it's in the array
|
// Assumes that every object has a unique window & it's in the array
|
||||||
for (let i = 0; i < _windows.length; i++)
|
for (let i = 0; i < _windows.length; i++)
|
||||||
if (_windows[i].window == aWindow)
|
if (_windows[i].window == aWindow)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ Notification.prototype = {
|
||||||
/**
|
/**
|
||||||
* Removes the notification and updates the popup accordingly if needed.
|
* Removes the notification and updates the popup accordingly if needed.
|
||||||
*/
|
*/
|
||||||
remove: function Notification_remove() {
|
remove: function () {
|
||||||
this.owner.remove(this);
|
this.owner.remove(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ PopupNotifications.prototype = {
|
||||||
* @returns the corresponding Notification object, or null if no such
|
* @returns the corresponding Notification object, or null if no such
|
||||||
* notification exists.
|
* notification exists.
|
||||||
*/
|
*/
|
||||||
getNotification: function PopupNotifications_getNotification(id, browser) {
|
getNotification: function (id, browser) {
|
||||||
let n = null;
|
let n = null;
|
||||||
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
||||||
notifications.some(function(x) x.id == id && (n = x));
|
notifications.some(function(x) x.id == id && (n = x));
|
||||||
|
|
@ -292,7 +292,7 @@ PopupNotifications.prototype = {
|
||||||
* opens the URL in a new tab.
|
* opens the URL in a new tab.
|
||||||
* @returns the Notification object corresponding to the added notification.
|
* @returns the Notification object corresponding to the added notification.
|
||||||
*/
|
*/
|
||||||
show: function PopupNotifications_show(browser, id, message, anchorID,
|
show: function (browser, id, message, anchorID,
|
||||||
mainAction, secondaryActions, options) {
|
mainAction, secondaryActions, options) {
|
||||||
function isInvalidAction(a) {
|
function isInvalidAction(a) {
|
||||||
return !a || !(typeof(a.callback) == "function") || !a.label || !a.accessKey;
|
return !a || !(typeof(a.callback) == "function") || !a.label || !a.accessKey;
|
||||||
|
|
@ -362,7 +362,7 @@ PopupNotifications.prototype = {
|
||||||
* Called by the consumer to indicate that a browser's location has changed,
|
* Called by the consumer to indicate that a browser's location has changed,
|
||||||
* so that we can update the active notifications accordingly.
|
* so that we can update the active notifications accordingly.
|
||||||
*/
|
*/
|
||||||
locationChange: function PopupNotifications_locationChange(aBrowser) {
|
locationChange: function (aBrowser) {
|
||||||
if (!aBrowser)
|
if (!aBrowser)
|
||||||
throw "PopupNotifications_locationChange: invalid browser";
|
throw "PopupNotifications_locationChange: invalid browser";
|
||||||
|
|
||||||
|
|
@ -415,7 +415,7 @@ PopupNotifications.prototype = {
|
||||||
* @param notification
|
* @param notification
|
||||||
* The Notification object to remove.
|
* The Notification object to remove.
|
||||||
*/
|
*/
|
||||||
remove: function PopupNotifications_remove(notification) {
|
remove: function (notification) {
|
||||||
this._remove(notification);
|
this._remove(notification);
|
||||||
|
|
||||||
if (notification.browser.docShell.isActive) {
|
if (notification.browser.docShell.isActive) {
|
||||||
|
|
@ -459,7 +459,7 @@ PopupNotifications.prototype = {
|
||||||
return this.tabbrowser.selectedBrowser ? this._getNotificationsForBrowser(this.tabbrowser.selectedBrowser) : [];
|
return this.tabbrowser.selectedBrowser ? this._getNotificationsForBrowser(this.tabbrowser.selectedBrowser) : [];
|
||||||
},
|
},
|
||||||
|
|
||||||
_remove: function PopupNotifications_removeHelper(notification) {
|
_remove: function (notification) {
|
||||||
// This notification may already be removed, in which case let's just fail
|
// This notification may already be removed, in which case let's just fail
|
||||||
// silently.
|
// silently.
|
||||||
let notifications = this._getNotificationsForBrowser(notification.browser);
|
let notifications = this._getNotificationsForBrowser(notification.browser);
|
||||||
|
|
@ -481,7 +481,7 @@ PopupNotifications.prototype = {
|
||||||
/**
|
/**
|
||||||
* Dismisses the notification without removing it.
|
* Dismisses the notification without removing it.
|
||||||
*/
|
*/
|
||||||
_dismiss: function PopupNotifications_dismiss() {
|
_dismiss: function () {
|
||||||
let browser = this.panel.firstChild &&
|
let browser = this.panel.firstChild &&
|
||||||
this.panel.firstChild.notification.browser;
|
this.panel.firstChild.notification.browser;
|
||||||
if (typeof this.panel.hidePopup === "function") {
|
if (typeof this.panel.hidePopup === "function") {
|
||||||
|
|
@ -494,7 +494,7 @@ PopupNotifications.prototype = {
|
||||||
/**
|
/**
|
||||||
* Hides the notification popup.
|
* Hides the notification popup.
|
||||||
*/
|
*/
|
||||||
_hidePanel: function PopupNotifications_hide() {
|
_hidePanel: function () {
|
||||||
this._ignoreDismissal = true;
|
this._ignoreDismissal = true;
|
||||||
if (typeof this.panel.hidePopup === "function") {
|
if (typeof this.panel.hidePopup === "function") {
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
|
|
@ -536,7 +536,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_refreshPanel: function PopupNotifications_refreshPanel(notificationsToShow) {
|
_refreshPanel: function (notificationsToShow) {
|
||||||
this._clearPanel();
|
this._clearPanel();
|
||||||
|
|
||||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
|
|
@ -653,7 +653,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showPanel: function PopupNotifications_showPanel(notificationsToShow, anchorElement) {
|
_showPanel: function (notificationsToShow, anchorElement) {
|
||||||
this.panel.hidden = false;
|
this.panel.hidden = false;
|
||||||
|
|
||||||
notificationsToShow.forEach(function (n) {
|
notificationsToShow.forEach(function (n) {
|
||||||
|
|
@ -709,7 +709,7 @@ PopupNotifications.prototype = {
|
||||||
* if there are no notifications to show. Otherwise,
|
* if there are no notifications to show. Otherwise,
|
||||||
* currently displayed notifications will be left alone.
|
* currently displayed notifications will be left alone.
|
||||||
*/
|
*/
|
||||||
_update: function PopupNotifications_update(notifications, anchor, dismissShowing = false) {
|
_update: function (notifications, anchor, dismissShowing = false) {
|
||||||
let useIconBox = this.iconBox && (!anchor || anchor.parentNode == this.iconBox);
|
let useIconBox = this.iconBox && (!anchor || anchor.parentNode == this.iconBox);
|
||||||
if (useIconBox) {
|
if (useIconBox) {
|
||||||
// hide icons of the previous tab.
|
// hide icons of the previous tab.
|
||||||
|
|
@ -777,7 +777,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showIcons: function PopupNotifications_showIcons(aCurrentNotifications) {
|
_showIcons: function (aCurrentNotifications) {
|
||||||
for (let notification of aCurrentNotifications) {
|
for (let notification of aCurrentNotifications) {
|
||||||
let anchorElm = notification.anchorElement;
|
let anchorElm = notification.anchorElement;
|
||||||
if (anchorElm) {
|
if (anchorElm) {
|
||||||
|
|
@ -786,7 +786,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideIcons: function PopupNotifications_hideIcons() {
|
_hideIcons: function () {
|
||||||
let icons = this.iconBox.querySelectorAll(ICON_SELECTOR);
|
let icons = this.iconBox.querySelectorAll(ICON_SELECTOR);
|
||||||
for (let icon of icons) {
|
for (let icon of icons) {
|
||||||
icon.removeAttribute(ICON_ATTRIBUTE_SHOWING);
|
icon.removeAttribute(ICON_ATTRIBUTE_SHOWING);
|
||||||
|
|
@ -796,7 +796,7 @@ PopupNotifications.prototype = {
|
||||||
/**
|
/**
|
||||||
* Gets and sets notifications for the browser.
|
* Gets and sets notifications for the browser.
|
||||||
*/
|
*/
|
||||||
_getNotificationsForBrowser: function PopupNotifications_getNotifications(browser) {
|
_getNotificationsForBrowser: function (browser) {
|
||||||
let notifications = popupNotificationsMap.get(browser);
|
let notifications = popupNotificationsMap.get(browser);
|
||||||
if (!notifications) {
|
if (!notifications) {
|
||||||
// Initialize the WeakMap for the browser so callers can reference/manipulate the array.
|
// Initialize the WeakMap for the browser so callers can reference/manipulate the array.
|
||||||
|
|
@ -805,12 +805,12 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
return notifications;
|
return notifications;
|
||||||
},
|
},
|
||||||
_setNotificationsForBrowser: function PopupNotifications_setNotifications(browser, notifications) {
|
_setNotificationsForBrowser: function (browser, notifications) {
|
||||||
popupNotificationsMap.set(browser, notifications);
|
popupNotificationsMap.set(browser, notifications);
|
||||||
return notifications;
|
return notifications;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIconBoxCommand: function PopupNotifications_onIconBoxCommand(event) {
|
_onIconBoxCommand: function (event) {
|
||||||
// Left click, space or enter only
|
// Left click, space or enter only
|
||||||
let type = event.type;
|
let type = event.type;
|
||||||
if (type == "click" && event.button != 0)
|
if (type == "click" && event.button != 0)
|
||||||
|
|
@ -832,7 +832,7 @@ PopupNotifications.prototype = {
|
||||||
this._reshowNotifications(anchor);
|
this._reshowNotifications(anchor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_reshowNotifications: function PopupNotifications_reshowNotifications(anchor, browser) {
|
_reshowNotifications: function (anchor, browser) {
|
||||||
// Mark notifications anchored to this anchor as un-dismissed
|
// Mark notifications anchored to this anchor as un-dismissed
|
||||||
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
||||||
notifications.forEach(function (n) {
|
notifications.forEach(function (n) {
|
||||||
|
|
@ -844,7 +844,7 @@ PopupNotifications.prototype = {
|
||||||
this._update(notifications, anchor);
|
this._update(notifications, anchor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_swapBrowserNotifications: function PopupNotifications_swapBrowserNoficications(ourBrowser, otherBrowser) {
|
_swapBrowserNotifications: function (ourBrowser, otherBrowser) {
|
||||||
// When swaping browser docshells (e.g. dragging tab to new window) we need
|
// When swaping browser docshells (e.g. dragging tab to new window) we need
|
||||||
// to update our notification map.
|
// to update our notification map.
|
||||||
|
|
||||||
|
|
@ -890,7 +890,7 @@ PopupNotifications.prototype = {
|
||||||
other._update(ourNotifications, ourNotifications[0].anchorElement);
|
other._update(ourNotifications, ourNotifications[0].anchorElement);
|
||||||
},
|
},
|
||||||
|
|
||||||
_fireCallback: function PopupNotifications_fireCallback(n, event, ...args) {
|
_fireCallback: function (n, event, ...args) {
|
||||||
try {
|
try {
|
||||||
if (n.options.eventCallback)
|
if (n.options.eventCallback)
|
||||||
return n.options.eventCallback.call(n, event, ...args);
|
return n.options.eventCallback.call(n, event, ...args);
|
||||||
|
|
@ -900,7 +900,7 @@ PopupNotifications.prototype = {
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupHidden: function PopupNotifications_onPopupHidden(event) {
|
_onPopupHidden: function (event) {
|
||||||
if (event.target != this.panel || this._ignoreDismissal)
|
if (event.target != this.panel || this._ignoreDismissal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -932,7 +932,7 @@ PopupNotifications.prototype = {
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonCommand: function PopupNotifications_onButtonCommand(event) {
|
_onButtonCommand: function (event) {
|
||||||
let notificationEl = getNotificationFromElement(event.originalTarget);
|
let notificationEl = getNotificationFromElement(event.originalTarget);
|
||||||
|
|
||||||
if (!notificationEl)
|
if (!notificationEl)
|
||||||
|
|
@ -968,7 +968,7 @@ PopupNotifications.prototype = {
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuCommand: function PopupNotifications_onMenuCommand(event) {
|
_onMenuCommand: function (event) {
|
||||||
let target = event.originalTarget;
|
let target = event.originalTarget;
|
||||||
if (!target.action || !target.notification)
|
if (!target.action || !target.notification)
|
||||||
throw "menucommand target has no associated action/notification";
|
throw "menucommand target has no associated action/notification";
|
||||||
|
|
@ -988,7 +988,7 @@ PopupNotifications.prototype = {
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_notify: function PopupNotifications_notify(topic) {
|
_notify: function (topic) {
|
||||||
Services.obs.notifyObservers(null, "PopupNotifications-" + topic, "");
|
Services.obs.notifyObservers(null, "PopupNotifications-" + topic, "");
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ this.RecentWindow = {
|
||||||
* Omit the property to search in both groups.
|
* Omit the property to search in both groups.
|
||||||
* * allowPopups: true if popup windows are permissable.
|
* * allowPopups: true if popup windows are permissable.
|
||||||
*/
|
*/
|
||||||
getMostRecentBrowserWindow: function RW_getMostRecentBrowserWindow(aOptions) {
|
getMostRecentBrowserWindow: function (aOptions) {
|
||||||
let checkPrivacy = typeof aOptions == "object" &&
|
let checkPrivacy = typeof aOptions == "object" &&
|
||||||
"private" in aOptions;
|
"private" in aOptions;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ this.WinTaskbarJumpList =
|
||||||
* Startup, shutdown, and update
|
* Startup, shutdown, and update
|
||||||
*/
|
*/
|
||||||
|
|
||||||
startup: function WTBJL_startup() {
|
startup: function () {
|
||||||
// exit if this isn't win7 or higher.
|
// exit if this isn't win7 or higher.
|
||||||
if (!this._initTaskbar())
|
if (!this._initTaskbar())
|
||||||
return;
|
return;
|
||||||
|
|
@ -175,7 +175,7 @@ this.WinTaskbarJumpList =
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function WTBJL_update() {
|
update: function () {
|
||||||
// are we disabled via prefs? don't do anything!
|
// are we disabled via prefs? don't do anything!
|
||||||
if (!this._enabled)
|
if (!this._enabled)
|
||||||
return;
|
return;
|
||||||
|
|
@ -184,7 +184,7 @@ this.WinTaskbarJumpList =
|
||||||
this._buildList();
|
this._buildList();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shutdown: function WTBJL__shutdown() {
|
_shutdown: function () {
|
||||||
this._shuttingDown = true;
|
this._shuttingDown = true;
|
||||||
|
|
||||||
// Correctly handle a clear history on shutdown. If there are no
|
// Correctly handle a clear history on shutdown. If there are no
|
||||||
|
|
@ -197,7 +197,7 @@ this.WinTaskbarJumpList =
|
||||||
this._free();
|
this._free();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shortcutMaintenance: function WTBJL__maintenace() {
|
_shortcutMaintenance: function () {
|
||||||
_winShellService.shortcutMaintenance();
|
_winShellService.shortcutMaintenance();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -212,11 +212,11 @@ this.WinTaskbarJumpList =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_pendingStatements: {},
|
_pendingStatements: {},
|
||||||
_hasPendingStatements: function WTBJL__hasPendingStatements() {
|
_hasPendingStatements: function () {
|
||||||
return Object.keys(this._pendingStatements).length > 0;
|
return Object.keys(this._pendingStatements).length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildList: function WTBJL__buildList() {
|
_buildList: function () {
|
||||||
if (this._hasPendingStatements()) {
|
if (this._hasPendingStatements()) {
|
||||||
// We were requested to update the list while another update was in
|
// We were requested to update the list while another update was in
|
||||||
// progress, this could happen at shutdown, idle or privatebrowsing.
|
// progress, this could happen at shutdown, idle or privatebrowsing.
|
||||||
|
|
@ -255,7 +255,7 @@ this.WinTaskbarJumpList =
|
||||||
* Taskbar api wrappers
|
* Taskbar api wrappers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_startBuild: function WTBJL__startBuild() {
|
_startBuild: function () {
|
||||||
var removedItems = Cc["@mozilla.org/array;1"].
|
var removedItems = Cc["@mozilla.org/array;1"].
|
||||||
createInstance(Ci.nsIMutableArray);
|
createInstance(Ci.nsIMutableArray);
|
||||||
this._builder.abortListBuild();
|
this._builder.abortListBuild();
|
||||||
|
|
@ -267,13 +267,13 @@ this.WinTaskbarJumpList =
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_commitBuild: function WTBJL__commitBuild() {
|
_commitBuild: function () {
|
||||||
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
||||||
this._builder.abortListBuild();
|
this._builder.abortListBuild();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildTasks: function WTBJL__buildTasks() {
|
_buildTasks: function () {
|
||||||
var items = Cc["@mozilla.org/array;1"].
|
var items = Cc["@mozilla.org/array;1"].
|
||||||
createInstance(Ci.nsIMutableArray);
|
createInstance(Ci.nsIMutableArray);
|
||||||
this._tasks.forEach(function (task) {
|
this._tasks.forEach(function (task) {
|
||||||
|
|
@ -288,12 +288,12 @@ this.WinTaskbarJumpList =
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildCustom: function WTBJL__buildCustom(title, items) {
|
_buildCustom: function (title, items) {
|
||||||
if (items.length > 0)
|
if (items.length > 0)
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildFrequent: function WTBJL__buildFrequent() {
|
_buildFrequent: function () {
|
||||||
// If history is empty, just bail out.
|
// If history is empty, just bail out.
|
||||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -333,7 +333,7 @@ this.WinTaskbarJumpList =
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildRecent: function WTBJL__buildRecent() {
|
_buildRecent: function () {
|
||||||
// If history is empty, just bail out.
|
// If history is empty, just bail out.
|
||||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -378,7 +378,7 @@ this.WinTaskbarJumpList =
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_deleteActiveJumpList: function WTBJL__deleteAJL() {
|
_deleteActiveJumpList: function () {
|
||||||
this._builder.deleteActiveList();
|
this._builder.deleteActiveList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -386,7 +386,7 @@ this.WinTaskbarJumpList =
|
||||||
* Jump list item creation helpers
|
* Jump list item creation helpers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_getHandlerAppItem: function WTBJL__getHandlerAppItem(name, description,
|
_getHandlerAppItem: function (name, description,
|
||||||
args, iconIndex,
|
args, iconIndex,
|
||||||
faviconPageUri) {
|
faviconPageUri) {
|
||||||
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
||||||
|
|
@ -408,7 +408,7 @@ this.WinTaskbarJumpList =
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSeparatorItem: function WTBJL__getSeparatorItem() {
|
_getSeparatorItem: function () {
|
||||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
||||||
createInstance(Ci.nsIJumpListSeparator);
|
createInstance(Ci.nsIJumpListSeparator);
|
||||||
return item;
|
return item;
|
||||||
|
|
@ -419,7 +419,7 @@ this.WinTaskbarJumpList =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_getHistoryResults:
|
_getHistoryResults:
|
||||||
function WTBLJL__getHistoryResults(aSortingMode, aLimit, aCallback, aScope) {
|
function (aSortingMode, aLimit, aCallback, aScope) {
|
||||||
var options = PlacesUtils.history.getNewQueryOptions();
|
var options = PlacesUtils.history.getNewQueryOptions();
|
||||||
options.maxResults = aLimit;
|
options.maxResults = aLimit;
|
||||||
options.sortingMode = aSortingMode;
|
options.sortingMode = aSortingMode;
|
||||||
|
|
@ -448,7 +448,7 @@ this.WinTaskbarJumpList =
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearHistory: function WTBJL__clearHistory(items) {
|
_clearHistory: function (items) {
|
||||||
if (!items)
|
if (!items)
|
||||||
return;
|
return;
|
||||||
var URIsToRemove = [];
|
var URIsToRemove = [];
|
||||||
|
|
@ -471,7 +471,7 @@ this.WinTaskbarJumpList =
|
||||||
* Prefs utilities
|
* Prefs utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_refreshPrefs: function WTBJL__refreshPrefs() {
|
_refreshPrefs: function () {
|
||||||
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
||||||
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
||||||
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
||||||
|
|
@ -483,7 +483,7 @@ this.WinTaskbarJumpList =
|
||||||
* Init and shutdown utilities
|
* Init and shutdown utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_initTaskbar: function WTBJL__initTaskbar() {
|
_initTaskbar: function () {
|
||||||
this._builder = _taskbarService.createJumpListBuilder();
|
this._builder = _taskbarService.createJumpListBuilder();
|
||||||
if (!this._builder || !this._builder.available)
|
if (!this._builder || !this._builder.available)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -491,7 +491,7 @@ this.WinTaskbarJumpList =
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initObs: function WTBJL__initObs() {
|
_initObs: function () {
|
||||||
// If the browser is closed while in private browsing mode, the "exit"
|
// If the browser is closed while in private browsing mode, the "exit"
|
||||||
// notification is fired on quit-application-granted.
|
// notification is fired on quit-application-granted.
|
||||||
// History cleanup can happen at profile-change-teardown.
|
// History cleanup can happen at profile-change-teardown.
|
||||||
|
|
@ -500,13 +500,13 @@ this.WinTaskbarJumpList =
|
||||||
_prefs.addObserver("", this, false);
|
_prefs.addObserver("", this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_freeObs: function WTBJL__freeObs() {
|
_freeObs: function () {
|
||||||
Services.obs.removeObserver(this, "profile-before-change");
|
Services.obs.removeObserver(this, "profile-before-change");
|
||||||
Services.obs.removeObserver(this, "browser:purge-session-history");
|
Services.obs.removeObserver(this, "browser:purge-session-history");
|
||||||
_prefs.removeObserver("", this);
|
_prefs.removeObserver("", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTimer: function WTBJL__updateTimer() {
|
_updateTimer: function () {
|
||||||
if (this._enabled && !this._shuttingDown && !this._timer) {
|
if (this._enabled && !this._shuttingDown && !this._timer) {
|
||||||
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
this._timer.initWithCallback(this,
|
this._timer.initWithCallback(this,
|
||||||
|
|
@ -520,7 +520,7 @@ this.WinTaskbarJumpList =
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasIdleObserver: false,
|
_hasIdleObserver: false,
|
||||||
_updateIdleObserver: function WTBJL__updateIdleObserver() {
|
_updateIdleObserver: function () {
|
||||||
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
||||||
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||||
this._hasIdleObserver = true;
|
this._hasIdleObserver = true;
|
||||||
|
|
@ -531,7 +531,7 @@ this.WinTaskbarJumpList =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_free: function WTBJL__free() {
|
_free: function () {
|
||||||
this._freeObs();
|
this._freeObs();
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
|
|
@ -542,13 +542,13 @@ this.WinTaskbarJumpList =
|
||||||
* Notification handlers
|
* Notification handlers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
notify: function WTBJL_notify(aTimer) {
|
notify: function (aTimer) {
|
||||||
// Add idle observer on the first notification so it doesn't hit startup.
|
// Add idle observer on the first notification so it doesn't hit startup.
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function WTBJL_observe(aSubject, aTopic, aData) {
|
observe: function (aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ this.OpenLocationLastURL = function OpenLocationLastURL(aWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenLocationLastURL.prototype = {
|
OpenLocationLastURL.prototype = {
|
||||||
isPrivate: function OpenLocationLastURL_isPrivate() {
|
isPrivate: function () {
|
||||||
// Assume not in private browsing mode, unless the browser window is
|
// Assume not in private browsing mode, unless the browser window is
|
||||||
// in private mode.
|
// in private mode.
|
||||||
if (!this.window)
|
if (!this.window)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue