mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
[Basilisk] Issue MoonchildProductions/UXP#516 - Remove named function syntax from basilisk/modules.
This commit is contained in:
parent
b31901aa3f
commit
ecfee37414
3 changed files with 38 additions and 38 deletions
|
|
@ -70,7 +70,7 @@ 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) {
|
||||||
_priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL);
|
_priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL);
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -78,7 +78,7 @@ var BrowserHelper = {
|
||||||
this.decreasePriority(aBrowser);
|
this.decreasePriority(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function NP_BH_onSelect(aBrowser) {
|
onSelect: function(aBrowser) {
|
||||||
let windowEntry = WindowHelper.getEntry(aBrowser.ownerGlobal);
|
let windowEntry = WindowHelper.getEntry(aBrowser.ownerGlobal);
|
||||||
if (windowEntry.lastSelectedBrowser)
|
if (windowEntry.lastSelectedBrowser)
|
||||||
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
||||||
|
|
@ -91,13 +91,13 @@ var BrowserHelper = {
|
||||||
aBrowser.setPriority(_priorityBackup.get(aBrowser.permanentKey));
|
aBrowser.setPriority(_priorityBackup.get(aBrowser.permanentKey));
|
||||||
},
|
},
|
||||||
|
|
||||||
increasePriority: function NP_BH_increasePriority(aBrowser) {
|
increasePriority: function(aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA);
|
aBrowser.adjustPriority(PRIORITY_DELTA);
|
||||||
_priorityBackup.set(aBrowser.permanentKey,
|
_priorityBackup.set(aBrowser.permanentKey,
|
||||||
_priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA);
|
_priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA);
|
||||||
},
|
},
|
||||||
|
|
||||||
decreasePriority: function NP_BH_decreasePriority(aBrowser) {
|
decreasePriority: function(aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
||||||
_priorityBackup.set(aBrowser.permanentKey,
|
_priorityBackup.set(aBrowser.permanentKey,
|
||||||
_priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA);
|
_priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA);
|
||||||
|
|
@ -107,7 +107,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 });
|
||||||
|
|
||||||
|
|
@ -130,7 +130,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;
|
||||||
|
|
||||||
|
|
@ -146,7 +146,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;
|
||||||
|
|
@ -158,7 +158,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);
|
||||||
|
|
@ -168,23 +168,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)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,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;
|
||||||
|
|
@ -173,7 +173,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;
|
||||||
|
|
@ -182,7 +182,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
|
||||||
|
|
@ -195,7 +195,7 @@ this.WinTaskbarJumpList =
|
||||||
this._free();
|
this._free();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shortcutMaintenance: function WTBJL__maintenace() {
|
_shortcutMaintenance: function() {
|
||||||
_winShellService.shortcutMaintenance();
|
_winShellService.shortcutMaintenance();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -210,11 +210,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.
|
||||||
|
|
@ -253,7 +253,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();
|
||||||
|
|
@ -265,13 +265,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) {
|
||||||
|
|
@ -286,12 +286,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;
|
||||||
|
|
@ -331,7 +331,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;
|
||||||
|
|
@ -376,7 +376,7 @@ this.WinTaskbarJumpList =
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_deleteActiveJumpList: function WTBJL__deleteAJL() {
|
_deleteActiveJumpList:() {
|
||||||
this._builder.deleteActiveList();
|
this._builder.deleteActiveList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -384,7 +384,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);
|
||||||
|
|
@ -406,7 +406,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;
|
||||||
|
|
@ -446,7 +446,7 @@ this.WinTaskbarJumpList =
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearHistory: function WTBJL__clearHistory(items) {
|
_clearHistory: function(items) {
|
||||||
if (!items)
|
if (!items)
|
||||||
return;
|
return;
|
||||||
var URIsToRemove = [];
|
var URIsToRemove = [];
|
||||||
|
|
@ -469,7 +469,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);
|
||||||
|
|
@ -481,7 +481,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;
|
||||||
|
|
@ -489,7 +489,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.
|
||||||
|
|
@ -498,13 +498,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,
|
||||||
|
|
@ -518,7 +518,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;
|
||||||
|
|
@ -529,7 +529,7 @@ this.WinTaskbarJumpList =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_free: function WTBJL__free() {
|
_free: function() {
|
||||||
this._freeObs();
|
this._freeObs();
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
|
|
@ -540,13 +540,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))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue