[Basilisk] Issue MoonchildProductions/UXP#516 - Remove named function syntax from basilisk/base.

This commit is contained in:
athenian200 2020-03-06 10:24:34 -06:00 committed by Roy Tam
commit b31901aa3f
24 changed files with 294 additions and 294 deletions

View file

@ -6,7 +6,7 @@
* Tab previews utility, produces thumbnails
*/
var tabPreviews = {
init: function tabPreviews_init() {
init: function() {
if (this._selectedTab)
return;
this._selectedTab = gBrowser.selectedTab;
@ -21,7 +21,7 @@ var tabPreviews = {
this.aspectRatio = height.value / width.value;
},
get: function tabPreviews_get(aTab) {
get: function(aTab) {
let uri = aTab.linkedBrowser.currentURI.spec;
if (aTab.__thumbnail_lastURI &&
@ -42,7 +42,7 @@ var tabPreviews = {
return this.capture(aTab, !aTab.hasAttribute("busy"));
},
capture: function tabPreviews_capture(aTab, aShouldCache) {
capture: function(aTab, aShouldCache) {
let browser = aTab.linkedBrowser;
let uri = browser.currentURI.spec;
let canvas = PageThumbs.createCanvas(window);
@ -67,7 +67,7 @@ var tabPreviews = {
return canvas;
},
handleEvent: function tabPreviews_handleEvent(event) {
handleEvent: function(event) {
switch (event.type) {
case "TabSelect":
if (this._selectedTab &&
@ -193,7 +193,7 @@ var ctrlTab = {
return this._recentlyUsedTabs;
},
init: function ctrlTab_init() {
init: function() {
if (!this._recentlyUsedTabs) {
tabPreviews.init();
@ -202,13 +202,13 @@ var ctrlTab = {
}
},
uninit: function ctrlTab_uninit() {
uninit: function() {
this._recentlyUsedTabs = null;
this._init(false);
},
prefName: "browser.ctrlTab.previews",
readPref: function ctrlTab_readPref() {
readPref: function() {
var enable =
gPrefService.getBoolPref(this.prefName) &&
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
@ -223,7 +223,7 @@ var ctrlTab = {
this.readPref();
},
updatePreviews: function ctrlTab_updatePreviews() {
updatePreviews: function() {
for (let i = 0; i < this.previews.length; i++)
this.updatePreview(this.previews[i], this.tabList[i]);
@ -233,7 +233,7 @@ var ctrlTab = {
this.showAllButton.hidden = !allTabs.canOpen;
},
updatePreview: function ctrlTab_updatePreview(aPreview, aTab) {
updatePreview: function(aPreview, aTab) {
if (aPreview == this.showAllButton)
return;
@ -267,7 +267,7 @@ var ctrlTab = {
}
},
advanceFocus: function ctrlTab_advanceFocus(aForward) {
advanceFocus: function(aForward) {
let selectedIndex = Array.indexOf(this.previews, this.selected);
do {
selectedIndex += aForward ? 1 : -1;
@ -291,12 +291,12 @@ var ctrlTab = {
}
},
_mouseOverFocus: function ctrlTab_mouseOverFocus(aPreview) {
_mouseOverFocus: function(aPreview) {
if (this._trackMouseOver)
aPreview.focus();
},
pick: function ctrlTab_pick(aPreview) {
pick: function(aPreview) {
if (!this.tabCount)
return;
@ -308,17 +308,17 @@ var ctrlTab = {
this.close(select._tab);
},
showAllTabs: function ctrlTab_showAllTabs(aPreview) {
showAllTabs: function(aPreview) {
this.close();
document.getElementById("Browser:ShowAllTabs").doCommand();
},
remove: function ctrlTab_remove(aPreview) {
remove: function(aPreview) {
if (aPreview._tab)
gBrowser.removeTab(aPreview._tab);
},
attachTab: function ctrlTab_attachTab(aTab, aPos) {
attachTab: function(aTab, aPos) {
if (aTab.closing)
return;
@ -330,13 +330,13 @@ var ctrlTab = {
this._recentlyUsedTabs.push(aTab);
},
detachTab: function ctrlTab_detachTab(aTab) {
detachTab: function(aTab) {
var i = this._recentlyUsedTabs.indexOf(aTab);
if (i >= 0)
this._recentlyUsedTabs.splice(i, 1);
},
open: function ctrlTab_open() {
open: function() {
if (this.isOpen)
return;
@ -353,7 +353,7 @@ var ctrlTab = {
}, 200, this);
},
_openPanel: function ctrlTab_openPanel() {
_openPanel: function() {
tabPreviewPanelHelper.opening(this);
this.panel.width = Math.min(screen.availWidth * .99,
@ -364,7 +364,7 @@ var ctrlTab = {
false);
},
close: function ctrlTab_close(aTabToSelect) {
close: function(aTabToSelect) {
if (!this.isOpen)
return;
@ -381,7 +381,7 @@ var ctrlTab = {
this.panel.hidePopup();
},
setupGUI: function ctrlTab_setupGUI() {
setupGUI: function() {
this.selected.focus();
this._selectedIndex = -1;
@ -394,7 +394,7 @@ var ctrlTab = {
}, 0, this);
},
suspendGUI: function ctrlTab_suspendGUI() {
suspendGUI: function() {
document.removeEventListener("keyup", this, true);
for (let preview of this.previews) {
@ -447,7 +447,7 @@ var ctrlTab = {
}
},
removeClosingTabFromUI: function ctrlTab_removeClosingTabFromUI(aTab) {
removeClosingTabFromUI: function(aTab) {
if (this.tabCount == 2) {
this.close();
return;
@ -468,7 +468,7 @@ var ctrlTab = {
}
},
handleEvent: function ctrlTab_handleEvent(event) {
handleEvent: function(event) {
switch (event.type) {
case "SSWindowRestored":
this._initRecentlyUsedTabs();
@ -528,7 +528,7 @@ var ctrlTab = {
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
},
_init: function ctrlTab__init(enable) {
_init: function(enable) {
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
window[toggleEventListener]("SSWindowRestored", this, false);
@ -575,7 +575,7 @@ var allTabs = {
return isElementVisible(this.toolbarButton);
},
open: function allTabs_open() {
open: function() {
if (this.canOpen) {
// Without setTimeout, the menupopup won't stay open when invoking
// "View > Show All Tabs" and the menu bar auto-hides.

View file

@ -38,7 +38,7 @@ var FullZoom = {
// Initialization & Destruction
init: function FullZoom_init() {
init: function() {
gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this);
// Register ourselves with the service so we know when our pref changes.
@ -66,7 +66,7 @@ var FullZoom = {
this._initialLocations = null;
},
destroy: function FullZoom_destroy() {
destroy: function() {
gPrefService.removeObserver("browser.zoom.", this);
this._cps2.removeObserverForName(this.name, this);
gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
@ -77,7 +77,7 @@ var FullZoom = {
// nsIDOMEventListener
handleEvent: function FullZoom_handleEvent(event) {
handleEvent: function(event) {
switch (event.type) {
case "ZoomChangeUsingMouseWheel":
let browser = this._getTargetedBrowser(event);
@ -108,11 +108,11 @@ var FullZoom = {
// nsIContentPrefObserver
onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue, aIsPrivate) {
onContentPrefSet: function(aGroup, aName, aValue, aIsPrivate) {
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
},
onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName, aIsPrivate) {
onContentPrefRemoved: function(aGroup, aName, aIsPrivate) {
this._onContentPrefChanged(aGroup, undefined, aIsPrivate);
},
@ -124,7 +124,7 @@ var FullZoom = {
* @param aValue The new value of the changed preference. Pass undefined to
* indicate the preference's removal.
*/
_onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue, aIsPrivate) {
_onContentPrefChanged: function(aGroup, aValue, aIsPrivate) {
if (this._isNextContentPrefChangeInternal) {
// Ignore changes that FullZoom itself makes. This works because the
// content pref service calls callbacks before notifying observers, and it
@ -175,7 +175,7 @@ var FullZoom = {
* @param aBrowser
* (optional) browser object displaying the document
*/
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
onLocationChange: function(aURI, aIsTabSwitch, aBrowser) {
let browser = aBrowser || gBrowser.selectedBrowser;
// If we haven't been initialized yet but receive an onLocationChange
@ -237,7 +237,7 @@ var FullZoom = {
// update state of zoom type menu item
updateMenu: function FullZoom_updateMenu() {
updateMenu: function() {
var menuItem = document.getElementById("toggle_zoom");
menuItem.setAttribute("checked", !ZoomManager.useFullZoom);
@ -248,7 +248,7 @@ var FullZoom = {
/**
* Reduces the zoom level of the page in the current browser.
*/
reduce: function FullZoom_reduce() {
reduce: function() {
ZoomManager.reduce();
let browser = gBrowser.selectedBrowser;
this._ignorePendingZoomAccesses(browser);
@ -258,7 +258,7 @@ var FullZoom = {
/**
* Enlarges the zoom level of the page in the current browser.
*/
enlarge: function FullZoom_enlarge() {
enlarge: function() {
ZoomManager.enlarge();
let browser = gBrowser.selectedBrowser;
this._ignorePendingZoomAccesses(browser);
@ -281,7 +281,7 @@ var FullZoom = {
*
* @return A promise which resolves when the zoom reset has been applied.
*/
reset: function FullZoom_reset(browser = gBrowser.selectedBrowser) {
reset: function(browser = gBrowser.selectedBrowser) {
let token = this._getBrowserToken(browser);
let result = this._getGlobalValue(browser).then(value => {
if (token.isCurrent) {
@ -317,7 +317,7 @@ var FullZoom = {
* @param aBrowser The zoom is set in this browser. Required.
* @param aCallback If given, it's asynchronously called when complete.
*/
_applyPrefToZoom: function FullZoom__applyPrefToZoom(aValue, aBrowser, aCallback) {
_applyPrefToZoom: function(aValue, aBrowser, aCallback) {
if (!this.siteSpecific || gInPrintPreviewMode) {
this._executeSoon(aCallback);
return;
@ -354,7 +354,7 @@ var FullZoom = {
*
* @param browser The zoom of this browser will be saved. Required.
*/
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
_applyZoomToPref: function(browser) {
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
if (!this.siteSpecific ||
gInPrintPreviewMode ||
@ -375,7 +375,7 @@ var FullZoom = {
*
* @param browser The zoom of this browser will be removed. Required.
*/
_removePref: function FullZoom__removePref(browser) {
_removePref: function(browser) {
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
if (browser.isSyntheticDocument)
return;
@ -401,7 +401,7 @@ var FullZoom = {
* @param browser The token of this browser will be returned.
* @return An object with an "isCurrent" getter.
*/
_getBrowserToken: function FullZoom__getBrowserToken(browser) {
_getBrowserToken: function(browser) {
let map = this._browserTokenMap;
if (!map.has(browser))
map.set(browser, 0);
@ -423,7 +423,7 @@ var FullZoom = {
* @param event The ZoomChangeUsingMouseWheel event.
* @return The associated browser element, if one exists, otherwise null.
*/
_getTargetedBrowser: function FullZoom__getTargetedBrowser(event) {
_getTargetedBrowser: function(event) {
let target = event.originalTarget;
// With remote content browsers, the event's target is the browser
@ -449,12 +449,12 @@ var FullZoom = {
*
* @param browser Pending accesses in this browser will be ignored.
*/
_ignorePendingZoomAccesses: function FullZoom__ignorePendingZoomAccesses(browser) {
_ignorePendingZoomAccesses: function(browser) {
let map = this._browserTokenMap;
map.set(browser, (map.get(browser) || 0) + 1);
},
_ensureValid: function FullZoom__ensureValid(aValue) {
_ensureValid: function(aValue) {
// Note that undefined is a valid value for aValue that indicates a known-
// not-to-exist value.
if (isNaN(aValue))
@ -476,7 +476,7 @@ var FullZoom = {
* @returns Promise<prefValue>
* Resolves to the preference value when done.
*/
_getGlobalValue: function FullZoom__getGlobalValue(browser) {
_getGlobalValue: function(browser) {
// * !("_globalValue" in this) => global value not yet cached.
// * this._globalValue === undefined => global value known not to exist.
// * Otherwise, this._globalValue is a number, the global value.
@ -502,7 +502,7 @@ var FullZoom = {
* @param Browser The Browser whose load context will be returned.
* @return The nsILoadContext of the given Browser.
*/
_loadContextFromBrowser: function FullZoom__loadContextFromBrowser(browser) {
_loadContextFromBrowser: function(browser) {
return browser.loadContext;
},
@ -512,13 +512,13 @@ var FullZoom = {
* The notification is always asynchronous so that observers are guaranteed a
* consistent behavior.
*/
_notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) {
_notifyOnLocationChange: function(browser) {
this._executeSoon(function () {
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
});
},
_executeSoon: function FullZoom__executeSoon(callback) {
_executeSoon: function(callback) {
if (!callback)
return;
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);

View file

@ -24,7 +24,7 @@ var gGestureSupport = {
* @param aAddListener
* True to add/init listeners and false to remove/uninit
*/
init: function GS_init(aAddListener) {
init: function(aAddListener) {
const gestureEvents = ["SwipeGestureMayStart", "SwipeGestureStart",
"SwipeGestureUpdate", "SwipeGestureEnd", "SwipeGesture",
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
@ -47,7 +47,7 @@ var gGestureSupport = {
* @param aEvent
* The gesture event to handle
*/
handleEvent: function GS_handleEvent(aEvent) {
handleEvent: function(aEvent) {
if (!Services.prefs.getBoolPref(
"dom.debug.propagate_gesture_events_through_content")) {
aEvent.stopPropagation();
@ -123,7 +123,7 @@ var gGestureSupport = {
* @param aDec
* Command to trigger for decreasing motion (without gesture name)
*/
_setupGesture: function GS__setupGesture(aEvent, aGesture, aPref, aInc, aDec) {
_setupGesture: function(aEvent, aGesture, aPref, aInc, aDec) {
// Try to load user-set values from preferences
for (let [pref, def] of Object.entries(aPref))
aPref[pref] = this._getPref(aGesture + "." + pref, def);
@ -168,7 +168,7 @@ var gGestureSupport = {
* The swipe gesture event.
* @return true if the swipe event may navigate the history, false othwerwise.
*/
_swipeNavigatesHistory: function GS__swipeNavigatesHistory(aEvent) {
_swipeNavigatesHistory: function(aEvent) {
return this._getCommand(aEvent, ["swipe", "left"])
== "Browser:BackOrBackDuplicate" &&
this._getCommand(aEvent, ["swipe", "right"])
@ -184,7 +184,7 @@ var gGestureSupport = {
* @return true if we're willing to start a swipe for this event, false
* otherwise.
*/
_shouldDoSwipeGesture: function GS__shouldDoSwipeGesture(aEvent) {
_shouldDoSwipeGesture: function(aEvent) {
if (!this._swipeNavigatesHistory(aEvent)) {
return false;
}
@ -232,14 +232,14 @@ var gGestureSupport = {
* @return true if swipe gestures could successfully be set up, false
* othwerwise.
*/
_setupSwipeGesture: function GS__setupSwipeGesture() {
_setupSwipeGesture: function() {
gHistorySwipeAnimation.startAnimation(false);
this._doUpdate = function GS__doUpdate(aEvent) {
this._doUpdate = function(aEvent) {
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
};
this._doEnd = function GS__doEnd(aEvent) {
this._doEnd = function(aEvent) {
gHistorySwipeAnimation.swipeEndEventReceived();
this._doUpdate = function (aEvent) {};
@ -255,7 +255,7 @@ var gGestureSupport = {
* Source array containing any number of elements
* @yield Array that is a subset of the input array from full set to empty
*/
_power: function* GS__power(aArray) {
_power: function* (aArray) {
// Create a bitmask based on the length of the array
let num = 1 << aArray.length;
while (--num >= 0) {
@ -279,7 +279,7 @@ var gGestureSupport = {
* @return Name of the executed command. Returns null if no command is
* found.
*/
_doAction: function GS__doAction(aEvent, aGesture) {
_doAction: function(aEvent, aGesture) {
let command = this._getCommand(aEvent, aGesture);
return command && this._doCommand(aEvent, command);
},
@ -293,7 +293,7 @@ var gGestureSupport = {
* @param aGesture
* Array of gesture name parts (to be joined by periods)
*/
_getCommand: function GS__getCommand(aEvent, aGesture) {
_getCommand: function(aEvent, aGesture) {
// Create an array of pressed keys in a fixed order so that a command for
// "meta" is preferred over "ctrl" when both buttons are pressed (and a
// command for both don't exist)
@ -327,7 +327,7 @@ var gGestureSupport = {
* @param aCommand
* Name of the command found for the event's keys and gesture.
*/
_doCommand: function GS__doCommand(aEvent, aCommand) {
_doCommand: function(aEvent, aCommand) {
let node = document.getElementById(aCommand);
if (node) {
if (node.getAttribute("disabled") != "true") {
@ -367,7 +367,7 @@ var gGestureSupport = {
* @param aEvent
* The swipe event to handle
*/
onSwipe: function GS_onSwipe(aEvent) {
onSwipe: function(aEvent) {
// Figure out which one (and only one) direction was triggered
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
@ -385,7 +385,7 @@ var gGestureSupport = {
* @param aDir
* The direction for the swipe event
*/
processSwipeEvent: function GS_processSwipeEvent(aEvent, aDir) {
processSwipeEvent: function(aEvent, aDir) {
this._doAction(aEvent, ["swipe", aDir.toLowerCase()]);
},
@ -419,7 +419,7 @@ var gGestureSupport = {
* @param aDef
* Default value if the preference doesn't exist
*/
_getPref: function GS__getPref(aPref, aDef) {
_getPref: function(aPref, aDef) {
// Preferences branch under which all gestures preferences are stored
const branch = "browser.gesture.";
@ -582,7 +582,7 @@ var gHistorySwipeAnimation = {
* Initializes the support for history swipe animations, if it is supported
* by the platform/configuration.
*/
init: function HSA_init() {
init: function() {
if (!this._isSupported())
return;
@ -612,7 +612,7 @@ var gHistorySwipeAnimation = {
/**
* Uninitializes the support for history swipe animations.
*/
uninit: function HSA_uninit() {
uninit: function() {
gBrowser.removeEventListener("pagehide", this, false);
gBrowser.removeEventListener("pageshow", this, false);
gBrowser.removeEventListener("popstate", this, false);
@ -630,7 +630,7 @@ var gHistorySwipeAnimation = {
* @param aIsVerticalSwipe
* Whether we're dealing with a vertical swipe or not.
*/
startAnimation: function HSA_startAnimation(aIsVerticalSwipe) {
startAnimation: function(aIsVerticalSwipe) {
this._direction = aIsVerticalSwipe ? "vertical" : "horizontal";
if (this.isAnimationRunning()) {
@ -672,7 +672,7 @@ var gHistorySwipeAnimation = {
/**
* Stops the swipe animation.
*/
stopAnimation: function HSA_stopAnimation() {
stopAnimation: function() {
gHistorySwipeAnimation._removeBoxes();
this._historyIndex = this._getCurrentHistoryIndex();
},
@ -684,7 +684,7 @@ var gHistorySwipeAnimation = {
* A floating point value that represents the progress of the
* swipe gesture.
*/
updateAnimation: function HSA_updateAnimation(aVal) {
updateAnimation: function(aVal) {
if (!this.isAnimationRunning()) {
return;
}
@ -741,7 +741,7 @@ var gHistorySwipeAnimation = {
* @param aEvent
* An event to process.
*/
handleEvent: function HSA_handleEvent(aEvent) {
handleEvent: function(aEvent) {
let browser = gBrowser.selectedBrowser;
switch (aEvent.type) {
case "TabClose":
@ -780,7 +780,7 @@ var gHistorySwipeAnimation = {
*
* @return true if the animation is currently running, false otherwise.
*/
isAnimationRunning: function HSA_isAnimationRunning() {
isAnimationRunning: function() {
return !!this._container;
},
@ -792,7 +792,7 @@ var gHistorySwipeAnimation = {
* @param aDir
* The direction for the swipe event
*/
processSwipeEvent: function HSA_processSwipeEvent(aEvent, aDir) {
processSwipeEvent: function(aEvent, aDir) {
if (aDir == "RIGHT")
this._historyIndex += this.isLTR ? 1 : -1;
else if (aDir == "LEFT")
@ -807,7 +807,7 @@ var gHistorySwipeAnimation = {
*
* @return true if there is a previous page in history, false otherwise.
*/
canGoBack: function HSA_canGoBack() {
canGoBack: function() {
if (this.isAnimationRunning())
return this._doesIndexExistInHistory(this._historyIndex - 1);
return gBrowser.webNavigation.canGoBack;
@ -818,7 +818,7 @@ var gHistorySwipeAnimation = {
*
* @return true if there is a next page in history, false otherwise.
*/
canGoForward: function HSA_canGoForward() {
canGoForward: function() {
if (this.isAnimationRunning())
return this._doesIndexExistInHistory(this._historyIndex + 1);
return gBrowser.webNavigation.canGoForward;
@ -829,7 +829,7 @@ var gHistorySwipeAnimation = {
* event and that we should navigate to the page that the user swiped to, if
* any. This will also result in the animation overlay to be torn down.
*/
swipeEndEventReceived: function HSA_swipeEndEventReceived() {
swipeEndEventReceived: function() {
// Update the session history before continuing.
let updateSessionHistory = sessionHistory => {
if (this._lastSwipeDir != "" && this._historyIndex != this._startingIndex)
@ -847,7 +847,7 @@ var gHistorySwipeAnimation = {
* The index to check for availability for in the history.
* @return true if the index exists in the browser history, false otherwise.
*/
_doesIndexExistInHistory: function HSA__doesIndexExistInHistory(aIndex) {
_doesIndexExistInHistory: function(aIndex) {
try {
return SessionStore.getSessionHistory(gBrowser.selectedTab).entries[aIndex] != null;
}
@ -860,7 +860,7 @@ var gHistorySwipeAnimation = {
* Navigates to the index in history that is currently being tracked by
* |this|.
*/
_navigateToHistoryIndex: function HSA__navigateToHistoryIndex() {
_navigateToHistoryIndex: function() {
if (this._doesIndexExistInHistory(this._historyIndex))
gBrowser.webNavigation.gotoIndex(this._historyIndex);
else
@ -873,7 +873,7 @@ var gHistorySwipeAnimation = {
*
* return true if supported, false otherwise.
*/
_isSupported: function HSA__isSupported() {
_isSupported: function() {
return window.matchMedia("(-moz-swipe-animation-enabled)").matches;
},
@ -882,7 +882,7 @@ var gHistorySwipeAnimation = {
* progress when a new one is initiated). This will swap out the snapshots
* used in the previous animation with the appropriate new ones.
*/
_handleFastSwiping: function HSA__handleFastSwiping() {
_handleFastSwiping: function() {
this._installCurrentPageSnapshot(null);
this._installPrevAndNextSnapshots();
},
@ -890,7 +890,7 @@ var gHistorySwipeAnimation = {
/**
* Adds the boxes that contain the snapshots used during the swipe animation.
*/
_addBoxes: function HSA__addBoxes() {
_addBoxes: function() {
let browserStack =
document.getAnonymousElementByAttribute(gBrowser.getNotificationBox(),
"class", "browserStack");
@ -918,7 +918,7 @@ var gHistorySwipeAnimation = {
/**
* Removes the boxes.
*/
_removeBoxes: function HSA__removeBoxes() {
_removeBoxes: function() {
this._curBox = null;
this._prevBox = null;
this._nextBox = null;
@ -938,7 +938,7 @@ var gHistorySwipeAnimation = {
* The name of the tag to create the element for.
* @return the newly created element.
*/
_createElement: function HSA__createElement(aID, aTagName) {
_createElement: function(aID, aTagName) {
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let element = document.createElementNS(XULNS, aTagName);
element.id = aID;
@ -953,7 +953,7 @@ var gHistorySwipeAnimation = {
* @param aPosition
* The position (in X coordinates) to move the box element to.
*/
_positionBox: function HSA__positionBox(aBox, aPosition) {
_positionBox: function(aBox, aPosition) {
let transform = "";
if (this._direction == "vertical")
@ -970,14 +970,14 @@ var gHistorySwipeAnimation = {
*
* @return true if we're ready to take snapshots, false otherwise.
*/
_readyToTakeSnapshots: function HSA__readyToTakeSnapshots() {
_readyToTakeSnapshots: function() {
return (this._maxSnapshots >= 1 && this._getCurrentHistoryIndex() >= 0);
},
/**
* Takes a snapshot of the page the browser is currently on.
*/
_takeSnapshot: function HSA__takeSnapshot() {
_takeSnapshot: function() {
if (!this._readyToTakeSnapshots()) {
return;
}
@ -1011,7 +1011,7 @@ var gHistorySwipeAnimation = {
* Retrieves the maximum number of snapshots that should be kept in memory.
* This limit is a global limit and is valid across all open tabs.
*/
_getMaxSnapshots: function HSA__getMaxSnapshots() {
_getMaxSnapshots: function() {
return gPrefService.getIntPref("browser.snapshots.limit");
},
@ -1083,7 +1083,7 @@ var gHistorySwipeAnimation = {
* @param aBrowser
* The browser the new snapshot was taken in.
*/
_removeTrackedSnapshot: function HSA__removeTrackedSnapshot(aIndex, aBrowser) {
_removeTrackedSnapshot: function(aIndex, aBrowser) {
let arr = this._trackedSnapshots;
let requiresExactIndexMatch = aIndex >= 0;
for (let i = 0; i < arr.length; i++) {
@ -1133,7 +1133,7 @@ var gHistorySwipeAnimation = {
* couldn't complete before this method was called.
* @return A new Image object representing the converted blob.
*/
_convertToImg: function HSA__convertToImg(aBlob) {
_convertToImg: function(aBlob) {
if (!aBlob)
return null;
@ -1165,7 +1165,7 @@ var gHistorySwipeAnimation = {
* @param aBox
* The box element that uses aSnapshot as background.
*/
_scaleSnapshot: function HSA__scaleSnapshot(aSnapshot, aScale, aBox) {
_scaleSnapshot: function(aSnapshot, aScale, aBox) {
if (aSnapshot && aScale != 1 && aBox) {
if (aSnapshot instanceof HTMLCanvasElement) {
aBox.style.backgroundSize =

View file

@ -44,7 +44,7 @@ var StarUI = {
["cmd_close", "cmd_closeWindow"].map(id => this._element(id));
},
_blockCommands: function SU__blockCommands() {
_blockCommands: function() {
this._blockedCommands.forEach(function (elt) {
// make sure not to permanently disable this item (see bug 409155)
if (elt.hasAttribute("wasDisabled"))
@ -58,7 +58,7 @@ var StarUI = {
});
},
_restoreCommandsState: function SU__restoreCommandsState() {
_restoreCommandsState: function() {
this._blockedCommands.forEach(function (elt) {
if (elt.getAttribute("wasDisabled") != "true")
elt.removeAttribute("disabled");
@ -331,13 +331,13 @@ var StarUI = {
}
},
quitEditMode: function SU_quitEditMode() {
quitEditMode: function() {
this._element("editBookmarkPanelContent").hidden = true;
this._element("editBookmarkPanelBottomButtons").hidden = true;
gEditItemOverlay.uninitPanel(true);
},
removeBookmarkButtonCommand: function SU_removeBookmarkButtonCommand() {
removeBookmarkButtonCommand: function() {
this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
this.panel.hidePopup();
},
@ -558,7 +558,7 @@ var PlacesCommandHook = {
/**
* Adds a bookmark to the page loaded in the current tab.
*/
bookmarkCurrentPage: function PCH_bookmarkCurrentPage(aShowEditUI, aParent) {
bookmarkCurrentPage: function(aShowEditUI, aParent) {
this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI);
},
@ -625,7 +625,7 @@ var PlacesCommandHook = {
* Adds a folder with bookmarks to all of the currently open tabs in this
* window.
*/
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
bookmarkCurrentPages: function() {
let pages = this.uniqueCurrentPages;
if (pages.length > 1) {
PlacesUIUtils.showBookmarkDialog({ action: "add"
@ -692,7 +692,7 @@ var PlacesCommandHook = {
* are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar,
* UnfiledBookmarks, Tags and Downloads.
*/
showPlacesOrganizer: function PCH_showPlacesOrganizer(aLeftPaneRoot) {
showPlacesOrganizer: function(aLeftPaneRoot) {
var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
// Due to bug 528706, getMostRecentWindow can return closed windows.
if (!organizer || organizer.closed) {
@ -731,7 +731,7 @@ HistoryMenu.prototype = {
return SessionStore.getClosedTabCount(window);
},
toggleRecentlyClosedTabs: function HM_toggleRecentlyClosedTabs() {
toggleRecentlyClosedTabs: function() {
// enable/disable the Recently Closed Tabs sub menu
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
@ -745,7 +745,7 @@ HistoryMenu.prototype = {
/**
* Populate when the history menu is opened
*/
populateUndoSubmenu: function PHM_populateUndoSubmenu() {
populateUndoSubmenu: function() {
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
var undoPopup = undoMenu.firstChild;
@ -767,7 +767,7 @@ HistoryMenu.prototype = {
undoPopup.appendChild(tabsFragment);
},
toggleRecentlyClosedWindows: function PHM_toggleRecentlyClosedWindows() {
toggleRecentlyClosedWindows: function() {
// enable/disable the Recently Closed Windows sub menu
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
@ -781,7 +781,7 @@ HistoryMenu.prototype = {
/**
* Populate when the history menu is opened
*/
populateUndoWindowSubmenu: function PHM_populateUndoWindowSubmenu() {
populateUndoWindowSubmenu: function() {
let undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
let undoPopup = undoMenu.firstChild;
@ -803,7 +803,7 @@ HistoryMenu.prototype = {
undoPopup.appendChild(windowsFragment);
},
toggleTabsFromOtherComputers: function PHM_toggleTabsFromOtherComputers() {
toggleTabsFromOtherComputers: function() {
// This is a no-op if MOZ_SERVICES_SYNC isn't defined
#ifdef MOZ_SERVICES_SYNC
// Enable/disable the Tabs From Other Computers menu. Some of the menus handled
@ -829,7 +829,7 @@ HistoryMenu.prototype = {
#endif
},
_onPopupShowing: function HM__onPopupShowing(aEvent) {
_onPopupShowing: function(aEvent) {
PlacesMenu.prototype._onPopupShowing.apply(this, arguments);
// Don't handle events for submenus.
@ -841,7 +841,7 @@ HistoryMenu.prototype = {
this.toggleTabsFromOtherComputers();
},
_onCommand: function HM__onCommand(aEvent) {
_onCommand: function(aEvent) {
let placesNode = aEvent.target._placesNode;
if (placesNode) {
if (!PrivateBrowsingUtils.isWindowPrivate(window))
@ -866,7 +866,7 @@ var BookmarksEventHandler = {
* @param aView
* The places view which aEvent should be associated with.
*/
onClick: function BEH_onClick(aEvent, aView) {
onClick: function(aEvent, aView) {
// Only handle middle-click or left-click with modifiers.
let modifKey;
if (AppConstants.platform == "macosx") {
@ -915,13 +915,13 @@ var BookmarksEventHandler = {
* @param aView
* The places view which aEvent should be associated with.
*/
onCommand: function BEH_onCommand(aEvent, aView) {
onCommand: function(aEvent, aView) {
var target = aEvent.originalTarget;
if (target._placesNode)
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
},
fillInBHTooltip: function BEH_fillInBHTooltip(aDocument, aEvent) {
fillInBHTooltip: function(aDocument, aEvent) {
var node;
var cropped = false;
var targetURI;
@ -991,7 +991,7 @@ var PlacesMenuDNDHandler = {
* @param event
* The DragEnter event that spawned the opening.
*/
onDragEnter: function PMDH_onDragEnter(event) {
onDragEnter: function(event) {
// Opening menus in a Places popup is handled by the view itself.
if (!this._isStaticContainer(event.target))
return;
@ -1022,7 +1022,7 @@ var PlacesMenuDNDHandler = {
/**
* Handles dragleave on the <menu> element.
*/
onDragLeave: function PMDH_onDragLeave(event) {
onDragLeave: function(event) {
// Handle menu-button separate targets.
if (event.relatedTarget === event.currentTarget ||
(event.relatedTarget &&
@ -1063,7 +1063,7 @@ var PlacesMenuDNDHandler = {
* @returns true if the element is a container element (menu or
*` menu-toolbarbutton), false otherwise.
*/
_isStaticContainer: function PMDH__isContainer(node) {
_isStaticContainer: function(node) {
let isMenu = node.localName == "menu" ||
(node.localName == "toolbarbutton" &&
(node.getAttribute("type") == "menu" ||
@ -1079,7 +1079,7 @@ var PlacesMenuDNDHandler = {
* @param event
* The DragOver event.
*/
onDragOver: function PMDH_onDragOver(event) {
onDragOver: function(event) {
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
Components.interfaces.nsITreeView.DROP_ON);
@ -1094,7 +1094,7 @@ var PlacesMenuDNDHandler = {
* @param event
* The Drop event.
*/
onDrop: function PMDH_onDrop(event) {
onDrop: function(event) {
// Put the item at the end of bookmark menu.
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
@ -1120,7 +1120,7 @@ var PlacesToolbarHelper = {
return document.getElementById("bookmarks-toolbar-placeholder");
},
init: function PTH_init(forceToolbarOverflowCheck) {
init: function(forceToolbarOverflowCheck) {
let viewElt = this._viewElt;
if (!viewElt || viewElt._placesView)
return;
@ -1148,11 +1148,11 @@ var PlacesToolbarHelper = {
this._setupPlaceholder();
},
uninit: function PTH_uninit() {
uninit: function() {
CustomizableUI.removeListener(this);
},
customizeStart: function PTH_customizeStart() {
customizeStart: function() {
try {
let viewElt = this._viewElt;
if (viewElt && viewElt._placesView)
@ -1163,11 +1163,11 @@ var PlacesToolbarHelper = {
this._shouldWrap = this._getShouldWrap();
},
customizeChange: function PTH_customizeChange() {
customizeChange: function() {
this._setupPlaceholder();
},
_setupPlaceholder: function PTH_setupPlaceholder() {
_setupPlaceholder: function() {
let placeholder = this._placeholder;
if (!placeholder) {
return;
@ -1184,12 +1184,12 @@ var PlacesToolbarHelper = {
}
},
customizeDone: function PTH_customizeDone() {
customizeDone: function() {
this._isCustomizing = false;
this.init(true);
},
_getShouldWrap: function PTH_getShouldWrap() {
_getShouldWrap: function() {
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
let area = placement && placement.area;
let areaType = area && CustomizableUI.getAreaType(area);
@ -1351,11 +1351,11 @@ var BookmarkingUI = {
* reasons.
*/
_popupNeedsUpdate: true,
onToolbarVisibilityChange: function BUI_onToolbarVisibilityChange() {
onToolbarVisibilityChange: function() {
this._popupNeedsUpdate = true;
},
onPopupShowing: function BUI_onPopupShowing(event) {
onPopupShowing: function(event) {
// Don't handle events for submenus.
if (event.target != event.currentTarget)
return;
@ -1554,12 +1554,12 @@ var BookmarkingUI = {
Services.prefs.setBoolPref(this.RECENTLY_BOOKMARKED_PREF, false);
},
_updateCustomizationState: function BUI__updateCustomizationState() {
_updateCustomizationState: function() {
let placement = CustomizableUI.getPlacementOfWidget(this.BOOKMARK_BUTTON_ID);
this._currentAreaType = placement && CustomizableUI.getAreaType(placement.area);
},
_uninitView: function BUI__uninitView() {
_uninitView: function() {
// When an element with a placesView attached is removed and re-inserted,
// XBL reapplies the binding causing any kind of issues and possible leaks,
// so kill current view and let popupshowing generate a new one.
@ -1581,38 +1581,38 @@ var BookmarkingUI = {
}
},
onCustomizeStart: function BUI_customizeStart(aWindow) {
onCustomizeStart: function(aWindow) {
if (aWindow == window) {
this._uninitView();
this._isCustomizing = true;
}
},
onWidgetAdded: function BUI_widgetAdded(aWidgetId) {
onWidgetAdded: function(aWidgetId) {
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
this._onWidgetWasMoved();
}
},
onWidgetRemoved: function BUI_widgetRemoved(aWidgetId) {
onWidgetRemoved: function(aWidgetId) {
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
this._onWidgetWasMoved();
}
},
onWidgetReset: function BUI_widgetReset(aNode, aContainer) {
onWidgetReset: function(aNode, aContainer) {
if (aNode == this.button) {
this._onWidgetWasMoved();
}
},
onWidgetUndoMove: function BUI_undoWidgetUndoMove(aNode, aContainer) {
onWidgetUndoMove: function(aNode, aContainer) {
if (aNode == this.button) {
this._onWidgetWasMoved();
}
},
_onWidgetWasMoved: function BUI_widgetWasMoved() {
_onWidgetWasMoved: function() {
let usedToUpdateStarState = this._shouldUpdateStarState();
this._updateCustomizationState();
if (!usedToUpdateStarState && this._shouldUpdateStarState()) {
@ -1627,7 +1627,7 @@ var BookmarkingUI = {
}
},
onCustomizeEnd: function BUI_customizeEnd(aWindow) {
onCustomizeEnd: function(aWindow) {
if (aWindow == window) {
this._isCustomizing = false;
this.onToolbarVisibilityChange();
@ -1641,7 +1641,7 @@ var BookmarkingUI = {
_hasBookmarksObserver: false,
_itemIds: [],
uninit: function BUI_uninit() {
uninit: function() {
this._updateBookmarkPageMenuItem(true);
CustomizableUI.removeListener(this);
@ -1657,14 +1657,14 @@ var BookmarkingUI = {
}
},
onLocationChange: function BUI_onLocationChange() {
onLocationChange: function() {
if (this._uri && gBrowser.currentURI.equals(this._uri)) {
return;
}
this.updateStarState();
},
updateStarState: function BUI_updateStarState() {
updateStarState: function() {
// Reset tracked values.
this._uri = gBrowser.currentURI;
this._itemIds = [];
@ -1704,7 +1704,7 @@ var BookmarkingUI = {
});
},
_updateStar: function BUI__updateStar() {
_updateStar: function() {
if (!this._shouldUpdateStarState()) {
if (this.broadcaster.hasAttribute("starred")) {
this.broadcaster.removeAttribute("starred");
@ -1733,7 +1733,7 @@ var BookmarkingUI = {
* forceReset is passed when we're destroyed and the label should go back
* to the default (Bookmark This Page) for OS X.
*/
_updateBookmarkPageMenuItem: function BUI__updateBookmarkPageMenuItem(forceReset) {
_updateBookmarkPageMenuItem: function(forceReset) {
let isStarred = !forceReset && this._itemIds.length > 0;
let label = isStarred ? "editlabel" : "bookmarklabel";
if (this.broadcaster) {
@ -1741,7 +1741,7 @@ var BookmarkingUI = {
}
},
onMainMenuPopupShowing: function BUI_onMainMenuPopupShowing(event) {
onMainMenuPopupShowing: function(event) {
// Don't handle events for submenus.
if (event.target != event.currentTarget)
return;
@ -1751,7 +1751,7 @@ var BookmarkingUI = {
this._initRecentBookmarks(document.getElementById("menu_recentBookmarks"));
},
_showBookmarkedNotification: function BUI_showBookmarkedNotification() {
_showBookmarkedNotification: function() {
function getCenteringTransformForRects(rectToPosition, referenceRect) {
let topDiff = referenceRect.top - rectToPosition.top;
let leftDiff = referenceRect.left - rectToPosition.left;
@ -1824,7 +1824,7 @@ var BookmarkingUI = {
CustomizableUI.AREA_PANEL);
},
onCommand: function BUI_onCommand(aEvent) {
onCommand: function(aEvent) {
if (aEvent.target != aEvent.currentTarget) {
return;
}
@ -1855,7 +1855,7 @@ var BookmarkingUI = {
this._updateBookmarkPageMenuItem();
},
handleEvent: function BUI_handleEvent(aEvent) {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "ViewShowing":
this.onPanelMenuViewShowing(aEvent);
@ -1866,7 +1866,7 @@ var BookmarkingUI = {
}
},
onPanelMenuViewShowing: function BUI_onViewShowing(aEvent) {
onPanelMenuViewShowing: function(aEvent) {
this._updateBookmarkPageMenuItem();
// Update checked status of the toolbar toggle.
let viewToolbar = document.getElementById("panelMenu_viewBookmarksToolbar");
@ -1891,13 +1891,13 @@ var BookmarkingUI = {
aEvent.target.removeEventListener("ViewShowing", this);
},
onPanelMenuViewHiding: function BUI_onViewHiding(aEvent) {
onPanelMenuViewHiding: function(aEvent) {
this._panelMenuView.uninit();
delete this._panelMenuView;
aEvent.target.removeEventListener("ViewHiding", this);
},
onPanelMenuViewCommand: function BUI_onPanelMenuViewCommand(aEvent, aView) {
onPanelMenuViewCommand: function(aEvent, aView) {
let target = aEvent.originalTarget;
if (!target._placesNode)
return;
@ -1909,7 +1909,7 @@ var BookmarkingUI = {
},
// nsINavBookmarkObserver
onItemAdded: function BUI_onItemAdded(aItemId, aParentId, aIndex, aItemType,
onItemAdded: function(aItemId, aParentId, aIndex, aItemType,
aURI) {
if (aURI && aURI.equals(this._uri)) {
// If a new bookmark has been added to the tracked uri, register it.
@ -1923,7 +1923,7 @@ var BookmarkingUI = {
}
},
onItemRemoved: function BUI_onItemRemoved(aItemId) {
onItemRemoved: function(aItemId) {
let index = this._itemIds.indexOf(aItemId);
// If one of the tracked bookmarks has been removed, unregister it.
if (index != -1) {
@ -1935,7 +1935,7 @@ var BookmarkingUI = {
}
},
onItemChanged: function BUI_onItemChanged(aItemId, aProperty,
onItemChanged: function(aItemId, aProperty,
aIsAnnotationProperty, aNewValue) {
if (aProperty == "uri") {
let index = this._itemIds.indexOf(aItemId);

View file

@ -95,7 +95,7 @@ var gPluginHandler = {
openUILinkIn(url, "tab");
},
submitReport: function submitReport(runID, keyVals, submitURLOptIn) {
submitReport: function(runID, keyVals, submitURLOptIn) {
/*** STUB ***/
return;
},
@ -110,7 +110,7 @@ var gPluginHandler = {
openHelpLink("plugin-crashed", false);
},
_clickToPlayNotificationEventCallback: function PH_ctpEventCallback(event) {
_clickToPlayNotificationEventCallback: function(event) {
if (event == "showing") {
Services.telemetry.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
.add(!this.options.primaryPlugin);

View file

@ -20,7 +20,7 @@ var gSyncUI = {
_unloaded: false,
init: function SUI_init() {
init: function() {
// Proceed to set up the UI if Sync has already started up.
// Otherwise we'll do it when Sync is firing up.
let xps = Components.classes["@mozilla.org/weave/service;1"]
@ -48,7 +48,7 @@ var gSyncUI = {
}, false);
},
initUI: function SUI_initUI() {
initUI: function() {
// If this is a browser window?
if (gBrowser) {
this._obs.push("weave:notification:added");
@ -64,7 +64,7 @@ var gSyncUI = {
this.updateUI();
},
initNotifications: function SUI_initNotifications() {
initNotifications: function() {
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let notificationbox = document.createElementNS(XULNS, "notificationbox");
notificationbox.id = "sync-notifications";
@ -82,7 +82,7 @@ var gSyncUI = {
_wasDelayed: false,
_needsSetup: function SUI__needsSetup() {
_needsSetup: function() {
let firstSync = "";
try {
firstSync = Services.prefs.getCharPref("services.sync.firstSync");
@ -91,7 +91,7 @@ var gSyncUI = {
firstSync == "notReady";
},
updateUI: function SUI_updateUI() {
updateUI: function() {
let needsSetup = this._needsSetup();
document.getElementById("sync-setup-state").hidden = !needsSetup;
document.getElementById("sync-syncnow-state").hidden = needsSetup;
@ -111,7 +111,7 @@ var gSyncUI = {
// Functions called by observers
onActivityStart: function SUI_onActivityStart() {
onActivityStart: function() {
if (!gBrowser)
return;
@ -122,7 +122,7 @@ var gSyncUI = {
button.setAttribute("status", "active");
},
onSyncDelay: function SUI_onSyncDelay() {
onSyncDelay: function() {
// basically, we want to just inform users that stuff is going to take a while
let title = this._stringBundle.GetStringFromName("error.sync.no_node_found.title");
let description = this._stringBundle.GetStringFromName("error.sync.no_node_found");
@ -137,17 +137,17 @@ var gSyncUI = {
this._wasDelayed = true;
},
onLoginFinish: function SUI_onLoginFinish() {
onLoginFinish: function() {
// Clear out any login failure notifications
let title = this._stringBundle.GetStringFromName("error.login.title");
this.clearError(title);
},
onSetupComplete: function SUI_onSetupComplete() {
onSetupComplete: function() {
this.onLoginFinish();
},
onLoginError: function SUI_onLoginError() {
onLoginError: function() {
// if login fails, any other notifications are essentially moot
Weave.Notifications.removeAll();
@ -185,15 +185,15 @@ var gSyncUI = {
this.updateUI();
},
onLogout: function SUI_onLogout() {
onLogout: function() {
this.updateUI();
},
onStartOver: function SUI_onStartOver() {
onStartOver: function() {
this.clearError();
},
onQuotaNotice: function onQuotaNotice(subject, data) {
onQuotaNotice: function(subject, data) {
let title = this._stringBundle.GetStringFromName("warning.sync.quota.label");
let description = this._stringBundle.GetStringFromName("warning.sync.quota.description");
let buttons = [];
@ -214,11 +214,11 @@ var gSyncUI = {
},
// Commands
doSync: function SUI_doSync() {
doSync: function() {
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
},
handleToolbarButton: function SUI_handleStatusbarButton() {
handleToolbarButton: function() {
if (this._needsSetup())
this.openSetup();
else
@ -238,7 +238,7 @@ var gSyncUI = {
* "reset" -- reset sync
*/
openSetup: function SUI_openSetup(wizardType) {
openSetup: function(wizardType) {
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
if (win)
win.focus();
@ -261,7 +261,7 @@ var gSyncUI = {
"syncAddDevice", "centerscreen,chrome,resizable=no");
},
openQuotaDialog: function SUI_openQuotaDialog() {
openQuotaDialog: function() {
let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
if (win)
win.focus();
@ -271,12 +271,12 @@ var gSyncUI = {
"centerscreen,chrome,dialog,modal");
},
openPrefs: function SUI_openPrefs() {
openPrefs: function() {
openPreferences("paneSync");
},
// Helpers
_updateLastSyncTime: function SUI__updateLastSyncTime() {
_updateLastSyncTime: function() {
if (!gBrowser)
return;
@ -302,12 +302,12 @@ var gSyncUI = {
syncButton.setAttribute("tooltiptext", lastSyncLabel);
},
clearError: function SUI_clearError(errorString) {
clearError: function(errorString) {
Weave.Notifications.removeAll(errorString);
this.updateUI();
},
onSyncFinish: function SUI_onSyncFinish() {
onSyncFinish: function() {
let title = this._stringBundle.GetStringFromName("error.sync.title");
// Clear out sync failures on a successful sync
@ -320,7 +320,7 @@ var gSyncUI = {
}
},
onSyncError: function SUI_onSyncError() {
onSyncError: function() {
let title = this._stringBundle.GetStringFromName("error.sync.title");
if (Weave.Status.login != Weave.LOGIN_SUCCEEDED) {
@ -401,7 +401,7 @@ var gSyncUI = {
this.updateUI();
},
observe: function SUI_observe(subject, topic, data) {
observe: function(subject, topic, data) {
if (this._unloaded) {
Cu.reportError("SyncUI observer called after unload: " + topic);
return;

View file

@ -10,7 +10,7 @@ var TabsInTitlebar = {
init: function () {},
uninit: function () {},
allowedBy: function (condition, allow) {},
updateAppearance: function updateAppearance(aForce) {},
updateAppearance: function(aForce) {},
get enabled() {
return document.documentElement.getAttribute("tabsintitlebar") == "true";
},

View file

@ -61,7 +61,7 @@ var TabsInTitlebar = {
}
},
updateAppearance: function updateAppearance(aForce) {
updateAppearance: function(aForce) {
this._update(aForce);
},

View file

@ -28,7 +28,7 @@ var gBrowserThumbnails = {
*/
_tabEvents: ["TabClose", "TabSelect"],
init: function Thumbnails_init() {
init: function() {
PageThumbs.addExpirationFilter(this);
gBrowser.addTabsProgressListener(this);
Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false);
@ -43,7 +43,7 @@ var gBrowserThumbnails = {
this._timeouts = new WeakMap();
},
uninit: function Thumbnails_uninit() {
uninit: function() {
PageThumbs.removeExpirationFilter(this);
gBrowser.removeTabsProgressListener(this);
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
@ -53,7 +53,7 @@ var gBrowserThumbnails = {
}, this);
},
handleEvent: function Thumbnails_handleEvent(aEvent) {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "scroll":
let browser = aEvent.currentTarget;
@ -70,7 +70,7 @@ var gBrowserThumbnails = {
}
},
observe: function Thumbnails_observe() {
observe: function() {
this._sslDiskCacheEnabled =
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
},
@ -83,14 +83,14 @@ var gBrowserThumbnails = {
/**
* State change progress listener for all tabs.
*/
onStateChange: function Thumbnails_onStateChange(aBrowser, aWebProgress,
onStateChange: function(aBrowser, aWebProgress,
aRequest, aStateFlags, aStatus) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)
this._delayedCapture(aBrowser);
},
_capture: function Thumbnails_capture(aBrowser) {
_capture: function(aBrowser) {
// Only capture about:newtab top sites.
if (this._topSiteURLs.indexOf(aBrowser.currentURI.spec) == -1)
return;
@ -101,7 +101,7 @@ var gBrowserThumbnails = {
});
},
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
_delayedCapture: function(aBrowser) {
if (this._timeouts.has(aBrowser))
clearTimeout(this._timeouts.get(aBrowser));
else
@ -115,7 +115,7 @@ var gBrowserThumbnails = {
this._timeouts.set(aBrowser, timeout);
},
_shouldCapture: function Thumbnails_shouldCapture(aBrowser, aCallback) {
_shouldCapture: function(aBrowser, aCallback) {
// Capture only if it's the currently selected tab.
if (aBrowser != gBrowser.selectedBrowser) {
aCallback(false);
@ -132,7 +132,7 @@ var gBrowserThumbnails = {
}, []);
},
_clearTimeout: function Thumbnails_clearTimeout(aBrowser) {
_clearTimeout: function(aBrowser) {
if (this._timeouts.has(aBrowser)) {
aBrowser.removeEventListener("scroll", this, false);
clearTimeout(this._timeouts.get(aBrowser));

View file

@ -3359,7 +3359,7 @@ const BrowserSearch = {
* the default engine's search form otherwise. For Mac, opens a new window
* or focuses an existing window, if necessary.
*/
webSearch: function BrowserSearch_webSearch() {
webSearch: function() {
if (window.location.href != getBrowserURL()) {
var win = getTopWin();
if (win) {
@ -3470,7 +3470,7 @@ const BrowserSearch = {
* @return string Name of the search engine used to perform a search or null
* if a search was not performed.
*/
loadSearch: function BrowserSearch_search(searchText, useNewTab, purpose) {
loadSearch: function(searchText, useNewTab, purpose) {
let engine = BrowserSearch._loadSearch(searchText, useNewTab, purpose);
if (!engine) {
return null;
@ -3508,7 +3508,7 @@ const BrowserSearch = {
return formatURL("browser.search.searchEnginesURL", true);
},
loadAddEngines: function BrowserSearch_loadAddEngines() {
loadAddEngines: function() {
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
var where = newWindowPref == 3 ? "tab" : "window";
openUILinkIn(this.searchEnginesURL, where);
@ -4303,7 +4303,7 @@ var XULBrowserWindow = {
},
// simulate all change notifications after switching tabs
onUpdateCurrentBrowser: function XWB_onUpdateCurrentBrowser(aStateFlags, aStatus, aMessage, aTotalProgress) {
onUpdateCurrentBrowser: function(aStateFlags, aStatus, aMessage, aTotalProgress) {
if (FullZoom.updateBackgroundTabs)
FullZoom.onLocationChange(gBrowser.currentURI, true);
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
@ -4666,7 +4666,7 @@ nsBrowserAccess.prototype = {
return newWindow;
},
openURIInFrame: function browser_openURIInFrame(aURI, aParams, aWhere, aFlags) {
openURIInFrame: function(aURI, aParams, aWhere, aFlags) {
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
dump("Error: openURIInFrame can only open in new tabs");
return null;
@ -7191,7 +7191,7 @@ function getNavToolbox() {
}
var gPrivateBrowsingUI = {
init: function PBUI_init() {
init: function() {
// Do nothing for normal windows
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
return;
@ -7429,7 +7429,7 @@ var TabContextMenu = {
}
});
},
updateContextMenu: function updateContextMenu(aPopupMenu) {
updateContextMenu: function(aPopupMenu) {
this.contextTab = aPopupMenu.triggerNode.localName == "tab" ?
aPopupMenu.triggerNode : gBrowser.selectedTab;
let disabled = gBrowser.tabs.length == 1;

View file

@ -81,7 +81,7 @@ Cell.prototype = {
* Checks whether the cell contains a pinned site.
* @return Whether the cell contains a pinned site.
*/
containsPinnedSite: function Cell_containsPinnedSite() {
containsPinnedSite: function() {
let site = this.site;
return site && site.isPinned();
},
@ -90,14 +90,14 @@ Cell.prototype = {
* Checks whether the cell contains a site (is empty).
* @return Whether the cell is empty.
*/
isEmpty: function Cell_isEmpty() {
isEmpty: function() {
return !this.site;
},
/**
* Handles all cell events.
*/
handleEvent: function Cell_handleEvent(aEvent) {
handleEvent: function(aEvent) {
// We're not responding to external drag/drop events
// when our parent window is in private browsing mode.
if (inPrivateBrowsingMode() && !gDrag.draggedSite)

View file

@ -33,7 +33,7 @@ var gDrag = {
* @param aSite The site that's being dragged.
* @param aEvent The 'dragstart' event.
*/
start: function Drag_start(aSite, aEvent) {
start: function(aSite, aEvent) {
this._draggedSite = aSite;
// Mark nodes as being dragged.
@ -66,7 +66,7 @@ var gDrag = {
* @param aSite The site that's being dragged.
* @param aEvent The 'drag' event.
*/
drag: function Drag_drag(aSite, aEvent) {
drag: function(aSite, aEvent) {
// Get the viewport size.
let {clientWidth, clientHeight} = document.documentElement;
@ -90,7 +90,7 @@ var gDrag = {
* @param aSite The site that's being dragged.
* @param aEvent The 'dragend' event.
*/
end: function Drag_end(aSite, aEvent) {
end: function(aSite, aEvent) {
let nodes = gGrid.node.querySelectorAll("[dragged]")
for (let i = 0; i < nodes.length; i++)
nodes[i].removeAttribute("dragged");
@ -106,7 +106,7 @@ var gDrag = {
* @param aEvent The drag event to check.
* @return Whether we should handle this drag and drop operation.
*/
isValid: function Drag_isValid(aEvent) {
isValid: function(aEvent) {
let link = gDragDataHelper.getLinkFromDragEvent(aEvent);
// Check that the drag data is non-empty.
@ -125,7 +125,7 @@ var gDrag = {
* @param aSite The site that's being dragged.
* @param aEvent The 'dragstart' event.
*/
_setDragData: function Drag_setDragData(aSite, aEvent) {
_setDragData: function(aSite, aEvent) {
let {url, title} = aSite;
let dt = aEvent.dataTransfer;

View file

@ -9,7 +9,7 @@ var gDragDataHelper = {
return "text/x-moz-url";
},
getLinkFromDragEvent: function DragDataHelper_getLinkFromDragEvent(aEvent) {
getLinkFromDragEvent: function(aEvent) {
let dt = aEvent.dataTransfer;
if (!dt || !dt.types.includes(this.mimeType)) {
return null;

View file

@ -21,7 +21,7 @@ var gDrop = {
* Handles the 'dragenter' event.
* @param aCell The drop target cell.
*/
enter: function Drop_enter(aCell) {
enter: function(aCell) {
this._delayedRearrange(aCell);
},
@ -30,7 +30,7 @@ var gDrop = {
* @param aCell The drop target cell.
* @param aEvent The 'dragexit' event.
*/
exit: function Drop_exit(aCell, aEvent) {
exit: function(aCell, aEvent) {
if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) {
this._delayedRearrange();
} else {
@ -45,7 +45,7 @@ var gDrop = {
* @param aCell The drop target cell.
* @param aEvent The 'dragexit' event.
*/
drop: function Drop_drop(aCell, aEvent) {
drop: function(aCell, aEvent) {
// The cell that is the drop target could contain a pinned site. We need
// to find out where that site has gone and re-pin it there.
if (aCell.containsPinnedSite())
@ -64,7 +64,7 @@ var gDrop = {
* Re-pins all pinned sites in their (new) positions.
* @param aCell The drop target cell.
*/
_repinSitesAfterDrop: function Drop_repinSitesAfterDrop(aCell) {
_repinSitesAfterDrop: function(aCell) {
let sites = gDropPreview.rearrange(aCell);
// Filter out pinned sites.
@ -81,7 +81,7 @@ var gDrop = {
* @param aCell The drop target cell.
* @param aEvent The 'dragexit' event.
*/
_pinDraggedSite: function Drop_pinDraggedSite(aCell, aEvent) {
_pinDraggedSite: function(aCell, aEvent) {
let index = aCell.index;
let draggedSite = gDrag.draggedSite;
@ -105,7 +105,7 @@ var gDrop = {
* Time a rearrange with a little delay.
* @param aCell The drop target cell.
*/
_delayedRearrange: function Drop_delayedRearrange(aCell) {
_delayedRearrange: function(aCell) {
// The last drop target didn't change so there's no need to re-arrange.
if (this._lastDropTarget == aCell)
return;
@ -127,7 +127,7 @@ var gDrop = {
/**
* Cancels a timed rearrange, if any.
*/
_cancelDelayedArrange: function Drop_cancelDelayedArrange() {
_cancelDelayedArrange: function() {
if (this._rearrangeTimeout) {
clearTimeout(this._rearrangeTimeout);
this._rearrangeTimeout = null;
@ -138,7 +138,7 @@ var gDrop = {
* Rearrange all sites in the grid depending on the current drop target.
* @param aCell The drop target cell.
*/
_rearrange: function Drop_rearrange(aCell) {
_rearrange: function(aCell) {
let sites = gGrid.sites;
// We need to rearrange the grid only if there's a current drop target.

View file

@ -16,7 +16,7 @@ var gDropPreview = {
* @param aCell The drop target cell.
* @return The re-arranged array of sites.
*/
rearrange: function DropPreview_rearrange(aCell) {
rearrange: function(aCell) {
let sites = gGrid.sites;
// Insert the dragged site into the current grid.
@ -34,7 +34,7 @@ var gDropPreview = {
* @param aSites The array of sites to insert into.
* @param aCell The drop target cell.
*/
_insertDraggedSite: function DropPreview_insertDraggedSite(aSites, aCell) {
_insertDraggedSite: function(aSites, aCell) {
let dropIndex = aCell.index;
let draggedSite = gDrag.draggedSite;
@ -85,7 +85,7 @@ var gDropPreview = {
* @param aCell The drop target cell.
* @return The filtered array of sites.
*/
_filterPinnedSites: function DropPreview_filterPinnedSites(aSites, aCell) {
_filterPinnedSites: function(aSites, aCell) {
let draggedSite = gDrag.draggedSite;
// When dropping on a cell that contains a pinned site make sure that all
@ -109,7 +109,7 @@ var gDropPreview = {
* @param aCell The drop target cell.
* @return The range of pinned cells.
*/
_getPinnedRange: function DropPreview_getPinnedRange(aCell) {
_getPinnedRange: function(aCell) {
let dropIndex = aCell.index;
let range = {start: dropIndex, end: dropIndex};

View file

@ -204,7 +204,7 @@ var gDropTargetShim = {
* Gets the positions of all cell nodes.
* @return The (cached) cell positions.
*/
_getCellPositions: function DropTargetShim_getCellPositions() {
_getCellPositions: function() {
if (this._cellPositions)
return this._cellPositions;

View file

@ -47,7 +47,7 @@ var gGrid = {
* Initializes the grid.
* @param aSelector The query selector of the grid.
*/
init: function Grid_init() {
init: function() {
this._node = document.getElementById("newtab-grid");
this._gridDefaultContent = this._node.lastChild;
this._createSiteFragment();
@ -77,7 +77,7 @@ var gGrid = {
* @param aCell The cell that will contain the new site.
* @return The newly created site.
*/
createSite: function Grid_createSite(aLink, aCell) {
createSite: function(aLink, aCell) {
let node = aCell.node;
node.appendChild(this._siteFragment.cloneNode(true));
return new Site(node.firstElementChild, aLink);
@ -86,7 +86,7 @@ var gGrid = {
/**
* Handles all grid events.
*/
handleEvent: function Grid_handleEvent(aEvent) {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "load":
case "resize":
@ -98,14 +98,14 @@ var gGrid = {
/**
* Locks the grid to block all pointer events.
*/
lock: function Grid_lock() {
lock: function() {
this.node.setAttribute("locked", "true");
},
/**
* Unlocks the grid to allow all pointer events.
*/
unlock: function Grid_unlock() {
unlock: function() {
this.node.removeAttribute("locked");
},
@ -158,7 +158,7 @@ var gGrid = {
* Calculate the height for a number of rows up to the maximum rows
* @param rows Number of rows defaulting to the max
*/
_computeHeight: function Grid_computeHeight(aRows) {
_computeHeight: function(aRows) {
let {gridRows} = gGridPrefs;
aRows = aRows === undefined ? gridRows : Math.min(gridRows, aRows);
return aRows * this._cellHeight + GRID_BOTTOM_EXTRA;
@ -167,7 +167,7 @@ var gGrid = {
/**
* Creates the DOM fragment that is re-used when creating sites.
*/
_createSiteFragment: function Grid_createSiteFragment() {
_createSiteFragment: function() {
let site = document.createElementNS(HTML_NAMESPACE, "div");
site.classList.add("newtab-site");
site.setAttribute("draggable", "true");
@ -192,7 +192,7 @@ var gGrid = {
* Test a tile at a given position for being pinned or history
* @param position Position in sites array
*/
_isHistoricalTile: function Grid_isHistoricalTile(aPos) {
_isHistoricalTile: function(aPos) {
let site = this.sites[aPos];
return site && (site.isPinned() || site.link && site.link.type == "history");
},
@ -200,7 +200,7 @@ var gGrid = {
/**
* Make sure the correct number of rows and columns are visible
*/
_resizeGrid: function Grid_resizeGrid() {
_resizeGrid: function() {
// If we're somehow called before the page has finished loading,
// let's bail out to avoid caching zero heights and widths.
// We'll be called again when DOMContentLoaded fires.

View file

@ -15,7 +15,7 @@ var gPage = {
/**
* Initializes the page.
*/
init: function Page_init() {
init: function() {
// Add ourselves to the list of pages to receive notifications.
gAllPages.register(this);
@ -41,7 +41,7 @@ var gPage = {
/**
* Listens for notifications specific to this page.
*/
observe: function Page_observe(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed") {
gCustomize.updateSelected();
@ -100,7 +100,7 @@ var gPage = {
* Internally initializes the page. This runs only when/if the feature
* is/gets enabled.
*/
_init: function Page_init() {
_init: function() {
if (this._initialized)
return;
@ -137,7 +137,7 @@ var gPage = {
* Updates the 'page-disabled' attributes of the respective DOM nodes.
* @param aValue Whether the New Tab Page is enabled or not.
*/
_updateAttributes: function Page_updateAttributes(aValue) {
_updateAttributes: function(aValue) {
// Set the nodes' states.
let nodeSelector = "#newtab-grid, #newtab-search-container";
for (let node of document.querySelectorAll(nodeSelector)) {
@ -160,14 +160,14 @@ var gPage = {
/**
* Handles unload event
*/
_handleUnloadEvent: function Page_handleUnloadEvent() {
_handleUnloadEvent: function() {
gAllPages.unregister(this);
},
/**
* Handles all page events.
*/
handleEvent: function Page_handleEvent(aEvent) {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "load":
this.onPageVisibleAndLoaded();

View file

@ -55,7 +55,7 @@ Site.prototype = {
* @param aIndex The pinned index (optional).
* @return true if link changed type after pin
*/
pin: function Site_pin(aIndex) {
pin: function(aIndex) {
if (typeof aIndex == "undefined")
aIndex = this.cell.index;
@ -71,7 +71,7 @@ Site.prototype = {
/**
* Unpins the site and calls the given callback when done.
*/
unpin: function Site_unpin() {
unpin: function() {
if (this.isPinned()) {
this._updateAttributes(false);
gPinnedLinks.unpin(this._link);
@ -83,7 +83,7 @@ Site.prototype = {
* Checks whether this site is pinned.
* @return Whether this site is pinned.
*/
isPinned: function Site_isPinned() {
isPinned: function() {
return gPinnedLinks.isPinned(this._link);
},
@ -91,7 +91,7 @@ Site.prototype = {
* Blocks the site (removes it from the grid) and calls the given callback
* when done.
*/
block: function Site_block() {
block: function() {
if (!gBlockedLinks.isBlocked(this._link)) {
gUndoDialog.show(this);
gBlockedLinks.block(this._link);
@ -104,7 +104,7 @@ Site.prototype = {
* @param aSelector The query selector.
* @return The DOM node we found.
*/
_querySelector: function Site_querySelector(aSelector) {
_querySelector: function(aSelector) {
return this.node.querySelector(aSelector);
},
@ -139,7 +139,7 @@ Site.prototype = {
/**
* Checks for and modifies link at campaign end time
*/
_checkLinkEndTime: function Site_checkLinkEndTime() {
_checkLinkEndTime: function() {
if (this.link.endTime && this.link.endTime < Date.now()) {
let oldUrl = this.url;
// chop off the path part from url
@ -155,7 +155,7 @@ Site.prototype = {
/**
* Renders the site's data (fills the HTML fragment).
*/
_render: function Site_render() {
_render: function() {
// first check for end time, as it may modify the link
this._checkLinkEndTime();
// setup display variables
@ -188,7 +188,7 @@ Site.prototype = {
* Since the newtab may be preloaded long before it's displayed,
* check for changed conditions and re-render if needed
*/
onFirstVisible: function Site_onFirstVisible() {
onFirstVisible: function() {
if (this.link.endTime && this.link.endTime < Date.now()) {
// site needs to change landing url and background image
this._render();
@ -202,7 +202,7 @@ Site.prototype = {
* Captures the site's thumbnail in the background, but only if there's no
* existing thumbnail and the page allows background captures.
*/
captureIfMissing: function Site_captureIfMissing() {
captureIfMissing: function() {
if (!document.hidden && !this.link.imageURI) {
BackgroundPageThumbs.captureIfMissing(this.url);
}
@ -211,7 +211,7 @@ Site.prototype = {
/**
* Refreshes the thumbnail for the site.
*/
refreshThumbnail: function Site_refreshThumbnail() {
refreshThumbnail: function() {
// Only enhance tiles if that feature is turned on
let link = this.link;
@ -249,7 +249,7 @@ Site.prototype = {
/**
* Adds event handlers for the site and its buttons.
*/
_addEventHandlers: function Site_addEventHandlers() {
_addEventHandlers: function() {
// Register drag-and-drop event handlers.
this._node.addEventListener("dragstart", this, false);
this._node.addEventListener("dragend", this, false);
@ -259,7 +259,7 @@ Site.prototype = {
/**
* Speculatively opens a connection to the current site.
*/
_speculativeConnect: function Site_speculativeConnect() {
_speculativeConnect: function() {
let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
let uri = Services.io.newURI(this.url, null, null);
try {
@ -272,7 +272,7 @@ Site.prototype = {
/**
* Record interaction with site using telemetry.
*/
_recordSiteClicked: function Site_recordSiteClicked(aIndex) {
_recordSiteClicked: function(aIndex) {
if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
aIndex > 8) {
@ -287,7 +287,7 @@ Site.prototype = {
/**
* Handles site click events.
*/
onClick: function Site_onClick(aEvent) {
onClick: function(aEvent) {
let action;
let pinned = this.isPinned();
let tileIndex = this.cell.index;
@ -326,7 +326,7 @@ Site.prototype = {
/**
* Handles all site events.
*/
handleEvent: function Site_handleEvent(aEvent) {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "mouseover":
this._node.removeEventListener("mouseover", this, false);

View file

@ -33,7 +33,7 @@ var gTransformation = {
* @param aNode The DOM node.
* @return A Rect instance with the position.
*/
getNodePosition: function Transformation_getNodePosition(aNode) {
getNodePosition: function(aNode) {
let {left, top, width, height} = aNode.getBoundingClientRect();
return new Rect(left + scrollX, top + scrollY, width, height);
},
@ -43,7 +43,7 @@ var gTransformation = {
* @param aNode The node to fade.
* @param aCallback The callback to call when finished.
*/
fadeNodeIn: function Transformation_fadeNodeIn(aNode, aCallback) {
fadeNodeIn: function(aNode, aCallback) {
this._setNodeOpacity(aNode, 1, function () {
// Clear the style property.
aNode.style.opacity = "";
@ -58,7 +58,7 @@ var gTransformation = {
* @param aNode The node to fade.
* @param aCallback The callback to call when finished.
*/
fadeNodeOut: function Transformation_fadeNodeOut(aNode, aCallback) {
fadeNodeOut: function(aNode, aCallback) {
this._setNodeOpacity(aNode, 0, aCallback);
},
@ -67,7 +67,7 @@ var gTransformation = {
* @param aSite The site to fade.
* @param aCallback The callback to call when finished.
*/
showSite: function Transformation_showSite(aSite, aCallback) {
showSite: function(aSite, aCallback) {
this.fadeNodeIn(aSite.node, aCallback);
},
@ -76,7 +76,7 @@ var gTransformation = {
* @param aSite The site to fade.
* @param aCallback The callback to call when finished.
*/
hideSite: function Transformation_hideSite(aSite, aCallback) {
hideSite: function(aSite, aCallback) {
this.fadeNodeOut(aSite.node, aCallback);
},
@ -85,7 +85,7 @@ var gTransformation = {
* @param aSite The site to re-position.
* @param aPosition The desired position for the given site.
*/
setSitePosition: function Transformation_setSitePosition(aSite, aPosition) {
setSitePosition: function(aSite, aPosition) {
let style = aSite.node.style;
let {top, left} = aPosition;
@ -97,7 +97,7 @@ var gTransformation = {
* Freezes a site in its current position by positioning it absolute.
* @param aSite The site to freeze.
*/
freezeSitePosition: function Transformation_freezeSitePosition(aSite) {
freezeSitePosition: function(aSite) {
if (this._isFrozen(aSite))
return;
@ -114,7 +114,7 @@ var gTransformation = {
* Unfreezes a site by removing its absolute positioning.
* @param aSite The site to unfreeze.
*/
unfreezeSitePosition: function Transformation_unfreezeSitePosition(aSite) {
unfreezeSitePosition: function(aSite) {
if (!this._isFrozen(aSite))
return;
@ -131,7 +131,7 @@ var gTransformation = {
* unfreeze - unfreeze the site after sliding
* callback - the callback to call when finished
*/
slideSiteTo: function Transformation_slideSiteTo(aSite, aTarget, aOptions) {
slideSiteTo: function(aSite, aTarget, aOptions) {
let currentPosition = this.getNodePosition(aSite.node);
let targetPosition = this.getNodePosition(aTarget.node)
let callback = aOptions && aOptions.callback;
@ -168,7 +168,7 @@ var gTransformation = {
* unfreeze - unfreeze the site after rearranging
* callback - the callback to call when finished
*/
rearrangeSites: function Transformation_rearrangeSites(aSites, aOptions) {
rearrangeSites: function(aSites, aOptions) {
let batch = [];
let cells = gGrid.cells;
let callback = aOptions && aOptions.callback;
@ -222,7 +222,7 @@ var gTransformation = {
* @param aNode The node to get the opacity value from.
* @return The node's opacity value.
*/
_getNodeOpacity: function Transformation_getNodeOpacity(aNode) {
_getNodeOpacity: function(aNode) {
let cstyle = window.getComputedStyle(aNode, null);
return cstyle.getPropertyValue("opacity");
},
@ -254,7 +254,7 @@ var gTransformation = {
* @param aIndex The target cell's index.
* @param aOptions Options that are directly passed to slideSiteTo().
*/
_moveSite: function Transformation_moveSite(aSite, aIndex, aOptions) {
_moveSite: function(aSite, aIndex, aOptions) {
this.freezeSitePosition(aSite);
this.slideSiteTo(aSite, gGrid.cells[aIndex], aOptions);
},
@ -264,7 +264,7 @@ var gTransformation = {
* @param aSite The site to check.
* @return Whether the given site is frozen.
*/
_isFrozen: function Transformation_isFrozen(aSite) {
_isFrozen: function(aSite) {
return aSite.node.hasAttribute("frozen");
}
};

View file

@ -22,7 +22,7 @@ var gUndoDialog = {
/**
* Initializes the undo dialog.
*/
init: function UndoDialog_init() {
init: function() {
this._undoContainer = document.getElementById("newtab-undo-container");
this._undoContainer.addEventListener("click", this, false);
this._undoButton = document.getElementById("newtab-undo-button");
@ -34,7 +34,7 @@ var gUndoDialog = {
* Shows the undo dialog.
* @param aSite The site that just got removed.
*/
show: function UndoDialog_show(aSite) {
show: function(aSite) {
if (this._undoData)
clearTimeout(this._undoData.timeout);
@ -54,7 +54,7 @@ var gUndoDialog = {
/**
* Hides the undo dialog.
*/
hide: function UndoDialog_hide() {
hide: function() {
if (!this._undoData)
return;
@ -70,7 +70,7 @@ var gUndoDialog = {
* The undo dialog event handler.
* @param aEvent The event to handle.
*/
handleEvent: function UndoDialog_handleEvent(aEvent) {
handleEvent: function(aEvent) {
switch (aEvent.target.id) {
case "newtab-undo-button":
this._undo();
@ -87,7 +87,7 @@ var gUndoDialog = {
/**
* Undo the last blocked site.
*/
_undo: function UndoDialog_undo() {
_undo: function() {
if (!this._undoData)
return;
@ -105,7 +105,7 @@ var gUndoDialog = {
/**
* Undo all blocked sites.
*/
_undoAll: function UndoDialog_undoAll() {
_undoAll: function() {
NewTabUtils.undoAll(function() {
gUpdater.updateGrid();
this.hide();

View file

@ -14,7 +14,7 @@ var gUpdater = {
* This removes old, moves existing and creates new sites to fill gaps.
* @param aCallback The callback to call when finished.
*/
updateGrid: function Updater_updateGrid(aCallback) {
updateGrid: function(aCallback) {
let links = gLinks.getLinks().slice(0, gGrid.cells.length);
// Find all sites that remain in the grid.
@ -50,7 +50,7 @@ var gUpdater = {
* @param aLinks The array of links to find sites for.
* @return Array of sites mapped to the given links (can contain null values).
*/
_findRemainingSites: function Updater_findRemainingSites(aLinks) {
_findRemainingSites: function(aLinks) {
let map = {};
// Create a map to easily retrieve the site for a given URL.
@ -69,7 +69,7 @@ var gUpdater = {
* Freezes the given sites' positions.
* @param aSites The array of sites to freeze.
*/
_freezeSitePositions: function Updater_freezeSitePositions(aSites) {
_freezeSitePositions: function(aSites) {
aSites.forEach(function (aSite) {
if (aSite)
gTransformation.freezeSitePosition(aSite);
@ -80,7 +80,7 @@ var gUpdater = {
* Moves the given sites' DOM nodes to their new positions.
* @param aSites The array of sites to move.
*/
_moveSiteNodes: function Updater_moveSiteNodes(aSites) {
_moveSiteNodes: function(aSites) {
let cells = gGrid.cells;
// Truncate the given array of sites to not have more sites than cells.
@ -112,7 +112,7 @@ var gUpdater = {
* @param aSites The array of sites to re-arrange.
* @param aCallback The callback to call when finished.
*/
_rearrangeSites: function Updater_rearrangeSites(aSites, aCallback) {
_rearrangeSites: function(aSites, aCallback) {
let options = {callback: aCallback, unfreeze: true};
gTransformation.rearrangeSites(aSites, options);
},
@ -123,7 +123,7 @@ var gUpdater = {
* @param aSites The array of sites remaining in the grid.
* @param aCallback The callback to call when finished.
*/
_removeLegacySites: function Updater_removeLegacySites(aSites, aCallback) {
_removeLegacySites: function(aSites, aCallback) {
let batch = [];
// Delete sites that were removed from the grid.
@ -152,7 +152,7 @@ var gUpdater = {
* @param aLinks The array of links.
* @param aCallback The callback to call when finished.
*/
_fillEmptyCells: function Updater_fillEmptyCells(aLinks, aCallback) {
_fillEmptyCells: function(aLinks, aCallback) {
let {cells, sites} = gGrid;
// Find empty cells and fill them.

View file

@ -24,7 +24,7 @@ function nsContextMenu(aXulMenu, aIsShift) {
// Prototype for nsContextMenu "class."
nsContextMenu.prototype = {
initMenu: function CM_initMenu(aXulMenu, aIsShift) {
initMenu: function(aXulMenu, aIsShift) {
// Get contextual info.
this.setTarget(document.popupNode, document.popupRangeParent,
document.popupRangeOffset);
@ -86,7 +86,7 @@ nsContextMenu.prototype = {
this.initItems();
},
hiding: function CM_hiding() {
hiding: function() {
gContextMenuContentData = null;
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
@ -99,7 +99,7 @@ nsContextMenu.prototype = {
}
},
initItems: function CM_initItems() {
initItems: function() {
this.initPageMenuSeparator();
this.initOpenItems();
this.initNavigationItems();
@ -114,11 +114,11 @@ nsContextMenu.prototype = {
this.initPasswordManagerItems();
},
initPageMenuSeparator: function CM_initPageMenuSeparator() {
initPageMenuSeparator: function() {
this.showItem("page-menu-separator", this.hasPageMenu);
},
initOpenItems: function CM_initOpenItems() {
initOpenItems: function() {
var isMailtoInternal = false;
if (this.onMailtoLink) {
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
@ -149,7 +149,7 @@ nsContextMenu.prototype = {
this.showItem("context-sep-open", shouldShow);
},
initNavigationItems: function CM_initNavigationItems() {
initNavigationItems: function() {
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
this.onCanvas || this.onVideo || this.onAudio ||
this.onTextInput);
@ -170,7 +170,7 @@ nsContextMenu.prototype = {
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
},
initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() {
initLeaveDOMFullScreenItems: function() {
// only show the option if the user is in DOM fullscreen
var shouldShow = (this.target.ownerDocument.fullscreenElement != null);
this.showItem("context-leave-dom-fullscreen", shouldShow);
@ -180,7 +180,7 @@ nsContextMenu.prototype = {
this.showItem("context-media-sep-commands", true);
},
initSaveItems: function CM_initSaveItems() {
initSaveItems: function() {
var shouldShow = !(this.onTextInput || this.onLink ||
this.isContentSelected || this.onImage ||
this.onCanvas || this.onVideo || this.onAudio);
@ -205,7 +205,7 @@ nsContextMenu.prototype = {
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
},
initViewItems: function CM_initViewItems() {
initViewItems: function() {
// View source is always OK, unless in directory listing.
this.showItem("context-viewpartialsource-selection",
this.isContentSelected);
@ -268,7 +268,7 @@ nsContextMenu.prototype = {
this.showItem("context-viewimagedesc", this.onImage && this.imageDescURL !== "");
},
initMiscItems: function CM_initMiscItems() {
initMiscItems: function() {
// Use "Bookmark This Link" if on a link.
let bookmarkPage = document.getElementById("context-bookmarkpage");
this.showItem(bookmarkPage,
@ -1214,7 +1214,7 @@ nsContextMenu.prototype = {
saveAsListener.prototype = {
extListener: null,
onStartRequest: function saveLinkAs_onStartRequest(aRequest, aContext) {
onStartRequest: function(aRequest, aContext) {
// if the timer fired, the error status will have been caused by that,
// and we'll be restarting in onStopRequest, so no reason to notify
@ -1255,7 +1255,7 @@ nsContextMenu.prototype = {
this.extListener.onStartRequest(aRequest, aContext);
},
onStopRequest: function saveLinkAs_onStopRequest(aRequest, aContext,
onStopRequest: function(aRequest, aContext,
aStatusCode) {
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
// do it the old fashioned way, which will pick the best filename
@ -1267,7 +1267,7 @@ nsContextMenu.prototype = {
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
},
onDataAvailable: function saveLinkAs_onDataAvailable(aRequest, aContext,
onDataAvailable: function(aRequest, aContext,
aInputStream,
aOffset, aCount) {
this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
@ -1277,7 +1277,7 @@ nsContextMenu.prototype = {
function callbacks() {}
callbacks.prototype = {
getInterface: function sLA_callbacks_getInterface(aIID) {
getInterface: function(aIID) {
if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) {
// If the channel demands authentication prompt, we must cancel it
// because the save-as-timer would expire and cancel the channel
@ -1296,7 +1296,7 @@ nsContextMenu.prototype = {
// we give up waiting for the filename.
function timerCallback() {}
timerCallback.prototype = {
notify: function sLA_timer_notify(aTimer) {
notify: function(aTimer) {
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
return;
}
@ -1617,16 +1617,16 @@ nsContextMenu.prototype = {
openUILinkIn(uri, where);
},
bookmarkThisPage: function CM_bookmarkThisPage() {
bookmarkThisPage: function() {
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
},
bookmarkLink: function CM_bookmarkLink() {
bookmarkLink: function() {
window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId,
this.linkURL, this.linkTextStr);
},
addBookmarkForFrame: function CM_addBookmarkForFrame() {
addBookmarkForFrame: function() {
let uri = gContextMenuContentData.documentURIObject;
let mm = this.browser.messageManager;
@ -1644,19 +1644,19 @@ nsContextMenu.prototype = {
mm.sendAsyncMessage("ContextMenu:BookmarkFrame", null, { target: this.target });
},
savePageAs: function CM_savePageAs() {
savePageAs: function() {
saveBrowser(this.browser);
},
printFrame: function CM_printFrame() {
printFrame: function() {
PrintUtils.printWindow(this.frameOuterWindowID, this.browser);
},
switchPageDirection: function CM_switchPageDirection() {
switchPageDirection: function() {
this.browser.messageManager.sendAsyncMessage("SwitchDocumentDirection");
},
mediaCommand : function CM_mediaCommand(command, data) {
mediaCommand : function(command, data) {
let mm = this.browser.messageManager;
let win = this.browser.ownerGlobal;
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)

View file

@ -568,7 +568,7 @@ var gContiguousSelectionTreeHelper = {
* view
* @return The new view
*/
setTree: function CSTH_setTree(aTreeElement, aProtoTreeView)
setTree: function(aTreeElement, aProtoTreeView)
{
this._tree = aTreeElement;
var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view);
@ -583,7 +583,7 @@ var gContiguousSelectionTreeHelper = {
*
* @return The row index of the grippy
*/
getGrippyRow: function CSTH_getGrippyRow()
getGrippyRow: function()
{
var sel = this.tree.view.selection;
var rangeCount = sel.getRangeCount();
@ -605,7 +605,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed dragover event
*/
ondragover: function CSTH_ondragover(aEvent)
ondragover: function(aEvent)
{
// Without this when dragging on Windows the mouse cursor is a "no" sign.
// This makes it a drop symbol.
@ -632,7 +632,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed dragstart event
*/
ondragstart: function CSTH_ondragstart(aEvent)
ondragstart: function(aEvent)
{
var tbo = this.tree.treeBoxObject;
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
@ -667,7 +667,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed keypress event
*/
onkeypress: function CSTH_onkeypress(aEvent)
onkeypress: function(aEvent)
{
var grippyRow = this.getGrippyRow();
var tbo = this.tree.treeBoxObject;
@ -728,7 +728,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed mousedown event
*/
onmousedown: function CSTH_onmousedown(aEvent)
onmousedown: function(aEvent)
{
var tbo = this.tree.treeBoxObject;
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
@ -750,7 +750,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEndRow
* The range [0, aEndRow] will be selected.
*/
rangedSelect: function CSTH_rangedSelect(aEndRow)
rangedSelect: function(aEndRow)
{
var tbo = this.tree.treeBoxObject;
if (aEndRow < 0)
@ -763,7 +763,7 @@ var gContiguousSelectionTreeHelper = {
/**
* Scrolls the tree so that the grippy row is in the center of the view.
*/
scrollToGrippy: function CSTH_scrollToGrippy()
scrollToGrippy: function()
{
var rowCount = this.tree.view.rowCount;
var tbo = this.tree.treeBoxObject;
@ -796,7 +796,7 @@ var gContiguousSelectionTreeHelper = {
* @param aProtoTreeView
* Used as the new view's prototype if specified
*/
_makeTreeView: function CSTH__makeTreeView(aProtoTreeView)
_makeTreeView: function(aProtoTreeView)
{
var view = aProtoTreeView;
var that = this;