mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 11:37: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
|
|
@ -78,7 +78,7 @@ Notification.prototype = {
|
|||
/**
|
||||
* Removes the notification and updates the popup accordingly if needed.
|
||||
*/
|
||||
remove: function Notification_remove() {
|
||||
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 PopupNotifications_getNotification(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 PopupNotifications_show(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,7 +362,7 @@ 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 PopupNotifications_locationChange(aBrowser) {
|
||||
locationChange: function (aBrowser) {
|
||||
if (!aBrowser)
|
||||
throw "PopupNotifications_locationChange: invalid browser";
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ PopupNotifications.prototype = {
|
|||
* @param notification
|
||||
* The Notification object to remove.
|
||||
*/
|
||||
remove: function PopupNotifications_remove(notification) {
|
||||
remove: function (notification) {
|
||||
this._remove(notification);
|
||||
|
||||
if (notification.browser.docShell.isActive) {
|
||||
|
|
@ -459,7 +459,7 @@ PopupNotifications.prototype = {
|
|||
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
|
||||
// silently.
|
||||
let notifications = this._getNotificationsForBrowser(notification.browser);
|
||||
|
|
@ -481,7 +481,7 @@ PopupNotifications.prototype = {
|
|||
/**
|
||||
* Dismisses the notification without removing it.
|
||||
*/
|
||||
_dismiss: function PopupNotifications_dismiss() {
|
||||
_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 PopupNotifications_hide() {
|
||||
_hidePanel: function () {
|
||||
this._ignoreDismissal = true;
|
||||
if (typeof this.panel.hidePopup === "function") {
|
||||
this.panel.hidePopup();
|
||||
|
|
@ -536,7 +536,7 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_refreshPanel: function PopupNotifications_refreshPanel(notificationsToShow) {
|
||||
_refreshPanel: function (notificationsToShow) {
|
||||
this._clearPanel();
|
||||
|
||||
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;
|
||||
|
||||
notificationsToShow.forEach(function (n) {
|
||||
|
|
@ -709,7 +709,7 @@ PopupNotifications.prototype = {
|
|||
* if there are no notifications to show. Otherwise,
|
||||
* 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);
|
||||
if (useIconBox) {
|
||||
// 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) {
|
||||
let anchorElm = notification.anchorElement;
|
||||
if (anchorElm) {
|
||||
|
|
@ -786,7 +786,7 @@ PopupNotifications.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_hideIcons: function PopupNotifications_hideIcons() {
|
||||
_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 PopupNotifications_getNotifications(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 PopupNotifications_setNotifications(browser, notifications) {
|
||||
_setNotificationsForBrowser: function (browser, notifications) {
|
||||
popupNotificationsMap.set(browser, notifications);
|
||||
return notifications;
|
||||
},
|
||||
|
||||
_onIconBoxCommand: function PopupNotifications_onIconBoxCommand(event) {
|
||||
_onIconBoxCommand: function (event) {
|
||||
// Left click, space or enter only
|
||||
let type = event.type;
|
||||
if (type == "click" && event.button != 0)
|
||||
|
|
@ -832,7 +832,7 @@ PopupNotifications.prototype = {
|
|||
this._reshowNotifications(anchor);
|
||||
},
|
||||
|
||||
_reshowNotifications: function PopupNotifications_reshowNotifications(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) {
|
||||
|
|
@ -844,7 +844,7 @@ PopupNotifications.prototype = {
|
|||
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
|
||||
// to update our notification map.
|
||||
|
||||
|
|
@ -890,7 +890,7 @@ PopupNotifications.prototype = {
|
|||
other._update(ourNotifications, ourNotifications[0].anchorElement);
|
||||
},
|
||||
|
||||
_fireCallback: function PopupNotifications_fireCallback(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 PopupNotifications_onPopupHidden(event) {
|
||||
_onPopupHidden: function (event) {
|
||||
if (event.target != this.panel || this._ignoreDismissal)
|
||||
return;
|
||||
|
||||
|
|
@ -932,7 +932,7 @@ PopupNotifications.prototype = {
|
|||
this._update();
|
||||
},
|
||||
|
||||
_onButtonCommand: function PopupNotifications_onButtonCommand(event) {
|
||||
_onButtonCommand: function (event) {
|
||||
let notificationEl = getNotificationFromElement(event.originalTarget);
|
||||
|
||||
if (!notificationEl)
|
||||
|
|
@ -968,7 +968,7 @@ PopupNotifications.prototype = {
|
|||
this._update();
|
||||
},
|
||||
|
||||
_onMenuCommand: function PopupNotifications_onMenuCommand(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 PopupNotifications_notify(topic) {
|
||||
_notify: function (topic) {
|
||||
Services.obs.notifyObservers(null, "PopupNotifications-" + topic, "");
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue