[Pale-Moon] Remove excess whitespace.

This commit is contained in:
athenian200 2020-02-06 09:46:16 -06:00 • committed by Roy Tam
commit b6b33a6b2a
73 changed files with 1883 additions and 1883 deletions

View file

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

View file

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

View file

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

View file

@ -11,12 +11,12 @@ var gPluginHandler = {
PLUGIN_SCRIPTED_STATE_FIRED: 1,
PLUGIN_SCRIPTED_STATE_DONE: 2,
getPluginUI: function (plugin, anonid) {
getPluginUI: function(plugin, anonid) {
return plugin.ownerDocument.
getAnonymousElementByAttribute(plugin, "anonid", anonid);
},
_getPluginInfo: function (pluginElement) {
_getPluginInfo: function(pluginElement) {
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
pluginElement.QueryInterface(Ci.nsIObjectLoadingContent);
@ -63,7 +63,7 @@ var gPluginHandler = {
},
// Map the plugin's name to a filtered version more suitable for user UI.
makeNicePluginName : function (aName) {
makeNicePluginName : function(aName) {
if (aName == "Shockwave Flash")
return "Adobe Flash";
@ -76,7 +76,7 @@ var gPluginHandler = {
return newName;
},
isTooSmall : function (plugin, overlay) {
isTooSmall : function(plugin, overlay) {
// Is the <object>'s size too small to hold what we want to show?
let pluginRect = plugin.getBoundingClientRect();
// XXX bug 446693. The text-shadow on the submitted-report text at
@ -88,7 +88,7 @@ var gPluginHandler = {
return overflows;
},
addLinkClickCallback: function (linkNode, callbackName /*callbackArgs...*/) {
addLinkClickCallback: function(linkNode, callbackName /*callbackArgs...*/) {
// XXX just doing (callback)(arg) was giving a same-origin error. bug?
let self = this;
let callbackArgs = Array.prototype.slice.call(arguments).slice(2);
@ -269,12 +269,12 @@ var gPluginHandler = {
}
},
isKnownPlugin: function (objLoadingContent) {
isKnownPlugin: function(objLoadingContent) {
return (objLoadingContent.getContentTypeForMIMEType(objLoadingContent.actualType) ==
Ci.nsIObjectLoadingContent.TYPE_PLUGIN);
},
canActivatePlugin: function (objLoadingContent) {
canActivatePlugin: function(objLoadingContent) {
// if this isn't a known plugin, we can't activate it
// (this also guards pluginHost.getPermissionStringForType against
// unexpected input)
@ -307,7 +307,7 @@ var gPluginHandler = {
overlay.style.visibility = "hidden";
},
stopPlayPreview: function (aPlugin, aPlayPlugin) {
stopPlayPreview: function(aPlugin, aPlayPlugin) {
let objLoadingContent = aPlugin.QueryInterface(Ci.nsIObjectLoadingContent);
if (objLoadingContent.activated)
return;
@ -319,28 +319,28 @@ var gPluginHandler = {
},
// Callback for user clicking on a disabled plugin
managePlugins: function (aEvent) {
managePlugins: function(aEvent) {
BrowserOpenAddonsMgr("addons://list/plugin");
},
// Callback for user clicking on the link in a click-to-play plugin
// (where the plugin has an update)
openPluginUpdatePage: function (aEvent) {
openPluginUpdatePage: function(aEvent) {
openURL(Services.urlFormatter.formatURLPref("plugins.update.url"));
},
// Callback for user clicking a "reload page" link
reloadPage: function (browser) {
reloadPage: function(browser) {
browser.reload();
},
// Callback for user clicking the help icon
openHelpPage: function () {
openHelpPage: function() {
openHelpLink("plugin-crashed", false);
},
// Event listener for click-to-play plugins.
_handleClickToPlayEvent: function (aPlugin) {
_handleClickToPlayEvent: function(aPlugin) {
let doc = aPlugin.ownerDocument;
let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
@ -372,7 +372,7 @@ var gPluginHandler = {
},
_overlayClickListener: {
handleEvent: function (aEvent) {
handleEvent: function(aEvent) {
let plugin = document.getBindingParent(aEvent.target);
let contentWindow = plugin.ownerDocument.defaultView.top;
// gBrowser.getBrowserForDocument does not exist in the case where we
@ -399,7 +399,7 @@ var gPluginHandler = {
}
},
_handlePlayPreviewEvent: function (aPlugin) {
_handlePlayPreviewEvent: function(aPlugin) {
let doc = aPlugin.ownerDocument;
let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
@ -441,7 +441,7 @@ var gPluginHandler = {
}
},
reshowClickToPlayNotification: function () {
reshowClickToPlayNotification: function() {
let browser = gBrowser.selectedBrowser;
let contentWindow = browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
@ -459,7 +459,7 @@ var gPluginHandler = {
gPluginHandler._showClickToPlayNotification(browser);
},
_clickToPlayNotificationEventCallback: function (event) {
_clickToPlayNotificationEventCallback: function(event) {
if (event == "showing") {
gPluginHandler._makeCenterActions(this);
}
@ -470,7 +470,7 @@ var gPluginHandler = {
}
},
_makeCenterActions: function (notification) {
_makeCenterActions: function(notification) {
let contentWindow = notification.browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
@ -533,7 +533,7 @@ var gPluginHandler = {
* and activate plugins if necessary.
* aNewState should be either "allownow" "allowalways" or "block"
*/
_updatePluginPermission: function (aNotification, aPluginInfo, aNewState) {
_updatePluginPermission: function(aNotification, aPluginInfo, aNewState) {
let permission;
let expireType;
let expireTime;
@ -598,7 +598,7 @@ var gPluginHandler = {
}
},
_showClickToPlayNotification: function (aBrowser, aPrimaryPlugin) {
_showClickToPlayNotification: function(aBrowser, aPrimaryPlugin) {
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
let contentWindow = aBrowser.contentWindow;
@ -664,7 +664,7 @@ var gPluginHandler = {
// Crashed-plugin event listener. Called for every instance of a
// plugin in content.
pluginInstanceCrashed: function (plugin, aEvent) {
pluginInstanceCrashed: function(plugin, aEvent) {
// Ensure the plugin and event are of the right type.
if (!(aEvent instanceof Ci.nsIDOMDataContainerEvent))
return;

View file

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

View file

@ -22,7 +22,7 @@ var tabPreviews = {
return this.height = Math.round(this.width * this.aspectRatio);
},
init: function () {
init: function() {
if (this._selectedTab)
return;
this._selectedTab = gBrowser.selectedTab;
@ -31,7 +31,7 @@ var tabPreviews = {
gBrowser.tabContainer.addEventListener("SSTabRestored", this, false);
},
get: function (aTab) {
get: function(aTab) {
let uri = aTab.linkedBrowser.currentURI.spec;
if (aTab.__thumbnail_lastURI &&
@ -52,7 +52,7 @@ var tabPreviews = {
return this.capture(aTab, !aTab.hasAttribute("busy"));
},
capture: function (aTab, aStore) {
capture: function(aTab, aStore) {
var thumbnail = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
thumbnail.mozOpaque = true;
thumbnail.height = this.height;
@ -75,7 +75,7 @@ var tabPreviews = {
return thumbnail;
},
handleEvent: function (event) {
handleEvent: function(event) {
switch (event.type) {
case "TabSelect":
if (this._selectedTab &&
@ -86,7 +86,7 @@ var tabPreviews = {
// for tabs that will be closed. During that timeout, don't generate other
// thumbnails in case multiple TabSelect events occur fast in succession.
this._pendingUpdate = true;
setTimeout(function (self, aTab) {
setTimeout(function(self, aTab) {
self._pendingUpdate = false;
if (aTab.parentNode &&
!aTab.hasAttribute("busy") &&
@ -104,7 +104,7 @@ var tabPreviews = {
};
var tabPreviewPanelHelper = {
opening: function (host) {
opening: function(host) {
host.panel.hidden = false;
var handler = this._generateHandler(host);
@ -113,20 +113,20 @@ var tabPreviewPanelHelper = {
host._prevFocus = document.commandDispatcher.focusedElement;
},
_generateHandler: function (host) {
_generateHandler: function(host) {
var self = this;
return function (event) {
return function(event) {
if (event.target == host.panel) {
host.panel.removeEventListener(event.type, arguments.callee, false);
self["_" + event.type](host);
}
};
},
_popupshown: function (host) {
_popupshown: function(host) {
if ("setupGUI" in host)
host.setupGUI();
},
_popuphiding: function (host) {
_popuphiding: function(host) {
if ("suspendGUI" in host)
host.suspendGUI();
@ -167,7 +167,7 @@ var ctrlTab = {
},
get keys () {
var keys = {};
["close", "find", "selectAll"].forEach(function (key) {
["close", "find", "selectAll"].forEach(function(key) {
keys[key] = document.getElementById("key_" + key)
.getAttribute("key")
.toLocaleLowerCase().charCodeAt(0);
@ -193,13 +193,13 @@ var ctrlTab = {
// Using gBrowser.tabs instead of gBrowser.visibleTabs, as the latter
// exlcudes closing tabs, breaking the following loop in case the the
// selected tab is closing.
let list = Array.filter(gBrowser.tabs, function (tab) !tab.hidden);
let list = Array.filter(gBrowser.tabs, function(tab) !tab.hidden);
// Rotate the list until the selected tab is first
while (!list[0].selected)
list.push(list.shift());
list = list.filter(function (tab) !tab.closing);
list = list.filter(function(tab) !tab.closing);
if (this.recentlyUsedLimit != 0) {
let recentlyUsedTabs = [];
@ -218,7 +218,7 @@ var ctrlTab = {
let hidePinnedTabs = gPrefService.getBoolPref("browser.ctrlTab.hidePinnedTabs");
if (hidePinnedTabs) {
regularTabsList = list.filter(function (tab) !tab.pinned);
regularTabsList = list.filter(function(tab) !tab.pinned);
// Don't hide pinned tabs if we only have 1 regular tab
if (regularTabsList.length > 1) {
list = regularTabsList;
@ -228,7 +228,7 @@ var ctrlTab = {
return this._tabList = list;
},
init: function () {
init: function() {
if (!this._recentlyUsedTabs) {
tabPreviews.init();
@ -237,13 +237,13 @@ var ctrlTab = {
}
},
uninit: function () {
uninit: function() {
this._recentlyUsedTabs = null;
this._init(false);
},
prefName: "browser.ctrlTab.previews",
readPref: function () {
readPref: function() {
var enable =
gPrefService.getBoolPref(this.prefName) &&
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
@ -254,11 +254,11 @@ var ctrlTab = {
else
this.uninit();
},
observe: function (aSubject, aTopic, aPrefName) {
observe: function(aSubject, aTopic, aPrefName) {
this.readPref();
},
updatePreviews: function () {
updatePreviews: function() {
for (let i = 0; i < this.previews.length; i++)
this.updatePreview(this.previews[i], this.tabList[i]);
@ -267,7 +267,7 @@ var ctrlTab = {
PluralForm.get(this.tabCount, showAllLabel).replace("#1", this.tabCount);
},
updatePreview: function (aPreview, aTab) {
updatePreview: function(aPreview, aTab) {
if (aPreview == this.showAllButton)
return;
@ -301,7 +301,7 @@ var ctrlTab = {
}
},
advanceFocus: function (aForward) {
advanceFocus: function(aForward) {
let selectedIndex = Array.indexOf(this.previews, this.selected);
do {
selectedIndex += aForward ? 1 : -1;
@ -325,12 +325,12 @@ var ctrlTab = {
}
},
_mouseOverFocus: function (aPreview) {
_mouseOverFocus: function(aPreview) {
if (this._trackMouseOver)
aPreview.focus();
},
pick: function (aPreview) {
pick: function(aPreview) {
if (!this.tabCount)
return;
@ -342,17 +342,17 @@ var ctrlTab = {
this.close(select._tab);
},
showAllTabs: function (aPreview) {
showAllTabs: function(aPreview) {
this.close();
document.getElementById("Browser:ShowAllTabs").doCommand();
},
remove: function (aPreview) {
remove: function(aPreview) {
if (aPreview._tab)
gBrowser.removeTab(aPreview._tab);
},
attachTab: function (aTab, aPos) {
attachTab: function(aTab, aPos) {
if (aPos == 0)
this._recentlyUsedTabs.unshift(aTab);
else if (aPos)
@ -360,13 +360,13 @@ var ctrlTab = {
else
this._recentlyUsedTabs.push(aTab);
},
detachTab: function (aTab) {
detachTab: function(aTab) {
var i = this._recentlyUsedTabs.indexOf(aTab);
if (i >= 0)
this._recentlyUsedTabs.splice(i, 1);
},
open: function () {
open: function() {
if (this.isOpen)
return;
@ -379,13 +379,13 @@ var ctrlTab = {
// Add a slight delay before showing the UI, so that a quick
// "ctrl-tab" keypress just flips back to the MRU tab.
this._timer = setTimeout(function (self) {
this._timer = setTimeout(function(self) {
self._timer = null;
self._openPanel();
}, 200, this);
},
_openPanel: function () {
_openPanel: function() {
tabPreviewPanelHelper.opening(this);
this.panel.width = Math.min(screen.availWidth * .99,
@ -396,7 +396,7 @@ var ctrlTab = {
false);
},
close: function (aTabToSelect) {
close: function(aTabToSelect) {
if (!this.isOpen)
return;
@ -413,30 +413,30 @@ var ctrlTab = {
this.panel.hidePopup();
},
setupGUI: function () {
setupGUI: function() {
this.selected.focus();
this._selectedIndex = -1;
// Track mouse movement after a brief delay so that the item that happens
// to be under the mouse pointer initially won't be selected unintentionally.
this._trackMouseOver = false;
setTimeout(function (self) {
setTimeout(function(self) {
if (self.isOpen)
self._trackMouseOver = true;
}, 0, this);
},
suspendGUI: function () {
suspendGUI: function() {
document.removeEventListener("keyup", this, true);
Array.forEach(this.previews, function (preview) {
Array.forEach(this.previews, function(preview) {
this.updatePreview(preview, null);
}, this);
this._tabList = null;
},
onKeyPress: function (event) {
onKeyPress: function(event) {
var isOpen = this.isOpen;
if (isOpen) {
@ -481,7 +481,7 @@ var ctrlTab = {
}
},
removeClosingTabFromUI: function (aTab) {
removeClosingTabFromUI: function(aTab) {
if (this.tabCount == 2) {
this.close();
return;
@ -497,13 +497,13 @@ var ctrlTab = {
// If the current tab is removed, another tab can steal our focus.
if (aTab.selected && this.panel.state == "open") {
setTimeout(function (selected) {
setTimeout(function(selected) {
selected.focus();
}, 0, this.selected);
}
},
handleEvent: function (event) {
handleEvent: function(event) {
switch (event.type) {
case "TabAttrModified":
// tab attribute modified (e.g. label, crop, busy, image, selected)
@ -536,7 +536,7 @@ var ctrlTab = {
}
},
_init: function (enable) {
_init: function(enable) {
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
var tabContainer = gBrowser.tabContainer;
@ -587,14 +587,14 @@ var allTabs = {
get previews () this.container.getElementsByClassName("allTabs-preview"),
get isOpen () this.panel.state == "open" || this.panel.state == "showing",
init: function () {
init: function() {
if (this._initiated)
return;
this._initiated = true;
tabPreviews.init();
Array.forEach(gBrowser.tabs, function (tab) {
Array.forEach(gBrowser.tabs, function(tab) {
this._addPreview(tab);
}, this);
@ -604,7 +604,7 @@ var allTabs = {
gBrowser.tabContainer.addEventListener("TabClose", this, false);
},
uninit: function () {
uninit: function() {
if (!this._initiated)
return;
@ -620,7 +620,7 @@ var allTabs = {
},
prefName: "browser.allTabs.previews",
readPref: function () {
readPref: function() {
var allTabsButton = this.toolbarButton;
if (!allTabsButton)
return;
@ -634,11 +634,11 @@ var allTabs = {
allTabsButton.removeAttribute("oncommand");
}
},
observe: function (aSubject, aTopic, aPrefName) {
observe: function(aSubject, aTopic, aPrefName) {
this.readPref();
},
pick: function (aPreview) {
pick: function(aPreview) {
if (!aPreview)
aPreview = this._firstVisiblePreview;
if (aPreview)
@ -647,12 +647,12 @@ var allTabs = {
this.close();
},
closeTab: function (event) {
closeTab: function(event) {
this.filterField.focus();
gBrowser.removeTab(event.currentTarget._targetPreview._tab);
},
filter: function () {
filter: function() {
if (this._currentFilter == this.filterField.value)
return;
@ -660,7 +660,7 @@ var allTabs = {
let hidePinnedTabs = gPrefService.getBoolPref("browser.allTabs.hidePinnedTabs");
if (hidePinnedTabs) {
let regularTabsList = Array.filter(this.previews, function (preview) !preview._tab.pinned);
let regularTabsList = Array.filter(this.previews, function(preview) !preview._tab.pinned);
// Show pinned tabs if we don't have any regular tabs
if (regularTabsList.length == 0) {
hidePinnedTabs = false;
@ -669,7 +669,7 @@ var allTabs = {
var filter = this._currentFilter.split(/\s+/g);
this._visible = 0;
Array.forEach(this.previews, function (preview) {
Array.forEach(this.previews, function(preview) {
var tab = preview._tab;
var matches = 0;
if (filter.length && !tab.hidden) {
@ -694,13 +694,13 @@ var allTabs = {
this._reflow();
},
open: function () {
open: function() {
var allTabsButton = this.toolbarButton;
if (allTabsButton &&
allTabsButton.getAttribute("type") == "menu") {
// Without setTimeout, the menupopup won't stay open when invoking
// "View > Show All Tabs" and the menu bar auto-hides.
setTimeout(function () {
setTimeout(function() {
allTabsButton.open = true;
}, 0);
return;
@ -722,11 +722,11 @@ var allTabs = {
this.panel.openPopup(gBrowser, "overlap", 0, 0, false, true);
},
close: function () {
close: function() {
this.panel.hidePopup();
},
setupGUI: function () {
setupGUI: function() {
this.filterField.focus();
this.filterField.placeholder = this.filterField.tooltipText;
@ -739,7 +739,7 @@ var allTabs = {
document.getElementById("Browser:ShowAllTabs").setAttribute("disabled", "true");
},
suspendGUI: function () {
suspendGUI: function() {
this.filterField.placeholder = "";
this.filterField.value = "";
this._currentFilter = null;
@ -750,12 +750,12 @@ var allTabs = {
this.panel.removeEventListener("keypress", this, true);
this._browserCommandSet.removeEventListener("command", this, false);
setTimeout(function () {
setTimeout(function() {
document.getElementById("Browser:ShowAllTabs").removeAttribute("disabled");
}, 300);
},
handleEvent: function (event) {
handleEvent: function(event) {
if (event.type.startsWith("Tab")) {
var tab = event.target;
if (event.type != "TabOpen")
@ -815,7 +815,7 @@ var allTabs = {
},
get _visiblePreviews ()
Array.filter(this.previews, function (preview) !preview.hidden),
Array.filter(this.previews, function(preview) !preview.hidden),
get _firstVisiblePreview () {
if (this._visible == 0)
@ -828,7 +828,7 @@ var allTabs = {
return null;
},
_reflow: function () {
_reflow: function() {
this._updateTabCloseButton();
const CONTAINER_MAX_WIDTH = this._maxPanelWidth * .95;
@ -867,7 +867,7 @@ var allTabs = {
var row = this.container.firstChild;
var colCount = 0;
previews.forEach(function (preview) {
previews.forEach(function(preview) {
if (!preview.hidden &&
++colCount > this._columns) {
row = row.nextSibling;
@ -887,14 +887,14 @@ var allTabs = {
this.container.maxHeight = rows * outerHeight;
},
_addPreview: function (aTab) {
_addPreview: function(aTab) {
var preview = document.createElement("button");
preview.className = "allTabs-preview";
preview._tab = aTab;
this.container.lastChild.appendChild(preview);
},
_removePreview: function (aPreview) {
_removePreview: function(aPreview) {
var updateUI = (this.isOpen && !aPreview.hidden);
aPreview._tab = null;
aPreview.parentNode.removeChild(aPreview);
@ -905,7 +905,7 @@ var allTabs = {
}
},
_getPreview: function (aTab) {
_getPreview: function(aTab) {
var previews = this.previews;
for (let i = 0; i < previews.length; i++)
if (previews[i]._tab == aTab)
@ -913,7 +913,7 @@ var allTabs = {
return null;
},
_updateTabCloseButton: function (event) {
_updateTabCloseButton: function(event) {
if (event && event.target == this.tabCloseButton)
return;
@ -950,7 +950,7 @@ var allTabs = {
}
},
_updatePreview: function (aPreview) {
_updatePreview: function(aPreview) {
aPreview.setAttribute("label", aPreview._tab.label);
aPreview.setAttribute("tooltiptext", aPreview._tab.label);
aPreview.setAttribute("crop", aPreview._tab.crop);
@ -975,7 +975,7 @@ var allTabs = {
aPreview.appendChild(thumbnail);
},
_onKeyPress: function (event) {
_onKeyPress: function(event) {
if (event.eventPhase == event.CAPTURING_PHASE) {
this._onCapturingKeyPress(event);
return;
@ -1010,7 +1010,7 @@ var allTabs = {
}
},
_onCapturingKeyPress: function (event) {
_onCapturingKeyPress: function(event) {
switch (event.keyCode) {
case event.DOM_VK_UP:
case event.DOM_VK_DOWN:
@ -1028,7 +1028,7 @@ var allTabs = {
}
},
_advanceFocusVertically: function (event) {
_advanceFocusVertically: function(event) {
var preview = document.activeElement;
if (!preview || preview.parentNode.parentNode != this.container)
return;

View file

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

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@ function nsContextMenu(aXulMenu, aIsShift) {
// Prototype for nsContextMenu "class."
nsContextMenu.prototype = {
initMenu: function (aXulMenu, aIsShift) {
initMenu: function(aXulMenu, aIsShift) {
// Get contextual info.
this.setTarget(document.popupNode, document.popupRangeParent,
document.popupRangeOffset);
@ -40,14 +40,14 @@ nsContextMenu.prototype = {
this.initItems();
},
hiding: function () {
hiding: function() {
gContextMenuContentData = null;
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
InlineSpellCheckerUI.uninit();
},
initItems: function () {
initItems: function() {
this.initPageMenuSeparator();
this.initOpenItems();
this.initNavigationItems();
@ -61,11 +61,11 @@ nsContextMenu.prototype = {
this.initClickToPlayItems();
},
initPageMenuSeparator: function () {
initPageMenuSeparator: function() {
this.showItem("page-menu-separator", this.hasPageMenu);
},
initOpenItems: function () {
initOpenItems: function() {
var isMailtoInternal = false;
if (this.onMailtoLink) {
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
@ -114,7 +114,7 @@ nsContextMenu.prototype = {
this.showItem("context-sep-open", shouldShow);
},
initNavigationItems: function () {
initNavigationItems: function() {
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
this.onCanvas || this.onVideo || this.onAudio ||
this.onTextInput);
@ -136,7 +136,7 @@ nsContextMenu.prototype = {
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
},
initLeaveDOMFullScreenItems: function () {
initLeaveDOMFullScreenItems: function() {
// only show the option if the user is in DOM fullscreen
var shouldShow = (this.target.ownerDocument.mozFullScreenElement != null);
this.showItem("context-leave-dom-fullscreen", shouldShow);
@ -146,7 +146,7 @@ nsContextMenu.prototype = {
this.showItem("context-media-sep-commands", true);
},
initSaveItems: function () {
initSaveItems: function() {
var shouldShow = !(this.onTextInput || this.onLink ||
this.isContentSelected || this.onImage ||
this.onCanvas || this.onVideo || this.onAudio);
@ -172,7 +172,7 @@ nsContextMenu.prototype = {
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL);
},
initViewItems: function () {
initViewItems: function() {
// View source is always OK, unless in directory listing.
this.showItem("context-viewpartialsource-selection",
this.isContentSelected);
@ -236,7 +236,7 @@ nsContextMenu.prototype = {
this.showItem("context-viewimageinfo", this.onImage);
},
initMiscItems: function () {
initMiscItems: function() {
// Use "Bookmark This Link" if on a link.
this.showItem("context-bookmarkpage",
!(this.isContentSelected || this.onTextInput || this.onLink ||
@ -426,7 +426,7 @@ nsContextMenu.prototype = {
this.showItem("context-sep-ctp", this.onCTPPlugin);
},
inspectNode: function () {
inspectNode: function() {
let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
let gBrowser = this.browser.ownerDocument.defaultView.gBrowser;
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
@ -442,7 +442,7 @@ nsContextMenu.prototype = {
},
// Set various context menu attributes based on the state of the world.
setTarget: function (aNode, aRangeParent, aRangeOffset) {
setTarget: function(aNode, aRangeParent, aRangeOffset) {
const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
if (aNode.namespaceURI == xulNS ||
aNode.nodeType == Node.DOCUMENT_NODE ||
@ -750,7 +750,7 @@ nsContextMenu.prototype = {
},
// Open linked-to URL in a new window.
openLink : function () {
openLink : function() {
var doc = this.target.ownerDocument;
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
openLinkIn(this.linkURL, "window",
@ -762,7 +762,7 @@ nsContextMenu.prototype = {
},
// Open linked-to URL in a new private window.
openLinkInPrivateWindow : function () {
openLinkInPrivateWindow : function() {
var doc = this.target.ownerDocument;
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
openLinkIn(this.linkURL, "window",
@ -884,11 +884,11 @@ nsContextMenu.prototype = {
"This feature cannot be used, because it hasn't found " +
"an appropriate window.");
} else {
new Promise.resolve({then: function (resolve) {
new Promise.resolve({then: function(resolve) {
target.toBlob((blob) => {
resolve(win.URL.createObjectURL(blob));
})
}}).then(function (blobURL) {
}}).then(function(blobURL) {
openUILink(blobURL, e, { disallowInheritPrincipal: true,
referrerURI: doc.documentURIObject });
}, Components.utils.reportError);
@ -905,7 +905,7 @@ nsContextMenu.prototype = {
}
},
saveVideoFrameAsImage: function () {
saveVideoFrameAsImage: function() {
let referrerURI = document.documentURIObject;
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser);
@ -931,7 +931,7 @@ nsContextMenu.prototype = {
isPrivate);
},
fullScreenVideo: function () {
fullScreenVideo: function() {
let video = this.target;
if (document.mozFullScreenEnabled)
video.mozRequestFullScreen();
@ -1008,7 +1008,7 @@ nsContextMenu.prototype = {
},
// Save URL of clicked-on frame.
saveFrame: function () {
saveFrame: function() {
saveDocument(this.target.ownerDocument);
},
@ -1027,7 +1027,7 @@ nsContextMenu.prototype = {
saveAsListener.prototype = {
extListener: null,
onStartRequest: function (aRequest, aContext) {
onStartRequest: function(aRequest, aContext) {
// if the timer fired, the error status will have been caused by that,
// and we'll be restarting in onStopRequest, so no reason to notify
@ -1065,7 +1065,7 @@ nsContextMenu.prototype = {
this.extListener.onStartRequest(aRequest, aContext);
},
onStopRequest: function (aRequest, aContext,
onStopRequest: function(aRequest, aContext,
aStatusCode) {
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
// do it the old fashioned way, which will pick the best filename
@ -1076,7 +1076,7 @@ nsContextMenu.prototype = {
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
},
onDataAvailable: function (aRequest, aContext,
onDataAvailable: function(aRequest, aContext,
aInputStream,
aOffset, aCount) {
this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
@ -1086,7 +1086,7 @@ nsContextMenu.prototype = {
function callbacks() {}
callbacks.prototype = {
getInterface: function (aIID) {
getInterface: function(aIID) {
if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) {
// If the channel demands authentication prompt, we must cancel it
// because the save-as-timer would expire and cancel the channel
@ -1105,7 +1105,7 @@ nsContextMenu.prototype = {
// we give up waiting for the filename.
function timerCallback() {}
timerCallback.prototype = {
notify: function (aTimer) {
notify: function(aTimer) {
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
return;
}
@ -1195,11 +1195,11 @@ nsContextMenu.prototype = {
"This feature cannot be used, because it hasn't found " +
"an appropriate window.");
} else {
new Promise.resolve({then: function (resolve) {
new Promise.resolve({then: function(resolve) {
target.toBlob((blob) => {
resolve(win.URL.createObjectURL(blob));
})
}}).then(function (blobURL) {
}}).then(function(blobURL) {
saveImageURL(blobURL, "canvas.png", "SaveImageTitle",
true, false, referrerURI, null, null, null,
isPrivate);
@ -1375,7 +1375,7 @@ nsContextMenu.prototype = {
return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed;
},
toString: function () {
toString: function() {
return "contextMenu.target = " + this.target + "\n" +
"contextMenu.onImage = " + this.onImage + "\n" +
"contextMenu.onLink = " + this.onLink + "\n" +
@ -1427,7 +1427,7 @@ nsContextMenu.prototype = {
// Determines whether or not the separator with the specified ID should be
// shown or not by determining if there are any non-hidden items between it
// and the previous separator.
shouldShowSeparator: function (aSeparatorID) {
shouldShowSeparator: function(aSeparatorID) {
var separator = document.getElementById(aSeparatorID);
if (separator) {
var sibling = separator.previousSibling;
@ -1465,11 +1465,11 @@ nsContextMenu.prototype = {
openUILinkIn(uri, where);
},
bookmarkThisPage: function () {
bookmarkThisPage: function() {
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
},
bookmarkLink: function () {
bookmarkLink: function() {
var linkText;
// If selected text is found to match valid URL pattern.
if (this.onPlainTextLink)
@ -1480,7 +1480,7 @@ nsContextMenu.prototype = {
linkText);
},
addBookmarkForFrame: function () {
addBookmarkForFrame: function() {
var doc = this.target.ownerDocument;
var uri = doc.documentURIObject;
@ -1507,23 +1507,23 @@ nsContextMenu.prototype = {
}
},
savePageAs: function () {
savePageAs: function() {
saveDocument(this.browser.contentDocument);
},
sendPage: function () {
sendPage: function() {
MailIntegration.sendLinkForWindow(this.browser.contentWindow);
},
printFrame: function () {
printFrame: function() {
PrintUtils.print(this.target.ownerDocument.defaultView);
},
switchPageDirection: function () {
switchPageDirection: function() {
SwitchDocumentDirection(this.browser.contentWindow);
},
mediaCommand : function (command, data) {
mediaCommand : function(command, data) {
var media = this.target;
switch (command) {
@ -1560,7 +1560,7 @@ nsContextMenu.prototype = {
}
},
copyMediaLocation : function () {
copyMediaLocation : function() {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboard.copyString(this.mediaURL, document);

View file

@ -35,7 +35,7 @@ var gSanitizePromptDialog = {
return document.getElementById("sanitizeEverythingWarningBox");
},
init: function ()
init: function()
{
// This is used by selectByTimespan() to determine if the window has loaded.
this._inited = true;
@ -69,7 +69,7 @@ var gSanitizePromptDialog = {
this.warningBox.hidden = true;
},
selectByTimespan: function ()
selectByTimespan: function()
{
// This method is the onselect handler for the duration dropdown. As a
// result it's called a couple of times before onload calls init().
@ -99,7 +99,7 @@ var gSanitizePromptDialog = {
window.document.documentElement.getAttribute("noneverythingtitle");
},
sanitize: function ()
sanitize: function()
{
// Update pref values before handing off to the sanitizer (bug 453440)
this.updatePrefs();
@ -136,7 +136,7 @@ var gSanitizePromptDialog = {
* True means the item list visibility status should not
* be changed.
*/
prepareWarning: function (aDontShowItemList) {
prepareWarning: function(aDontShowItemList) {
// If the date and time-aware locale warning string is ever used again,
// initialize it here. Currently we use the no-visits warning string,
// which does not include date and time. See bug 480169 comment 48.
@ -160,7 +160,7 @@ var gSanitizePromptDialog = {
* Called when the value of a preference element is synced from the actual
* pref. Enables or disables the OK button appropriately.
*/
onReadGeneric: function ()
onReadGeneric: function()
{
var found = false;
@ -193,7 +193,7 @@ var gSanitizePromptDialog = {
* (i.e., Windows). We must therefore manually set the prefs from their
* corresponding preference elements.
*/
updatePrefs : function ()
updatePrefs : function()
{
var tsPref = document.getElementById("privacy.sanitize.timeSpan");
Sanitizer.prefs.setIntPref("timeSpan", this.selectedTimespan);
@ -214,7 +214,7 @@ var gSanitizePromptDialog = {
/**
* Check if all of the history items have been selected like the default status.
*/
hasNonSelectedItems: function () {
hasNonSelectedItems: function() {
let checkboxes = document.querySelectorAll("#itemList > [preference]");
for (let i = 0; i < checkboxes.length; ++i) {
let pref = document.getElementById(checkboxes[i].getAttribute("preference"));
@ -227,7 +227,7 @@ var gSanitizePromptDialog = {
/**
* Show the history items list.
*/
showItemList: function () {
showItemList: function() {
var itemList = document.getElementById("itemList");
var expanderButton = document.getElementById("detailsExpander");
@ -242,7 +242,7 @@ var gSanitizePromptDialog = {
/**
* Hide the history items list.
*/
hideItemList: function () {
hideItemList: function() {
var itemList = document.getElementById("itemList");
var expanderButton = document.getElementById("detailsExpander");
@ -256,7 +256,7 @@ var gSanitizePromptDialog = {
/**
* Called by the item list expander button to toggle the list's visibility.
*/
toggleItemList: function ()
toggleItemList: function()
{
var itemList = document.getElementById("itemList");
@ -282,7 +282,7 @@ var gSanitizePromptDialog = {
return this._placesTree;
},
init: function ()
init: function()
{
// This is used by selectByTimespan() to determine if the window has loaded.
this._inited = true;
@ -315,7 +315,7 @@ var gSanitizePromptDialog = {
* the tree to duration values, and this.durationStartTimes, which maps
* duration values to their corresponding start times.
*/
initDurationDropdown: function ()
initDurationDropdown: function()
{
// First, calculate the start times for each duration.
this.durationStartTimes = {};
@ -379,7 +379,7 @@ var gSanitizePromptDialog = {
/**
* If the Places tree is not set up, sets it up. Otherwise does nothing.
*/
ensurePlacesTreeIsInited: function ()
ensurePlacesTreeIsInited: function()
{
if (this._placesTreeIsInited)
return;
@ -420,7 +420,7 @@ var gSanitizePromptDialog = {
* the tree that are contained in the selected duration. If clearing
* everything, the warning panel is shown instead.
*/
selectByTimespan: function ()
selectByTimespan: function()
{
// This method is the onselect handler for the duration dropdown. As a
// result it's called a couple of times before onload calls init().
@ -467,7 +467,7 @@ var gSanitizePromptDialog = {
document.documentElement.getButton("accept").disabled = durRow < 0;
},
sanitize: function ()
sanitize: function()
{
// Update pref values before handing off to the sanitizer (bug 453440)
this.updatePrefs();
@ -515,7 +515,7 @@ var gSanitizePromptDialog = {
* for garbage collection, we need to break the reference cycle between the
* two.
*/
unload: function ()
unload: function()
{
let result = this.placesTree.getResult();
result.removeObserver(this.placesTree.view);
@ -533,7 +533,7 @@ var gSanitizePromptDialog = {
* @param aEvent
* The event captured in the event handler.
*/
grippyMoved: function (aEventName, aEvent)
grippyMoved: function(aEventName, aEvent)
{
gContiguousSelectionTreeHelper[aEventName](aEvent);
var lastSelRow = gContiguousSelectionTreeHelper.getGrippyRow() - 1;
@ -589,7 +589,7 @@ var gContiguousSelectionTreeHelper = {
* view
* @return The new view
*/
setTree: function (aTreeElement, aProtoTreeView)
setTree: function(aTreeElement, aProtoTreeView)
{
this._tree = aTreeElement;
var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view);
@ -604,7 +604,7 @@ var gContiguousSelectionTreeHelper = {
*
* @return The row index of the grippy
*/
getGrippyRow: function ()
getGrippyRow: function()
{
var sel = this.tree.view.selection;
var rangeCount = sel.getRangeCount();
@ -626,7 +626,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed dragover event
*/
ondragover: function (aEvent)
ondragover: function(aEvent)
{
// Without this when dragging on Windows the mouse cursor is a "no" sign.
// This makes it a drop symbol.
@ -653,7 +653,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed dragstart event
*/
ondragstart: function (aEvent)
ondragstart: function(aEvent)
{
var tbo = this.tree.treeBoxObject;
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
@ -688,7 +688,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed keypress event
*/
onkeypress: function (aEvent)
onkeypress: function(aEvent)
{
var grippyRow = this.getGrippyRow();
var tbo = this.tree.treeBoxObject;
@ -749,7 +749,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEvent
* The observed mousedown event
*/
onmousedown: function (aEvent)
onmousedown: function(aEvent)
{
var tbo = this.tree.treeBoxObject;
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
@ -771,7 +771,7 @@ var gContiguousSelectionTreeHelper = {
* @param aEndRow
* The range [0, aEndRow] will be selected.
*/
rangedSelect: function (aEndRow)
rangedSelect: function(aEndRow)
{
var tbo = this.tree.treeBoxObject;
if (aEndRow < 0)
@ -784,7 +784,7 @@ var gContiguousSelectionTreeHelper = {
/**
* Scrolls the tree so that the grippy row is in the center of the view.
*/
scrollToGrippy: function ()
scrollToGrippy: function()
{
var rowCount = this.tree.view.rowCount;
var tbo = this.tree.treeBoxObject;
@ -817,14 +817,14 @@ var gContiguousSelectionTreeHelper = {
* @param aProtoTreeView
* Used as the new view's prototype if specified
*/
_makeTreeView: function (aProtoTreeView)
_makeTreeView: function(aProtoTreeView)
{
var view = aProtoTreeView;
var that = this;
//XXXadw: When Alex gets the grippy icon done, this may or may not change,
// depending on how we style it.
view.isSeparator = function (aRow)
view.isSeparator = function(aRow)
{
return aRow === that.getGrippyRow();
};
@ -832,7 +832,7 @@ var gContiguousSelectionTreeHelper = {
// rowCount includes the grippy row.
view.__defineGetter__("_rowCount", view.__lookupGetter__("rowCount"));
view.__defineGetter__("rowCount",
function ()
function()
{
return this._rowCount + 1;
});