[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/base.

This commit is contained in:
athenian200 2020-02-06 06:37:09 -06:00 • committed by Roy Tam
commit addf7b2fb1
10 changed files with 253 additions and 253 deletions

View file

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

View file

@ -24,7 +24,7 @@ var gGestureSupport = {
* @param aAddListener * @param aAddListener
* True to add/init listeners and false to remove/uninit * True to add/init listeners and false to remove/uninit
*/ */
init: function GS_init(aAddListener) { init: function (aAddListener) {
// Bug 863514 - Make gesture support work in electrolysis // Bug 863514 - Make gesture support work in electrolysis
if (gMultiProcessBrowser) if (gMultiProcessBrowser)
return; return;
@ -50,7 +50,7 @@ var gGestureSupport = {
* @param aEvent * @param aEvent
* The gesture event to handle * The gesture event to handle
*/ */
handleEvent: function GS_handleEvent(aEvent) { handleEvent: function (aEvent) {
if (!Services.prefs.getBoolPref( if (!Services.prefs.getBoolPref(
"dom.debug.propagate_gesture_events_through_content")) { "dom.debug.propagate_gesture_events_through_content")) {
aEvent.stopPropagation(); aEvent.stopPropagation();
@ -122,7 +122,7 @@ var gGestureSupport = {
* @param aDec * @param aDec
* Command to trigger for decreasing motion (without gesture name) * 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 // Try to load user-set values from preferences
for (let [pref, def] in Iterator(aPref)) for (let [pref, def] in Iterator(aPref))
aPref[pref] = this._getPref(aGesture + "." + pref, def); aPref[pref] = this._getPref(aGesture + "." + pref, def);
@ -133,7 +133,7 @@ var gGestureSupport = {
let isLatched = false; let isLatched = false;
// Create the update function here to capture closure state // Create the update function here to capture closure state
this._doUpdate = function GS__doUpdate(aEvent) { this._doUpdate = function (aEvent) {
// Update the offset with new event data // Update the offset with new event data
offset += aEvent.delta; offset += aEvent.delta;
@ -167,7 +167,7 @@ var gGestureSupport = {
* The swipe gesture event. * The swipe gesture event.
* @return true if the swipe event may navigate the history, false othwerwise. * @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"]) return this._getCommand(aEvent, ["swipe", "left"])
== "Browser:BackOrBackDuplicate" && == "Browser:BackOrBackDuplicate" &&
this._getCommand(aEvent, ["swipe", "right"]) this._getCommand(aEvent, ["swipe", "right"])
@ -180,7 +180,7 @@ var gGestureSupport = {
* @param aEvent * @param aEvent
* The swipe gesture start event. * The swipe gesture start event.
*/ */
_setupSwipeGesture: function GS__setupSwipeGesture(aEvent) { _setupSwipeGesture: function (aEvent) {
if (!this._swipeNavigatesHistory(aEvent)) if (!this._swipeNavigatesHistory(aEvent))
return; return;
@ -197,11 +197,11 @@ var gGestureSupport = {
gHistorySwipeAnimation.startAnimation(); gHistorySwipeAnimation.startAnimation();
this._doUpdate = function GS__doUpdate(aEvent) { this._doUpdate = function (aEvent) {
gHistorySwipeAnimation.updateAnimation(aEvent.delta); gHistorySwipeAnimation.updateAnimation(aEvent.delta);
}; };
this._doEnd = function GS__doEnd(aEvent) { this._doEnd = function (aEvent) {
gHistorySwipeAnimation.swipeEndEventReceived(); gHistorySwipeAnimation.swipeEndEventReceived();
this._doUpdate = function (aEvent) {}; this._doUpdate = function (aEvent) {};
@ -217,7 +217,7 @@ var gGestureSupport = {
* Source array containing any number of elements * Source array containing any number of elements
* @yield Array that is a subset of the input array from full set to empty * @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 // Create a bitmask based on the length of the array
let num = 1 << aArray.length; let num = 1 << aArray.length;
while (--num >= 0) { while (--num >= 0) {
@ -241,7 +241,7 @@ var gGestureSupport = {
* @return Name of the executed command. Returns null if no command is * @return Name of the executed command. Returns null if no command is
* found. * found.
*/ */
_doAction: function GS__doAction(aEvent, aGesture) { _doAction: function (aEvent, aGesture) {
let command = this._getCommand(aEvent, aGesture); let command = this._getCommand(aEvent, aGesture);
return command && this._doCommand(aEvent, command); return command && this._doCommand(aEvent, command);
}, },
@ -255,7 +255,7 @@ var gGestureSupport = {
* @param aGesture * @param aGesture
* Array of gesture name parts (to be joined by periods) * 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 // 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 // "meta" is preferred over "ctrl" when both buttons are pressed (and a
// command for both don't exist) // command for both don't exist)
@ -289,7 +289,7 @@ var gGestureSupport = {
* @param aCommand * @param aCommand
* Name of the command found for the event's keys and gesture. * 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); let node = document.getElementById(aCommand);
if (node) { if (node) {
if (node.getAttribute("disabled") != "true") { if (node.getAttribute("disabled") != "true") {
@ -329,7 +329,7 @@ var gGestureSupport = {
* @param aEvent * @param aEvent
* The swipe event to handle * The swipe event to handle
*/ */
onSwipe: function GS_onSwipe(aEvent) { onSwipe: function (aEvent) {
// Figure out which one (and only one) direction was triggered // Figure out which one (and only one) direction was triggered
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) { for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
if (aEvent.direction == aEvent["DIRECTION_" + dir]) { if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
@ -347,7 +347,7 @@ var gGestureSupport = {
* @param aDir * @param aDir
* The direction for the swipe event * The direction for the swipe event
*/ */
processSwipeEvent: function GS_processSwipeEvent(aEvent, aDir) { processSwipeEvent: function (aEvent, aDir) {
this._doAction(aEvent, ["swipe", aDir.toLowerCase()]); this._doAction(aEvent, ["swipe", aDir.toLowerCase()]);
}, },
@ -363,7 +363,7 @@ var gGestureSupport = {
* The direction for the swipe event * The direction for the swipe event
*/ */
_coordinateSwipeEventWithAnimation: _coordinateSwipeEventWithAnimation:
function GS__coordinateSwipeEventWithAnimation(aEvent, aDir) { function (aEvent, aDir) {
if ((gHistorySwipeAnimation.isAnimationRunning()) && if ((gHistorySwipeAnimation.isAnimationRunning()) &&
(aDir == "RIGHT" || aDir == "LEFT")) { (aDir == "RIGHT" || aDir == "LEFT")) {
gHistorySwipeAnimation.processSwipeEvent(aEvent, aDir); gHistorySwipeAnimation.processSwipeEvent(aEvent, aDir);
@ -381,7 +381,7 @@ var gGestureSupport = {
* @param aDef * @param aDef
* Default value if the preference doesn't exist * 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 // Preferences branch under which all gestures preferences are stored
const branch = "browser.gesture."; const branch = "browser.gesture.";
@ -541,7 +541,7 @@ var gHistorySwipeAnimation = {
* Initializes the support for history swipe animations, if it is supported * Initializes the support for history swipe animations, if it is supported
* by the platform/configuration. * by the platform/configuration.
*/ */
init: function HSA_init() { init: function () {
if (!this._isSupported()) if (!this._isSupported())
return; return;
@ -568,7 +568,7 @@ var gHistorySwipeAnimation = {
/** /**
* Uninitializes the support for history swipe animations. * Uninitializes the support for history swipe animations.
*/ */
uninit: function HSA_uninit() { uninit: function () {
gBrowser.removeEventListener("pagehide", this, false); gBrowser.removeEventListener("pagehide", this, false);
gBrowser.removeEventListener("pageshow", this, false); gBrowser.removeEventListener("pageshow", this, false);
gBrowser.removeEventListener("popstate", this, false); gBrowser.removeEventListener("popstate", this, false);
@ -582,7 +582,7 @@ var gHistorySwipeAnimation = {
* Starts the swipe animation and handles fast swiping (i.e. a swipe animation * Starts the swipe animation and handles fast swiping (i.e. a swipe animation
* is already in progress when a new one is initiated). * is already in progress when a new one is initiated).
*/ */
startAnimation: function HSA_startAnimation() { startAnimation: function () {
if (this.isAnimationRunning()) { if (this.isAnimationRunning()) {
gBrowser.stop(); gBrowser.stop();
this._lastSwipeDir = "RELOAD"; // just ensure that != "" this._lastSwipeDir = "RELOAD"; // just ensure that != ""
@ -607,7 +607,7 @@ var gHistorySwipeAnimation = {
/** /**
* Stops the swipe animation. * Stops the swipe animation.
*/ */
stopAnimation: function HSA_stopAnimation() { stopAnimation: function () {
gHistorySwipeAnimation._removeBoxes(); gHistorySwipeAnimation._removeBoxes();
}, },
@ -618,7 +618,7 @@ var gHistorySwipeAnimation = {
* A floating point value that represents the progress of the * A floating point value that represents the progress of the
* swipe gesture. * swipe gesture.
*/ */
updateAnimation: function HSA_updateAnimation(aVal) { updateAnimation: function (aVal) {
if (!this.isAnimationRunning()) if (!this.isAnimationRunning())
return; return;
@ -668,7 +668,7 @@ var gHistorySwipeAnimation = {
* @param aEvent * @param aEvent
* An event to process. * An event to process.
*/ */
handleEvent: function HSA_handleEvent(aEvent) { handleEvent: function (aEvent) {
switch (aEvent.type) { switch (aEvent.type) {
case "TabClose": case "TabClose":
let browser = gBrowser.getBrowserForTab(aEvent.target); let browser = gBrowser.getBrowserForTab(aEvent.target);
@ -698,7 +698,7 @@ var gHistorySwipeAnimation = {
* *
* @return true if the animation is currently running, false otherwise. * @return true if the animation is currently running, false otherwise.
*/ */
isAnimationRunning: function HSA_isAnimationRunning() { isAnimationRunning: function () {
return !!this._container; return !!this._container;
}, },
@ -710,7 +710,7 @@ var gHistorySwipeAnimation = {
* @param aDir * @param aDir
* The direction for the swipe event * The direction for the swipe event
*/ */
processSwipeEvent: function HSA_processSwipeEvent(aEvent, aDir) { processSwipeEvent: function (aEvent, aDir) {
if (aDir == "RIGHT") if (aDir == "RIGHT")
this._historyIndex += this.isLTR ? 1 : -1; this._historyIndex += this.isLTR ? 1 : -1;
else if (aDir == "LEFT") else if (aDir == "LEFT")
@ -725,7 +725,7 @@ var gHistorySwipeAnimation = {
* *
* @return true if there is a previous page in history, false otherwise. * @return true if there is a previous page in history, false otherwise.
*/ */
canGoBack: function HSA_canGoBack() { canGoBack: function () {
if (this.isAnimationRunning()) if (this.isAnimationRunning())
return this._doesIndexExistInHistory(this._historyIndex - 1); return this._doesIndexExistInHistory(this._historyIndex - 1);
return gBrowser.webNavigation.canGoBack; return gBrowser.webNavigation.canGoBack;
@ -736,7 +736,7 @@ var gHistorySwipeAnimation = {
* *
* @return true if there is a next page in history, false otherwise. * @return true if there is a next page in history, false otherwise.
*/ */
canGoForward: function HSA_canGoForward() { canGoForward: function () {
if (this.isAnimationRunning()) if (this.isAnimationRunning())
return this._doesIndexExistInHistory(this._historyIndex + 1); return this._doesIndexExistInHistory(this._historyIndex + 1);
return gBrowser.webNavigation.canGoForward; return gBrowser.webNavigation.canGoForward;
@ -747,7 +747,7 @@ var gHistorySwipeAnimation = {
* event and that we should navigate to the page that the user swiped to, if * 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. * any. This will also result in the animation overlay to be torn down.
*/ */
swipeEndEventReceived: function HSA_swipeEndEventReceived() { swipeEndEventReceived: function () {
if (this._lastSwipeDir != "") if (this._lastSwipeDir != "")
this._navigateToHistoryIndex(); this._navigateToHistoryIndex();
else else
@ -761,7 +761,7 @@ var gHistorySwipeAnimation = {
* The index to check for availability for in the history. * The index to check for availability for in the history.
* @return true if the index exists in the browser history, false otherwise. * @return true if the index exists in the browser history, false otherwise.
*/ */
_doesIndexExistInHistory: function HSA__doesIndexExistInHistory(aIndex) { _doesIndexExistInHistory: function (aIndex) {
try { try {
gBrowser.webNavigation.sessionHistory.getEntryAtIndex(aIndex, false); gBrowser.webNavigation.sessionHistory.getEntryAtIndex(aIndex, false);
} }
@ -775,7 +775,7 @@ var gHistorySwipeAnimation = {
* Navigates to the index in history that is currently being tracked by * Navigates to the index in history that is currently being tracked by
* |this|. * |this|.
*/ */
_navigateToHistoryIndex: function HSA__navigateToHistoryIndex() { _navigateToHistoryIndex: function () {
if (this._doesIndexExistInHistory(this._historyIndex)) { if (this._doesIndexExistInHistory(this._historyIndex)) {
gBrowser.webNavigation.gotoIndex(this._historyIndex); gBrowser.webNavigation.gotoIndex(this._historyIndex);
} }
@ -787,7 +787,7 @@ var gHistorySwipeAnimation = {
* *
* return true if supported, false otherwise. * return true if supported, false otherwise.
*/ */
_isSupported: function HSA__isSupported() { _isSupported: function () {
return window.matchMedia("(-moz-swipe-animation-enabled)").matches; return window.matchMedia("(-moz-swipe-animation-enabled)").matches;
}, },
@ -796,7 +796,7 @@ var gHistorySwipeAnimation = {
* progress when a new one is initiated). This will swap out the snapshots * progress when a new one is initiated). This will swap out the snapshots
* used in the previous animation with the appropriate new ones. * used in the previous animation with the appropriate new ones.
*/ */
_handleFastSwiping: function HSA__handleFastSwiping() { _handleFastSwiping: function () {
this._installCurrentPageSnapshot(null); this._installCurrentPageSnapshot(null);
this._installPrevAndNextSnapshots(); this._installPrevAndNextSnapshots();
}, },
@ -804,7 +804,7 @@ var gHistorySwipeAnimation = {
/** /**
* Adds the boxes that contain the snapshots used during the swipe animation. * Adds the boxes that contain the snapshots used during the swipe animation.
*/ */
_addBoxes: function HSA__addBoxes() { _addBoxes: function () {
let browserStack = let browserStack =
document.getAnonymousElementByAttribute(gBrowser.getNotificationBox(), document.getAnonymousElementByAttribute(gBrowser.getNotificationBox(),
"class", "browserStack"); "class", "browserStack");
@ -830,7 +830,7 @@ var gHistorySwipeAnimation = {
/** /**
* Removes the boxes. * Removes the boxes.
*/ */
_removeBoxes: function HSA__removeBoxes() { _removeBoxes: function () {
this._curBox = null; this._curBox = null;
this._prevBox = null; this._prevBox = null;
this._nextBox = null; this._nextBox = null;
@ -849,7 +849,7 @@ var gHistorySwipeAnimation = {
* The name of the tag to create the element for. * The name of the tag to create the element for.
* @return the newly created element. * @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 XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let element = document.createElementNS(XULNS, aTagName); let element = document.createElementNS(XULNS, aTagName);
element.id = aID; element.id = aID;
@ -864,14 +864,14 @@ var gHistorySwipeAnimation = {
* @param aPosition * @param aPosition
* The position (in X coordinates) to move the box element to. * The position (in X coordinates) to move the box element to.
*/ */
_positionBox: function HSA__positionBox(aBox, aPosition) { _positionBox: function (aBox, aPosition) {
aBox.style.transform = "translateX(" + this._boxWidth * aPosition + "px)"; aBox.style.transform = "translateX(" + this._boxWidth * aPosition + "px)";
}, },
/** /**
* Takes a snapshot of the page the browser is currently on. * Takes a snapshot of the page the browser is currently on.
*/ */
_takeSnapshot: function HSA__takeSnapshot() { _takeSnapshot: function () {
if ((this._maxSnapshots < 1) || if ((this._maxSnapshots < 1) ||
(gBrowser.webNavigation.sessionHistory.index < 0)) (gBrowser.webNavigation.sessionHistory.index < 0))
return; return;
@ -899,7 +899,7 @@ var gHistorySwipeAnimation = {
* Retrieves the maximum number of snapshots that should be kept in memory. * 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. * 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"); return gPrefService.getIntPref("browser.snapshots.limit");
}, },
@ -912,7 +912,7 @@ var gHistorySwipeAnimation = {
* The snapshot to add to the list and compress. * The snapshot to add to the list and compress.
*/ */
_assignSnapshotToCurrentBrowser: _assignSnapshotToCurrentBrowser:
function HSA__assignSnapshotToCurrentBrowser(aCanvas) { function (aCanvas) {
let browser = gBrowser.selectedBrowser; let browser = gBrowser.selectedBrowser;
let currIndex = browser.webNavigation.sessionHistory.index; let currIndex = browser.webNavigation.sessionHistory.index;
@ -946,7 +946,7 @@ var gHistorySwipeAnimation = {
* @param aBrowser * @param aBrowser
* The browser the new snapshot was taken in. * The browser the new snapshot was taken in.
*/ */
_removeTrackedSnapshot: function HSA__removeTrackedSnapshot(aIndex, aBrowser) { _removeTrackedSnapshot: function (aIndex, aBrowser) {
let arr = this._trackedSnapshots; let arr = this._trackedSnapshots;
let requiresExactIndexMatch = aIndex >= 0; let requiresExactIndexMatch = aIndex >= 0;
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
@ -972,7 +972,7 @@ var gHistorySwipeAnimation = {
* The browser the new snapshot was taken in. * The browser the new snapshot was taken in.
*/ */
_addSnapshotRefToArray: _addSnapshotRefToArray:
function HSA__addSnapshotRefToArray(aIndex, aBrowser) { function (aIndex, aBrowser) {
let id = { index: aIndex, let id = { index: aIndex,
browser: aBrowser }; browser: aBrowser };
let arr = this._trackedSnapshots; let arr = this._trackedSnapshots;
@ -995,7 +995,7 @@ var gHistorySwipeAnimation = {
* couldn't complete before this method was called. * couldn't complete before this method was called.
* @return A new Image object representing the converted blob. * @return A new Image object representing the converted blob.
*/ */
_convertToImg: function HSA__convertToImg(aBlob) { _convertToImg: function (aBlob) {
if (!aBlob) if (!aBlob)
return null; return null;
@ -1022,7 +1022,7 @@ var gHistorySwipeAnimation = {
* the previously stored snapshot for this index (if any) will be used. * the previously stored snapshot for this index (if any) will be used.
*/ */
_installCurrentPageSnapshot: _installCurrentPageSnapshot:
function HSA__installCurrentPageSnapshot(aCanvas) { function (aCanvas) {
let currSnapshot = aCanvas; let currSnapshot = aCanvas;
if (!currSnapshot) { if (!currSnapshot) {
let snapshots = gBrowser.selectedBrowser.snapshots || {}; let snapshots = gBrowser.selectedBrowser.snapshots || {};
@ -1039,7 +1039,7 @@ var gHistorySwipeAnimation = {
* previously stored for their respective indeces. * previously stored for their respective indeces.
*/ */
_installPrevAndNextSnapshots: _installPrevAndNextSnapshots:
function HSA__installPrevAndNextSnapshots() { function () {
let snapshots = gBrowser.selectedBrowser.snapshots || []; let snapshots = gBrowser.selectedBrowser.snapshots || [];
let currIndex = this._historyIndex; let currIndex = this._historyIndex;
let prevIndex = currIndex - 1; let prevIndex = currIndex - 1;

View file

@ -33,7 +33,7 @@ var StarUI = {
["cmd_close", "cmd_closeWindow"].map(function (id) this._element(id), this); ["cmd_close", "cmd_closeWindow"].map(function (id) this._element(id), this);
}, },
_blockCommands: function SU__blockCommands() { _blockCommands: function () {
this._blockedCommands.forEach(function (elt) { this._blockedCommands.forEach(function (elt) {
// make sure not to permanently disable this item (see bug 409155) // make sure not to permanently disable this item (see bug 409155)
if (elt.hasAttribute("wasDisabled")) if (elt.hasAttribute("wasDisabled"))
@ -47,7 +47,7 @@ var StarUI = {
}); });
}, },
_restoreCommandsState: function SU__restoreCommandsState() { _restoreCommandsState: function () {
this._blockedCommands.forEach(function (elt) { this._blockedCommands.forEach(function (elt) {
if (elt.getAttribute("wasDisabled") != "true") if (elt.getAttribute("wasDisabled") != "true")
elt.removeAttribute("disabled"); elt.removeAttribute("disabled");
@ -56,7 +56,7 @@ var StarUI = {
}, },
// nsIDOMEventListener // nsIDOMEventListener
handleEvent: function SU_handleEvent(aEvent) { handleEvent: function (aEvent) {
switch (aEvent.type) { switch (aEvent.type) {
case "popuphidden": case "popuphidden":
if (aEvent.originalTarget == this.panel) { if (aEvent.originalTarget == this.panel) {
@ -119,7 +119,7 @@ var StarUI = {
_overlayLoaded: false, _overlayLoaded: false,
_overlayLoading: false, _overlayLoading: false,
showEditBookmarkPopup: showEditBookmarkPopup:
function SU_showEditBookmarkPopup(aItemId, aAnchorElement, aPosition) { function (aItemId, aAnchorElement, aPosition) {
// Performance: load the overlay the first time the panel is opened // Performance: load the overlay the first time the panel is opened
// (see bug 392443). // (see bug 392443).
if (this._overlayLoading) if (this._overlayLoading)
@ -152,7 +152,7 @@ var StarUI = {
}, },
_doShowEditBookmarkPanel: _doShowEditBookmarkPanel:
function SU__doShowEditBookmarkPanel(aItemId, aAnchorElement, aPosition) { function (aItemId, aAnchorElement, aPosition) {
if (this.panel.state != "closed") if (this.panel.state != "closed")
return; return;
@ -210,7 +210,7 @@ var StarUI = {
}, },
panelShown: panelShown:
function SU_panelShown(aEvent) { function (aEvent) {
if (aEvent.target == this.panel) { if (aEvent.target == this.panel) {
if (!this._element("editBookmarkPanelContent").hidden) { if (!this._element("editBookmarkPanelContent").hidden) {
let fieldToFocus = "editBMPanel_" + let fieldToFocus = "editBMPanel_" +
@ -227,24 +227,24 @@ var StarUI = {
} }
}, },
quitEditMode: function SU_quitEditMode() { quitEditMode: function () {
this._element("editBookmarkPanelContent").hidden = true; this._element("editBookmarkPanelContent").hidden = true;
this._element("editBookmarkPanelBottomButtons").hidden = true; this._element("editBookmarkPanelBottomButtons").hidden = true;
gEditItemOverlay.uninitPanel(true); gEditItemOverlay.uninitPanel(true);
}, },
cancelButtonOnCommand: function SU_cancelButtonOnCommand() { cancelButtonOnCommand: function () {
this._actionOnHide = "cancel"; this._actionOnHide = "cancel";
this.panel.hidePopup(); this.panel.hidePopup();
}, },
removeBookmarkButtonCommand: function SU_removeBookmarkButtonCommand() { removeBookmarkButtonCommand: function () {
this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId); this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
this._actionOnHide = "remove"; this._actionOnHide = "remove";
this.panel.hidePopup(); this.panel.hidePopup();
}, },
beginBatch: function SU_beginBatch() { beginBatch: function () {
if (!this._batching) { if (!this._batching) {
PlacesUtils.transactionManager.beginBatch(null); PlacesUtils.transactionManager.beginBatch(null);
this._batching = true; this._batching = true;
@ -267,7 +267,7 @@ var PlacesCommandHook = {
* @param [optional] aShowEditUI * @param [optional] aShowEditUI
* whether or not to show the edit-bookmark UI for the bookmark item * whether or not to show the edit-bookmark UI for the bookmark item
*/ */
bookmarkPage: function PCH_bookmarkPage(aBrowser, aParent, aShowEditUI) { bookmarkPage: function (aBrowser, aParent, aShowEditUI) {
var uri = aBrowser.currentURI; var uri = aBrowser.currentURI;
var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri);
if (itemId == -1) { if (itemId == -1) {
@ -343,7 +343,7 @@ var PlacesCommandHook = {
/** /**
* Adds a bookmark to the page loaded in the current tab. * 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); this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI);
}, },
@ -357,7 +357,7 @@ var PlacesCommandHook = {
* @param aTitle * @param aTitle
* The link text * The link text
*/ */
bookmarkLink: function PCH_bookmarkLink(aParent, aURL, aTitle) { bookmarkLink: function (aParent, aURL, aTitle) {
var linkURI = makeURI(aURL); var linkURI = makeURI(aURL);
var itemId = PlacesUtils.getMostRecentBookmarkForURI(linkURI); var itemId = PlacesUtils.getMostRecentBookmarkForURI(linkURI);
if (itemId == -1) { if (itemId == -1) {
@ -401,7 +401,7 @@ var PlacesCommandHook = {
* Adds a folder with bookmarks to all of the currently open tabs in this * Adds a folder with bookmarks to all of the currently open tabs in this
* window. * window.
*/ */
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() { bookmarkCurrentPages: function () {
let pages = this.uniqueCurrentPages; let pages = this.uniqueCurrentPages;
if (pages.length > 1) { if (pages.length > 1) {
PlacesUIUtils.showBookmarkDialog({ action: "add" PlacesUIUtils.showBookmarkDialog({ action: "add"
@ -416,7 +416,7 @@ var PlacesCommandHook = {
* Updates disabled state for the "Bookmark All Tabs" command. * Updates disabled state for the "Bookmark All Tabs" command.
*/ */
updateBookmarkAllTabsCommand: updateBookmarkAllTabsCommand:
function PCH_updateBookmarkAllTabsCommand() { function () {
// There's nothing to do in non-browser windows. // There's nothing to do in non-browser windows.
if (window.location.href != getBrowserURL()) if (window.location.href != getBrowserURL())
return; return;
@ -436,7 +436,7 @@ var PlacesCommandHook = {
* @subtitle subtitle * @subtitle subtitle
* A short description of the feed. Optional. * A short description of the feed. Optional.
*/ */
addLiveBookmark: function PCH_addLiveBookmark(url, feedTitle, feedSubtitle) { addLiveBookmark: function (url, feedTitle, feedSubtitle) {
let toolbarIP = new InsertionPoint(PlacesUtils.toolbarFolderId, -1); let toolbarIP = new InsertionPoint(PlacesUtils.toolbarFolderId, -1);
let feedURI = makeURI(url); let feedURI = makeURI(url);
@ -466,7 +466,7 @@ var PlacesCommandHook = {
* are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar, * are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar,
* UnfiledBookmarks, Tags and Downloads. * UnfiledBookmarks, Tags and Downloads.
*/ */
showPlacesOrganizer: function PCH_showPlacesOrganizer(aLeftPaneRoot) { showPlacesOrganizer: function (aLeftPaneRoot) {
var organizer = Services.wm.getMostRecentWindow("Places:Organizer"); var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
// Due to bug 528706, getMostRecentWindow can return closed windows. // Due to bug 528706, getMostRecentWindow can return closed windows.
if (!organizer || organizer.closed) { if (!organizer || organizer.closed) {
@ -499,7 +499,7 @@ function HistoryMenu(aPopupShowingEvent) {
} }
HistoryMenu.prototype = { HistoryMenu.prototype = {
toggleRestoreLastSession: function HM_toggleRestoreLastSession() { toggleRestoreLastSession: function () {
let restoreItem = this._rootElt.ownerDocument.getElementById("Browser:RestoreLastSession"); let restoreItem = this._rootElt.ownerDocument.getElementById("Browser:RestoreLastSession");
if (this._ss.canRestoreLastSession && if (this._ss.canRestoreLastSession &&
@ -509,7 +509,7 @@ HistoryMenu.prototype = {
restoreItem.setAttribute("disabled", true); restoreItem.setAttribute("disabled", true);
}, },
toggleRecentlyClosedTabs: function HM_toggleRecentlyClosedTabs() { toggleRecentlyClosedTabs: function () {
// enable/disable the Recently Closed Tabs sub menu // enable/disable the Recently Closed Tabs sub menu
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0]; var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
@ -526,7 +526,7 @@ HistoryMenu.prototype = {
* @param aEvent * @param aEvent
* The event when the user clicks the menu item * The event when the user clicks the menu item
*/ */
_undoCloseMiddleClick: function PHM__undoCloseMiddleClick(aEvent) { _undoCloseMiddleClick: function (aEvent) {
if (aEvent.button != 1) if (aEvent.button != 1)
return; return;
@ -537,7 +537,7 @@ HistoryMenu.prototype = {
/** /**
* Populate when the history menu is opened * Populate when the history menu is opened
*/ */
populateUndoSubmenu: function PHM_populateUndoSubmenu() { populateUndoSubmenu: function () {
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0]; var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
var undoPopup = undoMenu.firstChild; var undoPopup = undoMenu.firstChild;
@ -596,7 +596,7 @@ HistoryMenu.prototype = {
}, false); }, false);
}, },
toggleRecentlyClosedWindows: function PHM_toggleRecentlyClosedWindows() { toggleRecentlyClosedWindows: function () {
// enable/disable the Recently Closed Windows sub menu // enable/disable the Recently Closed Windows sub menu
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0]; var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
@ -610,7 +610,7 @@ HistoryMenu.prototype = {
/** /**
* Populate when the history menu is opened * Populate when the history menu is opened
*/ */
populateUndoWindowSubmenu: function PHM_populateUndoWindowSubmenu() { populateUndoWindowSubmenu: function () {
let undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0]; let undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
let undoPopup = undoMenu.firstChild; let undoPopup = undoMenu.firstChild;
let menuLabelString = gNavigatorBundle.getString("menuUndoCloseWindowLabel"); let menuLabelString = gNavigatorBundle.getString("menuUndoCloseWindowLabel");
@ -672,7 +672,7 @@ HistoryMenu.prototype = {
"for (var i = 0; i < " + undoItems.length + "; i++) undoCloseWindow();"); "for (var i = 0; i < " + undoItems.length + "; i++) undoCloseWindow();");
}, },
toggleTabsFromOtherComputers: function PHM_toggleTabsFromOtherComputers() { toggleTabsFromOtherComputers: function () {
// This is a no-op if MOZ_SERVICES_SYNC isn't defined // This is a no-op if MOZ_SERVICES_SYNC isn't defined
#ifdef MOZ_SERVICES_SYNC #ifdef MOZ_SERVICES_SYNC
// Enable/disable the Tabs From Other Computers menu. Some of the menus handled // Enable/disable the Tabs From Other Computers menu. Some of the menus handled
@ -698,7 +698,7 @@ HistoryMenu.prototype = {
#endif #endif
}, },
_onPopupShowing: function HM__onPopupShowing(aEvent) { _onPopupShowing: function (aEvent) {
PlacesMenu.prototype._onPopupShowing.apply(this, arguments); PlacesMenu.prototype._onPopupShowing.apply(this, arguments);
// Don't handle events for submenus. // Don't handle events for submenus.
@ -711,7 +711,7 @@ HistoryMenu.prototype = {
this.toggleTabsFromOtherComputers(); this.toggleTabsFromOtherComputers();
}, },
_onCommand: function HM__onCommand(aEvent) { _onCommand: function (aEvent) {
let placesNode = aEvent.target._placesNode; let placesNode = aEvent.target._placesNode;
if (placesNode) { if (placesNode) {
if (!PrivateBrowsingUtils.isWindowPrivate(window)) if (!PrivateBrowsingUtils.isWindowPrivate(window))
@ -739,7 +739,7 @@ var BookmarksEventHandler = {
* @param aView * @param aView
* The places view which aEvent should be associated with. * 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. // Only handle middle-click or left-click with modifiers.
#ifdef XP_MACOSX #ifdef XP_MACOSX
var modifKey = aEvent.metaKey || aEvent.shiftKey; var modifKey = aEvent.metaKey || aEvent.shiftKey;
@ -786,13 +786,13 @@ var BookmarksEventHandler = {
* @param aView * @param aView
* The places view which aEvent should be associated with. * The places view which aEvent should be associated with.
*/ */
onCommand: function BEH_onCommand(aEvent, aView) { onCommand: function (aEvent, aView) {
var target = aEvent.originalTarget; var target = aEvent.originalTarget;
if (target._placesNode) if (target._placesNode)
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView); PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
}, },
fillInBHTooltip: function BEH_fillInBHTooltip(aDocument, aEvent) { fillInBHTooltip: function (aDocument, aEvent) {
var node; var node;
var cropped = false; var cropped = false;
var targetURI; var targetURI;
@ -863,7 +863,7 @@ var PlacesMenuDNDHandler = {
* @param event * @param event
* The DragEnter event that spawned the opening. * 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. // Opening menus in a Places popup is handled by the view itself.
if (!this._isStaticContainer(event.target)) if (!this._isStaticContainer(event.target))
return; return;
@ -887,7 +887,7 @@ var PlacesMenuDNDHandler = {
* @returns true if the element is a container element (menu or * @returns true if the element is a container element (menu or
* menu-toolbarbutton), false otherwise. * menu-toolbarbutton), false otherwise.
*/ */
onDragLeave: function PMDH_onDragLeave(event) { onDragLeave: function (event) {
// Handle menu-button separate targets. // Handle menu-button separate targets.
if (event.relatedTarget === event.currentTarget || if (event.relatedTarget === event.currentTarget ||
event.relatedTarget.parentNode === event.currentTarget) event.relatedTarget.parentNode === event.currentTarget)
@ -924,7 +924,7 @@ var PlacesMenuDNDHandler = {
* @returns true if the element is a container element (menu or * @returns true if the element is a container element (menu or
*` menu-toolbarbutton), false otherwise. *` menu-toolbarbutton), false otherwise.
*/ */
_isStaticContainer: function PMDH__isContainer(node) { _isStaticContainer: function (node) {
let isMenu = node.localName == "menu" || let isMenu = node.localName == "menu" ||
(node.localName == "toolbarbutton" && (node.localName == "toolbarbutton" &&
(node.getAttribute("type") == "menu" || (node.getAttribute("type") == "menu" ||
@ -940,7 +940,7 @@ var PlacesMenuDNDHandler = {
* @param event * @param event
* The DragOver event. * The DragOver event.
*/ */
onDragOver: function PMDH_onDragOver(event) { onDragOver: function (event) {
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId, let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX, PlacesUtils.bookmarks.DEFAULT_INDEX,
Ci.nsITreeView.DROP_ON); Ci.nsITreeView.DROP_ON);
@ -955,7 +955,7 @@ var PlacesMenuDNDHandler = {
* @param event * @param event
* The Drop event. * The Drop event.
*/ */
onDrop: function PMDH_onDrop(event) { onDrop: function (event) {
// Put the item at the end of bookmark menu. // Put the item at the end of bookmark menu.
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId, let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX, PlacesUtils.bookmarks.DEFAULT_INDEX,
@ -979,7 +979,7 @@ var PlacesToolbarHelper = {
return document.getElementById("PlacesToolbar"); return document.getElementById("PlacesToolbar");
}, },
init: function PTH_init() { init: function () {
let viewElt = this._viewElt; let viewElt = this._viewElt;
if (!viewElt || viewElt._placesView) if (!viewElt || viewElt._placesView)
return; return;
@ -997,7 +997,7 @@ var PlacesToolbarHelper = {
new PlacesToolbar(this._place); new PlacesToolbar(this._place);
}, },
customizeStart: function PTH_customizeStart() { customizeStart: function () {
let viewElt = this._viewElt; let viewElt = this._viewElt;
if (viewElt && viewElt._placesView) if (viewElt && viewElt._placesView)
viewElt._placesView.uninit(); viewElt._placesView.uninit();
@ -1005,7 +1005,7 @@ var PlacesToolbarHelper = {
this._isCustomizing = true; this._isCustomizing = true;
}, },
customizeDone: function PTH_customizeDone() { customizeDone: function () {
this._isCustomizing = false; this._isCustomizing = false;
this.init(); this.init();
} }
@ -1074,11 +1074,11 @@ var BookmarkingUI = {
* reasons. * reasons.
*/ */
_popupNeedsUpdate: true, _popupNeedsUpdate: true,
onToolbarVisibilityChange: function BUI_onToolbarVisibilityChange() { onToolbarVisibilityChange: function () {
this._popupNeedsUpdate = true; this._popupNeedsUpdate = true;
}, },
onPopupShowing: function BUI_onPopupShowing(event) { onPopupShowing: function (event) {
// Don't handle events for submenus. // Don't handle events for submenus.
if (event.target != event.currentTarget) if (event.target != event.currentTarget)
return; return;
@ -1112,7 +1112,7 @@ var BookmarkingUI = {
/** /**
* Handles star styling based on page proxy state changes. * Handles star styling based on page proxy state changes.
*/ */
onPageProxyStateChanged: function BUI_onPageProxyStateChanged(aState) { onPageProxyStateChanged: function (aState) {
if (!this.star) { if (!this.star) {
return; return;
} }
@ -1126,7 +1126,7 @@ var BookmarkingUI = {
} }
}, },
_updateToolbarStyle: function BUI__updateToolbarStyle() { _updateToolbarStyle: function () {
if (!this.button) { if (!this.button) {
return; return;
} }
@ -1145,7 +1145,7 @@ var BookmarkingUI = {
} }
}, },
_uninitView: function BUI__uninitView() { _uninitView: function () {
// When an element with a placesView attached is removed and re-inserted, // When an element with a placesView attached is removed and re-inserted,
// XBL reapplies the binding causing any kind of issues and possible leaks, // XBL reapplies the binding causing any kind of issues and possible leaks,
// so kill current view and let popupshowing generate a new one. // so kill current view and let popupshowing generate a new one.
@ -1160,22 +1160,22 @@ var BookmarkingUI = {
} }
}, },
customizeStart: function BUI_customizeStart() { customizeStart: function () {
this._uninitView(); this._uninitView();
}, },
customizeChange: function BUI_customizeChange() { customizeChange: function () {
this._updateToolbarStyle(); this._updateToolbarStyle();
}, },
customizeDone: function BUI_customizeDone() { customizeDone: function () {
delete this._button; delete this._button;
this.onToolbarVisibilityChange(); this.onToolbarVisibilityChange();
this._updateToolbarStyle(); this._updateToolbarStyle();
}, },
_hasBookmarksObserver: false, _hasBookmarksObserver: false,
uninit: function BUI_uninit() { uninit: function () {
this._uninitView(); this._uninitView();
if (this._hasBookmarksObserver) { if (this._hasBookmarksObserver) {
@ -1188,14 +1188,14 @@ var BookmarkingUI = {
} }
}, },
onLocationChange: function BUI_onLocationChange() { onLocationChange: function () {
if (this._uri && gBrowser.currentURI.equals(this._uri)) { if (this._uri && gBrowser.currentURI.equals(this._uri)) {
return; return;
} }
this.updateStarState(); this.updateStarState();
}, },
updateStarState: function BUI_updateStarState() { updateStarState: function () {
// Reset tracked values. // Reset tracked values.
this._uri = gBrowser.currentURI; this._uri = gBrowser.currentURI;
this._itemIds = []; this._itemIds = [];
@ -1240,7 +1240,7 @@ var BookmarkingUI = {
}, this); }, this);
}, },
_updateStar: function BUI__updateStar() { _updateStar: function () {
if (!this.star) { if (!this.star) {
return; return;
} }
@ -1255,7 +1255,7 @@ var BookmarkingUI = {
} }
}, },
onCommand: function BUI_onCommand(aEvent) { onCommand: function (aEvent) {
if (aEvent.target != aEvent.currentTarget) { if (aEvent.target != aEvent.currentTarget) {
return; return;
} }
@ -1266,7 +1266,7 @@ var BookmarkingUI = {
}, },
// nsINavBookmarkObserver // nsINavBookmarkObserver
onItemAdded: function BUI_onItemAdded(aItemId, aParentId, aIndex, aItemType, onItemAdded: function (aItemId, aParentId, aIndex, aItemType,
aURI) { aURI) {
if (aURI && aURI.equals(this._uri)) { if (aURI && aURI.equals(this._uri)) {
// If a new bookmark has been added to the tracked uri, register it. // If a new bookmark has been added to the tracked uri, register it.
@ -1277,7 +1277,7 @@ var BookmarkingUI = {
} }
}, },
onItemRemoved: function BUI_onItemRemoved(aItemId) { onItemRemoved: function (aItemId) {
let index = this._itemIds.indexOf(aItemId); let index = this._itemIds.indexOf(aItemId);
// If one of the tracked bookmarks has been removed, unregister it. // If one of the tracked bookmarks has been removed, unregister it.
if (index != -1) { if (index != -1) {
@ -1286,7 +1286,7 @@ var BookmarkingUI = {
} }
}, },
onItemChanged: function BUI_onItemChanged(aItemId, aProperty, onItemChanged: function (aItemId, aProperty,
aIsAnnotationProperty, aNewValue) { aIsAnnotationProperty, aNewValue) {
if (aProperty == "uri") { if (aProperty == "uri") {
let index = this._itemIds.indexOf(aItemId); let index = this._itemIds.indexOf(aItemId);

View file

@ -269,12 +269,12 @@ var gPluginHandler = {
} }
}, },
isKnownPlugin: function PH_isKnownPlugin(objLoadingContent) { isKnownPlugin: function (objLoadingContent) {
return (objLoadingContent.getContentTypeForMIMEType(objLoadingContent.actualType) == return (objLoadingContent.getContentTypeForMIMEType(objLoadingContent.actualType) ==
Ci.nsIObjectLoadingContent.TYPE_PLUGIN); Ci.nsIObjectLoadingContent.TYPE_PLUGIN);
}, },
canActivatePlugin: function PH_canActivatePlugin(objLoadingContent) { canActivatePlugin: function (objLoadingContent) {
// if this isn't a known plugin, we can't activate it // if this isn't a known plugin, we can't activate it
// (this also guards pluginHost.getPermissionStringForType against // (this also guards pluginHost.getPermissionStringForType against
// unexpected input) // unexpected input)
@ -307,7 +307,7 @@ var gPluginHandler = {
overlay.style.visibility = "hidden"; overlay.style.visibility = "hidden";
}, },
stopPlayPreview: function PH_stopPlayPreview(aPlugin, aPlayPlugin) { stopPlayPreview: function (aPlugin, aPlayPlugin) {
let objLoadingContent = aPlugin.QueryInterface(Ci.nsIObjectLoadingContent); let objLoadingContent = aPlugin.QueryInterface(Ci.nsIObjectLoadingContent);
if (objLoadingContent.activated) if (objLoadingContent.activated)
return; return;
@ -340,7 +340,7 @@ var gPluginHandler = {
}, },
// Event listener for click-to-play plugins. // Event listener for click-to-play plugins.
_handleClickToPlayEvent: function PH_handleClickToPlayEvent(aPlugin) { _handleClickToPlayEvent: function (aPlugin) {
let doc = aPlugin.ownerDocument; let doc = aPlugin.ownerDocument;
let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document); let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
@ -372,7 +372,7 @@ var gPluginHandler = {
}, },
_overlayClickListener: { _overlayClickListener: {
handleEvent: function PH_handleOverlayClick(aEvent) { handleEvent: function (aEvent) {
let plugin = document.getBindingParent(aEvent.target); let plugin = document.getBindingParent(aEvent.target);
let contentWindow = plugin.ownerDocument.defaultView.top; let contentWindow = plugin.ownerDocument.defaultView.top;
// gBrowser.getBrowserForDocument does not exist in the case where we // gBrowser.getBrowserForDocument does not exist in the case where we
@ -399,7 +399,7 @@ var gPluginHandler = {
} }
}, },
_handlePlayPreviewEvent: function PH_handlePlayPreviewEvent(aPlugin) { _handlePlayPreviewEvent: function (aPlugin) {
let doc = aPlugin.ownerDocument; let doc = aPlugin.ownerDocument;
let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document); let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
@ -441,7 +441,7 @@ var gPluginHandler = {
} }
}, },
reshowClickToPlayNotification: function PH_reshowClickToPlayNotification() { reshowClickToPlayNotification: function () {
let browser = gBrowser.selectedBrowser; let browser = gBrowser.selectedBrowser;
let contentWindow = browser.contentWindow; let contentWindow = browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
@ -459,7 +459,7 @@ var gPluginHandler = {
gPluginHandler._showClickToPlayNotification(browser); gPluginHandler._showClickToPlayNotification(browser);
}, },
_clickToPlayNotificationEventCallback: function PH_ctpEventCallback(event) { _clickToPlayNotificationEventCallback: function (event) {
if (event == "showing") { if (event == "showing") {
gPluginHandler._makeCenterActions(this); gPluginHandler._makeCenterActions(this);
} }
@ -470,7 +470,7 @@ var gPluginHandler = {
} }
}, },
_makeCenterActions: function PH_makeCenterActions(notification) { _makeCenterActions: function (notification) {
let contentWindow = notification.browser.contentWindow; let contentWindow = notification.browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils); .getInterface(Ci.nsIDOMWindowUtils);
@ -533,7 +533,7 @@ var gPluginHandler = {
* and activate plugins if necessary. * and activate plugins if necessary.
* aNewState should be either "allownow" "allowalways" or "block" * aNewState should be either "allownow" "allowalways" or "block"
*/ */
_updatePluginPermission: function PH_setPermissionForPlugins(aNotification, aPluginInfo, aNewState) { _updatePluginPermission: function (aNotification, aPluginInfo, aNewState) {
let permission; let permission;
let expireType; let expireType;
let expireTime; let expireTime;
@ -598,7 +598,7 @@ var gPluginHandler = {
} }
}, },
_showClickToPlayNotification: function PH_showClickToPlayNotification(aBrowser, aPrimaryPlugin) { _showClickToPlayNotification: function (aBrowser, aPrimaryPlugin) {
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser); let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
let contentWindow = aBrowser.contentWindow; let contentWindow = aBrowser.contentWindow;

View file

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

View file

@ -22,7 +22,7 @@ var tabPreviews = {
return this.height = Math.round(this.width * this.aspectRatio); return this.height = Math.round(this.width * this.aspectRatio);
}, },
init: function tabPreviews_init() { init: function () {
if (this._selectedTab) if (this._selectedTab)
return; return;
this._selectedTab = gBrowser.selectedTab; this._selectedTab = gBrowser.selectedTab;
@ -31,7 +31,7 @@ var tabPreviews = {
gBrowser.tabContainer.addEventListener("SSTabRestored", this, false); gBrowser.tabContainer.addEventListener("SSTabRestored", this, false);
}, },
get: function tabPreviews_get(aTab) { get: function (aTab) {
let uri = aTab.linkedBrowser.currentURI.spec; let uri = aTab.linkedBrowser.currentURI.spec;
if (aTab.__thumbnail_lastURI && if (aTab.__thumbnail_lastURI &&
@ -52,7 +52,7 @@ var tabPreviews = {
return this.capture(aTab, !aTab.hasAttribute("busy")); return this.capture(aTab, !aTab.hasAttribute("busy"));
}, },
capture: function tabPreviews_capture(aTab, aStore) { capture: function (aTab, aStore) {
var thumbnail = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); var thumbnail = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
thumbnail.mozOpaque = true; thumbnail.mozOpaque = true;
thumbnail.height = this.height; thumbnail.height = this.height;
@ -75,7 +75,7 @@ var tabPreviews = {
return thumbnail; return thumbnail;
}, },
handleEvent: function tabPreviews_handleEvent(event) { handleEvent: function (event) {
switch (event.type) { switch (event.type) {
case "TabSelect": case "TabSelect":
if (this._selectedTab && if (this._selectedTab &&
@ -228,7 +228,7 @@ var ctrlTab = {
return this._tabList = list; return this._tabList = list;
}, },
init: function ctrlTab_init() { init: function () {
if (!this._recentlyUsedTabs) { if (!this._recentlyUsedTabs) {
tabPreviews.init(); tabPreviews.init();
@ -237,13 +237,13 @@ var ctrlTab = {
} }
}, },
uninit: function ctrlTab_uninit() { uninit: function () {
this._recentlyUsedTabs = null; this._recentlyUsedTabs = null;
this._init(false); this._init(false);
}, },
prefName: "browser.ctrlTab.previews", prefName: "browser.ctrlTab.previews",
readPref: function ctrlTab_readPref() { readPref: function () {
var enable = var enable =
gPrefService.getBoolPref(this.prefName) && gPrefService.getBoolPref(this.prefName) &&
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") || (!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
@ -258,7 +258,7 @@ var ctrlTab = {
this.readPref(); this.readPref();
}, },
updatePreviews: function ctrlTab_updatePreviews() { updatePreviews: function () {
for (let i = 0; i < this.previews.length; i++) for (let i = 0; i < this.previews.length; i++)
this.updatePreview(this.previews[i], this.tabList[i]); this.updatePreview(this.previews[i], this.tabList[i]);
@ -267,7 +267,7 @@ var ctrlTab = {
PluralForm.get(this.tabCount, showAllLabel).replace("#1", this.tabCount); PluralForm.get(this.tabCount, showAllLabel).replace("#1", this.tabCount);
}, },
updatePreview: function ctrlTab_updatePreview(aPreview, aTab) { updatePreview: function (aPreview, aTab) {
if (aPreview == this.showAllButton) if (aPreview == this.showAllButton)
return; return;
@ -301,7 +301,7 @@ var ctrlTab = {
} }
}, },
advanceFocus: function ctrlTab_advanceFocus(aForward) { advanceFocus: function (aForward) {
let selectedIndex = Array.indexOf(this.previews, this.selected); let selectedIndex = Array.indexOf(this.previews, this.selected);
do { do {
selectedIndex += aForward ? 1 : -1; selectedIndex += aForward ? 1 : -1;
@ -325,12 +325,12 @@ var ctrlTab = {
} }
}, },
_mouseOverFocus: function ctrlTab_mouseOverFocus(aPreview) { _mouseOverFocus: function (aPreview) {
if (this._trackMouseOver) if (this._trackMouseOver)
aPreview.focus(); aPreview.focus();
}, },
pick: function ctrlTab_pick(aPreview) { pick: function (aPreview) {
if (!this.tabCount) if (!this.tabCount)
return; return;
@ -342,17 +342,17 @@ var ctrlTab = {
this.close(select._tab); this.close(select._tab);
}, },
showAllTabs: function ctrlTab_showAllTabs(aPreview) { showAllTabs: function (aPreview) {
this.close(); this.close();
document.getElementById("Browser:ShowAllTabs").doCommand(); document.getElementById("Browser:ShowAllTabs").doCommand();
}, },
remove: function ctrlTab_remove(aPreview) { remove: function (aPreview) {
if (aPreview._tab) if (aPreview._tab)
gBrowser.removeTab(aPreview._tab); gBrowser.removeTab(aPreview._tab);
}, },
attachTab: function ctrlTab_attachTab(aTab, aPos) { attachTab: function (aTab, aPos) {
if (aPos == 0) if (aPos == 0)
this._recentlyUsedTabs.unshift(aTab); this._recentlyUsedTabs.unshift(aTab);
else if (aPos) else if (aPos)
@ -360,13 +360,13 @@ var ctrlTab = {
else else
this._recentlyUsedTabs.push(aTab); this._recentlyUsedTabs.push(aTab);
}, },
detachTab: function ctrlTab_detachTab(aTab) { detachTab: function (aTab) {
var i = this._recentlyUsedTabs.indexOf(aTab); var i = this._recentlyUsedTabs.indexOf(aTab);
if (i >= 0) if (i >= 0)
this._recentlyUsedTabs.splice(i, 1); this._recentlyUsedTabs.splice(i, 1);
}, },
open: function ctrlTab_open() { open: function () {
if (this.isOpen) if (this.isOpen)
return; return;
@ -385,7 +385,7 @@ var ctrlTab = {
}, 200, this); }, 200, this);
}, },
_openPanel: function ctrlTab_openPanel() { _openPanel: function () {
tabPreviewPanelHelper.opening(this); tabPreviewPanelHelper.opening(this);
this.panel.width = Math.min(screen.availWidth * .99, this.panel.width = Math.min(screen.availWidth * .99,
@ -396,7 +396,7 @@ var ctrlTab = {
false); false);
}, },
close: function ctrlTab_close(aTabToSelect) { close: function (aTabToSelect) {
if (!this.isOpen) if (!this.isOpen)
return; return;
@ -413,7 +413,7 @@ var ctrlTab = {
this.panel.hidePopup(); this.panel.hidePopup();
}, },
setupGUI: function ctrlTab_setupGUI() { setupGUI: function () {
this.selected.focus(); this.selected.focus();
this._selectedIndex = -1; this._selectedIndex = -1;
@ -426,7 +426,7 @@ var ctrlTab = {
}, 0, this); }, 0, this);
}, },
suspendGUI: function ctrlTab_suspendGUI() { suspendGUI: function () {
document.removeEventListener("keyup", this, true); document.removeEventListener("keyup", this, true);
Array.forEach(this.previews, function (preview) { Array.forEach(this.previews, function (preview) {
@ -436,7 +436,7 @@ var ctrlTab = {
this._tabList = null; this._tabList = null;
}, },
onKeyPress: function ctrlTab_onKeyPress(event) { onKeyPress: function (event) {
var isOpen = this.isOpen; var isOpen = this.isOpen;
if (isOpen) { if (isOpen) {
@ -481,7 +481,7 @@ var ctrlTab = {
} }
}, },
removeClosingTabFromUI: function ctrlTab_removeClosingTabFromUI(aTab) { removeClosingTabFromUI: function (aTab) {
if (this.tabCount == 2) { if (this.tabCount == 2) {
this.close(); this.close();
return; return;
@ -503,7 +503,7 @@ var ctrlTab = {
} }
}, },
handleEvent: function ctrlTab_handleEvent(event) { handleEvent: function (event) {
switch (event.type) { switch (event.type) {
case "TabAttrModified": case "TabAttrModified":
// tab attribute modified (e.g. label, crop, busy, image, selected) // tab attribute modified (e.g. label, crop, busy, image, selected)
@ -536,7 +536,7 @@ var ctrlTab = {
} }
}, },
_init: function ctrlTab__init(enable) { _init: function (enable) {
var toggleEventListener = enable ? "addEventListener" : "removeEventListener"; var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
var tabContainer = gBrowser.tabContainer; var tabContainer = gBrowser.tabContainer;
@ -587,7 +587,7 @@ var allTabs = {
get previews () this.container.getElementsByClassName("allTabs-preview"), get previews () this.container.getElementsByClassName("allTabs-preview"),
get isOpen () this.panel.state == "open" || this.panel.state == "showing", get isOpen () this.panel.state == "open" || this.panel.state == "showing",
init: function allTabs_init() { init: function () {
if (this._initiated) if (this._initiated)
return; return;
this._initiated = true; this._initiated = true;
@ -604,7 +604,7 @@ var allTabs = {
gBrowser.tabContainer.addEventListener("TabClose", this, false); gBrowser.tabContainer.addEventListener("TabClose", this, false);
}, },
uninit: function allTabs_uninit() { uninit: function () {
if (!this._initiated) if (!this._initiated)
return; return;
@ -620,7 +620,7 @@ var allTabs = {
}, },
prefName: "browser.allTabs.previews", prefName: "browser.allTabs.previews",
readPref: function allTabs_readPref() { readPref: function () {
var allTabsButton = this.toolbarButton; var allTabsButton = this.toolbarButton;
if (!allTabsButton) if (!allTabsButton)
return; return;
@ -638,7 +638,7 @@ var allTabs = {
this.readPref(); this.readPref();
}, },
pick: function allTabs_pick(aPreview) { pick: function (aPreview) {
if (!aPreview) if (!aPreview)
aPreview = this._firstVisiblePreview; aPreview = this._firstVisiblePreview;
if (aPreview) if (aPreview)
@ -647,12 +647,12 @@ var allTabs = {
this.close(); this.close();
}, },
closeTab: function allTabs_closeTab(event) { closeTab: function (event) {
this.filterField.focus(); this.filterField.focus();
gBrowser.removeTab(event.currentTarget._targetPreview._tab); gBrowser.removeTab(event.currentTarget._targetPreview._tab);
}, },
filter: function allTabs_filter() { filter: function () {
if (this._currentFilter == this.filterField.value) if (this._currentFilter == this.filterField.value)
return; return;
@ -694,7 +694,7 @@ var allTabs = {
this._reflow(); this._reflow();
}, },
open: function allTabs_open() { open: function () {
var allTabsButton = this.toolbarButton; var allTabsButton = this.toolbarButton;
if (allTabsButton && if (allTabsButton &&
allTabsButton.getAttribute("type") == "menu") { allTabsButton.getAttribute("type") == "menu") {
@ -722,11 +722,11 @@ var allTabs = {
this.panel.openPopup(gBrowser, "overlap", 0, 0, false, true); this.panel.openPopup(gBrowser, "overlap", 0, 0, false, true);
}, },
close: function allTabs_close() { close: function () {
this.panel.hidePopup(); this.panel.hidePopup();
}, },
setupGUI: function allTabs_setupGUI() { setupGUI: function () {
this.filterField.focus(); this.filterField.focus();
this.filterField.placeholder = this.filterField.tooltipText; this.filterField.placeholder = this.filterField.tooltipText;
@ -739,7 +739,7 @@ var allTabs = {
document.getElementById("Browser:ShowAllTabs").setAttribute("disabled", "true"); document.getElementById("Browser:ShowAllTabs").setAttribute("disabled", "true");
}, },
suspendGUI: function allTabs_suspendGUI() { suspendGUI: function () {
this.filterField.placeholder = ""; this.filterField.placeholder = "";
this.filterField.value = ""; this.filterField.value = "";
this._currentFilter = null; this._currentFilter = null;
@ -755,7 +755,7 @@ var allTabs = {
}, 300); }, 300);
}, },
handleEvent: function allTabs_handleEvent(event) { handleEvent: function (event) {
if (event.type.startsWith("Tab")) { if (event.type.startsWith("Tab")) {
var tab = event.target; var tab = event.target;
if (event.type != "TabOpen") if (event.type != "TabOpen")
@ -828,7 +828,7 @@ var allTabs = {
return null; return null;
}, },
_reflow: function allTabs_reflow() { _reflow: function () {
this._updateTabCloseButton(); this._updateTabCloseButton();
const CONTAINER_MAX_WIDTH = this._maxPanelWidth * .95; const CONTAINER_MAX_WIDTH = this._maxPanelWidth * .95;
@ -887,14 +887,14 @@ var allTabs = {
this.container.maxHeight = rows * outerHeight; this.container.maxHeight = rows * outerHeight;
}, },
_addPreview: function allTabs_addPreview(aTab) { _addPreview: function (aTab) {
var preview = document.createElement("button"); var preview = document.createElement("button");
preview.className = "allTabs-preview"; preview.className = "allTabs-preview";
preview._tab = aTab; preview._tab = aTab;
this.container.lastChild.appendChild(preview); this.container.lastChild.appendChild(preview);
}, },
_removePreview: function allTabs_removePreview(aPreview) { _removePreview: function (aPreview) {
var updateUI = (this.isOpen && !aPreview.hidden); var updateUI = (this.isOpen && !aPreview.hidden);
aPreview._tab = null; aPreview._tab = null;
aPreview.parentNode.removeChild(aPreview); aPreview.parentNode.removeChild(aPreview);
@ -905,7 +905,7 @@ var allTabs = {
} }
}, },
_getPreview: function allTabs_getPreview(aTab) { _getPreview: function (aTab) {
var previews = this.previews; var previews = this.previews;
for (let i = 0; i < previews.length; i++) for (let i = 0; i < previews.length; i++)
if (previews[i]._tab == aTab) if (previews[i]._tab == aTab)
@ -913,7 +913,7 @@ var allTabs = {
return null; return null;
}, },
_updateTabCloseButton: function allTabs_updateTabCloseButton(event) { _updateTabCloseButton: function (event) {
if (event && event.target == this.tabCloseButton) if (event && event.target == this.tabCloseButton)
return; return;
@ -950,7 +950,7 @@ var allTabs = {
} }
}, },
_updatePreview: function allTabs_updatePreview(aPreview) { _updatePreview: function (aPreview) {
aPreview.setAttribute("label", aPreview._tab.label); aPreview.setAttribute("label", aPreview._tab.label);
aPreview.setAttribute("tooltiptext", aPreview._tab.label); aPreview.setAttribute("tooltiptext", aPreview._tab.label);
aPreview.setAttribute("crop", aPreview._tab.crop); aPreview.setAttribute("crop", aPreview._tab.crop);
@ -975,7 +975,7 @@ var allTabs = {
aPreview.appendChild(thumbnail); aPreview.appendChild(thumbnail);
}, },
_onKeyPress: function allTabs_onKeyPress(event) { _onKeyPress: function (event) {
if (event.eventPhase == event.CAPTURING_PHASE) { if (event.eventPhase == event.CAPTURING_PHASE) {
this._onCapturingKeyPress(event); this._onCapturingKeyPress(event);
return; return;
@ -1010,7 +1010,7 @@ var allTabs = {
} }
}, },
_onCapturingKeyPress: function allTabs_onCapturingKeyPress(event) { _onCapturingKeyPress: function (event) {
switch (event.keyCode) { switch (event.keyCode) {
case event.DOM_VK_UP: case event.DOM_VK_UP:
case event.DOM_VK_DOWN: case event.DOM_VK_DOWN:
@ -1028,7 +1028,7 @@ var allTabs = {
} }
}, },
_advanceFocusVertically: function allTabs_advanceFocusVertically(event) { _advanceFocusVertically: function (event) {
var preview = document.activeElement; var preview = document.activeElement;
if (!preview || preview.parentNode.parentNode != this.container) if (!preview || preview.parentNode.parentNode != this.container)
return; return;

View file

@ -30,7 +30,7 @@ var gBrowserThumbnails = {
*/ */
_tabEvents: ["TabClose", "TabSelect"], _tabEvents: ["TabClose", "TabSelect"],
init: function Thumbnails_init() { init: function () {
// Bug 863512 - Make page thumbnails work in electrolysis // Bug 863512 - Make page thumbnails work in electrolysis
if (gMultiProcessBrowser) if (gMultiProcessBrowser)
return; return;
@ -54,7 +54,7 @@ var gBrowserThumbnails = {
this._timeouts = new WeakMap(); this._timeouts = new WeakMap();
}, },
uninit: function Thumbnails_uninit() { uninit: function () {
// Bug 863512 - Make page thumbnails work in electrolysis // Bug 863512 - Make page thumbnails work in electrolysis
if (gMultiProcessBrowser) if (gMultiProcessBrowser)
return; return;
@ -68,7 +68,7 @@ var gBrowserThumbnails = {
}, this); }, this);
}, },
handleEvent: function Thumbnails_handleEvent(aEvent) { handleEvent: function (aEvent) {
switch (aEvent.type) { switch (aEvent.type) {
case "scroll": case "scroll":
let browser = aEvent.currentTarget; let browser = aEvent.currentTarget;
@ -85,13 +85,13 @@ var gBrowserThumbnails = {
} }
}, },
observe: function Thumbnails_observe() { observe: function () {
this._sslDiskCacheEnabled = this._sslDiskCacheEnabled =
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL); Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
}, },
filterForThumbnailExpiration: filterForThumbnailExpiration:
function Thumbnails_filterForThumbnailExpiration(aCallback) { function (aCallback) {
// Tycho: aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]); // Tycho: aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]);
let result = []; let result = [];
for (let browser of gBrowser.browsers) { for (let browser of gBrowser.browsers) {
@ -103,19 +103,19 @@ var gBrowserThumbnails = {
/** /**
* State change progress listener for all tabs. * State change progress listener for all tabs.
*/ */
onStateChange: function Thumbnails_onStateChange(aBrowser, aWebProgress, onStateChange: function (aBrowser, aWebProgress,
aRequest, aStateFlags, aStatus) { aRequest, aStateFlags, aStatus) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)
this._delayedCapture(aBrowser); this._delayedCapture(aBrowser);
}, },
_capture: function Thumbnails_capture(aBrowser) { _capture: function (aBrowser) {
if (this._shouldCapture(aBrowser)) if (this._shouldCapture(aBrowser))
PageThumbs.captureAndStore(aBrowser); PageThumbs.captureAndStore(aBrowser);
}, },
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) { _delayedCapture: function (aBrowser) {
if (this._timeouts.has(aBrowser)) if (this._timeouts.has(aBrowser))
clearTimeout(this._timeouts.get(aBrowser)); clearTimeout(this._timeouts.get(aBrowser));
else else
@ -129,7 +129,7 @@ var gBrowserThumbnails = {
this._timeouts.set(aBrowser, timeout); this._timeouts.set(aBrowser, timeout);
}, },
_shouldCapture: function Thumbnails_shouldCapture(aBrowser) { _shouldCapture: function (aBrowser) {
// Capture only if it's the currently selected tab. // Capture only if it's the currently selected tab.
if (aBrowser != gBrowser.selectedBrowser) if (aBrowser != gBrowser.selectedBrowser)
return false; return false;
@ -193,7 +193,7 @@ var gBrowserThumbnails = {
return true; return true;
}, },
_clearTimeout: function Thumbnails_clearTimeout(aBrowser) { _clearTimeout: function (aBrowser) {
if (this._timeouts.has(aBrowser)) { if (this._timeouts.has(aBrowser)) {
aBrowser.removeEventListener("scroll", this, false); aBrowser.removeEventListener("scroll", this, false);
clearTimeout(this._timeouts.get(aBrowser)); clearTimeout(this._timeouts.get(aBrowser));

View file

@ -2502,7 +2502,7 @@ function BrowserOnAboutPageLoad(doc) {
* Handle command events bubbling up from error page content * Handle command events bubbling up from error page content
*/ */
var BrowserOnClick = { var BrowserOnClick = {
handleEvent: function BrowserOnClick_handleEvent(aEvent) { handleEvent: function (aEvent) {
if (!aEvent.isTrusted || // Don't trust synthetic events if (!aEvent.isTrusted || // Don't trust synthetic events
aEvent.button == 2 || aEvent.target.localName != "button") { aEvent.button == 2 || aEvent.target.localName != "button") {
return; return;
@ -2524,7 +2524,7 @@ var BrowserOnClick = {
} }
}, },
onAboutCertError: function BrowserOnClick_onAboutCertError(aTargetElm, aOwnerDoc) { onAboutCertError: function (aTargetElm, aOwnerDoc) {
let elmId = aTargetElm.getAttribute("id"); let elmId = aTargetElm.getAttribute("id");
let isTopFrame = (aOwnerDoc.defaultView.parent === aOwnerDoc.defaultView); let isTopFrame = (aOwnerDoc.defaultView.parent === aOwnerDoc.defaultView);
@ -2565,14 +2565,14 @@ var BrowserOnClick = {
} }
}, },
onAboutNetError: function BrowserOnClick_onAboutNetError(aTargetElm, aOwnerDoc) { onAboutNetError: function (aTargetElm, aOwnerDoc) {
let elmId = aTargetElm.getAttribute("id"); let elmId = aTargetElm.getAttribute("id");
if (elmId != "errorTryAgain" || !/e=netOffline/.test(aOwnerDoc.documentURI)) if (elmId != "errorTryAgain" || !/e=netOffline/.test(aOwnerDoc.documentURI))
return; return;
Services.io.offline = false; Services.io.offline = false;
}, },
onAboutHome: function BrowserOnClick_onAboutHome(aTargetElm, aOwnerDoc) { onAboutHome: function (aTargetElm, aOwnerDoc) {
let elmId = aTargetElm.getAttribute("id"); let elmId = aTargetElm.getAttribute("id");
switch (elmId) { switch (elmId) {
@ -3113,7 +3113,7 @@ const BrowserSearch = {
* the default engine's search form otherwise. For Mac, opens a new window * the default engine's search form otherwise. For Mac, opens a new window
* or focuses an existing window, if necessary. * or focuses an existing window, if necessary.
*/ */
webSearch: function BrowserSearch_webSearch() { webSearch: function () {
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (window.location.href != getBrowserURL()) { if (window.location.href != getBrowserURL()) {
var win = getTopWin(); var win = getTopWin();
@ -3164,7 +3164,7 @@ const BrowserSearch = {
* @return string Name of the search engine used to perform a search or null * @return string Name of the search engine used to perform a search or null
* if a search was not performed. * if a search was not performed.
*/ */
loadSearch: function BrowserSearch_search(searchText, useNewTab, purpose) { loadSearch: function (searchText, useNewTab, purpose) {
var engine; var engine;
// If the search bar is visible, use the current engine, otherwise, fall // If the search bar is visible, use the current engine, otherwise, fall
@ -3211,7 +3211,7 @@ const BrowserSearch = {
return document.getElementById("searchbar"); return document.getElementById("searchbar");
}, },
loadAddEngines: function BrowserSearch_loadAddEngines() { loadAddEngines: function () {
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow"); var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
var where = newWindowPref == 3 ? "tab" : "window"; var where = newWindowPref == 3 ? "tab" : "window";
var searchEnginesURL = formatURL("browser.search.searchEnginesURL", true); var searchEnginesURL = formatURL("browser.search.searchEnginesURL", true);
@ -4130,7 +4130,7 @@ var XULBrowserWindow = {
}, },
// simulate all change notifications after switching tabs // simulate all change notifications after switching tabs
onUpdateCurrentBrowser: function XWB_onUpdateCurrentBrowser(aStateFlags, aStatus, aMessage, aTotalProgress) { onUpdateCurrentBrowser: function (aStateFlags, aStatus, aMessage, aTotalProgress) {
if (FullZoom.updateBackgroundTabs) if (FullZoom.updateBackgroundTabs)
FullZoom.onLocationChange(gBrowser.currentURI, true); FullZoom.onLocationChange(gBrowser.currentURI, true);
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener; var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
@ -4654,7 +4654,7 @@ var AudioIndicator = {
} }
var TabsOnTop = { var TabsOnTop = {
init: function TabsOnTop_init() { init: function () {
Services.prefs.addObserver(this._prefName, this, false); Services.prefs.addObserver(this._prefName, this, false);
// Pale Moon: Stop Being a Derp, Mozilla (#3) // Pale Moon: Stop Being a Derp, Mozilla (#3)
// Only show the toggle UI if the user disabled tabs on top. // Only show the toggle UI if the user disabled tabs on top.
@ -4664,7 +4664,7 @@ var TabsOnTop = {
// } // }
}, },
uninit: function TabsOnTop_uninit() { uninit: function () {
Services.prefs.removeObserver(this._prefName, this); Services.prefs.removeObserver(this._prefName, this);
}, },
@ -6940,7 +6940,7 @@ function getBrowser() gBrowser;
function getNavToolbox() gNavToolbox; function getNavToolbox() gNavToolbox;
var gPrivateBrowsingUI = { var gPrivateBrowsingUI = {
init: function PBUI_init() { init: function () {
// Do nothing for normal windows // Do nothing for normal windows
if (!PrivateBrowsingUtils.isWindowPrivate(window)) { if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
return; return;

View file

@ -13,7 +13,7 @@ function nsContextMenu(aXulMenu, aIsShift) {
// Prototype for nsContextMenu "class." // Prototype for nsContextMenu "class."
nsContextMenu.prototype = { nsContextMenu.prototype = {
initMenu: function CM_initMenu(aXulMenu, aIsShift) { initMenu: function (aXulMenu, aIsShift) {
// Get contextual info. // Get contextual info.
this.setTarget(document.popupNode, document.popupRangeParent, this.setTarget(document.popupNode, document.popupRangeParent,
document.popupRangeOffset); document.popupRangeOffset);
@ -40,14 +40,14 @@ nsContextMenu.prototype = {
this.initItems(); this.initItems();
}, },
hiding: function CM_hiding() { hiding: function () {
gContextMenuContentData = null; gContextMenuContentData = null;
InlineSpellCheckerUI.clearSuggestionsFromMenu(); InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu(); InlineSpellCheckerUI.clearDictionaryListFromMenu();
InlineSpellCheckerUI.uninit(); InlineSpellCheckerUI.uninit();
}, },
initItems: function CM_initItems() { initItems: function () {
this.initPageMenuSeparator(); this.initPageMenuSeparator();
this.initOpenItems(); this.initOpenItems();
this.initNavigationItems(); this.initNavigationItems();
@ -61,11 +61,11 @@ nsContextMenu.prototype = {
this.initClickToPlayItems(); this.initClickToPlayItems();
}, },
initPageMenuSeparator: function CM_initPageMenuSeparator() { initPageMenuSeparator: function () {
this.showItem("page-menu-separator", this.hasPageMenu); this.showItem("page-menu-separator", this.hasPageMenu);
}, },
initOpenItems: function CM_initOpenItems() { initOpenItems: function () {
var isMailtoInternal = false; var isMailtoInternal = false;
if (this.onMailtoLink) { if (this.onMailtoLink) {
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"]. var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
@ -114,7 +114,7 @@ nsContextMenu.prototype = {
this.showItem("context-sep-open", shouldShow); this.showItem("context-sep-open", shouldShow);
}, },
initNavigationItems: function CM_initNavigationItems() { initNavigationItems: function () {
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage || var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
this.onCanvas || this.onVideo || this.onAudio || this.onCanvas || this.onVideo || this.onAudio ||
this.onTextInput); this.onTextInput);
@ -136,7 +136,7 @@ nsContextMenu.prototype = {
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" ); //this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
}, },
initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() { initLeaveDOMFullScreenItems: function () {
// only show the option if the user is in DOM fullscreen // only show the option if the user is in DOM fullscreen
var shouldShow = (this.target.ownerDocument.mozFullScreenElement != null); var shouldShow = (this.target.ownerDocument.mozFullScreenElement != null);
this.showItem("context-leave-dom-fullscreen", shouldShow); this.showItem("context-leave-dom-fullscreen", shouldShow);
@ -146,7 +146,7 @@ nsContextMenu.prototype = {
this.showItem("context-media-sep-commands", true); this.showItem("context-media-sep-commands", true);
}, },
initSaveItems: function CM_initSaveItems() { initSaveItems: function () {
var shouldShow = !(this.onTextInput || this.onLink || var shouldShow = !(this.onTextInput || this.onLink ||
this.isContentSelected || this.onImage || this.isContentSelected || this.onImage ||
this.onCanvas || this.onVideo || this.onAudio); this.onCanvas || this.onVideo || this.onAudio);
@ -172,7 +172,7 @@ nsContextMenu.prototype = {
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL); this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL);
}, },
initViewItems: function CM_initViewItems() { initViewItems: function () {
// View source is always OK, unless in directory listing. // View source is always OK, unless in directory listing.
this.showItem("context-viewpartialsource-selection", this.showItem("context-viewpartialsource-selection",
this.isContentSelected); this.isContentSelected);
@ -236,7 +236,7 @@ nsContextMenu.prototype = {
this.showItem("context-viewimageinfo", this.onImage); this.showItem("context-viewimageinfo", this.onImage);
}, },
initMiscItems: function CM_initMiscItems() { initMiscItems: function () {
// Use "Bookmark This Link" if on a link. // Use "Bookmark This Link" if on a link.
this.showItem("context-bookmarkpage", this.showItem("context-bookmarkpage",
!(this.isContentSelected || this.onTextInput || this.onLink || !(this.isContentSelected || this.onTextInput || this.onLink ||
@ -426,7 +426,7 @@ nsContextMenu.prototype = {
this.showItem("context-sep-ctp", this.onCTPPlugin); this.showItem("context-sep-ctp", this.onCTPPlugin);
}, },
inspectNode: function CM_inspectNode() { inspectNode: function () {
let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {}); let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
let gBrowser = this.browser.ownerDocument.defaultView.gBrowser; let gBrowser = this.browser.ownerDocument.defaultView.gBrowser;
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
@ -1027,7 +1027,7 @@ nsContextMenu.prototype = {
saveAsListener.prototype = { saveAsListener.prototype = {
extListener: null, 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, // 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 // and we'll be restarting in onStopRequest, so no reason to notify
@ -1065,7 +1065,7 @@ nsContextMenu.prototype = {
this.extListener.onStartRequest(aRequest, aContext); this.extListener.onStartRequest(aRequest, aContext);
}, },
onStopRequest: function saveLinkAs_onStopRequest(aRequest, aContext, onStopRequest: function (aRequest, aContext,
aStatusCode) { aStatusCode) {
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) { if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
// do it the old fashioned way, which will pick the best filename // do it the old fashioned way, which will pick the best filename
@ -1076,7 +1076,7 @@ nsContextMenu.prototype = {
this.extListener.onStopRequest(aRequest, aContext, aStatusCode); this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
}, },
onDataAvailable: function saveLinkAs_onDataAvailable(aRequest, aContext, onDataAvailable: function (aRequest, aContext,
aInputStream, aInputStream,
aOffset, aCount) { aOffset, aCount) {
this.extListener.onDataAvailable(aRequest, aContext, aInputStream, this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
@ -1086,7 +1086,7 @@ nsContextMenu.prototype = {
function callbacks() {} function callbacks() {}
callbacks.prototype = { callbacks.prototype = {
getInterface: function sLA_callbacks_getInterface(aIID) { getInterface: function (aIID) {
if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) { if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) {
// If the channel demands authentication prompt, we must cancel it // If the channel demands authentication prompt, we must cancel it
// because the save-as-timer would expire and cancel the channel // because the save-as-timer would expire and cancel the channel
@ -1105,7 +1105,7 @@ nsContextMenu.prototype = {
// we give up waiting for the filename. // we give up waiting for the filename.
function timerCallback() {} function timerCallback() {}
timerCallback.prototype = { timerCallback.prototype = {
notify: function sLA_timer_notify(aTimer) { notify: function (aTimer) {
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT); channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
return; return;
} }
@ -1465,11 +1465,11 @@ nsContextMenu.prototype = {
openUILinkIn(uri, where); openUILinkIn(uri, where);
}, },
bookmarkThisPage: function CM_bookmarkThisPage() { bookmarkThisPage: function () {
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true); window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
}, },
bookmarkLink: function CM_bookmarkLink() { bookmarkLink: function () {
var linkText; var linkText;
// If selected text is found to match valid URL pattern. // If selected text is found to match valid URL pattern.
if (this.onPlainTextLink) if (this.onPlainTextLink)
@ -1480,7 +1480,7 @@ nsContextMenu.prototype = {
linkText); linkText);
}, },
addBookmarkForFrame: function CM_addBookmarkForFrame() { addBookmarkForFrame: function () {
var doc = this.target.ownerDocument; var doc = this.target.ownerDocument;
var uri = doc.documentURIObject; var uri = doc.documentURIObject;
@ -1507,23 +1507,23 @@ nsContextMenu.prototype = {
} }
}, },
savePageAs: function CM_savePageAs() { savePageAs: function () {
saveDocument(this.browser.contentDocument); saveDocument(this.browser.contentDocument);
}, },
sendPage: function CM_sendPage() { sendPage: function () {
MailIntegration.sendLinkForWindow(this.browser.contentWindow); MailIntegration.sendLinkForWindow(this.browser.contentWindow);
}, },
printFrame: function CM_printFrame() { printFrame: function () {
PrintUtils.print(this.target.ownerDocument.defaultView); PrintUtils.print(this.target.ownerDocument.defaultView);
}, },
switchPageDirection: function CM_switchPageDirection() { switchPageDirection: function () {
SwitchDocumentDirection(this.browser.contentWindow); SwitchDocumentDirection(this.browser.contentWindow);
}, },
mediaCommand : function CM_mediaCommand(command, data) { mediaCommand : function (command, data) {
var media = this.target; var media = this.target;
switch (command) { switch (command) {

View file

@ -589,7 +589,7 @@ var gContiguousSelectionTreeHelper = {
* view * view
* @return The new view * @return The new view
*/ */
setTree: function CSTH_setTree(aTreeElement, aProtoTreeView) setTree: function (aTreeElement, aProtoTreeView)
{ {
this._tree = aTreeElement; this._tree = aTreeElement;
var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view); var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view);
@ -604,7 +604,7 @@ var gContiguousSelectionTreeHelper = {
* *
* @return The row index of the grippy * @return The row index of the grippy
*/ */
getGrippyRow: function CSTH_getGrippyRow() getGrippyRow: function ()
{ {
var sel = this.tree.view.selection; var sel = this.tree.view.selection;
var rangeCount = sel.getRangeCount(); var rangeCount = sel.getRangeCount();
@ -626,7 +626,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent * @param aEvent
* The observed dragover event * 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. // Without this when dragging on Windows the mouse cursor is a "no" sign.
// This makes it a drop symbol. // This makes it a drop symbol.
@ -653,7 +653,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent * @param aEvent
* The observed dragstart event * The observed dragstart event
*/ */
ondragstart: function CSTH_ondragstart(aEvent) ondragstart: function (aEvent)
{ {
var tbo = this.tree.treeBoxObject; var tbo = this.tree.treeBoxObject;
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY); var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
@ -688,7 +688,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent * @param aEvent
* The observed keypress event * The observed keypress event
*/ */
onkeypress: function CSTH_onkeypress(aEvent) onkeypress: function (aEvent)
{ {
var grippyRow = this.getGrippyRow(); var grippyRow = this.getGrippyRow();
var tbo = this.tree.treeBoxObject; var tbo = this.tree.treeBoxObject;
@ -749,7 +749,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent * @param aEvent
* The observed mousedown event * The observed mousedown event
*/ */
onmousedown: function CSTH_onmousedown(aEvent) onmousedown: function (aEvent)
{ {
var tbo = this.tree.treeBoxObject; var tbo = this.tree.treeBoxObject;
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY); var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
@ -771,7 +771,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEndRow * @param aEndRow
* The range [0, aEndRow] will be selected. * The range [0, aEndRow] will be selected.
*/ */
rangedSelect: function CSTH_rangedSelect(aEndRow) rangedSelect: function (aEndRow)
{ {
var tbo = this.tree.treeBoxObject; var tbo = this.tree.treeBoxObject;
if (aEndRow < 0) if (aEndRow < 0)
@ -784,7 +784,7 @@ var gContiguousSelectionTreeHelper = {
/** /**
* Scrolls the tree so that the grippy row is in the center of the view. * 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 rowCount = this.tree.view.rowCount;
var tbo = this.tree.treeBoxObject; var tbo = this.tree.treeBoxObject;
@ -817,14 +817,14 @@ var gContiguousSelectionTreeHelper = {
* @param aProtoTreeView * @param aProtoTreeView
* Used as the new view's prototype if specified * Used as the new view's prototype if specified
*/ */
_makeTreeView: function CSTH__makeTreeView(aProtoTreeView) _makeTreeView: function (aProtoTreeView)
{ {
var view = aProtoTreeView; var view = aProtoTreeView;
var that = this; var that = this;
//XXXadw: When Alex gets the grippy icon done, this may or may not change, //XXXadw: When Alex gets the grippy icon done, this may or may not change,
// depending on how we style it. // depending on how we style it.
view.isSeparator = function CSTH_View_isSeparator(aRow) view.isSeparator = function (aRow)
{ {
return aRow === that.getGrippyRow(); return aRow === that.getGrippyRow();
}; };
@ -832,7 +832,7 @@ var gContiguousSelectionTreeHelper = {
// rowCount includes the grippy row. // rowCount includes the grippy row.
view.__defineGetter__("_rowCount", view.__lookupGetter__("rowCount")); view.__defineGetter__("_rowCount", view.__lookupGetter__("rowCount"));
view.__defineGetter__("rowCount", view.__defineGetter__("rowCount",
function CSTH_View_rowCount() function ()
{ {
return this._rowCount + 1; return this._rowCount + 1;
}); });