mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
[Pale-Moon] Remove excess whitespace.
This commit is contained in:
parent
fcab070621
commit
b6b33a6b2a
73 changed files with 1883 additions and 1883 deletions
|
|
@ -49,18 +49,18 @@ function clearTimer(timer) {
|
|||
}
|
||||
|
||||
this.BrowserNewTabPreloader = {
|
||||
init: function () {
|
||||
init: function() {
|
||||
Initializer.start();
|
||||
},
|
||||
|
||||
uninit: function () {
|
||||
uninit: function() {
|
||||
Initializer.stop();
|
||||
HostFrame.destroy();
|
||||
Preferences.uninit();
|
||||
HiddenBrowsers.uninit();
|
||||
},
|
||||
|
||||
newTab: function (aTab) {
|
||||
newTab: function(aTab) {
|
||||
let win = aTab.ownerDocument.defaultView;
|
||||
if (win.gBrowser) {
|
||||
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
|
|
@ -83,12 +83,12 @@ var Initializer = {
|
|||
_timer: null,
|
||||
_observing: false,
|
||||
|
||||
start: function () {
|
||||
start: function() {
|
||||
Services.obs.addObserver(this, TOPIC_DELAYED_STARTUP, false);
|
||||
this._observing = true;
|
||||
},
|
||||
|
||||
stop: function () {
|
||||
stop: function() {
|
||||
this._timer = clearTimer(this._timer);
|
||||
|
||||
if (this._observing) {
|
||||
|
|
@ -97,7 +97,7 @@ var Initializer = {
|
|||
}
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == TOPIC_DELAYED_STARTUP) {
|
||||
Services.obs.removeObserver(this, TOPIC_DELAYED_STARTUP);
|
||||
this._observing = false;
|
||||
|
|
@ -108,11 +108,11 @@ var Initializer = {
|
|||
}
|
||||
},
|
||||
|
||||
_startTimer: function () {
|
||||
_startTimer: function() {
|
||||
this._timer = createTimer(this, PRELOADER_INIT_DELAY_MS);
|
||||
},
|
||||
|
||||
_startPreloader: function () {
|
||||
_startPreloader: function() {
|
||||
Preferences.init();
|
||||
if (Preferences.enabled) {
|
||||
HiddenBrowsers.init();
|
||||
|
|
@ -133,19 +133,19 @@ var Preferences = {
|
|||
return this._enabled;
|
||||
},
|
||||
|
||||
init: function () {
|
||||
init: function() {
|
||||
this._branch = Services.prefs.getBranch(PREF_BRANCH);
|
||||
this._branch.addObserver("", this, false);
|
||||
},
|
||||
|
||||
uninit: function () {
|
||||
uninit: function() {
|
||||
if (this._branch) {
|
||||
this._branch.removeObserver("", this);
|
||||
this._branch = null;
|
||||
}
|
||||
},
|
||||
|
||||
observe: function () {
|
||||
observe: function() {
|
||||
let prevEnabled = this._enabled;
|
||||
this._enabled = null;
|
||||
|
||||
|
|
@ -166,13 +166,13 @@ var HiddenBrowsers = {
|
|||
TOPIC_XUL_WINDOW_CLOSED
|
||||
],
|
||||
|
||||
init: function () {
|
||||
init: function() {
|
||||
this._browsers = new Map();
|
||||
this._updateBrowserSizes();
|
||||
this._topics.forEach(t => Services.obs.addObserver(this, t, false));
|
||||
},
|
||||
|
||||
uninit: function () {
|
||||
uninit: function() {
|
||||
if (this._browsers) {
|
||||
this._topics.forEach(t => Services.obs.removeObserver(this, t, false));
|
||||
this._updateTimer = clearTimer(this._updateTimer);
|
||||
|
|
@ -184,7 +184,7 @@ var HiddenBrowsers = {
|
|||
}
|
||||
},
|
||||
|
||||
get: function (width, height) {
|
||||
get: function(width, height) {
|
||||
// We haven't been initialized, yet.
|
||||
if (!this._browsers) {
|
||||
return null;
|
||||
|
|
@ -212,7 +212,7 @@ var HiddenBrowsers = {
|
|||
return null;
|
||||
},
|
||||
|
||||
observe: function (subject, topic, data) {
|
||||
observe: function(subject, topic, data) {
|
||||
if (topic === TOPIC_TIMER_CALLBACK) {
|
||||
this._updateTimer = null;
|
||||
this._updateBrowserSizes();
|
||||
|
|
@ -222,7 +222,7 @@ var HiddenBrowsers = {
|
|||
}
|
||||
},
|
||||
|
||||
_updateBrowserSizes: function () {
|
||||
_updateBrowserSizes: function() {
|
||||
let sizes = this._collectTabBrowserSizes();
|
||||
let toRemove = [];
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ var HiddenBrowsers = {
|
|||
toRemove.forEach(b => b.destroy());
|
||||
},
|
||||
|
||||
_collectTabBrowserSizes: function () {
|
||||
_collectTabBrowserSizes: function() {
|
||||
let sizes = new Map();
|
||||
|
||||
function tabBrowserBounds() {
|
||||
|
|
@ -314,7 +314,7 @@ HiddenBrowser.prototype = {
|
|||
this._browser.currentURI.spec === NEWTAB_URL;
|
||||
},
|
||||
|
||||
swapWithNewTab: function (aTab) {
|
||||
swapWithNewTab: function(aTab) {
|
||||
if (!this.isPreloaded || this._timer) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -349,27 +349,27 @@ HiddenBrowser.prototype = {
|
|||
return true;
|
||||
},
|
||||
|
||||
observe: function () {
|
||||
observe: function() {
|
||||
this._timer = null;
|
||||
|
||||
// Start pre-loading the new tab page.
|
||||
this._browser.loadURI(NEWTAB_URL);
|
||||
},
|
||||
|
||||
resize: function (width, height) {
|
||||
resize: function(width, height) {
|
||||
this._width = width;
|
||||
this._height = height;
|
||||
this._applySize();
|
||||
},
|
||||
|
||||
_applySize: function () {
|
||||
_applySize: function() {
|
||||
if (this._browser) {
|
||||
this._browser.style.width = this._width + "px";
|
||||
this._browser.style.height = this._height + "px";
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
destroy: function() {
|
||||
if (this._browser) {
|
||||
this._browser.remove();
|
||||
this._browser = null;
|
||||
|
|
@ -391,7 +391,7 @@ var HostFrame = {
|
|||
return this.hiddenDOMDocument.readyState === "complete";
|
||||
},
|
||||
|
||||
get: function () {
|
||||
get: function() {
|
||||
if (!this._deferred) {
|
||||
this._deferred = Promise.defer();
|
||||
this._create();
|
||||
|
|
@ -400,7 +400,7 @@ var HostFrame = {
|
|||
return this._deferred.promise;
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
destroy: function() {
|
||||
if (this._frame) {
|
||||
if (!Cu.isDeadWrapper(this._frame)) {
|
||||
this._frame.removeEventListener("load", this, true);
|
||||
|
|
@ -412,7 +412,7 @@ var HostFrame = {
|
|||
}
|
||||
},
|
||||
|
||||
handleEvent: function () {
|
||||
handleEvent: function() {
|
||||
let contentWindow = this._frame.contentWindow;
|
||||
if (contentWindow.location.href === XUL_PAGE) {
|
||||
this._frame.removeEventListener("load", this, true);
|
||||
|
|
@ -422,7 +422,7 @@ var HostFrame = {
|
|||
}
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
_create: function() {
|
||||
if (this.isReady) {
|
||||
let doc = this.hiddenDOMDocument;
|
||||
this._frame = doc.createElementNS(HTML_NS, "iframe");
|
||||
|
|
|
|||
|
|
@ -65,13 +65,13 @@ function _handleEvent(aEvent) {
|
|||
|
||||
// Methods that impact a browser. Put into single object for organization.
|
||||
var BrowserHelper = {
|
||||
onOpen: function (aBrowser) {
|
||||
onOpen: function(aBrowser) {
|
||||
// If the tab is in the focused window, leave priority as it is
|
||||
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
|
||||
this.decreasePriority(aBrowser);
|
||||
},
|
||||
|
||||
onSelect: function (aBrowser) {
|
||||
onSelect: function(aBrowser) {
|
||||
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
|
||||
if (windowEntry.lastSelectedBrowser)
|
||||
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
||||
|
|
@ -80,11 +80,11 @@ var BrowserHelper = {
|
|||
windowEntry.lastSelectedBrowser = aBrowser;
|
||||
},
|
||||
|
||||
increasePriority: function (aBrowser) {
|
||||
increasePriority: function(aBrowser) {
|
||||
aBrowser.adjustPriority(PRIORITY_DELTA);
|
||||
},
|
||||
|
||||
decreasePriority: function (aBrowser) {
|
||||
decreasePriority: function(aBrowser) {
|
||||
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
||||
}
|
||||
};
|
||||
|
|
@ -92,7 +92,7 @@ var BrowserHelper = {
|
|||
|
||||
// Methods that impact a window. Put into single object for organization.
|
||||
var WindowHelper = {
|
||||
addWindow: function (aWindow) {
|
||||
addWindow: function(aWindow) {
|
||||
// Build internal data object
|
||||
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ var WindowHelper = {
|
|||
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
||||
},
|
||||
|
||||
removeWindow: function (aWindow) {
|
||||
removeWindow: function(aWindow) {
|
||||
if (aWindow == _lastFocusedWindow)
|
||||
_lastFocusedWindow = null;
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ var WindowHelper = {
|
|||
});
|
||||
},
|
||||
|
||||
onActivate: function (aWindow, aHasFocus) {
|
||||
onActivate: function(aWindow, aHasFocus) {
|
||||
// If this window was the last focused window, we don't need to do anything
|
||||
if (aWindow == _lastFocusedWindow)
|
||||
return;
|
||||
|
|
@ -143,7 +143,7 @@ var WindowHelper = {
|
|||
this.increasePriority(aWindow);
|
||||
},
|
||||
|
||||
handleFocusedWindow: function (aWindow) {
|
||||
handleFocusedWindow: function(aWindow) {
|
||||
// If we have a last focused window, we need to deprioritize it first
|
||||
if (_lastFocusedWindow)
|
||||
this.decreasePriority(_lastFocusedWindow);
|
||||
|
|
@ -153,23 +153,23 @@ var WindowHelper = {
|
|||
},
|
||||
|
||||
// Auxiliary methods
|
||||
increasePriority: function (aWindow) {
|
||||
increasePriority: function(aWindow) {
|
||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||
BrowserHelper.increasePriority(aBrowser);
|
||||
});
|
||||
},
|
||||
|
||||
decreasePriority: function (aWindow) {
|
||||
decreasePriority: function(aWindow) {
|
||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||
BrowserHelper.decreasePriority(aBrowser);
|
||||
});
|
||||
},
|
||||
|
||||
getEntry: function (aWindow) {
|
||||
getEntry: function(aWindow) {
|
||||
return _windows[this.getEntryIndex(aWindow)];
|
||||
},
|
||||
|
||||
getEntryIndex: function (aWindow) {
|
||||
getEntryIndex: function(aWindow) {
|
||||
// Assumes that every object has a unique window & it's in the array
|
||||
for (let i = 0; i < _windows.length; i++)
|
||||
if (_windows[i].window == aWindow)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ Notification.prototype = {
|
|||
/**
|
||||
* Removes the notification and updates the popup accordingly if needed.
|
||||
*/
|
||||
remove: function () {
|
||||
remove: function() {
|
||||
this.owner.remove(this);
|
||||
},
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ PopupNotifications.prototype = {
|
|||
* @returns the corresponding Notification object, or null if no such
|
||||
* notification exists.
|
||||
*/
|
||||
getNotification: function (id, browser) {
|
||||
getNotification: function(id, browser) {
|
||||
let n = null;
|
||||
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
||||
notifications.some(function(x) x.id == id && (n = x));
|
||||
|
|
@ -292,7 +292,7 @@ PopupNotifications.prototype = {
|
|||
* opens the URL in a new tab.
|
||||
* @returns the Notification object corresponding to the added notification.
|
||||
*/
|
||||
show: function (browser, id, message, anchorID,
|
||||
show: function(browser, id, message, anchorID,
|
||||
mainAction, secondaryActions, options) {
|
||||
function isInvalidAction(a) {
|
||||
return !a || !(typeof(a.callback) == "function") || !a.label || !a.accessKey;
|
||||
|
|
@ -362,13 +362,13 @@ PopupNotifications.prototype = {
|
|||
* Called by the consumer to indicate that a browser's location has changed,
|
||||
* so that we can update the active notifications accordingly.
|
||||
*/
|
||||
locationChange: function (aBrowser) {
|
||||
locationChange: function(aBrowser) {
|
||||
if (!aBrowser)
|
||||
throw "PopupNotifications_locationChange: invalid browser";
|
||||
|
||||
let notifications = this._getNotificationsForBrowser(aBrowser);
|
||||
|
||||
notifications = notifications.filter(function (notification) {
|
||||
notifications = notifications.filter(function(notification) {
|
||||
// The persistWhileVisible option allows an open notification to persist
|
||||
// across location changes
|
||||
if (notification.options.persistWhileVisible &&
|
||||
|
|
@ -415,7 +415,7 @@ PopupNotifications.prototype = {
|
|||
* @param notification
|
||||
* The Notification object to remove.
|
||||
*/
|
||||
remove: function (notification) {
|
||||
remove: function(notification) {
|
||||
this._remove(notification);
|
||||
|
||||
if (notification.browser.docShell.isActive) {
|
||||
|
|
@ -424,7 +424,7 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
handleEvent: function (aEvent) {
|
||||
handleEvent: function(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "popuphidden":
|
||||
this._onPopupHidden(aEvent);
|
||||
|
|
@ -434,7 +434,7 @@ PopupNotifications.prototype = {
|
|||
let self = this;
|
||||
// setTimeout(..., 0) needed, otherwise openPopup from "activate" event
|
||||
// handler results in the popup being hidden again for some reason...
|
||||
this.window.setTimeout(function () {
|
||||
this.window.setTimeout(function() {
|
||||
self._update();
|
||||
}, 0);
|
||||
break;
|
||||
|
|
@ -459,7 +459,7 @@ PopupNotifications.prototype = {
|
|||
return this.tabbrowser.selectedBrowser ? this._getNotificationsForBrowser(this.tabbrowser.selectedBrowser) : [];
|
||||
},
|
||||
|
||||
_remove: function (notification) {
|
||||
_remove: function(notification) {
|
||||
// This notification may already be removed, in which case let's just fail
|
||||
// silently.
|
||||
let notifications = this._getNotificationsForBrowser(notification.browser);
|
||||
|
|
@ -481,7 +481,7 @@ PopupNotifications.prototype = {
|
|||
/**
|
||||
* Dismisses the notification without removing it.
|
||||
*/
|
||||
_dismiss: function () {
|
||||
_dismiss: function() {
|
||||
let browser = this.panel.firstChild &&
|
||||
this.panel.firstChild.notification.browser;
|
||||
if (typeof this.panel.hidePopup === "function") {
|
||||
|
|
@ -494,7 +494,7 @@ PopupNotifications.prototype = {
|
|||
/**
|
||||
* Hides the notification popup.
|
||||
*/
|
||||
_hidePanel: function () {
|
||||
_hidePanel: function() {
|
||||
this._ignoreDismissal = true;
|
||||
if (typeof this.panel.hidePopup === "function") {
|
||||
this.panel.hidePopup();
|
||||
|
|
@ -505,7 +505,7 @@ PopupNotifications.prototype = {
|
|||
/**
|
||||
* Removes all notifications from the notification popup.
|
||||
*/
|
||||
_clearPanel: function () {
|
||||
_clearPanel: function() {
|
||||
let popupnotification;
|
||||
while ((popupnotification = this.panel.lastChild)) {
|
||||
this.panel.removeChild(popupnotification);
|
||||
|
|
@ -536,12 +536,12 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_refreshPanel: function (notificationsToShow) {
|
||||
_refreshPanel: function(notificationsToShow) {
|
||||
this._clearPanel();
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
notificationsToShow.forEach(function (n) {
|
||||
notificationsToShow.forEach(function(n) {
|
||||
let doc = this.window.document;
|
||||
|
||||
// Append "-notification" to the ID to try to avoid ID conflicts with other stuff
|
||||
|
|
@ -584,7 +584,7 @@ PopupNotifications.prototype = {
|
|||
popupnotification.notification = n;
|
||||
|
||||
if (n.secondaryActions) {
|
||||
n.secondaryActions.forEach(function (a) {
|
||||
n.secondaryActions.forEach(function(a) {
|
||||
let item = doc.createElementNS(XUL_NS, "menuitem");
|
||||
item.setAttribute("label", a.label);
|
||||
item.setAttribute("accesskey", a.accessKey);
|
||||
|
|
@ -653,10 +653,10 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_showPanel: function (notificationsToShow, anchorElement) {
|
||||
_showPanel: function(notificationsToShow, anchorElement) {
|
||||
this.panel.hidden = false;
|
||||
|
||||
notificationsToShow.forEach(function (n) {
|
||||
notificationsToShow.forEach(function(n) {
|
||||
this._fireCallback(n, NOTIFICATION_EVENT_SHOWING);
|
||||
}, this);
|
||||
this._refreshPanel(notificationsToShow);
|
||||
|
|
@ -686,12 +686,12 @@ PopupNotifications.prototype = {
|
|||
// On OS X and Linux we need a different panel arrow color for
|
||||
// click-to-play plugins, so copy the popupid and use css.
|
||||
this.panel.setAttribute("popupid", this.panel.firstChild.getAttribute("popupid"));
|
||||
notificationsToShow.forEach(function (n) {
|
||||
notificationsToShow.forEach(function(n) {
|
||||
// Remember the time the notification was shown for the security delay.
|
||||
n.timeShown = this.window.performance.now();
|
||||
}, this);
|
||||
this.panel.openPopup(anchorElement, "bottomcenter topleft");
|
||||
notificationsToShow.forEach(function (n) {
|
||||
notificationsToShow.forEach(function(n) {
|
||||
this._fireCallback(n, NOTIFICATION_EVENT_SHOWN);
|
||||
}, this);
|
||||
},
|
||||
|
|
@ -709,7 +709,7 @@ PopupNotifications.prototype = {
|
|||
* if there are no notifications to show. Otherwise,
|
||||
* currently displayed notifications will be left alone.
|
||||
*/
|
||||
_update: function (notifications, anchor, dismissShowing = false) {
|
||||
_update: function(notifications, anchor, dismissShowing = false) {
|
||||
let useIconBox = this.iconBox && (!anchor || anchor.parentNode == this.iconBox);
|
||||
if (useIconBox) {
|
||||
// hide icons of the previous tab.
|
||||
|
|
@ -747,7 +747,7 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
|
||||
// Also filter out notifications that have been dismissed.
|
||||
notificationsToShow = notifications.filter(function (n) {
|
||||
notificationsToShow = notifications.filter(function(n) {
|
||||
return !n.dismissed && n.anchorElement == anchorElement &&
|
||||
!n.options.neverShow;
|
||||
});
|
||||
|
|
@ -777,7 +777,7 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_showIcons: function (aCurrentNotifications) {
|
||||
_showIcons: function(aCurrentNotifications) {
|
||||
for (let notification of aCurrentNotifications) {
|
||||
let anchorElm = notification.anchorElement;
|
||||
if (anchorElm) {
|
||||
|
|
@ -786,7 +786,7 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_hideIcons: function () {
|
||||
_hideIcons: function() {
|
||||
let icons = this.iconBox.querySelectorAll(ICON_SELECTOR);
|
||||
for (let icon of icons) {
|
||||
icon.removeAttribute(ICON_ATTRIBUTE_SHOWING);
|
||||
|
|
@ -796,7 +796,7 @@ PopupNotifications.prototype = {
|
|||
/**
|
||||
* Gets and sets notifications for the browser.
|
||||
*/
|
||||
_getNotificationsForBrowser: function (browser) {
|
||||
_getNotificationsForBrowser: function(browser) {
|
||||
let notifications = popupNotificationsMap.get(browser);
|
||||
if (!notifications) {
|
||||
// Initialize the WeakMap for the browser so callers can reference/manipulate the array.
|
||||
|
|
@ -805,12 +805,12 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
return notifications;
|
||||
},
|
||||
_setNotificationsForBrowser: function (browser, notifications) {
|
||||
_setNotificationsForBrowser: function(browser, notifications) {
|
||||
popupNotificationsMap.set(browser, notifications);
|
||||
return notifications;
|
||||
},
|
||||
|
||||
_onIconBoxCommand: function (event) {
|
||||
_onIconBoxCommand: function(event) {
|
||||
// Left click, space or enter only
|
||||
let type = event.type;
|
||||
if (type == "click" && event.button != 0)
|
||||
|
|
@ -832,10 +832,10 @@ PopupNotifications.prototype = {
|
|||
this._reshowNotifications(anchor);
|
||||
},
|
||||
|
||||
_reshowNotifications: function (anchor, browser) {
|
||||
_reshowNotifications: function(anchor, browser) {
|
||||
// Mark notifications anchored to this anchor as un-dismissed
|
||||
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
||||
notifications.forEach(function (n) {
|
||||
notifications.forEach(function(n) {
|
||||
if (n.anchorElement == anchor)
|
||||
n.dismissed = false;
|
||||
});
|
||||
|
|
@ -844,7 +844,7 @@ PopupNotifications.prototype = {
|
|||
this._update(notifications, anchor);
|
||||
},
|
||||
|
||||
_swapBrowserNotifications: function (ourBrowser, otherBrowser) {
|
||||
_swapBrowserNotifications: function(ourBrowser, otherBrowser) {
|
||||
// When swaping browser docshells (e.g. dragging tab to new window) we need
|
||||
// to update our notification map.
|
||||
|
||||
|
|
@ -890,7 +890,7 @@ PopupNotifications.prototype = {
|
|||
other._update(ourNotifications, ourNotifications[0].anchorElement);
|
||||
},
|
||||
|
||||
_fireCallback: function (n, event, ...args) {
|
||||
_fireCallback: function(n, event, ...args) {
|
||||
try {
|
||||
if (n.options.eventCallback)
|
||||
return n.options.eventCallback.call(n, event, ...args);
|
||||
|
|
@ -900,7 +900,7 @@ PopupNotifications.prototype = {
|
|||
return undefined;
|
||||
},
|
||||
|
||||
_onPopupHidden: function (event) {
|
||||
_onPopupHidden: function(event) {
|
||||
if (event.target != this.panel || this._ignoreDismissal)
|
||||
return;
|
||||
|
||||
|
|
@ -911,7 +911,7 @@ PopupNotifications.prototype = {
|
|||
|
||||
let notifications = this._getNotificationsForBrowser(browser);
|
||||
// Mark notifications as dismissed and call dismissal callbacks
|
||||
Array.forEach(this.panel.childNodes, function (nEl) {
|
||||
Array.forEach(this.panel.childNodes, function(nEl) {
|
||||
let notificationObj = nEl.notification;
|
||||
// Never call a dismissal handler on a notification that's been removed.
|
||||
if (notifications.indexOf(notificationObj) == -1)
|
||||
|
|
@ -932,7 +932,7 @@ PopupNotifications.prototype = {
|
|||
this._update();
|
||||
},
|
||||
|
||||
_onButtonCommand: function (event) {
|
||||
_onButtonCommand: function(event) {
|
||||
let notificationEl = getNotificationFromElement(event.originalTarget);
|
||||
|
||||
if (!notificationEl)
|
||||
|
|
@ -968,7 +968,7 @@ PopupNotifications.prototype = {
|
|||
this._update();
|
||||
},
|
||||
|
||||
_onMenuCommand: function (event) {
|
||||
_onMenuCommand: function(event) {
|
||||
let target = event.originalTarget;
|
||||
if (!target.action || !target.notification)
|
||||
throw "menucommand target has no associated action/notification";
|
||||
|
|
@ -988,7 +988,7 @@ PopupNotifications.prototype = {
|
|||
this._update();
|
||||
},
|
||||
|
||||
_notify: function (topic) {
|
||||
_notify: function(topic) {
|
||||
Services.obs.notifyObservers(null, "PopupNotifications-" + topic, "");
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ this.RecentWindow = {
|
|||
* Omit the property to search in both groups.
|
||||
* * allowPopups: true if popup windows are permissable.
|
||||
*/
|
||||
getMostRecentBrowserWindow: function (aOptions) {
|
||||
getMostRecentBrowserWindow: function(aOptions) {
|
||||
let checkPrivacy = typeof aOptions == "object" &&
|
||||
"private" in aOptions;
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ this.WinTaskbarJumpList =
|
|||
* Startup, shutdown, and update
|
||||
*/
|
||||
|
||||
startup: function () {
|
||||
startup: function() {
|
||||
// exit if this isn't win7 or higher.
|
||||
if (!this._initTaskbar())
|
||||
return;
|
||||
|
|
@ -175,7 +175,7 @@ this.WinTaskbarJumpList =
|
|||
this._updateTimer();
|
||||
},
|
||||
|
||||
update: function () {
|
||||
update: function() {
|
||||
// are we disabled via prefs? don't do anything!
|
||||
if (!this._enabled)
|
||||
return;
|
||||
|
|
@ -184,7 +184,7 @@ this.WinTaskbarJumpList =
|
|||
this._buildList();
|
||||
},
|
||||
|
||||
_shutdown: function () {
|
||||
_shutdown: function() {
|
||||
this._shuttingDown = true;
|
||||
|
||||
// Correctly handle a clear history on shutdown. If there are no
|
||||
|
|
@ -197,7 +197,7 @@ this.WinTaskbarJumpList =
|
|||
this._free();
|
||||
},
|
||||
|
||||
_shortcutMaintenance: function () {
|
||||
_shortcutMaintenance: function() {
|
||||
_winShellService.shortcutMaintenance();
|
||||
},
|
||||
|
||||
|
|
@ -212,11 +212,11 @@ this.WinTaskbarJumpList =
|
|||
*/
|
||||
|
||||
_pendingStatements: {},
|
||||
_hasPendingStatements: function () {
|
||||
_hasPendingStatements: function() {
|
||||
return Object.keys(this._pendingStatements).length > 0;
|
||||
},
|
||||
|
||||
_buildList: function () {
|
||||
_buildList: function() {
|
||||
if (this._hasPendingStatements()) {
|
||||
// We were requested to update the list while another update was in
|
||||
// progress, this could happen at shutdown, idle or privatebrowsing.
|
||||
|
|
@ -255,7 +255,7 @@ this.WinTaskbarJumpList =
|
|||
* Taskbar api wrappers
|
||||
*/
|
||||
|
||||
_startBuild: function () {
|
||||
_startBuild: function() {
|
||||
var removedItems = Cc["@mozilla.org/array;1"].
|
||||
createInstance(Ci.nsIMutableArray);
|
||||
this._builder.abortListBuild();
|
||||
|
|
@ -267,16 +267,16 @@ this.WinTaskbarJumpList =
|
|||
return false;
|
||||
},
|
||||
|
||||
_commitBuild: function () {
|
||||
_commitBuild: function() {
|
||||
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
||||
this._builder.abortListBuild();
|
||||
}
|
||||
},
|
||||
|
||||
_buildTasks: function () {
|
||||
_buildTasks: function() {
|
||||
var items = Cc["@mozilla.org/array;1"].
|
||||
createInstance(Ci.nsIMutableArray);
|
||||
this._tasks.forEach(function (task) {
|
||||
this._tasks.forEach(function(task) {
|
||||
if ((this._shuttingDown && !task.close) || (!this._shuttingDown && !task.open))
|
||||
return;
|
||||
var item = this._getHandlerAppItem(task.title, task.description,
|
||||
|
|
@ -288,12 +288,12 @@ this.WinTaskbarJumpList =
|
|||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||
},
|
||||
|
||||
_buildCustom: function (title, items) {
|
||||
_buildCustom: function(title, items) {
|
||||
if (items.length > 0)
|
||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||
},
|
||||
|
||||
_buildFrequent: function () {
|
||||
_buildFrequent: function() {
|
||||
// If history is empty, just bail out.
|
||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||
return;
|
||||
|
|
@ -313,7 +313,7 @@ this.WinTaskbarJumpList =
|
|||
this._pendingStatements[LIST_TYPE.FREQUENT] = this._getHistoryResults(
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING,
|
||||
this._maxItemCount,
|
||||
function (aResult) {
|
||||
function(aResult) {
|
||||
if (!aResult) {
|
||||
delete this._pendingStatements[LIST_TYPE.FREQUENT];
|
||||
// The are no more results, build the list.
|
||||
|
|
@ -333,7 +333,7 @@ this.WinTaskbarJumpList =
|
|||
);
|
||||
},
|
||||
|
||||
_buildRecent: function () {
|
||||
_buildRecent: function() {
|
||||
// If history is empty, just bail out.
|
||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||
return;
|
||||
|
|
@ -348,7 +348,7 @@ this.WinTaskbarJumpList =
|
|||
this._pendingStatements[LIST_TYPE.RECENT] = this._getHistoryResults(
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING,
|
||||
this._maxItemCount * 2,
|
||||
function (aResult) {
|
||||
function(aResult) {
|
||||
if (!aResult) {
|
||||
// The are no more results, build the list.
|
||||
this._buildCustom(_getString("taskbar.recent.label"), items);
|
||||
|
|
@ -378,7 +378,7 @@ this.WinTaskbarJumpList =
|
|||
);
|
||||
},
|
||||
|
||||
_deleteActiveJumpList: function () {
|
||||
_deleteActiveJumpList: function() {
|
||||
this._builder.deleteActiveList();
|
||||
},
|
||||
|
||||
|
|
@ -386,7 +386,7 @@ this.WinTaskbarJumpList =
|
|||
* Jump list item creation helpers
|
||||
*/
|
||||
|
||||
_getHandlerAppItem: function (name, description,
|
||||
_getHandlerAppItem: function(name, description,
|
||||
args, iconIndex,
|
||||
faviconPageUri) {
|
||||
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
||||
|
|
@ -408,7 +408,7 @@ this.WinTaskbarJumpList =
|
|||
return item;
|
||||
},
|
||||
|
||||
_getSeparatorItem: function () {
|
||||
_getSeparatorItem: function() {
|
||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
||||
createInstance(Ci.nsIJumpListSeparator);
|
||||
return item;
|
||||
|
|
@ -419,7 +419,7 @@ this.WinTaskbarJumpList =
|
|||
*/
|
||||
|
||||
_getHistoryResults:
|
||||
function (aSortingMode, aLimit, aCallback, aScope) {
|
||||
function(aSortingMode, aLimit, aCallback, aScope) {
|
||||
var options = PlacesUtils.history.getNewQueryOptions();
|
||||
options.maxResults = aLimit;
|
||||
options.sortingMode = aSortingMode;
|
||||
|
|
@ -428,7 +428,7 @@ this.WinTaskbarJumpList =
|
|||
// Return the pending statement to the caller, to allow cancelation.
|
||||
return PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
|
||||
.asyncExecuteLegacyQueries([query], 1, options, {
|
||||
handleResult: function (aResultSet) {
|
||||
handleResult: function(aResultSet) {
|
||||
for (let row; (row = aResultSet.getNextRow());) {
|
||||
try {
|
||||
aCallback.call(aScope,
|
||||
|
|
@ -438,17 +438,17 @@ this.WinTaskbarJumpList =
|
|||
} catch (e) {}
|
||||
}
|
||||
},
|
||||
handleError: function (aError) {
|
||||
handleError: function(aError) {
|
||||
Components.utils.reportError(
|
||||
"Async execution error (" + aError.result + "): " + aError.message);
|
||||
},
|
||||
handleCompletion: function (aReason) {
|
||||
handleCompletion: function(aReason) {
|
||||
aCallback.call(WinTaskbarJumpList, null);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
_clearHistory: function (items) {
|
||||
_clearHistory: function(items) {
|
||||
if (!items)
|
||||
return;
|
||||
var URIsToRemove = [];
|
||||
|
|
@ -471,7 +471,7 @@ this.WinTaskbarJumpList =
|
|||
* Prefs utilities
|
||||
*/
|
||||
|
||||
_refreshPrefs: function () {
|
||||
_refreshPrefs: function() {
|
||||
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
||||
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
||||
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
||||
|
|
@ -483,7 +483,7 @@ this.WinTaskbarJumpList =
|
|||
* Init and shutdown utilities
|
||||
*/
|
||||
|
||||
_initTaskbar: function () {
|
||||
_initTaskbar: function() {
|
||||
this._builder = _taskbarService.createJumpListBuilder();
|
||||
if (!this._builder || !this._builder.available)
|
||||
return false;
|
||||
|
|
@ -491,7 +491,7 @@ this.WinTaskbarJumpList =
|
|||
return true;
|
||||
},
|
||||
|
||||
_initObs: function () {
|
||||
_initObs: function() {
|
||||
// If the browser is closed while in private browsing mode, the "exit"
|
||||
// notification is fired on quit-application-granted.
|
||||
// History cleanup can happen at profile-change-teardown.
|
||||
|
|
@ -500,13 +500,13 @@ this.WinTaskbarJumpList =
|
|||
_prefs.addObserver("", this, false);
|
||||
},
|
||||
|
||||
_freeObs: function () {
|
||||
_freeObs: function() {
|
||||
Services.obs.removeObserver(this, "profile-before-change");
|
||||
Services.obs.removeObserver(this, "browser:purge-session-history");
|
||||
_prefs.removeObserver("", this);
|
||||
},
|
||||
|
||||
_updateTimer: function () {
|
||||
_updateTimer: function() {
|
||||
if (this._enabled && !this._shuttingDown && !this._timer) {
|
||||
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
this._timer.initWithCallback(this,
|
||||
|
|
@ -520,7 +520,7 @@ this.WinTaskbarJumpList =
|
|||
},
|
||||
|
||||
_hasIdleObserver: false,
|
||||
_updateIdleObserver: function () {
|
||||
_updateIdleObserver: function() {
|
||||
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
||||
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||
this._hasIdleObserver = true;
|
||||
|
|
@ -531,7 +531,7 @@ this.WinTaskbarJumpList =
|
|||
}
|
||||
},
|
||||
|
||||
_free: function () {
|
||||
_free: function() {
|
||||
this._freeObs();
|
||||
this._updateTimer();
|
||||
this._updateIdleObserver();
|
||||
|
|
@ -542,13 +542,13 @@ this.WinTaskbarJumpList =
|
|||
* Notification handlers
|
||||
*/
|
||||
|
||||
notify: function (aTimer) {
|
||||
notify: function(aTimer) {
|
||||
// Add idle observer on the first notification so it doesn't hit startup.
|
||||
this._updateIdleObserver();
|
||||
this.update();
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "nsPref:changed":
|
||||
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
|
|||
var gOpenLocationLastURLData = "";
|
||||
|
||||
var observer = {
|
||||
QueryInterface: function (aIID) {
|
||||
QueryInterface: function(aIID) {
|
||||
if (aIID.equals(Components.interfaces.nsIObserver) ||
|
||||
aIID.equals(Components.interfaces.nsISupports) ||
|
||||
aIID.equals(Components.interfaces.nsISupportsWeakReference))
|
||||
return this;
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
},
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "last-pb-context-exited":
|
||||
gOpenLocationLastURLData = "";
|
||||
|
|
@ -46,7 +46,7 @@ this.OpenLocationLastURL = function OpenLocationLastURL(aWindow) {
|
|||
}
|
||||
|
||||
OpenLocationLastURL.prototype = {
|
||||
isPrivate: function () {
|
||||
isPrivate: function() {
|
||||
// Assume not in private browsing mode, unless the browser window is
|
||||
// in private mode.
|
||||
if (!this.window)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue