mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
[Pale-Moon] Remove excess whitespace.
This commit is contained in:
parent
fcab070621
commit
b6b33a6b2a
73 changed files with 1883 additions and 1883 deletions
|
|
@ -38,7 +38,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// Initialization & Destruction
|
// Initialization & Destruction
|
||||||
|
|
||||||
init: function () {
|
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 () {
|
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 (event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "ZoomChangeUsingMouseWheel":
|
case "ZoomChangeUsingMouseWheel":
|
||||||
let browser = this._getTargetedBrowser(event);
|
let browser = this._getTargetedBrowser(event);
|
||||||
|
|
@ -89,7 +89,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// nsIObserver
|
// nsIObserver
|
||||||
|
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
switch (aData) {
|
switch (aData) {
|
||||||
|
|
@ -108,11 +108,11 @@ var FullZoom = {
|
||||||
|
|
||||||
// nsIContentPrefObserver
|
// nsIContentPrefObserver
|
||||||
|
|
||||||
onContentPrefSet: function (aGroup, aName, aValue, aIsPrivate) {
|
onContentPrefSet: function(aGroup, aName, aValue, aIsPrivate) {
|
||||||
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
|
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
onContentPrefRemoved: function (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 (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
|
||||||
|
|
@ -154,8 +154,8 @@ var FullZoom = {
|
||||||
let hasPref = false;
|
let hasPref = false;
|
||||||
let token = this._getBrowserToken(browser);
|
let token = this._getBrowserToken(browser);
|
||||||
this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
|
this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
|
||||||
handleResult: function () { hasPref = true; },
|
handleResult: function() { hasPref = true; },
|
||||||
handleCompletion: function () {
|
handleCompletion: function() {
|
||||||
if (!hasPref && token.isCurrent)
|
if (!hasPref && token.isCurrent)
|
||||||
this._applyPrefToZoom(undefined, browser);
|
this._applyPrefToZoom(undefined, browser);
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
|
@ -175,7 +175,7 @@ var FullZoom = {
|
||||||
* @param aBrowser
|
* @param aBrowser
|
||||||
* (optional) browser object displaying the document
|
* (optional) browser object displaying the document
|
||||||
*/
|
*/
|
||||||
onLocationChange: function (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
|
||||||
|
|
@ -223,8 +223,8 @@ var FullZoom = {
|
||||||
let value = undefined;
|
let value = undefined;
|
||||||
let token = this._getBrowserToken(browser);
|
let token = this._getBrowserToken(browser);
|
||||||
this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, {
|
this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, {
|
||||||
handleResult: function (resultPref) { value = resultPref.value; },
|
handleResult: function(resultPref) { value = resultPref.value; },
|
||||||
handleCompletion: function () {
|
handleCompletion: function() {
|
||||||
if (!token.isCurrent) {
|
if (!token.isCurrent) {
|
||||||
this._notifyOnLocationChange(browser);
|
this._notifyOnLocationChange(browser);
|
||||||
return;
|
return;
|
||||||
|
|
@ -237,7 +237,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// update state of zoom type menu item
|
// update state of zoom type menu item
|
||||||
|
|
||||||
updateMenu: function () {
|
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 () {
|
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 () {
|
enlarge: function() {
|
||||||
ZoomManager.enlarge();
|
ZoomManager.enlarge();
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
this._ignorePendingZoomAccesses(browser);
|
this._ignorePendingZoomAccesses(browser);
|
||||||
|
|
@ -269,7 +269,7 @@ var FullZoom = {
|
||||||
* Sets the zoom level for the given browser to the given floating
|
* Sets the zoom level for the given browser to the given floating
|
||||||
* point value, where 1 is the default zoom level.
|
* 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);
|
ZoomManager.setZoomForBrowser(browser, value);
|
||||||
this._ignorePendingZoomAccesses(browser);
|
this._ignorePendingZoomAccesses(browser);
|
||||||
this._applyZoomToPref(browser);
|
this._applyZoomToPref(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 (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 (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 (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 ||
|
||||||
|
|
@ -364,7 +364,7 @@ var FullZoom = {
|
||||||
this._cps2.set(browser.currentURI.spec, this.name,
|
this._cps2.set(browser.currentURI.spec, this.name,
|
||||||
ZoomManager.getZoomForBrowser(browser),
|
ZoomManager.getZoomForBrowser(browser),
|
||||||
this._loadContextFromBrowser(browser), {
|
this._loadContextFromBrowser(browser), {
|
||||||
handleCompletion: function () {
|
handleCompletion: function() {
|
||||||
this._isNextContentPrefChangeInternal = true;
|
this._isNextContentPrefChangeInternal = true;
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
});
|
});
|
||||||
|
|
@ -375,13 +375,13 @@ 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 (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;
|
||||||
let ctxt = this._loadContextFromBrowser(browser);
|
let ctxt = this._loadContextFromBrowser(browser);
|
||||||
this._cps2.removeByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
|
this._cps2.removeByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
|
||||||
handleCompletion: function () {
|
handleCompletion: function() {
|
||||||
this._isNextContentPrefChangeInternal = true;
|
this._isNextContentPrefChangeInternal = true;
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
});
|
});
|
||||||
|
|
@ -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 (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 (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 (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 (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 (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.
|
||||||
|
|
@ -487,7 +487,7 @@ var FullZoom = {
|
||||||
}
|
}
|
||||||
let value = undefined;
|
let value = undefined;
|
||||||
this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), {
|
this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), {
|
||||||
handleResult: function (pref) { value = pref.value; },
|
handleResult: function(pref) { value = pref.value; },
|
||||||
handleCompletion: (reason) => {
|
handleCompletion: (reason) => {
|
||||||
this._globalValue = this._ensureValid(value);
|
this._globalValue = this._ensureValid(value);
|
||||||
resolve(this._globalValue);
|
resolve(this._globalValue);
|
||||||
|
|
@ -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 (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 (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 (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);
|
||||||
|
|
|
||||||
|
|
@ -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 (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;
|
||||||
|
|
@ -38,7 +38,7 @@ var gGestureSupport = {
|
||||||
let addRemove = aAddListener ? window.addEventListener :
|
let addRemove = aAddListener ? window.addEventListener :
|
||||||
window.removeEventListener;
|
window.removeEventListener;
|
||||||
|
|
||||||
gestureEvents.forEach(function (event) addRemove("Moz" + event, this, true),
|
gestureEvents.forEach(function(event) addRemove("Moz" + event, this, true),
|
||||||
this);
|
this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ var gGestureSupport = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The gesture event to handle
|
* The gesture event to handle
|
||||||
*/
|
*/
|
||||||
handleEvent: function (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 (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 (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 (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 (aEvent) {
|
_setupSwipeGesture: function(aEvent) {
|
||||||
if (!this._swipeNavigatesHistory(aEvent))
|
if (!this._swipeNavigatesHistory(aEvent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -197,15 +197,15 @@ var gGestureSupport = {
|
||||||
|
|
||||||
gHistorySwipeAnimation.startAnimation();
|
gHistorySwipeAnimation.startAnimation();
|
||||||
|
|
||||||
this._doUpdate = function (aEvent) {
|
this._doUpdate = function(aEvent) {
|
||||||
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
|
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._doEnd = function (aEvent) {
|
this._doEnd = function(aEvent) {
|
||||||
gHistorySwipeAnimation.swipeEndEventReceived();
|
gHistorySwipeAnimation.swipeEndEventReceived();
|
||||||
|
|
||||||
this._doUpdate = function (aEvent) {};
|
this._doUpdate = function(aEvent) {};
|
||||||
this._doEnd = function (aEvent) {};
|
this._doEnd = function(aEvent) {};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -217,12 +217,12 @@ 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 (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) {
|
||||||
// Only select array elements where the current bit is set
|
// 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)
|
if (num & 1 << aIndex)
|
||||||
aPrev.push(aCurr);
|
aPrev.push(aCurr);
|
||||||
return aPrev;
|
return aPrev;
|
||||||
|
|
@ -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 (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,12 +255,12 @@ 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 (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)
|
||||||
let keyCombos = [];
|
let keyCombos = [];
|
||||||
["shift", "alt", "ctrl", "meta"].forEach(function (key) {
|
["shift", "alt", "ctrl", "meta"].forEach(function(key) {
|
||||||
if (aEvent[key + "Key"])
|
if (aEvent[key + "Key"])
|
||||||
keyCombos.push(key);
|
keyCombos.push(key);
|
||||||
});
|
});
|
||||||
|
|
@ -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 (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 (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 (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 (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 (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 () {
|
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 () {
|
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 () {
|
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 () {
|
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 (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 (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 () {
|
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 (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 () {
|
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 () {
|
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 () {
|
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 (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 () {
|
_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 () {
|
_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 () {
|
_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 () {
|
_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 () {
|
_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 (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 (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 () {
|
_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 () {
|
_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 (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 (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 (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 (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 (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 () {
|
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;
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ var StarUI = {
|
||||||
get _blockedCommands() {
|
get _blockedCommands() {
|
||||||
delete this._blockedCommands;
|
delete this._blockedCommands;
|
||||||
return 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 () {
|
_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"))
|
||||||
return;
|
return;
|
||||||
|
|
@ -47,8 +47,8 @@ var StarUI = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_restoreCommandsState: function () {
|
_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");
|
||||||
elt.removeAttribute("wasDisabled");
|
elt.removeAttribute("wasDisabled");
|
||||||
|
|
@ -56,7 +56,7 @@ var StarUI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
handleEvent: function (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 (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)
|
||||||
|
|
@ -133,7 +133,7 @@ var StarUI = {
|
||||||
this._overlayLoading = true;
|
this._overlayLoading = true;
|
||||||
document.loadOverlay(
|
document.loadOverlay(
|
||||||
"chrome://browser/content/places/editBookmarkOverlay.xul",
|
"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)
|
//XXX We just caused localstore.rdf to be re-applied (bug 640158)
|
||||||
retrieveToolbarIconsizesFromTheme();
|
retrieveToolbarIconsizesFromTheme();
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ var StarUI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_doShowEditBookmarkPanel:
|
_doShowEditBookmarkPanel:
|
||||||
function (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 (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 () {
|
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 () {
|
cancelButtonOnCommand: function() {
|
||||||
this._actionOnHide = "cancel";
|
this._actionOnHide = "cancel";
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
},
|
},
|
||||||
|
|
||||||
removeBookmarkButtonCommand: function () {
|
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 () {
|
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 (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 (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 (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) {
|
||||||
|
|
@ -387,7 +387,7 @@ var PlacesCommandHook = {
|
||||||
get uniqueCurrentPages() {
|
get uniqueCurrentPages() {
|
||||||
let uniquePages = {};
|
let uniquePages = {};
|
||||||
let URIs = [];
|
let URIs = [];
|
||||||
gBrowser.visibleTabs.forEach(function (tab) {
|
gBrowser.visibleTabs.forEach(function(tab) {
|
||||||
let spec = tab.linkedBrowser.currentURI.spec;
|
let spec = tab.linkedBrowser.currentURI.spec;
|
||||||
if (!tab.pinned && !(spec in uniquePages)) {
|
if (!tab.pinned && !(spec in uniquePages)) {
|
||||||
uniquePages[spec] = null;
|
uniquePages[spec] = null;
|
||||||
|
|
@ -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 () {
|
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 () {
|
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 (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 (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 () {
|
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 () {
|
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 (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 () {
|
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 () {
|
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 () {
|
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 () {
|
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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 () {
|
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 () {
|
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 () {
|
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 () {
|
onToolbarVisibilityChange: function() {
|
||||||
this._popupNeedsUpdate = true;
|
this._popupNeedsUpdate = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onPopupShowing: function (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 (aState) {
|
onPageProxyStateChanged: function(aState) {
|
||||||
if (!this.star) {
|
if (!this.star) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1126,7 +1126,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateToolbarStyle: function () {
|
_updateToolbarStyle: function() {
|
||||||
if (!this.button) {
|
if (!this.button) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1145,7 +1145,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_uninitView: function () {
|
_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 () {
|
customizeStart: function() {
|
||||||
this._uninitView();
|
this._uninitView();
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeChange: function () {
|
customizeChange: function() {
|
||||||
this._updateToolbarStyle();
|
this._updateToolbarStyle();
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeDone: function () {
|
customizeDone: function() {
|
||||||
delete this._button;
|
delete this._button;
|
||||||
this.onToolbarVisibilityChange();
|
this.onToolbarVisibilityChange();
|
||||||
this._updateToolbarStyle();
|
this._updateToolbarStyle();
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasBookmarksObserver: false,
|
_hasBookmarksObserver: false,
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
this._uninitView();
|
this._uninitView();
|
||||||
|
|
||||||
if (this._hasBookmarksObserver) {
|
if (this._hasBookmarksObserver) {
|
||||||
|
|
@ -1188,14 +1188,14 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLocationChange: function () {
|
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 () {
|
updateStarState: function() {
|
||||||
// Reset tracked values.
|
// Reset tracked values.
|
||||||
this._uri = gBrowser.currentURI;
|
this._uri = gBrowser.currentURI;
|
||||||
this._itemIds = [];
|
this._itemIds = [];
|
||||||
|
|
@ -1221,7 +1221,7 @@ var BookmarkingUI = {
|
||||||
// calls back. For such an edge case, retain all unique entries from both
|
// calls back. For such an edge case, retain all unique entries from both
|
||||||
// arrays.
|
// arrays.
|
||||||
this._itemIds = this._itemIds.filter(
|
this._itemIds = this._itemIds.filter(
|
||||||
function (id) aItemIds.indexOf(id) == -1
|
function(id) aItemIds.indexOf(id) == -1
|
||||||
).concat(aItemIds);
|
).concat(aItemIds);
|
||||||
|
|
||||||
this._updateStar();
|
this._updateStar();
|
||||||
|
|
@ -1240,7 +1240,7 @@ var BookmarkingUI = {
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateStar: function () {
|
_updateStar: function() {
|
||||||
if (!this.star) {
|
if (!this.star) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1255,7 +1255,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCommand: function (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 (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 (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 (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);
|
||||||
|
|
@ -1304,11 +1304,11 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onBeginUpdateBatch: function () {},
|
onBeginUpdateBatch: function() {},
|
||||||
onEndUpdateBatch: function () {},
|
onEndUpdateBatch: function() {},
|
||||||
onBeforeItemRemoved: function () {},
|
onBeforeItemRemoved: function() {},
|
||||||
onItemVisited: function () {},
|
onItemVisited: function() {},
|
||||||
onItemMoved: function () {},
|
onItemMoved: function() {},
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsINavBookmarkObserver
|
Ci.nsINavBookmarkObserver
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ var gPluginHandler = {
|
||||||
PLUGIN_SCRIPTED_STATE_FIRED: 1,
|
PLUGIN_SCRIPTED_STATE_FIRED: 1,
|
||||||
PLUGIN_SCRIPTED_STATE_DONE: 2,
|
PLUGIN_SCRIPTED_STATE_DONE: 2,
|
||||||
|
|
||||||
getPluginUI: function (plugin, anonid) {
|
getPluginUI: function(plugin, anonid) {
|
||||||
return plugin.ownerDocument.
|
return plugin.ownerDocument.
|
||||||
getAnonymousElementByAttribute(plugin, "anonid", anonid);
|
getAnonymousElementByAttribute(plugin, "anonid", anonid);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPluginInfo: function (pluginElement) {
|
_getPluginInfo: function(pluginElement) {
|
||||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||||
pluginElement.QueryInterface(Ci.nsIObjectLoadingContent);
|
pluginElement.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ var gPluginHandler = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Map the plugin's name to a filtered version more suitable for user UI.
|
// Map the plugin's name to a filtered version more suitable for user UI.
|
||||||
makeNicePluginName : function (aName) {
|
makeNicePluginName : function(aName) {
|
||||||
if (aName == "Shockwave Flash")
|
if (aName == "Shockwave Flash")
|
||||||
return "Adobe Flash";
|
return "Adobe Flash";
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ var gPluginHandler = {
|
||||||
return newName;
|
return newName;
|
||||||
},
|
},
|
||||||
|
|
||||||
isTooSmall : function (plugin, overlay) {
|
isTooSmall : function(plugin, overlay) {
|
||||||
// Is the <object>'s size too small to hold what we want to show?
|
// Is the <object>'s size too small to hold what we want to show?
|
||||||
let pluginRect = plugin.getBoundingClientRect();
|
let pluginRect = plugin.getBoundingClientRect();
|
||||||
// XXX bug 446693. The text-shadow on the submitted-report text at
|
// XXX bug 446693. The text-shadow on the submitted-report text at
|
||||||
|
|
@ -88,7 +88,7 @@ var gPluginHandler = {
|
||||||
return overflows;
|
return overflows;
|
||||||
},
|
},
|
||||||
|
|
||||||
addLinkClickCallback: function (linkNode, callbackName /*callbackArgs...*/) {
|
addLinkClickCallback: function(linkNode, callbackName /*callbackArgs...*/) {
|
||||||
// XXX just doing (callback)(arg) was giving a same-origin error. bug?
|
// XXX just doing (callback)(arg) was giving a same-origin error. bug?
|
||||||
let self = this;
|
let self = this;
|
||||||
let callbackArgs = Array.prototype.slice.call(arguments).slice(2);
|
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) ==
|
return (objLoadingContent.getContentTypeForMIMEType(objLoadingContent.actualType) ==
|
||||||
Ci.nsIObjectLoadingContent.TYPE_PLUGIN);
|
Ci.nsIObjectLoadingContent.TYPE_PLUGIN);
|
||||||
},
|
},
|
||||||
|
|
||||||
canActivatePlugin: function (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 (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;
|
||||||
|
|
@ -319,28 +319,28 @@ var gPluginHandler = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Callback for user clicking on a disabled plugin
|
// Callback for user clicking on a disabled plugin
|
||||||
managePlugins: function (aEvent) {
|
managePlugins: function(aEvent) {
|
||||||
BrowserOpenAddonsMgr("addons://list/plugin");
|
BrowserOpenAddonsMgr("addons://list/plugin");
|
||||||
},
|
},
|
||||||
|
|
||||||
// Callback for user clicking on the link in a click-to-play plugin
|
// Callback for user clicking on the link in a click-to-play plugin
|
||||||
// (where the plugin has an update)
|
// (where the plugin has an update)
|
||||||
openPluginUpdatePage: function (aEvent) {
|
openPluginUpdatePage: function(aEvent) {
|
||||||
openURL(Services.urlFormatter.formatURLPref("plugins.update.url"));
|
openURL(Services.urlFormatter.formatURLPref("plugins.update.url"));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Callback for user clicking a "reload page" link
|
// Callback for user clicking a "reload page" link
|
||||||
reloadPage: function (browser) {
|
reloadPage: function(browser) {
|
||||||
browser.reload();
|
browser.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Callback for user clicking the help icon
|
// Callback for user clicking the help icon
|
||||||
openHelpPage: function () {
|
openHelpPage: function() {
|
||||||
openHelpLink("plugin-crashed", false);
|
openHelpLink("plugin-crashed", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Event listener for click-to-play plugins.
|
// Event listener for click-to-play plugins.
|
||||||
_handleClickToPlayEvent: function (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 (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 (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 () {
|
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 (event) {
|
_clickToPlayNotificationEventCallback: function(event) {
|
||||||
if (event == "showing") {
|
if (event == "showing") {
|
||||||
gPluginHandler._makeCenterActions(this);
|
gPluginHandler._makeCenterActions(this);
|
||||||
}
|
}
|
||||||
|
|
@ -470,7 +470,7 @@ var gPluginHandler = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeCenterActions: function (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 (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 (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;
|
||||||
|
|
@ -664,7 +664,7 @@ var gPluginHandler = {
|
||||||
|
|
||||||
// Crashed-plugin event listener. Called for every instance of a
|
// Crashed-plugin event listener. Called for every instance of a
|
||||||
// plugin in content.
|
// plugin in content.
|
||||||
pluginInstanceCrashed: function (plugin, aEvent) {
|
pluginInstanceCrashed: function(plugin, aEvent) {
|
||||||
// Ensure the plugin and event are of the right type.
|
// Ensure the plugin and event are of the right type.
|
||||||
if (!(aEvent instanceof Ci.nsIDOMDataContainerEvent))
|
if (!(aEvent instanceof Ci.nsIDOMDataContainerEvent))
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ var gSyncUI = {
|
||||||
|
|
||||||
_unloaded: false,
|
_unloaded: false,
|
||||||
|
|
||||||
init: function () {
|
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 () {
|
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 () {
|
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 () {
|
_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 () {
|
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 () {
|
onActivityStart: function() {
|
||||||
if (!gBrowser)
|
if (!gBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ var gSyncUI = {
|
||||||
button.setAttribute("status", "active");
|
button.setAttribute("status", "active");
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncDelay: function () {
|
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 () {
|
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 () {
|
onSetupComplete: function() {
|
||||||
this.onLoginFinish();
|
this.onLoginFinish();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoginError: function () {
|
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 () {
|
onLogout: function() {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onStartOver: function () {
|
onStartOver: function() {
|
||||||
this.clearError();
|
this.clearError();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -205,17 +205,17 @@ var gSyncUI = {
|
||||||
Weave.Notifications.replaceTitle(notification);
|
Weave.Notifications.replaceTitle(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
openServerStatus: function () {
|
openServerStatus: function() {
|
||||||
let statusURL = Services.prefs.getCharPref("services.sync.statusURL");
|
let statusURL = Services.prefs.getCharPref("services.sync.statusURL");
|
||||||
window.openUILinkIn(statusURL, "tab");
|
window.openUILinkIn(statusURL, "tab");
|
||||||
},
|
},
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
doSync: function () {
|
doSync: function() {
|
||||||
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
|
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleToolbarButton: function () {
|
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 (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();
|
||||||
|
|
@ -246,7 +246,7 @@ var gSyncUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openAddDevice: function () {
|
openAddDevice: function() {
|
||||||
if (!Weave.Utils.ensureMPUnlocked())
|
if (!Weave.Utils.ensureMPUnlocked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -258,7 +258,7 @@ var gSyncUI = {
|
||||||
"syncAddDevice", "centerscreen,chrome,resizable=no");
|
"syncAddDevice", "centerscreen,chrome,resizable=no");
|
||||||
},
|
},
|
||||||
|
|
||||||
openQuotaDialog: function () {
|
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 () {
|
openPrefs: function() {
|
||||||
openPreferences("paneSync");
|
openPreferences("paneSync");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
_updateLastSyncTime: function () {
|
_updateLastSyncTime: function() {
|
||||||
if (!gBrowser)
|
if (!gBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -296,12 +296,12 @@ var gSyncUI = {
|
||||||
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
||||||
},
|
},
|
||||||
|
|
||||||
clearError: function (errorString) {
|
clearError: function(errorString) {
|
||||||
Weave.Notifications.removeAll(errorString);
|
Weave.Notifications.removeAll(errorString);
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncFinish: function () {
|
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 () {
|
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 (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;
|
||||||
|
|
|
||||||
|
|
@ -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 () {
|
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 (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 (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 (event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "TabSelect":
|
case "TabSelect":
|
||||||
if (this._selectedTab &&
|
if (this._selectedTab &&
|
||||||
|
|
@ -86,7 +86,7 @@ var tabPreviews = {
|
||||||
// for tabs that will be closed. During that timeout, don't generate other
|
// for tabs that will be closed. During that timeout, don't generate other
|
||||||
// thumbnails in case multiple TabSelect events occur fast in succession.
|
// thumbnails in case multiple TabSelect events occur fast in succession.
|
||||||
this._pendingUpdate = true;
|
this._pendingUpdate = true;
|
||||||
setTimeout(function (self, aTab) {
|
setTimeout(function(self, aTab) {
|
||||||
self._pendingUpdate = false;
|
self._pendingUpdate = false;
|
||||||
if (aTab.parentNode &&
|
if (aTab.parentNode &&
|
||||||
!aTab.hasAttribute("busy") &&
|
!aTab.hasAttribute("busy") &&
|
||||||
|
|
@ -104,7 +104,7 @@ var tabPreviews = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var tabPreviewPanelHelper = {
|
var tabPreviewPanelHelper = {
|
||||||
opening: function (host) {
|
opening: function(host) {
|
||||||
host.panel.hidden = false;
|
host.panel.hidden = false;
|
||||||
|
|
||||||
var handler = this._generateHandler(host);
|
var handler = this._generateHandler(host);
|
||||||
|
|
@ -113,20 +113,20 @@ var tabPreviewPanelHelper = {
|
||||||
|
|
||||||
host._prevFocus = document.commandDispatcher.focusedElement;
|
host._prevFocus = document.commandDispatcher.focusedElement;
|
||||||
},
|
},
|
||||||
_generateHandler: function (host) {
|
_generateHandler: function(host) {
|
||||||
var self = this;
|
var self = this;
|
||||||
return function (event) {
|
return function(event) {
|
||||||
if (event.target == host.panel) {
|
if (event.target == host.panel) {
|
||||||
host.panel.removeEventListener(event.type, arguments.callee, false);
|
host.panel.removeEventListener(event.type, arguments.callee, false);
|
||||||
self["_" + event.type](host);
|
self["_" + event.type](host);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
_popupshown: function (host) {
|
_popupshown: function(host) {
|
||||||
if ("setupGUI" in host)
|
if ("setupGUI" in host)
|
||||||
host.setupGUI();
|
host.setupGUI();
|
||||||
},
|
},
|
||||||
_popuphiding: function (host) {
|
_popuphiding: function(host) {
|
||||||
if ("suspendGUI" in host)
|
if ("suspendGUI" in host)
|
||||||
host.suspendGUI();
|
host.suspendGUI();
|
||||||
|
|
||||||
|
|
@ -167,7 +167,7 @@ var ctrlTab = {
|
||||||
},
|
},
|
||||||
get keys () {
|
get keys () {
|
||||||
var keys = {};
|
var keys = {};
|
||||||
["close", "find", "selectAll"].forEach(function (key) {
|
["close", "find", "selectAll"].forEach(function(key) {
|
||||||
keys[key] = document.getElementById("key_" + key)
|
keys[key] = document.getElementById("key_" + key)
|
||||||
.getAttribute("key")
|
.getAttribute("key")
|
||||||
.toLocaleLowerCase().charCodeAt(0);
|
.toLocaleLowerCase().charCodeAt(0);
|
||||||
|
|
@ -193,13 +193,13 @@ var ctrlTab = {
|
||||||
// Using gBrowser.tabs instead of gBrowser.visibleTabs, as the latter
|
// Using gBrowser.tabs instead of gBrowser.visibleTabs, as the latter
|
||||||
// exlcudes closing tabs, breaking the following loop in case the the
|
// exlcudes closing tabs, breaking the following loop in case the the
|
||||||
// selected tab is closing.
|
// 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
|
// Rotate the list until the selected tab is first
|
||||||
while (!list[0].selected)
|
while (!list[0].selected)
|
||||||
list.push(list.shift());
|
list.push(list.shift());
|
||||||
|
|
||||||
list = list.filter(function (tab) !tab.closing);
|
list = list.filter(function(tab) !tab.closing);
|
||||||
|
|
||||||
if (this.recentlyUsedLimit != 0) {
|
if (this.recentlyUsedLimit != 0) {
|
||||||
let recentlyUsedTabs = [];
|
let recentlyUsedTabs = [];
|
||||||
|
|
@ -218,7 +218,7 @@ var ctrlTab = {
|
||||||
|
|
||||||
let hidePinnedTabs = gPrefService.getBoolPref("browser.ctrlTab.hidePinnedTabs");
|
let hidePinnedTabs = gPrefService.getBoolPref("browser.ctrlTab.hidePinnedTabs");
|
||||||
if (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
|
// Don't hide pinned tabs if we only have 1 regular tab
|
||||||
if (regularTabsList.length > 1) {
|
if (regularTabsList.length > 1) {
|
||||||
list = regularTabsList;
|
list = regularTabsList;
|
||||||
|
|
@ -228,7 +228,7 @@ var ctrlTab = {
|
||||||
return this._tabList = list;
|
return this._tabList = list;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
if (!this._recentlyUsedTabs) {
|
if (!this._recentlyUsedTabs) {
|
||||||
tabPreviews.init();
|
tabPreviews.init();
|
||||||
|
|
||||||
|
|
@ -237,13 +237,13 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
this._recentlyUsedTabs = null;
|
this._recentlyUsedTabs = null;
|
||||||
this._init(false);
|
this._init(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
prefName: "browser.ctrlTab.previews",
|
prefName: "browser.ctrlTab.previews",
|
||||||
readPref: function () {
|
readPref: function() {
|
||||||
var enable =
|
var enable =
|
||||||
gPrefService.getBoolPref(this.prefName) &&
|
gPrefService.getBoolPref(this.prefName) &&
|
||||||
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
|
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
|
||||||
|
|
@ -254,11 +254,11 @@ var ctrlTab = {
|
||||||
else
|
else
|
||||||
this.uninit();
|
this.uninit();
|
||||||
},
|
},
|
||||||
observe: function (aSubject, aTopic, aPrefName) {
|
observe: function(aSubject, aTopic, aPrefName) {
|
||||||
this.readPref();
|
this.readPref();
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreviews: function () {
|
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 (aPreview, aTab) {
|
updatePreview: function(aPreview, aTab) {
|
||||||
if (aPreview == this.showAllButton)
|
if (aPreview == this.showAllButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -301,7 +301,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
advanceFocus: function (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 (aPreview) {
|
_mouseOverFocus: function(aPreview) {
|
||||||
if (this._trackMouseOver)
|
if (this._trackMouseOver)
|
||||||
aPreview.focus();
|
aPreview.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
pick: function (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 (aPreview) {
|
showAllTabs: function(aPreview) {
|
||||||
this.close();
|
this.close();
|
||||||
document.getElementById("Browser:ShowAllTabs").doCommand();
|
document.getElementById("Browser:ShowAllTabs").doCommand();
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function (aPreview) {
|
remove: function(aPreview) {
|
||||||
if (aPreview._tab)
|
if (aPreview._tab)
|
||||||
gBrowser.removeTab(aPreview._tab);
|
gBrowser.removeTab(aPreview._tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
attachTab: function (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 (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 () {
|
open: function() {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -379,13 +379,13 @@ var ctrlTab = {
|
||||||
|
|
||||||
// Add a slight delay before showing the UI, so that a quick
|
// Add a slight delay before showing the UI, so that a quick
|
||||||
// "ctrl-tab" keypress just flips back to the MRU tab.
|
// "ctrl-tab" keypress just flips back to the MRU tab.
|
||||||
this._timer = setTimeout(function (self) {
|
this._timer = setTimeout(function(self) {
|
||||||
self._timer = null;
|
self._timer = null;
|
||||||
self._openPanel();
|
self._openPanel();
|
||||||
}, 200, this);
|
}, 200, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_openPanel: function () {
|
_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 (aTabToSelect) {
|
close: function(aTabToSelect) {
|
||||||
if (!this.isOpen)
|
if (!this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -413,30 +413,30 @@ var ctrlTab = {
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
},
|
},
|
||||||
|
|
||||||
setupGUI: function () {
|
setupGUI: function() {
|
||||||
this.selected.focus();
|
this.selected.focus();
|
||||||
this._selectedIndex = -1;
|
this._selectedIndex = -1;
|
||||||
|
|
||||||
// Track mouse movement after a brief delay so that the item that happens
|
// 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.
|
// to be under the mouse pointer initially won't be selected unintentionally.
|
||||||
this._trackMouseOver = false;
|
this._trackMouseOver = false;
|
||||||
setTimeout(function (self) {
|
setTimeout(function(self) {
|
||||||
if (self.isOpen)
|
if (self.isOpen)
|
||||||
self._trackMouseOver = true;
|
self._trackMouseOver = true;
|
||||||
}, 0, this);
|
}, 0, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
suspendGUI: function () {
|
suspendGUI: function() {
|
||||||
document.removeEventListener("keyup", this, true);
|
document.removeEventListener("keyup", this, true);
|
||||||
|
|
||||||
Array.forEach(this.previews, function (preview) {
|
Array.forEach(this.previews, function(preview) {
|
||||||
this.updatePreview(preview, null);
|
this.updatePreview(preview, null);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this._tabList = null;
|
this._tabList = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyPress: function (event) {
|
onKeyPress: function(event) {
|
||||||
var isOpen = this.isOpen;
|
var isOpen = this.isOpen;
|
||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
|
|
@ -481,7 +481,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
removeClosingTabFromUI: function (aTab) {
|
removeClosingTabFromUI: function(aTab) {
|
||||||
if (this.tabCount == 2) {
|
if (this.tabCount == 2) {
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
|
|
@ -497,13 +497,13 @@ var ctrlTab = {
|
||||||
|
|
||||||
// If the current tab is removed, another tab can steal our focus.
|
// If the current tab is removed, another tab can steal our focus.
|
||||||
if (aTab.selected && this.panel.state == "open") {
|
if (aTab.selected && this.panel.state == "open") {
|
||||||
setTimeout(function (selected) {
|
setTimeout(function(selected) {
|
||||||
selected.focus();
|
selected.focus();
|
||||||
}, 0, this.selected);
|
}, 0, this.selected);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (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 (enable) {
|
_init: function(enable) {
|
||||||
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
||||||
|
|
||||||
var tabContainer = gBrowser.tabContainer;
|
var tabContainer = gBrowser.tabContainer;
|
||||||
|
|
@ -587,14 +587,14 @@ 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 () {
|
init: function() {
|
||||||
if (this._initiated)
|
if (this._initiated)
|
||||||
return;
|
return;
|
||||||
this._initiated = true;
|
this._initiated = true;
|
||||||
|
|
||||||
tabPreviews.init();
|
tabPreviews.init();
|
||||||
|
|
||||||
Array.forEach(gBrowser.tabs, function (tab) {
|
Array.forEach(gBrowser.tabs, function(tab) {
|
||||||
this._addPreview(tab);
|
this._addPreview(tab);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
@ -604,7 +604,7 @@ var allTabs = {
|
||||||
gBrowser.tabContainer.addEventListener("TabClose", this, false);
|
gBrowser.tabContainer.addEventListener("TabClose", this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
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 () {
|
readPref: function() {
|
||||||
var allTabsButton = this.toolbarButton;
|
var allTabsButton = this.toolbarButton;
|
||||||
if (!allTabsButton)
|
if (!allTabsButton)
|
||||||
return;
|
return;
|
||||||
|
|
@ -634,11 +634,11 @@ var allTabs = {
|
||||||
allTabsButton.removeAttribute("oncommand");
|
allTabsButton.removeAttribute("oncommand");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
observe: function (aSubject, aTopic, aPrefName) {
|
observe: function(aSubject, aTopic, aPrefName) {
|
||||||
this.readPref();
|
this.readPref();
|
||||||
},
|
},
|
||||||
|
|
||||||
pick: function (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 (event) {
|
closeTab: function(event) {
|
||||||
this.filterField.focus();
|
this.filterField.focus();
|
||||||
gBrowser.removeTab(event.currentTarget._targetPreview._tab);
|
gBrowser.removeTab(event.currentTarget._targetPreview._tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
filter: function () {
|
filter: function() {
|
||||||
if (this._currentFilter == this.filterField.value)
|
if (this._currentFilter == this.filterField.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -660,7 +660,7 @@ var allTabs = {
|
||||||
|
|
||||||
let hidePinnedTabs = gPrefService.getBoolPref("browser.allTabs.hidePinnedTabs");
|
let hidePinnedTabs = gPrefService.getBoolPref("browser.allTabs.hidePinnedTabs");
|
||||||
if (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
|
// Show pinned tabs if we don't have any regular tabs
|
||||||
if (regularTabsList.length == 0) {
|
if (regularTabsList.length == 0) {
|
||||||
hidePinnedTabs = false;
|
hidePinnedTabs = false;
|
||||||
|
|
@ -669,7 +669,7 @@ var allTabs = {
|
||||||
|
|
||||||
var filter = this._currentFilter.split(/\s+/g);
|
var filter = this._currentFilter.split(/\s+/g);
|
||||||
this._visible = 0;
|
this._visible = 0;
|
||||||
Array.forEach(this.previews, function (preview) {
|
Array.forEach(this.previews, function(preview) {
|
||||||
var tab = preview._tab;
|
var tab = preview._tab;
|
||||||
var matches = 0;
|
var matches = 0;
|
||||||
if (filter.length && !tab.hidden) {
|
if (filter.length && !tab.hidden) {
|
||||||
|
|
@ -694,13 +694,13 @@ var allTabs = {
|
||||||
this._reflow();
|
this._reflow();
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function () {
|
open: function() {
|
||||||
var allTabsButton = this.toolbarButton;
|
var allTabsButton = this.toolbarButton;
|
||||||
if (allTabsButton &&
|
if (allTabsButton &&
|
||||||
allTabsButton.getAttribute("type") == "menu") {
|
allTabsButton.getAttribute("type") == "menu") {
|
||||||
// Without setTimeout, the menupopup won't stay open when invoking
|
// Without setTimeout, the menupopup won't stay open when invoking
|
||||||
// "View > Show All Tabs" and the menu bar auto-hides.
|
// "View > Show All Tabs" and the menu bar auto-hides.
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
allTabsButton.open = true;
|
allTabsButton.open = true;
|
||||||
}, 0);
|
}, 0);
|
||||||
return;
|
return;
|
||||||
|
|
@ -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 () {
|
close: function() {
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
},
|
},
|
||||||
|
|
||||||
setupGUI: function () {
|
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 () {
|
suspendGUI: function() {
|
||||||
this.filterField.placeholder = "";
|
this.filterField.placeholder = "";
|
||||||
this.filterField.value = "";
|
this.filterField.value = "";
|
||||||
this._currentFilter = null;
|
this._currentFilter = null;
|
||||||
|
|
@ -750,12 +750,12 @@ var allTabs = {
|
||||||
this.panel.removeEventListener("keypress", this, true);
|
this.panel.removeEventListener("keypress", this, true);
|
||||||
this._browserCommandSet.removeEventListener("command", this, false);
|
this._browserCommandSet.removeEventListener("command", this, false);
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
document.getElementById("Browser:ShowAllTabs").removeAttribute("disabled");
|
document.getElementById("Browser:ShowAllTabs").removeAttribute("disabled");
|
||||||
}, 300);
|
}, 300);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (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")
|
||||||
|
|
@ -815,7 +815,7 @@ var allTabs = {
|
||||||
},
|
},
|
||||||
|
|
||||||
get _visiblePreviews ()
|
get _visiblePreviews ()
|
||||||
Array.filter(this.previews, function (preview) !preview.hidden),
|
Array.filter(this.previews, function(preview) !preview.hidden),
|
||||||
|
|
||||||
get _firstVisiblePreview () {
|
get _firstVisiblePreview () {
|
||||||
if (this._visible == 0)
|
if (this._visible == 0)
|
||||||
|
|
@ -828,7 +828,7 @@ var allTabs = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_reflow: function () {
|
_reflow: function() {
|
||||||
this._updateTabCloseButton();
|
this._updateTabCloseButton();
|
||||||
|
|
||||||
const CONTAINER_MAX_WIDTH = this._maxPanelWidth * .95;
|
const CONTAINER_MAX_WIDTH = this._maxPanelWidth * .95;
|
||||||
|
|
@ -867,7 +867,7 @@ var allTabs = {
|
||||||
|
|
||||||
var row = this.container.firstChild;
|
var row = this.container.firstChild;
|
||||||
var colCount = 0;
|
var colCount = 0;
|
||||||
previews.forEach(function (preview) {
|
previews.forEach(function(preview) {
|
||||||
if (!preview.hidden &&
|
if (!preview.hidden &&
|
||||||
++colCount > this._columns) {
|
++colCount > this._columns) {
|
||||||
row = row.nextSibling;
|
row = row.nextSibling;
|
||||||
|
|
@ -887,14 +887,14 @@ var allTabs = {
|
||||||
this.container.maxHeight = rows * outerHeight;
|
this.container.maxHeight = rows * outerHeight;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addPreview: function (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 (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 (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 (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 (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 (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 (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 (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;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ var gBrowserThumbnails = {
|
||||||
*/
|
*/
|
||||||
_tabEvents: ["TabClose", "TabSelect"],
|
_tabEvents: ["TabClose", "TabSelect"],
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
// Bug 863512 - Make page thumbnails work in electrolysis
|
// Bug 863512 - Make page thumbnails work in electrolysis
|
||||||
if (gMultiProcessBrowser)
|
if (gMultiProcessBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
@ -47,14 +47,14 @@ var gBrowserThumbnails = {
|
||||||
this._sslDiskCacheEnabled =
|
this._sslDiskCacheEnabled =
|
||||||
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
||||||
|
|
||||||
this._tabEvents.forEach(function (aEvent) {
|
this._tabEvents.forEach(function(aEvent) {
|
||||||
gBrowser.tabContainer.addEventListener(aEvent, this, false);
|
gBrowser.tabContainer.addEventListener(aEvent, this, false);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this._timeouts = new WeakMap();
|
this._timeouts = new WeakMap();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
// Bug 863512 - Make page thumbnails work in electrolysis
|
// Bug 863512 - Make page thumbnails work in electrolysis
|
||||||
if (gMultiProcessBrowser)
|
if (gMultiProcessBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
@ -63,12 +63,12 @@ var gBrowserThumbnails = {
|
||||||
gBrowser.removeTabsProgressListener(this);
|
gBrowser.removeTabsProgressListener(this);
|
||||||
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, 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);
|
gBrowser.tabContainer.removeEventListener(aEvent, this, false);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (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 () {
|
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 (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,25 +103,25 @@ var gBrowserThumbnails = {
|
||||||
/**
|
/**
|
||||||
* State change progress listener for all tabs.
|
* State change progress listener for all tabs.
|
||||||
*/
|
*/
|
||||||
onStateChange: function (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 (aBrowser) {
|
_capture: function(aBrowser) {
|
||||||
if (this._shouldCapture(aBrowser))
|
if (this._shouldCapture(aBrowser))
|
||||||
PageThumbs.captureAndStore(aBrowser);
|
PageThumbs.captureAndStore(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
_delayedCapture: function (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
|
||||||
aBrowser.addEventListener("scroll", this, true);
|
aBrowser.addEventListener("scroll", this, true);
|
||||||
|
|
||||||
let timeout = setTimeout(function () {
|
let timeout = setTimeout(function() {
|
||||||
this._clearTimeout(aBrowser);
|
this._clearTimeout(aBrowser);
|
||||||
this._capture(aBrowser);
|
this._capture(aBrowser);
|
||||||
}.bind(this), this._captureDelayMS);
|
}.bind(this), this._captureDelayMS);
|
||||||
|
|
@ -129,7 +129,7 @@ var gBrowserThumbnails = {
|
||||||
this._timeouts.set(aBrowser, timeout);
|
this._timeouts.set(aBrowser, timeout);
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldCapture: function (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 (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));
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -13,7 +13,7 @@ function nsContextMenu(aXulMenu, aIsShift) {
|
||||||
|
|
||||||
// Prototype for nsContextMenu "class."
|
// Prototype for nsContextMenu "class."
|
||||||
nsContextMenu.prototype = {
|
nsContextMenu.prototype = {
|
||||||
initMenu: function (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 () {
|
hiding: function() {
|
||||||
gContextMenuContentData = null;
|
gContextMenuContentData = null;
|
||||||
InlineSpellCheckerUI.clearSuggestionsFromMenu();
|
InlineSpellCheckerUI.clearSuggestionsFromMenu();
|
||||||
InlineSpellCheckerUI.clearDictionaryListFromMenu();
|
InlineSpellCheckerUI.clearDictionaryListFromMenu();
|
||||||
InlineSpellCheckerUI.uninit();
|
InlineSpellCheckerUI.uninit();
|
||||||
},
|
},
|
||||||
|
|
||||||
initItems: function () {
|
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 () {
|
initPageMenuSeparator: function() {
|
||||||
this.showItem("page-menu-separator", this.hasPageMenu);
|
this.showItem("page-menu-separator", this.hasPageMenu);
|
||||||
},
|
},
|
||||||
|
|
||||||
initOpenItems: function () {
|
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 () {
|
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 () {
|
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 () {
|
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 () {
|
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 () {
|
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 () {
|
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);
|
||||||
|
|
@ -442,7 +442,7 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set various context menu attributes based on the state of the world.
|
// 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";
|
const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
if (aNode.namespaceURI == xulNS ||
|
if (aNode.namespaceURI == xulNS ||
|
||||||
aNode.nodeType == Node.DOCUMENT_NODE ||
|
aNode.nodeType == Node.DOCUMENT_NODE ||
|
||||||
|
|
@ -750,7 +750,7 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Open linked-to URL in a new window.
|
// Open linked-to URL in a new window.
|
||||||
openLink : function () {
|
openLink : function() {
|
||||||
var doc = this.target.ownerDocument;
|
var doc = this.target.ownerDocument;
|
||||||
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
||||||
openLinkIn(this.linkURL, "window",
|
openLinkIn(this.linkURL, "window",
|
||||||
|
|
@ -762,7 +762,7 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Open linked-to URL in a new private window.
|
// Open linked-to URL in a new private window.
|
||||||
openLinkInPrivateWindow : function () {
|
openLinkInPrivateWindow : function() {
|
||||||
var doc = this.target.ownerDocument;
|
var doc = this.target.ownerDocument;
|
||||||
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
||||||
openLinkIn(this.linkURL, "window",
|
openLinkIn(this.linkURL, "window",
|
||||||
|
|
@ -884,11 +884,11 @@ nsContextMenu.prototype = {
|
||||||
"This feature cannot be used, because it hasn't found " +
|
"This feature cannot be used, because it hasn't found " +
|
||||||
"an appropriate window.");
|
"an appropriate window.");
|
||||||
} else {
|
} else {
|
||||||
new Promise.resolve({then: function (resolve) {
|
new Promise.resolve({then: function(resolve) {
|
||||||
target.toBlob((blob) => {
|
target.toBlob((blob) => {
|
||||||
resolve(win.URL.createObjectURL(blob));
|
resolve(win.URL.createObjectURL(blob));
|
||||||
})
|
})
|
||||||
}}).then(function (blobURL) {
|
}}).then(function(blobURL) {
|
||||||
openUILink(blobURL, e, { disallowInheritPrincipal: true,
|
openUILink(blobURL, e, { disallowInheritPrincipal: true,
|
||||||
referrerURI: doc.documentURIObject });
|
referrerURI: doc.documentURIObject });
|
||||||
}, Components.utils.reportError);
|
}, Components.utils.reportError);
|
||||||
|
|
@ -905,7 +905,7 @@ nsContextMenu.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
saveVideoFrameAsImage: function () {
|
saveVideoFrameAsImage: function() {
|
||||||
let referrerURI = document.documentURIObject;
|
let referrerURI = document.documentURIObject;
|
||||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser);
|
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser);
|
||||||
|
|
||||||
|
|
@ -931,7 +931,7 @@ nsContextMenu.prototype = {
|
||||||
isPrivate);
|
isPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
fullScreenVideo: function () {
|
fullScreenVideo: function() {
|
||||||
let video = this.target;
|
let video = this.target;
|
||||||
if (document.mozFullScreenEnabled)
|
if (document.mozFullScreenEnabled)
|
||||||
video.mozRequestFullScreen();
|
video.mozRequestFullScreen();
|
||||||
|
|
@ -1008,7 +1008,7 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Save URL of clicked-on frame.
|
// Save URL of clicked-on frame.
|
||||||
saveFrame: function () {
|
saveFrame: function() {
|
||||||
saveDocument(this.target.ownerDocument);
|
saveDocument(this.target.ownerDocument);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1027,7 +1027,7 @@ nsContextMenu.prototype = {
|
||||||
saveAsListener.prototype = {
|
saveAsListener.prototype = {
|
||||||
extListener: null,
|
extListener: null,
|
||||||
|
|
||||||
onStartRequest: function (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 (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 (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 (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 (aTimer) {
|
notify: function(aTimer) {
|
||||||
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
|
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1195,11 +1195,11 @@ nsContextMenu.prototype = {
|
||||||
"This feature cannot be used, because it hasn't found " +
|
"This feature cannot be used, because it hasn't found " +
|
||||||
"an appropriate window.");
|
"an appropriate window.");
|
||||||
} else {
|
} else {
|
||||||
new Promise.resolve({then: function (resolve) {
|
new Promise.resolve({then: function(resolve) {
|
||||||
target.toBlob((blob) => {
|
target.toBlob((blob) => {
|
||||||
resolve(win.URL.createObjectURL(blob));
|
resolve(win.URL.createObjectURL(blob));
|
||||||
})
|
})
|
||||||
}}).then(function (blobURL) {
|
}}).then(function(blobURL) {
|
||||||
saveImageURL(blobURL, "canvas.png", "SaveImageTitle",
|
saveImageURL(blobURL, "canvas.png", "SaveImageTitle",
|
||||||
true, false, referrerURI, null, null, null,
|
true, false, referrerURI, null, null, null,
|
||||||
isPrivate);
|
isPrivate);
|
||||||
|
|
@ -1375,7 +1375,7 @@ nsContextMenu.prototype = {
|
||||||
return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed;
|
return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed;
|
||||||
},
|
},
|
||||||
|
|
||||||
toString: function () {
|
toString: function() {
|
||||||
return "contextMenu.target = " + this.target + "\n" +
|
return "contextMenu.target = " + this.target + "\n" +
|
||||||
"contextMenu.onImage = " + this.onImage + "\n" +
|
"contextMenu.onImage = " + this.onImage + "\n" +
|
||||||
"contextMenu.onLink = " + this.onLink + "\n" +
|
"contextMenu.onLink = " + this.onLink + "\n" +
|
||||||
|
|
@ -1427,7 +1427,7 @@ nsContextMenu.prototype = {
|
||||||
// Determines whether or not the separator with the specified ID should be
|
// 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
|
// shown or not by determining if there are any non-hidden items between it
|
||||||
// and the previous separator.
|
// and the previous separator.
|
||||||
shouldShowSeparator: function (aSeparatorID) {
|
shouldShowSeparator: function(aSeparatorID) {
|
||||||
var separator = document.getElementById(aSeparatorID);
|
var separator = document.getElementById(aSeparatorID);
|
||||||
if (separator) {
|
if (separator) {
|
||||||
var sibling = separator.previousSibling;
|
var sibling = separator.previousSibling;
|
||||||
|
|
@ -1465,11 +1465,11 @@ nsContextMenu.prototype = {
|
||||||
openUILinkIn(uri, where);
|
openUILinkIn(uri, where);
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkThisPage: function () {
|
bookmarkThisPage: function() {
|
||||||
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
|
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkLink: function () {
|
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 () {
|
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 () {
|
savePageAs: function() {
|
||||||
saveDocument(this.browser.contentDocument);
|
saveDocument(this.browser.contentDocument);
|
||||||
},
|
},
|
||||||
|
|
||||||
sendPage: function () {
|
sendPage: function() {
|
||||||
MailIntegration.sendLinkForWindow(this.browser.contentWindow);
|
MailIntegration.sendLinkForWindow(this.browser.contentWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
printFrame: function () {
|
printFrame: function() {
|
||||||
PrintUtils.print(this.target.ownerDocument.defaultView);
|
PrintUtils.print(this.target.ownerDocument.defaultView);
|
||||||
},
|
},
|
||||||
|
|
||||||
switchPageDirection: function () {
|
switchPageDirection: function() {
|
||||||
SwitchDocumentDirection(this.browser.contentWindow);
|
SwitchDocumentDirection(this.browser.contentWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
mediaCommand : function (command, data) {
|
mediaCommand : function(command, data) {
|
||||||
var media = this.target;
|
var media = this.target;
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
|
|
@ -1560,7 +1560,7 @@ nsContextMenu.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
copyMediaLocation : function () {
|
copyMediaLocation : function() {
|
||||||
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
|
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
|
||||||
getService(Ci.nsIClipboardHelper);
|
getService(Ci.nsIClipboardHelper);
|
||||||
clipboard.copyString(this.mediaURL, document);
|
clipboard.copyString(this.mediaURL, document);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ var gSanitizePromptDialog = {
|
||||||
return document.getElementById("sanitizeEverythingWarningBox");
|
return document.getElementById("sanitizeEverythingWarningBox");
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function ()
|
init: function()
|
||||||
{
|
{
|
||||||
// This is used by selectByTimespan() to determine if the window has loaded.
|
// This is used by selectByTimespan() to determine if the window has loaded.
|
||||||
this._inited = true;
|
this._inited = true;
|
||||||
|
|
@ -69,7 +69,7 @@ var gSanitizePromptDialog = {
|
||||||
this.warningBox.hidden = true;
|
this.warningBox.hidden = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectByTimespan: function ()
|
selectByTimespan: function()
|
||||||
{
|
{
|
||||||
// This method is the onselect handler for the duration dropdown. As a
|
// This method is the onselect handler for the duration dropdown. As a
|
||||||
// result it's called a couple of times before onload calls init().
|
// result it's called a couple of times before onload calls init().
|
||||||
|
|
@ -99,7 +99,7 @@ var gSanitizePromptDialog = {
|
||||||
window.document.documentElement.getAttribute("noneverythingtitle");
|
window.document.documentElement.getAttribute("noneverythingtitle");
|
||||||
},
|
},
|
||||||
|
|
||||||
sanitize: function ()
|
sanitize: function()
|
||||||
{
|
{
|
||||||
// Update pref values before handing off to the sanitizer (bug 453440)
|
// Update pref values before handing off to the sanitizer (bug 453440)
|
||||||
this.updatePrefs();
|
this.updatePrefs();
|
||||||
|
|
@ -136,7 +136,7 @@ var gSanitizePromptDialog = {
|
||||||
* True means the item list visibility status should not
|
* True means the item list visibility status should not
|
||||||
* be changed.
|
* be changed.
|
||||||
*/
|
*/
|
||||||
prepareWarning: function (aDontShowItemList) {
|
prepareWarning: function(aDontShowItemList) {
|
||||||
// If the date and time-aware locale warning string is ever used again,
|
// If the date and time-aware locale warning string is ever used again,
|
||||||
// initialize it here. Currently we use the no-visits warning string,
|
// initialize it here. Currently we use the no-visits warning string,
|
||||||
// which does not include date and time. See bug 480169 comment 48.
|
// 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
|
* Called when the value of a preference element is synced from the actual
|
||||||
* pref. Enables or disables the OK button appropriately.
|
* pref. Enables or disables the OK button appropriately.
|
||||||
*/
|
*/
|
||||||
onReadGeneric: function ()
|
onReadGeneric: function()
|
||||||
{
|
{
|
||||||
var found = false;
|
var found = false;
|
||||||
|
|
||||||
|
|
@ -193,7 +193,7 @@ var gSanitizePromptDialog = {
|
||||||
* (i.e., Windows). We must therefore manually set the prefs from their
|
* (i.e., Windows). We must therefore manually set the prefs from their
|
||||||
* corresponding preference elements.
|
* corresponding preference elements.
|
||||||
*/
|
*/
|
||||||
updatePrefs : function ()
|
updatePrefs : function()
|
||||||
{
|
{
|
||||||
var tsPref = document.getElementById("privacy.sanitize.timeSpan");
|
var tsPref = document.getElementById("privacy.sanitize.timeSpan");
|
||||||
Sanitizer.prefs.setIntPref("timeSpan", this.selectedTimespan);
|
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.
|
* Check if all of the history items have been selected like the default status.
|
||||||
*/
|
*/
|
||||||
hasNonSelectedItems: function () {
|
hasNonSelectedItems: function() {
|
||||||
let checkboxes = document.querySelectorAll("#itemList > [preference]");
|
let checkboxes = document.querySelectorAll("#itemList > [preference]");
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
let pref = document.getElementById(checkboxes[i].getAttribute("preference"));
|
let pref = document.getElementById(checkboxes[i].getAttribute("preference"));
|
||||||
|
|
@ -227,7 +227,7 @@ var gSanitizePromptDialog = {
|
||||||
/**
|
/**
|
||||||
* Show the history items list.
|
* Show the history items list.
|
||||||
*/
|
*/
|
||||||
showItemList: function () {
|
showItemList: function() {
|
||||||
var itemList = document.getElementById("itemList");
|
var itemList = document.getElementById("itemList");
|
||||||
var expanderButton = document.getElementById("detailsExpander");
|
var expanderButton = document.getElementById("detailsExpander");
|
||||||
|
|
||||||
|
|
@ -242,7 +242,7 @@ var gSanitizePromptDialog = {
|
||||||
/**
|
/**
|
||||||
* Hide the history items list.
|
* Hide the history items list.
|
||||||
*/
|
*/
|
||||||
hideItemList: function () {
|
hideItemList: function() {
|
||||||
var itemList = document.getElementById("itemList");
|
var itemList = document.getElementById("itemList");
|
||||||
var expanderButton = document.getElementById("detailsExpander");
|
var expanderButton = document.getElementById("detailsExpander");
|
||||||
|
|
||||||
|
|
@ -256,7 +256,7 @@ var gSanitizePromptDialog = {
|
||||||
/**
|
/**
|
||||||
* Called by the item list expander button to toggle the list's visibility.
|
* Called by the item list expander button to toggle the list's visibility.
|
||||||
*/
|
*/
|
||||||
toggleItemList: function ()
|
toggleItemList: function()
|
||||||
{
|
{
|
||||||
var itemList = document.getElementById("itemList");
|
var itemList = document.getElementById("itemList");
|
||||||
|
|
||||||
|
|
@ -282,7 +282,7 @@ var gSanitizePromptDialog = {
|
||||||
return this._placesTree;
|
return this._placesTree;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function ()
|
init: function()
|
||||||
{
|
{
|
||||||
// This is used by selectByTimespan() to determine if the window has loaded.
|
// This is used by selectByTimespan() to determine if the window has loaded.
|
||||||
this._inited = true;
|
this._inited = true;
|
||||||
|
|
@ -315,7 +315,7 @@ var gSanitizePromptDialog = {
|
||||||
* the tree to duration values, and this.durationStartTimes, which maps
|
* the tree to duration values, and this.durationStartTimes, which maps
|
||||||
* duration values to their corresponding start times.
|
* duration values to their corresponding start times.
|
||||||
*/
|
*/
|
||||||
initDurationDropdown: function ()
|
initDurationDropdown: function()
|
||||||
{
|
{
|
||||||
// First, calculate the start times for each duration.
|
// First, calculate the start times for each duration.
|
||||||
this.durationStartTimes = {};
|
this.durationStartTimes = {};
|
||||||
|
|
@ -379,7 +379,7 @@ var gSanitizePromptDialog = {
|
||||||
/**
|
/**
|
||||||
* If the Places tree is not set up, sets it up. Otherwise does nothing.
|
* If the Places tree is not set up, sets it up. Otherwise does nothing.
|
||||||
*/
|
*/
|
||||||
ensurePlacesTreeIsInited: function ()
|
ensurePlacesTreeIsInited: function()
|
||||||
{
|
{
|
||||||
if (this._placesTreeIsInited)
|
if (this._placesTreeIsInited)
|
||||||
return;
|
return;
|
||||||
|
|
@ -420,7 +420,7 @@ var gSanitizePromptDialog = {
|
||||||
* the tree that are contained in the selected duration. If clearing
|
* the tree that are contained in the selected duration. If clearing
|
||||||
* everything, the warning panel is shown instead.
|
* everything, the warning panel is shown instead.
|
||||||
*/
|
*/
|
||||||
selectByTimespan: function ()
|
selectByTimespan: function()
|
||||||
{
|
{
|
||||||
// This method is the onselect handler for the duration dropdown. As a
|
// This method is the onselect handler for the duration dropdown. As a
|
||||||
// result it's called a couple of times before onload calls init().
|
// 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;
|
document.documentElement.getButton("accept").disabled = durRow < 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
sanitize: function ()
|
sanitize: function()
|
||||||
{
|
{
|
||||||
// Update pref values before handing off to the sanitizer (bug 453440)
|
// Update pref values before handing off to the sanitizer (bug 453440)
|
||||||
this.updatePrefs();
|
this.updatePrefs();
|
||||||
|
|
@ -515,7 +515,7 @@ var gSanitizePromptDialog = {
|
||||||
* for garbage collection, we need to break the reference cycle between the
|
* for garbage collection, we need to break the reference cycle between the
|
||||||
* two.
|
* two.
|
||||||
*/
|
*/
|
||||||
unload: function ()
|
unload: function()
|
||||||
{
|
{
|
||||||
let result = this.placesTree.getResult();
|
let result = this.placesTree.getResult();
|
||||||
result.removeObserver(this.placesTree.view);
|
result.removeObserver(this.placesTree.view);
|
||||||
|
|
@ -533,7 +533,7 @@ var gSanitizePromptDialog = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The event captured in the event handler.
|
* The event captured in the event handler.
|
||||||
*/
|
*/
|
||||||
grippyMoved: function (aEventName, aEvent)
|
grippyMoved: function(aEventName, aEvent)
|
||||||
{
|
{
|
||||||
gContiguousSelectionTreeHelper[aEventName](aEvent);
|
gContiguousSelectionTreeHelper[aEventName](aEvent);
|
||||||
var lastSelRow = gContiguousSelectionTreeHelper.getGrippyRow() - 1;
|
var lastSelRow = gContiguousSelectionTreeHelper.getGrippyRow() - 1;
|
||||||
|
|
@ -589,7 +589,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* view
|
* view
|
||||||
* @return The new view
|
* @return The new view
|
||||||
*/
|
*/
|
||||||
setTree: function (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 ()
|
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 (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 (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 (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 (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 (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 ()
|
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 (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 (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 ()
|
function()
|
||||||
{
|
{
|
||||||
return this._rowCount + 1;
|
return this._rowCount + 1;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,12 @@ DistributionCustomizer.prototype = {
|
||||||
return this._ioSvc;
|
return this._ioSvc;
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeURI: function (spec) {
|
_makeURI: function(spec) {
|
||||||
return this._ioSvc.newURI(spec, null, null);
|
return this._ioSvc.newURI(spec, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_parseBookmarksSection:
|
_parseBookmarksSection:
|
||||||
function (parentId, section) {
|
function(parentId, section) {
|
||||||
let keys = [];
|
let keys = [];
|
||||||
for (let i in enumerate(this._ini.getKeys(section)))
|
for (let i in enumerate(this._ini.getKeys(section)))
|
||||||
keys.push(i);
|
keys.push(i);
|
||||||
|
|
@ -177,7 +177,7 @@ DistributionCustomizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_customizationsApplied: false,
|
_customizationsApplied: false,
|
||||||
applyCustomizations: function () {
|
applyCustomizations: function() {
|
||||||
this._customizationsApplied = true;
|
this._customizationsApplied = true;
|
||||||
if (!this._iniFile)
|
if (!this._iniFile)
|
||||||
return this._checkCustomizationComplete();
|
return this._checkCustomizationComplete();
|
||||||
|
|
@ -190,7 +190,7 @@ DistributionCustomizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_bookmarksApplied: false,
|
_bookmarksApplied: false,
|
||||||
applyBookmarks: function () {
|
applyBookmarks: function() {
|
||||||
this._bookmarksApplied = true;
|
this._bookmarksApplied = true;
|
||||||
if (!this._iniFile)
|
if (!this._iniFile)
|
||||||
return this._checkCustomizationComplete();
|
return this._checkCustomizationComplete();
|
||||||
|
|
@ -230,7 +230,7 @@ DistributionCustomizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_prefDefaultsApplied: false,
|
_prefDefaultsApplied: false,
|
||||||
applyPrefDefaults: function () {
|
applyPrefDefaults: function() {
|
||||||
this._prefDefaultsApplied = true;
|
this._prefDefaultsApplied = true;
|
||||||
if (!this._iniFile)
|
if (!this._iniFile)
|
||||||
return this._checkCustomizationComplete();
|
return this._checkCustomizationComplete();
|
||||||
|
|
@ -321,7 +321,7 @@ DistributionCustomizer.prototype = {
|
||||||
return this._checkCustomizationComplete();
|
return this._checkCustomizationComplete();
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkCustomizationComplete: function () {
|
_checkCustomizationComplete: function() {
|
||||||
let prefDefaultsApplied = this._prefDefaultsApplied || !this._iniFile;
|
let prefDefaultsApplied = this._prefDefaultsApplied || !this._iniFile;
|
||||||
if (this._customizationsApplied && this._bookmarksApplied &&
|
if (this._customizationsApplied && this._bookmarksApplied &&
|
||||||
prefDefaultsApplied) {
|
prefDefaultsApplied) {
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const kPrefBranch = Services.prefs.getBranch("browser.download.");
|
||||||
var PrefObserver = {
|
var PrefObserver = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||||
Ci.nsISupportsWeakReference]),
|
Ci.nsISupportsWeakReference]),
|
||||||
getPref: function (name) {
|
getPref: function(name) {
|
||||||
try {
|
try {
|
||||||
switch (typeof this.prefs[name]) {
|
switch (typeof this.prefs[name]) {
|
||||||
case "boolean":
|
case "boolean":
|
||||||
|
|
@ -106,17 +106,17 @@ var PrefObserver = {
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
return this.prefs[name];
|
return this.prefs[name];
|
||||||
},
|
},
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
if (this.prefs.hasOwnProperty(aData)) {
|
if (this.prefs.hasOwnProperty(aData)) {
|
||||||
return this[aData] = this.getPref(aData);
|
return this[aData] = this.getPref(aData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
register: function (prefs) {
|
register: function(prefs) {
|
||||||
this.prefs = prefs;
|
this.prefs = prefs;
|
||||||
kPrefBranch.addObserver("", this, true);
|
kPrefBranch.addObserver("", this, true);
|
||||||
for (let key in prefs) {
|
for (let key in prefs) {
|
||||||
let name = key;
|
let name = key;
|
||||||
XPCOMUtils.defineLazyGetter(this, name, function () {
|
XPCOMUtils.defineLazyGetter(this, name, function() {
|
||||||
return PrefObserver.getPref(name);
|
return PrefObserver.getPref(name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -138,9 +138,9 @@ PrefObserver.register({
|
||||||
* and provides shared methods for all the instances of the user interface.
|
* and provides shared methods for all the instances of the user interface.
|
||||||
*/
|
*/
|
||||||
this.DownloadsCommon = {
|
this.DownloadsCommon = {
|
||||||
log: function (...aMessageArgs) {
|
log: function(...aMessageArgs) {
|
||||||
delete this.log;
|
delete this.log;
|
||||||
this.log = function (...aMessageArgs) {
|
this.log = function(...aMessageArgs) {
|
||||||
if (!PrefObserver.debug) {
|
if (!PrefObserver.debug) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -149,9 +149,9 @@ this.DownloadsCommon = {
|
||||||
this.log.apply(this, aMessageArgs);
|
this.log.apply(this, aMessageArgs);
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function (...aMessageArgs) {
|
error: function(...aMessageArgs) {
|
||||||
delete this.error;
|
delete this.error;
|
||||||
this.error = function (...aMessageArgs) {
|
this.error = function(...aMessageArgs) {
|
||||||
if (!PrefObserver.debug) {
|
if (!PrefObserver.debug) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -173,14 +173,14 @@ this.DownloadsCommon = {
|
||||||
let string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
|
let string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
|
||||||
let stringName = string.key;
|
let stringName = string.key;
|
||||||
if (stringName in kDownloadsStringsRequiringFormatting) {
|
if (stringName in kDownloadsStringsRequiringFormatting) {
|
||||||
strings[stringName] = function () {
|
strings[stringName] = function() {
|
||||||
// Convert "arguments" to a real array before calling into XPCOM.
|
// Convert "arguments" to a real array before calling into XPCOM.
|
||||||
return sb.formatStringFromName(stringName,
|
return sb.formatStringFromName(stringName,
|
||||||
Array.slice(arguments, 0),
|
Array.slice(arguments, 0),
|
||||||
arguments.length);
|
arguments.length);
|
||||||
};
|
};
|
||||||
} else if (stringName in kDownloadsStringsRequiringPluralForm) {
|
} else if (stringName in kDownloadsStringsRequiringPluralForm) {
|
||||||
strings[stringName] = function (aCount) {
|
strings[stringName] = function(aCount) {
|
||||||
// Convert "arguments" to a real array before calling into XPCOM.
|
// Convert "arguments" to a real array before calling into XPCOM.
|
||||||
let formattedString = sb.formatStringFromName(stringName,
|
let formattedString = sb.formatStringFromName(stringName,
|
||||||
Array.slice(arguments, 0),
|
Array.slice(arguments, 0),
|
||||||
|
|
@ -205,7 +205,7 @@ this.DownloadsCommon = {
|
||||||
* @return Formatted string, for example "30s" or "2h". The returned value is
|
* @return Formatted string, for example "30s" or "2h". The returned value is
|
||||||
* maximum three characters long, at least in English.
|
* maximum three characters long, at least in English.
|
||||||
*/
|
*/
|
||||||
formatTimeLeft: function (aSeconds)
|
formatTimeLeft: function(aSeconds)
|
||||||
{
|
{
|
||||||
// Decide what text to show for the time
|
// Decide what text to show for the time
|
||||||
let seconds = Math.round(aSeconds);
|
let seconds = Math.round(aSeconds);
|
||||||
|
|
@ -259,7 +259,7 @@ this.DownloadsCommon = {
|
||||||
* @param aWindow
|
* @param aWindow
|
||||||
* The browser window which owns the download button.
|
* The browser window which owns the download button.
|
||||||
*/
|
*/
|
||||||
getData: function (aWindow) {
|
getData: function(aWindow) {
|
||||||
if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
|
if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
|
||||||
return PrivateDownloadsData;
|
return PrivateDownloadsData;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -277,7 +277,7 @@ this.DownloadsCommon = {
|
||||||
* called, and we must ensure to register our listeners before the
|
* called, and we must ensure to register our listeners before the
|
||||||
* getService call for the Download Manager returns.
|
* getService call for the Download Manager returns.
|
||||||
*/
|
*/
|
||||||
initializeAllDataLinks: function (aDownloadManagerService) {
|
initializeAllDataLinks: function(aDownloadManagerService) {
|
||||||
DownloadsData.initializeDataLink(aDownloadManagerService);
|
DownloadsData.initializeDataLink(aDownloadManagerService);
|
||||||
PrivateDownloadsData.initializeDataLink(aDownloadManagerService);
|
PrivateDownloadsData.initializeDataLink(aDownloadManagerService);
|
||||||
},
|
},
|
||||||
|
|
@ -286,7 +286,7 @@ this.DownloadsCommon = {
|
||||||
* Terminates the data link for both the private and non-private downloads
|
* Terminates the data link for both the private and non-private downloads
|
||||||
* data objects.
|
* data objects.
|
||||||
*/
|
*/
|
||||||
terminateAllDataLinks: function () {
|
terminateAllDataLinks: function() {
|
||||||
DownloadsData.terminateDataLink();
|
DownloadsData.terminateDataLink();
|
||||||
PrivateDownloadsData.terminateDataLink();
|
PrivateDownloadsData.terminateDataLink();
|
||||||
},
|
},
|
||||||
|
|
@ -299,7 +299,7 @@ this.DownloadsCommon = {
|
||||||
* True to load only active downloads from the database.
|
* True to load only active downloads from the database.
|
||||||
*/
|
*/
|
||||||
ensureAllPersistentDataLoaded:
|
ensureAllPersistentDataLoaded:
|
||||||
function (aActiveOnly) {
|
function(aActiveOnly) {
|
||||||
DownloadsData.ensurePersistentDataLoaded(aActiveOnly);
|
DownloadsData.ensurePersistentDataLoaded(aActiveOnly);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -308,7 +308,7 @@ this.DownloadsCommon = {
|
||||||
* PrivateDownloadsIndicatorData objects, depending on the privacy status of
|
* PrivateDownloadsIndicatorData objects, depending on the privacy status of
|
||||||
* the window in question.
|
* the window in question.
|
||||||
*/
|
*/
|
||||||
getIndicatorData: function (aWindow) {
|
getIndicatorData: function(aWindow) {
|
||||||
if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
|
if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
|
||||||
return PrivateDownloadsIndicatorData;
|
return PrivateDownloadsIndicatorData;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -326,7 +326,7 @@ this.DownloadsCommon = {
|
||||||
* The number of items on the top of the downloads list to exclude
|
* The number of items on the top of the downloads list to exclude
|
||||||
* from the summary.
|
* from the summary.
|
||||||
*/
|
*/
|
||||||
getSummary: function (aWindow, aNumToExclude)
|
getSummary: function(aWindow, aNumToExclude)
|
||||||
{
|
{
|
||||||
if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
|
if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
|
||||||
if (this._privateSummary) {
|
if (this._privateSummary) {
|
||||||
|
|
@ -465,7 +465,7 @@ this.DownloadsCommon = {
|
||||||
* downloads. This is a floating point value to help get sub-second
|
* downloads. This is a floating point value to help get sub-second
|
||||||
* accuracy for current and future estimates.
|
* accuracy for current and future estimates.
|
||||||
*/
|
*/
|
||||||
smoothSeconds: function (aSeconds, aLastSeconds)
|
smoothSeconds: function(aSeconds, aLastSeconds)
|
||||||
{
|
{
|
||||||
// We apply an algorithm similar to the DownloadUtils.getTimeLeft function,
|
// We apply an algorithm similar to the DownloadUtils.getTimeLeft function,
|
||||||
// though tailored to a single time estimation for all downloads. We never
|
// though tailored to a single time estimation for all downloads. We never
|
||||||
|
|
@ -503,7 +503,7 @@ this.DownloadsCommon = {
|
||||||
* @param aOwnerWindow
|
* @param aOwnerWindow
|
||||||
* the window with which this action is associated.
|
* the window with which this action is associated.
|
||||||
*/
|
*/
|
||||||
openDownloadedFile: function (aFile, aMimeInfo, aOwnerWindow) {
|
openDownloadedFile: function(aFile, aMimeInfo, aOwnerWindow) {
|
||||||
if (!(aFile instanceof Ci.nsIFile))
|
if (!(aFile instanceof Ci.nsIFile))
|
||||||
throw new Error("aFile must be a nsIFile object");
|
throw new Error("aFile must be a nsIFile object");
|
||||||
if (aMimeInfo && !(aMimeInfo instanceof Ci.nsIMIMEInfo))
|
if (aMimeInfo && !(aMimeInfo instanceof Ci.nsIMIMEInfo))
|
||||||
|
|
@ -572,7 +572,7 @@ this.DownloadsCommon = {
|
||||||
* @param aFile
|
* @param aFile
|
||||||
* a downloaded file.
|
* a downloaded file.
|
||||||
*/
|
*/
|
||||||
showDownloadedFile: function (aFile) {
|
showDownloadedFile: function(aFile) {
|
||||||
if (!(aFile instanceof Ci.nsIFile))
|
if (!(aFile instanceof Ci.nsIFile))
|
||||||
throw new Error("aFile must be a nsIFile object");
|
throw new Error("aFile must be a nsIFile object");
|
||||||
try {
|
try {
|
||||||
|
|
@ -601,7 +601,7 @@ this.DownloadsCommon = {
|
||||||
/**
|
/**
|
||||||
* Returns true if we are executing on Windows Vista or a later version.
|
* Returns true if we are executing on Windows Vista or a later version.
|
||||||
*/
|
*/
|
||||||
XPCOMUtils.defineLazyGetter(DownloadsCommon, "isWinVistaOrHigher", function () {
|
XPCOMUtils.defineLazyGetter(DownloadsCommon, "isWinVistaOrHigher", function() {
|
||||||
let os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
|
let os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
|
||||||
if (os != "WINNT") {
|
if (os != "WINNT") {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -615,7 +615,7 @@ XPCOMUtils.defineLazyGetter(DownloadsCommon, "isWinVistaOrHigher", function () {
|
||||||
* for downloads instead of the nsIDownloadManager back-end.
|
* for downloads instead of the nsIDownloadManager back-end.
|
||||||
* This is kept for compatibility/leftovers and should be removed later.
|
* This is kept for compatibility/leftovers and should be removed later.
|
||||||
*/
|
*/
|
||||||
XPCOMUtils.defineLazyGetter(DownloadsCommon, "useJSTransfer", function () {
|
XPCOMUtils.defineLazyGetter(DownloadsCommon, "useJSTransfer", function() {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -669,7 +669,7 @@ DownloadsDataCtor.prototype = {
|
||||||
/**
|
/**
|
||||||
* Stops receiving events for current downloads and cancels any pending read.
|
* Stops receiving events for current downloads and cancels any pending read.
|
||||||
*/
|
*/
|
||||||
terminateDataLink: function ()
|
terminateDataLink: function()
|
||||||
{
|
{
|
||||||
Cu.reportError("terminateDataLink not applicable with JS Transfers");
|
Cu.reportError("terminateDataLink not applicable with JS Transfers");
|
||||||
return;
|
return;
|
||||||
|
|
@ -698,7 +698,7 @@ DownloadsDataCtor.prototype = {
|
||||||
/**
|
/**
|
||||||
* Asks the back-end to remove finished downloads from the list.
|
* Asks the back-end to remove finished downloads from the list.
|
||||||
*/
|
*/
|
||||||
removeFinished: function ()
|
removeFinished: function()
|
||||||
{
|
{
|
||||||
let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE
|
let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE
|
||||||
: Downloads.PUBLIC);
|
: Downloads.PUBLIC);
|
||||||
|
|
@ -804,7 +804,7 @@ DownloadsDataCtor.prototype = {
|
||||||
* DownloadsView object to be added. This reference must be passed to
|
* DownloadsView object to be added. This reference must be passed to
|
||||||
* removeView before termination.
|
* removeView before termination.
|
||||||
*/
|
*/
|
||||||
addView: function (aView)
|
addView: function(aView)
|
||||||
{
|
{
|
||||||
this._views.push(aView);
|
this._views.push(aView);
|
||||||
this._updateView(aView);
|
this._updateView(aView);
|
||||||
|
|
@ -816,7 +816,7 @@ DownloadsDataCtor.prototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* DownloadsView object to be removed.
|
* DownloadsView object to be removed.
|
||||||
*/
|
*/
|
||||||
removeView: function (aView)
|
removeView: function(aView)
|
||||||
{
|
{
|
||||||
let index = this._views.indexOf(aView);
|
let index = this._views.indexOf(aView);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|
@ -830,7 +830,7 @@ DownloadsDataCtor.prototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* DownloadsView object to be initialized.
|
* DownloadsView object to be initialized.
|
||||||
*/
|
*/
|
||||||
_updateView: function (aView)
|
_updateView: function(aView)
|
||||||
{
|
{
|
||||||
// Indicate to the view that a batch loading operation is in progress.
|
// Indicate to the view that a batch loading operation is in progress.
|
||||||
aView.onDataLoadStarting();
|
aView.onDataLoadStarting();
|
||||||
|
|
@ -857,7 +857,7 @@ DownloadsDataCtor.prototype = {
|
||||||
/**
|
/**
|
||||||
* Clears the loaded data.
|
* Clears the loaded data.
|
||||||
*/
|
*/
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
this._terminateDataAccess();
|
this._terminateDataAccess();
|
||||||
this.dataItems = {};
|
this.dataItems = {};
|
||||||
|
|
@ -890,7 +890,7 @@ DownloadsDataCtor.prototype = {
|
||||||
* @return New or existing data item, or null if the item was deleted from the
|
* @return New or existing data item, or null if the item was deleted from the
|
||||||
* list of available downloads.
|
* list of available downloads.
|
||||||
*/
|
*/
|
||||||
_getOrAddDataItem: function (aSource, aMayReuseGUID)
|
_getOrAddDataItem: function(aSource, aMayReuseGUID)
|
||||||
{
|
{
|
||||||
let downloadGuid = (aSource instanceof Ci.nsIDownload)
|
let downloadGuid = (aSource instanceof Ci.nsIDownload)
|
||||||
? aSource.guid
|
? aSource.guid
|
||||||
|
|
@ -910,7 +910,7 @@ DownloadsDataCtor.prototype = {
|
||||||
// Create the view items before returning.
|
// Create the view items before returning.
|
||||||
let addToStartOfList = aSource instanceof Ci.nsIDownload;
|
let addToStartOfList = aSource instanceof Ci.nsIDownload;
|
||||||
this._views.forEach(
|
this._views.forEach(
|
||||||
function (view) view.onDataItemAdded(dataItem, addToStartOfList)
|
function(view) view.onDataItemAdded(dataItem, addToStartOfList)
|
||||||
);
|
);
|
||||||
return dataItem;
|
return dataItem;
|
||||||
},
|
},
|
||||||
|
|
@ -920,13 +920,13 @@ DownloadsDataCtor.prototype = {
|
||||||
*
|
*
|
||||||
* This method can be called at most once per download identifier.
|
* This method can be called at most once per download identifier.
|
||||||
*/
|
*/
|
||||||
_removeDataItem: function (aDownloadId)
|
_removeDataItem: function(aDownloadId)
|
||||||
{
|
{
|
||||||
if (aDownloadId in this.dataItems) {
|
if (aDownloadId in this.dataItems) {
|
||||||
let dataItem = this.dataItems[aDownloadId];
|
let dataItem = this.dataItems[aDownloadId];
|
||||||
this.dataItems[aDownloadId] = null;
|
this.dataItems[aDownloadId] = null;
|
||||||
this._views.forEach(
|
this._views.forEach(
|
||||||
function (view) view.onDataItemRemoved(dataItem)
|
function(view) view.onDataItemRemoved(dataItem)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -961,7 +961,7 @@ DownloadsDataCtor.prototype = {
|
||||||
* True to load only active downloads from the database.
|
* True to load only active downloads from the database.
|
||||||
*/
|
*/
|
||||||
ensurePersistentDataLoaded:
|
ensurePersistentDataLoaded:
|
||||||
function (aActiveOnly)
|
function(aActiveOnly)
|
||||||
{
|
{
|
||||||
if (this == PrivateDownloadsData) {
|
if (this == PrivateDownloadsData) {
|
||||||
Cu.reportError("ensurePersistentDataLoaded should not be called on PrivateDownloadsData");
|
Cu.reportError("ensurePersistentDataLoaded should not be called on PrivateDownloadsData");
|
||||||
|
|
@ -978,7 +978,7 @@ DownloadsDataCtor.prototype = {
|
||||||
DownloadsCommon.log("Loading only active downloads from the persistence database");
|
DownloadsCommon.log("Loading only active downloads from the persistence database");
|
||||||
// Indicate to the views that a batch loading operation is in progress.
|
// Indicate to the views that a batch loading operation is in progress.
|
||||||
this._views.forEach(
|
this._views.forEach(
|
||||||
function (view) view.onDataLoadStarting()
|
function(view) view.onDataLoadStarting()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Reload the list using the Download Manager service. The list is
|
// Reload the list using the Download Manager service. The list is
|
||||||
|
|
@ -992,7 +992,7 @@ DownloadsDataCtor.prototype = {
|
||||||
|
|
||||||
// Indicate to the views that the batch loading operation is complete.
|
// Indicate to the views that the batch loading operation is complete.
|
||||||
this._views.forEach(
|
this._views.forEach(
|
||||||
function (view) view.onDataLoadCompleted()
|
function(view) view.onDataLoadCompleted()
|
||||||
);
|
);
|
||||||
DownloadsCommon.log("Active downloads done loading.");
|
DownloadsCommon.log("Active downloads done loading.");
|
||||||
}
|
}
|
||||||
|
|
@ -1022,7 +1022,7 @@ DownloadsDataCtor.prototype = {
|
||||||
/**
|
/**
|
||||||
* Cancels any pending data access and ensures views are notified.
|
* Cancels any pending data access and ensures views are notified.
|
||||||
*/
|
*/
|
||||||
_terminateDataAccess: function ()
|
_terminateDataAccess: function()
|
||||||
{
|
{
|
||||||
if (this._pendingStatement) {
|
if (this._pendingStatement) {
|
||||||
this._pendingStatement.cancel();
|
this._pendingStatement.cancel();
|
||||||
|
|
@ -1032,14 +1032,14 @@ DownloadsDataCtor.prototype = {
|
||||||
// Close all the views on the current data. Create a copy of the array
|
// Close all the views on the current data. Create a copy of the array
|
||||||
// because some views might unregister while processing this event.
|
// because some views might unregister while processing this event.
|
||||||
Array.slice(this._views, 0).forEach(
|
Array.slice(this._views, 0).forEach(
|
||||||
function (view) view.onDataInvalidated()
|
function(view) view.onDataInvalidated()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// mozIStorageStatementCallback
|
//// mozIStorageStatementCallback
|
||||||
|
|
||||||
handleResult: function (aResultSet)
|
handleResult: function(aResultSet)
|
||||||
{
|
{
|
||||||
for (let row = aResultSet.getNextRow();
|
for (let row = aResultSet.getNextRow();
|
||||||
row;
|
row;
|
||||||
|
|
@ -1051,13 +1051,13 @@ DownloadsDataCtor.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleError: function (aError)
|
handleError: function(aError)
|
||||||
{
|
{
|
||||||
DownloadsCommon.error("Database statement execution error (",
|
DownloadsCommon.error("Database statement execution error (",
|
||||||
aError.result, "): ", aError.message);
|
aError.result, "): ", aError.message);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCompletion: function (aReason)
|
handleCompletion: function(aReason)
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Loading all downloads from database completed with reason:",
|
DownloadsCommon.log("Loading all downloads from database completed with reason:",
|
||||||
aReason);
|
aReason);
|
||||||
|
|
@ -1076,14 +1076,14 @@ DownloadsDataCtor.prototype = {
|
||||||
// would open and immediately close. This case is rare enough not to need a
|
// would open and immediately close. This case is rare enough not to need a
|
||||||
// special treatment.
|
// special treatment.
|
||||||
this._views.forEach(
|
this._views.forEach(
|
||||||
function (view) view.onDataLoadCompleted()
|
function(view) view.onDataLoadCompleted()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// nsIObserver
|
//// nsIObserver
|
||||||
|
|
||||||
observe: function (aSubject, aTopic, aData)
|
observe: function(aSubject, aTopic, aData)
|
||||||
{
|
{
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "download-manager-remove-download-guid":
|
case "download-manager-remove-download-guid":
|
||||||
|
|
@ -1121,7 +1121,7 @@ DownloadsDataCtor.prototype = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// nsIDownloadProgressListener
|
//// nsIDownloadProgressListener
|
||||||
|
|
||||||
onDownloadStateChange: function (aOldState, aDownload)
|
onDownloadStateChange: function(aOldState, aDownload)
|
||||||
{
|
{
|
||||||
if (aDownload.isPrivate != this._isPrivate) {
|
if (aDownload.isPrivate != this._isPrivate) {
|
||||||
// Ignore the downloads with a privacy status other than what we are
|
// Ignore the downloads with a privacy status other than what we are
|
||||||
|
|
@ -1202,7 +1202,7 @@ DownloadsDataCtor.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onProgressChange: function (aWebProgress, aRequest,
|
onProgressChange: function(aWebProgress, aRequest,
|
||||||
aCurSelfProgress,
|
aCurSelfProgress,
|
||||||
aMaxSelfProgress,
|
aMaxSelfProgress,
|
||||||
aCurTotalProgress,
|
aCurTotalProgress,
|
||||||
|
|
@ -1225,13 +1225,13 @@ DownloadsDataCtor.prototype = {
|
||||||
dataItem.percentComplete = aDownload.percentComplete;
|
dataItem.percentComplete = aDownload.percentComplete;
|
||||||
|
|
||||||
this._views.forEach(
|
this._views.forEach(
|
||||||
function (view) view.getViewItem(dataItem).onProgressChange()
|
function(view) view.getViewItem(dataItem).onProgressChange()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
onStateChange: function () { },
|
onStateChange: function() { },
|
||||||
|
|
||||||
onSecurityChange: function () { },
|
onSecurityChange: function() { },
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// Notifications sent to the most recent browser window only
|
//// Notifications sent to the most recent browser window only
|
||||||
|
|
@ -1259,7 +1259,7 @@ DownloadsDataCtor.prototype = {
|
||||||
* @param aType
|
* @param aType
|
||||||
* Set to "start" for new downloads, "finish" for completed downloads.
|
* Set to "start" for new downloads, "finish" for completed downloads.
|
||||||
*/
|
*/
|
||||||
_notifyDownloadEvent: function (aType)
|
_notifyDownloadEvent: function(aType)
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Attempting to notify that a new download has started or finished.");
|
DownloadsCommon.log("Attempting to notify that a new download has started or finished.");
|
||||||
if (DownloadsCommon.useToolkitUI) {
|
if (DownloadsCommon.useToolkitUI) {
|
||||||
|
|
@ -1329,7 +1329,7 @@ const DownloadsViewPrototype = {
|
||||||
* View object to be added. This reference must be
|
* View object to be added. This reference must be
|
||||||
* passed to removeView before termination.
|
* passed to removeView before termination.
|
||||||
*/
|
*/
|
||||||
addView: function (aView)
|
addView: function(aView)
|
||||||
{
|
{
|
||||||
// Start receiving events when the first of our views is registered.
|
// Start receiving events when the first of our views is registered.
|
||||||
if (this._views.length == 0) {
|
if (this._views.length == 0) {
|
||||||
|
|
@ -1350,7 +1350,7 @@ const DownloadsViewPrototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* View object to be updated.
|
* View object to be updated.
|
||||||
*/
|
*/
|
||||||
refreshView: function (aView)
|
refreshView: function(aView)
|
||||||
{
|
{
|
||||||
// Update immediately even if we are still loading data asynchronously.
|
// Update immediately even if we are still loading data asynchronously.
|
||||||
// Subclasses must provide these two functions!
|
// Subclasses must provide these two functions!
|
||||||
|
|
@ -1364,7 +1364,7 @@ const DownloadsViewPrototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* View object to be removed.
|
* View object to be removed.
|
||||||
*/
|
*/
|
||||||
removeView: function (aView)
|
removeView: function(aView)
|
||||||
{
|
{
|
||||||
let index = this._views.indexOf(aView);
|
let index = this._views.indexOf(aView);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|
@ -1392,7 +1392,7 @@ const DownloadsViewPrototype = {
|
||||||
/**
|
/**
|
||||||
* Called before multiple downloads are about to be loaded.
|
* Called before multiple downloads are about to be loaded.
|
||||||
*/
|
*/
|
||||||
onDataLoadStarting: function ()
|
onDataLoadStarting: function()
|
||||||
{
|
{
|
||||||
this._loading = true;
|
this._loading = true;
|
||||||
},
|
},
|
||||||
|
|
@ -1400,7 +1400,7 @@ const DownloadsViewPrototype = {
|
||||||
/**
|
/**
|
||||||
* Called after data loading finished.
|
* Called after data loading finished.
|
||||||
*/
|
*/
|
||||||
onDataLoadCompleted: function ()
|
onDataLoadCompleted: function()
|
||||||
{
|
{
|
||||||
this._loading = false;
|
this._loading = false;
|
||||||
},
|
},
|
||||||
|
|
@ -1412,7 +1412,7 @@ const DownloadsViewPrototype = {
|
||||||
*
|
*
|
||||||
* @note Subclasses should override this.
|
* @note Subclasses should override this.
|
||||||
*/
|
*/
|
||||||
onDataInvalidated: function ()
|
onDataInvalidated: function()
|
||||||
{
|
{
|
||||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
},
|
},
|
||||||
|
|
@ -1481,7 +1481,7 @@ const DownloadsViewPrototype = {
|
||||||
*
|
*
|
||||||
* @note Subclasses should override this.
|
* @note Subclasses should override this.
|
||||||
*/
|
*/
|
||||||
_refreshProperties: function ()
|
_refreshProperties: function()
|
||||||
{
|
{
|
||||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
},
|
},
|
||||||
|
|
@ -1491,7 +1491,7 @@ const DownloadsViewPrototype = {
|
||||||
*
|
*
|
||||||
* @note Subclasses should override this.
|
* @note Subclasses should override this.
|
||||||
*/
|
*/
|
||||||
_updateView: function ()
|
_updateView: function()
|
||||||
{
|
{
|
||||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
@ -1523,7 +1523,7 @@ DownloadsIndicatorDataCtor.prototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* DownloadsIndicatorView object to be removed.
|
* DownloadsIndicatorView object to be removed.
|
||||||
*/
|
*/
|
||||||
removeView: function (aView)
|
removeView: function(aView)
|
||||||
{
|
{
|
||||||
DownloadsViewPrototype.removeView.call(this, aView);
|
DownloadsViewPrototype.removeView.call(this, aView);
|
||||||
|
|
||||||
|
|
@ -1535,7 +1535,7 @@ DownloadsIndicatorDataCtor.prototype = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// Callback functions from DownloadsData
|
//// Callback functions from DownloadsData
|
||||||
|
|
||||||
onDataLoadCompleted: function ()
|
onDataLoadCompleted: function()
|
||||||
{
|
{
|
||||||
DownloadsViewPrototype.onDataLoadCompleted.call(this);
|
DownloadsViewPrototype.onDataLoadCompleted.call(this);
|
||||||
this._updateViews();
|
this._updateViews();
|
||||||
|
|
@ -1546,7 +1546,7 @@ DownloadsIndicatorDataCtor.prototype = {
|
||||||
* entered Private Browsing Mode and the database backend changed).
|
* entered Private Browsing Mode and the database backend changed).
|
||||||
* References to existing data should be discarded.
|
* References to existing data should be discarded.
|
||||||
*/
|
*/
|
||||||
onDataInvalidated: function ()
|
onDataInvalidated: function()
|
||||||
{
|
{
|
||||||
this._itemCount = 0;
|
this._itemCount = 0;
|
||||||
},
|
},
|
||||||
|
|
@ -1612,7 +1612,7 @@ DownloadsIndicatorDataCtor.prototype = {
|
||||||
/**
|
/**
|
||||||
* Computes aggregate values and propagates the changes to our views.
|
* Computes aggregate values and propagates the changes to our views.
|
||||||
*/
|
*/
|
||||||
_updateViews: function ()
|
_updateViews: function()
|
||||||
{
|
{
|
||||||
// Do not update the status indicators during batch loads of download items.
|
// Do not update the status indicators during batch loads of download items.
|
||||||
if (this._loading) {
|
if (this._loading) {
|
||||||
|
|
@ -1629,7 +1629,7 @@ DownloadsIndicatorDataCtor.prototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* DownloadsIndicatorView object to be updated.
|
* DownloadsIndicatorView object to be updated.
|
||||||
*/
|
*/
|
||||||
_updateView: function (aView)
|
_updateView: function(aView)
|
||||||
{
|
{
|
||||||
aView.hasDownloads = this._hasDownloads;
|
aView.hasDownloads = this._hasDownloads;
|
||||||
aView.counter = this._counter;
|
aView.counter = this._counter;
|
||||||
|
|
@ -1681,7 +1681,7 @@ DownloadsIndicatorDataCtor.prototype = {
|
||||||
/**
|
/**
|
||||||
* Computes aggregate values based on the current state of downloads.
|
* Computes aggregate values based on the current state of downloads.
|
||||||
*/
|
*/
|
||||||
_refreshProperties: function ()
|
_refreshProperties: function()
|
||||||
{
|
{
|
||||||
let summary =
|
let summary =
|
||||||
DownloadsCommon.summarizeDownloads(this._activeDownloads());
|
DownloadsCommon.summarizeDownloads(this._activeDownloads());
|
||||||
|
|
@ -1780,7 +1780,7 @@ DownloadsSummaryData.prototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* DownloadsSummary view to be removed.
|
* DownloadsSummary view to be removed.
|
||||||
*/
|
*/
|
||||||
removeView: function (aView)
|
removeView: function(aView)
|
||||||
{
|
{
|
||||||
DownloadsViewPrototype.removeView.call(this, aView);
|
DownloadsViewPrototype.removeView.call(this, aView);
|
||||||
|
|
||||||
|
|
@ -1796,13 +1796,13 @@ DownloadsSummaryData.prototype = {
|
||||||
//// DownloadsViewPrototype for more information on what these functions
|
//// DownloadsViewPrototype for more information on what these functions
|
||||||
//// are used for.
|
//// are used for.
|
||||||
|
|
||||||
onDataLoadCompleted: function ()
|
onDataLoadCompleted: function()
|
||||||
{
|
{
|
||||||
DownloadsViewPrototype.onDataLoadCompleted.call(this);
|
DownloadsViewPrototype.onDataLoadCompleted.call(this);
|
||||||
this._updateViews();
|
this._updateViews();
|
||||||
},
|
},
|
||||||
|
|
||||||
onDataInvalidated: function ()
|
onDataInvalidated: function()
|
||||||
{
|
{
|
||||||
this._dataItems = [];
|
this._dataItems = [];
|
||||||
},
|
},
|
||||||
|
|
@ -1839,7 +1839,7 @@ DownloadsSummaryData.prototype = {
|
||||||
/**
|
/**
|
||||||
* Computes aggregate values and propagates the changes to our views.
|
* Computes aggregate values and propagates the changes to our views.
|
||||||
*/
|
*/
|
||||||
_updateViews: function ()
|
_updateViews: function()
|
||||||
{
|
{
|
||||||
// Do not update the status indicators during batch loads of download items.
|
// Do not update the status indicators during batch loads of download items.
|
||||||
if (this._loading) {
|
if (this._loading) {
|
||||||
|
|
@ -1856,7 +1856,7 @@ DownloadsSummaryData.prototype = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* DownloadsIndicatorView object to be updated.
|
* DownloadsIndicatorView object to be updated.
|
||||||
*/
|
*/
|
||||||
_updateView: function (aView)
|
_updateView: function(aView)
|
||||||
{
|
{
|
||||||
aView.showingProgress = this._showingProgress;
|
aView.showingProgress = this._showingProgress;
|
||||||
aView.percentComplete = this._percentComplete;
|
aView.percentComplete = this._percentComplete;
|
||||||
|
|
@ -1885,7 +1885,7 @@ DownloadsSummaryData.prototype = {
|
||||||
/**
|
/**
|
||||||
* Computes aggregate values based on the current state of downloads.
|
* Computes aggregate values based on the current state of downloads.
|
||||||
*/
|
*/
|
||||||
_refreshProperties: function ()
|
_refreshProperties: function()
|
||||||
{
|
{
|
||||||
// Pre-load summary with default values.
|
// Pre-load summary with default values.
|
||||||
let summary =
|
let summary =
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
this.DownloadsLogger = {
|
this.DownloadsLogger = {
|
||||||
_generateLogMessage: function (args) {
|
_generateLogMessage: function(args) {
|
||||||
// create a string representation of a list of arbitrary things
|
// create a string representation of a list of arbitrary things
|
||||||
let strings = [];
|
let strings = [];
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ this.DownloadsLogger = {
|
||||||
*
|
*
|
||||||
* Enable with about:config pref browser.download.debug
|
* Enable with about:config pref browser.download.debug
|
||||||
*/
|
*/
|
||||||
log: function (...args) {
|
log: function(...args) {
|
||||||
let output = this._generateLogMessage(args);
|
let output = this._generateLogMessage(args);
|
||||||
dump(output + "\n");
|
dump(output + "\n");
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ this.DownloadsLogger = {
|
||||||
* reportError() - report an error through component utils as well as
|
* reportError() - report an error through component utils as well as
|
||||||
* our log function
|
* our log function
|
||||||
*/
|
*/
|
||||||
reportError: function (...aArgs) {
|
reportError: function(...aArgs) {
|
||||||
// Report the error in the browser
|
// Report the error in the browser
|
||||||
let output = this._generateLogMessage(aArgs);
|
let output = this._generateLogMessage(aArgs);
|
||||||
Cu.reportError(output);
|
Cu.reportError(output);
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ DownloadsStartup.prototype = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// nsIObserver
|
//// nsIObserver
|
||||||
|
|
||||||
observe: function (aSubject, aTopic, aData)
|
observe: function(aSubject, aTopic, aData)
|
||||||
{
|
{
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "profile-after-change":
|
case "profile-after-change":
|
||||||
|
|
@ -259,7 +259,7 @@ DownloadsStartup.prototype = {
|
||||||
/**
|
/**
|
||||||
* Ensures that persistent download data is reloaded at the appropriate time.
|
* Ensures that persistent download data is reloaded at the appropriate time.
|
||||||
*/
|
*/
|
||||||
_ensureDataLoaded: function ()
|
_ensureDataLoaded: function()
|
||||||
{
|
{
|
||||||
if (!this._downloadsServiceInitialized) {
|
if (!this._downloadsServiceInitialized) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||||
|
|
||||||
function DownloadsUI()
|
function DownloadsUI()
|
||||||
{
|
{
|
||||||
XPCOMUtils.defineLazyGetter(this, "_toolkitUI", function () {
|
XPCOMUtils.defineLazyGetter(this, "_toolkitUI", function() {
|
||||||
// Create Toolkit's nsIDownloadManagerUI implementation.
|
// Create Toolkit's nsIDownloadManagerUI implementation.
|
||||||
return Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"]
|
return Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"]
|
||||||
.getService(Ci.nsIDownloadManagerUI);
|
.getService(Ci.nsIDownloadManagerUI);
|
||||||
|
|
@ -60,7 +60,7 @@ DownloadsUI.prototype = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// nsIDownloadManagerUI
|
//// nsIDownloadManagerUI
|
||||||
|
|
||||||
show: function (aWindowContext, aDownload, aReason, aUsePrivateUI)
|
show: function(aWindowContext, aDownload, aReason, aUsePrivateUI)
|
||||||
{
|
{
|
||||||
if (DownloadsCommon.useToolkitUI && !PrivateBrowsingUtils.isWindowPrivate(aWindowContext)) {
|
if (DownloadsCommon.useToolkitUI && !PrivateBrowsingUtils.isWindowPrivate(aWindowContext)) {
|
||||||
this._toolkitUI.show(aWindowContext, aDownload, aReason, aUsePrivateUI);
|
this._toolkitUI.show(aWindowContext, aDownload, aReason, aUsePrivateUI);
|
||||||
|
|
@ -101,7 +101,7 @@ DownloadsUI.prototype = {
|
||||||
return DownloadsCommon.useToolkitUI ? this._toolkitUI.visible : true;
|
return DownloadsCommon.useToolkitUI ? this._toolkitUI.visible : true;
|
||||||
},
|
},
|
||||||
|
|
||||||
getAttention: function ()
|
getAttention: function()
|
||||||
{
|
{
|
||||||
if (DownloadsCommon.useToolkitUI) {
|
if (DownloadsCommon.useToolkitUI) {
|
||||||
this._toolkitUI.getAttention();
|
this._toolkitUI.getAttention();
|
||||||
|
|
@ -112,7 +112,7 @@ DownloadsUI.prototype = {
|
||||||
* Helper function that opens the download manager UI.
|
* Helper function that opens the download manager UI.
|
||||||
*/
|
*/
|
||||||
_showDownloadManagerUI:
|
_showDownloadManagerUI:
|
||||||
function (aWindowContext, aUsePrivateUI)
|
function(aWindowContext, aUsePrivateUI)
|
||||||
{
|
{
|
||||||
// If we weren't given a window context, try to find a browser window
|
// If we weren't given a window context, try to find a browser window
|
||||||
// to use as our parent - and if that doesn't work, error out and give up.
|
// to use as our parent - and if that doesn't work, error out and give up.
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ HistoryDownloadElementShell.prototype = {
|
||||||
* be activated when entering the visible area. Session downloads are always
|
* be activated when entering the visible area. Session downloads are always
|
||||||
* active.
|
* active.
|
||||||
*/
|
*/
|
||||||
ensureActive: function () {
|
ensureActive: function() {
|
||||||
if (!this._active) {
|
if (!this._active) {
|
||||||
this._active = true;
|
this._active = true;
|
||||||
this.element.setAttribute("active", true);
|
this.element.setAttribute("active", true);
|
||||||
|
|
@ -305,7 +305,7 @@ HistoryDownloadElementShell.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/* nsIController */
|
/* nsIController */
|
||||||
isCommandEnabled: function (aCommand) {
|
isCommandEnabled: function(aCommand) {
|
||||||
// The only valid command for inactive elements is cmd_delete.
|
// The only valid command for inactive elements is cmd_delete.
|
||||||
if (!this.active && aCommand != "cmd_delete")
|
if (!this.active && aCommand != "cmd_delete")
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -340,7 +340,7 @@ HistoryDownloadElementShell.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/* nsIController */
|
/* nsIController */
|
||||||
doCommand: function (aCommand) {
|
doCommand: function(aCommand) {
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "downloadsCmd_open": {
|
case "downloadsCmd_open": {
|
||||||
let file = new FileUtils.File(this.download.target.path);
|
let file = new FileUtils.File(this.download.target.path);
|
||||||
|
|
@ -391,7 +391,7 @@ HistoryDownloadElementShell.prototype = {
|
||||||
// Returns whether or not the download handled by this shell should
|
// Returns whether or not the download handled by this shell should
|
||||||
// show up in the search results for the given term. Both the display
|
// show up in the search results for the given term. Both the display
|
||||||
// name for the download and the url are searched.
|
// name for the download and the url are searched.
|
||||||
matchesSearchTerm: function (aTerm) {
|
matchesSearchTerm: function(aTerm) {
|
||||||
if (!aTerm)
|
if (!aTerm)
|
||||||
return true;
|
return true;
|
||||||
aTerm = aTerm.toLowerCase();
|
aTerm = aTerm.toLowerCase();
|
||||||
|
|
@ -401,7 +401,7 @@ HistoryDownloadElementShell.prototype = {
|
||||||
|
|
||||||
// Handles return keypress on the element (the keypress listener is
|
// Handles return keypress on the element (the keypress listener is
|
||||||
// set in the DownloadsPlacesView object).
|
// set in the DownloadsPlacesView object).
|
||||||
doDefaultCommand: function () {
|
doDefaultCommand: function() {
|
||||||
function getDefaultCommandForState(aState) {
|
function getDefaultCommandForState(aState) {
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case nsIDM.DOWNLOAD_FINISHED:
|
case nsIDM.DOWNLOAD_FINISHED:
|
||||||
|
|
@ -435,7 +435,7 @@ HistoryDownloadElementShell.prototype = {
|
||||||
* existence of the target file already, we can do it now and then update
|
* existence of the target file already, we can do it now and then update
|
||||||
* the commands as needed.
|
* the commands as needed.
|
||||||
*/
|
*/
|
||||||
onSelect: function () {
|
onSelect: function() {
|
||||||
if (!this.active)
|
if (!this.active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -775,7 +775,7 @@ DownloadsPlacesView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeElement: function (aElement) {
|
_removeElement: function(aElement) {
|
||||||
// If the element was selected exclusively, select its next
|
// If the element was selected exclusively, select its next
|
||||||
// sibling first, if not, try for previous sibling, if any.
|
// sibling first, if not, try for previous sibling, if any.
|
||||||
if ((aElement.nextSibling || aElement.previousSibling) &&
|
if ((aElement.nextSibling || aElement.previousSibling) &&
|
||||||
|
|
@ -796,7 +796,7 @@ DownloadsPlacesView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeHistoryDownloadFromView:
|
_removeHistoryDownloadFromView:
|
||||||
function (aPlacesNode) {
|
function(aPlacesNode) {
|
||||||
let downloadURI = aPlacesNode.uri;
|
let downloadURI = aPlacesNode.uri;
|
||||||
let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI);
|
let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI);
|
||||||
if (shellsForURI) {
|
if (shellsForURI) {
|
||||||
|
|
@ -857,7 +857,7 @@ DownloadsPlacesView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureVisibleElementsAreActive:
|
_ensureVisibleElementsAreActive:
|
||||||
function () {
|
function() {
|
||||||
if (!this.active || this._ensureVisibleTimer || !this._richlistbox.firstChild)
|
if (!this.active || this._ensureVisibleTimer || !this._richlistbox.firstChild)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -964,12 +964,12 @@ DownloadsPlacesView.prototype = {
|
||||||
get hasSelection() this.selectedNodes.length > 0,
|
get hasSelection() this.selectedNodes.length > 0,
|
||||||
|
|
||||||
containerStateChanged:
|
containerStateChanged:
|
||||||
function (aNode, aOldState, aNewState) {
|
function(aNode, aOldState, aNewState) {
|
||||||
this.invalidateContainer(aNode)
|
this.invalidateContainer(aNode)
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer:
|
invalidateContainer:
|
||||||
function (aContainer) {
|
function(aContainer) {
|
||||||
if (aContainer != this._resultNode)
|
if (aContainer != this._resultNode)
|
||||||
throw new Error("Unexpected container node");
|
throw new Error("Unexpected container node");
|
||||||
if (!aContainer.containerOpen)
|
if (!aContainer.containerOpen)
|
||||||
|
|
@ -1015,7 +1015,7 @@ DownloadsPlacesView.prototype = {
|
||||||
goUpdateDownloadCommands();
|
goUpdateDownloadCommands();
|
||||||
},
|
},
|
||||||
|
|
||||||
_appendDownloadsFragment: function (aDOMFragment) {
|
_appendDownloadsFragment: function(aDOMFragment) {
|
||||||
// Workaround multiple reflows hang by removing the richlistbox
|
// Workaround multiple reflows hang by removing the richlistbox
|
||||||
// and adding it back when we're done.
|
// and adding it back when we're done.
|
||||||
|
|
||||||
|
|
@ -1037,11 +1037,11 @@ DownloadsPlacesView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeInserted: function (aParent, aPlacesNode) {
|
nodeInserted: function(aParent, aPlacesNode) {
|
||||||
this._addDownloadData(null, aPlacesNode);
|
this._addDownloadData(null, aPlacesNode);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeRemoved: function (aParent, aPlacesNode, aOldIndex) {
|
nodeRemoved: function(aParent, aPlacesNode, aOldIndex) {
|
||||||
this._removeHistoryDownloadFromView(aPlacesNode);
|
this._removeHistoryDownloadFromView(aPlacesNode);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1086,7 +1086,7 @@ DownloadsPlacesView.prototype = {
|
||||||
* data is done loading. However, if the selection has changed in-between,
|
* data is done loading. However, if the selection has changed in-between,
|
||||||
* we assume the user has already started using the view and give up.
|
* we assume the user has already started using the view and give up.
|
||||||
*/
|
*/
|
||||||
_ensureInitialSelection: function () {
|
_ensureInitialSelection: function() {
|
||||||
// Either they're both null, or the selection has not changed in between.
|
// Either they're both null, or the selection has not changed in between.
|
||||||
if (this._richlistbox.selectedItem == this._initiallySelectedElement) {
|
if (this._richlistbox.selectedItem == this._initiallySelectedElement) {
|
||||||
let firstDownloadElement = this._richlistbox.firstChild;
|
let firstDownloadElement = this._richlistbox.firstChild;
|
||||||
|
|
@ -1106,7 +1106,7 @@ DownloadsPlacesView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onDataLoadStarting: function() { },
|
onDataLoadStarting: function() { },
|
||||||
onDataLoadCompleted: function () {
|
onDataLoadCompleted: function() {
|
||||||
this._ensureInitialSelection();
|
this._ensureInitialSelection();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1126,7 +1126,7 @@ DownloadsPlacesView.prototype = {
|
||||||
this._removeSessionDownloadFromView(download);
|
this._removeSessionDownloadFromView(download);
|
||||||
},
|
},
|
||||||
|
|
||||||
supportsCommand: function (aCommand) {
|
supportsCommand: function(aCommand) {
|
||||||
if (DOWNLOAD_VIEW_SUPPORTED_COMMANDS.indexOf(aCommand) != -1) {
|
if (DOWNLOAD_VIEW_SUPPORTED_COMMANDS.indexOf(aCommand) != -1) {
|
||||||
// The clear-downloads command may be performed by the toolbar-button,
|
// The clear-downloads command may be performed by the toolbar-button,
|
||||||
// which can be focused on OS X. Thus enable this command even if the
|
// which can be focused on OS X. Thus enable this command even if the
|
||||||
|
|
@ -1144,7 +1144,7 @@ DownloadsPlacesView.prototype = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
isCommandEnabled: function (aCommand) {
|
isCommandEnabled: function(aCommand) {
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "cmd_copy":
|
case "cmd_copy":
|
||||||
return this._richlistbox.selectedItems.length > 0;
|
return this._richlistbox.selectedItems.length > 0;
|
||||||
|
|
@ -1161,7 +1161,7 @@ DownloadsPlacesView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_canClearDownloads: function () {
|
_canClearDownloads: function() {
|
||||||
// Downloads can be cleared if there's at least one removable download in
|
// Downloads can be cleared if there's at least one removable download in
|
||||||
// the list (either a history download or a completed session download).
|
// the list (either a history download or a completed session download).
|
||||||
// Because history downloads are always removable and are listed after the
|
// Because history downloads are always removable and are listed after the
|
||||||
|
|
@ -1177,7 +1177,7 @@ DownloadsPlacesView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_copySelectedDownloadsToClipboard:
|
_copySelectedDownloadsToClipboard:
|
||||||
function () {
|
function() {
|
||||||
let urls = [for (element of this._richlistbox.selectedItems)
|
let urls = [for (element of this._richlistbox.selectedItems)
|
||||||
element._shell.download.source.url];
|
element._shell.download.source.url];
|
||||||
|
|
||||||
|
|
@ -1186,7 +1186,7 @@ DownloadsPlacesView.prototype = {
|
||||||
.copyString(urls.join("\n"), document);
|
.copyString(urls.join("\n"), document);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getURLFromClipboardData: function () {
|
_getURLFromClipboardData: function() {
|
||||||
let trans = Cc["@mozilla.org/widget/transferable;1"].
|
let trans = Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Ci.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
trans.init(null);
|
trans.init(null);
|
||||||
|
|
@ -1210,19 +1210,19 @@ DownloadsPlacesView.prototype = {
|
||||||
return ["", ""];
|
return ["", ""];
|
||||||
},
|
},
|
||||||
|
|
||||||
_canDownloadClipboardURL: function () {
|
_canDownloadClipboardURL: function() {
|
||||||
let [url, name] = this._getURLFromClipboardData();
|
let [url, name] = this._getURLFromClipboardData();
|
||||||
return url != "";
|
return url != "";
|
||||||
},
|
},
|
||||||
|
|
||||||
_downloadURLFromClipboard: function () {
|
_downloadURLFromClipboard: function() {
|
||||||
let [url, name] = this._getURLFromClipboardData();
|
let [url, name] = this._getURLFromClipboardData();
|
||||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
||||||
let initiatingDoc = browserWin ? browserWin.document : document;
|
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||||
DownloadURL(url, name, initiatingDoc);
|
DownloadURL(url, name, initiatingDoc);
|
||||||
},
|
},
|
||||||
|
|
||||||
doCommand: function (aCommand) {
|
doCommand: function(aCommand) {
|
||||||
// Commands may be invoked with keyboard shortcuts even if disabled.
|
// Commands may be invoked with keyboard shortcuts even if disabled.
|
||||||
if (!this.isCommandEnabled(aCommand)) {
|
if (!this.isCommandEnabled(aCommand)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1263,7 +1263,7 @@ DownloadsPlacesView.prototype = {
|
||||||
|
|
||||||
onEvent: function() { },
|
onEvent: function() { },
|
||||||
|
|
||||||
onContextMenu: function (aEvent)
|
onContextMenu: function(aEvent)
|
||||||
{
|
{
|
||||||
let element = this._richlistbox.selectedItem;
|
let element = this._richlistbox.selectedItem;
|
||||||
if (!element || !element._shell)
|
if (!element || !element._shell)
|
||||||
|
|
@ -1283,7 +1283,7 @@ DownloadsPlacesView.prototype = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyPress: function (aEvent) {
|
onKeyPress: function(aEvent) {
|
||||||
let selectedElements = this._richlistbox.selectedItems;
|
let selectedElements = this._richlistbox.selectedItems;
|
||||||
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
|
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
|
||||||
// In the content tree, opening bookmarks by pressing return is only
|
// In the content tree, opening bookmarks by pressing return is only
|
||||||
|
|
@ -1304,7 +1304,7 @@ DownloadsPlacesView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDoubleClick: function (aEvent) {
|
onDoubleClick: function(aEvent) {
|
||||||
if (aEvent.button != 0)
|
if (aEvent.button != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1317,11 +1317,11 @@ DownloadsPlacesView.prototype = {
|
||||||
element._shell.doDefaultCommand();
|
element._shell.doDefaultCommand();
|
||||||
},
|
},
|
||||||
|
|
||||||
onScroll: function () {
|
onScroll: function() {
|
||||||
this._ensureVisibleElementsAreActive();
|
this._ensureVisibleElementsAreActive();
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function () {
|
onSelect: function() {
|
||||||
goUpdateDownloadCommands();
|
goUpdateDownloadCommands();
|
||||||
|
|
||||||
let selectedElements = this._richlistbox.selectedItems;
|
let selectedElements = this._richlistbox.selectedItems;
|
||||||
|
|
@ -1331,7 +1331,7 @@ DownloadsPlacesView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDragStart: function (aEvent) {
|
onDragStart: function(aEvent) {
|
||||||
// TODO Bug 831358: Support d&d for multiple selection.
|
// TODO Bug 831358: Support d&d for multiple selection.
|
||||||
// For now, we just drag the first element.
|
// For now, we just drag the first element.
|
||||||
let selectedItem = this._richlistbox.selectedItem;
|
let selectedItem = this._richlistbox.selectedItem;
|
||||||
|
|
@ -1357,7 +1357,7 @@ DownloadsPlacesView.prototype = {
|
||||||
dt.addElement(selectedItem);
|
dt.addElement(selectedItem);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDragOver: function (aEvent) {
|
onDragOver: function(aEvent) {
|
||||||
let types = aEvent.dataTransfer.types;
|
let types = aEvent.dataTransfer.types;
|
||||||
if (types.contains("text/uri-list") ||
|
if (types.contains("text/uri-list") ||
|
||||||
types.contains("text/x-moz-url") ||
|
types.contains("text/x-moz-url") ||
|
||||||
|
|
@ -1366,7 +1366,7 @@ DownloadsPlacesView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDrop: function (aEvent) {
|
onDrop: function(aEvent) {
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
// If dragged item is from our source, do not try to
|
// If dragged item is from our source, do not try to
|
||||||
// redownload already downloaded file.
|
// redownload already downloaded file.
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
|
|
||||||
var ContentAreaDownloadsView = {
|
var ContentAreaDownloadsView = {
|
||||||
init: function () {
|
init: function() {
|
||||||
let view = new DownloadsPlacesView(document.getElementById("downloadsRichListBox"));
|
let view = new DownloadsPlacesView(document.getElementById("downloadsRichListBox"));
|
||||||
// Do not display the Places downloads in private windows
|
// Do not display the Places downloads in private windows
|
||||||
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ const DownloadsPanel = {
|
||||||
* @param aCallback
|
* @param aCallback
|
||||||
* Called when initialization is complete.
|
* Called when initialization is complete.
|
||||||
*/
|
*/
|
||||||
initialize: function (aCallback)
|
initialize: function(aCallback)
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Attempting to initialize DownloadsPanel for a window.");
|
DownloadsCommon.log("Attempting to initialize DownloadsPanel for a window.");
|
||||||
if (this._state != this.kStateUninitialized) {
|
if (this._state != this.kStateUninitialized) {
|
||||||
|
|
@ -164,7 +164,7 @@ const DownloadsPanel = {
|
||||||
* downloads. The downloads panel can be reopened later, even after this
|
* downloads. The downloads panel can be reopened later, even after this
|
||||||
* function has been called.
|
* function has been called.
|
||||||
*/
|
*/
|
||||||
terminate: function ()
|
terminate: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Attempting to terminate DownloadsPanel for a window.");
|
DownloadsCommon.log("Attempting to terminate DownloadsPanel for a window.");
|
||||||
if (this._state == this.kStateUninitialized) {
|
if (this._state == this.kStateUninitialized) {
|
||||||
|
|
@ -214,7 +214,7 @@ const DownloadsPanel = {
|
||||||
* initialized the first time this method is called, and the panel is shown
|
* initialized the first time this method is called, and the panel is shown
|
||||||
* only when data is ready.
|
* only when data is ready.
|
||||||
*/
|
*/
|
||||||
showPanel: function ()
|
showPanel: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Opening the downloads panel.");
|
DownloadsCommon.log("Opening the downloads panel.");
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ const DownloadsPanel = {
|
||||||
// called while another window is closing (like the window for selecting
|
// called while another window is closing (like the window for selecting
|
||||||
// whether to save or open the file), and that would cause the panel to
|
// whether to save or open the file), and that would cause the panel to
|
||||||
// close immediately.
|
// close immediately.
|
||||||
setTimeout(function () DownloadsPanel._openPopupIfDataReady(), 0);
|
setTimeout(function() DownloadsPanel._openPopupIfDataReady(), 0);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
DownloadsCommon.log("Waiting for the downloads panel to appear.");
|
DownloadsCommon.log("Waiting for the downloads panel to appear.");
|
||||||
|
|
@ -240,7 +240,7 @@ const DownloadsPanel = {
|
||||||
* Hides the downloads panel, if visible, but keeps the internal state so that
|
* Hides the downloads panel, if visible, but keeps the internal state so that
|
||||||
* the panel can be reopened quickly if required.
|
* the panel can be reopened quickly if required.
|
||||||
*/
|
*/
|
||||||
hidePanel: function ()
|
hidePanel: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Closing the downloads panel.");
|
DownloadsCommon.log("Closing the downloads panel.");
|
||||||
|
|
||||||
|
|
@ -297,7 +297,7 @@ const DownloadsPanel = {
|
||||||
* Handles the mousemove event for the panel, which disables focusring
|
* Handles the mousemove event for the panel, which disables focusring
|
||||||
* visualization.
|
* visualization.
|
||||||
*/
|
*/
|
||||||
handleEvent: function (aEvent)
|
handleEvent: function(aEvent)
|
||||||
{
|
{
|
||||||
if (aEvent.type == "mousemove") {
|
if (aEvent.type == "mousemove") {
|
||||||
this.keyFocusing = false;
|
this.keyFocusing = false;
|
||||||
|
|
@ -310,7 +310,7 @@ const DownloadsPanel = {
|
||||||
/**
|
/**
|
||||||
* Called after data loading finished.
|
* Called after data loading finished.
|
||||||
*/
|
*/
|
||||||
onViewLoadCompleted: function ()
|
onViewLoadCompleted: function()
|
||||||
{
|
{
|
||||||
this._openPopupIfDataReady();
|
this._openPopupIfDataReady();
|
||||||
},
|
},
|
||||||
|
|
@ -318,13 +318,13 @@ const DownloadsPanel = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// User interface event functions
|
//// User interface event functions
|
||||||
|
|
||||||
onWindowUnload: function ()
|
onWindowUnload: function()
|
||||||
{
|
{
|
||||||
// This function is registered as an event listener, we can't use "this".
|
// This function is registered as an event listener, we can't use "this".
|
||||||
DownloadsPanel.terminate();
|
DownloadsPanel.terminate();
|
||||||
},
|
},
|
||||||
|
|
||||||
onPopupShown: function (aEvent)
|
onPopupShown: function(aEvent)
|
||||||
{
|
{
|
||||||
// Ignore events raised by nested popups.
|
// Ignore events raised by nested popups.
|
||||||
if (aEvent.target != aEvent.currentTarget) {
|
if (aEvent.target != aEvent.currentTarget) {
|
||||||
|
|
@ -346,7 +346,7 @@ const DownloadsPanel = {
|
||||||
this._focusPanel();
|
this._focusPanel();
|
||||||
},
|
},
|
||||||
|
|
||||||
onPopupHidden: function (aEvent)
|
onPopupHidden: function(aEvent)
|
||||||
{
|
{
|
||||||
// Ignore events raised by nested popups.
|
// Ignore events raised by nested popups.
|
||||||
if (aEvent.target != aEvent.currentTarget) {
|
if (aEvent.target != aEvent.currentTarget) {
|
||||||
|
|
@ -375,7 +375,7 @@ const DownloadsPanel = {
|
||||||
/**
|
/**
|
||||||
* Shows or focuses the user interface dedicated to downloads history.
|
* Shows or focuses the user interface dedicated to downloads history.
|
||||||
*/
|
*/
|
||||||
showDownloadsHistory: function ()
|
showDownloadsHistory: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Showing download history.");
|
DownloadsCommon.log("Showing download history.");
|
||||||
// Hide the panel before showing another window, otherwise focus will return
|
// Hide the panel before showing another window, otherwise focus will return
|
||||||
|
|
@ -393,7 +393,7 @@ const DownloadsPanel = {
|
||||||
* removed in _unattachEventListeners. This is called automatically after the
|
* removed in _unattachEventListeners. This is called automatically after the
|
||||||
* panel has successfully loaded.
|
* panel has successfully loaded.
|
||||||
*/
|
*/
|
||||||
_attachEventListeners: function ()
|
_attachEventListeners: function()
|
||||||
{
|
{
|
||||||
// Handle keydown to support accel-V.
|
// Handle keydown to support accel-V.
|
||||||
this.panel.addEventListener("keydown", this._onKeyDown.bind(this), false);
|
this.panel.addEventListener("keydown", this._onKeyDown.bind(this), false);
|
||||||
|
|
@ -406,7 +406,7 @@ const DownloadsPanel = {
|
||||||
* Unattach event listeners that were added in _attachEventListeners. This
|
* Unattach event listeners that were added in _attachEventListeners. This
|
||||||
* is called automatically on panel termination.
|
* is called automatically on panel termination.
|
||||||
*/
|
*/
|
||||||
_unattachEventListeners: function ()
|
_unattachEventListeners: function()
|
||||||
{
|
{
|
||||||
this.panel.removeEventListener("keydown", this._onKeyDown.bind(this),
|
this.panel.removeEventListener("keydown", this._onKeyDown.bind(this),
|
||||||
false);
|
false);
|
||||||
|
|
@ -414,7 +414,7 @@ const DownloadsPanel = {
|
||||||
false);
|
false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPress: function (aEvent)
|
_onKeyPress: function(aEvent)
|
||||||
{
|
{
|
||||||
// Handle unmodified keys only.
|
// Handle unmodified keys only.
|
||||||
if (aEvent.altKey || aEvent.ctrlKey || aEvent.shiftKey || aEvent.metaKey) {
|
if (aEvent.altKey || aEvent.ctrlKey || aEvent.shiftKey || aEvent.metaKey) {
|
||||||
|
|
@ -462,7 +462,7 @@ const DownloadsPanel = {
|
||||||
* as the the accel-V "paste" event, which initiates a file download if the
|
* as the the accel-V "paste" event, which initiates a file download if the
|
||||||
* pasted item can be resolved to a URI.
|
* pasted item can be resolved to a URI.
|
||||||
*/
|
*/
|
||||||
_onKeyDown: function (aEvent)
|
_onKeyDown: function(aEvent)
|
||||||
{
|
{
|
||||||
// If the footer is focused and the downloads list has at least 1 element
|
// If the footer is focused and the downloads list has at least 1 element
|
||||||
// in it, focus the last element in the list when going up.
|
// in it, focus the last element in the list when going up.
|
||||||
|
|
@ -516,7 +516,7 @@ const DownloadsPanel = {
|
||||||
* Move focus to the main element in the downloads panel, unless another
|
* Move focus to the main element in the downloads panel, unless another
|
||||||
* element in the panel is already focused.
|
* element in the panel is already focused.
|
||||||
*/
|
*/
|
||||||
_focusPanel: function ()
|
_focusPanel: function()
|
||||||
{
|
{
|
||||||
// We may be invoked while the panel is still waiting to be shown.
|
// We may be invoked while the panel is still waiting to be shown.
|
||||||
if (this._state != this.kStateShown) {
|
if (this._state != this.kStateShown) {
|
||||||
|
|
@ -539,7 +539,7 @@ const DownloadsPanel = {
|
||||||
/**
|
/**
|
||||||
* Opens the downloads panel when data is ready to be displayed.
|
* Opens the downloads panel when data is ready to be displayed.
|
||||||
*/
|
*/
|
||||||
_openPopupIfDataReady: function ()
|
_openPopupIfDataReady: function()
|
||||||
{
|
{
|
||||||
// We don't want to open the popup if we already displayed it, or if we are
|
// We don't want to open the popup if we already displayed it, or if we are
|
||||||
// still loading data.
|
// still loading data.
|
||||||
|
|
@ -627,7 +627,7 @@ const DownloadsOverlayLoader = {
|
||||||
* Invoked when loading is completed. If the overlay is already
|
* Invoked when loading is completed. If the overlay is already
|
||||||
* loaded, the function is called immediately.
|
* loaded, the function is called immediately.
|
||||||
*/
|
*/
|
||||||
ensureOverlayLoaded: function (aOverlay, aCallback)
|
ensureOverlayLoaded: function(aOverlay, aCallback)
|
||||||
{
|
{
|
||||||
// The overlay is already loaded, invoke the callback immediately.
|
// The overlay is already loaded, invoke the callback immediately.
|
||||||
if (aOverlay in this._loadedOverlays) {
|
if (aOverlay in this._loadedOverlays) {
|
||||||
|
|
@ -663,7 +663,7 @@ const DownloadsOverlayLoader = {
|
||||||
* and/or loading more overlays as needed. In most cases, there will be a
|
* and/or loading more overlays as needed. In most cases, there will be a
|
||||||
* single request for one overlay, that will be processed immediately.
|
* single request for one overlay, that will be processed immediately.
|
||||||
*/
|
*/
|
||||||
processPendingRequests: function ()
|
processPendingRequests: function()
|
||||||
{
|
{
|
||||||
// Re-process all the currently pending requests, yet allow more requests
|
// Re-process all the currently pending requests, yet allow more requests
|
||||||
// to be appended at the end of the array if we're not ready for them.
|
// to be appended at the end of the array if we're not ready for them.
|
||||||
|
|
@ -721,7 +721,7 @@ const DownloadsView = {
|
||||||
/**
|
/**
|
||||||
* Called when the number of items in the list changes.
|
* Called when the number of items in the list changes.
|
||||||
*/
|
*/
|
||||||
_itemCountChanged: function ()
|
_itemCountChanged: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("The downloads item count has changed - we are tracking",
|
DownloadsCommon.log("The downloads item count has changed - we are tracking",
|
||||||
this._downloads.length, "downloads in total.");
|
this._downloads.length, "downloads in total.");
|
||||||
|
|
@ -766,7 +766,7 @@ const DownloadsView = {
|
||||||
/**
|
/**
|
||||||
* Called before multiple downloads are about to be loaded.
|
* Called before multiple downloads are about to be loaded.
|
||||||
*/
|
*/
|
||||||
onDataLoadStarting: function ()
|
onDataLoadStarting: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("onDataLoadStarting called for DownloadsView.");
|
DownloadsCommon.log("onDataLoadStarting called for DownloadsView.");
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
@ -775,7 +775,7 @@ const DownloadsView = {
|
||||||
/**
|
/**
|
||||||
* Called after data loading finished.
|
* Called after data loading finished.
|
||||||
*/
|
*/
|
||||||
onDataLoadCompleted: function ()
|
onDataLoadCompleted: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("onDataLoadCompleted called for DownloadsView.");
|
DownloadsCommon.log("onDataLoadCompleted called for DownloadsView.");
|
||||||
|
|
||||||
|
|
@ -795,7 +795,7 @@ const DownloadsView = {
|
||||||
* entering Private Browsing Mode). References to existing data should be
|
* entering Private Browsing Mode). References to existing data should be
|
||||||
* discarded.
|
* discarded.
|
||||||
*/
|
*/
|
||||||
onDataInvalidated: function ()
|
onDataInvalidated: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.log("Downloads data has been invalidated. Cleaning up",
|
DownloadsCommon.log("Downloads data has been invalidated. Cleaning up",
|
||||||
"DownloadsView.");
|
"DownloadsView.");
|
||||||
|
|
@ -952,7 +952,7 @@ const DownloadsView = {
|
||||||
* @param aCommand
|
* @param aCommand
|
||||||
* The command to be performed.
|
* The command to be performed.
|
||||||
*/
|
*/
|
||||||
onDownloadCommand: function (aEvent, aCommand)
|
onDownloadCommand: function(aEvent, aCommand)
|
||||||
{
|
{
|
||||||
let target = aEvent.target;
|
let target = aEvent.target;
|
||||||
while (target.nodeName != "richlistitem") {
|
while (target.nodeName != "richlistitem") {
|
||||||
|
|
@ -961,7 +961,7 @@ const DownloadsView = {
|
||||||
DownloadsView.controllerForElement(target).doCommand(aCommand);
|
DownloadsView.controllerForElement(target).doCommand(aCommand);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadClick: function (aEvent)
|
onDownloadClick: function(aEvent)
|
||||||
{
|
{
|
||||||
// Handle primary clicks only, and exclude the action button.
|
// Handle primary clicks only, and exclude the action button.
|
||||||
if (aEvent.button == 0 &&
|
if (aEvent.button == 0 &&
|
||||||
|
|
@ -973,7 +973,7 @@ const DownloadsView = {
|
||||||
/**
|
/**
|
||||||
* Handles keypress events on a download item.
|
* Handles keypress events on a download item.
|
||||||
*/
|
*/
|
||||||
onDownloadKeyPress: function (aEvent)
|
onDownloadKeyPress: function(aEvent)
|
||||||
{
|
{
|
||||||
// Pressing the key on buttons should not invoke the action because the
|
// Pressing the key on buttons should not invoke the action because the
|
||||||
// event has already been handled by the button itself.
|
// event has already been handled by the button itself.
|
||||||
|
|
@ -997,12 +997,12 @@ const DownloadsView = {
|
||||||
/**
|
/**
|
||||||
* Mouse listeners to handle selection on hover.
|
* Mouse listeners to handle selection on hover.
|
||||||
*/
|
*/
|
||||||
onDownloadMouseOver: function (aEvent)
|
onDownloadMouseOver: function(aEvent)
|
||||||
{
|
{
|
||||||
if (aEvent.originalTarget.parentNode == this.richListBox)
|
if (aEvent.originalTarget.parentNode == this.richListBox)
|
||||||
this.richListBox.selectedItem = aEvent.originalTarget;
|
this.richListBox.selectedItem = aEvent.originalTarget;
|
||||||
},
|
},
|
||||||
onDownloadMouseOut: function (aEvent)
|
onDownloadMouseOut: function(aEvent)
|
||||||
{
|
{
|
||||||
if (aEvent.originalTarget.parentNode == this.richListBox) {
|
if (aEvent.originalTarget.parentNode == this.richListBox) {
|
||||||
// If the destination element is outside of the richlistitem, clear the
|
// If the destination element is outside of the richlistitem, clear the
|
||||||
|
|
@ -1016,7 +1016,7 @@ const DownloadsView = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadContextMenu: function (aEvent)
|
onDownloadContextMenu: function(aEvent)
|
||||||
{
|
{
|
||||||
let element = this.richListBox.selectedItem;
|
let element = this.richListBox.selectedItem;
|
||||||
if (!element) {
|
if (!element) {
|
||||||
|
|
@ -1030,7 +1030,7 @@ const DownloadsView = {
|
||||||
contextMenu.setAttribute("state", element.getAttribute("state"));
|
contextMenu.setAttribute("state", element.getAttribute("state"));
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadDragStart: function (aEvent)
|
onDownloadDragStart: function(aEvent)
|
||||||
{
|
{
|
||||||
let element = this.richListBox.selectedItem;
|
let element = this.richListBox.selectedItem;
|
||||||
if (!element) {
|
if (!element) {
|
||||||
|
|
@ -1113,12 +1113,12 @@ const DownloadsViewController = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// Initialization and termination
|
//// Initialization and termination
|
||||||
|
|
||||||
initialize: function ()
|
initialize: function()
|
||||||
{
|
{
|
||||||
window.controllers.insertControllerAt(0, this);
|
window.controllers.insertControllerAt(0, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
terminate: function ()
|
terminate: function()
|
||||||
{
|
{
|
||||||
window.controllers.removeController(this);
|
window.controllers.removeController(this);
|
||||||
},
|
},
|
||||||
|
|
@ -1126,7 +1126,7 @@ const DownloadsViewController = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// nsIController
|
//// nsIController
|
||||||
|
|
||||||
supportsCommand: function (aCommand)
|
supportsCommand: function(aCommand)
|
||||||
{
|
{
|
||||||
// Firstly, determine if this is a command that we can handle.
|
// Firstly, determine if this is a command that we can handle.
|
||||||
if (!(aCommand in this.commands) &&
|
if (!(aCommand in this.commands) &&
|
||||||
|
|
@ -1143,7 +1143,7 @@ const DownloadsViewController = {
|
||||||
return !!element;
|
return !!element;
|
||||||
},
|
},
|
||||||
|
|
||||||
isCommandEnabled: function (aCommand)
|
isCommandEnabled: function(aCommand)
|
||||||
{
|
{
|
||||||
// Handle commands that are not selection-specific.
|
// Handle commands that are not selection-specific.
|
||||||
if (aCommand == "downloadsCmd_clearList") {
|
if (aCommand == "downloadsCmd_clearList") {
|
||||||
|
|
@ -1156,7 +1156,7 @@ const DownloadsViewController = {
|
||||||
.isCommandEnabled(aCommand);
|
.isCommandEnabled(aCommand);
|
||||||
},
|
},
|
||||||
|
|
||||||
doCommand: function (aCommand)
|
doCommand: function(aCommand)
|
||||||
{
|
{
|
||||||
// If this command is not selection-specific, execute it.
|
// If this command is not selection-specific, execute it.
|
||||||
if (aCommand in this.commands) {
|
if (aCommand in this.commands) {
|
||||||
|
|
@ -1172,12 +1172,12 @@ const DownloadsViewController = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onEvent: function () { },
|
onEvent: function() { },
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// Other functions
|
//// Other functions
|
||||||
|
|
||||||
updateCommands: function ()
|
updateCommands: function()
|
||||||
{
|
{
|
||||||
Object.keys(this.commands).forEach(goUpdateCommand);
|
Object.keys(this.commands).forEach(goUpdateCommand);
|
||||||
Object.keys(DownloadsViewItemController.prototype.commands)
|
Object.keys(DownloadsViewItemController.prototype.commands)
|
||||||
|
|
@ -1192,7 +1192,7 @@ const DownloadsViewController = {
|
||||||
* the currently selected item in the list.
|
* the currently selected item in the list.
|
||||||
*/
|
*/
|
||||||
commands: {
|
commands: {
|
||||||
downloadsCmd_clearList: function ()
|
downloadsCmd_clearList: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.getData(window).removeFinished();
|
DownloadsCommon.getData(window).removeFinished();
|
||||||
}
|
}
|
||||||
|
|
@ -1213,7 +1213,7 @@ function DownloadsViewItemController(download) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadsViewItemController.prototype = {
|
DownloadsViewItemController.prototype = {
|
||||||
isCommandEnabled: function (aCommand)
|
isCommandEnabled: function(aCommand)
|
||||||
{
|
{
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "downloadsCmd_open": {
|
case "downloadsCmd_open": {
|
||||||
|
|
@ -1252,7 +1252,7 @@ DownloadsViewItemController.prototype = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
doCommand: function (aCommand)
|
doCommand: function(aCommand)
|
||||||
{
|
{
|
||||||
if (this.isCommandEnabled(aCommand)) {
|
if (this.isCommandEnabled(aCommand)) {
|
||||||
this.commands[aCommand].apply(this);
|
this.commands[aCommand].apply(this);
|
||||||
|
|
@ -1268,20 +1268,20 @@ DownloadsViewItemController.prototype = {
|
||||||
* In commands, the "this" identifier points to the controller item.
|
* In commands, the "this" identifier points to the controller item.
|
||||||
*/
|
*/
|
||||||
commands: {
|
commands: {
|
||||||
cmd_delete: function ()
|
cmd_delete: function()
|
||||||
{
|
{
|
||||||
DownloadsCommon.removeAndFinalizeDownload(this.download);
|
DownloadsCommon.removeAndFinalizeDownload(this.download);
|
||||||
PlacesUtils.bhistory.removePage(
|
PlacesUtils.bhistory.removePage(
|
||||||
NetUtil.newURI(this.download.source.url));
|
NetUtil.newURI(this.download.source.url));
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_cancel: function ()
|
downloadsCmd_cancel: function()
|
||||||
{
|
{
|
||||||
this.download.cancel().catch(() => {});
|
this.download.cancel().catch(() => {});
|
||||||
this.download.removePartialData().catch(Cu.reportError);
|
this.download.removePartialData().catch(Cu.reportError);
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_open: function ()
|
downloadsCmd_open: function()
|
||||||
{
|
{
|
||||||
this.download.launch().catch(Cu.reportError);
|
this.download.launch().catch(Cu.reportError);
|
||||||
|
|
||||||
|
|
@ -1293,7 +1293,7 @@ DownloadsViewItemController.prototype = {
|
||||||
DownloadsPanel.hidePanel();
|
DownloadsPanel.hidePanel();
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_show: function ()
|
downloadsCmd_show: function()
|
||||||
{
|
{
|
||||||
let file = new FileUtils.File(this.download.target.path);
|
let file = new FileUtils.File(this.download.target.path);
|
||||||
DownloadsCommon.showDownloadedFile(file);
|
DownloadsCommon.showDownloadedFile(file);
|
||||||
|
|
@ -1306,7 +1306,7 @@ DownloadsViewItemController.prototype = {
|
||||||
DownloadsPanel.hidePanel();
|
DownloadsPanel.hidePanel();
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_pauseResume: function ()
|
downloadsCmd_pauseResume: function()
|
||||||
{
|
{
|
||||||
if (this.download.stopped) {
|
if (this.download.stopped) {
|
||||||
this.download.start();
|
this.download.start();
|
||||||
|
|
@ -1315,29 +1315,29 @@ DownloadsViewItemController.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_retry: function ()
|
downloadsCmd_retry: function()
|
||||||
{
|
{
|
||||||
this.download.start().catch(() => {});
|
this.download.start().catch(() => {});
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_openReferrer: function ()
|
downloadsCmd_openReferrer: function()
|
||||||
{
|
{
|
||||||
openURL(this.download.source.referrer);
|
openURL(this.download.source.referrer);
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_copyLocation: function ()
|
downloadsCmd_copyLocation: function()
|
||||||
{
|
{
|
||||||
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
|
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
|
||||||
.getService(Ci.nsIClipboardHelper);
|
.getService(Ci.nsIClipboardHelper);
|
||||||
clipboard.copyString(this.download.source.url, document);
|
clipboard.copyString(this.download.source.url, document);
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadsCmd_doDefault: function ()
|
downloadsCmd_doDefault: function()
|
||||||
{
|
{
|
||||||
const nsIDM = Ci.nsIDownloadManager;
|
const nsIDM = Ci.nsIDownloadManager;
|
||||||
|
|
||||||
// Determine the default command for the current item.
|
// Determine the default command for the current item.
|
||||||
let defaultCommand = function () {
|
let defaultCommand = function() {
|
||||||
switch (DownloadsCommon.stateOfDownload(this.download)) {
|
switch (DownloadsCommon.stateOfDownload(this.download)) {
|
||||||
case nsIDM.DOWNLOAD_NOTSTARTED: return "downloadsCmd_cancel";
|
case nsIDM.DOWNLOAD_NOTSTARTED: return "downloadsCmd_cancel";
|
||||||
case nsIDM.DOWNLOAD_FINISHED: return "downloadsCmd_open";
|
case nsIDM.DOWNLOAD_FINISHED: return "downloadsCmd_open";
|
||||||
|
|
@ -1478,7 +1478,7 @@ const DownloadsSummary = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The keydown event being handled.
|
* The keydown event being handled.
|
||||||
*/
|
*/
|
||||||
onKeyDown: function (aEvent)
|
onKeyDown: function(aEvent)
|
||||||
{
|
{
|
||||||
if (aEvent.charCode == " ".charCodeAt(0) ||
|
if (aEvent.charCode == " ".charCodeAt(0) ||
|
||||||
aEvent.keyCode == KeyEvent.DOM_VK_ENTER ||
|
aEvent.keyCode == KeyEvent.DOM_VK_ENTER ||
|
||||||
|
|
@ -1493,7 +1493,7 @@ const DownloadsSummary = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The click event being handled.
|
* The click event being handled.
|
||||||
*/
|
*/
|
||||||
onClick: function (aEvent)
|
onClick: function(aEvent)
|
||||||
{
|
{
|
||||||
DownloadsPanel.showDownloadsHistory();
|
DownloadsPanel.showDownloadsHistory();
|
||||||
},
|
},
|
||||||
|
|
@ -1569,7 +1569,7 @@ const DownloadsFooter = {
|
||||||
* is visible, focus it. If not, focus the "Show All Downloads"
|
* is visible, focus it. If not, focus the "Show All Downloads"
|
||||||
* button.
|
* button.
|
||||||
*/
|
*/
|
||||||
focus: function ()
|
focus: function()
|
||||||
{
|
{
|
||||||
if (this._showingSummary) {
|
if (this._showingSummary) {
|
||||||
DownloadsSummary.focus();
|
DownloadsSummary.focus();
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ const DownloadsButton = {
|
||||||
* startup time, and in particular should not cause the Download Manager
|
* startup time, and in particular should not cause the Download Manager
|
||||||
* service to start.
|
* service to start.
|
||||||
*/
|
*/
|
||||||
initializeIndicator: function ()
|
initializeIndicator: function()
|
||||||
{
|
{
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
@ -77,7 +77,7 @@ const DownloadsButton = {
|
||||||
* placeholder is an ordinary button defined in the browser window that can be
|
* placeholder is an ordinary button defined in the browser window that can be
|
||||||
* moved freely between the toolbars and the customization palette.
|
* moved freely between the toolbars and the customization palette.
|
||||||
*/
|
*/
|
||||||
customizeStart: function ()
|
customizeStart: function()
|
||||||
{
|
{
|
||||||
// Hide the indicator and prevent it to be displayed as a temporary anchor
|
// Hide the indicator and prevent it to be displayed as a temporary anchor
|
||||||
// during customization, even if requested using the getAnchor method.
|
// during customization, even if requested using the getAnchor method.
|
||||||
|
|
@ -98,7 +98,7 @@ const DownloadsButton = {
|
||||||
/**
|
/**
|
||||||
* This function is called when toolbar customization ends.
|
* This function is called when toolbar customization ends.
|
||||||
*/
|
*/
|
||||||
customizeDone: function ()
|
customizeDone: function()
|
||||||
{
|
{
|
||||||
this._customizing = false;
|
this._customizing = false;
|
||||||
this._update();
|
this._update();
|
||||||
|
|
@ -114,7 +114,7 @@ const DownloadsButton = {
|
||||||
* input/output it performs, and in particular should not cause the
|
* input/output it performs, and in particular should not cause the
|
||||||
* Download Manager service to start.
|
* Download Manager service to start.
|
||||||
*/
|
*/
|
||||||
_update: function () {
|
_update: function() {
|
||||||
this._updatePositionInternal();
|
this._updatePositionInternal();
|
||||||
|
|
||||||
if (!DownloadsCommon.useToolkitUI) {
|
if (!DownloadsCommon.useToolkitUI) {
|
||||||
|
|
@ -131,7 +131,7 @@ const DownloadsButton = {
|
||||||
* that the panel doesn't flicker because we move the DOM element to which
|
* that the panel doesn't flicker because we move the DOM element to which
|
||||||
* it's anchored.
|
* it's anchored.
|
||||||
*/
|
*/
|
||||||
updatePosition: function ()
|
updatePosition: function()
|
||||||
{
|
{
|
||||||
if (!this._anchorRequested) {
|
if (!this._anchorRequested) {
|
||||||
this._updatePositionInternal();
|
this._updatePositionInternal();
|
||||||
|
|
@ -144,7 +144,7 @@ const DownloadsButton = {
|
||||||
*
|
*
|
||||||
* @return Anchor element, or null if the indicator is not visible.
|
* @return Anchor element, or null if the indicator is not visible.
|
||||||
*/
|
*/
|
||||||
_updatePositionInternal: function ()
|
_updatePositionInternal: function()
|
||||||
{
|
{
|
||||||
let indicator = DownloadsIndicatorView.indicator;
|
let indicator = DownloadsIndicatorView.indicator;
|
||||||
if (!indicator) {
|
if (!indicator) {
|
||||||
|
|
@ -187,7 +187,7 @@ const DownloadsButton = {
|
||||||
* Called once the indicator overlay has loaded. Gets a boolean
|
* Called once the indicator overlay has loaded. Gets a boolean
|
||||||
* argument representing the indicator visibility.
|
* argument representing the indicator visibility.
|
||||||
*/
|
*/
|
||||||
checkIsVisible: function (aCallback)
|
checkIsVisible: function(aCallback)
|
||||||
{
|
{
|
||||||
function DB_CEV_callback() {
|
function DB_CEV_callback() {
|
||||||
if (!this._placeholder) {
|
if (!this._placeholder) {
|
||||||
|
|
@ -215,7 +215,7 @@ const DownloadsButton = {
|
||||||
* panel should be anchored, or null if an anchor is not available (for
|
* panel should be anchored, or null if an anchor is not available (for
|
||||||
* example because both the tab bar and the navigation bar are hidden).
|
* example because both the tab bar and the navigation bar are hidden).
|
||||||
*/
|
*/
|
||||||
getAnchor: function (aCallback)
|
getAnchor: function(aCallback)
|
||||||
{
|
{
|
||||||
// Do not allow anchoring the panel to the element while customizing.
|
// Do not allow anchoring the panel to the element while customizing.
|
||||||
if (this._customizing) {
|
if (this._customizing) {
|
||||||
|
|
@ -235,7 +235,7 @@ const DownloadsButton = {
|
||||||
/**
|
/**
|
||||||
* Allows the temporary anchor to be hidden.
|
* Allows the temporary anchor to be hidden.
|
||||||
*/
|
*/
|
||||||
releaseAnchor: function ()
|
releaseAnchor: function()
|
||||||
{
|
{
|
||||||
this._anchorRequested = false;
|
this._anchorRequested = false;
|
||||||
this._updatePositionInternal();
|
this._updatePositionInternal();
|
||||||
|
|
@ -284,7 +284,7 @@ const DownloadsIndicatorView = {
|
||||||
/**
|
/**
|
||||||
* Prepares the downloads indicator to be displayed.
|
* Prepares the downloads indicator to be displayed.
|
||||||
*/
|
*/
|
||||||
ensureInitialized: function ()
|
ensureInitialized: function()
|
||||||
{
|
{
|
||||||
if (this._initialized) {
|
if (this._initialized) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -298,7 +298,7 @@ const DownloadsIndicatorView = {
|
||||||
/**
|
/**
|
||||||
* Frees the internal resources related to the indicator.
|
* Frees the internal resources related to the indicator.
|
||||||
*/
|
*/
|
||||||
ensureTerminated: function ()
|
ensureTerminated: function()
|
||||||
{
|
{
|
||||||
if (!this._initialized) {
|
if (!this._initialized) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -320,7 +320,7 @@ const DownloadsIndicatorView = {
|
||||||
* Ensures that the user interface elements required to display the indicator
|
* Ensures that the user interface elements required to display the indicator
|
||||||
* are loaded, then invokes the given callback.
|
* are loaded, then invokes the given callback.
|
||||||
*/
|
*/
|
||||||
_ensureOperational: function (aCallback)
|
_ensureOperational: function(aCallback)
|
||||||
{
|
{
|
||||||
if (this._operational) {
|
if (this._operational) {
|
||||||
aCallback();
|
aCallback();
|
||||||
|
|
@ -359,7 +359,7 @@ const DownloadsIndicatorView = {
|
||||||
* @param aType
|
* @param aType
|
||||||
* Set to "start" for new downloads, "finish" for completed downloads.
|
* Set to "start" for new downloads, "finish" for completed downloads.
|
||||||
*/
|
*/
|
||||||
showEventNotification: function (aType)
|
showEventNotification: function(aType)
|
||||||
{
|
{
|
||||||
if (!this._initialized) {
|
if (!this._initialized) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -386,7 +386,7 @@ const DownloadsIndicatorView = {
|
||||||
let indicator = this.indicator;
|
let indicator = this.indicator;
|
||||||
indicator.setAttribute("notification", aType);
|
indicator.setAttribute("notification", aType);
|
||||||
this._notificationTimeout = setTimeout(
|
this._notificationTimeout = setTimeout(
|
||||||
function () indicator.removeAttribute("notification"), 1000);
|
function() indicator.removeAttribute("notification"), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._ensureOperational(DIV_SEN_callback.bind(this));
|
this._ensureOperational(DIV_SEN_callback.bind(this));
|
||||||
|
|
@ -516,13 +516,13 @@ const DownloadsIndicatorView = {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//// User interface event functions
|
//// User interface event functions
|
||||||
|
|
||||||
onWindowUnload: function ()
|
onWindowUnload: function()
|
||||||
{
|
{
|
||||||
// This function is registered as an event listener, we can't use "this".
|
// This function is registered as an event listener, we can't use "this".
|
||||||
DownloadsIndicatorView.ensureTerminated();
|
DownloadsIndicatorView.ensureTerminated();
|
||||||
},
|
},
|
||||||
|
|
||||||
onCommand: function (aEvent)
|
onCommand: function(aEvent)
|
||||||
{
|
{
|
||||||
if (DownloadsCommon.useToolkitUI) {
|
if (DownloadsCommon.useToolkitUI) {
|
||||||
// The panel won't suppress attention for us, we need to clear now.
|
// The panel won't suppress attention for us, we need to clear now.
|
||||||
|
|
@ -535,12 +535,12 @@ const DownloadsIndicatorView = {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
onDragOver: function (aEvent)
|
onDragOver: function(aEvent)
|
||||||
{
|
{
|
||||||
browserDragAndDrop.dragOver(aEvent);
|
browserDragAndDrop.dragOver(aEvent);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDrop: function (aEvent)
|
onDrop: function(aEvent)
|
||||||
{
|
{
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
// If dragged item is from our source, do not try to
|
// If dragged item is from our source, do not try to
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIStreamConverter.idl
|
* See nsIStreamConverter.idl
|
||||||
*/
|
*/
|
||||||
convert: function (sourceStream, sourceType, destinationType,
|
convert: function(sourceStream, sourceType, destinationType,
|
||||||
context) {
|
context) {
|
||||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
},
|
},
|
||||||
|
|
@ -135,7 +135,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIStreamConverter.idl
|
* See nsIStreamConverter.idl
|
||||||
*/
|
*/
|
||||||
asyncConvertData: function (sourceType, destinationType,
|
asyncConvertData: function(sourceType, destinationType,
|
||||||
listener, context) {
|
listener, context) {
|
||||||
this._listener = listener;
|
this._listener = listener;
|
||||||
},
|
},
|
||||||
|
|
@ -148,7 +148,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* Release our references to various things once we're done using them.
|
* Release our references to various things once we're done using them.
|
||||||
*/
|
*/
|
||||||
_releaseHandles: function () {
|
_releaseHandles: function() {
|
||||||
this._listener = null;
|
this._listener = null;
|
||||||
this._request = null;
|
this._request = null;
|
||||||
this._processor = null;
|
this._processor = null;
|
||||||
|
|
@ -157,7 +157,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIFeedResultListener.idl
|
* See nsIFeedResultListener.idl
|
||||||
*/
|
*/
|
||||||
handleResult: function (result) {
|
handleResult: function(result) {
|
||||||
// Feeds come in various content types, which our feed sniffer coerces to
|
// Feeds come in various content types, which our feed sniffer coerces to
|
||||||
// the maybe.feed type. However, feeds are used as a transport for
|
// the maybe.feed type. However, feeds are used as a transport for
|
||||||
// different data types, e.g. news/blogs (traditional feed), video/audio
|
// different data types, e.g. news/blogs (traditional feed), video/audio
|
||||||
|
|
@ -270,7 +270,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIStreamListener.idl
|
* See nsIStreamListener.idl
|
||||||
*/
|
*/
|
||||||
onDataAvailable: function (request, context, inputStream,
|
onDataAvailable: function(request, context, inputStream,
|
||||||
sourceOffset, count) {
|
sourceOffset, count) {
|
||||||
if (this._processor)
|
if (this._processor)
|
||||||
this._processor.onDataAvailable(request, context, inputStream,
|
this._processor.onDataAvailable(request, context, inputStream,
|
||||||
|
|
@ -280,7 +280,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIRequestObserver.idl
|
* See nsIRequestObserver.idl
|
||||||
*/
|
*/
|
||||||
onStartRequest: function (request, context) {
|
onStartRequest: function(request, context) {
|
||||||
var channel = request.QueryInterface(Ci.nsIChannel);
|
var channel = request.QueryInterface(Ci.nsIChannel);
|
||||||
|
|
||||||
// Check for a header that tells us there was no sniffing
|
// Check for a header that tells us there was no sniffing
|
||||||
|
|
@ -323,7 +323,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIRequestObserver.idl
|
* See nsIRequestObserver.idl
|
||||||
*/
|
*/
|
||||||
onStopRequest: function (request, context, status) {
|
onStopRequest: function(request, context, status) {
|
||||||
if (this._processor)
|
if (this._processor)
|
||||||
this._processor.onStopRequest(request, context, status);
|
this._processor.onStopRequest(request, context, status);
|
||||||
},
|
},
|
||||||
|
|
@ -331,7 +331,7 @@ FeedConverter.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsISupports.idl
|
* See nsISupports.idl
|
||||||
*/
|
*/
|
||||||
QueryInterface: function (iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIFeedResultListener) ||
|
if (iid.equals(Ci.nsIFeedResultListener) ||
|
||||||
iid.equals(Ci.nsIStreamConverter) ||
|
iid.equals(Ci.nsIStreamConverter) ||
|
||||||
iid.equals(Ci.nsIStreamListener) ||
|
iid.equals(Ci.nsIStreamListener) ||
|
||||||
|
|
@ -366,7 +366,7 @@ FeedResultService.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIFeedResultService.idl
|
* See nsIFeedResultService.idl
|
||||||
*/
|
*/
|
||||||
addToClientReader: function (spec, title, subtitle, feedType) {
|
addToClientReader: function(spec, title, subtitle, feedType) {
|
||||||
var prefs =
|
var prefs =
|
||||||
Cc["@mozilla.org/preferences-service;1"].
|
Cc["@mozilla.org/preferences-service;1"].
|
||||||
getService(Ci.nsIPrefBranch);
|
getService(Ci.nsIPrefBranch);
|
||||||
|
|
@ -432,7 +432,7 @@ FeedResultService.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIFeedResultService.idl
|
* See nsIFeedResultService.idl
|
||||||
*/
|
*/
|
||||||
addFeedResult: function (feedResult) {
|
addFeedResult: function(feedResult) {
|
||||||
NS_ASSERT(feedResult.uri != null, "null URI!");
|
NS_ASSERT(feedResult.uri != null, "null URI!");
|
||||||
NS_ASSERT(feedResult.uri != null, "null feedResult!");
|
NS_ASSERT(feedResult.uri != null, "null feedResult!");
|
||||||
var spec = feedResult.uri.spec;
|
var spec = feedResult.uri.spec;
|
||||||
|
|
@ -444,7 +444,7 @@ FeedResultService.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIFeedResultService.idl
|
* See nsIFeedResultService.idl
|
||||||
*/
|
*/
|
||||||
getFeedResult: function (uri) {
|
getFeedResult: function(uri) {
|
||||||
NS_ASSERT(uri != null, "null URI!");
|
NS_ASSERT(uri != null, "null URI!");
|
||||||
var resultList = this._results[uri.spec];
|
var resultList = this._results[uri.spec];
|
||||||
for (var i in resultList) {
|
for (var i in resultList) {
|
||||||
|
|
@ -457,7 +457,7 @@ FeedResultService.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIFeedResultService.idl
|
* See nsIFeedResultService.idl
|
||||||
*/
|
*/
|
||||||
removeFeedResult: function (uri) {
|
removeFeedResult: function(uri) {
|
||||||
NS_ASSERT(uri != null, "null URI!");
|
NS_ASSERT(uri != null, "null URI!");
|
||||||
var resultList = this._results[uri.spec];
|
var resultList = this._results[uri.spec];
|
||||||
if (!resultList)
|
if (!resultList)
|
||||||
|
|
@ -478,13 +478,13 @@ FeedResultService.prototype = {
|
||||||
delete this._results[uri.spec];
|
delete this._results[uri.spec];
|
||||||
},
|
},
|
||||||
|
|
||||||
createInstance: function (outer, iid) {
|
createInstance: function(outer, iid) {
|
||||||
if (outer != null)
|
if (outer != null)
|
||||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||||
return this.QueryInterface(iid);
|
return this.QueryInterface(iid);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function (iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIFeedResultService) ||
|
if (iid.equals(Ci.nsIFeedResultService) ||
|
||||||
iid.equals(Ci.nsIFactory) ||
|
iid.equals(Ci.nsIFactory) ||
|
||||||
iid.equals(Ci.nsISupports))
|
iid.equals(Ci.nsISupports))
|
||||||
|
|
@ -500,7 +500,7 @@ FeedResultService.prototype = {
|
||||||
function GenericProtocolHandler() {
|
function GenericProtocolHandler() {
|
||||||
}
|
}
|
||||||
GenericProtocolHandler.prototype = {
|
GenericProtocolHandler.prototype = {
|
||||||
_init: function (scheme) {
|
_init: function(scheme) {
|
||||||
var ios =
|
var ios =
|
||||||
Cc["@mozilla.org/network/io-service;1"].
|
Cc["@mozilla.org/network/io-service;1"].
|
||||||
getService(Ci.nsIIOService);
|
getService(Ci.nsIIOService);
|
||||||
|
|
@ -520,11 +520,11 @@ GenericProtocolHandler.prototype = {
|
||||||
return this._http.defaultPort;
|
return this._http.defaultPort;
|
||||||
},
|
},
|
||||||
|
|
||||||
allowPort: function (port, scheme) {
|
allowPort: function(port, scheme) {
|
||||||
return this._http.allowPort(port, scheme);
|
return this._http.allowPort(port, scheme);
|
||||||
},
|
},
|
||||||
|
|
||||||
newURI: function (spec, originalCharset, baseURI) {
|
newURI: function(spec, originalCharset, baseURI) {
|
||||||
// Feed URIs can be either nested URIs of the form feed:realURI (in which
|
// Feed URIs can be either nested URIs of the form feed:realURI (in which
|
||||||
// case we create a nested URI for the realURI) or feed://example.com, in
|
// case we create a nested URI for the realURI) or feed://example.com, in
|
||||||
// which case we create a nested URI for the real protocol which is http.
|
// which case we create a nested URI for the real protocol which is http.
|
||||||
|
|
@ -548,7 +548,7 @@ GenericProtocolHandler.prototype = {
|
||||||
return uri;
|
return uri;
|
||||||
},
|
},
|
||||||
|
|
||||||
newChannel2: function (aUri, aLoadInfo) {
|
newChannel2: function(aUri, aLoadInfo) {
|
||||||
var inner = aUri.QueryInterface(Ci.nsINestedURI).innerURI;
|
var inner = aUri.QueryInterface(Ci.nsINestedURI).innerURI;
|
||||||
var channel = Cc["@mozilla.org/network/io-service;1"].
|
var channel = Cc["@mozilla.org/network/io-service;1"].
|
||||||
getService(Ci.nsIIOService).
|
getService(Ci.nsIIOService).
|
||||||
|
|
@ -562,7 +562,7 @@ GenericProtocolHandler.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
QueryInterface: function (iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIProtocolHandler) ||
|
if (iid.equals(Ci.nsIProtocolHandler) ||
|
||||||
iid.equals(Ci.nsISupports))
|
iid.equals(Ci.nsISupports))
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
|
|
@ -149,12 +149,12 @@ FeedWriter.prototype = {
|
||||||
_mimeSvc : Cc["@mozilla.org/mime;1"].
|
_mimeSvc : Cc["@mozilla.org/mime;1"].
|
||||||
getService(Ci.nsIMIMEService),
|
getService(Ci.nsIMIMEService),
|
||||||
|
|
||||||
_getPropertyAsBag: function (container, property) {
|
_getPropertyAsBag: function(container, property) {
|
||||||
return container.fields.getProperty(property).
|
return container.fields.getProperty(property).
|
||||||
QueryInterface(Ci.nsIPropertyBag2);
|
QueryInterface(Ci.nsIPropertyBag2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPropertyAsString: function (container, property) {
|
_getPropertyAsString: function(container, property) {
|
||||||
try {
|
try {
|
||||||
return container.fields.getPropertyAsAString(property);
|
return container.fields.getPropertyAsAString(property);
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +163,7 @@ FeedWriter.prototype = {
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
_setContentText: function (id, text) {
|
_setContentText: function(id, text) {
|
||||||
this._contentSandbox.element = this._document.getElementById(id);
|
this._contentSandbox.element = this._document.getElementById(id);
|
||||||
this._contentSandbox.textNode = text.createDocumentFragment(this._contentSandbox.element);
|
this._contentSandbox.textNode = text.createDocumentFragment(this._contentSandbox.element);
|
||||||
var codeStr =
|
var codeStr =
|
||||||
|
|
@ -190,7 +190,7 @@ FeedWriter.prototype = {
|
||||||
* The URI spec to set as the href
|
* The URI spec to set as the href
|
||||||
*/
|
*/
|
||||||
_safeSetURIAttribute:
|
_safeSetURIAttribute:
|
||||||
function (element, attribute, uri) {
|
function(element, attribute, uri) {
|
||||||
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||||
getService(Ci.nsIScriptSecurityManager);
|
getService(Ci.nsIScriptSecurityManager);
|
||||||
const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
|
const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
|
||||||
|
|
@ -243,7 +243,7 @@ FeedWriter.prototype = {
|
||||||
* @param aElement
|
* @param aElement
|
||||||
* the XUL element to call doCommand() on.
|
* the XUL element to call doCommand() on.
|
||||||
*/
|
*/
|
||||||
_safeDoCommand: function (aElement) {
|
_safeDoCommand: function(aElement) {
|
||||||
this._contentSandbox.element = aElement;
|
this._contentSandbox.element = aElement;
|
||||||
Cu.evalInSandbox("element.doCommand();", this._contentSandbox);
|
Cu.evalInSandbox("element.doCommand();", this._contentSandbox);
|
||||||
this._contentSandbox.element = null;
|
this._contentSandbox.element = null;
|
||||||
|
|
@ -268,16 +268,16 @@ FeedWriter.prototype = {
|
||||||
return this.__bundle;
|
return this.__bundle;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getFormattedString: function (key, params) {
|
_getFormattedString: function(key, params) {
|
||||||
return this._bundle.formatStringFromName(key, params, params.length);
|
return this._bundle.formatStringFromName(key, params, params.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getString: function (key) {
|
_getString: function(key) {
|
||||||
return this._bundle.GetStringFromName(key);
|
return this._bundle.GetStringFromName(key);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Magic helper methods to be used instead of xbl properties */
|
/* Magic helper methods to be used instead of xbl properties */
|
||||||
_getSelectedItemFromMenulist: function (aList) {
|
_getSelectedItemFromMenulist: function(aList) {
|
||||||
var node = aList.firstChild.firstChild;
|
var node = aList.firstChild.firstChild;
|
||||||
while (node) {
|
while (node) {
|
||||||
if (node.localName == "menuitem" && node.getAttribute("selected") == "true")
|
if (node.localName == "menuitem" && node.getAttribute("selected") == "true")
|
||||||
|
|
@ -289,7 +289,7 @@ FeedWriter.prototype = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setCheckboxCheckedState: function (aCheckbox, aValue) {
|
_setCheckboxCheckedState: function(aCheckbox, aValue) {
|
||||||
// see checkbox.xml, xbl bindings are not applied within the sandbox!
|
// see checkbox.xml, xbl bindings are not applied within the sandbox!
|
||||||
this._contentSandbox.checkbox = aCheckbox;
|
this._contentSandbox.checkbox = aCheckbox;
|
||||||
var codeStr;
|
var codeStr;
|
||||||
|
|
@ -315,7 +315,7 @@ FeedWriter.prototype = {
|
||||||
* @param dateString
|
* @param dateString
|
||||||
* A date as extracted from a feed entry. (entry.updated)
|
* A date as extracted from a feed entry. (entry.updated)
|
||||||
*/
|
*/
|
||||||
_parseDate: function (dateString) {
|
_parseDate: function(dateString) {
|
||||||
// Convert the date into the user's local time zone
|
// Convert the date into the user's local time zone
|
||||||
dateObj = new Date(dateString);
|
dateObj = new Date(dateString);
|
||||||
|
|
||||||
|
|
@ -334,7 +334,7 @@ FeedWriter.prototype = {
|
||||||
* Returns the feed type.
|
* Returns the feed type.
|
||||||
*/
|
*/
|
||||||
__feedType: null,
|
__feedType: null,
|
||||||
_getFeedType: function () {
|
_getFeedType: function() {
|
||||||
if (this.__feedType != null)
|
if (this.__feedType != null)
|
||||||
return this.__feedType;
|
return this.__feedType;
|
||||||
|
|
||||||
|
|
@ -352,7 +352,7 @@ FeedWriter.prototype = {
|
||||||
/**
|
/**
|
||||||
* Maps a feed type to a maybe-feed mimetype.
|
* Maps a feed type to a maybe-feed mimetype.
|
||||||
*/
|
*/
|
||||||
_getMimeTypeForFeedType: function () {
|
_getMimeTypeForFeedType: function() {
|
||||||
switch (this._getFeedType()) {
|
switch (this._getFeedType()) {
|
||||||
case Ci.nsIFeed.TYPE_VIDEO:
|
case Ci.nsIFeed.TYPE_VIDEO:
|
||||||
return TYPE_MAYBE_VIDEO_FEED;
|
return TYPE_MAYBE_VIDEO_FEED;
|
||||||
|
|
@ -370,7 +370,7 @@ FeedWriter.prototype = {
|
||||||
* @param container
|
* @param container
|
||||||
* The feed container
|
* The feed container
|
||||||
*/
|
*/
|
||||||
_setTitleText: function (container) {
|
_setTitleText: function(container) {
|
||||||
if (container.title) {
|
if (container.title) {
|
||||||
var title = container.title.plainText();
|
var title = container.title.plainText();
|
||||||
this._setContentText(TITLE_ID, container.title);
|
this._setContentText(TITLE_ID, container.title);
|
||||||
|
|
@ -390,7 +390,7 @@ FeedWriter.prototype = {
|
||||||
* @param container
|
* @param container
|
||||||
* The feed container
|
* The feed container
|
||||||
*/
|
*/
|
||||||
_setTitleImage: function (container) {
|
_setTitleImage: function(container) {
|
||||||
try {
|
try {
|
||||||
var parts = container.image;
|
var parts = container.image;
|
||||||
|
|
||||||
|
|
@ -432,7 +432,7 @@ FeedWriter.prototype = {
|
||||||
* @param container
|
* @param container
|
||||||
* The container of entries in the feed
|
* The container of entries in the feed
|
||||||
*/
|
*/
|
||||||
_writeFeedContent: function (container) {
|
_writeFeedContent: function(container) {
|
||||||
// Build the actual feed content
|
// Build the actual feed content
|
||||||
var feed = container.QueryInterface(Ci.nsIFeed);
|
var feed = container.QueryInterface(Ci.nsIFeed);
|
||||||
if (feed.items.length == 0)
|
if (feed.items.length == 0)
|
||||||
|
|
@ -532,7 +532,7 @@ FeedWriter.prototype = {
|
||||||
* The URL string from which to create a display name
|
* The URL string from which to create a display name
|
||||||
* @returns a string
|
* @returns a string
|
||||||
*/
|
*/
|
||||||
_getURLDisplayName: function (aURL) {
|
_getURLDisplayName: function(aURL) {
|
||||||
var url = makeURI(aURL);
|
var url = makeURI(aURL);
|
||||||
url.QueryInterface(Ci.nsIURL);
|
url.QueryInterface(Ci.nsIURL);
|
||||||
if (url == null || url.fileName.length == 0)
|
if (url == null || url.fileName.length == 0)
|
||||||
|
|
@ -548,7 +548,7 @@ FeedWriter.prototype = {
|
||||||
* FeedEntry with enclosures
|
* FeedEntry with enclosures
|
||||||
* @returns element
|
* @returns element
|
||||||
*/
|
*/
|
||||||
_buildEnclosureDiv: function (entry) {
|
_buildEnclosureDiv: function(entry) {
|
||||||
var enclosuresDiv = this._document.createElementNS(HTML_NS, "div");
|
var enclosuresDiv = this._document.createElementNS(HTML_NS, "div");
|
||||||
enclosuresDiv.className = "enclosures";
|
enclosuresDiv.className = "enclosures";
|
||||||
|
|
||||||
|
|
@ -628,7 +628,7 @@ FeedWriter.prototype = {
|
||||||
* @returns A valid nsIFeedContainer object containing the contents of
|
* @returns A valid nsIFeedContainer object containing the contents of
|
||||||
* the feed.
|
* the feed.
|
||||||
*/
|
*/
|
||||||
_getContainer: function (result) {
|
_getContainer: function(result) {
|
||||||
var feedService =
|
var feedService =
|
||||||
Cc["@mozilla.org/browser/feeds/result-service;1"].
|
Cc["@mozilla.org/browser/feeds/result-service;1"].
|
||||||
getService(Ci.nsIFeedResultService);
|
getService(Ci.nsIFeedResultService);
|
||||||
|
|
@ -668,7 +668,7 @@ FeedWriter.prototype = {
|
||||||
* A nsIFile to look up the name of
|
* A nsIFile to look up the name of
|
||||||
* @returns The display name of the application represented by the file.
|
* @returns The display name of the application represented by the file.
|
||||||
*/
|
*/
|
||||||
_getFileDisplayName: function (file) {
|
_getFileDisplayName: function(file) {
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
if (file instanceof Ci.nsILocalFileWin) {
|
if (file instanceof Ci.nsILocalFileWin) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -710,7 +710,7 @@ FeedWriter.prototype = {
|
||||||
* Helper method to get an element in the XBL binding where the handler
|
* Helper method to get an element in the XBL binding where the handler
|
||||||
* selection UI lives
|
* selection UI lives
|
||||||
*/
|
*/
|
||||||
_getUIElement: function (id) {
|
_getUIElement: function(id) {
|
||||||
return this._document.getAnonymousElementByAttribute(
|
return this._document.getAnonymousElementByAttribute(
|
||||||
this._document.getElementById("feedSubscribeLine"), "anonid", id);
|
this._document.getElementById("feedSubscribeLine"), "anonid", id);
|
||||||
},
|
},
|
||||||
|
|
@ -720,7 +720,7 @@ FeedWriter.prototype = {
|
||||||
* @param aCallback the callback method, passes in true if a feed reader was
|
* @param aCallback the callback method, passes in true if a feed reader was
|
||||||
* selected, false otherwise.
|
* selected, false otherwise.
|
||||||
*/
|
*/
|
||||||
_chooseClientApp: function (aCallback) {
|
_chooseClientApp: function(aCallback) {
|
||||||
try {
|
try {
|
||||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||||
let fpCallback = function fpCallback_done(aResult) {
|
let fpCallback = function fpCallback_done(aResult) {
|
||||||
|
|
@ -766,7 +766,7 @@ FeedWriter.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setAlwaysUseCheckedState: function (feedType) {
|
_setAlwaysUseCheckedState: function(feedType) {
|
||||||
var checkbox = this._getUIElement("alwaysUse");
|
var checkbox = this._getUIElement("alwaysUse");
|
||||||
if (checkbox) {
|
if (checkbox) {
|
||||||
var alwaysUse = false;
|
var alwaysUse = false;
|
||||||
|
|
@ -781,7 +781,7 @@ FeedWriter.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSubscribeUsingLabel: function () {
|
_setSubscribeUsingLabel: function() {
|
||||||
var stringLabel = "subscribeFeedUsing";
|
var stringLabel = "subscribeFeedUsing";
|
||||||
switch (this._getFeedType()) {
|
switch (this._getFeedType()) {
|
||||||
case Ci.nsIFeed.TYPE_VIDEO:
|
case Ci.nsIFeed.TYPE_VIDEO:
|
||||||
|
|
@ -800,7 +800,7 @@ FeedWriter.prototype = {
|
||||||
Cu.evalInSandbox(codeStr, this._contentSandbox);
|
Cu.evalInSandbox(codeStr, this._contentSandbox);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setAlwaysUseLabel: function () {
|
_setAlwaysUseLabel: function() {
|
||||||
var checkbox = this._getUIElement("alwaysUse");
|
var checkbox = this._getUIElement("alwaysUse");
|
||||||
if (checkbox) {
|
if (checkbox) {
|
||||||
if (this._handlersMenuList) {
|
if (this._handlersMenuList) {
|
||||||
|
|
@ -864,7 +864,7 @@ FeedWriter.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSelectedHandler: function (feedType) {
|
_setSelectedHandler: function(feedType) {
|
||||||
var prefs =
|
var prefs =
|
||||||
Cc["@mozilla.org/preferences-service;1"].
|
Cc["@mozilla.org/preferences-service;1"].
|
||||||
getService(Ci.nsIPrefBranch);
|
getService(Ci.nsIPrefBranch);
|
||||||
|
|
@ -927,7 +927,7 @@ FeedWriter.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_initSubscriptionUI: function () {
|
_initSubscriptionUI: function() {
|
||||||
var handlersMenuPopup = this._getUIElement("handlersMenuPopup");
|
var handlersMenuPopup = this._getUIElement("handlersMenuPopup");
|
||||||
if (!handlersMenuPopup)
|
if (!handlersMenuPopup)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1105,7 +1105,7 @@ FeedWriter.prototype = {
|
||||||
* @param aWindow
|
* @param aWindow
|
||||||
* The window of the document invoking the BrowserFeedWriter
|
* The window of the document invoking the BrowserFeedWriter
|
||||||
*/
|
*/
|
||||||
_getOriginalURI: function (aWindow) {
|
_getOriginalURI: function(aWindow) {
|
||||||
var chan = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
var chan = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||||
getInterface(Ci.nsIWebNavigation).
|
getInterface(Ci.nsIWebNavigation).
|
||||||
QueryInterface(Ci.nsIDocShell).currentDocumentChannel;
|
QueryInterface(Ci.nsIDocShell).currentDocumentChannel;
|
||||||
|
|
@ -1135,7 +1135,7 @@ FeedWriter.prototype = {
|
||||||
_handlersMenuList: null,
|
_handlersMenuList: null,
|
||||||
|
|
||||||
// BrowserFeedWriter WebIDL methods
|
// BrowserFeedWriter WebIDL methods
|
||||||
init: function (aWindow) {
|
init: function(aWindow) {
|
||||||
var window = aWindow;
|
var window = aWindow;
|
||||||
this._feedURI = this._getOriginalURI(window);
|
this._feedURI = this._getOriginalURI(window);
|
||||||
if (!this._feedURI)
|
if (!this._feedURI)
|
||||||
|
|
@ -1171,7 +1171,7 @@ FeedWriter.prototype = {
|
||||||
prefs.addObserver(PREF_AUDIO_SELECTED_APP, this, false);
|
prefs.addObserver(PREF_AUDIO_SELECTED_APP, this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
writeContent: function () {
|
writeContent: function() {
|
||||||
if (!this._window)
|
if (!this._window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1190,7 +1190,7 @@ FeedWriter.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function () {
|
close: function() {
|
||||||
this._getUIElement("handlersMenuPopup")
|
this._getUIElement("handlersMenuPopup")
|
||||||
.removeEventListener("command", this, false);
|
.removeEventListener("command", this, false);
|
||||||
this._getUIElement("subscribeButton")
|
this._getUIElement("subscribeButton")
|
||||||
|
|
@ -1220,7 +1220,7 @@ FeedWriter.prototype = {
|
||||||
this.__contentSandbox = null;
|
this.__contentSandbox = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeFeedFromCache: function () {
|
_removeFeedFromCache: function() {
|
||||||
if (this._feedURI) {
|
if (this._feedURI) {
|
||||||
var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"].
|
var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"].
|
||||||
getService(Ci.nsIFeedResultService);
|
getService(Ci.nsIFeedResultService);
|
||||||
|
|
@ -1229,7 +1229,7 @@ FeedWriter.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
subscribe: function () {
|
subscribe: function() {
|
||||||
var feedType = this._getFeedType();
|
var feedType = this._getFeedType();
|
||||||
|
|
||||||
// Subscribe to the feed using the selected handler and save prefs
|
// Subscribe to the feed using the selected handler and save prefs
|
||||||
|
|
@ -1313,7 +1313,7 @@ FeedWriter.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIObserver
|
// nsIObserver
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
if (!this._window) {
|
if (!this._window) {
|
||||||
// this._window is null unless this.init was called with a trusted
|
// this._window is null unless this.init was called with a trusted
|
||||||
// window object.
|
// window object.
|
||||||
|
|
@ -1356,7 +1356,7 @@ FeedWriter.prototype = {
|
||||||
* to the icon url. See Bug 358878 for details.
|
* to the icon url. See Bug 358878 for details.
|
||||||
*/
|
*/
|
||||||
_setFaviconForWebReader:
|
_setFaviconForWebReader:
|
||||||
function (aReaderUrl, aMenuItem) {
|
function(aReaderUrl, aMenuItem) {
|
||||||
var readerURI = makeURI(aReaderUrl);
|
var readerURI = makeURI(aReaderUrl);
|
||||||
if (!/^https?$/.test(readerURI.scheme)) {
|
if (!/^https?$/.test(readerURI.scheme)) {
|
||||||
// Don't try to get a favicon for non http(s) URIs.
|
// Don't try to get a favicon for non http(s) URIs.
|
||||||
|
|
@ -1374,7 +1374,7 @@ FeedWriter.prototype = {
|
||||||
this._faviconService.setAndFetchFaviconForPage(readerURI, faviconURI, false,
|
this._faviconService.setAndFetchFaviconForPage(readerURI, faviconURI, false,
|
||||||
usePrivateBrowsing ? this._faviconService.FAVICON_LOAD_PRIVATE
|
usePrivateBrowsing ? this._faviconService.FAVICON_LOAD_PRIVATE
|
||||||
: this._faviconService.FAVICON_LOAD_NON_PRIVATE,
|
: this._faviconService.FAVICON_LOAD_NON_PRIVATE,
|
||||||
function (aURI, aDataLen, aData, aMimeType) {
|
function(aURI, aDataLen, aData, aMimeType) {
|
||||||
if (aDataLen > 0) {
|
if (aDataLen > 0) {
|
||||||
var dataURL = "data:" + aMimeType + ";base64," +
|
var dataURL = "data:" + aMimeType + ";base64," +
|
||||||
btoa(String.fromCharCode.apply(null, aData));
|
btoa(String.fromCharCode.apply(null, aData));
|
||||||
|
|
|
||||||
|
|
@ -73,19 +73,19 @@ const NS_ERROR_DOM_SYNTAX_ERR = NS_ERROR_MODULE_DOM + 12;
|
||||||
function WebContentConverter() {
|
function WebContentConverter() {
|
||||||
}
|
}
|
||||||
WebContentConverter.prototype = {
|
WebContentConverter.prototype = {
|
||||||
convert: function () { },
|
convert: function() { },
|
||||||
asyncConvertData: function () { },
|
asyncConvertData: function() { },
|
||||||
onDataAvailable: function () { },
|
onDataAvailable: function() { },
|
||||||
onStopRequest: function () { },
|
onStopRequest: function() { },
|
||||||
|
|
||||||
onStartRequest: function (request, context) {
|
onStartRequest: function(request, context) {
|
||||||
var wccr =
|
var wccr =
|
||||||
Cc[WCCR_CONTRACTID].
|
Cc[WCCR_CONTRACTID].
|
||||||
getService(Ci.nsIWebContentConverterService);
|
getService(Ci.nsIWebContentConverterService);
|
||||||
wccr.loadPreferredHandler(request);
|
wccr.loadPreferredHandler(request);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function (iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIStreamConverter) ||
|
if (iid.equals(Ci.nsIStreamConverter) ||
|
||||||
iid.equals(Ci.nsIStreamListener) ||
|
iid.equals(Ci.nsIStreamListener) ||
|
||||||
iid.equals(Ci.nsISupports))
|
iid.equals(Ci.nsISupports))
|
||||||
|
|
@ -95,13 +95,13 @@ WebContentConverter.prototype = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var WebContentConverterFactory = {
|
var WebContentConverterFactory = {
|
||||||
createInstance: function (outer, iid) {
|
createInstance: function(outer, iid) {
|
||||||
if (outer != null)
|
if (outer != null)
|
||||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||||
return new WebContentConverter().QueryInterface(iid);
|
return new WebContentConverter().QueryInterface(iid);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function (iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIFactory) ||
|
if (iid.equals(Ci.nsIFactory) ||
|
||||||
iid.equals(Ci.nsISupports))
|
iid.equals(Ci.nsISupports))
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -125,7 +125,7 @@ ServiceInfo.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIHandlerApp
|
* See nsIHandlerApp
|
||||||
*/
|
*/
|
||||||
equals: function (aHandlerApp) {
|
equals: function(aHandlerApp) {
|
||||||
if (!aHandlerApp)
|
if (!aHandlerApp)
|
||||||
throw Cr.NS_ERROR_NULL_POINTER;
|
throw Cr.NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
|
@ -154,11 +154,11 @@ ServiceInfo.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIWebContentHandlerInfo
|
* See nsIWebContentHandlerInfo
|
||||||
*/
|
*/
|
||||||
getHandlerURI: function (uri) {
|
getHandlerURI: function(uri) {
|
||||||
return this._uri.replace(/%s/gi, encodeURIComponent(uri));
|
return this._uri.replace(/%s/gi, encodeURIComponent(uri));
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function (iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIWebContentHandlerInfo) ||
|
if (iid.equals(Ci.nsIWebContentHandlerInfo) ||
|
||||||
iid.equals(Ci.nsISupports))
|
iid.equals(Ci.nsISupports))
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -180,11 +180,11 @@ WebContentConverterRegistrar.prototype = {
|
||||||
return WebContentConverterRegistrar.prototype.stringBundle = sb;
|
return WebContentConverterRegistrar.prototype.stringBundle = sb;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getFormattedString: function (key, params) {
|
_getFormattedString: function(key, params) {
|
||||||
return this.stringBundle.formatStringFromName(key, params, params.length);
|
return this.stringBundle.formatStringFromName(key, params, params.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getString: function (key) {
|
_getString: function(key) {
|
||||||
return this.stringBundle.GetStringFromName(key);
|
return this.stringBundle.GetStringFromName(key);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -192,7 +192,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
getAutoHandler:
|
getAutoHandler:
|
||||||
function (contentType) {
|
function(contentType) {
|
||||||
contentType = this._resolveContentType(contentType);
|
contentType = this._resolveContentType(contentType);
|
||||||
if (contentType in this._autoHandleContentTypes)
|
if (contentType in this._autoHandleContentTypes)
|
||||||
return this._autoHandleContentTypes[contentType];
|
return this._autoHandleContentTypes[contentType];
|
||||||
|
|
@ -203,7 +203,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
setAutoHandler:
|
setAutoHandler:
|
||||||
function (contentType, handler) {
|
function(contentType, handler) {
|
||||||
if (handler && !this._typeIsRegistered(contentType, handler.uri))
|
if (handler && !this._typeIsRegistered(contentType, handler.uri))
|
||||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
|
|
@ -226,7 +226,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* Update the internal data structure (not persistent)
|
* Update the internal data structure (not persistent)
|
||||||
*/
|
*/
|
||||||
_setAutoHandler:
|
_setAutoHandler:
|
||||||
function (contentType, handler) {
|
function(contentType, handler) {
|
||||||
if (handler)
|
if (handler)
|
||||||
this._autoHandleContentTypes[contentType] = handler;
|
this._autoHandleContentTypes[contentType] = handler;
|
||||||
else if (contentType in this._autoHandleContentTypes)
|
else if (contentType in this._autoHandleContentTypes)
|
||||||
|
|
@ -237,7 +237,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
getWebContentHandlerByURI:
|
getWebContentHandlerByURI:
|
||||||
function (contentType, uri) {
|
function(contentType, uri) {
|
||||||
var handlers = this.getContentHandlers(contentType, { });
|
var handlers = this.getContentHandlers(contentType, { });
|
||||||
for (var i = 0; i < handlers.length; ++i) {
|
for (var i = 0; i < handlers.length; ++i) {
|
||||||
if (handlers[i].uri == uri)
|
if (handlers[i].uri == uri)
|
||||||
|
|
@ -250,7 +250,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
loadPreferredHandler:
|
loadPreferredHandler:
|
||||||
function (request) {
|
function(request) {
|
||||||
var channel = request.QueryInterface(Ci.nsIChannel);
|
var channel = request.QueryInterface(Ci.nsIChannel);
|
||||||
var contentType = this._resolveContentType(channel.contentType);
|
var contentType = this._resolveContentType(channel.contentType);
|
||||||
var handler = this.getAutoHandler(contentType);
|
var handler = this.getAutoHandler(contentType);
|
||||||
|
|
@ -269,7 +269,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
removeProtocolHandler:
|
removeProtocolHandler:
|
||||||
function (aProtocol, aURITemplate) {
|
function(aProtocol, aURITemplate) {
|
||||||
var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||||
getService(Ci.nsIExternalProtocolService);
|
getService(Ci.nsIExternalProtocolService);
|
||||||
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
|
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
|
||||||
|
|
@ -292,7 +292,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
removeContentHandler:
|
removeContentHandler:
|
||||||
function (contentType, uri) {
|
function(contentType, uri) {
|
||||||
function notURI(serviceInfo) {
|
function notURI(serviceInfo) {
|
||||||
return serviceInfo.uri != uri;
|
return serviceInfo.uri != uri;
|
||||||
}
|
}
|
||||||
|
|
@ -326,7 +326,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* @returns The resolved contentType value.
|
* @returns The resolved contentType value.
|
||||||
*/
|
*/
|
||||||
_resolveContentType:
|
_resolveContentType:
|
||||||
function (contentType) {
|
function(contentType) {
|
||||||
if (contentType in this._mappings)
|
if (contentType in this._mappings)
|
||||||
return this._mappings[contentType];
|
return this._mappings[contentType];
|
||||||
return contentType;
|
return contentType;
|
||||||
|
|
@ -339,7 +339,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkAndGetURI:
|
_checkAndGetURI:
|
||||||
function (aURIString, aContentWindow)
|
function(aURIString, aContentWindow)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
let baseURI = aContentWindow.document.baseURIObject;
|
let baseURI = aContentWindow.document.baseURIObject;
|
||||||
|
|
@ -382,7 +382,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* @return true if it is already registered, false otherwise.
|
* @return true if it is already registered, false otherwise.
|
||||||
*/
|
*/
|
||||||
_protocolHandlerRegistered:
|
_protocolHandlerRegistered:
|
||||||
function (aProtocol, aURITemplate) {
|
function(aProtocol, aURITemplate) {
|
||||||
var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||||
getService(Ci.nsIExternalProtocolService);
|
getService(Ci.nsIExternalProtocolService);
|
||||||
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
|
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
|
||||||
|
|
@ -401,7 +401,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentHandlerRegistrar
|
* See nsIWebContentHandlerRegistrar
|
||||||
*/
|
*/
|
||||||
registerProtocolHandler:
|
registerProtocolHandler:
|
||||||
function (aProtocol, aURIString, aTitle, aContentWindow) {
|
function(aProtocol, aURIString, aTitle, aContentWindow) {
|
||||||
LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")");
|
LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")");
|
||||||
|
|
||||||
var uri = this._checkAndGetURI(aURIString, aContentWindow);
|
var uri = this._checkAndGetURI(aURIString, aContentWindow);
|
||||||
|
|
@ -455,7 +455,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
|
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
|
||||||
|
|
||||||
callback:
|
callback:
|
||||||
function (aNotification, aButtonInfo) {
|
function(aNotification, aButtonInfo) {
|
||||||
var protocol = aButtonInfo.protocolInfo.protocol;
|
var protocol = aButtonInfo.protocolInfo.protocol;
|
||||||
var uri = aButtonInfo.protocolInfo.uri;
|
var uri = aButtonInfo.protocolInfo.uri;
|
||||||
var name = aButtonInfo.protocolInfo.name;
|
var name = aButtonInfo.protocolInfo.name;
|
||||||
|
|
@ -496,7 +496,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* prompt the user to confirm the registration.
|
* prompt the user to confirm the registration.
|
||||||
*/
|
*/
|
||||||
registerContentHandler:
|
registerContentHandler:
|
||||||
function (aContentType, aURIString, aTitle, aContentWindow) {
|
function(aContentType, aURIString, aTitle, aContentWindow) {
|
||||||
LOG("registerContentHandler(" + aContentType + "," + aURIString + "," + aTitle + ")");
|
LOG("registerContentHandler(" + aContentType + "," + aURIString + "," + aTitle + ")");
|
||||||
|
|
||||||
// Check against the type blacklist.
|
// Check against the type blacklist.
|
||||||
|
|
@ -526,7 +526,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* Returns the browser chrome window in which the content window is in
|
* Returns the browser chrome window in which the content window is in
|
||||||
*/
|
*/
|
||||||
_getBrowserWindowForContentWindow:
|
_getBrowserWindowForContentWindow:
|
||||||
function (aContentWindow) {
|
function(aContentWindow) {
|
||||||
return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||||
|
|
@ -547,7 +547,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* (i.e. the content window of a frame/iframe).
|
* (i.e. the content window of a frame/iframe).
|
||||||
*/
|
*/
|
||||||
_getBrowserForContentWindow:
|
_getBrowserForContentWindow:
|
||||||
function (aBrowserWindow, aContentWindow) {
|
function(aBrowserWindow, aContentWindow) {
|
||||||
// This depends on pseudo APIs of browser.js and tabbrowser.xml
|
// This depends on pseudo APIs of browser.js and tabbrowser.xml
|
||||||
aContentWindow = aContentWindow.top;
|
aContentWindow = aContentWindow.top;
|
||||||
var browsers = aBrowserWindow.gBrowser.browsers;
|
var browsers = aBrowserWindow.gBrowser.browsers;
|
||||||
|
|
@ -579,7 +579,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* @return true if a notification has been appended, false otherwise.
|
* @return true if a notification has been appended, false otherwise.
|
||||||
*/
|
*/
|
||||||
_appendFeedReaderNotification:
|
_appendFeedReaderNotification:
|
||||||
function (aURI, aName, aNotificationBox) {
|
function(aURI, aName, aNotificationBox) {
|
||||||
var uriSpec = aURI.spec;
|
var uriSpec = aURI.spec;
|
||||||
var notificationValue = "feed reader notification: " + uriSpec;
|
var notificationValue = "feed reader notification: " + uriSpec;
|
||||||
var notificationIcon = aURI.prePath + "/favicon.ico";
|
var notificationIcon = aURI.prePath + "/favicon.ico";
|
||||||
|
|
@ -603,7 +603,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
callback:
|
callback:
|
||||||
function (aNotification, aButtonInfo) {
|
function(aNotification, aButtonInfo) {
|
||||||
var uri = aButtonInfo.feedReaderInfo.uri;
|
var uri = aButtonInfo.feedReaderInfo.uri;
|
||||||
var name = aButtonInfo.feedReaderInfo.name;
|
var name = aButtonInfo.feedReaderInfo.name;
|
||||||
var outer = aButtonInfo._outer;
|
var outer = aButtonInfo._outer;
|
||||||
|
|
@ -645,7 +645,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* browser.contentHandlers.title0 = Foo 2.0alphr
|
* browser.contentHandlers.title0 = Foo 2.0alphr
|
||||||
*/
|
*/
|
||||||
_saveContentHandlerToPrefs:
|
_saveContentHandlerToPrefs:
|
||||||
function (contentType, uri, title) {
|
function(contentType, uri, title) {
|
||||||
var ps =
|
var ps =
|
||||||
Cc["@mozilla.org/preferences-service;1"].
|
Cc["@mozilla.org/preferences-service;1"].
|
||||||
getService(Ci.nsIPrefService);
|
getService(Ci.nsIPrefService);
|
||||||
|
|
@ -685,7 +685,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* @param uri
|
* @param uri
|
||||||
* The uri of the
|
* The uri of the
|
||||||
*/
|
*/
|
||||||
_typeIsRegistered: function (contentType, uri) {
|
_typeIsRegistered: function(contentType, uri) {
|
||||||
if (!(contentType in this._contentTypes))
|
if (!(contentType in this._contentTypes))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -705,7 +705,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* @returns A contract id to construct a converter to convert between the
|
* @returns A contract id to construct a converter to convert between the
|
||||||
* contentType and *\/*.
|
* contentType and *\/*.
|
||||||
*/
|
*/
|
||||||
_getConverterContractID: function (contentType) {
|
_getConverterContractID: function(contentType) {
|
||||||
const template = "@mozilla.org/streamconv;1?from=%s&to=*/*";
|
const template = "@mozilla.org/streamconv;1?from=%s&to=*/*";
|
||||||
return template.replace(/%s/, contentType);
|
return template.replace(/%s/, contentType);
|
||||||
},
|
},
|
||||||
|
|
@ -721,7 +721,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* the human readable name of the web service
|
* the human readable name of the web service
|
||||||
*/
|
*/
|
||||||
_registerContentHandler:
|
_registerContentHandler:
|
||||||
function (contentType, uri, title) {
|
function(contentType, uri, title) {
|
||||||
this._updateContentTypeHandlerMap(contentType, uri, title);
|
this._updateContentTypeHandlerMap(contentType, uri, title);
|
||||||
this._saveContentHandlerToPrefs(contentType, uri, title);
|
this._saveContentHandlerToPrefs(contentType, uri, title);
|
||||||
|
|
||||||
|
|
@ -754,7 +754,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* The human readable name of the web service
|
* The human readable name of the web service
|
||||||
*/
|
*/
|
||||||
_updateContentTypeHandlerMap:
|
_updateContentTypeHandlerMap:
|
||||||
function (contentType, uri, title) {
|
function(contentType, uri, title) {
|
||||||
if (!(contentType in this._contentTypes))
|
if (!(contentType in this._contentTypes))
|
||||||
this._contentTypes[contentType] = [];
|
this._contentTypes[contentType] = [];
|
||||||
|
|
||||||
|
|
@ -776,7 +776,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
getContentHandlers:
|
getContentHandlers:
|
||||||
function (contentType, countRef) {
|
function(contentType, countRef) {
|
||||||
countRef.value = 0;
|
countRef.value = 0;
|
||||||
if (!(contentType in this._contentTypes))
|
if (!(contentType in this._contentTypes))
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -790,7 +790,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* See nsIWebContentConverterService
|
* See nsIWebContentConverterService
|
||||||
*/
|
*/
|
||||||
resetHandlersForType:
|
resetHandlersForType:
|
||||||
function (contentType) {
|
function(contentType) {
|
||||||
// currently unused within the tree, so only useful for extensions; previous
|
// currently unused within the tree, so only useful for extensions; previous
|
||||||
// impl. was buggy (and even infinite-looped!), so I argue that this is a
|
// impl. was buggy (and even infinite-looped!), so I argue that this is a
|
||||||
// definite improvement
|
// definite improvement
|
||||||
|
|
@ -833,7 +833,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
* Load the auto handler, content handler and protocol tables from
|
* Load the auto handler, content handler and protocol tables from
|
||||||
* preferences.
|
* preferences.
|
||||||
*/
|
*/
|
||||||
_init: function () {
|
_init: function() {
|
||||||
var ps =
|
var ps =
|
||||||
Cc["@mozilla.org/preferences-service;1"].
|
Cc["@mozilla.org/preferences-service;1"].
|
||||||
getService(Ci.nsIPrefService);
|
getService(Ci.nsIPrefService);
|
||||||
|
|
@ -883,7 +883,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIObserver
|
* See nsIObserver
|
||||||
*/
|
*/
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
var os =
|
var os =
|
||||||
Cc["@mozilla.org/observer-service;1"].
|
Cc["@mozilla.org/observer-service;1"].
|
||||||
getService(Ci.nsIObserverService);
|
getService(Ci.nsIObserverService);
|
||||||
|
|
@ -901,7 +901,7 @@ WebContentConverterRegistrar.prototype = {
|
||||||
/**
|
/**
|
||||||
* See nsIFactory
|
* See nsIFactory
|
||||||
*/
|
*/
|
||||||
createInstance: function (outer, iid) {
|
createInstance: function(outer, iid) {
|
||||||
if (outer != null)
|
if (outer != null)
|
||||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||||
return this.QueryInterface(iid);
|
return this.QueryInterface(iid);
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,15 @@ var SubscribeHandler = {
|
||||||
*/
|
*/
|
||||||
_feedWriter: null,
|
_feedWriter: null,
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
this._feedWriter = new BrowserFeedWriter();
|
this._feedWriter = new BrowserFeedWriter();
|
||||||
},
|
},
|
||||||
|
|
||||||
writeContent: function () {
|
writeContent: function() {
|
||||||
this._feedWriter.writeContent();
|
this._feedWriter.writeContent();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
this._feedWriter.close();
|
this._feedWriter.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,14 @@ var Utilities = {
|
||||||
return this.windowMediator;
|
return this.windowMediator;
|
||||||
},
|
},
|
||||||
|
|
||||||
makeURI: function (aSpec) {
|
makeURI: function(aSpec) {
|
||||||
if (!aSpec)
|
if (!aSpec)
|
||||||
return null;
|
return null;
|
||||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||||
return ios.newURI(aSpec, null, null);
|
return ios.newURI(aSpec, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
free: function () {
|
free: function() {
|
||||||
delete this.bookmarks;
|
delete this.bookmarks;
|
||||||
delete this.bookmarksObserver;
|
delete this.bookmarksObserver;
|
||||||
delete this.annotations;
|
delete this.annotations;
|
||||||
|
|
@ -103,12 +103,12 @@ Window.prototype = {
|
||||||
* Helper used to setup event handlers on the XBL element. Note that the events
|
* Helper used to setup event handlers on the XBL element. Note that the events
|
||||||
* are actually dispatched to tabs, so we capture them.
|
* are actually dispatched to tabs, so we capture them.
|
||||||
*/
|
*/
|
||||||
_watch: function (aType) {
|
_watch: function(aType) {
|
||||||
this._tabbrowser.tabContainer.addEventListener(aType, this,
|
this._tabbrowser.tabContainer.addEventListener(aType, this,
|
||||||
/* useCapture = */ true);
|
/* useCapture = */ true);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
this._events.dispatch(aEvent.type, getBrowserTab(this, aEvent.originalTarget.linkedBrowser));
|
this._events.dispatch(aEvent.type, getBrowserTab(this, aEvent.originalTarget.linkedBrowser));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ Window.prototype = {
|
||||||
return getBrowserTab(this, this._tabbrowser.selectedBrowser);
|
return getBrowserTab(this, this._tabbrowser.selectedBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function (aURI) {
|
open: function(aURI) {
|
||||||
return getBrowserTab(this, this._tabbrowser.addTab(aURI.spec).linkedBrowser);
|
return getBrowserTab(this, this._tabbrowser.addTab(aURI.spec).linkedBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -192,12 +192,12 @@ BrowserTab.prototype = {
|
||||||
/*
|
/*
|
||||||
* Helper used to setup event handlers on the XBL element
|
* Helper used to setup event handlers on the XBL element
|
||||||
*/
|
*/
|
||||||
_watch: function (aType) {
|
_watch: function(aType) {
|
||||||
this._browser.addEventListener(aType, this,
|
this._browser.addEventListener(aType, this,
|
||||||
/* useCapture = */ true);
|
/* useCapture = */ true);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
if (aEvent.type == "load") {
|
if (aEvent.type == "load") {
|
||||||
if (!(aEvent.originalTarget instanceof Ci.nsIDOMDocument))
|
if (!(aEvent.originalTarget instanceof Ci.nsIDOMDocument))
|
||||||
return;
|
return;
|
||||||
|
|
@ -211,29 +211,29 @@ BrowserTab.prototype = {
|
||||||
/*
|
/*
|
||||||
* Helper used to determine the index offset of the browsertab
|
* Helper used to determine the index offset of the browsertab
|
||||||
*/
|
*/
|
||||||
_getTab: function () {
|
_getTab: function() {
|
||||||
var tabs = this._tabbrowser.tabs;
|
var tabs = this._tabbrowser.tabs;
|
||||||
return tabs[this.index] || null;
|
return tabs[this.index] || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
load: function (aURI) {
|
load: function(aURI) {
|
||||||
this._browser.loadURI(aURI.spec, null, null);
|
this._browser.loadURI(aURI.spec, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
focus: function () {
|
focus: function() {
|
||||||
this._tabbrowser.selectedTab = this._getTab();
|
this._tabbrowser.selectedTab = this._getTab();
|
||||||
this._tabbrowser.focus();
|
this._tabbrowser.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function () {
|
close: function() {
|
||||||
this._tabbrowser.removeTab(this._getTab());
|
this._tabbrowser.removeTab(this._getTab());
|
||||||
},
|
},
|
||||||
|
|
||||||
moveBefore: function (aBefore) {
|
moveBefore: function(aBefore) {
|
||||||
this._tabbrowser.moveTabTo(this._getTab(), aBefore.index);
|
this._tabbrowser.moveTabTo(this._getTab(), aBefore.index);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveToEnd: function () {
|
moveToEnd: function() {
|
||||||
this._tabbrowser.moveTabTo(this._getTab(), this._tabbrowser.browsers.length);
|
this._tabbrowser.moveTabTo(this._getTab(), this._tabbrowser.browsers.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -252,21 +252,21 @@ Annotations.prototype = {
|
||||||
return Utilities.annotations.getItemAnnotationNames(this._id);
|
return Utilities.annotations.getItemAnnotationNames(this._id);
|
||||||
},
|
},
|
||||||
|
|
||||||
has: function (aName) {
|
has: function(aName) {
|
||||||
return Utilities.annotations.itemHasAnnotation(this._id, aName);
|
return Utilities.annotations.itemHasAnnotation(this._id, aName);
|
||||||
},
|
},
|
||||||
|
|
||||||
get: function (aName) {
|
get: function(aName) {
|
||||||
if (this.has(aName))
|
if (this.has(aName))
|
||||||
return Utilities.annotations.getItemAnnotation(this._id, aName);
|
return Utilities.annotations.getItemAnnotation(this._id, aName);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
set: function (aName, aValue, aExpiration) {
|
set: function(aName, aValue, aExpiration) {
|
||||||
Utilities.annotations.setItemAnnotation(this._id, aName, aValue, 0, aExpiration);
|
Utilities.annotations.setItemAnnotation(this._id, aName, aValue, 0, aExpiration);
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function (aName) {
|
remove: function(aName) {
|
||||||
if (aName)
|
if (aName)
|
||||||
Utilities.annotations.removeItemAnnotation(this._id, aName);
|
Utilities.annotations.removeItemAnnotation(this._id, aName);
|
||||||
},
|
},
|
||||||
|
|
@ -304,37 +304,37 @@ function BookmarksObserver() {
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarksObserver.prototype = {
|
BookmarksObserver.prototype = {
|
||||||
onBeginUpdateBatch: function () {},
|
onBeginUpdateBatch: function() {},
|
||||||
onEndUpdateBatch: function () {},
|
onEndUpdateBatch: function() {},
|
||||||
onItemVisited: function () {},
|
onItemVisited: function() {},
|
||||||
|
|
||||||
onItemAdded: function (aId, aFolder, aIndex, aItemType, aURI) {
|
onItemAdded: function(aId, aFolder, aIndex, aItemType, aURI) {
|
||||||
this._rootEvents.dispatch("add", aId);
|
this._rootEvents.dispatch("add", aId);
|
||||||
this._dispatchToEvents("addchild", aId, this._folderEventsDict[aFolder]);
|
this._dispatchToEvents("addchild", aId, this._folderEventsDict[aFolder]);
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemRemoved: function (aId, aFolder, aIndex) {
|
onItemRemoved: function(aId, aFolder, aIndex) {
|
||||||
this._rootEvents.dispatch("remove", aId);
|
this._rootEvents.dispatch("remove", aId);
|
||||||
this._dispatchToEvents("remove", aId, this._eventsDict[aId]);
|
this._dispatchToEvents("remove", aId, this._eventsDict[aId]);
|
||||||
this._dispatchToEvents("removechild", aId, this._folderEventsDict[aFolder]);
|
this._dispatchToEvents("removechild", aId, this._folderEventsDict[aFolder]);
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemChanged: function (aId, aProperty, aIsAnnotationProperty, aValue) {
|
onItemChanged: function(aId, aProperty, aIsAnnotationProperty, aValue) {
|
||||||
this._rootEvents.dispatch("change", aProperty);
|
this._rootEvents.dispatch("change", aProperty);
|
||||||
this._dispatchToEvents("change", aProperty, this._eventsDict[aId]);
|
this._dispatchToEvents("change", aProperty, this._eventsDict[aId]);
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved: function (aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
onItemMoved: function(aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
||||||
this._dispatchToEvents("move", aId, this._eventsDict[aId]);
|
this._dispatchToEvents("move", aId, this._eventsDict[aId]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_dispatchToEvents: function (aEvent, aData, aEvents) {
|
_dispatchToEvents: function(aEvent, aData, aEvents) {
|
||||||
if (aEvents) {
|
if (aEvents) {
|
||||||
aEvents.dispatch(aEvent, aData);
|
aEvents.dispatch(aEvent, aData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_addListenerToDict: function (aId, aEvent, aListener, aDict) {
|
_addListenerToDict: function(aId, aEvent, aListener, aDict) {
|
||||||
var events = aDict[aId];
|
var events = aDict[aId];
|
||||||
if (!events) {
|
if (!events) {
|
||||||
events = new Events();
|
events = new Events();
|
||||||
|
|
@ -343,7 +343,7 @@ BookmarksObserver.prototype = {
|
||||||
events.addListener(aEvent, aListener);
|
events.addListener(aEvent, aListener);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeListenerFromDict: function (aId, aEvent, aListener, aDict) {
|
_removeListenerFromDict: function(aId, aEvent, aListener, aDict) {
|
||||||
var events = aDict[aId];
|
var events = aDict[aId];
|
||||||
if (!events) {
|
if (!events) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -354,27 +354,27 @@ BookmarksObserver.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addListener: function (aId, aEvent, aListener) {
|
addListener: function(aId, aEvent, aListener) {
|
||||||
this._addListenerToDict(aId, aEvent, aListener, this._eventsDict);
|
this._addListenerToDict(aId, aEvent, aListener, this._eventsDict);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeListener: function (aId, aEvent, aListener) {
|
removeListener: function(aId, aEvent, aListener) {
|
||||||
this._removeListenerFromDict(aId, aEvent, aListener, this._eventsDict);
|
this._removeListenerFromDict(aId, aEvent, aListener, this._eventsDict);
|
||||||
},
|
},
|
||||||
|
|
||||||
addFolderListener: function (aId, aEvent, aListener) {
|
addFolderListener: function(aId, aEvent, aListener) {
|
||||||
this._addListenerToDict(aId, aEvent, aListener, this._folderEventsDict);
|
this._addListenerToDict(aId, aEvent, aListener, this._folderEventsDict);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeFolderListener: function (aId, aEvent, aListener) {
|
removeFolderListener: function(aId, aEvent, aListener) {
|
||||||
this._removeListenerFromDict(aId, aEvent, aListener, this._folderEventsDict);
|
this._removeListenerFromDict(aId, aEvent, aListener, this._folderEventsDict);
|
||||||
},
|
},
|
||||||
|
|
||||||
addRootListener: function (aEvent, aListener) {
|
addRootListener: function(aEvent, aListener) {
|
||||||
this._rootEvents.addListener(aEvent, aListener);
|
this._rootEvents.addListener(aEvent, aListener);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeRootListener: function (aEvent, aListener) {
|
removeRootListener: function(aEvent, aListener) {
|
||||||
this._rootEvents.removeListener(aEvent, aListener);
|
this._rootEvents.removeListener(aEvent, aListener);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -408,10 +408,10 @@ function Bookmark(aId, aParent, aType) {
|
||||||
// Our _events object forwards to bookmarksObserver.
|
// Our _events object forwards to bookmarksObserver.
|
||||||
var self = this;
|
var self = this;
|
||||||
this._events = {
|
this._events = {
|
||||||
addListener: function (aEvent, aListener) {
|
addListener: function(aEvent, aListener) {
|
||||||
Utilities.bookmarksObserver.addListener(self._id, aEvent, aListener);
|
Utilities.bookmarksObserver.addListener(self._id, aEvent, aListener);
|
||||||
},
|
},
|
||||||
removeListener: function (aEvent, aListener) {
|
removeListener: function(aEvent, aListener) {
|
||||||
Utilities.bookmarksObserver.removeListener(self._id, aEvent, aListener);
|
Utilities.bookmarksObserver.removeListener(self._id, aEvent, aListener);
|
||||||
},
|
},
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.extIEvents])
|
QueryInterface: XPCOMUtils.generateQI([Ci.extIEvents])
|
||||||
|
|
@ -479,16 +479,16 @@ Bookmark.prototype = {
|
||||||
return this._events;
|
return this._events;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove : function () {
|
remove : function() {
|
||||||
Utilities.bookmarks.removeItem(this._id);
|
Utilities.bookmarks.removeItem(this._id);
|
||||||
},
|
},
|
||||||
|
|
||||||
onBeginUpdateBatch: function () {},
|
onBeginUpdateBatch: function() {},
|
||||||
onEndUpdateBatch: function () {},
|
onEndUpdateBatch: function() {},
|
||||||
onItemAdded: function () {},
|
onItemAdded: function() {},
|
||||||
onItemVisited: function () {},
|
onItemVisited: function() {},
|
||||||
onItemRemoved: function () {},
|
onItemRemoved: function() {},
|
||||||
onItemChanged: function () {},
|
onItemChanged: function() {},
|
||||||
|
|
||||||
onItemMoved: function(aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
onItemMoved: function(aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
||||||
if (aId == this._id) {
|
if (aId == this._id) {
|
||||||
|
|
@ -528,7 +528,7 @@ function BookmarkFolder(aId, aParent) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this._events = {
|
this._events = {
|
||||||
addListener: function (aEvent, aListener) {
|
addListener: function(aEvent, aListener) {
|
||||||
if (self._parent) {
|
if (self._parent) {
|
||||||
if (/child$/.test(aEvent)) {
|
if (/child$/.test(aEvent)) {
|
||||||
Utilities.bookmarksObserver.addFolderListener(self._id, aEvent, aListener);
|
Utilities.bookmarksObserver.addFolderListener(self._id, aEvent, aListener);
|
||||||
|
|
@ -541,7 +541,7 @@ function BookmarkFolder(aId, aParent) {
|
||||||
Utilities.bookmarksObserver.addRootListener(aEvent, aListener);
|
Utilities.bookmarksObserver.addRootListener(aEvent, aListener);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeListener: function (aEvent, aListener) {
|
removeListener: function(aEvent, aListener) {
|
||||||
if (self._parent) {
|
if (self._parent) {
|
||||||
if (/child$/.test(aEvent)) {
|
if (/child$/.test(aEvent)) {
|
||||||
Utilities.bookmarksObserver.removeFolderListener(self._id, aEvent, aListener);
|
Utilities.bookmarksObserver.removeFolderListener(self._id, aEvent, aListener);
|
||||||
|
|
@ -633,36 +633,36 @@ BookmarkFolder.prototype = {
|
||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
|
|
||||||
addBookmark: function (aTitle, aUri) {
|
addBookmark: function(aTitle, aUri) {
|
||||||
var newBookmarkID = Utilities.bookmarks.insertBookmark(this._id, aUri, Utilities.bookmarks.DEFAULT_INDEX, aTitle);
|
var newBookmarkID = Utilities.bookmarks.insertBookmark(this._id, aUri, Utilities.bookmarks.DEFAULT_INDEX, aTitle);
|
||||||
var newBookmark = new Bookmark(newBookmarkID, this, "bookmark");
|
var newBookmark = new Bookmark(newBookmarkID, this, "bookmark");
|
||||||
return newBookmark;
|
return newBookmark;
|
||||||
},
|
},
|
||||||
|
|
||||||
addSeparator: function () {
|
addSeparator: function() {
|
||||||
var newBookmarkID = Utilities.bookmarks.insertSeparator(this._id, Utilities.bookmarks.DEFAULT_INDEX);
|
var newBookmarkID = Utilities.bookmarks.insertSeparator(this._id, Utilities.bookmarks.DEFAULT_INDEX);
|
||||||
var newBookmark = new Bookmark(newBookmarkID, this, "separator");
|
var newBookmark = new Bookmark(newBookmarkID, this, "separator");
|
||||||
return newBookmark;
|
return newBookmark;
|
||||||
},
|
},
|
||||||
|
|
||||||
addFolder: function (aTitle) {
|
addFolder: function(aTitle) {
|
||||||
var newFolderID = Utilities.bookmarks.createFolder(this._id, aTitle, Utilities.bookmarks.DEFAULT_INDEX);
|
var newFolderID = Utilities.bookmarks.createFolder(this._id, aTitle, Utilities.bookmarks.DEFAULT_INDEX);
|
||||||
var newFolder = new BookmarkFolder(newFolderID, this);
|
var newFolder = new BookmarkFolder(newFolderID, this);
|
||||||
return newFolder;
|
return newFolder;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function () {
|
remove: function() {
|
||||||
Utilities.bookmarks.removeItem(this._id);
|
Utilities.bookmarks.removeItem(this._id);
|
||||||
},
|
},
|
||||||
|
|
||||||
// observer
|
// observer
|
||||||
onBeginUpdateBatch: function () {},
|
onBeginUpdateBatch: function() {},
|
||||||
onEndUpdateBatch : function () {},
|
onEndUpdateBatch : function() {},
|
||||||
onItemAdded : function () {},
|
onItemAdded : function() {},
|
||||||
onItemRemoved : function () {},
|
onItemRemoved : function() {},
|
||||||
onItemChanged : function () {},
|
onItemChanged : function() {},
|
||||||
|
|
||||||
onItemMoved: function (aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
onItemMoved: function(aId, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
||||||
if (this._id == aId) {
|
if (this._id == aId) {
|
||||||
this._parent = new BookmarkFolder(aNewParent, Utilities.bookmarks.getFolderIdForItem(aNewParent));
|
this._parent = new BookmarkFolder(aNewParent, Utilities.bookmarks.getFolderIdForItem(aNewParent));
|
||||||
}
|
}
|
||||||
|
|
@ -718,7 +718,7 @@ BookmarkRoots.prototype = {
|
||||||
// See bug 386535.
|
// See bug 386535.
|
||||||
var gSingleton = null;
|
var gSingleton = null;
|
||||||
var ApplicationFactory = {
|
var ApplicationFactory = {
|
||||||
createInstance: function (aOuter, aIID) {
|
createInstance: function(aOuter, aIID) {
|
||||||
if (aOuter != null)
|
if (aOuter != null)
|
||||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||||
|
|
||||||
|
|
@ -771,7 +771,7 @@ function ApplicationPrototype() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// for nsIObserver
|
// for nsIObserver
|
||||||
this.observe = function (aSubject, aTopic, aData) {
|
this.observe = function(aSubject, aTopic, aData) {
|
||||||
// Call the extApplication version of this function first
|
// Call the extApplication version of this function first
|
||||||
var superPrototype = Object.getPrototypeOf(Object.getPrototypeOf(this));
|
var superPrototype = Object.getPrototypeOf(Object.getPrototypeOf(this));
|
||||||
superPrototype.observe.call(this, aSubject, aTopic, aData);
|
superPrototype.observe.call(this, aSubject, aTopic, aData);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ function Cell(aGrid, aNode) {
|
||||||
this._node._newtabCell = this;
|
this._node._newtabCell = this;
|
||||||
|
|
||||||
// Register drag-and-drop event handlers.
|
// Register drag-and-drop event handlers.
|
||||||
["dragenter", "dragover", "dragexit", "drop"].forEach(function (aType) {
|
["dragenter", "dragover", "dragexit", "drop"].forEach(function(aType) {
|
||||||
this._node.addEventListener(aType, this, false);
|
this._node.addEventListener(aType, this, false);
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +81,7 @@ Cell.prototype = {
|
||||||
* Checks whether the cell contains a pinned site.
|
* Checks whether the cell contains a pinned site.
|
||||||
* @return Whether the cell contains a pinned site.
|
* @return Whether the cell contains a pinned site.
|
||||||
*/
|
*/
|
||||||
containsPinnedSite: function () {
|
containsPinnedSite: function() {
|
||||||
let site = this.site;
|
let site = this.site;
|
||||||
return site && site.isPinned();
|
return site && site.isPinned();
|
||||||
},
|
},
|
||||||
|
|
@ -90,14 +90,14 @@ Cell.prototype = {
|
||||||
* Checks whether the cell contains a site (is empty).
|
* Checks whether the cell contains a site (is empty).
|
||||||
* @return Whether the cell is empty.
|
* @return Whether the cell is empty.
|
||||||
*/
|
*/
|
||||||
isEmpty: function () {
|
isEmpty: function() {
|
||||||
return !this.site;
|
return !this.site;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all cell events.
|
* Handles all cell events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
// We're not responding to external drag/drop events
|
// We're not responding to external drag/drop events
|
||||||
// when our parent window is in private browsing mode.
|
// when our parent window is in private browsing mode.
|
||||||
if (inPrivateBrowsingMode() && !gDrag.draggedSite)
|
if (inPrivateBrowsingMode() && !gDrag.draggedSite)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'dragstart' event.
|
* @param aEvent The 'dragstart' event.
|
||||||
*/
|
*/
|
||||||
start: function (aSite, aEvent) {
|
start: function(aSite, aEvent) {
|
||||||
this._draggedSite = aSite;
|
this._draggedSite = aSite;
|
||||||
|
|
||||||
// Mark nodes as being dragged.
|
// Mark nodes as being dragged.
|
||||||
|
|
@ -66,7 +66,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'drag' event.
|
* @param aEvent The 'drag' event.
|
||||||
*/
|
*/
|
||||||
drag: function (aSite, aEvent) {
|
drag: function(aSite, aEvent) {
|
||||||
// Get the viewport size.
|
// Get the viewport size.
|
||||||
let {clientWidth, clientHeight} = document.documentElement;
|
let {clientWidth, clientHeight} = document.documentElement;
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'dragend' event.
|
* @param aEvent The 'dragend' event.
|
||||||
*/
|
*/
|
||||||
end: function (aSite, aEvent) {
|
end: function(aSite, aEvent) {
|
||||||
let nodes = gGrid.node.querySelectorAll("[dragged]")
|
let nodes = gGrid.node.querySelectorAll("[dragged]")
|
||||||
for (let i = 0; i < nodes.length; i++)
|
for (let i = 0; i < nodes.length; i++)
|
||||||
nodes[i].removeAttribute("dragged");
|
nodes[i].removeAttribute("dragged");
|
||||||
|
|
@ -106,7 +106,7 @@ var gDrag = {
|
||||||
* @param aEvent The drag event to check.
|
* @param aEvent The drag event to check.
|
||||||
* @return Whether we should handle this drag and drop operation.
|
* @return Whether we should handle this drag and drop operation.
|
||||||
*/
|
*/
|
||||||
isValid: function (aEvent) {
|
isValid: function(aEvent) {
|
||||||
let link = gDragDataHelper.getLinkFromDragEvent(aEvent);
|
let link = gDragDataHelper.getLinkFromDragEvent(aEvent);
|
||||||
|
|
||||||
// Check that the drag data is non-empty.
|
// Check that the drag data is non-empty.
|
||||||
|
|
@ -125,7 +125,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'dragstart' event.
|
* @param aEvent The 'dragstart' event.
|
||||||
*/
|
*/
|
||||||
_setDragData: function (aSite, aEvent) {
|
_setDragData: function(aSite, aEvent) {
|
||||||
let {url, title} = aSite;
|
let {url, title} = aSite;
|
||||||
|
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ var gDragDataHelper = {
|
||||||
return "text/x-moz-url";
|
return "text/x-moz-url";
|
||||||
},
|
},
|
||||||
|
|
||||||
getLinkFromDragEvent: function (aEvent) {
|
getLinkFromDragEvent: function(aEvent) {
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
if (!dt || !dt.types.includes(this.mimeType)) {
|
if (!dt || !dt.types.includes(this.mimeType)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ var gDrop = {
|
||||||
* Handles the 'dragenter' event.
|
* Handles the 'dragenter' event.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
enter: function (aCell) {
|
enter: function(aCell) {
|
||||||
this._delayedRearrange(aCell);
|
this._delayedRearrange(aCell);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ var gDrop = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @param aEvent The 'dragexit' event.
|
* @param aEvent The 'dragexit' event.
|
||||||
*/
|
*/
|
||||||
exit: function (aCell, aEvent) {
|
exit: function(aCell, aEvent) {
|
||||||
if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) {
|
if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) {
|
||||||
this._delayedRearrange();
|
this._delayedRearrange();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -45,7 +45,7 @@ var gDrop = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @param aEvent The 'dragexit' event.
|
* @param aEvent The 'dragexit' event.
|
||||||
*/
|
*/
|
||||||
drop: function (aCell, aEvent) {
|
drop: function(aCell, aEvent) {
|
||||||
// The cell that is the drop target could contain a pinned site. We need
|
// The cell that is the drop target could contain a pinned site. We need
|
||||||
// to find out where that site has gone and re-pin it there.
|
// to find out where that site has gone and re-pin it there.
|
||||||
if (aCell.containsPinnedSite())
|
if (aCell.containsPinnedSite())
|
||||||
|
|
@ -64,11 +64,11 @@ var gDrop = {
|
||||||
* Re-pins all pinned sites in their (new) positions.
|
* Re-pins all pinned sites in their (new) positions.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_repinSitesAfterDrop: function (aCell) {
|
_repinSitesAfterDrop: function(aCell) {
|
||||||
let sites = gDropPreview.rearrange(aCell);
|
let sites = gDropPreview.rearrange(aCell);
|
||||||
|
|
||||||
// Filter out pinned sites.
|
// Filter out pinned sites.
|
||||||
let pinnedSites = sites.filter(function (aSite) {
|
let pinnedSites = sites.filter(function(aSite) {
|
||||||
return aSite && aSite.isPinned();
|
return aSite && aSite.isPinned();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ var gDrop = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @param aEvent The 'dragexit' event.
|
* @param aEvent The 'dragexit' event.
|
||||||
*/
|
*/
|
||||||
_pinDraggedSite: function (aCell, aEvent) {
|
_pinDraggedSite: function(aCell, aEvent) {
|
||||||
let index = aCell.index;
|
let index = aCell.index;
|
||||||
let draggedSite = gDrag.draggedSite;
|
let draggedSite = gDrag.draggedSite;
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ var gDrop = {
|
||||||
* Time a rearrange with a little delay.
|
* Time a rearrange with a little delay.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_delayedRearrange: function (aCell) {
|
_delayedRearrange: function(aCell) {
|
||||||
// The last drop target didn't change so there's no need to re-arrange.
|
// The last drop target didn't change so there's no need to re-arrange.
|
||||||
if (this._lastDropTarget == aCell)
|
if (this._lastDropTarget == aCell)
|
||||||
return;
|
return;
|
||||||
|
|
@ -127,7 +127,7 @@ var gDrop = {
|
||||||
/**
|
/**
|
||||||
* Cancels a timed rearrange, if any.
|
* Cancels a timed rearrange, if any.
|
||||||
*/
|
*/
|
||||||
_cancelDelayedArrange: function () {
|
_cancelDelayedArrange: function() {
|
||||||
if (this._rearrangeTimeout) {
|
if (this._rearrangeTimeout) {
|
||||||
clearTimeout(this._rearrangeTimeout);
|
clearTimeout(this._rearrangeTimeout);
|
||||||
this._rearrangeTimeout = null;
|
this._rearrangeTimeout = null;
|
||||||
|
|
@ -138,7 +138,7 @@ var gDrop = {
|
||||||
* Rearrange all sites in the grid depending on the current drop target.
|
* Rearrange all sites in the grid depending on the current drop target.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_rearrange: function (aCell) {
|
_rearrange: function(aCell) {
|
||||||
let sites = gGrid.sites;
|
let sites = gGrid.sites;
|
||||||
|
|
||||||
// We need to rearrange the grid only if there's a current drop target.
|
// We need to rearrange the grid only if there's a current drop target.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @return The re-arranged array of sites.
|
* @return The re-arranged array of sites.
|
||||||
*/
|
*/
|
||||||
rearrange: function (aCell) {
|
rearrange: function(aCell) {
|
||||||
let sites = gGrid.sites;
|
let sites = gGrid.sites;
|
||||||
|
|
||||||
// Insert the dragged site into the current grid.
|
// Insert the dragged site into the current grid.
|
||||||
|
|
@ -34,7 +34,7 @@ var gDropPreview = {
|
||||||
* @param aSites The array of sites to insert into.
|
* @param aSites The array of sites to insert into.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_insertDraggedSite: function (aSites, aCell) {
|
_insertDraggedSite: function(aSites, aCell) {
|
||||||
let dropIndex = aCell.index;
|
let dropIndex = aCell.index;
|
||||||
let draggedSite = gDrag.draggedSite;
|
let draggedSite = gDrag.draggedSite;
|
||||||
|
|
||||||
|
|
@ -61,13 +61,13 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_repositionPinnedSites:
|
_repositionPinnedSites:
|
||||||
function (aSites, aCell) {
|
function(aSites, aCell) {
|
||||||
|
|
||||||
// Collect all pinned sites.
|
// Collect all pinned sites.
|
||||||
let pinnedSites = this._filterPinnedSites(aSites, aCell);
|
let pinnedSites = this._filterPinnedSites(aSites, aCell);
|
||||||
|
|
||||||
// Correct pinned site positions.
|
// Correct pinned site positions.
|
||||||
pinnedSites.forEach(function (aSite) {
|
pinnedSites.forEach(function(aSite) {
|
||||||
aSites[aSites.indexOf(aSite)] = aSites[aSite.cell.index];
|
aSites[aSites.indexOf(aSite)] = aSites[aSite.cell.index];
|
||||||
aSites[aSite.cell.index] = aSite;
|
aSites[aSite.cell.index] = aSite;
|
||||||
}, this);
|
}, this);
|
||||||
|
|
@ -85,14 +85,14 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @return The filtered array of sites.
|
* @return The filtered array of sites.
|
||||||
*/
|
*/
|
||||||
_filterPinnedSites: function (aSites, aCell) {
|
_filterPinnedSites: function(aSites, aCell) {
|
||||||
let draggedSite = gDrag.draggedSite;
|
let draggedSite = gDrag.draggedSite;
|
||||||
|
|
||||||
// When dropping on a cell that contains a pinned site make sure that all
|
// When dropping on a cell that contains a pinned site make sure that all
|
||||||
// pinned cells surrounding the drop target are moved as well.
|
// pinned cells surrounding the drop target are moved as well.
|
||||||
let range = this._getPinnedRange(aCell);
|
let range = this._getPinnedRange(aCell);
|
||||||
|
|
||||||
return aSites.filter(function (aSite, aIndex) {
|
return aSites.filter(function(aSite, aIndex) {
|
||||||
// The site must be valid, pinned and not the dragged site.
|
// The site must be valid, pinned and not the dragged site.
|
||||||
if (!aSite || aSite == draggedSite || !aSite.isPinned())
|
if (!aSite || aSite == draggedSite || !aSite.isPinned())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -109,7 +109,7 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @return The range of pinned cells.
|
* @return The range of pinned cells.
|
||||||
*/
|
*/
|
||||||
_getPinnedRange: function (aCell) {
|
_getPinnedRange: function(aCell) {
|
||||||
let dropIndex = aCell.index;
|
let dropIndex = aCell.index;
|
||||||
let range = {start: dropIndex, end: dropIndex};
|
let range = {start: dropIndex, end: dropIndex};
|
||||||
|
|
||||||
|
|
@ -139,7 +139,7 @@ var gDropPreview = {
|
||||||
* @return Whether there is an overflowed pinned cell.
|
* @return Whether there is an overflowed pinned cell.
|
||||||
*/
|
*/
|
||||||
_hasOverflowedPinnedSite:
|
_hasOverflowedPinnedSite:
|
||||||
function (aSites, aCell) {
|
function(aSites, aCell) {
|
||||||
|
|
||||||
// If the drop target isn't pinned there's no way a pinned site has been
|
// If the drop target isn't pinned there's no way a pinned site has been
|
||||||
// pushed out of the grid so we can just exit here.
|
// pushed out of the grid so we can just exit here.
|
||||||
|
|
@ -166,7 +166,7 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_repositionOverflowedPinnedSite:
|
_repositionOverflowedPinnedSite:
|
||||||
function (aSites, aCell) {
|
function(aSites, aCell) {
|
||||||
|
|
||||||
// Try to find a lower-priority cell (empty or containing an unpinned site).
|
// Try to find a lower-priority cell (empty or containing an unpinned site).
|
||||||
let index = this._indexOfLowerPrioritySite(aSites, aCell);
|
let index = this._indexOfLowerPrioritySite(aSites, aCell);
|
||||||
|
|
@ -197,7 +197,7 @@ var gDropPreview = {
|
||||||
* @return The cell's index.
|
* @return The cell's index.
|
||||||
*/
|
*/
|
||||||
_indexOfLowerPrioritySite:
|
_indexOfLowerPrioritySite:
|
||||||
function (aSites, aCell) {
|
function(aSites, aCell) {
|
||||||
|
|
||||||
let cells = gGrid.cells;
|
let cells = gGrid.cells;
|
||||||
let dropIndex = aCell.index;
|
let dropIndex = aCell.index;
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,14 @@ var gDropTargetShim = {
|
||||||
/**
|
/**
|
||||||
* Initializes the drop target shim.
|
* Initializes the drop target shim.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {
|
||||||
gGrid.node.addEventListener("dragstart", this, true);
|
gGrid.node.addEventListener("dragstart", this, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all event listeners needed during a drag operation.
|
* Add all event listeners needed during a drag operation.
|
||||||
*/
|
*/
|
||||||
_addEventListeners: function () {
|
_addEventListeners: function() {
|
||||||
gGrid.node.addEventListener("dragend", this);
|
gGrid.node.addEventListener("dragend", this);
|
||||||
|
|
||||||
let docElement = document.documentElement;
|
let docElement = document.documentElement;
|
||||||
|
|
@ -42,7 +42,7 @@ var gDropTargetShim = {
|
||||||
/**
|
/**
|
||||||
* Remove all event listeners that were needed during a drag operation.
|
* Remove all event listeners that were needed during a drag operation.
|
||||||
*/
|
*/
|
||||||
_removeEventListeners: function () {
|
_removeEventListeners: function() {
|
||||||
gGrid.node.removeEventListener("dragend", this);
|
gGrid.node.removeEventListener("dragend", this);
|
||||||
|
|
||||||
let docElement = document.documentElement;
|
let docElement = document.documentElement;
|
||||||
|
|
@ -54,7 +54,7 @@ var gDropTargetShim = {
|
||||||
/**
|
/**
|
||||||
* Handles all shim events.
|
* Handles all shim events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "dragstart":
|
case "dragstart":
|
||||||
this._dragstart(aEvent);
|
this._dragstart(aEvent);
|
||||||
|
|
@ -78,7 +78,7 @@ var gDropTargetShim = {
|
||||||
* Handles the 'dragstart' event.
|
* Handles the 'dragstart' event.
|
||||||
* @param aEvent The 'dragstart' event.
|
* @param aEvent The 'dragstart' event.
|
||||||
*/
|
*/
|
||||||
_dragstart: function (aEvent) {
|
_dragstart: function(aEvent) {
|
||||||
if (aEvent.target.classList.contains("newtab-link")) {
|
if (aEvent.target.classList.contains("newtab-link")) {
|
||||||
gGrid.lock();
|
gGrid.lock();
|
||||||
this._addEventListeners();
|
this._addEventListeners();
|
||||||
|
|
@ -89,7 +89,7 @@ var gDropTargetShim = {
|
||||||
* Handles the 'dragover' event.
|
* Handles the 'dragover' event.
|
||||||
* @param aEvent The 'dragover' event.
|
* @param aEvent The 'dragover' event.
|
||||||
*/
|
*/
|
||||||
_dragover: function (aEvent) {
|
_dragover: function(aEvent) {
|
||||||
// XXX bug 505521 - Use the dragover event to retrieve the
|
// XXX bug 505521 - Use the dragover event to retrieve the
|
||||||
// current mouse coordinates while dragging.
|
// current mouse coordinates while dragging.
|
||||||
let sourceNode = aEvent.dataTransfer.mozSourceNode.parentNode;
|
let sourceNode = aEvent.dataTransfer.mozSourceNode.parentNode;
|
||||||
|
|
@ -109,7 +109,7 @@ var gDropTargetShim = {
|
||||||
* Handles the 'drop' event.
|
* Handles the 'drop' event.
|
||||||
* @param aEvent The 'drop' event.
|
* @param aEvent The 'drop' event.
|
||||||
*/
|
*/
|
||||||
_drop: function (aEvent) {
|
_drop: function(aEvent) {
|
||||||
// We're accepting all drops.
|
// We're accepting all drops.
|
||||||
aEvent.preventDefault();
|
aEvent.preventDefault();
|
||||||
|
|
||||||
|
|
@ -129,7 +129,7 @@ var gDropTargetShim = {
|
||||||
* Handles the 'dragend' event.
|
* Handles the 'dragend' event.
|
||||||
* @param aEvent The 'dragend' event.
|
* @param aEvent The 'dragend' event.
|
||||||
*/
|
*/
|
||||||
_dragend: function (aEvent) {
|
_dragend: function(aEvent) {
|
||||||
if (this._lastDropTarget) {
|
if (this._lastDropTarget) {
|
||||||
if (aEvent.dataTransfer.mozUserCancelled || !this._dropSeen) {
|
if (aEvent.dataTransfer.mozUserCancelled || !this._dropSeen) {
|
||||||
// The drag operation was cancelled or no drop event was generated
|
// The drag operation was cancelled or no drop event was generated
|
||||||
|
|
@ -152,7 +152,7 @@ var gDropTargetShim = {
|
||||||
* appropriate dragenter, dragexit, and dragleave events.
|
* appropriate dragenter, dragexit, and dragleave events.
|
||||||
* @param aEvent The current drag event.
|
* @param aEvent The current drag event.
|
||||||
*/
|
*/
|
||||||
_updateDropTarget: function (aEvent) {
|
_updateDropTarget: function(aEvent) {
|
||||||
// Let's see if we find a drop target.
|
// Let's see if we find a drop target.
|
||||||
let target = this._findDropTarget(aEvent);
|
let target = this._findDropTarget(aEvent);
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ var gDropTargetShim = {
|
||||||
* against all cells in the grid.
|
* against all cells in the grid.
|
||||||
* @return The currently hovered drop target or null.
|
* @return The currently hovered drop target or null.
|
||||||
*/
|
*/
|
||||||
_findDropTarget: function () {
|
_findDropTarget: function() {
|
||||||
// These are the minimum intersection values - we want to use the cell if
|
// These are the minimum intersection values - we want to use the cell if
|
||||||
// the site is >= 50% hovering its position.
|
// the site is >= 50% hovering its position.
|
||||||
let minWidth = gDrag.cellWidth / 2;
|
let minWidth = gDrag.cellWidth / 2;
|
||||||
|
|
@ -204,11 +204,11 @@ var gDropTargetShim = {
|
||||||
* Gets the positions of all cell nodes.
|
* Gets the positions of all cell nodes.
|
||||||
* @return The (cached) cell positions.
|
* @return The (cached) cell positions.
|
||||||
*/
|
*/
|
||||||
_getCellPositions: function () {
|
_getCellPositions: function() {
|
||||||
if (this._cellPositions)
|
if (this._cellPositions)
|
||||||
return this._cellPositions;
|
return this._cellPositions;
|
||||||
|
|
||||||
return this._cellPositions = gGrid.cells.map(function (cell) {
|
return this._cellPositions = gGrid.cells.map(function(cell) {
|
||||||
return {cell: cell, rect: gTransformation.getNodePosition(cell.node)};
|
return {cell: cell, rect: gTransformation.getNodePosition(cell.node)};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -219,7 +219,7 @@ var gDropTargetShim = {
|
||||||
* @param aType The event type.
|
* @param aType The event type.
|
||||||
* @param aTarget The target node that receives the event.
|
* @param aTarget The target node that receives the event.
|
||||||
*/
|
*/
|
||||||
_dispatchEvent: function (aEvent, aType, aTarget) {
|
_dispatchEvent: function(aEvent, aType, aTarget) {
|
||||||
let node = aTarget.node;
|
let node = aTarget.node;
|
||||||
let event = document.createEvent("DragEvent");
|
let event = document.createEvent("DragEvent");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ var gGrid = {
|
||||||
* Initializes the grid.
|
* Initializes the grid.
|
||||||
* @param aSelector The query selector of the grid.
|
* @param aSelector The query selector of the grid.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {
|
||||||
this._node = document.getElementById("newtab-grid");
|
this._node = document.getElementById("newtab-grid");
|
||||||
this._gridDefaultContent = this._node.lastChild;
|
this._gridDefaultContent = this._node.lastChild;
|
||||||
this._createSiteFragment();
|
this._createSiteFragment();
|
||||||
|
|
@ -65,7 +65,7 @@ var gGrid = {
|
||||||
* @param aCell The cell that will contain the new site.
|
* @param aCell The cell that will contain the new site.
|
||||||
* @return The newly created site.
|
* @return The newly created site.
|
||||||
*/
|
*/
|
||||||
createSite: function (aLink, aCell) {
|
createSite: function(aLink, aCell) {
|
||||||
let node = aCell.node;
|
let node = aCell.node;
|
||||||
node.appendChild(this._siteFragment.cloneNode(true));
|
node.appendChild(this._siteFragment.cloneNode(true));
|
||||||
return new Site(node.firstElementChild, aLink);
|
return new Site(node.firstElementChild, aLink);
|
||||||
|
|
@ -74,21 +74,21 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Handles all grid events.
|
* Handles all grid events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
// Any specific events should go here.
|
// Any specific events should go here.
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locks the grid to block all pointer events.
|
* Locks the grid to block all pointer events.
|
||||||
*/
|
*/
|
||||||
lock: function () {
|
lock: function() {
|
||||||
this.node.setAttribute("locked", "true");
|
this.node.setAttribute("locked", "true");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlocks the grid to allow all pointer events.
|
* Unlocks the grid to allow all pointer events.
|
||||||
*/
|
*/
|
||||||
unlock: function () {
|
unlock: function() {
|
||||||
this.node.removeAttribute("locked");
|
this.node.removeAttribute("locked");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -142,7 +142,7 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Creates the DOM fragment that is re-used when creating sites.
|
* Creates the DOM fragment that is re-used when creating sites.
|
||||||
*/
|
*/
|
||||||
_createSiteFragment: function () {
|
_createSiteFragment: function() {
|
||||||
let site = document.createElementNS(HTML_NAMESPACE, "div");
|
let site = document.createElementNS(HTML_NAMESPACE, "div");
|
||||||
site.classList.add("newtab-site");
|
site.classList.add("newtab-site");
|
||||||
site.setAttribute("draggable", "true");
|
site.setAttribute("draggable", "true");
|
||||||
|
|
@ -167,7 +167,7 @@ var gGrid = {
|
||||||
* Test a tile at a given position for being pinned or history
|
* Test a tile at a given position for being pinned or history
|
||||||
* @param position Position in sites array
|
* @param position Position in sites array
|
||||||
*/
|
*/
|
||||||
_isHistoricalTile: function (aPos) {
|
_isHistoricalTile: function(aPos) {
|
||||||
let site = this.sites[aPos];
|
let site = this.sites[aPos];
|
||||||
return site && (site.isPinned() || site.link && site.link.type == "history");
|
return site && (site.isPinned() || site.link && site.link.type == "history");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Initializes the page.
|
* Initializes the page.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {
|
||||||
// Add ourselves to the list of pages to receive notifications.
|
// Add ourselves to the list of pages to receive notifications.
|
||||||
gAllPages.register(this);
|
gAllPages.register(this);
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Listens for notifications specific to this page.
|
* Listens for notifications specific to this page.
|
||||||
*/
|
*/
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
if (aTopic == "nsPref:changed") {
|
if (aTopic == "nsPref:changed") {
|
||||||
let enabled = gAllPages.enabled;
|
let enabled = gAllPages.enabled;
|
||||||
this._updateAttributes(enabled);
|
this._updateAttributes(enabled);
|
||||||
|
|
@ -102,7 +102,7 @@ var gPage = {
|
||||||
* Internally initializes the page. This runs only when/if the feature
|
* Internally initializes the page. This runs only when/if the feature
|
||||||
* is/gets enabled.
|
* is/gets enabled.
|
||||||
*/
|
*/
|
||||||
_init: function () {
|
_init: function() {
|
||||||
if (this._initialized)
|
if (this._initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -136,7 +136,7 @@ var gPage = {
|
||||||
* Updates the 'page-disabled' attributes of the respective DOM nodes.
|
* Updates the 'page-disabled' attributes of the respective DOM nodes.
|
||||||
* @param aValue Whether the New Tab Page is enabled or not.
|
* @param aValue Whether the New Tab Page is enabled or not.
|
||||||
*/
|
*/
|
||||||
_updateAttributes: function (aValue) {
|
_updateAttributes: function(aValue) {
|
||||||
// Set the nodes' states.
|
// Set the nodes' states.
|
||||||
let nodeSelector = "#newtab-grid, #searchContainer";
|
let nodeSelector = "#newtab-grid, #searchContainer";
|
||||||
for (let node of document.querySelectorAll(nodeSelector)) {
|
for (let node of document.querySelectorAll(nodeSelector)) {
|
||||||
|
|
@ -159,14 +159,14 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Handles unload event
|
* Handles unload event
|
||||||
*/
|
*/
|
||||||
_handleUnloadEvent: function () {
|
_handleUnloadEvent: function() {
|
||||||
gAllPages.unregister(this);
|
gAllPages.unregister(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all page events.
|
* Handles all page events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "load":
|
case "load":
|
||||||
this.onPageVisibleAndLoaded();
|
this.onPageVisibleAndLoaded();
|
||||||
|
|
@ -211,7 +211,7 @@ var gPage = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onPageFirstVisible: function () {
|
onPageFirstVisible: function() {
|
||||||
// Record another page impression.
|
// Record another page impression.
|
||||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_SHOWN").add(true);
|
Services.telemetry.getHistogramById("NEWTAB_PAGE_SHOWN").add(true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ Site.prototype = {
|
||||||
* @param aIndex The pinned index (optional).
|
* @param aIndex The pinned index (optional).
|
||||||
* @return true if link changed type after pin
|
* @return true if link changed type after pin
|
||||||
*/
|
*/
|
||||||
pin: function (aIndex) {
|
pin: function(aIndex) {
|
||||||
if (typeof aIndex == "undefined")
|
if (typeof aIndex == "undefined")
|
||||||
aIndex = this.cell.index;
|
aIndex = this.cell.index;
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Unpins the site and calls the given callback when done.
|
* Unpins the site and calls the given callback when done.
|
||||||
*/
|
*/
|
||||||
unpin: function () {
|
unpin: function() {
|
||||||
if (this.isPinned()) {
|
if (this.isPinned()) {
|
||||||
this._updateAttributes(false);
|
this._updateAttributes(false);
|
||||||
gPinnedLinks.unpin(this._link);
|
gPinnedLinks.unpin(this._link);
|
||||||
|
|
@ -83,7 +83,7 @@ Site.prototype = {
|
||||||
* Checks whether this site is pinned.
|
* Checks whether this site is pinned.
|
||||||
* @return Whether this site is pinned.
|
* @return Whether this site is pinned.
|
||||||
*/
|
*/
|
||||||
isPinned: function () {
|
isPinned: function() {
|
||||||
return gPinnedLinks.isPinned(this._link);
|
return gPinnedLinks.isPinned(this._link);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ Site.prototype = {
|
||||||
* Blocks the site (removes it from the grid) and calls the given callback
|
* Blocks the site (removes it from the grid) and calls the given callback
|
||||||
* when done.
|
* when done.
|
||||||
*/
|
*/
|
||||||
block: function () {
|
block: function() {
|
||||||
if (!gBlockedLinks.isBlocked(this._link)) {
|
if (!gBlockedLinks.isBlocked(this._link)) {
|
||||||
gUndoDialog.show(this);
|
gUndoDialog.show(this);
|
||||||
gBlockedLinks.block(this._link);
|
gBlockedLinks.block(this._link);
|
||||||
|
|
@ -104,7 +104,7 @@ Site.prototype = {
|
||||||
* @param aSelector The query selector.
|
* @param aSelector The query selector.
|
||||||
* @return The DOM node we found.
|
* @return The DOM node we found.
|
||||||
*/
|
*/
|
||||||
_querySelector: function (aSelector) {
|
_querySelector: function(aSelector) {
|
||||||
return this.node.querySelector(aSelector);
|
return this.node.querySelector(aSelector);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ Site.prototype = {
|
||||||
* pinned or unpinned.
|
* pinned or unpinned.
|
||||||
* @param aPinned Whether this site is now pinned or unpinned.
|
* @param aPinned Whether this site is now pinned or unpinned.
|
||||||
*/
|
*/
|
||||||
_updateAttributes: function (aPinned) {
|
_updateAttributes: function(aPinned) {
|
||||||
let control = this._querySelector(".newtab-control-pin");
|
let control = this._querySelector(".newtab-control-pin");
|
||||||
|
|
||||||
if (aPinned) {
|
if (aPinned) {
|
||||||
|
|
@ -139,7 +139,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Checks for and modifies link at campaign end time
|
* Checks for and modifies link at campaign end time
|
||||||
*/
|
*/
|
||||||
_checkLinkEndTime: function () {
|
_checkLinkEndTime: function() {
|
||||||
if (this.link.endTime && this.link.endTime < Date.now()) {
|
if (this.link.endTime && this.link.endTime < Date.now()) {
|
||||||
let oldUrl = this.url;
|
let oldUrl = this.url;
|
||||||
// chop off the path part from url
|
// chop off the path part from url
|
||||||
|
|
@ -155,7 +155,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Renders the site's data (fills the HTML fragment).
|
* Renders the site's data (fills the HTML fragment).
|
||||||
*/
|
*/
|
||||||
_render: function () {
|
_render: function() {
|
||||||
// first check for end time, as it may modify the link
|
// first check for end time, as it may modify the link
|
||||||
this._checkLinkEndTime();
|
this._checkLinkEndTime();
|
||||||
// setup display variables
|
// setup display variables
|
||||||
|
|
@ -189,7 +189,7 @@ Site.prototype = {
|
||||||
* Since the newtab may be preloaded long before it's displayed,
|
* Since the newtab may be preloaded long before it's displayed,
|
||||||
* check for changed conditions and re-render if needed
|
* check for changed conditions and re-render if needed
|
||||||
*/
|
*/
|
||||||
onFirstVisible: function () {
|
onFirstVisible: function() {
|
||||||
if (this.link.endTime && this.link.endTime < Date.now()) {
|
if (this.link.endTime && this.link.endTime < Date.now()) {
|
||||||
// site needs to change landing url and background image
|
// site needs to change landing url and background image
|
||||||
this._render();
|
this._render();
|
||||||
|
|
@ -203,7 +203,7 @@ Site.prototype = {
|
||||||
* Captures the site's thumbnail in the background, but only if there's no
|
* Captures the site's thumbnail in the background, but only if there's no
|
||||||
* existing thumbnail and the page allows background captures.
|
* existing thumbnail and the page allows background captures.
|
||||||
*/
|
*/
|
||||||
captureIfMissing: function () {
|
captureIfMissing: function() {
|
||||||
if (!document.hidden && !this.link.imageURI) {
|
if (!document.hidden && !this.link.imageURI) {
|
||||||
BackgroundPageThumbs.captureIfMissing(this.url);
|
BackgroundPageThumbs.captureIfMissing(this.url);
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +212,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Refreshes the thumbnail for the site.
|
* Refreshes the thumbnail for the site.
|
||||||
*/
|
*/
|
||||||
refreshThumbnail: function () {
|
refreshThumbnail: function() {
|
||||||
let link = this.link;
|
let link = this.link;
|
||||||
|
|
||||||
let thumbnail = this._querySelector(".newtab-thumbnail.thumbnail");
|
let thumbnail = this._querySelector(".newtab-thumbnail.thumbnail");
|
||||||
|
|
@ -249,7 +249,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Adds event handlers for the site and its buttons.
|
* Adds event handlers for the site and its buttons.
|
||||||
*/
|
*/
|
||||||
_addEventHandlers: function () {
|
_addEventHandlers: function() {
|
||||||
// Register drag-and-drop event handlers.
|
// Register drag-and-drop event handlers.
|
||||||
this._node.addEventListener("dragstart", this, false);
|
this._node.addEventListener("dragstart", this, false);
|
||||||
this._node.addEventListener("dragend", this, false);
|
this._node.addEventListener("dragend", this, false);
|
||||||
|
|
@ -259,7 +259,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Speculatively opens a connection to the current site.
|
* Speculatively opens a connection to the current site.
|
||||||
*/
|
*/
|
||||||
_speculativeConnect: function () {
|
_speculativeConnect: function() {
|
||||||
let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
|
let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
|
||||||
let uri = Services.io.newURI(this.url, null, null);
|
let uri = Services.io.newURI(this.url, null, null);
|
||||||
try {
|
try {
|
||||||
|
|
@ -272,7 +272,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Record interaction with site using telemetry.
|
* Record interaction with site using telemetry.
|
||||||
*/
|
*/
|
||||||
_recordSiteClicked: function (aIndex) {
|
_recordSiteClicked: function(aIndex) {
|
||||||
if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
|
if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
|
||||||
Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
|
Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
|
||||||
aIndex > 8) {
|
aIndex > 8) {
|
||||||
|
|
@ -297,7 +297,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handles site click events.
|
* Handles site click events.
|
||||||
*/
|
*/
|
||||||
onClick: function (aEvent) {
|
onClick: function(aEvent) {
|
||||||
let action;
|
let action;
|
||||||
let pinned = this.isPinned();
|
let pinned = this.isPinned();
|
||||||
let tileIndex = this.cell.index;
|
let tileIndex = this.cell.index;
|
||||||
|
|
@ -336,7 +336,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handles all site events.
|
* Handles all site events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "mouseover":
|
case "mouseover":
|
||||||
this._node.removeEventListener("mouseover", this, false);
|
this._node.removeEventListener("mouseover", this, false);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ var gTransformation = {
|
||||||
* @param aNode The DOM node.
|
* @param aNode The DOM node.
|
||||||
* @return A Rect instance with the position.
|
* @return A Rect instance with the position.
|
||||||
*/
|
*/
|
||||||
getNodePosition: function (aNode) {
|
getNodePosition: function(aNode) {
|
||||||
let {left, top, width, height} = aNode.getBoundingClientRect();
|
let {left, top, width, height} = aNode.getBoundingClientRect();
|
||||||
return new Rect(left + scrollX, top + scrollY, width, height);
|
return new Rect(left + scrollX, top + scrollY, width, height);
|
||||||
},
|
},
|
||||||
|
|
@ -43,8 +43,8 @@ var gTransformation = {
|
||||||
* @param aNode The node to fade.
|
* @param aNode The node to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
fadeNodeIn: function (aNode, aCallback) {
|
fadeNodeIn: function(aNode, aCallback) {
|
||||||
this._setNodeOpacity(aNode, 1, function () {
|
this._setNodeOpacity(aNode, 1, function() {
|
||||||
// Clear the style property.
|
// Clear the style property.
|
||||||
aNode.style.opacity = "";
|
aNode.style.opacity = "";
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ var gTransformation = {
|
||||||
* @param aNode The node to fade.
|
* @param aNode The node to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
fadeNodeOut: function (aNode, aCallback) {
|
fadeNodeOut: function(aNode, aCallback) {
|
||||||
this._setNodeOpacity(aNode, 0, aCallback);
|
this._setNodeOpacity(aNode, 0, aCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to fade.
|
* @param aSite The site to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
showSite: function (aSite, aCallback) {
|
showSite: function(aSite, aCallback) {
|
||||||
this.fadeNodeIn(aSite.node, aCallback);
|
this.fadeNodeIn(aSite.node, aCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to fade.
|
* @param aSite The site to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
hideSite: function (aSite, aCallback) {
|
hideSite: function(aSite, aCallback) {
|
||||||
this.fadeNodeOut(aSite.node, aCallback);
|
this.fadeNodeOut(aSite.node, aCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to re-position.
|
* @param aSite The site to re-position.
|
||||||
* @param aPosition The desired position for the given site.
|
* @param aPosition The desired position for the given site.
|
||||||
*/
|
*/
|
||||||
setSitePosition: function (aSite, aPosition) {
|
setSitePosition: function(aSite, aPosition) {
|
||||||
let style = aSite.node.style;
|
let style = aSite.node.style;
|
||||||
let {top, left} = aPosition;
|
let {top, left} = aPosition;
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ var gTransformation = {
|
||||||
* Freezes a site in its current position by positioning it absolute.
|
* Freezes a site in its current position by positioning it absolute.
|
||||||
* @param aSite The site to freeze.
|
* @param aSite The site to freeze.
|
||||||
*/
|
*/
|
||||||
freezeSitePosition: function (aSite) {
|
freezeSitePosition: function(aSite) {
|
||||||
if (this._isFrozen(aSite))
|
if (this._isFrozen(aSite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ var gTransformation = {
|
||||||
* Unfreezes a site by removing its absolute positioning.
|
* Unfreezes a site by removing its absolute positioning.
|
||||||
* @param aSite The site to unfreeze.
|
* @param aSite The site to unfreeze.
|
||||||
*/
|
*/
|
||||||
unfreezeSitePosition: function (aSite) {
|
unfreezeSitePosition: function(aSite) {
|
||||||
if (!this._isFrozen(aSite))
|
if (!this._isFrozen(aSite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ var gTransformation = {
|
||||||
* unfreeze - unfreeze the site after sliding
|
* unfreeze - unfreeze the site after sliding
|
||||||
* callback - the callback to call when finished
|
* callback - the callback to call when finished
|
||||||
*/
|
*/
|
||||||
slideSiteTo: function (aSite, aTarget, aOptions) {
|
slideSiteTo: function(aSite, aTarget, aOptions) {
|
||||||
let currentPosition = this.getNodePosition(aSite.node);
|
let currentPosition = this.getNodePosition(aSite.node);
|
||||||
let targetPosition = this.getNodePosition(aTarget.node)
|
let targetPosition = this.getNodePosition(aTarget.node)
|
||||||
let callback = aOptions && aOptions.callback;
|
let callback = aOptions && aOptions.callback;
|
||||||
|
|
@ -168,13 +168,13 @@ var gTransformation = {
|
||||||
* unfreeze - unfreeze the site after rearranging
|
* unfreeze - unfreeze the site after rearranging
|
||||||
* callback - the callback to call when finished
|
* callback - the callback to call when finished
|
||||||
*/
|
*/
|
||||||
rearrangeSites: function (aSites, aOptions) {
|
rearrangeSites: function(aSites, aOptions) {
|
||||||
let batch = [];
|
let batch = [];
|
||||||
let cells = gGrid.cells;
|
let cells = gGrid.cells;
|
||||||
let callback = aOptions && aOptions.callback;
|
let callback = aOptions && aOptions.callback;
|
||||||
let unfreeze = aOptions && aOptions.unfreeze;
|
let unfreeze = aOptions && aOptions.unfreeze;
|
||||||
|
|
||||||
aSites.forEach(function (aSite, aIndex) {
|
aSites.forEach(function(aSite, aIndex) {
|
||||||
// Do not re-arrange empty cells or the dragged site.
|
// Do not re-arrange empty cells or the dragged site.
|
||||||
if (!aSite || aSite == gDrag.draggedSite)
|
if (!aSite || aSite == gDrag.draggedSite)
|
||||||
return;
|
return;
|
||||||
|
|
@ -206,7 +206,7 @@ var gTransformation = {
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_whenTransitionEnded:
|
_whenTransitionEnded:
|
||||||
function (aNode, aProperties, aCallback) {
|
function(aNode, aProperties, aCallback) {
|
||||||
|
|
||||||
let props = new Set(aProperties);
|
let props = new Set(aProperties);
|
||||||
aNode.addEventListener("transitionend", function onEnd(e) {
|
aNode.addEventListener("transitionend", function onEnd(e) {
|
||||||
|
|
@ -222,7 +222,7 @@ var gTransformation = {
|
||||||
* @param aNode The node to get the opacity value from.
|
* @param aNode The node to get the opacity value from.
|
||||||
* @return The node's opacity value.
|
* @return The node's opacity value.
|
||||||
*/
|
*/
|
||||||
_getNodeOpacity: function (aNode) {
|
_getNodeOpacity: function(aNode) {
|
||||||
let cstyle = window.getComputedStyle(aNode, null);
|
let cstyle = window.getComputedStyle(aNode, null);
|
||||||
return cstyle.getPropertyValue("opacity");
|
return cstyle.getPropertyValue("opacity");
|
||||||
},
|
},
|
||||||
|
|
@ -234,7 +234,7 @@ var gTransformation = {
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_setNodeOpacity:
|
_setNodeOpacity:
|
||||||
function (aNode, aOpacity, aCallback) {
|
function(aNode, aOpacity, aCallback) {
|
||||||
|
|
||||||
if (this._getNodeOpacity(aNode) == aOpacity) {
|
if (this._getNodeOpacity(aNode) == aOpacity) {
|
||||||
if (aCallback)
|
if (aCallback)
|
||||||
|
|
@ -254,7 +254,7 @@ var gTransformation = {
|
||||||
* @param aIndex The target cell's index.
|
* @param aIndex The target cell's index.
|
||||||
* @param aOptions Options that are directly passed to slideSiteTo().
|
* @param aOptions Options that are directly passed to slideSiteTo().
|
||||||
*/
|
*/
|
||||||
_moveSite: function (aSite, aIndex, aOptions) {
|
_moveSite: function(aSite, aIndex, aOptions) {
|
||||||
this.freezeSitePosition(aSite);
|
this.freezeSitePosition(aSite);
|
||||||
this.slideSiteTo(aSite, gGrid.cells[aIndex], aOptions);
|
this.slideSiteTo(aSite, gGrid.cells[aIndex], aOptions);
|
||||||
},
|
},
|
||||||
|
|
@ -264,7 +264,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to check.
|
* @param aSite The site to check.
|
||||||
* @return Whether the given site is frozen.
|
* @return Whether the given site is frozen.
|
||||||
*/
|
*/
|
||||||
_isFrozen: function (aSite) {
|
_isFrozen: function(aSite) {
|
||||||
return aSite.node.hasAttribute("frozen");
|
return aSite.node.hasAttribute("frozen");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Initializes the undo dialog.
|
* Initializes the undo dialog.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {
|
||||||
this._undoContainer = document.getElementById("newtab-undo-container");
|
this._undoContainer = document.getElementById("newtab-undo-container");
|
||||||
this._undoContainer.addEventListener("click", this, false);
|
this._undoContainer.addEventListener("click", this, false);
|
||||||
this._undoButton = document.getElementById("newtab-undo-button");
|
this._undoButton = document.getElementById("newtab-undo-button");
|
||||||
|
|
@ -34,7 +34,7 @@ var gUndoDialog = {
|
||||||
* Shows the undo dialog.
|
* Shows the undo dialog.
|
||||||
* @param aSite The site that just got removed.
|
* @param aSite The site that just got removed.
|
||||||
*/
|
*/
|
||||||
show: function (aSite) {
|
show: function(aSite) {
|
||||||
if (this._undoData)
|
if (this._undoData)
|
||||||
clearTimeout(this._undoData.timeout);
|
clearTimeout(this._undoData.timeout);
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Hides the undo dialog.
|
* Hides the undo dialog.
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
hide: function() {
|
||||||
if (!this._undoData)
|
if (!this._undoData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ var gUndoDialog = {
|
||||||
* The undo dialog event handler.
|
* The undo dialog event handler.
|
||||||
* @param aEvent The event to handle.
|
* @param aEvent The event to handle.
|
||||||
*/
|
*/
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.target.id) {
|
switch (aEvent.target.id) {
|
||||||
case "newtab-undo-button":
|
case "newtab-undo-button":
|
||||||
this._undo();
|
this._undo();
|
||||||
|
|
@ -87,7 +87,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Undo the last blocked site.
|
* Undo the last blocked site.
|
||||||
*/
|
*/
|
||||||
_undo: function () {
|
_undo: function() {
|
||||||
if (!this._undoData)
|
if (!this._undoData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Undo all blocked sites.
|
* Undo all blocked sites.
|
||||||
*/
|
*/
|
||||||
_undoAll: function () {
|
_undoAll: function() {
|
||||||
NewTabUtils.undoAll(function() {
|
NewTabUtils.undoAll(function() {
|
||||||
gUpdater.updateGrid();
|
gUpdater.updateGrid();
|
||||||
this.hide();
|
this.hide();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ var gUpdater = {
|
||||||
* This removes old, moves existing and creates new sites to fill gaps.
|
* This removes old, moves existing and creates new sites to fill gaps.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
updateGrid: function (aCallback) {
|
updateGrid: function(aCallback) {
|
||||||
let links = gLinks.getLinks().slice(0, gGrid.cells.length);
|
let links = gLinks.getLinks().slice(0, gGrid.cells.length);
|
||||||
|
|
||||||
// Find all sites that remain in the grid.
|
// Find all sites that remain in the grid.
|
||||||
|
|
@ -50,17 +50,17 @@ var gUpdater = {
|
||||||
* @param aLinks The array of links to find sites for.
|
* @param aLinks The array of links to find sites for.
|
||||||
* @return Array of sites mapped to the given links (can contain null values).
|
* @return Array of sites mapped to the given links (can contain null values).
|
||||||
*/
|
*/
|
||||||
_findRemainingSites: function (aLinks) {
|
_findRemainingSites: function(aLinks) {
|
||||||
let map = {};
|
let map = {};
|
||||||
|
|
||||||
// Create a map to easily retrieve the site for a given URL.
|
// Create a map to easily retrieve the site for a given URL.
|
||||||
gGrid.sites.forEach(function (aSite) {
|
gGrid.sites.forEach(function(aSite) {
|
||||||
if (aSite)
|
if (aSite)
|
||||||
map[aSite.url] = aSite;
|
map[aSite.url] = aSite;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Map each link to its corresponding site, if any.
|
// Map each link to its corresponding site, if any.
|
||||||
return aLinks.map(function (aLink) {
|
return aLinks.map(function(aLink) {
|
||||||
return aLink && (aLink.url in map) && map[aLink.url];
|
return aLink && (aLink.url in map) && map[aLink.url];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -69,8 +69,8 @@ var gUpdater = {
|
||||||
* Freezes the given sites' positions.
|
* Freezes the given sites' positions.
|
||||||
* @param aSites The array of sites to freeze.
|
* @param aSites The array of sites to freeze.
|
||||||
*/
|
*/
|
||||||
_freezeSitePositions: function (aSites) {
|
_freezeSitePositions: function(aSites) {
|
||||||
aSites.forEach(function (aSite) {
|
aSites.forEach(function(aSite) {
|
||||||
if (aSite)
|
if (aSite)
|
||||||
gTransformation.freezeSitePosition(aSite);
|
gTransformation.freezeSitePosition(aSite);
|
||||||
});
|
});
|
||||||
|
|
@ -80,7 +80,7 @@ var gUpdater = {
|
||||||
* Moves the given sites' DOM nodes to their new positions.
|
* Moves the given sites' DOM nodes to their new positions.
|
||||||
* @param aSites The array of sites to move.
|
* @param aSites The array of sites to move.
|
||||||
*/
|
*/
|
||||||
_moveSiteNodes: function (aSites) {
|
_moveSiteNodes: function(aSites) {
|
||||||
let cells = gGrid.cells;
|
let cells = gGrid.cells;
|
||||||
|
|
||||||
// Truncate the given array of sites to not have more sites than cells.
|
// Truncate the given array of sites to not have more sites than cells.
|
||||||
|
|
@ -88,7 +88,7 @@ var gUpdater = {
|
||||||
// of link) onto the grid.
|
// of link) onto the grid.
|
||||||
let sites = aSites.slice(0, cells.length);
|
let sites = aSites.slice(0, cells.length);
|
||||||
|
|
||||||
sites.forEach(function (aSite, aIndex) {
|
sites.forEach(function(aSite, aIndex) {
|
||||||
let cell = cells[aIndex];
|
let cell = cells[aIndex];
|
||||||
let cellSite = cell.site;
|
let cellSite = cell.site;
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ var gUpdater = {
|
||||||
* @param aSites The array of sites to re-arrange.
|
* @param aSites The array of sites to re-arrange.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_rearrangeSites: function (aSites, aCallback) {
|
_rearrangeSites: function(aSites, aCallback) {
|
||||||
let options = {callback: aCallback, unfreeze: true};
|
let options = {callback: aCallback, unfreeze: true};
|
||||||
gTransformation.rearrangeSites(aSites, options);
|
gTransformation.rearrangeSites(aSites, options);
|
||||||
},
|
},
|
||||||
|
|
@ -123,18 +123,18 @@ var gUpdater = {
|
||||||
* @param aSites The array of sites remaining in the grid.
|
* @param aSites The array of sites remaining in the grid.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_removeLegacySites: function (aSites, aCallback) {
|
_removeLegacySites: function(aSites, aCallback) {
|
||||||
let batch = [];
|
let batch = [];
|
||||||
|
|
||||||
// Delete sites that were removed from the grid.
|
// Delete sites that were removed from the grid.
|
||||||
gGrid.sites.forEach(function (aSite) {
|
gGrid.sites.forEach(function(aSite) {
|
||||||
// The site must be valid and not in the current grid.
|
// The site must be valid and not in the current grid.
|
||||||
if (!aSite || aSites.indexOf(aSite) != -1)
|
if (!aSite || aSites.indexOf(aSite) != -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
batch.push(new Promise(resolve => {
|
batch.push(new Promise(resolve => {
|
||||||
// Fade out the to-be-removed site.
|
// Fade out the to-be-removed site.
|
||||||
gTransformation.hideSite(aSite, function () {
|
gTransformation.hideSite(aSite, function() {
|
||||||
let node = aSite.node;
|
let node = aSite.node;
|
||||||
|
|
||||||
// Remove the site from the DOM.
|
// Remove the site from the DOM.
|
||||||
|
|
@ -152,7 +152,7 @@ var gUpdater = {
|
||||||
* @param aLinks The array of links.
|
* @param aLinks The array of links.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_fillEmptyCells: function (aLinks, aCallback) {
|
_fillEmptyCells: function(aLinks, aCallback) {
|
||||||
let {cells, sites} = gGrid;
|
let {cells, sites} = gGrid;
|
||||||
|
|
||||||
// Find empty cells and fill them.
|
// Find empty cells and fill them.
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ AboutRedirector.prototype = {
|
||||||
/**
|
/**
|
||||||
* Gets the module name from the given URI.
|
* Gets the module name from the given URI.
|
||||||
*/
|
*/
|
||||||
_getModuleName: function (aURI) {
|
_getModuleName: function(aURI) {
|
||||||
// Strip out the first ? or #, and anything following it
|
// Strip out the first ? or #, and anything following it
|
||||||
let name = (/[^?#]+/.exec(aURI.path))[0];
|
let name = (/[^?#]+/.exec(aURI.path))[0];
|
||||||
return name.toLowerCase();
|
return name.toLowerCase();
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ function openWindow(parent, url, target, features, args, noExternalArgs) {
|
||||||
// put the URIs into argArray
|
// put the URIs into argArray
|
||||||
var uriArray = Components.classes["@mozilla.org/supports-array;1"]
|
var uriArray = Components.classes["@mozilla.org/supports-array;1"]
|
||||||
.createInstance(Components.interfaces.nsISupportsArray);
|
.createInstance(Components.interfaces.nsISupportsArray);
|
||||||
stringArgs.forEach(function (uri) {
|
stringArgs.forEach(function(uri) {
|
||||||
var sstring = Components.classes["@mozilla.org/supports-string;1"]
|
var sstring = Components.classes["@mozilla.org/supports-string;1"]
|
||||||
.createInstance(nsISupportsString);
|
.createInstance(nsISupportsString);
|
||||||
sstring.data = uri;
|
sstring.data = uri;
|
||||||
|
|
@ -278,7 +278,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
classID: Components.ID("{5d0ce354-df01-421a-83fb-7ead0990c24e}"),
|
classID: Components.ID("{5d0ce354-df01-421a-83fb-7ead0990c24e}"),
|
||||||
|
|
||||||
_xpcom_factory: {
|
_xpcom_factory: {
|
||||||
createInstance: function (outer, iid) {
|
createInstance: function(outer, iid) {
|
||||||
if (outer)
|
if (outer)
|
||||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||||
return gBrowserContentHandler.QueryInterface(iid);
|
return gBrowserContentHandler.QueryInterface(iid);
|
||||||
|
|
@ -308,7 +308,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
nsICommandLineValidator]),
|
nsICommandLineValidator]),
|
||||||
|
|
||||||
/* nsICommandLineHandler */
|
/* nsICommandLineHandler */
|
||||||
handle : function (cmdLine) {
|
handle : function(cmdLine) {
|
||||||
if (cmdLine.handleFlag("browser", false)) {
|
if (cmdLine.handleFlag("browser", false)) {
|
||||||
// Passing defaultArgs, so use NO_EXTERNAL_URIS
|
// Passing defaultArgs, so use NO_EXTERNAL_URIS
|
||||||
openWindow(null, this.chromeURL, "_blank",
|
openWindow(null, this.chromeURL, "_blank",
|
||||||
|
|
@ -601,7 +601,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
|
|
||||||
mFeatures : null,
|
mFeatures : null,
|
||||||
|
|
||||||
getFeatures : function (cmdLine) {
|
getFeatures : function(cmdLine) {
|
||||||
if (this.mFeatures === null) {
|
if (this.mFeatures === null) {
|
||||||
this.mFeatures = "";
|
this.mFeatures = "";
|
||||||
|
|
||||||
|
|
@ -629,7 +629,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
|
|
||||||
/* nsIContentHandler */
|
/* nsIContentHandler */
|
||||||
|
|
||||||
handleContent : function (contentType, context, request) {
|
handleContent : function(contentType, context, request) {
|
||||||
try {
|
try {
|
||||||
var webNavInfo = Components.classes["@mozilla.org/webnavigation-info;1"]
|
var webNavInfo = Components.classes["@mozilla.org/webnavigation-info;1"]
|
||||||
.getService(nsIWebNavigationInfo);
|
.getService(nsIWebNavigationInfo);
|
||||||
|
|
@ -647,7 +647,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/* nsICommandLineValidator */
|
/* nsICommandLineValidator */
|
||||||
validate : function (cmdLine) {
|
validate : function(cmdLine) {
|
||||||
// Other handlers may use osint so only handle the osint flag if the url
|
// Other handlers may use osint so only handle the osint flag if the url
|
||||||
// flag is also present and the command line is valid.
|
// flag is also present and the command line is valid.
|
||||||
var osintFlagIdx = cmdLine.findFlag("osint", false);
|
var osintFlagIdx = cmdLine.findFlag("osint", false);
|
||||||
|
|
@ -699,7 +699,7 @@ nsDefaultCommandLineHandler.prototype = {
|
||||||
classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"),
|
classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"),
|
||||||
|
|
||||||
/* nsISupports */
|
/* nsISupports */
|
||||||
QueryInterface : function (iid) {
|
QueryInterface : function(iid) {
|
||||||
if (!iid.equals(nsISupports) &&
|
if (!iid.equals(nsISupports) &&
|
||||||
!iid.equals(nsICommandLineHandler))
|
!iid.equals(nsICommandLineHandler))
|
||||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||||
|
|
@ -712,7 +712,7 @@ nsDefaultCommandLineHandler.prototype = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* nsICommandLineHandler */
|
/* nsICommandLineHandler */
|
||||||
handle : function (cmdLine) {
|
handle : function(cmdLine) {
|
||||||
var urilist = [];
|
var urilist = [];
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
|
|
@ -780,7 +780,7 @@ nsDefaultCommandLineHandler.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var URLlist = urilist.filter(shouldLoadURI).map(function (u) u.spec);
|
var URLlist = urilist.filter(shouldLoadURI).map(function(u) u.spec);
|
||||||
if (URLlist.length) {
|
if (URLlist.length) {
|
||||||
openWindow(null, gBrowserContentHandler.chromeURL, "_blank",
|
openWindow(null, gBrowserContentHandler.chromeURL, "_blank",
|
||||||
"chrome,dialog=no,all" + gBrowserContentHandler.getFeatures(cmdLine),
|
"chrome,dialog=no,all" + gBrowserContentHandler.getFeatures(cmdLine),
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ const BOOKMARKS_BACKUP_MAX_BACKUPS = 10;
|
||||||
// Factory object
|
// Factory object
|
||||||
const BrowserGlueServiceFactory = {
|
const BrowserGlueServiceFactory = {
|
||||||
_instance: null,
|
_instance: null,
|
||||||
createInstance: function (outer, iid) {
|
createInstance: function(outer, iid) {
|
||||||
if (outer != null)
|
if (outer != null)
|
||||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||||
return this._instance == null ?
|
return this._instance == null ?
|
||||||
|
|
@ -113,7 +113,7 @@ BrowserGlue.prototype = {
|
||||||
_isPlacesDatabaseLocked: false,
|
_isPlacesDatabaseLocked: false,
|
||||||
_migrationImportsDefaultBookmarks: false,
|
_migrationImportsDefaultBookmarks: false,
|
||||||
|
|
||||||
_setPrefToSaveSession: function (aForce) {
|
_setPrefToSaveSession: function(aForce) {
|
||||||
if (!this._saveSession && !aForce)
|
if (!this._saveSession && !aForce)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
#ifdef MOZ_SERVICES_SYNC
|
#ifdef MOZ_SERVICES_SYNC
|
||||||
_setSyncAutoconnectDelay: function () {
|
_setSyncAutoconnectDelay: function() {
|
||||||
// Assume that a non-zero value for services.sync.autoconnectDelay should override
|
// Assume that a non-zero value for services.sync.autoconnectDelay should override
|
||||||
if (Services.prefs.prefHasUserValue("services.sync.autoconnectDelay")) {
|
if (Services.prefs.prefHasUserValue("services.sync.autoconnectDelay")) {
|
||||||
let prefDelay = Services.prefs.getIntPref("services.sync.autoconnectDelay");
|
let prefDelay = Services.prefs.getIntPref("services.sync.autoconnectDelay");
|
||||||
|
|
@ -150,7 +150,7 @@ BrowserGlue.prototype = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// nsIObserver implementation
|
// nsIObserver implementation
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case "notifications-open-settings":
|
case "notifications-open-settings":
|
||||||
this._openPermissions(subject);
|
this._openPermissions(subject);
|
||||||
|
|
@ -312,7 +312,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncSearchEngines: function () {
|
_syncSearchEngines: function() {
|
||||||
// Only do this if the search service is already initialized. This function
|
// Only do this if the search service is already initialized. This function
|
||||||
// gets called in finalUIStartup and from a browser-search-service observer,
|
// gets called in finalUIStartup and from a browser-search-service observer,
|
||||||
// to catch both cases (search service initialization occurring before and
|
// to catch both cases (search service initialization occurring before and
|
||||||
|
|
@ -323,7 +323,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// initialization (called on application startup)
|
// initialization (called on application startup)
|
||||||
_init: function () {
|
_init: function() {
|
||||||
let os = Services.obs;
|
let os = Services.obs;
|
||||||
os.addObserver(this, "notifications-open-settings", false);
|
os.addObserver(this, "notifications-open-settings", false);
|
||||||
os.addObserver(this, "prefservice:after-app-defaults", false);
|
os.addObserver(this, "prefservice:after-app-defaults", false);
|
||||||
|
|
@ -356,7 +356,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// cleanup (called on application shutdown)
|
// cleanup (called on application shutdown)
|
||||||
_dispose: function () {
|
_dispose: function() {
|
||||||
let os = Services.obs;
|
let os = Services.obs;
|
||||||
os.removeObserver(this, "notifications-open-settings");
|
os.removeObserver(this, "notifications-open-settings");
|
||||||
os.removeObserver(this, "prefservice:after-app-defaults");
|
os.removeObserver(this, "prefservice:after-app-defaults");
|
||||||
|
|
@ -391,7 +391,7 @@ BrowserGlue.prototype = {
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAppDefaults: function () {
|
_onAppDefaults: function() {
|
||||||
// apply distribution customizations (prefs)
|
// apply distribution customizations (prefs)
|
||||||
// other customizations are applied in _finalUIStartup()
|
// other customizations are applied in _finalUIStartup()
|
||||||
this._distributionCustomizer.applyPrefDefaults();
|
this._distributionCustomizer.applyPrefDefaults();
|
||||||
|
|
@ -399,7 +399,7 @@ BrowserGlue.prototype = {
|
||||||
|
|
||||||
// runs on startup, before the first command line handler is invoked
|
// runs on startup, before the first command line handler is invoked
|
||||||
// (i.e. before the first window is opened)
|
// (i.e. before the first window is opened)
|
||||||
_finalUIStartup: function () {
|
_finalUIStartup: function() {
|
||||||
this._sanitizer.onStartup();
|
this._sanitizer.onStartup();
|
||||||
// check if we're in safe mode
|
// check if we're in safe mode
|
||||||
if (Services.appinfo.inSafeMode) {
|
if (Services.appinfo.inSafeMode) {
|
||||||
|
|
@ -433,11 +433,11 @@ BrowserGlue.prototype = {
|
||||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||||
},
|
},
|
||||||
|
|
||||||
_setUpUserAgentOverrides: function () {
|
_setUpUserAgentOverrides: function() {
|
||||||
UserAgentOverrides.init();
|
UserAgentOverrides.init();
|
||||||
|
|
||||||
if (Services.prefs.getBoolPref("general.useragent.complexOverride.moodle")) {
|
if (Services.prefs.getBoolPref("general.useragent.complexOverride.moodle")) {
|
||||||
UserAgentOverrides.addComplexOverride(function (aHttpChannel, aOriginalUA) {
|
UserAgentOverrides.addComplexOverride(function(aHttpChannel, aOriginalUA) {
|
||||||
let cookies;
|
let cookies;
|
||||||
try {
|
try {
|
||||||
cookies = aHttpChannel.getRequestHeader("Cookie");
|
cookies = aHttpChannel.getRequestHeader("Cookie");
|
||||||
|
|
@ -449,7 +449,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_trackSlowStartup: function () {
|
_trackSlowStartup: function() {
|
||||||
if (Services.startup.interrupted ||
|
if (Services.startup.interrupted ||
|
||||||
Services.prefs.getBoolPref("browser.slowStartup.notificationDisabled"))
|
Services.prefs.getBoolPref("browser.slowStartup.notificationDisabled"))
|
||||||
return;
|
return;
|
||||||
|
|
@ -475,7 +475,7 @@ BrowserGlue.prototype = {
|
||||||
Services.prefs.setIntPref("browser.slowStartup.samples", samples);
|
Services.prefs.setIntPref("browser.slowStartup.samples", samples);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showSlowStartupNotification: function () {
|
_showSlowStartupNotification: function() {
|
||||||
let win = this.getMostRecentBrowserWindow();
|
let win = this.getMostRecentBrowserWindow();
|
||||||
if (!win)
|
if (!win)
|
||||||
return;
|
return;
|
||||||
|
|
@ -487,14 +487,14 @@ BrowserGlue.prototype = {
|
||||||
{
|
{
|
||||||
label: win.gNavigatorBundle.getString("slowStartup.helpButton.label"),
|
label: win.gNavigatorBundle.getString("slowStartup.helpButton.label"),
|
||||||
accessKey: win.gNavigatorBundle.getString("slowStartup.helpButton.accesskey"),
|
accessKey: win.gNavigatorBundle.getString("slowStartup.helpButton.accesskey"),
|
||||||
callback: function () {
|
callback: function() {
|
||||||
win.openUILinkIn(Services.prefs.getCharPref("browser.slowstartup.help.url"), "tab");
|
win.openUILinkIn(Services.prefs.getCharPref("browser.slowstartup.help.url"), "tab");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: win.gNavigatorBundle.getString("slowStartup.disableNotificationButton.label"),
|
label: win.gNavigatorBundle.getString("slowStartup.disableNotificationButton.label"),
|
||||||
accessKey: win.gNavigatorBundle.getString("slowStartup.disableNotificationButton.accesskey"),
|
accessKey: win.gNavigatorBundle.getString("slowStartup.disableNotificationButton.accesskey"),
|
||||||
callback: function () {
|
callback: function() {
|
||||||
Services.prefs.setBoolPref("browser.slowStartup.notificationDisabled", true);
|
Services.prefs.setBoolPref("browser.slowStartup.notificationDisabled", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -507,7 +507,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// the first browser window has finished initializing
|
// the first browser window has finished initializing
|
||||||
_onFirstWindowLoaded: function () {
|
_onFirstWindowLoaded: function() {
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
// For windows seven, initialize the jump list module.
|
// For windows seven, initialize the jump list module.
|
||||||
const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
|
const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
|
||||||
|
|
@ -529,7 +529,7 @@ BrowserGlue.prototype = {
|
||||||
* All components depending on Places should be shut down in
|
* All components depending on Places should be shut down in
|
||||||
* _onPlacesShutdown() and not here.
|
* _onPlacesShutdown() and not here.
|
||||||
*/
|
*/
|
||||||
_onProfileShutdown: function () {
|
_onProfileShutdown: function() {
|
||||||
BrowserNewTabPreloader.uninit();
|
BrowserNewTabPreloader.uninit();
|
||||||
UserAgentOverrides.uninit();
|
UserAgentOverrides.uninit();
|
||||||
#ifdef MOZ_WEBRTC
|
#ifdef MOZ_WEBRTC
|
||||||
|
|
@ -541,7 +541,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// All initial windows have opened.
|
// All initial windows have opened.
|
||||||
_onWindowsRestored: function () {
|
_onWindowsRestored: function() {
|
||||||
// Show update notification, if needed.
|
// Show update notification, if needed.
|
||||||
if (Services.prefs.prefHasUserValue("app.update.postupdate"))
|
if (Services.prefs.prefHasUserValue("app.update.postupdate"))
|
||||||
this._showUpdateNotification();
|
this._showUpdateNotification();
|
||||||
|
|
@ -644,7 +644,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onQuitRequest: function (aCancelQuit, aQuitType) {
|
_onQuitRequest: function(aCancelQuit, aQuitType) {
|
||||||
// If user has already dismissed quit request, then do nothing
|
// If user has already dismissed quit request, then do nothing
|
||||||
if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
|
if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
|
||||||
return;
|
return;
|
||||||
|
|
@ -776,7 +776,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showUpdateNotification: function () {
|
_showUpdateNotification: function() {
|
||||||
Services.prefs.clearUserPref("app.update.postupdate");
|
Services.prefs.clearUserPref("app.update.postupdate");
|
||||||
|
|
||||||
var um = Cc["@mozilla.org/updates/update-manager;1"].
|
var um = Cc["@mozilla.org/updates/update-manager;1"].
|
||||||
|
|
@ -877,7 +877,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showPluginUpdatePage: function () {
|
_showPluginUpdatePage: function() {
|
||||||
// Pale Moon: disable this functionality from BrowserGlue, people are
|
// Pale Moon: disable this functionality from BrowserGlue, people are
|
||||||
// already notified if they visit a page with an outdated plugin, and
|
// already notified if they visit a page with an outdated plugin, and
|
||||||
// they can check properly from the plugins page as well.
|
// they can check properly from the plugins page as well.
|
||||||
|
|
@ -912,7 +912,7 @@ BrowserGlue.prototype = {
|
||||||
* Set to true by safe-mode dialog to indicate we must restore default
|
* Set to true by safe-mode dialog to indicate we must restore default
|
||||||
* bookmarks.
|
* bookmarks.
|
||||||
*/
|
*/
|
||||||
_initPlaces: function (aInitialMigrationPerformed) {
|
_initPlaces: function(aInitialMigrationPerformed) {
|
||||||
// We must instantiate the history service since it will tell us if we
|
// We must instantiate the history service since it will tell us if we
|
||||||
// need to import or restore bookmarks due to first-run, corruption or
|
// need to import or restore bookmarks due to first-run, corruption or
|
||||||
// forced migration (due to a major schema change).
|
// forced migration (due to a major schema change).
|
||||||
|
|
@ -1078,7 +1078,7 @@ BrowserGlue.prototype = {
|
||||||
* - export bookmarks as HTML, if so configured.
|
* - export bookmarks as HTML, if so configured.
|
||||||
* - finalize components depending on Places.
|
* - finalize components depending on Places.
|
||||||
*/
|
*/
|
||||||
_onPlacesShutdown: function () {
|
_onPlacesShutdown: function() {
|
||||||
this._sanitizer.onShutdown();
|
this._sanitizer.onShutdown();
|
||||||
PageThumbs.uninit();
|
PageThumbs.uninit();
|
||||||
|
|
||||||
|
|
@ -1134,7 +1134,7 @@ BrowserGlue.prototype = {
|
||||||
* Determine whether to backup bookmarks or not.
|
* Determine whether to backup bookmarks or not.
|
||||||
* @return true if bookmarks should be backed up, false if not.
|
* @return true if bookmarks should be backed up, false if not.
|
||||||
*/
|
*/
|
||||||
_shouldBackupBookmarks: function () {
|
_shouldBackupBookmarks: function() {
|
||||||
let lastBackupFile = PlacesBackups.getMostRecent();
|
let lastBackupFile = PlacesBackups.getMostRecent();
|
||||||
|
|
||||||
// Should backup bookmarks if there are no backups or the maximum interval between
|
// Should backup bookmarks if there are no backups or the maximum interval between
|
||||||
|
|
@ -1146,7 +1146,7 @@ BrowserGlue.prototype = {
|
||||||
/**
|
/**
|
||||||
* Backup bookmarks.
|
* Backup bookmarks.
|
||||||
*/
|
*/
|
||||||
_backupBookmarks: function () {
|
_backupBookmarks: function() {
|
||||||
return Task.spawn(function() {
|
return Task.spawn(function() {
|
||||||
// Backup bookmarks if there are no backups or the maximum interval between
|
// Backup bookmarks if there are no backups or the maximum interval between
|
||||||
// backups elapsed.
|
// backups elapsed.
|
||||||
|
|
@ -1163,7 +1163,7 @@ BrowserGlue.prototype = {
|
||||||
/**
|
/**
|
||||||
* Show the notificationBox for a locked places database.
|
* Show the notificationBox for a locked places database.
|
||||||
*/
|
*/
|
||||||
_showPlacesLockedNotificationBox: function () {
|
_showPlacesLockedNotificationBox: function() {
|
||||||
var applicationName = gBrandBundle.GetStringFromName("brandShortName");
|
var applicationName = gBrandBundle.GetStringFromName("brandShortName");
|
||||||
var placesBundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
|
var placesBundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
|
||||||
var title = placesBundle.GetStringFromName("lockPrompt.title");
|
var title = placesBundle.GetStringFromName("lockPrompt.title");
|
||||||
|
|
@ -1197,7 +1197,7 @@ BrowserGlue.prototype = {
|
||||||
notification.persistence = -1; // Until user closes it
|
notification.persistence = -1; // Until user closes it
|
||||||
},
|
},
|
||||||
|
|
||||||
_migrateUI: function () {
|
_migrateUI: function() {
|
||||||
const UI_VERSION = 22;
|
const UI_VERSION = 22;
|
||||||
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
|
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
|
||||||
let currentUIVersion = 0;
|
let currentUIVersion = 0;
|
||||||
|
|
@ -1477,7 +1477,7 @@ BrowserGlue.prototype = {
|
||||||
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
|
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasExistingNotificationPermission: function () {
|
_hasExistingNotificationPermission: function() {
|
||||||
let enumerator = Services.perms.enumerator;
|
let enumerator = Services.perms.enumerator;
|
||||||
while (enumerator.hasMoreElements()) {
|
while (enumerator.hasMoreElements()) {
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
||||||
|
|
@ -1488,7 +1488,7 @@ BrowserGlue.prototype = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyNotificationsUpgrade: function () {
|
_notifyNotificationsUpgrade: function() {
|
||||||
if (!this._hasExistingNotificationPermission()) {
|
if (!this._hasExistingNotificationPermission()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1533,14 +1533,14 @@ BrowserGlue.prototype = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPersist: function (aSource, aProperty) {
|
_getPersist: function(aSource, aProperty) {
|
||||||
var target = this._dataSource.GetTarget(aSource, aProperty, true);
|
var target = this._dataSource.GetTarget(aSource, aProperty, true);
|
||||||
if (target instanceof Ci.nsIRDFLiteral)
|
if (target instanceof Ci.nsIRDFLiteral)
|
||||||
return target.Value;
|
return target.Value;
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setPersist: function (aSource, aProperty, aTarget) {
|
_setPersist: function(aSource, aProperty, aTarget) {
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
try {
|
try {
|
||||||
var oldTarget = this._dataSource.GetTarget(aSource, aProperty, true);
|
var oldTarget = this._dataSource.GetTarget(aSource, aProperty, true);
|
||||||
|
|
@ -1570,12 +1570,12 @@ BrowserGlue.prototype = {
|
||||||
// public nsIBrowserGlue members
|
// public nsIBrowserGlue members
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
|
|
||||||
sanitize: function (aParentWindow) {
|
sanitize: function(aParentWindow) {
|
||||||
this._sanitizer.sanitize(aParentWindow);
|
this._sanitizer.sanitize(aParentWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
ensurePlacesDefaultQueriesInitialized:
|
ensurePlacesDefaultQueriesInitialized:
|
||||||
function () {
|
function() {
|
||||||
// This is actual version of the smart bookmarks, must be increased every
|
// This is actual version of the smart bookmarks, must be increased every
|
||||||
// time smart bookmarks change.
|
// time smart bookmarks change.
|
||||||
// When adding a new smart bookmark below, its newInVersion property must
|
// When adding a new smart bookmark below, its newInVersion property must
|
||||||
|
|
@ -1610,7 +1610,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let batch = {
|
let batch = {
|
||||||
runBatched: function () {
|
runBatched: function() {
|
||||||
let menuIndex = 0;
|
let menuIndex = 0;
|
||||||
let toolbarIndex = 0;
|
let toolbarIndex = 0;
|
||||||
let bundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
|
let bundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
|
||||||
|
|
@ -1658,7 +1658,7 @@ BrowserGlue.prototype = {
|
||||||
// we will use these informations to create the new version at the same
|
// we will use these informations to create the new version at the same
|
||||||
// position.
|
// position.
|
||||||
let smartBookmarkItemIds = PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
|
let smartBookmarkItemIds = PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
|
||||||
smartBookmarkItemIds.forEach(function (itemId) {
|
smartBookmarkItemIds.forEach(function(itemId) {
|
||||||
let queryId = PlacesUtils.annotations.getItemAnnotation(itemId, SMART_BOOKMARKS_ANNO);
|
let queryId = PlacesUtils.annotations.getItemAnnotation(itemId, SMART_BOOKMARKS_ANNO);
|
||||||
if (queryId in smartBookmarks) {
|
if (queryId in smartBookmarks) {
|
||||||
let smartBookmark = smartBookmarks[queryId];
|
let smartBookmark = smartBookmarks[queryId];
|
||||||
|
|
@ -1732,7 +1732,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// this returns the most recent non-popup browser window
|
// this returns the most recent non-popup browser window
|
||||||
getMostRecentBrowserWindow: function () {
|
getMostRecentBrowserWindow: function() {
|
||||||
return RecentWindow.getMostRecentBrowserWindow();
|
return RecentWindow.getMostRecentBrowserWindow();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1748,7 +1748,7 @@ BrowserGlue.prototype = {
|
||||||
* lesser evil than sending a tab to a specific device (from e.g. Fennec)
|
* lesser evil than sending a tab to a specific device (from e.g. Fennec)
|
||||||
* and having nothing happen on the receiving end.
|
* and having nothing happen on the receiving end.
|
||||||
*/
|
*/
|
||||||
_onDisplaySyncURI: function (data) {
|
_onDisplaySyncURI: function(data) {
|
||||||
try {
|
try {
|
||||||
let tabbrowser = RecentWindow.getMostRecentBrowserWindow({private: false}).gBrowser;
|
let tabbrowser = RecentWindow.getMostRecentBrowserWindow({private: false}).gBrowser;
|
||||||
|
|
||||||
|
|
@ -1778,7 +1778,7 @@ ContentPermissionPrompt.prototype = {
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
|
||||||
|
|
||||||
_getChromeWindow: function (aWindow) {
|
_getChromeWindow: function(aWindow) {
|
||||||
var chromeWin = aWindow
|
var chromeWin = aWindow
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
|
|
@ -1790,7 +1790,7 @@ ContentPermissionPrompt.prototype = {
|
||||||
return chromeWin;
|
return chromeWin;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getBrowserForRequest: function (aRequest) {
|
_getBrowserForRequest: function(aRequest) {
|
||||||
let requestingWindow = aRequest.window.top;
|
let requestingWindow = aRequest.window.top;
|
||||||
// find the requesting browser or iframe
|
// find the requesting browser or iframe
|
||||||
let browser = requestingWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
let browser = requestingWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
|
@ -1814,7 +1814,7 @@ ContentPermissionPrompt.prototype = {
|
||||||
* @param aAnchorId The id for the PopupNotification anchor.
|
* @param aAnchorId The id for the PopupNotification anchor.
|
||||||
* @param aOptions Options for the PopupNotification
|
* @param aOptions Options for the PopupNotification
|
||||||
*/
|
*/
|
||||||
_showPrompt: function (aRequest, aMessage, aPermission, aActions,
|
_showPrompt: function(aRequest, aMessage, aPermission, aActions,
|
||||||
aNotificationId, aAnchorId, aOptions) {
|
aNotificationId, aAnchorId, aOptions) {
|
||||||
function onFullScreen() {
|
function onFullScreen() {
|
||||||
popup.remove();
|
popup.remove();
|
||||||
|
|
@ -2005,7 +2005,7 @@ ContentPermissionPrompt.prototype = {
|
||||||
"web-notifications-notification-icon", options);
|
"web-notifications-notification-icon", options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_promptPointerLock: function (aRequest, autoAllow) {
|
_promptPointerLock: function(aRequest, autoAllow) {
|
||||||
let requestingURI = aRequest.principal.URI;
|
let requestingURI = aRequest.principal.URI;
|
||||||
|
|
||||||
let originString = requestingURI.schemeIs("file") ? requestingURI.path : requestingURI.host;
|
let originString = requestingURI.schemeIs("file") ? requestingURI.path : requestingURI.host;
|
||||||
|
|
@ -2042,7 +2042,7 @@ ContentPermissionPrompt.prototype = {
|
||||||
"pointerLock-notification-icon", null);
|
"pointerLock-notification-icon", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
prompt: function (request) {
|
prompt: function(request) {
|
||||||
// Only allow exactly one permission rquest here.
|
// Only allow exactly one permission rquest here.
|
||||||
let types = request.types.QueryInterface(Ci.nsIArray);
|
let types = request.types.QueryInterface(Ci.nsIArray);
|
||||||
if (types.length != 1) {
|
if (types.length != 1) {
|
||||||
|
|
|
||||||
|
|
@ -18,21 +18,21 @@ var gPrefs;
|
||||||
var gUsageRequest;
|
var gUsageRequest;
|
||||||
|
|
||||||
var gPermObj = {
|
var gPermObj = {
|
||||||
image: function ()
|
image: function()
|
||||||
{
|
{
|
||||||
if (gPrefs.getIntPref("permissions.default.image") == IMAGE_DENY) {
|
if (gPrefs.getIntPref("permissions.default.image") == IMAGE_DENY) {
|
||||||
return DENY;
|
return DENY;
|
||||||
}
|
}
|
||||||
return ALLOW;
|
return ALLOW;
|
||||||
},
|
},
|
||||||
popup: function ()
|
popup: function()
|
||||||
{
|
{
|
||||||
if (gPrefs.getBoolPref("dom.disable_open_during_load")) {
|
if (gPrefs.getBoolPref("dom.disable_open_during_load")) {
|
||||||
return DENY;
|
return DENY;
|
||||||
}
|
}
|
||||||
return ALLOW;
|
return ALLOW;
|
||||||
},
|
},
|
||||||
cookie: function ()
|
cookie: function()
|
||||||
{
|
{
|
||||||
if (gPrefs.getIntPref("network.cookie.cookieBehavior") == COOKIE_DENY) {
|
if (gPrefs.getIntPref("network.cookie.cookieBehavior") == COOKIE_DENY) {
|
||||||
return DENY;
|
return DENY;
|
||||||
|
|
@ -42,35 +42,35 @@ var gPermObj = {
|
||||||
}
|
}
|
||||||
return ALLOW;
|
return ALLOW;
|
||||||
},
|
},
|
||||||
"desktop-notification": function ()
|
"desktop-notification": function()
|
||||||
{
|
{
|
||||||
if (!gPrefs.getBoolPref("dom.webnotifications.enabled")) {
|
if (!gPrefs.getBoolPref("dom.webnotifications.enabled")) {
|
||||||
return DENY;
|
return DENY;
|
||||||
}
|
}
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
},
|
},
|
||||||
install: function ()
|
install: function()
|
||||||
{
|
{
|
||||||
if (Services.prefs.getBoolPref("xpinstall.whitelist.required")) {
|
if (Services.prefs.getBoolPref("xpinstall.whitelist.required")) {
|
||||||
return DENY;
|
return DENY;
|
||||||
}
|
}
|
||||||
return ALLOW;
|
return ALLOW;
|
||||||
},
|
},
|
||||||
geo: function ()
|
geo: function()
|
||||||
{
|
{
|
||||||
if (!gPrefs.getBoolPref("geo.enabled")) {
|
if (!gPrefs.getBoolPref("geo.enabled")) {
|
||||||
return DENY;
|
return DENY;
|
||||||
}
|
}
|
||||||
return ALLOW;
|
return ALLOW;
|
||||||
},
|
},
|
||||||
plugins: function ()
|
plugins: function()
|
||||||
{
|
{
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var permissionObserver = {
|
var permissionObserver = {
|
||||||
observe: function (aSubject, aTopic, aData)
|
observe: function(aSubject, aTopic, aData)
|
||||||
{
|
{
|
||||||
if (aTopic == "perm-changed") {
|
if (aTopic == "perm-changed") {
|
||||||
var permission = aSubject.QueryInterface(
|
var permission = aSubject.QueryInterface(
|
||||||
|
|
@ -309,7 +309,7 @@ function initPluginsRow() {
|
||||||
// fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries)
|
// fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries)
|
||||||
// ];
|
// ];
|
||||||
let permissionEntries = [];
|
let permissionEntries = [];
|
||||||
entries.forEach(function (p) {
|
entries.forEach(function(p) {
|
||||||
permissionEntries.push(fillInPluginPermissionTemplate(p.permission, p.obj));
|
permissionEntries.push(fillInPluginPermissionTemplate(p.permission, p.obj));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ this.PlacesUIUtils = {
|
||||||
* The string spec of the URI
|
* The string spec of the URI
|
||||||
* @returns A URI object for the spec.
|
* @returns A URI object for the spec.
|
||||||
*/
|
*/
|
||||||
createFixedURI: function (aSpec) {
|
createFixedURI: function(aSpec) {
|
||||||
return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormattedString: function (key, params) {
|
getFormattedString: function(key, params) {
|
||||||
return bundle.formatStringFromName(key, params, params.length);
|
return bundle.formatStringFromName(key, params, params.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -65,17 +65,17 @@ this.PlacesUIUtils = {
|
||||||
* @see https://developer.mozilla.org/en/Localization_and_Plurals
|
* @see https://developer.mozilla.org/en/Localization_and_Plurals
|
||||||
* @return The localized plural string.
|
* @return The localized plural string.
|
||||||
*/
|
*/
|
||||||
getPluralString: function (aKey, aNumber, aParams) {
|
getPluralString: function(aKey, aNumber, aParams) {
|
||||||
let str = PluralForm.get(aNumber, bundle.GetStringFromName(aKey));
|
let str = PluralForm.get(aNumber, bundle.GetStringFromName(aKey));
|
||||||
|
|
||||||
// Replace #1 with aParams[0], #2 with aParams[1], and so on.
|
// Replace #1 with aParams[0], #2 with aParams[1], and so on.
|
||||||
return str.replace(/\#(\d+)/g, function (matchedId, matchedNumber) {
|
return str.replace(/\#(\d+)/g, function(matchedId, matchedNumber) {
|
||||||
let param = aParams[parseInt(matchedNumber, 10) - 1];
|
let param = aParams[parseInt(matchedNumber, 10) - 1];
|
||||||
return param !== undefined ? param : matchedId;
|
return param !== undefined ? param : matchedId;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getString: function (key) {
|
getString: function(key) {
|
||||||
return bundle.GetStringFromName(key);
|
return bundle.GetStringFromName(key);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ this.PlacesUIUtils = {
|
||||||
* @see this._copyableAnnotations for the list of copyable annotations.
|
* @see this._copyableAnnotations for the list of copyable annotations.
|
||||||
*/
|
*/
|
||||||
_getURIItemCopyTransaction:
|
_getURIItemCopyTransaction:
|
||||||
function (aData, aContainer, aIndex)
|
function(aData, aContainer, aIndex)
|
||||||
{
|
{
|
||||||
let transactions = [];
|
let transactions = [];
|
||||||
if (aData.dateAdded) {
|
if (aData.dateAdded) {
|
||||||
|
|
@ -120,7 +120,7 @@ this.PlacesUIUtils = {
|
||||||
let keyword = aData.keyword || null;
|
let keyword = aData.keyword || null;
|
||||||
let annos = [];
|
let annos = [];
|
||||||
if (aData.annos) {
|
if (aData.annos) {
|
||||||
annos = aData.annos.filter(function (aAnno) {
|
annos = aData.annos.filter(function(aAnno) {
|
||||||
return this._copyableAnnotations.indexOf(aAnno.name) != -1;
|
return this._copyableAnnotations.indexOf(aAnno.name) != -1;
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +231,7 @@ this.PlacesUIUtils = {
|
||||||
|
|
||||||
let annos = [];
|
let annos = [];
|
||||||
if (aData.annos) {
|
if (aData.annos) {
|
||||||
annos = aData.annos.filter(function (aAnno) {
|
annos = aData.annos.filter(function(aAnno) {
|
||||||
return this._copyableAnnotations.indexOf(aAnno.name) != -1;
|
return this._copyableAnnotations.indexOf(aAnno.name) != -1;
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +257,7 @@ this.PlacesUIUtils = {
|
||||||
* @see this._copyableAnnotations for the list of copyable annotations.
|
* @see this._copyableAnnotations for the list of copyable annotations.
|
||||||
*/
|
*/
|
||||||
_getLivemarkCopyTransaction:
|
_getLivemarkCopyTransaction:
|
||||||
function (aData, aContainer, aIndex)
|
function(aData, aContainer, aIndex)
|
||||||
{
|
{
|
||||||
if (!aData.livemark || !aData.annos) {
|
if (!aData.livemark || !aData.annos) {
|
||||||
throw new Error("node is not a livemark");
|
throw new Error("node is not a livemark");
|
||||||
|
|
@ -266,7 +266,7 @@ this.PlacesUIUtils = {
|
||||||
let feedURI, siteURI;
|
let feedURI, siteURI;
|
||||||
let annos = [];
|
let annos = [];
|
||||||
if (aData.annos) {
|
if (aData.annos) {
|
||||||
annos = aData.annos.filter(function (aAnno) {
|
annos = aData.annos.filter(function(aAnno) {
|
||||||
if (aAnno.name == PlacesUtils.LMANNO_FEEDURI) {
|
if (aAnno.name == PlacesUtils.LMANNO_FEEDURI) {
|
||||||
feedURI = PlacesUtils._uri(aAnno.value);
|
feedURI = PlacesUtils._uri(aAnno.value);
|
||||||
}
|
}
|
||||||
|
|
@ -291,7 +291,7 @@ this.PlacesUIUtils = {
|
||||||
* @note Maybe this should be removed later, see bug 1072833.
|
* @note Maybe this should be removed later, see bug 1072833.
|
||||||
*/
|
*/
|
||||||
_isLivemark:
|
_isLivemark:
|
||||||
function (aItemId)
|
function(aItemId)
|
||||||
{
|
{
|
||||||
// Since this check may be done on each dragover event, it's worth maintaining
|
// Since this check may be done on each dragover event, it's worth maintaining
|
||||||
// a cache.
|
// a cache.
|
||||||
|
|
@ -344,7 +344,7 @@ this.PlacesUIUtils = {
|
||||||
* the move/insert.
|
* the move/insert.
|
||||||
*/
|
*/
|
||||||
makeTransaction:
|
makeTransaction:
|
||||||
function (data, type, container, index, copy)
|
function(data, type, container, index, copy)
|
||||||
{
|
{
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER:
|
case PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER:
|
||||||
|
|
@ -399,7 +399,7 @@ this.PlacesUIUtils = {
|
||||||
* @return true if any transaction has been performed, false otherwise.
|
* @return true if any transaction has been performed, false otherwise.
|
||||||
*/
|
*/
|
||||||
showBookmarkDialog:
|
showBookmarkDialog:
|
||||||
function (aInfo, aParentWindow) {
|
function(aInfo, aParentWindow) {
|
||||||
// Preserve size attributes differently based on the fact the dialog has
|
// Preserve size attributes differently based on the fact the dialog has
|
||||||
// a folder picker or not, since it needs more horizontal space than the
|
// a folder picker or not, since it needs more horizontal space than the
|
||||||
// other controls.
|
// other controls.
|
||||||
|
|
@ -415,7 +415,7 @@ this.PlacesUIUtils = {
|
||||||
return ("performed" in aInfo && aInfo.performed);
|
return ("performed" in aInfo && aInfo.performed);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getTopBrowserWin: function () {
|
_getTopBrowserWin: function() {
|
||||||
return RecentWindow.getMostRecentBrowserWindow();
|
return RecentWindow.getMostRecentBrowserWindow();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -425,7 +425,7 @@ this.PlacesUIUtils = {
|
||||||
* a DOM node
|
* a DOM node
|
||||||
* @return the closet ancestor places view if exists, null otherwsie.
|
* @return the closet ancestor places view if exists, null otherwsie.
|
||||||
*/
|
*/
|
||||||
getViewForNode: function (aNode) {
|
getViewForNode: function(aNode) {
|
||||||
let node = aNode;
|
let node = aNode;
|
||||||
|
|
||||||
// The view for a <menu> of which its associated menupopup is a places
|
// The view for a <menu> of which its associated menupopup is a places
|
||||||
|
|
@ -454,7 +454,7 @@ this.PlacesUIUtils = {
|
||||||
* organizer. If this is not called visits will be marked as
|
* organizer. If this is not called visits will be marked as
|
||||||
* TRANSITION_LINK.
|
* TRANSITION_LINK.
|
||||||
*/
|
*/
|
||||||
markPageAsTyped: function (aURL) {
|
markPageAsTyped: function(aURL) {
|
||||||
PlacesUtils.history.markPageAsTyped(this.createFixedURI(aURL));
|
PlacesUtils.history.markPageAsTyped(this.createFixedURI(aURL));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -465,7 +465,7 @@ this.PlacesUIUtils = {
|
||||||
* personal toolbar, and bookmarks from within the places organizer.
|
* personal toolbar, and bookmarks from within the places organizer.
|
||||||
* If this is not called visits will be marked as TRANSITION_LINK.
|
* If this is not called visits will be marked as TRANSITION_LINK.
|
||||||
*/
|
*/
|
||||||
markPageAsFollowedBookmark: function (aURL) {
|
markPageAsFollowedBookmark: function(aURL) {
|
||||||
PlacesUtils.history.markPageAsFollowedBookmark(this.createFixedURI(aURL));
|
PlacesUtils.history.markPageAsFollowedBookmark(this.createFixedURI(aURL));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -475,7 +475,7 @@ this.PlacesUIUtils = {
|
||||||
* This is actually used to distinguish user-initiated visits in frames
|
* This is actually used to distinguish user-initiated visits in frames
|
||||||
* so automatic visits can be correctly ignored.
|
* so automatic visits can be correctly ignored.
|
||||||
*/
|
*/
|
||||||
markPageAsFollowedLink: function (aURL) {
|
markPageAsFollowedLink: function(aURL) {
|
||||||
PlacesUtils.history.markPageAsFollowedLink(this.createFixedURI(aURL));
|
PlacesUtils.history.markPageAsFollowedLink(this.createFixedURI(aURL));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -489,7 +489,7 @@ this.PlacesUIUtils = {
|
||||||
* @return true if it's safe to open the node in the browser, false otherwise.
|
* @return true if it's safe to open the node in the browser, false otherwise.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
checkURLSecurity: function (aURINode, aWindow) {
|
checkURLSecurity: function(aURINode, aWindow) {
|
||||||
if (PlacesUtils.nodeIsBookmark(aURINode))
|
if (PlacesUtils.nodeIsBookmark(aURINode))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -516,7 +516,7 @@ this.PlacesUIUtils = {
|
||||||
* @returns A description string if a META element was discovered with a
|
* @returns A description string if a META element was discovered with a
|
||||||
* "description" or "httpequiv" attribute, empty string otherwise.
|
* "description" or "httpequiv" attribute, empty string otherwise.
|
||||||
*/
|
*/
|
||||||
getDescriptionFromDocument: function (doc) {
|
getDescriptionFromDocument: function(doc) {
|
||||||
var metaElements = doc.getElementsByTagName("META");
|
var metaElements = doc.getElementsByTagName("META");
|
||||||
for (var i = 0; i < metaElements.length; ++i) {
|
for (var i = 0; i < metaElements.length; ++i) {
|
||||||
if (metaElements[i].name.toLowerCase() == "description" ||
|
if (metaElements[i].name.toLowerCase() == "description" ||
|
||||||
|
|
@ -534,7 +534,7 @@ this.PlacesUIUtils = {
|
||||||
* @returns the description of the given item, or an empty string if it is
|
* @returns the description of the given item, or an empty string if it is
|
||||||
* not set.
|
* not set.
|
||||||
*/
|
*/
|
||||||
getItemDescription: function (aItemId) {
|
getItemDescription: function(aItemId) {
|
||||||
if (PlacesUtils.annotations.itemHasAnnotation(aItemId, this.DESCRIPTION_ANNO))
|
if (PlacesUtils.annotations.itemHasAnnotation(aItemId, this.DESCRIPTION_ANNO))
|
||||||
return PlacesUtils.annotations.getItemAnnotation(aItemId, this.DESCRIPTION_ANNO);
|
return PlacesUtils.annotations.getItemAnnotation(aItemId, this.DESCRIPTION_ANNO);
|
||||||
return "";
|
return "";
|
||||||
|
|
@ -548,7 +548,7 @@ this.PlacesUIUtils = {
|
||||||
* a node, except the root node of a query.
|
* a node, except the root node of a query.
|
||||||
* @return true if the aNode represents a removable entry, false otherwise.
|
* @return true if the aNode represents a removable entry, false otherwise.
|
||||||
*/
|
*/
|
||||||
canUserRemove: function (aNode) {
|
canUserRemove: function(aNode) {
|
||||||
let parentNode = aNode.parent;
|
let parentNode = aNode.parent;
|
||||||
if (!parentNode)
|
if (!parentNode)
|
||||||
throw new Error("canUserRemove doesn't accept root nodes");
|
throw new Error("canUserRemove doesn't accept root nodes");
|
||||||
|
|
@ -594,7 +594,7 @@ this.PlacesUIUtils = {
|
||||||
* @note livemark "folders" are considered read-only (but see bug 1072833).
|
* @note livemark "folders" are considered read-only (but see bug 1072833).
|
||||||
* @return true if aItemId points to a read-only folder, false otherwise.
|
* @return true if aItemId points to a read-only folder, false otherwise.
|
||||||
*/
|
*/
|
||||||
isContentsReadOnly: function (aNodeOrItemId) {
|
isContentsReadOnly: function(aNodeOrItemId) {
|
||||||
let itemId;
|
let itemId;
|
||||||
if (typeof(aNodeOrItemId) == "number") {
|
if (typeof(aNodeOrItemId) == "number") {
|
||||||
itemId = aNodeOrItemId;
|
itemId = aNodeOrItemId;
|
||||||
|
|
@ -631,7 +631,7 @@ this.PlacesUIUtils = {
|
||||||
* Gives the user a chance to cancel loading lots of tabs at once
|
* Gives the user a chance to cancel loading lots of tabs at once
|
||||||
*/
|
*/
|
||||||
_confirmOpenInTabs:
|
_confirmOpenInTabs:
|
||||||
function (numTabsToOpen, aWindow) {
|
function(numTabsToOpen, aWindow) {
|
||||||
const WARN_ON_OPEN_PREF = "browser.tabs.warnOnOpen";
|
const WARN_ON_OPEN_PREF = "browser.tabs.warnOnOpen";
|
||||||
var reallyOpen = true;
|
var reallyOpen = true;
|
||||||
|
|
||||||
|
|
@ -673,7 +673,7 @@ this.PlacesUIUtils = {
|
||||||
/** aItemsToOpen needs to be an array of objects of the form:
|
/** aItemsToOpen needs to be an array of objects of the form:
|
||||||
* {uri: string, isBookmark: boolean}
|
* {uri: string, isBookmark: boolean}
|
||||||
*/
|
*/
|
||||||
_openTabset: function (aItemsToOpen, aEvent, aWindow) {
|
_openTabset: function(aItemsToOpen, aEvent, aWindow) {
|
||||||
if (!aItemsToOpen.length)
|
if (!aItemsToOpen.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -722,7 +722,7 @@ this.PlacesUIUtils = {
|
||||||
},
|
},
|
||||||
|
|
||||||
openLiveMarkNodesInTabs:
|
openLiveMarkNodesInTabs:
|
||||||
function (aNode, aEvent, aView) {
|
function(aNode, aEvent, aView) {
|
||||||
let window = aView.ownerWindow;
|
let window = aView.ownerWindow;
|
||||||
|
|
||||||
PlacesUtils.livemarks.getLivemark({id: aNode.itemId})
|
PlacesUtils.livemarks.getLivemark({id: aNode.itemId})
|
||||||
|
|
@ -741,7 +741,7 @@ this.PlacesUIUtils = {
|
||||||
},
|
},
|
||||||
|
|
||||||
openContainerNodeInTabs:
|
openContainerNodeInTabs:
|
||||||
function (aNode, aEvent, aView) {
|
function(aNode, aEvent, aView) {
|
||||||
let window = aView.ownerWindow;
|
let window = aView.ownerWindow;
|
||||||
|
|
||||||
let urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
|
let urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
|
||||||
|
|
@ -750,7 +750,7 @@ this.PlacesUIUtils = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openURINodesInTabs: function (aNodes, aEvent, aView) {
|
openURINodesInTabs: function(aNodes, aEvent, aView) {
|
||||||
let window = aView.ownerWindow;
|
let window = aView.ownerWindow;
|
||||||
|
|
||||||
let urlsToOpen = [];
|
let urlsToOpen = [];
|
||||||
|
|
@ -775,7 +775,7 @@ this.PlacesUIUtils = {
|
||||||
* The controller associated with aNode.
|
* The controller associated with aNode.
|
||||||
*/
|
*/
|
||||||
openNodeWithEvent:
|
openNodeWithEvent:
|
||||||
function (aNode, aEvent, aView) {
|
function(aNode, aEvent, aView) {
|
||||||
let window = aView.ownerWindow;
|
let window = aView.ownerWindow;
|
||||||
this._openNodeIn(aNode, window.whereToOpenLink(aEvent, false, true), window);
|
this._openNodeIn(aNode, window.whereToOpenLink(aEvent, false, true), window);
|
||||||
},
|
},
|
||||||
|
|
@ -785,12 +785,12 @@ this.PlacesUIUtils = {
|
||||||
* web panel.
|
* web panel.
|
||||||
* see also openUILinkIn
|
* see also openUILinkIn
|
||||||
*/
|
*/
|
||||||
openNodeIn: function (aNode, aWhere, aView, aPrivate) {
|
openNodeIn: function(aNode, aWhere, aView, aPrivate) {
|
||||||
let window = aView.ownerWindow;
|
let window = aView.ownerWindow;
|
||||||
this._openNodeIn(aNode, aWhere, window, aPrivate);
|
this._openNodeIn(aNode, aWhere, window, aPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
_openNodeIn: function (aNode, aWhere, aWindow, aPrivate=false) {
|
_openNodeIn: function(aNode, aWhere, aWindow, aPrivate=false) {
|
||||||
if (aNode && PlacesUtils.nodeIsURI(aNode) &&
|
if (aNode && PlacesUtils.nodeIsURI(aNode) &&
|
||||||
this.checkURLSecurity(aNode, aWindow)) {
|
this.checkURLSecurity(aNode, aWindow)) {
|
||||||
let isBookmark = PlacesUtils.nodeIsBookmark(aNode);
|
let isBookmark = PlacesUtils.nodeIsBookmark(aNode);
|
||||||
|
|
@ -831,11 +831,11 @@ this.PlacesUIUtils = {
|
||||||
*
|
*
|
||||||
* @note this is not supposed be perfect, so use it only for UI purposes.
|
* @note this is not supposed be perfect, so use it only for UI purposes.
|
||||||
*/
|
*/
|
||||||
guessUrlSchemeForUI: function (aUrlString) {
|
guessUrlSchemeForUI: function(aUrlString) {
|
||||||
return aUrlString.substr(0, aUrlString.indexOf(":"));
|
return aUrlString.substr(0, aUrlString.indexOf(":"));
|
||||||
},
|
},
|
||||||
|
|
||||||
getBestTitle: function (aNode, aDoNotCutTitle) {
|
getBestTitle: function(aNode, aDoNotCutTitle) {
|
||||||
var title;
|
var title;
|
||||||
if (!aNode.title && PlacesUtils.nodeIsURI(aNode)) {
|
if (!aNode.title && PlacesUtils.nodeIsURI(aNode)) {
|
||||||
// if node title is empty, try to set the label using host and filename
|
// if node title is empty, try to set the label using host and filename
|
||||||
|
|
@ -1016,7 +1016,7 @@ this.PlacesUIUtils = {
|
||||||
// Create a new left pane folder.
|
// Create a new left pane folder.
|
||||||
var callback = {
|
var callback = {
|
||||||
// Helper to create an organizer special query.
|
// Helper to create an organizer special query.
|
||||||
create_query: function (aQueryName, aParentId, aQueryUrl) {
|
create_query: function(aQueryName, aParentId, aQueryUrl) {
|
||||||
let itemId = bs.insertBookmark(aParentId,
|
let itemId = bs.insertBookmark(aParentId,
|
||||||
PlacesUtils._uri(aQueryUrl),
|
PlacesUtils._uri(aQueryUrl),
|
||||||
bs.DEFAULT_INDEX,
|
bs.DEFAULT_INDEX,
|
||||||
|
|
@ -1033,7 +1033,7 @@ this.PlacesUIUtils = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Helper to create an organizer special folder.
|
// Helper to create an organizer special folder.
|
||||||
create_folder: function (aFolderName, aParentId, aIsRoot) {
|
create_folder: function(aFolderName, aParentId, aIsRoot) {
|
||||||
// Left Pane Root Folder.
|
// Left Pane Root Folder.
|
||||||
let folderId = bs.createFolder(aParentId,
|
let folderId = bs.createFolder(aParentId,
|
||||||
queries[aFolderName].title,
|
queries[aFolderName].title,
|
||||||
|
|
@ -1057,7 +1057,7 @@ this.PlacesUIUtils = {
|
||||||
return folderId;
|
return folderId;
|
||||||
},
|
},
|
||||||
|
|
||||||
runBatched: function (aUserData) {
|
runBatched: function(aUserData) {
|
||||||
delete PlacesUIUtils.leftPaneQueries;
|
delete PlacesUIUtils.leftPaneQueries;
|
||||||
PlacesUIUtils.leftPaneQueries = { };
|
PlacesUIUtils.leftPaneQueries = { };
|
||||||
|
|
||||||
|
|
@ -1125,7 +1125,7 @@ this.PlacesUIUtils = {
|
||||||
* @param aItemId id of a container
|
* @param aItemId id of a container
|
||||||
* @returns the name of the query, or empty string if not a left-pane query
|
* @returns the name of the query, or empty string if not a left-pane query
|
||||||
*/
|
*/
|
||||||
getLeftPaneQueryNameFromId: function (aItemId) {
|
getLeftPaneQueryNameFromId: function(aItemId) {
|
||||||
var queryName = "";
|
var queryName = "";
|
||||||
// If the let pane hasn't been built, use the annotation service
|
// If the let pane hasn't been built, use the annotation service
|
||||||
// directly, to avoid building the left pane too early.
|
// directly, to avoid building the left pane too early.
|
||||||
|
|
@ -1170,7 +1170,7 @@ this.PlacesUIUtils = {
|
||||||
* @return The URL with the fragment at the end
|
* @return The URL with the fragment at the end
|
||||||
*/
|
*/
|
||||||
getImageURLForResolution:
|
getImageURLForResolution:
|
||||||
function (aWindow, aURL, aWidth, aHeight) {
|
function(aWindow, aURL, aWidth, aHeight) {
|
||||||
return aURL;
|
return aURL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ var BookmarkPropertiesPanel = {
|
||||||
* This method returns the correct label for the dialog's "accept"
|
* This method returns the correct label for the dialog's "accept"
|
||||||
* button based on the variant of the dialog.
|
* button based on the variant of the dialog.
|
||||||
*/
|
*/
|
||||||
_getAcceptLabel: function () {
|
_getAcceptLabel: function() {
|
||||||
if (this._action == ACTION_ADD) {
|
if (this._action == ACTION_ADD) {
|
||||||
if (this._URIs.length)
|
if (this._URIs.length)
|
||||||
return this._strings.getString("dialogAcceptLabelAddMulti");
|
return this._strings.getString("dialogAcceptLabelAddMulti");
|
||||||
|
|
@ -127,7 +127,7 @@ var BookmarkPropertiesPanel = {
|
||||||
* This method returns the correct title for the current variant
|
* This method returns the correct title for the current variant
|
||||||
* of this dialog.
|
* of this dialog.
|
||||||
*/
|
*/
|
||||||
_getDialogTitle: function () {
|
_getDialogTitle: function() {
|
||||||
if (this._action == ACTION_ADD) {
|
if (this._action == ACTION_ADD) {
|
||||||
if (this._itemType == BOOKMARK_ITEM)
|
if (this._itemType == BOOKMARK_ITEM)
|
||||||
return this._strings.getString("dialogTitleAddBookmark");
|
return this._strings.getString("dialogTitleAddBookmark");
|
||||||
|
|
@ -150,7 +150,7 @@ var BookmarkPropertiesPanel = {
|
||||||
/**
|
/**
|
||||||
* Determines the initial data for the item edited or added by this dialog
|
* Determines the initial data for the item edited or added by this dialog
|
||||||
*/
|
*/
|
||||||
_determineItemInfo: function () {
|
_determineItemInfo: function() {
|
||||||
var dialogInfo = window.arguments[0];
|
var dialogInfo = window.arguments[0];
|
||||||
this._action = dialogInfo.action == "add" ? ACTION_ADD : ACTION_EDIT;
|
this._action = dialogInfo.action == "add" ? ACTION_ADD : ACTION_EDIT;
|
||||||
this._hiddenRows = dialogInfo.hiddenRows ? dialogInfo.hiddenRows : [];
|
this._hiddenRows = dialogInfo.hiddenRows ? dialogInfo.hiddenRows : [];
|
||||||
|
|
@ -294,7 +294,7 @@ var BookmarkPropertiesPanel = {
|
||||||
*
|
*
|
||||||
* @returns a title string
|
* @returns a title string
|
||||||
*/
|
*/
|
||||||
_getURITitleFromHistory: function (aURI) {
|
_getURITitleFromHistory: function(aURI) {
|
||||||
NS_ASSERT(aURI instanceof Ci.nsIURI);
|
NS_ASSERT(aURI instanceof Ci.nsIURI);
|
||||||
|
|
||||||
// get the title from History
|
// get the title from History
|
||||||
|
|
@ -390,7 +390,7 @@ var BookmarkPropertiesPanel = {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
var target = aEvent.target;
|
var target = aEvent.target;
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "input":
|
case "input":
|
||||||
|
|
@ -413,7 +413,7 @@ var BookmarkPropertiesPanel = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_beginBatch: function () {
|
_beginBatch: function() {
|
||||||
if (this._batching)
|
if (this._batching)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -421,7 +421,7 @@ var BookmarkPropertiesPanel = {
|
||||||
this._batching = true;
|
this._batching = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_endBatch: function () {
|
_endBatch: function() {
|
||||||
if (!this._batching)
|
if (!this._batching)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -429,7 +429,7 @@ var BookmarkPropertiesPanel = {
|
||||||
this._batching = false;
|
this._batching = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_fillEditProperties: function () {
|
_fillEditProperties: function() {
|
||||||
gEditItemOverlay.initPanel(this._itemId,
|
gEditItemOverlay.initPanel(this._itemId,
|
||||||
{ hiddenRows: this._hiddenRows,
|
{ hiddenRows: this._hiddenRows,
|
||||||
forceReadOnly: this._readOnly });
|
forceReadOnly: this._readOnly });
|
||||||
|
|
@ -449,7 +449,7 @@ var BookmarkPropertiesPanel = {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function(aIID) {
|
||||||
if (aIID.equals(Ci.nsIDOMEventListener) ||
|
if (aIID.equals(Ci.nsIDOMEventListener) ||
|
||||||
aIID.equals(Ci.nsISupports))
|
aIID.equals(Ci.nsISupports))
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -457,11 +457,11 @@ var BookmarkPropertiesPanel = {
|
||||||
throw Cr.NS_NOINTERFACE;
|
throw Cr.NS_NOINTERFACE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_element: function (aID) {
|
_element: function(aID) {
|
||||||
return document.getElementById("editBMPanel_" + aID);
|
return document.getElementById("editBMPanel_" + aID);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDialogUnload: function () {
|
onDialogUnload: function() {
|
||||||
// gEditItemOverlay does not exist anymore here, so don't rely on it.
|
// gEditItemOverlay does not exist anymore here, so don't rely on it.
|
||||||
this._mutationObserver.disconnect();
|
this._mutationObserver.disconnect();
|
||||||
delete this._mutationObserver;
|
delete this._mutationObserver;
|
||||||
|
|
@ -478,7 +478,7 @@ var BookmarkPropertiesPanel = {
|
||||||
.removeEventListener("input", this, false);
|
.removeEventListener("input", this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDialogAccept: function () {
|
onDialogAccept: function() {
|
||||||
// We must blur current focused element to save its changes correctly
|
// We must blur current focused element to save its changes correctly
|
||||||
document.commandDispatcher.focusedElement.blur();
|
document.commandDispatcher.focusedElement.blur();
|
||||||
// The order here is important! We have to uninit the panel first, otherwise
|
// The order here is important! We have to uninit the panel first, otherwise
|
||||||
|
|
@ -488,7 +488,7 @@ var BookmarkPropertiesPanel = {
|
||||||
window.arguments[0].performed = true;
|
window.arguments[0].performed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onDialogCancel: function () {
|
onDialogCancel: function() {
|
||||||
// The order here is important! We have to uninit the panel first, otherwise
|
// The order here is important! We have to uninit the panel first, otherwise
|
||||||
// changes done as part of Undo may change the panel contents and by
|
// changes done as part of Undo may change the panel contents and by
|
||||||
// that force it to commit more transactions.
|
// that force it to commit more transactions.
|
||||||
|
|
@ -503,7 +503,7 @@ var BookmarkPropertiesPanel = {
|
||||||
*
|
*
|
||||||
* @returns true if the input is valid, false otherwise
|
* @returns true if the input is valid, false otherwise
|
||||||
*/
|
*/
|
||||||
_inputIsValid: function () {
|
_inputIsValid: function() {
|
||||||
if (this._itemType == BOOKMARK_ITEM &&
|
if (this._itemType == BOOKMARK_ITEM &&
|
||||||
!this._containsValidURI("locationField"))
|
!this._containsValidURI("locationField"))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -522,7 +522,7 @@ var BookmarkPropertiesPanel = {
|
||||||
*
|
*
|
||||||
* @returns true if the textbox contains a valid URI string, false otherwise
|
* @returns true if the textbox contains a valid URI string, false otherwise
|
||||||
*/
|
*/
|
||||||
_containsValidURI: function (aTextboxID) {
|
_containsValidURI: function(aTextboxID) {
|
||||||
try {
|
try {
|
||||||
var value = this._element(aTextboxID).value;
|
var value = this._element(aTextboxID).value;
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
@ -540,7 +540,7 @@ var BookmarkPropertiesPanel = {
|
||||||
* The container-identifier and insertion-index are returned separately in
|
* The container-identifier and insertion-index are returned separately in
|
||||||
* the form of [containerIdentifier, insertionIndex]
|
* the form of [containerIdentifier, insertionIndex]
|
||||||
*/
|
*/
|
||||||
_getInsertionPointDetails: function () {
|
_getInsertionPointDetails: function() {
|
||||||
var containerId = this._defaultInsertionPoint.itemId;
|
var containerId = this._defaultInsertionPoint.itemId;
|
||||||
var indexInContainer = this._defaultInsertionPoint.index;
|
var indexInContainer = this._defaultInsertionPoint.index;
|
||||||
|
|
||||||
|
|
@ -552,7 +552,7 @@ var BookmarkPropertiesPanel = {
|
||||||
* various fields and opening arguments of the dialog.
|
* various fields and opening arguments of the dialog.
|
||||||
*/
|
*/
|
||||||
_getCreateNewBookmarkTransaction:
|
_getCreateNewBookmarkTransaction:
|
||||||
function (aContainer, aIndex) {
|
function(aContainer, aIndex) {
|
||||||
var annotations = [];
|
var annotations = [];
|
||||||
var childTransactions = [];
|
var childTransactions = [];
|
||||||
|
|
||||||
|
|
@ -598,7 +598,7 @@ var BookmarkPropertiesPanel = {
|
||||||
* Returns a childItems-transactions array representing the URIList with
|
* Returns a childItems-transactions array representing the URIList with
|
||||||
* which the dialog has been opened.
|
* which the dialog has been opened.
|
||||||
*/
|
*/
|
||||||
_getTransactionsForURIList: function () {
|
_getTransactionsForURIList: function() {
|
||||||
var transactions = [];
|
var transactions = [];
|
||||||
for (var i = 0; i < this._URIs.length; ++i) {
|
for (var i = 0; i < this._URIs.length; ++i) {
|
||||||
var uri = this._URIs[i];
|
var uri = this._URIs[i];
|
||||||
|
|
@ -616,7 +616,7 @@ var BookmarkPropertiesPanel = {
|
||||||
* various fields and opening arguments of the dialog.
|
* various fields and opening arguments of the dialog.
|
||||||
*/
|
*/
|
||||||
_getCreateNewFolderTransaction:
|
_getCreateNewFolderTransaction:
|
||||||
function (aContainer, aIndex) {
|
function(aContainer, aIndex) {
|
||||||
var annotations = [];
|
var annotations = [];
|
||||||
var childItemsTransactions;
|
var childItemsTransactions;
|
||||||
if (this._URIs.length)
|
if (this._URIs.length)
|
||||||
|
|
@ -635,7 +635,7 @@ var BookmarkPropertiesPanel = {
|
||||||
* the various fields and opening arguments of the dialog.
|
* the various fields and opening arguments of the dialog.
|
||||||
*/
|
*/
|
||||||
_getCreateNewLivemarkTransaction:
|
_getCreateNewLivemarkTransaction:
|
||||||
function (aContainer, aIndex) {
|
function(aContainer, aIndex) {
|
||||||
return new PlacesCreateLivemarkTransaction(this._feedURI, this._siteURI,
|
return new PlacesCreateLivemarkTransaction(this._feedURI, this._siteURI,
|
||||||
this._title,
|
this._title,
|
||||||
aContainer, aIndex);
|
aContainer, aIndex);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ PlacesViewBase.prototype = {
|
||||||
* @throws if there is no DOM node set for aPlacesNode.
|
* @throws if there is no DOM node set for aPlacesNode.
|
||||||
*/
|
*/
|
||||||
_getDOMNodeForPlacesNode:
|
_getDOMNodeForPlacesNode:
|
||||||
function (aPlacesNode) {
|
function(aPlacesNode) {
|
||||||
let node = this._domNodes.get(aPlacesNode, null);
|
let node = this._domNodes.get(aPlacesNode, null);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
throw new Error("No DOM node set for aPlacesNode.\nnode.type: " +
|
throw new Error("No DOM node set for aPlacesNode.\nnode.type: " +
|
||||||
|
|
@ -182,17 +182,17 @@ PlacesViewBase.prototype = {
|
||||||
index, orientation, isTag);
|
index, orientation, isTag);
|
||||||
},
|
},
|
||||||
|
|
||||||
buildContextMenu: function (aPopup) {
|
buildContextMenu: function(aPopup) {
|
||||||
this._contextMenuShown = aPopup;
|
this._contextMenuShown = aPopup;
|
||||||
window.updateCommands("places");
|
window.updateCommands("places");
|
||||||
return this.controller.buildContextMenu(aPopup);
|
return this.controller.buildContextMenu(aPopup);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyContextMenu: function (aPopup) {
|
destroyContextMenu: function(aPopup) {
|
||||||
this._contextMenuShown = null;
|
this._contextMenuShown = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_cleanPopup: function (aPopup, aDelay) {
|
_cleanPopup: function(aPopup, aDelay) {
|
||||||
// Remove Places nodes from the popup.
|
// Remove Places nodes from the popup.
|
||||||
let child = aPopup._startMarker;
|
let child = aPopup._startMarker;
|
||||||
while (child.nextSibling != aPopup._endMarker) {
|
while (child.nextSibling != aPopup._endMarker) {
|
||||||
|
|
@ -215,7 +215,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_rebuildPopup: function (aPopup) {
|
_rebuildPopup: function(aPopup) {
|
||||||
let resultNode = aPopup._placesNode;
|
let resultNode = aPopup._placesNode;
|
||||||
if (!resultNode.containerOpen)
|
if (!resultNode.containerOpen)
|
||||||
return;
|
return;
|
||||||
|
|
@ -244,7 +244,7 @@ PlacesViewBase.prototype = {
|
||||||
aPopup._built = true;
|
aPopup._built = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeChild: function (aChild) {
|
_removeChild: function(aChild) {
|
||||||
// If document.popupNode pointed to this child, null it out,
|
// If document.popupNode pointed to this child, null it out,
|
||||||
// otherwise controller's command-updating may rely on the removed
|
// otherwise controller's command-updating may rely on the removed
|
||||||
// item still being "selected".
|
// item still being "selected".
|
||||||
|
|
@ -255,7 +255,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_setEmptyPopupStatus:
|
_setEmptyPopupStatus:
|
||||||
function (aPopup, aEmpty) {
|
function(aPopup, aEmpty) {
|
||||||
if (!aPopup._emptyMenuitem) {
|
if (!aPopup._emptyMenuitem) {
|
||||||
let label = PlacesUIUtils.getString("bookmarksMenuEmptyFolder");
|
let label = PlacesUIUtils.getString("bookmarksMenuEmptyFolder");
|
||||||
aPopup._emptyMenuitem = document.createElement("menuitem");
|
aPopup._emptyMenuitem = document.createElement("menuitem");
|
||||||
|
|
@ -279,7 +279,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_createMenuItemForPlacesNode:
|
_createMenuItemForPlacesNode:
|
||||||
function (aPlacesNode) {
|
function(aPlacesNode) {
|
||||||
this._domNodes.delete(aPlacesNode);
|
this._domNodes.delete(aPlacesNode);
|
||||||
|
|
||||||
let element;
|
let element;
|
||||||
|
|
@ -357,7 +357,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_insertNewItemToPopup:
|
_insertNewItemToPopup:
|
||||||
function (aNewChild, aPopup, aBefore) {
|
function(aNewChild, aPopup, aBefore) {
|
||||||
let element = this._createMenuItemForPlacesNode(aNewChild);
|
let element = this._createMenuItemForPlacesNode(aNewChild);
|
||||||
let before = aBefore || aPopup._endMarker;
|
let before = aBefore || aPopup._endMarker;
|
||||||
aPopup.insertBefore(element, before);
|
aPopup.insertBefore(element, before);
|
||||||
|
|
@ -365,7 +365,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_setLivemarkSiteURIMenuItem:
|
_setLivemarkSiteURIMenuItem:
|
||||||
function (aPopup) {
|
function(aPopup) {
|
||||||
let livemarkInfo = this.controller.getCachedLivemarkInfo(aPopup._placesNode);
|
let livemarkInfo = this.controller.getCachedLivemarkInfo(aPopup._placesNode);
|
||||||
let siteUrl = livemarkInfo && livemarkInfo.siteURI ?
|
let siteUrl = livemarkInfo && livemarkInfo.siteURI ?
|
||||||
livemarkInfo.siteURI.spec : null;
|
livemarkInfo.siteURI.spec : null;
|
||||||
|
|
@ -408,7 +408,7 @@ PlacesViewBase.prototype = {
|
||||||
* The livemark status
|
* The livemark status
|
||||||
*/
|
*/
|
||||||
_setLivemarkStatusMenuItem:
|
_setLivemarkStatusMenuItem:
|
||||||
function (aPopup, aStatus) {
|
function(aPopup, aStatus) {
|
||||||
let statusMenuitem = aPopup._statusMenuitem;
|
let statusMenuitem = aPopup._statusMenuitem;
|
||||||
if (!statusMenuitem) {
|
if (!statusMenuitem) {
|
||||||
// Create the status menuitem and cache it in the popup object.
|
// Create the status menuitem and cache it in the popup object.
|
||||||
|
|
@ -434,7 +434,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCutNode: function (aPlacesNode, aValue) {
|
toggleCutNode: function(aPlacesNode, aValue) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
// We may get the popup for menus, but we need the menu itself.
|
// We may get the popup for menus, but we need the menu itself.
|
||||||
|
|
@ -446,7 +446,7 @@ PlacesViewBase.prototype = {
|
||||||
elt.removeAttribute("cutting");
|
elt.removeAttribute("cutting");
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeURIChanged: function (aPlacesNode, aURIString) {
|
nodeURIChanged: function(aPlacesNode, aURIString) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
// Here we need the <menu>.
|
// Here we need the <menu>.
|
||||||
|
|
@ -456,7 +456,7 @@ PlacesViewBase.prototype = {
|
||||||
elt.setAttribute("scheme", PlacesUIUtils.guessUrlSchemeForUI(aURIString));
|
elt.setAttribute("scheme", PlacesUIUtils.guessUrlSchemeForUI(aURIString));
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeIconChanged: function (aPlacesNode) {
|
nodeIconChanged: function(aPlacesNode) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
// There's no UI representation for the root node, thus there's nothing to
|
// There's no UI representation for the root node, thus there's nothing to
|
||||||
|
|
@ -477,7 +477,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeAnnotationChanged:
|
nodeAnnotationChanged:
|
||||||
function (aPlacesNode, aAnno) {
|
function(aPlacesNode, aAnno) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
// All livemarks have a feedURI, so use it as our indicator of a livemark
|
// All livemarks have a feedURI, so use it as our indicator of a livemark
|
||||||
|
|
@ -504,7 +504,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTitleChanged:
|
nodeTitleChanged:
|
||||||
function (aPlacesNode, aNewTitle) {
|
function(aPlacesNode, aNewTitle) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
// There's no UI representation for the root node, thus there's
|
// There's no UI representation for the root node, thus there's
|
||||||
|
|
@ -528,7 +528,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeRemoved:
|
nodeRemoved:
|
||||||
function (aParentPlacesNode, aPlacesNode, aIndex) {
|
function(aParentPlacesNode, aPlacesNode, aIndex) {
|
||||||
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
|
|
@ -548,7 +548,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeHistoryDetailsChanged:
|
nodeHistoryDetailsChanged:
|
||||||
function (aPlacesNode, aTime, aCount) {
|
function(aPlacesNode, aTime, aCount) {
|
||||||
if (aPlacesNode.parent &&
|
if (aPlacesNode.parent &&
|
||||||
this.controller.hasCachedLivemarkInfo(aPlacesNode.parent)) {
|
this.controller.hasCachedLivemarkInfo(aPlacesNode.parent)) {
|
||||||
// Find the node in the parent.
|
// Find the node in the parent.
|
||||||
|
|
@ -575,7 +575,7 @@ PlacesViewBase.prototype = {
|
||||||
batching: function() { },
|
batching: function() { },
|
||||||
|
|
||||||
nodeInserted:
|
nodeInserted:
|
||||||
function (aParentPlacesNode, aPlacesNode, aIndex) {
|
function(aParentPlacesNode, aPlacesNode, aIndex) {
|
||||||
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
||||||
if (!parentElt._built)
|
if (!parentElt._built)
|
||||||
return;
|
return;
|
||||||
|
|
@ -588,7 +588,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeMoved:
|
nodeMoved:
|
||||||
function (aPlacesNode,
|
function(aPlacesNode,
|
||||||
aOldParentPlacesNode, aOldIndex,
|
aOldParentPlacesNode, aOldIndex,
|
||||||
aNewParentPlacesNode, aNewIndex) {
|
aNewParentPlacesNode, aNewIndex) {
|
||||||
// Note: the current implementation of moveItem does not actually
|
// Note: the current implementation of moveItem does not actually
|
||||||
|
|
@ -617,7 +617,7 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
containerStateChanged:
|
containerStateChanged:
|
||||||
function (aPlacesNode, aOldState, aNewState) {
|
function(aPlacesNode, aOldState, aNewState) {
|
||||||
if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED ||
|
if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED ||
|
||||||
aNewState == Ci.nsINavHistoryContainerResultNode.STATE_CLOSED) {
|
aNewState == Ci.nsINavHistoryContainerResultNode.STATE_CLOSED) {
|
||||||
this.invalidateContainer(aPlacesNode);
|
this.invalidateContainer(aPlacesNode);
|
||||||
|
|
@ -649,7 +649,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateLivemarkPopup: function (aPopup)
|
_populateLivemarkPopup: function(aPopup)
|
||||||
{
|
{
|
||||||
this._setLivemarkSiteURIMenuItem(aPopup);
|
this._setLivemarkSiteURIMenuItem(aPopup);
|
||||||
// Show the loading status only if there are no entries yet.
|
// Show the loading status only if there are no entries yet.
|
||||||
|
|
@ -679,7 +679,7 @@ PlacesViewBase.prototype = {
|
||||||
}, Components.utils.reportError);
|
}, Components.utils.reportError);
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer: function (aPlacesNode) {
|
invalidateContainer: function(aPlacesNode) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
elt._built = false;
|
elt._built = false;
|
||||||
|
|
||||||
|
|
@ -688,7 +688,7 @@ PlacesViewBase.prototype = {
|
||||||
this._rebuildPopup(elt);
|
this._rebuildPopup(elt);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
if (this._result) {
|
if (this._result) {
|
||||||
this._result.removeObserver(this);
|
this._result.removeObserver(this);
|
||||||
this._resultNode.containerOpen = false;
|
this._resultNode.containerOpen = false;
|
||||||
|
|
@ -729,7 +729,7 @@ PlacesViewBase.prototype = {
|
||||||
* @param aPopup
|
* @param aPopup
|
||||||
* a Places popup.
|
* a Places popup.
|
||||||
*/
|
*/
|
||||||
_mayAddCommandsItems: function (aPopup) {
|
_mayAddCommandsItems: function(aPopup) {
|
||||||
// The command items are never added to the root popup.
|
// The command items are never added to the root popup.
|
||||||
if (aPopup == this._rootElt)
|
if (aPopup == this._rootElt)
|
||||||
return;
|
return;
|
||||||
|
|
@ -794,7 +794,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureMarkers: function (aPopup) {
|
_ensureMarkers: function(aPopup) {
|
||||||
if (aPopup._startMarker)
|
if (aPopup._startMarker)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -830,7 +830,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupShowing: function (aEvent) {
|
_onPopupShowing: function(aEvent) {
|
||||||
// Avoid handling popupshowing of inner views.
|
// Avoid handling popupshowing of inner views.
|
||||||
let popup = aEvent.originalTarget;
|
let popup = aEvent.originalTarget;
|
||||||
|
|
||||||
|
|
@ -854,14 +854,14 @@ PlacesViewBase.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_addEventListeners:
|
_addEventListeners:
|
||||||
function (aObject, aEventNames, aCapturing) {
|
function(aObject, aEventNames, aCapturing) {
|
||||||
for (let i = 0; i < aEventNames.length; i++) {
|
for (let i = 0; i < aEventNames.length; i++) {
|
||||||
aObject.addEventListener(aEventNames[i], this, aCapturing);
|
aObject.addEventListener(aEventNames[i], this, aCapturing);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeEventListeners:
|
_removeEventListeners:
|
||||||
function (aObject, aEventNames, aCapturing) {
|
function(aObject, aEventNames, aCapturing) {
|
||||||
for (let i = 0; i < aEventNames.length; i++) {
|
for (let i = 0; i < aEventNames.length; i++) {
|
||||||
aObject.removeEventListener(aEventNames[i], this, aCapturing);
|
aObject.removeEventListener(aEventNames[i], this, aCapturing);
|
||||||
}
|
}
|
||||||
|
|
@ -878,9 +878,9 @@ function PlacesToolbar(aPlace) {
|
||||||
["_dropIndicator", "PlacesToolbarDropIndicator"],
|
["_dropIndicator", "PlacesToolbarDropIndicator"],
|
||||||
["_chevron", "PlacesChevron"],
|
["_chevron", "PlacesChevron"],
|
||||||
["_chevronPopup", "PlacesChevronPopup"]
|
["_chevronPopup", "PlacesChevronPopup"]
|
||||||
].forEach(function (elementGlobal) {
|
].forEach(function(elementGlobal) {
|
||||||
let [name, id] = elementGlobal;
|
let [name, id] = elementGlobal;
|
||||||
thisView.__defineGetter__(name, function () {
|
thisView.__defineGetter__(name, function() {
|
||||||
let element = document.getElementById(id);
|
let element = document.getElementById(id);
|
||||||
if (!element)
|
if (!element)
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -914,7 +914,7 @@ PlacesToolbar.prototype = {
|
||||||
_cbEvents: ["dragstart", "dragover", "dragexit", "dragend", "drop",
|
_cbEvents: ["dragstart", "dragover", "dragexit", "dragend", "drop",
|
||||||
"mousemove", "mouseover", "mouseout"],
|
"mousemove", "mouseover", "mouseout"],
|
||||||
|
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function(aIID) {
|
||||||
if (aIID.equals(Ci.nsIDOMEventListener) ||
|
if (aIID.equals(Ci.nsIDOMEventListener) ||
|
||||||
aIID.equals(Ci.nsITimerCallback))
|
aIID.equals(Ci.nsITimerCallback))
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -922,7 +922,7 @@ PlacesToolbar.prototype = {
|
||||||
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
this._removeEventListeners(this._viewElt, this._cbEvents, false);
|
this._removeEventListeners(this._viewElt, this._cbEvents, false);
|
||||||
this._removeEventListeners(this._rootElt, ["popupshowing", "popuphidden"],
|
this._removeEventListeners(this._rootElt, ["popupshowing", "popuphidden"],
|
||||||
true);
|
true);
|
||||||
|
|
@ -936,7 +936,7 @@ PlacesToolbar.prototype = {
|
||||||
_openedMenuButton: null,
|
_openedMenuButton: null,
|
||||||
_allowPopupShowing: true,
|
_allowPopupShowing: true,
|
||||||
|
|
||||||
_rebuild: function () {
|
_rebuild: function() {
|
||||||
// Clear out references to existing nodes, since they will be removed
|
// Clear out references to existing nodes, since they will be removed
|
||||||
// and re-added.
|
// and re-added.
|
||||||
if (this._overFolder.elt)
|
if (this._overFolder.elt)
|
||||||
|
|
@ -961,7 +961,7 @@ PlacesToolbar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_insertNewItem:
|
_insertNewItem:
|
||||||
function (aChild, aBefore) {
|
function(aChild, aBefore) {
|
||||||
this._domNodes.delete(aChild);
|
this._domNodes.delete(aChild);
|
||||||
|
|
||||||
let type = aChild.type;
|
let type = aChild.type;
|
||||||
|
|
@ -1022,7 +1022,7 @@ PlacesToolbar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateChevronPopupNodesVisibility:
|
_updateChevronPopupNodesVisibility:
|
||||||
function () {
|
function() {
|
||||||
for (let i = 0, node = this._chevronPopup._startMarker.nextSibling;
|
for (let i = 0, node = this._chevronPopup._startMarker.nextSibling;
|
||||||
node != this._chevronPopup._endMarker;
|
node != this._chevronPopup._endMarker;
|
||||||
i++, node = node.nextSibling) {
|
i++, node = node.nextSibling) {
|
||||||
|
|
@ -1031,7 +1031,7 @@ PlacesToolbar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChevronPopupShowing:
|
_onChevronPopupShowing:
|
||||||
function (aEvent) {
|
function(aEvent) {
|
||||||
// Handle popupshowing only for the chevron popup, not for nested ones.
|
// Handle popupshowing only for the chevron popup, not for nested ones.
|
||||||
if (aEvent.target != this._chevronPopup)
|
if (aEvent.target != this._chevronPopup)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1042,7 +1042,7 @@ PlacesToolbar.prototype = {
|
||||||
this._updateChevronPopupNodesVisibility();
|
this._updateChevronPopupNodesVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "unload":
|
case "unload":
|
||||||
this.uninit();
|
this.uninit();
|
||||||
|
|
@ -1120,7 +1120,7 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateChevron: function () {
|
updateChevron: function() {
|
||||||
// If the chevron is collapsed there's nothing to update.
|
// If the chevron is collapsed there's nothing to update.
|
||||||
if (this._chevron.collapsed)
|
if (this._chevron.collapsed)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1133,7 +1133,7 @@ PlacesToolbar.prototype = {
|
||||||
this._updateChevronTimer = this._setTimer(100);
|
this._updateChevronTimer = this._setTimer(100);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateChevronTimerCallback: function () {
|
_updateChevronTimerCallback: function() {
|
||||||
let scrollRect = this._rootElt.getBoundingClientRect();
|
let scrollRect = this._rootElt.getBoundingClientRect();
|
||||||
let childOverflowed = false;
|
let childOverflowed = false;
|
||||||
for (let i = 0; i < this._rootElt.childNodes.length; i++) {
|
for (let i = 0; i < this._rootElt.childNodes.length; i++) {
|
||||||
|
|
@ -1155,7 +1155,7 @@ PlacesToolbar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeInserted:
|
nodeInserted:
|
||||||
function (aParentPlacesNode, aPlacesNode, aIndex) {
|
function(aParentPlacesNode, aPlacesNode, aIndex) {
|
||||||
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
||||||
if (parentElt == this._rootElt) {
|
if (parentElt == this._rootElt) {
|
||||||
let children = this._rootElt.childNodes;
|
let children = this._rootElt.childNodes;
|
||||||
|
|
@ -1169,7 +1169,7 @@ PlacesToolbar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeRemoved:
|
nodeRemoved:
|
||||||
function (aParentPlacesNode, aPlacesNode, aIndex) {
|
function(aParentPlacesNode, aPlacesNode, aIndex) {
|
||||||
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
|
|
@ -1187,7 +1187,7 @@ PlacesToolbar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeMoved:
|
nodeMoved:
|
||||||
function (aPlacesNode,
|
function(aPlacesNode,
|
||||||
aOldParentPlacesNode, aOldIndex,
|
aOldParentPlacesNode, aOldIndex,
|
||||||
aNewParentPlacesNode, aNewIndex) {
|
aNewParentPlacesNode, aNewIndex) {
|
||||||
let parentElt = this._getDOMNodeForPlacesNode(aNewParentPlacesNode);
|
let parentElt = this._getDOMNodeForPlacesNode(aNewParentPlacesNode);
|
||||||
|
|
@ -1219,7 +1219,7 @@ PlacesToolbar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeAnnotationChanged:
|
nodeAnnotationChanged:
|
||||||
function (aPlacesNode, aAnno) {
|
function(aPlacesNode, aAnno) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
if (elt == this._rootElt)
|
if (elt == this._rootElt)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1248,7 +1248,7 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTitleChanged: function (aPlacesNode, aNewTitle) {
|
nodeTitleChanged: function(aPlacesNode, aNewTitle) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
|
|
||||||
// There's no UI representation for the root node, thus there's
|
// There's no UI representation for the root node, thus there's
|
||||||
|
|
@ -1268,7 +1268,7 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer: function (aPlacesNode) {
|
invalidateContainer: function(aPlacesNode) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
if (elt == this._rootElt) {
|
if (elt == this._rootElt) {
|
||||||
// Container is the toolbar itself.
|
// Container is the toolbar itself.
|
||||||
|
|
@ -1284,7 +1284,7 @@ PlacesToolbar.prototype = {
|
||||||
hoverTime: 350,
|
hoverTime: 350,
|
||||||
closeTimer: null },
|
closeTimer: null },
|
||||||
|
|
||||||
_clearOverFolder: function () {
|
_clearOverFolder: function() {
|
||||||
// The mouse is no longer dragging over the stored menubutton.
|
// The mouse is no longer dragging over the stored menubutton.
|
||||||
// Close the menubutton, clear out drag styles, and clear all
|
// Close the menubutton, clear out drag styles, and clear all
|
||||||
// timers for opening/closing it.
|
// timers for opening/closing it.
|
||||||
|
|
@ -1312,7 +1312,7 @@ PlacesToolbar.prototype = {
|
||||||
* - beforeIndex: child index to drop before, for the drop indicator.
|
* - beforeIndex: child index to drop before, for the drop indicator.
|
||||||
* - folderElt: the folder to drop into, if applicable.
|
* - folderElt: the folder to drop into, if applicable.
|
||||||
*/
|
*/
|
||||||
_getDropPoint: function (aEvent) {
|
_getDropPoint: function(aEvent) {
|
||||||
let result = this.result;
|
let result = this.result;
|
||||||
if (!PlacesUtils.nodeIsFolder(this._resultNode))
|
if (!PlacesUtils.nodeIsFolder(this._resultNode))
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -1395,13 +1395,13 @@ PlacesToolbar.prototype = {
|
||||||
return dropPoint;
|
return dropPoint;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setTimer: function (aTime) {
|
_setTimer: function(aTime) {
|
||||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
|
timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
|
||||||
return timer;
|
return timer;
|
||||||
},
|
},
|
||||||
|
|
||||||
notify: function (aTimer) {
|
notify: function(aTimer) {
|
||||||
if (aTimer == this._updateChevronTimer) {
|
if (aTimer == this._updateChevronTimer) {
|
||||||
this._updateChevronTimer = null;
|
this._updateChevronTimer = null;
|
||||||
this._updateChevronTimerCallback();
|
this._updateChevronTimerCallback();
|
||||||
|
|
@ -1446,18 +1446,18 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseOver: function (aEvent) {
|
_onMouseOver: function(aEvent) {
|
||||||
let button = aEvent.target;
|
let button = aEvent.target;
|
||||||
if (button.parentNode == this._rootElt && button._placesNode &&
|
if (button.parentNode == this._rootElt && button._placesNode &&
|
||||||
PlacesUtils.nodeIsURI(button._placesNode))
|
PlacesUtils.nodeIsURI(button._placesNode))
|
||||||
window.XULBrowserWindow.setOverLink(aEvent.target._placesNode.uri, null);
|
window.XULBrowserWindow.setOverLink(aEvent.target._placesNode.uri, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseOut: function (aEvent) {
|
_onMouseOut: function(aEvent) {
|
||||||
window.XULBrowserWindow.setOverLink("", null);
|
window.XULBrowserWindow.setOverLink("", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_cleanupDragDetails: function () {
|
_cleanupDragDetails: function() {
|
||||||
// Called on dragend and drop.
|
// Called on dragend and drop.
|
||||||
PlacesControllerDragHelper.currentDropTarget = null;
|
PlacesControllerDragHelper.currentDropTarget = null;
|
||||||
this._draggedElt = null;
|
this._draggedElt = null;
|
||||||
|
|
@ -1467,7 +1467,7 @@ PlacesToolbar.prototype = {
|
||||||
this._dropIndicator.collapsed = true;
|
this._dropIndicator.collapsed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragStart: function (aEvent) {
|
_onDragStart: function(aEvent) {
|
||||||
// Sub menus have their own d&d handlers.
|
// Sub menus have their own d&d handlers.
|
||||||
let draggedElt = aEvent.target;
|
let draggedElt = aEvent.target;
|
||||||
if (draggedElt.parentNode != this._rootElt || !draggedElt._placesNode)
|
if (draggedElt.parentNode != this._rootElt || !draggedElt._placesNode)
|
||||||
|
|
@ -1502,7 +1502,7 @@ PlacesToolbar.prototype = {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragOver: function (aEvent) {
|
_onDragOver: function(aEvent) {
|
||||||
// Cache the dataTransfer
|
// Cache the dataTransfer
|
||||||
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
|
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
|
|
@ -1578,7 +1578,7 @@ PlacesToolbar.prototype = {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDrop: function (aEvent) {
|
_onDrop: function(aEvent) {
|
||||||
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
|
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
|
||||||
|
|
||||||
let dropPoint = this._getDropPoint(aEvent);
|
let dropPoint = this._getDropPoint(aEvent);
|
||||||
|
|
@ -1591,7 +1591,7 @@ PlacesToolbar.prototype = {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragExit: function (aEvent) {
|
_onDragExit: function(aEvent) {
|
||||||
PlacesControllerDragHelper.currentDropTarget = null;
|
PlacesControllerDragHelper.currentDropTarget = null;
|
||||||
|
|
||||||
// Set timer to turn off indicator bar (if we turn it off
|
// Set timer to turn off indicator bar (if we turn it off
|
||||||
|
|
@ -1606,11 +1606,11 @@ PlacesToolbar.prototype = {
|
||||||
this._overFolder.closeTimer = this._setTimer(this._overFolder.hoverTime);
|
this._overFolder.closeTimer = this._setTimer(this._overFolder.hoverTime);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function (aEvent) {
|
_onDragEnd: function(aEvent) {
|
||||||
this._cleanupDragDetails();
|
this._cleanupDragDetails();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupShowing: function (aEvent) {
|
_onPopupShowing: function(aEvent) {
|
||||||
if (!this._allowPopupShowing) {
|
if (!this._allowPopupShowing) {
|
||||||
this._allowPopupShowing = true;
|
this._allowPopupShowing = true;
|
||||||
aEvent.preventDefault();
|
aEvent.preventDefault();
|
||||||
|
|
@ -1624,7 +1624,7 @@ PlacesToolbar.prototype = {
|
||||||
PlacesViewBase.prototype._onPopupShowing.apply(this, arguments);
|
PlacesViewBase.prototype._onPopupShowing.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupHidden: function (aEvent) {
|
_onPopupHidden: function(aEvent) {
|
||||||
let popup = aEvent.target;
|
let popup = aEvent.target;
|
||||||
let placesNode = popup._placesNode;
|
let placesNode = popup._placesNode;
|
||||||
// Avoid handling popuphidden of inner views
|
// Avoid handling popuphidden of inner views
|
||||||
|
|
@ -1650,7 +1650,7 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseMove: function (aEvent) {
|
_onMouseMove: function(aEvent) {
|
||||||
// Used in dragStart to prevent dragging folders when dragging down.
|
// Used in dragStart to prevent dragging folders when dragging down.
|
||||||
this._cachedMouseMoveEvent = aEvent;
|
this._cachedMouseMoveEvent = aEvent;
|
||||||
|
|
||||||
|
|
@ -1696,18 +1696,18 @@ function PlacesMenu(aPopupShowingEvent, aPlace) {
|
||||||
PlacesMenu.prototype = {
|
PlacesMenu.prototype = {
|
||||||
__proto__: PlacesViewBase.prototype,
|
__proto__: PlacesViewBase.prototype,
|
||||||
|
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function(aIID) {
|
||||||
if (aIID.equals(Ci.nsIDOMEventListener))
|
if (aIID.equals(Ci.nsIDOMEventListener))
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeChild: function (aChild) {
|
_removeChild: function(aChild) {
|
||||||
PlacesViewBase.prototype._removeChild.apply(this, arguments);
|
PlacesViewBase.prototype._removeChild.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
this._removeEventListeners(this._rootElt, ["popupshowing", "popuphidden"],
|
this._removeEventListeners(this._rootElt, ["popupshowing", "popuphidden"],
|
||||||
true);
|
true);
|
||||||
this._removeEventListeners(window, ["unload"], false);
|
this._removeEventListeners(window, ["unload"], false);
|
||||||
|
|
@ -1715,7 +1715,7 @@ PlacesMenu.prototype = {
|
||||||
PlacesViewBase.prototype.uninit.apply(this, arguments);
|
PlacesViewBase.prototype.uninit.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "unload":
|
case "unload":
|
||||||
this.uninit();
|
this.uninit();
|
||||||
|
|
@ -1729,7 +1729,7 @@ PlacesMenu.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupHidden: function (aEvent) {
|
_onPopupHidden: function(aEvent) {
|
||||||
// Avoid handling popuphidden of inner views.
|
// Avoid handling popuphidden of inner views.
|
||||||
let popup = aEvent.originalTarget;
|
let popup = aEvent.originalTarget;
|
||||||
let placesNode = popup._placesNode;
|
let placesNode = popup._placesNode;
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ function PlacesController(aView) {
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "clipboard",
|
XPCOMUtils.defineLazyServiceGetter(this, "clipboard",
|
||||||
"@mozilla.org/widget/clipboard;1",
|
"@mozilla.org/widget/clipboard;1",
|
||||||
"nsIClipboard");
|
"nsIClipboard");
|
||||||
XPCOMUtils.defineLazyGetter(this, "profileName", function () {
|
XPCOMUtils.defineLazyGetter(this, "profileName", function() {
|
||||||
return Services.dirsvc.get("ProfD", Ci.nsIFile).leafName;
|
return Services.dirsvc.get("ProfD", Ci.nsIFile).leafName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -97,15 +97,15 @@ PlacesController.prototype = {
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// nsIClipboardOwner
|
// nsIClipboardOwner
|
||||||
LosingOwnership: function (aXferable) {
|
LosingOwnership: function(aXferable) {
|
||||||
this.cutNodes = [];
|
this.cutNodes = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
terminate: function () {
|
terminate: function() {
|
||||||
this._releaseClipboardOwnership();
|
this._releaseClipboardOwnership();
|
||||||
},
|
},
|
||||||
|
|
||||||
supportsCommand: function (aCommand) {
|
supportsCommand: function(aCommand) {
|
||||||
// Non-Places specific commands that we also support
|
// Non-Places specific commands that we also support
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "cmd_undo":
|
case "cmd_undo":
|
||||||
|
|
@ -124,7 +124,7 @@ PlacesController.prototype = {
|
||||||
return (aCommand.substr(0, CMD_PREFIX.length) == CMD_PREFIX);
|
return (aCommand.substr(0, CMD_PREFIX.length) == CMD_PREFIX);
|
||||||
},
|
},
|
||||||
|
|
||||||
isCommandEnabled: function (aCommand) {
|
isCommandEnabled: function(aCommand) {
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "cmd_undo":
|
case "cmd_undo":
|
||||||
return PlacesUtils.transactionManager.numberOfUndoItems > 0;
|
return PlacesUtils.transactionManager.numberOfUndoItems > 0;
|
||||||
|
|
@ -199,7 +199,7 @@ PlacesController.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
doCommand: function (aCommand) {
|
doCommand: function(aCommand) {
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "cmd_undo":
|
case "cmd_undo":
|
||||||
PlacesUtils.transactionManager.undoTransaction();
|
PlacesUtils.transactionManager.undoTransaction();
|
||||||
|
|
@ -291,7 +291,7 @@ PlacesController.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onEvent: function (eventName) { },
|
onEvent: function(eventName) { },
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -328,7 +328,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Determines whether or not nodes can be inserted relative to the selection.
|
* Determines whether or not nodes can be inserted relative to the selection.
|
||||||
*/
|
*/
|
||||||
_canInsert: function (isPaste) {
|
_canInsert: function(isPaste) {
|
||||||
var ip = this._view.insertionPoint;
|
var ip = this._view.insertionPoint;
|
||||||
return ip != null && (isPaste || ip.isTag != true);
|
return ip != null && (isPaste || ip.isTag != true);
|
||||||
},
|
},
|
||||||
|
|
@ -341,7 +341,7 @@ PlacesController.prototype = {
|
||||||
- clipboard data is of type TEXT_UNICODE and
|
- clipboard data is of type TEXT_UNICODE and
|
||||||
is a valid URI.
|
is a valid URI.
|
||||||
*/
|
*/
|
||||||
_isClipboardDataPasteable: function () {
|
_isClipboardDataPasteable: function() {
|
||||||
// if the clipboard contains TYPE_X_MOZ_PLACE_* data, it is definitely
|
// if the clipboard contains TYPE_X_MOZ_PLACE_* data, it is definitely
|
||||||
// pasteable, with no need to unwrap all the nodes.
|
// pasteable, with no need to unwrap all the nodes.
|
||||||
|
|
||||||
|
|
@ -401,7 +401,7 @@ PlacesController.prototype = {
|
||||||
* Notes:
|
* Notes:
|
||||||
* 1) This can be slow, so don't call it anywhere performance critical!
|
* 1) This can be slow, so don't call it anywhere performance critical!
|
||||||
*/
|
*/
|
||||||
_buildSelectionMetadata: function () {
|
_buildSelectionMetadata: function() {
|
||||||
var metadata = [];
|
var metadata = [];
|
||||||
var nodes = this._view.selectedNodes;
|
var nodes = this._view.selectedNodes;
|
||||||
|
|
||||||
|
|
@ -484,7 +484,7 @@ PlacesController.prototype = {
|
||||||
* @returns true if the conditions (see buildContextMenu) are satisfied
|
* @returns true if the conditions (see buildContextMenu) are satisfied
|
||||||
* and the item can be displayed, false otherwise.
|
* and the item can be displayed, false otherwise.
|
||||||
*/
|
*/
|
||||||
_shouldShowMenuItem: function (aMenuItem, aMetaData) {
|
_shouldShowMenuItem: function(aMenuItem, aMetaData) {
|
||||||
var selectiontype = aMenuItem.getAttribute("selectiontype");
|
var selectiontype = aMenuItem.getAttribute("selectiontype");
|
||||||
if (!selectiontype) {
|
if (!selectiontype) {
|
||||||
selectiontype = "single|multiple";
|
selectiontype = "single|multiple";
|
||||||
|
|
@ -577,7 +577,7 @@ PlacesController.prototype = {
|
||||||
* The menupopup to build children into.
|
* The menupopup to build children into.
|
||||||
* @return true if at least one item is visible, false otherwise.
|
* @return true if at least one item is visible, false otherwise.
|
||||||
*/
|
*/
|
||||||
buildContextMenu: function (aPopup) {
|
buildContextMenu: function(aPopup) {
|
||||||
var metadata = this._buildSelectionMetadata();
|
var metadata = this._buildSelectionMetadata();
|
||||||
var ip = this._view.insertionPoint;
|
var ip = this._view.insertionPoint;
|
||||||
var noIp = !ip || ip.isTag;
|
var noIp = !ip || ip.isTag;
|
||||||
|
|
@ -648,7 +648,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Select all links in the current view.
|
* Select all links in the current view.
|
||||||
*/
|
*/
|
||||||
selectAll: function () {
|
selectAll: function() {
|
||||||
this._view.selectAll();
|
this._view.selectAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -656,7 +656,7 @@ PlacesController.prototype = {
|
||||||
* Opens the bookmark properties for the selected URI Node.
|
* Opens the bookmark properties for the selected URI Node.
|
||||||
*/
|
*/
|
||||||
showBookmarkPropertiesForSelection:
|
showBookmarkPropertiesForSelection:
|
||||||
function () {
|
function() {
|
||||||
var node = this._view.selectedNode;
|
var node = this._view.selectedNode;
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
@ -684,7 +684,7 @@ PlacesController.prototype = {
|
||||||
* This method can be run on a URI parameter to ensure that it didn't
|
* This method can be run on a URI parameter to ensure that it didn't
|
||||||
* receive a string instead of an nsIURI object.
|
* receive a string instead of an nsIURI object.
|
||||||
*/
|
*/
|
||||||
_assertURINotString: function (value) {
|
_assertURINotString: function(value) {
|
||||||
NS_ASSERT((typeof(value) == "object") && !(value instanceof String),
|
NS_ASSERT((typeof(value) == "object") && !(value instanceof String),
|
||||||
"This method should be passed a URI as a nsIURI object, not as a string.");
|
"This method should be passed a URI as a nsIURI object, not as a string.");
|
||||||
},
|
},
|
||||||
|
|
@ -692,7 +692,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Reloads the selected livemark if any.
|
* Reloads the selected livemark if any.
|
||||||
*/
|
*/
|
||||||
reloadSelectedLivemark: function () {
|
reloadSelectedLivemark: function() {
|
||||||
var selectedNode = this._view.selectedNode;
|
var selectedNode = this._view.selectedNode;
|
||||||
if (selectedNode) {
|
if (selectedNode) {
|
||||||
let itemId = selectedNode.itemId;
|
let itemId = selectedNode.itemId;
|
||||||
|
|
@ -706,7 +706,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Opens the links in the selected folder, or the selected links in new tabs.
|
* Opens the links in the selected folder, or the selected links in new tabs.
|
||||||
*/
|
*/
|
||||||
openSelectionInTabs: function (aEvent) {
|
openSelectionInTabs: function(aEvent) {
|
||||||
var node = this._view.selectedNode;
|
var node = this._view.selectedNode;
|
||||||
var nodes = this._view.selectedNodes;
|
var nodes = this._view.selectedNodes;
|
||||||
// In the case of no selection, open the root node:
|
// In the case of no selection, open the root node:
|
||||||
|
|
@ -725,7 +725,7 @@ PlacesController.prototype = {
|
||||||
* @param aType
|
* @param aType
|
||||||
* the type of the new item (bookmark/livemark/folder)
|
* the type of the new item (bookmark/livemark/folder)
|
||||||
*/
|
*/
|
||||||
newItem: function (aType) {
|
newItem: function(aType) {
|
||||||
let ip = this._view.insertionPoint;
|
let ip = this._view.insertionPoint;
|
||||||
if (!ip)
|
if (!ip)
|
||||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
@ -747,7 +747,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Create a new Bookmark separator somewhere.
|
* Create a new Bookmark separator somewhere.
|
||||||
*/
|
*/
|
||||||
newSeparator: function () {
|
newSeparator: function() {
|
||||||
var ip = this._view.insertionPoint;
|
var ip = this._view.insertionPoint;
|
||||||
if (!ip)
|
if (!ip)
|
||||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
@ -762,7 +762,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Opens a dialog for moving the selected nodes.
|
* Opens a dialog for moving the selected nodes.
|
||||||
*/
|
*/
|
||||||
moveSelectedBookmarks: function () {
|
moveSelectedBookmarks: function() {
|
||||||
window.openDialog("chrome://browser/content/places/moveBookmarks.xul",
|
window.openDialog("chrome://browser/content/places/moveBookmarks.xul",
|
||||||
"", "chrome, modal",
|
"", "chrome, modal",
|
||||||
this._view.selectedNodes);
|
this._view.selectedNodes);
|
||||||
|
|
@ -771,7 +771,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Sort the selected folder by name.
|
* Sort the selected folder by name.
|
||||||
*/
|
*/
|
||||||
sortFolderByName: function () {
|
sortFolderByName: function() {
|
||||||
var itemId = PlacesUtils.getConcreteItemId(this._view.selectedNode);
|
var itemId = PlacesUtils.getConcreteItemId(this._view.selectedNode);
|
||||||
var txn = new PlacesSortFolderByNameTransaction(itemId);
|
var txn = new PlacesSortFolderByNameTransaction(itemId);
|
||||||
PlacesUtils.transactionManager.doTransaction(txn);
|
PlacesUtils.transactionManager.doTransaction(txn);
|
||||||
|
|
@ -780,7 +780,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Open the parent folder for the selected bookmarks search result.
|
* Open the parent folder for the selected bookmarks search result.
|
||||||
*/
|
*/
|
||||||
openParentFolder: function () {
|
openParentFolder: function() {
|
||||||
var view;
|
var view;
|
||||||
if (!document.popupNode) {
|
if (!document.popupNode) {
|
||||||
view = document.commandDispatcher.focusedElement;
|
view = document.commandDispatcher.focusedElement;
|
||||||
|
|
@ -796,7 +796,7 @@ PlacesController.prototype = {
|
||||||
this.selectFolderByItemId(view, aFolderItemId, aItemId);
|
this.selectFolderByItemId(view, aFolderItemId, aItemId);
|
||||||
},
|
},
|
||||||
|
|
||||||
getParentFolderByItemId: function (aItemId) {
|
getParentFolderByItemId: function(aItemId) {
|
||||||
var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].
|
var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||||
getService(Components.interfaces.nsINavBookmarksService);
|
getService(Components.interfaces.nsINavBookmarksService);
|
||||||
var parentFolderId = bmsvc.getFolderIdForItem(aItemId);
|
var parentFolderId = bmsvc.getFolderIdForItem(aItemId);
|
||||||
|
|
@ -804,7 +804,7 @@ PlacesController.prototype = {
|
||||||
return parentFolderId;
|
return parentFolderId;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectItems2: function (view, aIDs) {
|
selectItems2: function(view, aIDs) {
|
||||||
var ids = aIDs; // Don't manipulate the caller's array.
|
var ids = aIDs; // Don't manipulate the caller's array.
|
||||||
|
|
||||||
// Array of nodes found by findNodes which are to be selected
|
// Array of nodes found by findNodes which are to be selected
|
||||||
|
|
@ -904,7 +904,7 @@ PlacesController.prototype = {
|
||||||
selection.selectEventsSuppressed = false;
|
selection.selectEventsSuppressed = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectFolderByItemId: function (view, aFolderItemId, aItemId) {
|
selectFolderByItemId: function(view, aFolderItemId, aItemId) {
|
||||||
// Library
|
// Library
|
||||||
if (view.getAttribute("id") == "placeContent") {
|
if (view.getAttribute("id") == "placeContent") {
|
||||||
view = document.getElementById("placesList");
|
view = document.getElementById("placesList");
|
||||||
|
|
@ -1062,7 +1062,7 @@ PlacesController.prototype = {
|
||||||
* List of folders the calling function has already traversed
|
* List of folders the calling function has already traversed
|
||||||
* @returns true if the node should be skipped, false otherwise.
|
* @returns true if the node should be skipped, false otherwise.
|
||||||
*/
|
*/
|
||||||
_shouldSkipNode: function (node, pastFolders) {
|
_shouldSkipNode: function(node, pastFolders) {
|
||||||
/**
|
/**
|
||||||
* Determines if a node is contained by another node within a resultset.
|
* Determines if a node is contained by another node within a resultset.
|
||||||
* @param node
|
* @param node
|
||||||
|
|
@ -1098,7 +1098,7 @@ PlacesController.prototype = {
|
||||||
* @param [optional] removedFolders
|
* @param [optional] removedFolders
|
||||||
* An array of folder nodes that have already been removed.
|
* An array of folder nodes that have already been removed.
|
||||||
*/
|
*/
|
||||||
_removeRange: function (range, transactions, removedFolders) {
|
_removeRange: function(range, transactions, removedFolders) {
|
||||||
NS_ASSERT(transactions instanceof Array, "Must pass a transactions array");
|
NS_ASSERT(transactions instanceof Array, "Must pass a transactions array");
|
||||||
if (!removedFolders)
|
if (!removedFolders)
|
||||||
removedFolders = [];
|
removedFolders = [];
|
||||||
|
|
@ -1167,7 +1167,7 @@ PlacesController.prototype = {
|
||||||
* @param txnName
|
* @param txnName
|
||||||
* See |remove|.
|
* See |remove|.
|
||||||
*/
|
*/
|
||||||
_removeRowsFromBookmarks: function (txnName) {
|
_removeRowsFromBookmarks: function(txnName) {
|
||||||
var ranges = this._view.removableSelectionRanges;
|
var ranges = this._view.removableSelectionRanges;
|
||||||
var transactions = [];
|
var transactions = [];
|
||||||
var removedFolders = [];
|
var removedFolders = [];
|
||||||
|
|
@ -1186,7 +1186,7 @@ PlacesController.prototype = {
|
||||||
*
|
*
|
||||||
* @note history deletes are not undoable.
|
* @note history deletes are not undoable.
|
||||||
*/
|
*/
|
||||||
_removeRowsFromHistory: function () {
|
_removeRowsFromHistory: function() {
|
||||||
let nodes = this._view.selectedNodes;
|
let nodes = this._view.selectedNodes;
|
||||||
let URIs = [];
|
let URIs = [];
|
||||||
for (let i = 0; i < nodes.length; ++i) {
|
for (let i = 0; i < nodes.length; ++i) {
|
||||||
|
|
@ -1229,7 +1229,7 @@ PlacesController.prototype = {
|
||||||
*
|
*
|
||||||
* @note history deletes are not undoable.
|
* @note history deletes are not undoable.
|
||||||
*/
|
*/
|
||||||
_removeHistoryContainer: function (aContainerNode) {
|
_removeHistoryContainer: function(aContainerNode) {
|
||||||
if (PlacesUtils.nodeIsHost(aContainerNode)) {
|
if (PlacesUtils.nodeIsHost(aContainerNode)) {
|
||||||
// Site container.
|
// Site container.
|
||||||
PlacesUtils.bhistory.removePagesFromHost(aContainerNode.title, true);
|
PlacesUtils.bhistory.removePagesFromHost(aContainerNode.title, true);
|
||||||
|
|
@ -1255,7 +1255,7 @@ PlacesController.prototype = {
|
||||||
* A name for the transaction if this is being performed
|
* A name for the transaction if this is being performed
|
||||||
* as part of another operation.
|
* as part of another operation.
|
||||||
*/
|
*/
|
||||||
remove: function (aTxnName) {
|
remove: function(aTxnName) {
|
||||||
if (!this._hasRemovableSelection())
|
if (!this._hasRemovableSelection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1284,7 +1284,7 @@ PlacesController.prototype = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The dragstart event.
|
* The dragstart event.
|
||||||
*/
|
*/
|
||||||
setDataTransfer: function (aEvent) {
|
setDataTransfer: function(aEvent) {
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
let doCopy = ["copyLink", "copy", "link"].indexOf(dt.effectAllowed) != -1;
|
let doCopy = ["copyLink", "copy", "link"].indexOf(dt.effectAllowed) != -1;
|
||||||
|
|
||||||
|
|
@ -1355,14 +1355,14 @@ PlacesController.prototype = {
|
||||||
return action;
|
return action;
|
||||||
},
|
},
|
||||||
|
|
||||||
_releaseClipboardOwnership: function () {
|
_releaseClipboardOwnership: function() {
|
||||||
if (this.cutNodes.length > 0) {
|
if (this.cutNodes.length > 0) {
|
||||||
// This clears the logical clipboard, doesn't remove data.
|
// This clears the logical clipboard, doesn't remove data.
|
||||||
this.clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
|
this.clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearClipboard: function () {
|
_clearClipboard: function() {
|
||||||
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Ci.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
xferable.init(null);
|
xferable.init(null);
|
||||||
|
|
@ -1373,7 +1373,7 @@ PlacesController.prototype = {
|
||||||
this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateClipboard: function (aNodes, aAction) {
|
_populateClipboard: function(aNodes, aAction) {
|
||||||
// This order is _important_! It controls how this and other applications
|
// This order is _important_! It controls how this and other applications
|
||||||
// select data to be inserted based on type.
|
// select data to be inserted based on type.
|
||||||
let contents = [
|
let contents = [
|
||||||
|
|
@ -1386,7 +1386,7 @@ PlacesController.prototype = {
|
||||||
// Avoid handling descendants of a copied node, the transactions take care
|
// Avoid handling descendants of a copied node, the transactions take care
|
||||||
// of them automatically.
|
// of them automatically.
|
||||||
let copiedFolders = [];
|
let copiedFolders = [];
|
||||||
aNodes.forEach(function (node) {
|
aNodes.forEach(function(node) {
|
||||||
if (this._shouldSkipNode(node, copiedFolders))
|
if (this._shouldSkipNode(node, copiedFolders))
|
||||||
return;
|
return;
|
||||||
if (PlacesUtils.nodeIsFolder(node))
|
if (PlacesUtils.nodeIsFolder(node))
|
||||||
|
|
@ -1395,7 +1395,7 @@ PlacesController.prototype = {
|
||||||
let livemarkInfo = this.getCachedLivemarkInfo(node);
|
let livemarkInfo = this.getCachedLivemarkInfo(node);
|
||||||
let feedURI = livemarkInfo && livemarkInfo.feedURI.spec;
|
let feedURI = livemarkInfo && livemarkInfo.feedURI.spec;
|
||||||
|
|
||||||
contents.forEach(function (content) {
|
contents.forEach(function(content) {
|
||||||
content.entries.push(
|
content.entries.push(
|
||||||
PlacesUtils.wrapNode(node, content.type, feedURI)
|
PlacesUtils.wrapNode(node, content.type, feedURI)
|
||||||
);
|
);
|
||||||
|
|
@ -1414,7 +1414,7 @@ PlacesController.prototype = {
|
||||||
let hasData = false;
|
let hasData = false;
|
||||||
// This order matters here! It controls how this and other applications
|
// This order matters here! It controls how this and other applications
|
||||||
// select data to be inserted based on type.
|
// select data to be inserted based on type.
|
||||||
contents.forEach(function (content) {
|
contents.forEach(function(content) {
|
||||||
if (content.entries.length > 0) {
|
if (content.entries.length > 0) {
|
||||||
hasData = true;
|
hasData = true;
|
||||||
let glue =
|
let glue =
|
||||||
|
|
@ -1441,7 +1441,7 @@ PlacesController.prototype = {
|
||||||
set cutNodes(aNodes) {
|
set cutNodes(aNodes) {
|
||||||
let self = this;
|
let self = this;
|
||||||
function updateCutNodes(aValue) {
|
function updateCutNodes(aValue) {
|
||||||
self._cutNodes.forEach(function (aNode) {
|
self._cutNodes.forEach(function(aNode) {
|
||||||
self._view.toggleCutNode(aNode, aValue);
|
self._view.toggleCutNode(aNode, aValue);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1455,7 +1455,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Copy Bookmarks and Folders to the clipboard
|
* Copy Bookmarks and Folders to the clipboard
|
||||||
*/
|
*/
|
||||||
copy: function () {
|
copy: function() {
|
||||||
let result = this._view.result;
|
let result = this._view.result;
|
||||||
let didSuppressNotifications = result.suppressNotifications;
|
let didSuppressNotifications = result.suppressNotifications;
|
||||||
if (!didSuppressNotifications)
|
if (!didSuppressNotifications)
|
||||||
|
|
@ -1472,7 +1472,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Cut Bookmarks and Folders to the clipboard
|
* Cut Bookmarks and Folders to the clipboard
|
||||||
*/
|
*/
|
||||||
cut: function () {
|
cut: function() {
|
||||||
let result = this._view.result;
|
let result = this._view.result;
|
||||||
let didSuppressNotifications = result.suppressNotifications;
|
let didSuppressNotifications = result.suppressNotifications;
|
||||||
if (!didSuppressNotifications)
|
if (!didSuppressNotifications)
|
||||||
|
|
@ -1490,7 +1490,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Paste Bookmarks and Folders from the clipboard
|
* Paste Bookmarks and Folders from the clipboard
|
||||||
*/
|
*/
|
||||||
paste: function () {
|
paste: function() {
|
||||||
// No reason to proceed if there isn't a valid insertion point.
|
// No reason to proceed if there isn't a valid insertion point.
|
||||||
let ip = this._view.insertionPoint;
|
let ip = this._view.insertionPoint;
|
||||||
if (!ip)
|
if (!ip)
|
||||||
|
|
@ -1506,7 +1506,7 @@ PlacesController.prototype = {
|
||||||
[ PlacesUtils.TYPE_X_MOZ_PLACE,
|
[ PlacesUtils.TYPE_X_MOZ_PLACE,
|
||||||
PlacesUtils.TYPE_X_MOZ_URL,
|
PlacesUtils.TYPE_X_MOZ_URL,
|
||||||
PlacesUtils.TYPE_UNICODE,
|
PlacesUtils.TYPE_UNICODE,
|
||||||
].forEach(function (type) xferable.addDataFlavor(type));
|
].forEach(function(type) xferable.addDataFlavor(type));
|
||||||
|
|
||||||
this.clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
|
this.clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
|
|
||||||
|
|
@ -1572,7 +1572,7 @@ PlacesController.prototype = {
|
||||||
* @param aLivemarkInfo
|
* @param aLivemarkInfo
|
||||||
* a mozILivemarkInfo object.
|
* a mozILivemarkInfo object.
|
||||||
*/
|
*/
|
||||||
cacheLivemarkInfo: function (aNode, aLivemarkInfo) {
|
cacheLivemarkInfo: function(aNode, aLivemarkInfo) {
|
||||||
this._cachedLivemarkInfoObjects.set(aNode, aLivemarkInfo);
|
this._cachedLivemarkInfoObjects.set(aNode, aLivemarkInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1583,7 +1583,7 @@ PlacesController.prototype = {
|
||||||
* @return true if there's a cached mozILivemarkInfo object for
|
* @return true if there's a cached mozILivemarkInfo object for
|
||||||
* aNode, false otherwise.
|
* aNode, false otherwise.
|
||||||
*/
|
*/
|
||||||
hasCachedLivemarkInfo: function (aNode)
|
hasCachedLivemarkInfo: function(aNode)
|
||||||
this._cachedLivemarkInfoObjects.has(aNode),
|
this._cachedLivemarkInfoObjects.has(aNode),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1593,7 +1593,7 @@ PlacesController.prototype = {
|
||||||
* a places result node.
|
* a places result node.
|
||||||
* @return the mozILivemarkInfo object for aNode, if set, null otherwise.
|
* @return the mozILivemarkInfo object for aNode, if set, null otherwise.
|
||||||
*/
|
*/
|
||||||
getCachedLivemarkInfo: function (aNode)
|
getCachedLivemarkInfo: function(aNode)
|
||||||
this._cachedLivemarkInfoObjects.get(aNode, null)
|
this._cachedLivemarkInfoObjects.get(aNode, null)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1618,7 +1618,7 @@ var PlacesControllerDragHelper = {
|
||||||
* @returns true if the user is dragging over a node within the hierarchy of
|
* @returns true if the user is dragging over a node within the hierarchy of
|
||||||
* the container, false otherwise.
|
* the container, false otherwise.
|
||||||
*/
|
*/
|
||||||
draggingOverChildNode: function (node) {
|
draggingOverChildNode: function(node) {
|
||||||
let currentNode = this.currentDropTarget;
|
let currentNode = this.currentDropTarget;
|
||||||
while (currentNode) {
|
while (currentNode) {
|
||||||
if (currentNode == node)
|
if (currentNode == node)
|
||||||
|
|
@ -1631,7 +1631,7 @@ var PlacesControllerDragHelper = {
|
||||||
/**
|
/**
|
||||||
* @returns The current active drag session. Returns null if there is none.
|
* @returns The current active drag session. Returns null if there is none.
|
||||||
*/
|
*/
|
||||||
getSession: function () {
|
getSession: function() {
|
||||||
return this.dragService.getCurrentSession();
|
return this.dragService.getCurrentSession();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1640,7 +1640,7 @@ var PlacesControllerDragHelper = {
|
||||||
* @param aFlavors
|
* @param aFlavors
|
||||||
* The flavors list of type nsIDOMDOMStringList.
|
* The flavors list of type nsIDOMDOMStringList.
|
||||||
*/
|
*/
|
||||||
getFirstValidFlavor: function (aFlavors) {
|
getFirstValidFlavor: function(aFlavors) {
|
||||||
for (let i = 0; i < aFlavors.length; i++) {
|
for (let i = 0; i < aFlavors.length; i++) {
|
||||||
if (this.GENERIC_VIEW_DROP_TYPES.indexOf(aFlavors[i]) != -1)
|
if (this.GENERIC_VIEW_DROP_TYPES.indexOf(aFlavors[i]) != -1)
|
||||||
return aFlavors[i];
|
return aFlavors[i];
|
||||||
|
|
@ -1662,7 +1662,7 @@ var PlacesControllerDragHelper = {
|
||||||
* @param ip
|
* @param ip
|
||||||
* The insertion point where the items should be dropped.
|
* The insertion point where the items should be dropped.
|
||||||
*/
|
*/
|
||||||
canDrop: function (ip, dt) {
|
canDrop: function(ip, dt) {
|
||||||
let dropCount = dt.mozItemCount;
|
let dropCount = dt.mozItemCount;
|
||||||
|
|
||||||
// Check every dragged item.
|
// Check every dragged item.
|
||||||
|
|
@ -1724,7 +1724,7 @@ var PlacesControllerDragHelper = {
|
||||||
* @returns True if the node can be moved, false otherwise.
|
* @returns True if the node can be moved, false otherwise.
|
||||||
*/
|
*/
|
||||||
canMoveNode:
|
canMoveNode:
|
||||||
function (aNode) {
|
function(aNode) {
|
||||||
// Only bookmark items are movable.
|
// Only bookmark items are movable.
|
||||||
if (aNode.itemId == -1)
|
if (aNode.itemId == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1743,7 +1743,7 @@ var PlacesControllerDragHelper = {
|
||||||
* @param insertionPoint
|
* @param insertionPoint
|
||||||
* The insertion point where the items should be dropped
|
* The insertion point where the items should be dropped
|
||||||
*/
|
*/
|
||||||
onDrop: function (insertionPoint, dt) {
|
onDrop: function(insertionPoint, dt) {
|
||||||
let doCopy = ["copy", "link"].indexOf(dt.dropEffect) != -1;
|
let doCopy = ["copy", "link"].indexOf(dt.dropEffect) != -1;
|
||||||
|
|
||||||
let transactions = [];
|
let transactions = [];
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ var gEditItemOverlay = {
|
||||||
/**
|
/**
|
||||||
* Determines the initial data for the item edited or added by this dialog
|
* Determines the initial data for the item edited or added by this dialog
|
||||||
*/
|
*/
|
||||||
_determineInfo: function (aInfo) {
|
_determineInfo: function(aInfo) {
|
||||||
// hidden rows
|
// hidden rows
|
||||||
if (aInfo && aInfo.hiddenRows)
|
if (aInfo && aInfo.hiddenRows)
|
||||||
this._hiddenRows = aInfo.hiddenRows;
|
this._hiddenRows = aInfo.hiddenRows;
|
||||||
|
|
@ -55,7 +55,7 @@ var gEditItemOverlay = {
|
||||||
this._onPanelReady = aInfo && aInfo.onPanelReady;
|
this._onPanelReady = aInfo && aInfo.onPanelReady;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showHideRows: function () {
|
_showHideRows: function() {
|
||||||
var isBookmark = this._itemId != -1 &&
|
var isBookmark = this._itemId != -1 &&
|
||||||
this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK;
|
this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK;
|
||||||
var isQuery = false;
|
var isQuery = false;
|
||||||
|
|
@ -102,7 +102,7 @@ var gEditItemOverlay = {
|
||||||
* * forceReadOnly - set this flag to initialize the panel to its
|
* * forceReadOnly - set this flag to initialize the panel to its
|
||||||
* read-only (view) mode even if the given item is editable.
|
* read-only (view) mode even if the given item is editable.
|
||||||
*/
|
*/
|
||||||
initPanel: function (aFor, aInfo) {
|
initPanel: function(aFor, aInfo) {
|
||||||
// For sanity ensure that the implementer has uninited the panel before
|
// For sanity ensure that the implementer has uninited the panel before
|
||||||
// trying to init it again, or we could end up leaking due to observers.
|
// trying to init it again, or we could end up leaking due to observers.
|
||||||
if (this._initialized)
|
if (this._initialized)
|
||||||
|
|
@ -241,8 +241,8 @@ var gEditItemOverlay = {
|
||||||
*/
|
*/
|
||||||
_getCommonTags: function() {
|
_getCommonTags: function() {
|
||||||
return this._tags[0].filter(
|
return this._tags[0].filter(
|
||||||
function (aTag) this._tags.every(
|
function(aTag) this._tags.every(
|
||||||
function (aTags) aTags.indexOf(aTag) != -1
|
function(aTags) aTags.indexOf(aTag) != -1
|
||||||
), this
|
), this
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -266,7 +266,7 @@ var gEditItemOverlay = {
|
||||||
* @return the new menu item.
|
* @return the new menu item.
|
||||||
*/
|
*/
|
||||||
_appendFolderItemToMenupopup:
|
_appendFolderItemToMenupopup:
|
||||||
function (aMenupopup, aFolderId) {
|
function(aMenupopup, aFolderId) {
|
||||||
// First make sure the folders-separator is visible
|
// First make sure the folders-separator is visible
|
||||||
this._element("foldersSeparator").hidden = false;
|
this._element("foldersSeparator").hidden = false;
|
||||||
|
|
||||||
|
|
@ -279,7 +279,7 @@ var gEditItemOverlay = {
|
||||||
return folderMenuItem;
|
return folderMenuItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initFolderMenuList: function (aSelectedFolder) {
|
_initFolderMenuList: function(aSelectedFolder) {
|
||||||
// clean up first
|
// clean up first
|
||||||
var menupopup = this._folderMenuList.menupopup;
|
var menupopup = this._folderMenuList.menupopup;
|
||||||
while (menupopup.childNodes.length > 6)
|
while (menupopup.childNodes.length > 6)
|
||||||
|
|
@ -345,7 +345,7 @@ var gEditItemOverlay = {
|
||||||
this._folderMenuList.disabled = this._readOnly;
|
this._folderMenuList.disabled = this._readOnly;
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function(aIID) {
|
||||||
if (aIID.equals(Ci.nsIDOMEventListener) ||
|
if (aIID.equals(Ci.nsIDOMEventListener) ||
|
||||||
aIID.equals(Ci.nsINavBookmarkObserver) ||
|
aIID.equals(Ci.nsINavBookmarkObserver) ||
|
||||||
aIID.equals(Ci.nsISupports))
|
aIID.equals(Ci.nsISupports))
|
||||||
|
|
@ -354,11 +354,11 @@ var gEditItemOverlay = {
|
||||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_element: function (aID) {
|
_element: function(aID) {
|
||||||
return document.getElementById("editBMPanel_" + aID);
|
return document.getElementById("editBMPanel_" + aID);
|
||||||
},
|
},
|
||||||
|
|
||||||
_editorTransactionManagerClear: function (aItem) {
|
_editorTransactionManagerClear: function(aItem) {
|
||||||
// Clear the editor's undo stack
|
// Clear the editor's undo stack
|
||||||
let transactionManager;
|
let transactionManager;
|
||||||
try {
|
try {
|
||||||
|
|
@ -378,7 +378,7 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getItemStaticTitle: function () {
|
_getItemStaticTitle: function() {
|
||||||
if (this._titleOverride)
|
if (this._titleOverride)
|
||||||
return this._titleOverride;
|
return this._titleOverride;
|
||||||
|
|
||||||
|
|
@ -392,14 +392,14 @@ var gEditItemOverlay = {
|
||||||
return title;
|
return title;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initNamePicker: function () {
|
_initNamePicker: function() {
|
||||||
var namePicker = this._element("namePicker");
|
var namePicker = this._element("namePicker");
|
||||||
namePicker.value = this._getItemStaticTitle();
|
namePicker.value = this._getItemStaticTitle();
|
||||||
namePicker.readOnly = this._readOnly;
|
namePicker.readOnly = this._readOnly;
|
||||||
this._editorTransactionManagerClear(namePicker);
|
this._editorTransactionManagerClear(namePicker);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninitPanel: function (aHideCollapsibleElements) {
|
uninitPanel: function(aHideCollapsibleElements) {
|
||||||
if (aHideCollapsibleElements) {
|
if (aHideCollapsibleElements) {
|
||||||
// hide the folder tree if it was previously visible
|
// hide the folder tree if it was previously visible
|
||||||
var folderTreeRow = this._element("folderTreeRow");
|
var folderTreeRow = this._element("folderTreeRow");
|
||||||
|
|
@ -438,18 +438,18 @@ var gEditItemOverlay = {
|
||||||
this._readOnly = false;
|
this._readOnly = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
onTagsFieldBlur: function () {
|
onTagsFieldBlur: function() {
|
||||||
if (this._updateTags()) // if anything has changed
|
if (this._updateTags()) // if anything has changed
|
||||||
this._mayUpdateFirstEditField("tagsField");
|
this._mayUpdateFirstEditField("tagsField");
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTags: function () {
|
_updateTags: function() {
|
||||||
if (this._multiEdit)
|
if (this._multiEdit)
|
||||||
return this._updateMultipleTagsForItems();
|
return this._updateMultipleTagsForItems();
|
||||||
return this._updateSingleTagForItem();
|
return this._updateSingleTagForItem();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSingleTagForItem: function () {
|
_updateSingleTagForItem: function() {
|
||||||
var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri);
|
var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri);
|
||||||
var tags = this._getTagsArrayFromTagField();
|
var tags = this._getTagsArrayFromTagField();
|
||||||
if (tags.length > 0 || currentTags.length > 0) {
|
if (tags.length > 0 || currentTags.length > 0) {
|
||||||
|
|
@ -494,7 +494,7 @@ var gEditItemOverlay = {
|
||||||
* the id of the field that may be set (without the "editBMPanel_"
|
* the id of the field that may be set (without the "editBMPanel_"
|
||||||
* prefix)
|
* prefix)
|
||||||
*/
|
*/
|
||||||
_mayUpdateFirstEditField: function (aNewField) {
|
_mayUpdateFirstEditField: function(aNewField) {
|
||||||
// * The first-edit-field behavior is not applied in the multi-edit case
|
// * The first-edit-field behavior is not applied in the multi-edit case
|
||||||
// * if this._firstEditedField is already set, this is not the first field,
|
// * if this._firstEditedField is already set, this is not the first field,
|
||||||
// so there's nothing to do
|
// so there's nothing to do
|
||||||
|
|
@ -509,7 +509,7 @@ var gEditItemOverlay = {
|
||||||
prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField);
|
prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMultipleTagsForItems: function () {
|
_updateMultipleTagsForItems: function() {
|
||||||
var tags = this._getTagsArrayFromTagField();
|
var tags = this._getTagsArrayFromTagField();
|
||||||
if (tags.length > 0 || this._allTags.length > 0) {
|
if (tags.length > 0 || this._allTags.length > 0) {
|
||||||
var tagsToRemove = [];
|
var tagsToRemove = [];
|
||||||
|
|
@ -562,7 +562,7 @@ var gEditItemOverlay = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
onNamePickerBlur: function () {
|
onNamePickerBlur: function() {
|
||||||
if (this._itemId == -1)
|
if (this._itemId == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -582,7 +582,7 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDescriptionFieldBlur: function () {
|
onDescriptionFieldBlur: function() {
|
||||||
var description = this._element("descriptionField").value;
|
var description = this._element("descriptionField").value;
|
||||||
if (description != PlacesUIUtils.getItemDescription(this._itemId)) {
|
if (description != PlacesUIUtils.getItemDescription(this._itemId)) {
|
||||||
var annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO,
|
var annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO,
|
||||||
|
|
@ -595,7 +595,7 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLocationFieldBlur: function () {
|
onLocationFieldBlur: function() {
|
||||||
var uri;
|
var uri;
|
||||||
try {
|
try {
|
||||||
uri = PlacesUIUtils.createFixedURI(this._element("locationField").value);
|
uri = PlacesUIUtils.createFixedURI(this._element("locationField").value);
|
||||||
|
|
@ -609,7 +609,7 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeywordFieldBlur: function () {
|
onKeywordFieldBlur: function() {
|
||||||
let oldKeyword = this._keyword;
|
let oldKeyword = this._keyword;
|
||||||
let keyword = this._keyword = this._element("keywordField").value;
|
let keyword = this._keyword = this._element("keywordField").value;
|
||||||
if (keyword != oldKeyword) {
|
if (keyword != oldKeyword) {
|
||||||
|
|
@ -622,7 +622,7 @@ var gEditItemOverlay = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoadInSidebarCheckboxCommand:
|
onLoadInSidebarCheckboxCommand:
|
||||||
function () {
|
function() {
|
||||||
let annoObj = { name : PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO };
|
let annoObj = { name : PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO };
|
||||||
if (this._element("loadInSidebarCheckbox").checked)
|
if (this._element("loadInSidebarCheckbox").checked)
|
||||||
annoObj.value = true;
|
annoObj.value = true;
|
||||||
|
|
@ -630,7 +630,7 @@ var gEditItemOverlay = {
|
||||||
PlacesUtils.transactionManager.doTransaction(txn);
|
PlacesUtils.transactionManager.doTransaction(txn);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleFolderTreeVisibility: function () {
|
toggleFolderTreeVisibility: function() {
|
||||||
var expander = this._element("foldersExpander");
|
var expander = this._element("foldersExpander");
|
||||||
var folderTreeRow = this._element("folderTreeRow");
|
var folderTreeRow = this._element("folderTreeRow");
|
||||||
if (!folderTreeRow.collapsed) {
|
if (!folderTreeRow.collapsed) {
|
||||||
|
|
@ -664,7 +664,7 @@ var gEditItemOverlay = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_getFolderIdFromMenuList:
|
_getFolderIdFromMenuList:
|
||||||
function () {
|
function() {
|
||||||
var selectedItem = this._folderMenuList.selectedItem;
|
var selectedItem = this._folderMenuList.selectedItem;
|
||||||
NS_ASSERT("folderId" in selectedItem,
|
NS_ASSERT("folderId" in selectedItem,
|
||||||
"Invalid menuitem in the folders-menulist");
|
"Invalid menuitem in the folders-menulist");
|
||||||
|
|
@ -680,7 +680,7 @@ var gEditItemOverlay = {
|
||||||
* The identifier of the bookmarks folder.
|
* The identifier of the bookmarks folder.
|
||||||
*/
|
*/
|
||||||
_getFolderMenuItem:
|
_getFolderMenuItem:
|
||||||
function (aFolderId) {
|
function(aFolderId) {
|
||||||
var menupopup = this._folderMenuList.menupopup;
|
var menupopup = this._folderMenuList.menupopup;
|
||||||
|
|
||||||
for (let i = 0; i < menupopup.childNodes.length; i++) {
|
for (let i = 0; i < menupopup.childNodes.length; i++) {
|
||||||
|
|
@ -696,7 +696,7 @@ var gEditItemOverlay = {
|
||||||
return this._appendFolderItemToMenupopup(menupopup, aFolderId);
|
return this._appendFolderItemToMenupopup(menupopup, aFolderId);
|
||||||
},
|
},
|
||||||
|
|
||||||
onFolderMenuListCommand: function (aEvent) {
|
onFolderMenuListCommand: function(aEvent) {
|
||||||
// Set a selectedIndex attribute to show special icons
|
// Set a selectedIndex attribute to show special icons
|
||||||
this._folderMenuList.setAttribute("selectedIndex",
|
this._folderMenuList.setAttribute("selectedIndex",
|
||||||
this._folderMenuList.selectedIndex);
|
this._folderMenuList.selectedIndex);
|
||||||
|
|
@ -739,7 +739,7 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onFolderTreeSelect: function () {
|
onFolderTreeSelect: function() {
|
||||||
var selectedNode = this._folderTree.selectedNode;
|
var selectedNode = this._folderTree.selectedNode;
|
||||||
|
|
||||||
// Disable the "New Folder" button if we cannot create a new folder
|
// Disable the "New Folder" button if we cannot create a new folder
|
||||||
|
|
@ -759,7 +759,7 @@ var gEditItemOverlay = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_markFolderAsRecentlyUsed:
|
_markFolderAsRecentlyUsed:
|
||||||
function (aFolderId) {
|
function(aFolderId) {
|
||||||
var txns = [];
|
var txns = [];
|
||||||
|
|
||||||
// Expire old unused recent folders
|
// Expire old unused recent folders
|
||||||
|
|
@ -789,7 +789,7 @@ var gEditItemOverlay = {
|
||||||
* with the transaction manager.
|
* with the transaction manager.
|
||||||
*/
|
*/
|
||||||
_getLastUsedAnnotationObject:
|
_getLastUsedAnnotationObject:
|
||||||
function (aLastUsed) {
|
function(aLastUsed) {
|
||||||
var anno = { name: LAST_USED_ANNO,
|
var anno = { name: LAST_USED_ANNO,
|
||||||
type: Ci.nsIAnnotationService.TYPE_INT32,
|
type: Ci.nsIAnnotationService.TYPE_INT32,
|
||||||
flags: 0,
|
flags: 0,
|
||||||
|
|
@ -799,7 +799,7 @@ var gEditItemOverlay = {
|
||||||
return anno;
|
return anno;
|
||||||
},
|
},
|
||||||
|
|
||||||
_rebuildTagsSelectorList: function () {
|
_rebuildTagsSelectorList: function() {
|
||||||
var tagsSelector = this._element("tagsSelector");
|
var tagsSelector = this._element("tagsSelector");
|
||||||
var tagsSelectorRow = this._element("tagsSelectorRow");
|
var tagsSelectorRow = this._element("tagsSelectorRow");
|
||||||
if (tagsSelectorRow.collapsed)
|
if (tagsSelectorRow.collapsed)
|
||||||
|
|
@ -842,7 +842,7 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleTagsSelector: function () {
|
toggleTagsSelector: function() {
|
||||||
var tagsSelector = this._element("tagsSelector");
|
var tagsSelector = this._element("tagsSelector");
|
||||||
var tagsSelectorRow = this._element("tagsSelectorRow");
|
var tagsSelectorRow = this._element("tagsSelectorRow");
|
||||||
var expander = this._element("tagsSelectorExpander");
|
var expander = this._element("tagsSelectorExpander");
|
||||||
|
|
@ -869,14 +869,14 @@ var gEditItemOverlay = {
|
||||||
*
|
*
|
||||||
* @return Array of tag strings found in the field value.
|
* @return Array of tag strings found in the field value.
|
||||||
*/
|
*/
|
||||||
_getTagsArrayFromTagField: function () {
|
_getTagsArrayFromTagField: function() {
|
||||||
let tags = this._element("tagsField").value;
|
let tags = this._element("tagsField").value;
|
||||||
return tags.trim()
|
return tags.trim()
|
||||||
.split(/\s*,\s*/) // Split on commas and remove spaces.
|
.split(/\s*,\s*/) // Split on commas and remove spaces.
|
||||||
.filter(function (tag) tag.length > 0); // Kill empty tags.
|
.filter(function(tag) tag.length > 0); // Kill empty tags.
|
||||||
},
|
},
|
||||||
|
|
||||||
newFolder: function () {
|
newFolder: function() {
|
||||||
var ip = this._folderTree.insertionPoint;
|
var ip = this._folderTree.insertionPoint;
|
||||||
|
|
||||||
// default to the bookmarks menu folder
|
// default to the bookmarks menu folder
|
||||||
|
|
@ -897,7 +897,7 @@ var gEditItemOverlay = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "CheckboxStateChange":
|
case "CheckboxStateChange":
|
||||||
// Update the tags field when items are checked/unchecked in the listbox
|
// Update the tags field when items are checked/unchecked in the listbox
|
||||||
|
|
@ -927,7 +927,7 @@ var gEditItemOverlay = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsINavBookmarkObserver
|
// nsINavBookmarkObserver
|
||||||
onItemChanged: function (aItemId, aProperty,
|
onItemChanged: function(aItemId, aProperty,
|
||||||
aIsAnnotationProperty, aValue,
|
aIsAnnotationProperty, aValue,
|
||||||
aLastModified, aItemType) {
|
aLastModified, aItemType) {
|
||||||
if (aProperty == "tags") {
|
if (aProperty == "tags") {
|
||||||
|
|
@ -940,7 +940,7 @@ var gEditItemOverlay = {
|
||||||
// Check if the changed uri is part of the modified ones.
|
// Check if the changed uri is part of the modified ones.
|
||||||
let changedURI = PlacesUtils.bookmarks.getBookmarkURI(aItemId);
|
let changedURI = PlacesUtils.bookmarks.getBookmarkURI(aItemId);
|
||||||
let uris = this._multiEdit ? this._uris : [this._uri];
|
let uris = this._multiEdit ? this._uris : [this._uri];
|
||||||
uris.forEach(function (aURI, aIndex) {
|
uris.forEach(function(aURI, aIndex) {
|
||||||
if (aURI.equals(changedURI)) {
|
if (aURI.equals(changedURI)) {
|
||||||
shouldUpdateTagsField = true;
|
shouldUpdateTagsField = true;
|
||||||
if (this._multiEdit) {
|
if (this._multiEdit) {
|
||||||
|
|
@ -1038,7 +1038,7 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved: function (aItemId, aOldParent, aOldIndex,
|
onItemMoved: function(aItemId, aOldParent, aOldIndex,
|
||||||
aNewParent, aNewIndex, aItemType) {
|
aNewParent, aNewIndex, aItemType) {
|
||||||
if (aItemId != this._itemId ||
|
if (aItemId != this._itemId ||
|
||||||
aNewParent == this._getFolderIdFromMenuList())
|
aNewParent == this._getFolderIdFromMenuList())
|
||||||
|
|
@ -1051,7 +1051,7 @@ var gEditItemOverlay = {
|
||||||
this._folderMenuList.selectedItem = folderItem;
|
this._folderMenuList.selectedItem = folderItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemAdded: function (aItemId, aParentId, aIndex, aItemType,
|
onItemAdded: function(aItemId, aParentId, aIndex, aItemType,
|
||||||
aURI) {
|
aURI) {
|
||||||
this._lastNewItem = aItemId;
|
this._lastNewItem = aItemId;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ var gMoveBookmarksDialog = {
|
||||||
PlacesUIUtils.allBookmarksFolderId;
|
PlacesUIUtils.allBookmarksFolderId;
|
||||||
},
|
},
|
||||||
|
|
||||||
onOK: function (aEvent) {
|
onOK: function(aEvent) {
|
||||||
var selectedNode = this.foldersTree.selectedNode;
|
var selectedNode = this.foldersTree.selectedNode;
|
||||||
NS_ASSERT(selectedNode,
|
NS_ASSERT(selectedNode,
|
||||||
"selectedNode must be set in a single-selection tree with initial selection set");
|
"selectedNode must be set in a single-selection tree with initial selection set");
|
||||||
|
|
@ -46,7 +46,7 @@ var gMoveBookmarksDialog = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
newFolder: function () {
|
newFolder: function() {
|
||||||
// The command is disabled when the tree is not focused
|
// The command is disabled when the tree is not focused
|
||||||
this.foldersTree.focus();
|
this.foldersTree.focus();
|
||||||
goDoCommand("placesCmd_new:folder");
|
goDoCommand("placesCmd_new:folder");
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ var PlacesOrganizer = {
|
||||||
this._places.place = "place:excludeItems=1&expandQueries=0&folder=" + leftPaneRoot;
|
this._places.place = "place:excludeItems=1&expandQueries=0&folder=" + leftPaneRoot;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectLeftPaneQuery: function (aQueryName) {
|
selectLeftPaneQuery: function(aQueryName) {
|
||||||
var itemId = PlacesUIUtils.leftPaneQueries[aQueryName];
|
var itemId = PlacesUIUtils.leftPaneQueries[aQueryName];
|
||||||
this._places.selectItems([itemId]);
|
this._places.selectItems([itemId]);
|
||||||
// Forcefully expand all-bookmarks
|
// Forcefully expand all-bookmarks
|
||||||
|
|
@ -38,7 +38,7 @@ var PlacesOrganizer = {
|
||||||
PlacesUtils.asContainer(this._places.selectedNode).containerOpen = true;
|
PlacesUtils.asContainer(this._places.selectedNode).containerOpen = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
ContentArea.init();
|
ContentArea.init();
|
||||||
|
|
||||||
this._places = document.getElementById("placesList");
|
this._places = document.getElementById("placesList");
|
||||||
|
|
@ -91,7 +91,7 @@ var PlacesOrganizer = {
|
||||||
ContentArea.focus();
|
ContentArea.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function(aIID) {
|
||||||
if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
|
if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
|
||||||
aIID.equals(Components.interfaces.nsISupports))
|
aIID.equals(Components.interfaces.nsISupports))
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -99,7 +99,7 @@ var PlacesOrganizer = {
|
||||||
throw new Components.Exception("", Components.results.NS_NOINTERFACE);
|
throw new Components.Exception("", Components.results.NS_NOINTERFACE);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
if (aEvent.type != "AppCommand")
|
if (aEvent.type != "AppCommand")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ var PlacesOrganizer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
_location: null,
|
_location: null,
|
||||||
|
|
@ -161,13 +161,13 @@ var PlacesOrganizer = {
|
||||||
_backHistory: [],
|
_backHistory: [],
|
||||||
_forwardHistory: [],
|
_forwardHistory: [],
|
||||||
|
|
||||||
back: function () {
|
back: function() {
|
||||||
this._forwardHistory.unshift(this.location);
|
this._forwardHistory.unshift(this.location);
|
||||||
var historyEntry = this._backHistory.shift();
|
var historyEntry = this._backHistory.shift();
|
||||||
this._location = null;
|
this._location = null;
|
||||||
this.location = historyEntry;
|
this.location = historyEntry;
|
||||||
},
|
},
|
||||||
forward: function () {
|
forward: function() {
|
||||||
this._backHistory.unshift(this.location);
|
this._backHistory.unshift(this.location);
|
||||||
var historyEntry = this._forwardHistory.shift();
|
var historyEntry = this._forwardHistory.shift();
|
||||||
this._location = null;
|
this._location = null;
|
||||||
|
|
@ -185,7 +185,7 @@ var PlacesOrganizer = {
|
||||||
* deleting its text, this will be false.
|
* deleting its text, this will be false.
|
||||||
*/
|
*/
|
||||||
_cachedLeftPaneSelectedURI: null,
|
_cachedLeftPaneSelectedURI: null,
|
||||||
onPlaceSelected: function (resetSearchBox) {
|
onPlaceSelected: function(resetSearchBox) {
|
||||||
// Don't change the right-hand pane contents when there's no selection.
|
// Don't change the right-hand pane contents when there's no selection.
|
||||||
if (!this._places.hasSelection)
|
if (!this._places.hasSelection)
|
||||||
return;
|
return;
|
||||||
|
|
@ -243,7 +243,7 @@ var PlacesOrganizer = {
|
||||||
* @param aNode
|
* @param aNode
|
||||||
* the node to set up scope from
|
* the node to set up scope from
|
||||||
*/
|
*/
|
||||||
_setSearchScopeForNode: function (aNode) {
|
_setSearchScopeForNode: function(aNode) {
|
||||||
let itemId = aNode.itemId;
|
let itemId = aNode.itemId;
|
||||||
|
|
||||||
// Set default buttons status.
|
// Set default buttons status.
|
||||||
|
|
@ -279,7 +279,7 @@ var PlacesOrganizer = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The mouse event.
|
* The mouse event.
|
||||||
*/
|
*/
|
||||||
onPlacesListClick: function (aEvent) {
|
onPlacesListClick: function(aEvent) {
|
||||||
// Only handle clicks on tree children.
|
// Only handle clicks on tree children.
|
||||||
if (aEvent.target.localName != "treechildren")
|
if (aEvent.target.localName != "treechildren")
|
||||||
return;
|
return;
|
||||||
|
|
@ -299,7 +299,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Handle focus changes on the places list and the current content view.
|
* Handle focus changes on the places list and the current content view.
|
||||||
*/
|
*/
|
||||||
updateDetailsPane: function () {
|
updateDetailsPane: function() {
|
||||||
if (!ContentArea.currentViewOptions.showDetailsPane)
|
if (!ContentArea.currentViewOptions.showDetailsPane)
|
||||||
return;
|
return;
|
||||||
let view = PlacesUIUtils.getViewForNode(document.activeElement);
|
let view = PlacesUIUtils.getViewForNode(document.activeElement);
|
||||||
|
|
@ -310,7 +310,7 @@ var PlacesOrganizer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openFlatContainer: function (aContainer) {
|
openFlatContainer: function(aContainer) {
|
||||||
if (aContainer.itemId != -1)
|
if (aContainer.itemId != -1)
|
||||||
this._places.selectItems([aContainer.itemId]);
|
this._places.selectItems([aContainer.itemId]);
|
||||||
else if (PlacesUtils.nodeIsQuery(aContainer))
|
else if (PlacesUtils.nodeIsQuery(aContainer))
|
||||||
|
|
@ -321,7 +321,7 @@ var PlacesOrganizer = {
|
||||||
* Returns the options associated with the query currently loaded in the
|
* Returns the options associated with the query currently loaded in the
|
||||||
* main places pane.
|
* main places pane.
|
||||||
*/
|
*/
|
||||||
getCurrentOptions: function () {
|
getCurrentOptions: function() {
|
||||||
return PlacesUtils.asQuery(ContentArea.currentView.result.root).queryOptions;
|
return PlacesUtils.asQuery(ContentArea.currentView.result.root).queryOptions;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -329,14 +329,14 @@ var PlacesOrganizer = {
|
||||||
* Returns the queries associated with the query currently loaded in the
|
* Returns the queries associated with the query currently loaded in the
|
||||||
* main places pane.
|
* main places pane.
|
||||||
*/
|
*/
|
||||||
getCurrentQueries: function () {
|
getCurrentQueries: function() {
|
||||||
return PlacesUtils.asQuery(ContentArea.currentView.result.root).getQueries();
|
return PlacesUtils.asQuery(ContentArea.currentView.result.root).getQueries();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a file-picker and import the selected file into the bookmarks store
|
* Open a file-picker and import the selected file into the bookmarks store
|
||||||
*/
|
*/
|
||||||
importFromFile: function () {
|
importFromFile: function() {
|
||||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||||
let fpCallback = function fpCallback_done(aResult) {
|
let fpCallback = function fpCallback_done(aResult) {
|
||||||
if (aResult != Ci.nsIFilePicker.returnCancel && fp.fileURL) {
|
if (aResult != Ci.nsIFilePicker.returnCancel && fp.fileURL) {
|
||||||
|
|
@ -355,7 +355,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Allows simple exporting of bookmarks.
|
* Allows simple exporting of bookmarks.
|
||||||
*/
|
*/
|
||||||
exportBookmarks: function () {
|
exportBookmarks: function() {
|
||||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||||
let fpCallback = function fpCallback_done(aResult) {
|
let fpCallback = function fpCallback_done(aResult) {
|
||||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||||
|
|
@ -375,7 +375,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Populates the restore menu with the dates of the backups available.
|
* Populates the restore menu with the dates of the backups available.
|
||||||
*/
|
*/
|
||||||
populateRestoreMenu: function () {
|
populateRestoreMenu: function() {
|
||||||
let restorePopup = document.getElementById("fileRestorePopup");
|
let restorePopup = document.getElementById("fileRestorePopup");
|
||||||
|
|
||||||
let dateSvc = Cc["@mozilla.org/intl/scriptabledateformat;1"].
|
let dateSvc = Cc["@mozilla.org/intl/scriptabledateformat;1"].
|
||||||
|
|
@ -432,7 +432,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Called when a menuitem is selected from the restore menu.
|
* Called when a menuitem is selected from the restore menu.
|
||||||
*/
|
*/
|
||||||
onRestoreMenuItemClick: function (aMenuItem) {
|
onRestoreMenuItemClick: function(aMenuItem) {
|
||||||
Task.spawn(function() {
|
Task.spawn(function() {
|
||||||
let backupName = aMenuItem.getAttribute("value");
|
let backupName = aMenuItem.getAttribute("value");
|
||||||
let backupFilePaths = yield PlacesBackups.getBackupFiles();
|
let backupFilePaths = yield PlacesBackups.getBackupFiles();
|
||||||
|
|
@ -449,7 +449,7 @@ var PlacesOrganizer = {
|
||||||
* Called when 'Choose File...' is selected from the restore menu.
|
* Called when 'Choose File...' is selected from the restore menu.
|
||||||
* Prompts for a file and restores bookmarks to those in the file.
|
* Prompts for a file and restores bookmarks to those in the file.
|
||||||
*/
|
*/
|
||||||
onRestoreBookmarksFromFile: function () {
|
onRestoreBookmarksFromFile: function() {
|
||||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||||
getService(Ci.nsIProperties);
|
getService(Ci.nsIProperties);
|
||||||
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||||
|
|
@ -472,7 +472,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Restores bookmarks from a JSON file.
|
* Restores bookmarks from a JSON file.
|
||||||
*/
|
*/
|
||||||
restoreBookmarksFromFile: function (aFile) {
|
restoreBookmarksFromFile: function(aFile) {
|
||||||
// check file extension
|
// check file extension
|
||||||
let filePath = aFile.path;
|
let filePath = aFile.path;
|
||||||
if (!filePath.toLowerCase().endsWith("json") &&
|
if (!filePath.toLowerCase().endsWith("json") &&
|
||||||
|
|
@ -498,7 +498,7 @@ var PlacesOrganizer = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_showErrorAlert: function (aMsg) {
|
_showErrorAlert: function(aMsg) {
|
||||||
var brandShortName = document.getElementById("brandStrings").
|
var brandShortName = document.getElementById("brandStrings").
|
||||||
getString("brandShortName");
|
getString("brandShortName");
|
||||||
|
|
||||||
|
|
@ -512,7 +512,7 @@ var PlacesOrganizer = {
|
||||||
* The file is a JSON serialization of bookmarks, tags and any annotations
|
* The file is a JSON serialization of bookmarks, tags and any annotations
|
||||||
* of those items.
|
* of those items.
|
||||||
*/
|
*/
|
||||||
backupBookmarks: function () {
|
backupBookmarks: function() {
|
||||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||||
getService(Ci.nsIProperties);
|
getService(Ci.nsIProperties);
|
||||||
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||||
|
|
@ -534,7 +534,7 @@ var PlacesOrganizer = {
|
||||||
|
|
||||||
_paneDisabled: false,
|
_paneDisabled: false,
|
||||||
_setDetailsFieldsDisabledState:
|
_setDetailsFieldsDisabledState:
|
||||||
function (aDisabled) {
|
function(aDisabled) {
|
||||||
if (aDisabled) {
|
if (aDisabled) {
|
||||||
document.getElementById("paneElementsBroadcaster")
|
document.getElementById("paneElementsBroadcaster")
|
||||||
.setAttribute("disabled", "true");
|
.setAttribute("disabled", "true");
|
||||||
|
|
@ -546,7 +546,7 @@ var PlacesOrganizer = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_detectAndSetDetailsPaneMinimalState:
|
_detectAndSetDetailsPaneMinimalState:
|
||||||
function (aNode) {
|
function(aNode) {
|
||||||
/**
|
/**
|
||||||
* The details of simple folder-items (as opposed to livemarks) or the
|
* The details of simple folder-items (as opposed to livemarks) or the
|
||||||
* of livemark-children are not likely to fill the infoBox anyway,
|
* of livemark-children are not likely to fill the infoBox anyway,
|
||||||
|
|
@ -576,14 +576,14 @@ var PlacesOrganizer = {
|
||||||
infoBox.setAttribute("minimal", "true");
|
infoBox.setAttribute("minimal", "true");
|
||||||
infoBox.removeAttribute("wasminimal");
|
infoBox.removeAttribute("wasminimal");
|
||||||
infoBoxExpanderWrapper.hidden =
|
infoBoxExpanderWrapper.hidden =
|
||||||
this._additionalInfoFields.every(function (id)
|
this._additionalInfoFields.every(function(id)
|
||||||
document.getElementById(id).collapsed);
|
document.getElementById(id).collapsed);
|
||||||
}
|
}
|
||||||
additionalInfoBroadcaster.hidden = infoBox.getAttribute("minimal") == "true";
|
additionalInfoBroadcaster.hidden = infoBox.getAttribute("minimal") == "true";
|
||||||
},
|
},
|
||||||
|
|
||||||
// NOT YET USED
|
// NOT YET USED
|
||||||
updateThumbnailProportions: function () {
|
updateThumbnailProportions: function() {
|
||||||
var previewBox = document.getElementById("previewBox");
|
var previewBox = document.getElementById("previewBox");
|
||||||
var canvas = document.getElementById("itemThumbnail");
|
var canvas = document.getElementById("itemThumbnail");
|
||||||
var height = previewBox.boxObject.height;
|
var height = previewBox.boxObject.height;
|
||||||
|
|
@ -592,7 +592,7 @@ var PlacesOrganizer = {
|
||||||
canvas.height = height;
|
canvas.height = height;
|
||||||
},
|
},
|
||||||
|
|
||||||
_fillDetailsPane: function (aNodeList) {
|
_fillDetailsPane: function(aNodeList) {
|
||||||
var infoBox = document.getElementById("infoBox");
|
var infoBox = document.getElementById("infoBox");
|
||||||
var detailsDeck = document.getElementById("detailsDeck");
|
var detailsDeck = document.getElementById("detailsDeck");
|
||||||
|
|
||||||
|
|
@ -716,7 +716,7 @@ var PlacesOrganizer = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// NOT YET USED
|
// NOT YET USED
|
||||||
_updateThumbnail: function () {
|
_updateThumbnail: function() {
|
||||||
var bo = document.getElementById("previewBox").boxObject;
|
var bo = document.getElementById("previewBox").boxObject;
|
||||||
var width = bo.width;
|
var width = bo.width;
|
||||||
var height = bo.height;
|
var height = bo.height;
|
||||||
|
|
@ -737,7 +737,7 @@ var PlacesOrganizer = {
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleAdditionalInfoFields: function () {
|
toggleAdditionalInfoFields: function() {
|
||||||
var infoBox = document.getElementById("infoBox");
|
var infoBox = document.getElementById("infoBox");
|
||||||
var infoBoxExpander = document.getElementById("infoBoxExpander");
|
var infoBoxExpander = document.getElementById("infoBoxExpander");
|
||||||
var infoBoxExpanderLabel = document.getElementById("infoBoxExpanderLabel");
|
var infoBoxExpanderLabel = document.getElementById("infoBoxExpanderLabel");
|
||||||
|
|
@ -762,7 +762,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Save the current search (or advanced query) to the bookmarks root.
|
* Save the current search (or advanced query) to the bookmarks root.
|
||||||
*/
|
*/
|
||||||
saveSearch: function () {
|
saveSearch: function() {
|
||||||
// Get the place: uri for the query.
|
// Get the place: uri for the query.
|
||||||
// If the advanced query builder is showing, use that.
|
// If the advanced query builder is showing, use that.
|
||||||
var options = this.getCurrentOptions();
|
var options = this.getCurrentOptions();
|
||||||
|
|
@ -840,7 +840,7 @@ var PlacesSearchBox = {
|
||||||
* @param filterString
|
* @param filterString
|
||||||
* The text to search for.
|
* The text to search for.
|
||||||
*/
|
*/
|
||||||
search: function (filterString) {
|
search: function(filterString) {
|
||||||
var PO = PlacesOrganizer;
|
var PO = PlacesOrganizer;
|
||||||
// If the user empties the search box manually, reset it and load all
|
// If the user empties the search box manually, reset it and load all
|
||||||
// contents of the current scope.
|
// contents of the current scope.
|
||||||
|
|
@ -909,7 +909,7 @@ var PlacesSearchBox = {
|
||||||
/**
|
/**
|
||||||
* Finds across all history, downloads or all bookmarks.
|
* Finds across all history, downloads or all bookmarks.
|
||||||
*/
|
*/
|
||||||
findAll: function () {
|
findAll: function() {
|
||||||
switch (this.filterCollection) {
|
switch (this.filterCollection) {
|
||||||
case "history":
|
case "history":
|
||||||
PlacesQueryBuilder.setScope("history");
|
PlacesQueryBuilder.setScope("history");
|
||||||
|
|
@ -929,7 +929,7 @@ var PlacesSearchBox = {
|
||||||
* @param aTitle
|
* @param aTitle
|
||||||
* The title of the current collection.
|
* The title of the current collection.
|
||||||
*/
|
*/
|
||||||
updateCollectionTitle: function (aTitle) {
|
updateCollectionTitle: function(aTitle) {
|
||||||
let title = "";
|
let title = "";
|
||||||
// This is needed when a user performs a folder-specific search
|
// This is needed when a user performs a folder-specific search
|
||||||
// using the scope bar, removes the search-string, and unfocuses
|
// using the scope bar, removes the search-string, and unfocuses
|
||||||
|
|
@ -978,14 +978,14 @@ var PlacesSearchBox = {
|
||||||
/**
|
/**
|
||||||
* Focus the search box
|
* Focus the search box
|
||||||
*/
|
*/
|
||||||
focus: function () {
|
focus: function() {
|
||||||
this.searchFilter.focus();
|
this.searchFilter.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the gray text in the search bar as the Places View loads.
|
* Set up the gray text in the search bar as the Places View loads.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {
|
||||||
this.updateCollectionTitle();
|
this.updateCollectionTitle();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -999,13 +999,13 @@ var PlacesSearchBox = {
|
||||||
return this.searchFilter.value = value;
|
return this.searchFilter.value = value;
|
||||||
},
|
},
|
||||||
|
|
||||||
showSearchUI: function () {
|
showSearchUI: function() {
|
||||||
// Hide the advanced search controls when the user hasn't searched
|
// Hide the advanced search controls when the user hasn't searched
|
||||||
var searchModifiers = document.getElementById("searchModifiers");
|
var searchModifiers = document.getElementById("searchModifiers");
|
||||||
searchModifiers.hidden = false;
|
searchModifiers.hidden = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
hideSearchUI: function () {
|
hideSearchUI: function() {
|
||||||
var searchModifiers = document.getElementById("searchModifiers");
|
var searchModifiers = document.getElementById("searchModifiers");
|
||||||
searchModifiers.hidden = true;
|
searchModifiers.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1024,7 +1024,7 @@ var PlacesQueryBuilder = {
|
||||||
* @param aButton
|
* @param aButton
|
||||||
* the scope button that was selected
|
* the scope button that was selected
|
||||||
*/
|
*/
|
||||||
onScopeSelected: function (aButton) {
|
onScopeSelected: function(aButton) {
|
||||||
switch (aButton.id) {
|
switch (aButton.id) {
|
||||||
case "scopeBarHistory":
|
case "scopeBarHistory":
|
||||||
this.setScope("history");
|
this.setScope("history");
|
||||||
|
|
@ -1054,7 +1054,7 @@ var PlacesQueryBuilder = {
|
||||||
* The search scope: "bookmarks", "collection", "downloads" or
|
* The search scope: "bookmarks", "collection", "downloads" or
|
||||||
* "history".
|
* "history".
|
||||||
*/
|
*/
|
||||||
setScope: function (aScope) {
|
setScope: function(aScope) {
|
||||||
// Determine filterCollection, folders, and scopeButtonId based on aScope.
|
// Determine filterCollection, folders, and scopeButtonId based on aScope.
|
||||||
var filterCollection;
|
var filterCollection;
|
||||||
var folders = [];
|
var folders = [];
|
||||||
|
|
@ -1130,7 +1130,7 @@ var ViewMenu = {
|
||||||
* @returns The element for the caller to insert new items before,
|
* @returns The element for the caller to insert new items before,
|
||||||
* null if the caller should just append to the popup.
|
* null if the caller should just append to the popup.
|
||||||
*/
|
*/
|
||||||
_clean: function (popup, startID, endID) {
|
_clean: function(popup, startID, endID) {
|
||||||
if (endID)
|
if (endID)
|
||||||
NS_ASSERT(startID, "meaningless to have valid endID and null startID");
|
NS_ASSERT(startID, "meaningless to have valid endID and null startID");
|
||||||
if (startID) {
|
if (startID) {
|
||||||
|
|
@ -1179,7 +1179,7 @@ var ViewMenu = {
|
||||||
* If propertyPrefix is null, the column label is used as label and
|
* If propertyPrefix is null, the column label is used as label and
|
||||||
* no accesskey is assigned.
|
* no accesskey is assigned.
|
||||||
*/
|
*/
|
||||||
fillWithColumns: function (event, startID, endID, type, propertyPrefix) {
|
fillWithColumns: function(event, startID, endID, type, propertyPrefix) {
|
||||||
var popup = event.target;
|
var popup = event.target;
|
||||||
var pivot = this._clean(popup, startID, endID);
|
var pivot = this._clean(popup, startID, endID);
|
||||||
|
|
||||||
|
|
@ -1242,7 +1242,7 @@ var ViewMenu = {
|
||||||
/**
|
/**
|
||||||
* Set up the content of the view menu.
|
* Set up the content of the view menu.
|
||||||
*/
|
*/
|
||||||
populateSortMenu: function (event) {
|
populateSortMenu: function(event) {
|
||||||
this.fillWithColumns(event, "viewUnsorted", "directionSeparator", "radio", "view.sortBy.");
|
this.fillWithColumns(event, "viewUnsorted", "directionSeparator", "radio", "view.sortBy.");
|
||||||
|
|
||||||
var sortColumn = this._getSortColumn();
|
var sortColumn = this._getSortColumn();
|
||||||
|
|
@ -1273,7 +1273,7 @@ var ViewMenu = {
|
||||||
* @param element
|
* @param element
|
||||||
* The menuitem element for the column
|
* The menuitem element for the column
|
||||||
*/
|
*/
|
||||||
showHideColumn: function (element) {
|
showHideColumn: function(element) {
|
||||||
var column = element.column;
|
var column = element.column;
|
||||||
|
|
||||||
var splitter = column.nextSibling;
|
var splitter = column.nextSibling;
|
||||||
|
|
@ -1296,7 +1296,7 @@ var ViewMenu = {
|
||||||
* Gets the last column that was sorted.
|
* Gets the last column that was sorted.
|
||||||
* @returns the currently sorted column, null if there is no sorted column.
|
* @returns the currently sorted column, null if there is no sorted column.
|
||||||
*/
|
*/
|
||||||
_getSortColumn: function () {
|
_getSortColumn: function() {
|
||||||
var content = document.getElementById("placeContent");
|
var content = document.getElementById("placeContent");
|
||||||
var cols = content.columns;
|
var cols = content.columns;
|
||||||
for (var i = 0; i < cols.count; ++i) {
|
for (var i = 0; i < cols.count; ++i) {
|
||||||
|
|
@ -1319,7 +1319,7 @@ var ViewMenu = {
|
||||||
*
|
*
|
||||||
* If both aColumnID and aDirection are null, the view will be unsorted.
|
* If both aColumnID and aDirection are null, the view will be unsorted.
|
||||||
*/
|
*/
|
||||||
setSortColumn: function (aColumn, aDirection) {
|
setSortColumn: function(aColumn, aDirection) {
|
||||||
var result = document.getElementById("placeContent").result;
|
var result = document.getElementById("placeContent").result;
|
||||||
if (!aColumn && !aDirection) {
|
if (!aColumn && !aDirection) {
|
||||||
result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||||
|
|
@ -1380,7 +1380,7 @@ var ViewMenu = {
|
||||||
var ContentArea = {
|
var ContentArea = {
|
||||||
_specialViews: new Map(),
|
_specialViews: new Map(),
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
this._deck = document.getElementById("placesViewsDeck");
|
this._deck = document.getElementById("placesViewsDeck");
|
||||||
this._toolbar = document.getElementById("placesToolbar");
|
this._toolbar = document.getElementById("placesToolbar");
|
||||||
ContentTree.init();
|
ContentTree.init();
|
||||||
|
|
@ -1397,7 +1397,7 @@ var ContentArea = {
|
||||||
* @return the view to be used for loading aQueryString.
|
* @return the view to be used for loading aQueryString.
|
||||||
*/
|
*/
|
||||||
getContentViewForQueryString:
|
getContentViewForQueryString:
|
||||||
function (aQueryString) {
|
function(aQueryString) {
|
||||||
try {
|
try {
|
||||||
if (this._specialViews.has(aQueryString)) {
|
if (this._specialViews.has(aQueryString)) {
|
||||||
let { view, options } = this._specialViews.get(aQueryString);
|
let { view, options } = this._specialViews.get(aQueryString);
|
||||||
|
|
@ -1427,7 +1427,7 @@ var ContentArea = {
|
||||||
* @see ContentTree.viewOptions for supported options and default values.
|
* @see ContentTree.viewOptions for supported options and default values.
|
||||||
*/
|
*/
|
||||||
setContentViewForQueryString:
|
setContentViewForQueryString:
|
||||||
function (aQueryString, aView, aOptions) {
|
function(aQueryString, aView, aOptions) {
|
||||||
if (!aQueryString ||
|
if (!aQueryString ||
|
||||||
typeof aView != "object" && typeof aView != "function")
|
typeof aView != "object" && typeof aView != "function")
|
||||||
throw new Components.Exception("Invalid arguments",
|
throw new Components.Exception("Invalid arguments",
|
||||||
|
|
@ -1468,7 +1468,7 @@ var ContentArea = {
|
||||||
/**
|
/**
|
||||||
* Applies view options.
|
* Applies view options.
|
||||||
*/
|
*/
|
||||||
_setupView: function () {
|
_setupView: function() {
|
||||||
let options = this.currentViewOptions;
|
let options = this.currentViewOptions;
|
||||||
|
|
||||||
// showDetailsPane.
|
// showDetailsPane.
|
||||||
|
|
@ -1512,7 +1512,7 @@ var ContentArea = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var ContentTree = {
|
var ContentTree = {
|
||||||
init: function () {
|
init: function() {
|
||||||
this._view = document.getElementById("placeContent");
|
this._view = document.getElementById("placeContent");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1523,12 +1523,12 @@ var ContentTree = {
|
||||||
toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter"
|
toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
openSelectedNode: function (aEvent) {
|
openSelectedNode: function(aEvent) {
|
||||||
let view = this.view;
|
let view = this.view;
|
||||||
PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view);
|
PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view);
|
||||||
},
|
},
|
||||||
|
|
||||||
onClick: function (aEvent) {
|
onClick: function(aEvent) {
|
||||||
let node = this.view.selectedNode;
|
let node = this.view.selectedNode;
|
||||||
if (node) {
|
if (node) {
|
||||||
let doubleClick = aEvent.button == 0 && aEvent.detail == 2;
|
let doubleClick = aEvent.button == 0 && aEvent.detail == 2;
|
||||||
|
|
@ -1546,7 +1546,7 @@ var ContentTree = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyPress: function (aEvent) {
|
onKeyPress: function(aEvent) {
|
||||||
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
||||||
this.openSelectedNode(aEvent);
|
this.openSelectedNode(aEvent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
var SidebarUtils = {
|
var SidebarUtils = {
|
||||||
handleTreeClick: function (aTree, aEvent, aGutterSelect) {
|
handleTreeClick: function(aTree, aEvent, aGutterSelect) {
|
||||||
// right-clicks are not handled here
|
// right-clicks are not handled here
|
||||||
if (aEvent.button == 2)
|
if (aEvent.button == 2)
|
||||||
return;
|
return;
|
||||||
|
|
@ -61,7 +61,7 @@ var SidebarUtils = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleTreeKeyPress: function (aEvent) {
|
handleTreeKeyPress: function(aEvent) {
|
||||||
// XXX Bug 627901: Post Fx4, this method should take a tree parameter.
|
// XXX Bug 627901: Post Fx4, this method should take a tree parameter.
|
||||||
let tree = aEvent.target;
|
let tree = aEvent.target;
|
||||||
let node = tree.selectedNode;
|
let node = tree.selectedNode;
|
||||||
|
|
@ -75,7 +75,7 @@ var SidebarUtils = {
|
||||||
* The following function displays the URL of a node that is being
|
* The following function displays the URL of a node that is being
|
||||||
* hovered over.
|
* hovered over.
|
||||||
*/
|
*/
|
||||||
handleTreeMouseMove: function (aEvent) {
|
handleTreeMouseMove: function(aEvent) {
|
||||||
if (aEvent.target.localName != "treechildren")
|
if (aEvent.target.localName != "treechildren")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ var SidebarUtils = {
|
||||||
this.setMouseoverURL("");
|
this.setMouseoverURL("");
|
||||||
},
|
},
|
||||||
|
|
||||||
setMouseoverURL: function (aURL) {
|
setMouseoverURL: function(aURL) {
|
||||||
// When the browser window is closed with an open sidebar, the sidebar
|
// When the browser window is closed with an open sidebar, the sidebar
|
||||||
// unload event happens after the browser's one. In this case
|
// unload event happens after the browser's one. In this case
|
||||||
// top.XULBrowserWindow has been nullified already.
|
// top.XULBrowserWindow has been nullified already.
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ PlacesTreeView.prototype = {
|
||||||
/**
|
/**
|
||||||
* This is called once both the result and the tree are set.
|
* This is called once both the result and the tree are set.
|
||||||
*/
|
*/
|
||||||
_finishInit: function () {
|
_finishInit: function() {
|
||||||
let selection = this.selection;
|
let selection = this.selection;
|
||||||
if (selection)
|
if (selection)
|
||||||
selection.selectEventsSuppressed = true;
|
selection.selectEventsSuppressed = true;
|
||||||
|
|
@ -88,7 +88,7 @@ PlacesTreeView.prototype = {
|
||||||
*
|
*
|
||||||
* @return true if aContainer is a plain container, false otherwise.
|
* @return true if aContainer is a plain container, false otherwise.
|
||||||
*/
|
*/
|
||||||
_isPlainContainer: function (aContainer) {
|
_isPlainContainer: function(aContainer) {
|
||||||
// Livemarks are always plain containers.
|
// Livemarks are always plain containers.
|
||||||
if (this._controller.hasCachedLivemarkInfo(aContainer))
|
if (this._controller.hasCachedLivemarkInfo(aContainer))
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -137,7 +137,7 @@ PlacesTreeView.prototype = {
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
_getRowForNode:
|
_getRowForNode:
|
||||||
function (aNode, aForceBuild, aParentRow, aNodeIndex) {
|
function(aNode, aForceBuild, aParentRow, aNodeIndex) {
|
||||||
if (aNode == this._rootNode)
|
if (aNode == this._rootNode)
|
||||||
throw new Error("The root node is never visible");
|
throw new Error("The root node is never visible");
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ PlacesTreeView.prototype = {
|
||||||
* Row number.
|
* Row number.
|
||||||
* @return [parentNode, parentRow]
|
* @return [parentNode, parentRow]
|
||||||
*/
|
*/
|
||||||
_getParentByChildRow: function (aChildRow) {
|
_getParentByChildRow: function(aChildRow) {
|
||||||
let node = this._getNodeForRow(aChildRow);
|
let node = this._getNodeForRow(aChildRow);
|
||||||
let parent = (node === null) ? this._rootNode : node.parent;
|
let parent = (node === null) ? this._rootNode : node.parent;
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ PlacesTreeView.prototype = {
|
||||||
/**
|
/**
|
||||||
* Gets the node at a given row.
|
* Gets the node at a given row.
|
||||||
*/
|
*/
|
||||||
_getNodeForRow: function (aRow) {
|
_getNodeForRow: function(aRow) {
|
||||||
if (aRow < 0) {
|
if (aRow < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -267,7 +267,7 @@ PlacesTreeView.prototype = {
|
||||||
* @return the number of rows which were inserted.
|
* @return the number of rows which were inserted.
|
||||||
*/
|
*/
|
||||||
_buildVisibleSection:
|
_buildVisibleSection:
|
||||||
function (aContainer, aFirstChildRow, aToOpen)
|
function(aContainer, aFirstChildRow, aToOpen)
|
||||||
{
|
{
|
||||||
// There's nothing to do if the container is closed.
|
// There's nothing to do if the container is closed.
|
||||||
if (!aContainer.containerOpen)
|
if (!aContainer.containerOpen)
|
||||||
|
|
@ -333,7 +333,7 @@ PlacesTreeView.prototype = {
|
||||||
* will count the node itself plus any child node following it.
|
* will count the node itself plus any child node following it.
|
||||||
*/
|
*/
|
||||||
_countVisibleRowsForNodeAtRow:
|
_countVisibleRowsForNodeAtRow:
|
||||||
function (aNodeRow) {
|
function(aNodeRow) {
|
||||||
let node = this._rows[aNodeRow];
|
let node = this._rows[aNodeRow];
|
||||||
|
|
||||||
// If it's not listed yet, we know that it's a leaf node (instanceof also
|
// If it's not listed yet, we know that it's a leaf node (instanceof also
|
||||||
|
|
@ -353,7 +353,7 @@ PlacesTreeView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSelectedNodesInRange:
|
_getSelectedNodesInRange:
|
||||||
function (aFirstRow, aLastRow) {
|
function(aFirstRow, aLastRow) {
|
||||||
let selection = this.selection;
|
let selection = this.selection;
|
||||||
let rc = selection.getRangeCount();
|
let rc = selection.getRangeCount();
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
|
|
@ -404,7 +404,7 @@ PlacesTreeView.prototype = {
|
||||||
* found, -1 otherwise.
|
* found, -1 otherwise.
|
||||||
*/
|
*/
|
||||||
_getNewRowForRemovedNode:
|
_getNewRowForRemovedNode:
|
||||||
function (aUpdatedContainer, aOldNode) {
|
function(aUpdatedContainer, aOldNode) {
|
||||||
if (aOldNode == undefined) {
|
if (aOldNode == undefined) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -449,7 +449,7 @@ PlacesTreeView.prototype = {
|
||||||
* The container which was updated.
|
* The container which was updated.
|
||||||
*/
|
*/
|
||||||
_restoreSelection:
|
_restoreSelection:
|
||||||
function (aNodesInfo, aUpdatedContainer) {
|
function(aNodesInfo, aUpdatedContainer) {
|
||||||
if (aNodesInfo.length == 0)
|
if (aNodesInfo.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -485,7 +485,7 @@ PlacesTreeView.prototype = {
|
||||||
this._tree.ensureRowIsVisible(scrollToRow);
|
this._tree.ensureRowIsVisible(scrollToRow);
|
||||||
},
|
},
|
||||||
|
|
||||||
_convertPRTimeToString: function (aTime) {
|
_convertPRTimeToString: function(aTime) {
|
||||||
const MS_PER_MINUTE = 60000;
|
const MS_PER_MINUTE = 60000;
|
||||||
const MS_PER_DAY = 86400000;
|
const MS_PER_DAY = 86400000;
|
||||||
let timeMs = aTime / 1000; // PRTime is in microseconds
|
let timeMs = aTime / 1000; // PRTime is in microseconds
|
||||||
|
|
@ -524,7 +524,7 @@ PlacesTreeView.prototype = {
|
||||||
COLUMN_TYPE_PARENTFOLDER: 10,
|
COLUMN_TYPE_PARENTFOLDER: 10,
|
||||||
COLUMN_TYPE_PARENTFOLDERPATH: 11,
|
COLUMN_TYPE_PARENTFOLDERPATH: 11,
|
||||||
|
|
||||||
_getColumnType: function (aColumn) {
|
_getColumnType: function(aColumn) {
|
||||||
let columnType = aColumn.element.getAttribute("anonid") || aColumn.id;
|
let columnType = aColumn.element.getAttribute("anonid") || aColumn.id;
|
||||||
|
|
||||||
switch (columnType) {
|
switch (columnType) {
|
||||||
|
|
@ -554,7 +554,7 @@ PlacesTreeView.prototype = {
|
||||||
return this.COLUMN_TYPE_UNKNOWN;
|
return this.COLUMN_TYPE_UNKNOWN;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sortTypeToColumnType: function (aSortType) {
|
_sortTypeToColumnType: function(aSortType) {
|
||||||
switch (aSortType) {
|
switch (aSortType) {
|
||||||
case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_TITLE, false];
|
return [this.COLUMN_TYPE_TITLE, false];
|
||||||
|
|
@ -600,7 +600,7 @@ PlacesTreeView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsINavHistoryResultObserver
|
// nsINavHistoryResultObserver
|
||||||
nodeInserted: function (aParentNode, aNode, aNewIndex) {
|
nodeInserted: function(aParentNode, aNode, aNewIndex) {
|
||||||
NS_ASSERT(this._result, "Got a notification but have no result!");
|
NS_ASSERT(this._result, "Got a notification but have no result!");
|
||||||
if (!this._tree || !this._result)
|
if (!this._tree || !this._result)
|
||||||
return;
|
return;
|
||||||
|
|
@ -674,7 +674,7 @@ PlacesTreeView.prototype = {
|
||||||
* However, we won't do this when sorted by date because dates will never
|
* However, we won't do this when sorted by date because dates will never
|
||||||
* change for visits, and date sorting is the only time things are collapsed.
|
* change for visits, and date sorting is the only time things are collapsed.
|
||||||
*/
|
*/
|
||||||
nodeRemoved: function (aParentNode, aNode, aOldIndex) {
|
nodeRemoved: function(aParentNode, aNode, aOldIndex) {
|
||||||
NS_ASSERT(this._result, "Got a notification but have no result!");
|
NS_ASSERT(this._result, "Got a notification but have no result!");
|
||||||
if (!this._tree || !this._result)
|
if (!this._tree || !this._result)
|
||||||
return;
|
return;
|
||||||
|
|
@ -727,7 +727,7 @@ PlacesTreeView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeMoved:
|
nodeMoved:
|
||||||
function (aNode, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
function(aNode, aOldParent, aOldIndex, aNewParent, aNewIndex) {
|
||||||
NS_ASSERT(this._result, "Got a notification but have no result!");
|
NS_ASSERT(this._result, "Got a notification but have no result!");
|
||||||
if (!this._tree || !this._result)
|
if (!this._tree || !this._result)
|
||||||
return;
|
return;
|
||||||
|
|
@ -773,7 +773,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_invalidateCellValue: function (aNode,
|
_invalidateCellValue: function(aNode,
|
||||||
aColumnType) {
|
aColumnType) {
|
||||||
NS_ASSERT(this._result, "Got a notification but have no result!");
|
NS_ASSERT(this._result, "Got a notification but have no result!");
|
||||||
if (!this._tree || !this._result)
|
if (!this._tree || !this._result)
|
||||||
|
|
@ -800,7 +800,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateLivemarkContainer: function (aNode) {
|
_populateLivemarkContainer: function(aNode) {
|
||||||
PlacesUtils.livemarks.getLivemark({ id: aNode.itemId })
|
PlacesUtils.livemarks.getLivemark({ id: aNode.itemId })
|
||||||
.then(aLivemark => {
|
.then(aLivemark => {
|
||||||
let placesNode = aNode;
|
let placesNode = aNode;
|
||||||
|
|
@ -816,20 +816,20 @@ PlacesTreeView.prototype = {
|
||||||
}, Components.utils.reportError);
|
}, Components.utils.reportError);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTitleChanged: function (aNode, aNewTitle) {
|
nodeTitleChanged: function(aNode, aNewTitle) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeURIChanged: function (aNode, aNewURI) {
|
nodeURIChanged: function(aNode, aNewURI) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_URI);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_URI);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeIconChanged: function (aNode) {
|
nodeIconChanged: function(aNode) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeHistoryDetailsChanged:
|
nodeHistoryDetailsChanged:
|
||||||
function (aNode, aUpdatedVisitDate,
|
function(aNode, aUpdatedVisitDate,
|
||||||
aUpdatedVisitCount) {
|
aUpdatedVisitCount) {
|
||||||
if (aNode.parent && this._controller.hasCachedLivemarkInfo(aNode.parent)) {
|
if (aNode.parent && this._controller.hasCachedLivemarkInfo(aNode.parent)) {
|
||||||
// Find the node in the parent.
|
// Find the node in the parent.
|
||||||
|
|
@ -849,15 +849,15 @@ PlacesTreeView.prototype = {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_VISITCOUNT);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_VISITCOUNT);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTagsChanged: function (aNode) {
|
nodeTagsChanged: function(aNode) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeKeywordChanged: function (aNode, aNewKeyword) {
|
nodeKeywordChanged: function(aNode, aNewKeyword) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_KEYWORD);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_KEYWORD);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeAnnotationChanged: function (aNode, aAnno) {
|
nodeAnnotationChanged: function(aNode, aAnno) {
|
||||||
if (aAnno == PlacesUIUtils.DESCRIPTION_ANNO) {
|
if (aAnno == PlacesUIUtils.DESCRIPTION_ANNO) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DESCRIPTION);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
@ -873,17 +873,17 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeDateAddedChanged: function (aNode, aNewValue) {
|
nodeDateAddedChanged: function(aNode, aNewValue) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeLastModifiedChanged:
|
nodeLastModifiedChanged:
|
||||||
function (aNode, aNewValue) {
|
function(aNode, aNewValue) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
|
||||||
},
|
},
|
||||||
|
|
||||||
containerStateChanged:
|
containerStateChanged:
|
||||||
function (aNode, aOldState, aNewState) {
|
function(aNode, aOldState, aNewState) {
|
||||||
this.invalidateContainer(aNode);
|
this.invalidateContainer(aNode);
|
||||||
|
|
||||||
if (PlacesUtils.nodeIsFolder(aNode) ||
|
if (PlacesUtils.nodeIsFolder(aNode) ||
|
||||||
|
|
@ -914,7 +914,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer: function (aContainer) {
|
invalidateContainer: function(aContainer) {
|
||||||
NS_ASSERT(this._result, "Need to have a result to update");
|
NS_ASSERT(this._result, "Need to have a result to update");
|
||||||
if (!this._tree)
|
if (!this._tree)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1020,7 +1020,7 @@ PlacesTreeView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_columns: [],
|
_columns: [],
|
||||||
_findColumnByType: function (aColumnType) {
|
_findColumnByType: function(aColumnType) {
|
||||||
if (this._columns[aColumnType])
|
if (this._columns[aColumnType])
|
||||||
return this._columns[aColumnType];
|
return this._columns[aColumnType];
|
||||||
|
|
||||||
|
|
@ -1039,7 +1039,7 @@ PlacesTreeView.prototype = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
sortingChanged: function (aSortingMode) {
|
sortingChanged: function(aSortingMode) {
|
||||||
if (!this._tree || !this._result)
|
if (!this._tree || !this._result)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1068,7 +1068,7 @@ PlacesTreeView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_inBatchMode: false,
|
_inBatchMode: false,
|
||||||
batching: function (aToggleMode) {
|
batching: function(aToggleMode) {
|
||||||
if (this._inBatchMode != aToggleMode) {
|
if (this._inBatchMode != aToggleMode) {
|
||||||
this._inBatchMode = this.selection.selectEventsSuppressed = aToggleMode;
|
this._inBatchMode = this.selection.selectEventsSuppressed = aToggleMode;
|
||||||
if (this._inBatchMode) {
|
if (this._inBatchMode) {
|
||||||
|
|
@ -1107,14 +1107,14 @@ PlacesTreeView.prototype = {
|
||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeForTreeIndex: function (aIndex) {
|
nodeForTreeIndex: function(aIndex) {
|
||||||
if (aIndex > this._rows.length)
|
if (aIndex > this._rows.length)
|
||||||
throw Cr.NS_ERROR_INVALID_ARG;
|
throw Cr.NS_ERROR_INVALID_ARG;
|
||||||
|
|
||||||
return this._getNodeForRow(aIndex);
|
return this._getNodeForRow(aIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
treeIndexForNode: function (aNode) {
|
treeIndexForNode: function(aNode) {
|
||||||
// The API allows passing invisible nodes.
|
// The API allows passing invisible nodes.
|
||||||
try {
|
try {
|
||||||
return this._getRowForNode(aNode, true);
|
return this._getRowForNode(aNode, true);
|
||||||
|
|
@ -1124,7 +1124,7 @@ PlacesTreeView.prototype = {
|
||||||
return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
|
return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getResourceForNode: function (aNode)
|
_getResourceForNode: function(aNode)
|
||||||
{
|
{
|
||||||
let uri = aNode.uri;
|
let uri = aNode.uri;
|
||||||
NS_ASSERT(uri, "if there is no uri, we can't persist the open state");
|
NS_ASSERT(uri, "if there is no uri, we can't persist the open state");
|
||||||
|
|
@ -1139,7 +1139,7 @@ PlacesTreeView.prototype = {
|
||||||
getRowProperties: function() { return ""; },
|
getRowProperties: function() { return ""; },
|
||||||
|
|
||||||
getCellProperties:
|
getCellProperties:
|
||||||
function (aRow, aColumn) {
|
function(aRow, aColumn) {
|
||||||
// for anonid-trees, we need to add the column-type manually
|
// for anonid-trees, we need to add the column-type manually
|
||||||
var props = "";
|
var props = "";
|
||||||
let columnType = aColumn.element.getAttribute("anonid");
|
let columnType = aColumn.element.getAttribute("anonid");
|
||||||
|
|
@ -1220,7 +1220,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
getColumnProperties: function(aColumn) { return ""; },
|
getColumnProperties: function(aColumn) { return ""; },
|
||||||
|
|
||||||
isContainer: function (aRow) {
|
isContainer: function(aRow) {
|
||||||
// Only leaf nodes aren't listed in the rows array.
|
// Only leaf nodes aren't listed in the rows array.
|
||||||
let node = this._rows[aRow];
|
let node = this._rows[aRow];
|
||||||
if (node === undefined)
|
if (node === undefined)
|
||||||
|
|
@ -1245,7 +1245,7 @@ PlacesTreeView.prototype = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
isContainerOpen: function (aRow) {
|
isContainerOpen: function(aRow) {
|
||||||
if (this._flatList)
|
if (this._flatList)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -1253,7 +1253,7 @@ PlacesTreeView.prototype = {
|
||||||
return this._rows[aRow].containerOpen;
|
return this._rows[aRow].containerOpen;
|
||||||
},
|
},
|
||||||
|
|
||||||
isContainerEmpty: function (aRow) {
|
isContainerEmpty: function(aRow) {
|
||||||
if (this._flatList)
|
if (this._flatList)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -1267,18 +1267,18 @@ PlacesTreeView.prototype = {
|
||||||
return !node.hasChildren;
|
return !node.hasChildren;
|
||||||
},
|
},
|
||||||
|
|
||||||
isSeparator: function (aRow) {
|
isSeparator: function(aRow) {
|
||||||
// All separators are listed in the rows array.
|
// All separators are listed in the rows array.
|
||||||
let node = this._rows[aRow];
|
let node = this._rows[aRow];
|
||||||
return node && PlacesUtils.nodeIsSeparator(node);
|
return node && PlacesUtils.nodeIsSeparator(node);
|
||||||
},
|
},
|
||||||
|
|
||||||
isSorted: function () {
|
isSorted: function() {
|
||||||
return this._result.sortingMode !=
|
return this._result.sortingMode !=
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||||
},
|
},
|
||||||
|
|
||||||
canDrop: function (aRow, aOrientation, aDataTransfer) {
|
canDrop: function(aRow, aOrientation, aDataTransfer) {
|
||||||
if (!this._result)
|
if (!this._result)
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
throw Cr.NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
|
@ -1290,7 +1290,7 @@ PlacesTreeView.prototype = {
|
||||||
return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer);
|
return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getInsertionPoint: function (index, orientation) {
|
_getInsertionPoint: function(index, orientation) {
|
||||||
let container = this._result.root;
|
let container = this._result.root;
|
||||||
let dropNearItemId = -1;
|
let dropNearItemId = -1;
|
||||||
// When there's no selection, assume the container is the container
|
// When there's no selection, assume the container is the container
|
||||||
|
|
@ -1361,7 +1361,7 @@ PlacesTreeView.prototype = {
|
||||||
dropNearItemId);
|
dropNearItemId);
|
||||||
},
|
},
|
||||||
|
|
||||||
drop: function (aRow, aOrientation, aDataTransfer) {
|
drop: function(aRow, aOrientation, aDataTransfer) {
|
||||||
// We are responsible for translating the |index| and |orientation|
|
// We are responsible for translating the |index| and |orientation|
|
||||||
// parameters into a container id and index within the container,
|
// parameters into a container id and index within the container,
|
||||||
// since this information is specific to the tree view.
|
// since this information is specific to the tree view.
|
||||||
|
|
@ -1372,12 +1372,12 @@ PlacesTreeView.prototype = {
|
||||||
PlacesControllerDragHelper.currentDropTarget = null;
|
PlacesControllerDragHelper.currentDropTarget = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getParentIndex: function (aRow) {
|
getParentIndex: function(aRow) {
|
||||||
let [parentNode, parentRow] = this._getParentByChildRow(aRow);
|
let [parentNode, parentRow] = this._getParentByChildRow(aRow);
|
||||||
return parentRow;
|
return parentRow;
|
||||||
},
|
},
|
||||||
|
|
||||||
hasNextSibling: function (aRow, aAfterIndex) {
|
hasNextSibling: function(aRow, aAfterIndex) {
|
||||||
if (aRow == this._rows.length - 1) {
|
if (aRow == this._rows.length - 1) {
|
||||||
// The last row has no sibling.
|
// The last row has no sibling.
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1407,7 +1407,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
getLevel: function(aRow) this._getNodeForRow(aRow).indentLevel,
|
getLevel: function(aRow) this._getNodeForRow(aRow).indentLevel,
|
||||||
|
|
||||||
getImageSrc: function (aRow, aColumn) {
|
getImageSrc: function(aRow, aColumn) {
|
||||||
// Only the title column has an image.
|
// Only the title column has an image.
|
||||||
if (this._getColumnType(aColumn) != this.COLUMN_TYPE_TITLE)
|
if (this._getColumnType(aColumn) != this.COLUMN_TYPE_TITLE)
|
||||||
return "";
|
return "";
|
||||||
|
|
@ -1418,7 +1418,7 @@ PlacesTreeView.prototype = {
|
||||||
getProgressMode: function(aRow, aColumn) { },
|
getProgressMode: function(aRow, aColumn) { },
|
||||||
getCellValue: function(aRow, aColumn) { },
|
getCellValue: function(aRow, aColumn) { },
|
||||||
|
|
||||||
getCellText: function (aRow, aColumn) {
|
getCellText: function(aRow, aColumn) {
|
||||||
let node = this._getNodeForRow(aRow);
|
let node = this._getNodeForRow(aRow);
|
||||||
switch (this._getColumnType(aColumn)) {
|
switch (this._getColumnType(aColumn)) {
|
||||||
case this.COLUMN_TYPE_TITLE:
|
case this.COLUMN_TYPE_TITLE:
|
||||||
|
|
@ -1515,7 +1515,7 @@ PlacesTreeView.prototype = {
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
setTree: function (aTree) {
|
setTree: function(aTree) {
|
||||||
// If we are replacing the tree during a batch, there is a concrete risk
|
// If we are replacing the tree during a batch, there is a concrete risk
|
||||||
// that the treeView goes out of sync, thus it's safer to end the batch now.
|
// that the treeView goes out of sync, thus it's safer to end the batch now.
|
||||||
// This is a no-op if we are not batching.
|
// This is a no-op if we are not batching.
|
||||||
|
|
@ -1538,7 +1538,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleOpenState: function (aRow) {
|
toggleOpenState: function(aRow) {
|
||||||
if (!this._result)
|
if (!this._result)
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
throw Cr.NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
|
@ -1565,7 +1565,7 @@ PlacesTreeView.prototype = {
|
||||||
node.containerOpen = !node.containerOpen;
|
node.containerOpen = !node.containerOpen;
|
||||||
},
|
},
|
||||||
|
|
||||||
cycleHeader: function (aColumn) {
|
cycleHeader: function(aColumn) {
|
||||||
if (!this._result)
|
if (!this._result)
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
throw Cr.NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
|
@ -1697,7 +1697,7 @@ PlacesTreeView.prototype = {
|
||||||
this._result.sortingMode = newSort;
|
this._result.sortingMode = newSort;
|
||||||
},
|
},
|
||||||
|
|
||||||
isEditable: function (aRow, aColumn) {
|
isEditable: function(aRow, aColumn) {
|
||||||
// At this point we only support editing the title field.
|
// At this point we only support editing the title field.
|
||||||
if (aColumn.index != 0)
|
if (aColumn.index != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1740,7 +1740,7 @@ PlacesTreeView.prototype = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
setCellText: function (aRow, aColumn, aText) {
|
setCellText: function(aRow, aColumn, aText) {
|
||||||
// We may only get here if the cell is editable.
|
// We may only get here if the cell is editable.
|
||||||
let node = this._rows[aRow];
|
let node = this._rows[aRow];
|
||||||
if (node.title != aText) {
|
if (node.title != aText) {
|
||||||
|
|
@ -1749,7 +1749,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCutNode: function (aNode, aValue) {
|
toggleCutNode: function(aNode, aValue) {
|
||||||
let currentVal = this._cuttingNodes.has(aNode);
|
let currentVal = this._cuttingNodes.has(aNode);
|
||||||
if (currentVal != aValue) {
|
if (currentVal != aValue) {
|
||||||
if (aValue)
|
if (aValue)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Brings the appropriate tab to the front and initializes various bits of UI.
|
* Brings the appropriate tab to the front and initializes various bits of UI.
|
||||||
*/
|
*/
|
||||||
init: function ()
|
init: function()
|
||||||
{
|
{
|
||||||
this._inited = true;
|
this._inited = true;
|
||||||
var advancedPrefs = document.getElementById("advancedPrefs");
|
var advancedPrefs = document.getElementById("advancedPrefs");
|
||||||
|
|
@ -61,7 +61,7 @@ var gAdvancedPane = {
|
||||||
* Stores the identity of the current tab in preferences so that the selected
|
* Stores the identity of the current tab in preferences so that the selected
|
||||||
* tab can be persisted between openings of the preferences window.
|
* tab can be persisted between openings of the preferences window.
|
||||||
*/
|
*/
|
||||||
tabSelectionChanged: function ()
|
tabSelectionChanged: function()
|
||||||
{
|
{
|
||||||
if (!this._inited)
|
if (!this._inited)
|
||||||
return;
|
return;
|
||||||
|
|
@ -109,7 +109,7 @@ var gAdvancedPane = {
|
||||||
* the current value to enable proper pref restoration if the checkbox is
|
* the current value to enable proper pref restoration if the checkbox is
|
||||||
* never changed.
|
* never changed.
|
||||||
*/
|
*/
|
||||||
readCheckSpelling: function ()
|
readCheckSpelling: function()
|
||||||
{
|
{
|
||||||
var pref = document.getElementById("layout.spellcheckDefault");
|
var pref = document.getElementById("layout.spellcheckDefault");
|
||||||
this._storedSpellCheck = pref.value;
|
this._storedSpellCheck = pref.value;
|
||||||
|
|
@ -122,7 +122,7 @@ var gAdvancedPane = {
|
||||||
* preserving the preference's "hidden" value if the preference is
|
* preserving the preference's "hidden" value if the preference is
|
||||||
* unchanged and represents a value not strictly allowed in UI.
|
* unchanged and represents a value not strictly allowed in UI.
|
||||||
*/
|
*/
|
||||||
writeCheckSpelling: function ()
|
writeCheckSpelling: function()
|
||||||
{
|
{
|
||||||
var checkbox = document.getElementById("checkSpelling");
|
var checkbox = document.getElementById("checkSpelling");
|
||||||
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
|
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
|
||||||
|
|
@ -132,7 +132,7 @@ var gAdvancedPane = {
|
||||||
* security.OCSP.enabled is an integer value for legacy reasons.
|
* security.OCSP.enabled is an integer value for legacy reasons.
|
||||||
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
|
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
|
||||||
*/
|
*/
|
||||||
readEnableOCSP: function ()
|
readEnableOCSP: function()
|
||||||
{
|
{
|
||||||
var preference = document.getElementById("security.OCSP.enabled");
|
var preference = document.getElementById("security.OCSP.enabled");
|
||||||
// This is the case if the preference is the default value.
|
// This is the case if the preference is the default value.
|
||||||
|
|
@ -145,7 +145,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* See documentation for readEnableOCSP.
|
* See documentation for readEnableOCSP.
|
||||||
*/
|
*/
|
||||||
writeEnableOCSP: function ()
|
writeEnableOCSP: function()
|
||||||
{
|
{
|
||||||
var checkbox = document.getElementById("enableOCSP");
|
var checkbox = document.getElementById("enableOCSP");
|
||||||
return checkbox.checked ? 1 : 0;
|
return checkbox.checked ? 1 : 0;
|
||||||
|
|
@ -178,7 +178,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* opening links behind a modal dialog is poor form. Work around flawed text-link handling here.
|
* opening links behind a modal dialog is poor form. Work around flawed text-link handling here.
|
||||||
*/
|
*/
|
||||||
openTextLink: function (evt) {
|
openTextLink: function(evt) {
|
||||||
let where = Services.prefs.getBoolPref("browser.preferences.instantApply") ? "tab" : "window";
|
let where = Services.prefs.getBoolPref("browser.preferences.instantApply") ? "tab" : "window";
|
||||||
openUILinkIn(evt.target.getAttribute("href"), where);
|
openUILinkIn(evt.target.getAttribute("href"), where);
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
@ -187,7 +187,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Set up or hide the Learn More links for various data collection options
|
* Set up or hide the Learn More links for various data collection options
|
||||||
*/
|
*/
|
||||||
_setupLearnMoreLink: function (pref, element) {
|
_setupLearnMoreLink: function(pref, element) {
|
||||||
// set up the Learn More link with the correct URL
|
// set up the Learn More link with the correct URL
|
||||||
let url = Services.prefs.getCharPref(pref);
|
let url = Services.prefs.getCharPref(pref);
|
||||||
let el = document.getElementById(element);
|
let el = document.getElementById(element);
|
||||||
|
|
@ -212,14 +212,14 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Displays a dialog in which proxy settings may be changed.
|
* Displays a dialog in which proxy settings may be changed.
|
||||||
*/
|
*/
|
||||||
showConnections: function ()
|
showConnections: function()
|
||||||
{
|
{
|
||||||
document.documentElement.openSubDialog("chrome://browser/content/preferences/connection.xul",
|
document.documentElement.openSubDialog("chrome://browser/content/preferences/connection.xul",
|
||||||
"", null);
|
"", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Retrieves the amount of space currently used by disk cache
|
// Retrieves the amount of space currently used by disk cache
|
||||||
updateActualCacheSize: function ()
|
updateActualCacheSize: function()
|
||||||
{
|
{
|
||||||
var sum = 0;
|
var sum = 0;
|
||||||
function updateUI(consumption) {
|
function updateUI(consumption) {
|
||||||
|
|
@ -233,7 +233,7 @@ var gAdvancedPane = {
|
||||||
Visitor.prototype = {
|
Visitor.prototype = {
|
||||||
expected: 0,
|
expected: 0,
|
||||||
sum: 0,
|
sum: 0,
|
||||||
QueryInterface: function (iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||||
iid.equals(Components.interfaces.nsICacheStorageVisitor)) {
|
iid.equals(Components.interfaces.nsICacheStorageVisitor)) {
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -266,10 +266,10 @@ var gAdvancedPane = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Retrieves the amount of space currently used by offline cache
|
// Retrieves the amount of space currently used by offline cache
|
||||||
updateActualAppCacheSize: function ()
|
updateActualAppCacheSize: function()
|
||||||
{
|
{
|
||||||
var visitor = {
|
var visitor = {
|
||||||
onCacheStorageInfo: function (aEntryCount, aConsumption, aCapacity, aDiskDirectory)
|
onCacheStorageInfo: function(aEntryCount, aConsumption, aCapacity, aDiskDirectory)
|
||||||
{
|
{
|
||||||
var actualSizeLabel = document.getElementById("actualAppCacheSize");
|
var actualSizeLabel = document.getElementById("actualAppCacheSize");
|
||||||
var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
|
var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
|
||||||
|
|
@ -286,14 +286,14 @@ var gAdvancedPane = {
|
||||||
storage.asyncVisitStorage(visitor, false);
|
storage.asyncVisitStorage(visitor, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateCacheSizeUI: function (smartSizeEnabled)
|
updateCacheSizeUI: function(smartSizeEnabled)
|
||||||
{
|
{
|
||||||
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
|
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
|
||||||
document.getElementById("cacheSize").disabled = smartSizeEnabled;
|
document.getElementById("cacheSize").disabled = smartSizeEnabled;
|
||||||
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
|
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
readSmartSizeEnabled: function ()
|
readSmartSizeEnabled: function()
|
||||||
{
|
{
|
||||||
// The smart_size.enabled preference element is inverted="true", so its
|
// The smart_size.enabled preference element is inverted="true", so its
|
||||||
// value is the opposite of the actual pref value
|
// value is the opposite of the actual pref value
|
||||||
|
|
@ -305,7 +305,7 @@ var gAdvancedPane = {
|
||||||
* Converts the cache size from units of KB to units of MB and returns that
|
* Converts the cache size from units of KB to units of MB and returns that
|
||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
readCacheSize: function ()
|
readCacheSize: function()
|
||||||
{
|
{
|
||||||
var preference = document.getElementById("browser.cache.disk.capacity");
|
var preference = document.getElementById("browser.cache.disk.capacity");
|
||||||
return preference.value / 1024;
|
return preference.value / 1024;
|
||||||
|
|
@ -315,7 +315,7 @@ var gAdvancedPane = {
|
||||||
* Converts the cache size as specified in UI (in MB) to KB and returns that
|
* Converts the cache size as specified in UI (in MB) to KB and returns that
|
||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
writeCacheSize: function ()
|
writeCacheSize: function()
|
||||||
{
|
{
|
||||||
var cacheSize = document.getElementById("cacheSize");
|
var cacheSize = document.getElementById("cacheSize");
|
||||||
var intValue = parseInt(cacheSize.value, 10);
|
var intValue = parseInt(cacheSize.value, 10);
|
||||||
|
|
@ -325,7 +325,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Clears the cache.
|
* Clears the cache.
|
||||||
*/
|
*/
|
||||||
clearCache: function ()
|
clearCache: function()
|
||||||
{
|
{
|
||||||
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
||||||
.getService(Components.interfaces.nsICacheStorageService);
|
.getService(Components.interfaces.nsICacheStorageService);
|
||||||
|
|
@ -338,7 +338,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Clears the application cache.
|
* Clears the application cache.
|
||||||
*/
|
*/
|
||||||
clearOfflineAppCache: function ()
|
clearOfflineAppCache: function()
|
||||||
{
|
{
|
||||||
Components.utils.import("resource:///modules/offlineAppCache.jsm");
|
Components.utils.import("resource:///modules/offlineAppCache.jsm");
|
||||||
OfflineAppCacheHelper.clear();
|
OfflineAppCacheHelper.clear();
|
||||||
|
|
@ -389,7 +389,7 @@ var gAdvancedPane = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX: duplicated in browser.js
|
// XXX: duplicated in browser.js
|
||||||
_getOfflineAppUsage: function (perm, groups)
|
_getOfflineAppUsage: function(perm, groups)
|
||||||
{
|
{
|
||||||
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
||||||
getService(Components.interfaces.nsIApplicationCacheService);
|
getService(Components.interfaces.nsIApplicationCacheService);
|
||||||
|
|
@ -414,7 +414,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Updates the list of offline applications
|
* Updates the list of offline applications
|
||||||
*/
|
*/
|
||||||
updateOfflineApps: function ()
|
updateOfflineApps: function()
|
||||||
{
|
{
|
||||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
||||||
.getService(Components.interfaces.nsIPermissionManager);
|
.getService(Components.interfaces.nsIPermissionManager);
|
||||||
|
|
@ -560,7 +560,7 @@ var gAdvancedPane = {
|
||||||
* iii 0/1/2 f false
|
* iii 0/1/2 f false
|
||||||
* iii 0/1/2 *t* *true*
|
* iii 0/1/2 *t* *true*
|
||||||
*/
|
*/
|
||||||
updateReadPrefs: function ()
|
updateReadPrefs: function()
|
||||||
{
|
{
|
||||||
var enabledPref = document.getElementById("app.update.enabled");
|
var enabledPref = document.getElementById("app.update.enabled");
|
||||||
var autoPref = document.getElementById("app.update.auto");
|
var autoPref = document.getElementById("app.update.auto");
|
||||||
|
|
@ -592,7 +592,7 @@ var gAdvancedPane = {
|
||||||
* Sets the pref values based on the selected item of the radiogroup,
|
* Sets the pref values based on the selected item of the radiogroup,
|
||||||
* and sets the disabled state of the warnIncompatible checkbox accordingly.
|
* and sets the disabled state of the warnIncompatible checkbox accordingly.
|
||||||
*/
|
*/
|
||||||
updateWritePrefs: function ()
|
updateWritePrefs: function()
|
||||||
{
|
{
|
||||||
var enabledPref = document.getElementById("app.update.enabled");
|
var enabledPref = document.getElementById("app.update.enabled");
|
||||||
var autoPref = document.getElementById("app.update.auto");
|
var autoPref = document.getElementById("app.update.auto");
|
||||||
|
|
@ -641,7 +641,7 @@ var gAdvancedPane = {
|
||||||
* 2 Checked Warn if there are incompatibilities,
|
* 2 Checked Warn if there are incompatibilities,
|
||||||
* or the update is major.
|
* or the update is major.
|
||||||
*/
|
*/
|
||||||
readAddonWarn: function ()
|
readAddonWarn: function()
|
||||||
{
|
{
|
||||||
var preference = document.getElementById("app.update.mode");
|
var preference = document.getElementById("app.update.mode");
|
||||||
var warn = preference.value != 0;
|
var warn = preference.value != 0;
|
||||||
|
|
@ -654,7 +654,7 @@ var gAdvancedPane = {
|
||||||
* themes" checkbox into the integer preference which represents it,
|
* themes" checkbox into the integer preference which represents it,
|
||||||
* returning that value.
|
* returning that value.
|
||||||
*/
|
*/
|
||||||
writeAddonWarn: function ()
|
writeAddonWarn: function()
|
||||||
{
|
{
|
||||||
var warnIncompatible = document.getElementById("warnIncompatible");
|
var warnIncompatible = document.getElementById("warnIncompatible");
|
||||||
return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
|
return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
|
||||||
|
|
@ -663,7 +663,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Displays the history of installed updates.
|
* Displays the history of installed updates.
|
||||||
*/
|
*/
|
||||||
showUpdates: function ()
|
showUpdates: function()
|
||||||
{
|
{
|
||||||
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
|
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
|
||||||
.createInstance(Components.interfaces.nsIUpdatePrompt);
|
.createInstance(Components.interfaces.nsIUpdatePrompt);
|
||||||
|
|
@ -688,7 +688,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Displays the user's certificates and associated options.
|
* Displays the user's certificates and associated options.
|
||||||
*/
|
*/
|
||||||
showCertificates: function ()
|
showCertificates: function()
|
||||||
{
|
{
|
||||||
document.documentElement.openWindow("mozilla:certmanager",
|
document.documentElement.openWindow("mozilla:certmanager",
|
||||||
"chrome://pippki/content/certManager.xul",
|
"chrome://pippki/content/certManager.xul",
|
||||||
|
|
@ -698,7 +698,7 @@ var gAdvancedPane = {
|
||||||
/**
|
/**
|
||||||
* Displays a dialog from which the user can manage his security devices.
|
* Displays a dialog from which the user can manage his security devices.
|
||||||
*/
|
*/
|
||||||
showSecurityDevices: function ()
|
showSecurityDevices: function()
|
||||||
{
|
{
|
||||||
document.documentElement.openWindow("mozilla:devicemanager",
|
document.documentElement.openWindow("mozilla:devicemanager",
|
||||||
"chrome://pippki/content/device_manager.xul",
|
"chrome://pippki/content/device_manager.xul",
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ var Ci = Components.interfaces;
|
||||||
var gAppManagerDialog = {
|
var gAppManagerDialog = {
|
||||||
_removed: [],
|
_removed: [],
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
this.handlerInfo = window.arguments[0];
|
this.handlerInfo = window.arguments[0];
|
||||||
|
|
||||||
var bundle = document.getElementById("appManagerBundle");
|
var bundle = document.getElementById("appManagerBundle");
|
||||||
|
|
@ -44,7 +44,7 @@ var gAppManagerDialog = {
|
||||||
list.selectedIndex = 0;
|
list.selectedIndex = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
onOK: function () {
|
onOK: function() {
|
||||||
if (!this._removed.length) {
|
if (!this._removed.length) {
|
||||||
// return early to avoid calling the |store| method.
|
// return early to avoid calling the |store| method.
|
||||||
return;
|
return;
|
||||||
|
|
@ -56,11 +56,11 @@ var gAppManagerDialog = {
|
||||||
this.handlerInfo.store();
|
this.handlerInfo.store();
|
||||||
},
|
},
|
||||||
|
|
||||||
onCancel: function () {
|
onCancel: function() {
|
||||||
// do nothing
|
// do nothing
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function () {
|
remove: function() {
|
||||||
var list = document.getElementById("appList");
|
var list = document.getElementById("appList");
|
||||||
this._removed.push(list.selectedItem.app);
|
this._removed.push(list.selectedItem.app);
|
||||||
var index = list.selectedIndex;
|
var index = list.selectedIndex;
|
||||||
|
|
@ -78,7 +78,7 @@ var gAppManagerDialog = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function () {
|
onSelect: function() {
|
||||||
var list = document.getElementById("appList");
|
var list = document.getElementById("appList");
|
||||||
if (!list.selectedItem) {
|
if (!list.selectedItem) {
|
||||||
document.getElementById("remove").disabled = true;
|
document.getElementById("remove").disabled = true;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ var gCookiesWindow = {
|
||||||
_tree : null,
|
_tree : null,
|
||||||
_bundle : null,
|
_bundle : null,
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||||
.getService(Components.interfaces.nsIObserverService);
|
.getService(Components.interfaces.nsIObserverService);
|
||||||
os.addObserver(this, "cookie-changed", false);
|
os.addObserver(this, "cookie-changed", false);
|
||||||
|
|
@ -36,14 +36,14 @@ var gCookiesWindow = {
|
||||||
document.getElementById("filter").focus();
|
document.getElementById("filter").focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||||
.getService(Components.interfaces.nsIObserverService);
|
.getService(Components.interfaces.nsIObserverService);
|
||||||
os.removeObserver(this, "cookie-changed");
|
os.removeObserver(this, "cookie-changed");
|
||||||
os.removeObserver(this, "perm-changed");
|
os.removeObserver(this, "perm-changed");
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateList: function (aInitialLoad) {
|
_populateList: function(aInitialLoad) {
|
||||||
this._loadCookies();
|
this._loadCookies();
|
||||||
this._tree.view = this._view;
|
this._tree.view = this._view;
|
||||||
if (aInitialLoad)
|
if (aInitialLoad)
|
||||||
|
|
@ -67,7 +67,7 @@ var gCookiesWindow = {
|
||||||
this._saveState();
|
this._saveState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_cookieEquals: function (aCookieA, aCookieB, aStrippedHost) {
|
_cookieEquals: function(aCookieA, aCookieB, aStrippedHost) {
|
||||||
return aCookieA.rawHost == aStrippedHost &&
|
return aCookieA.rawHost == aStrippedHost &&
|
||||||
aCookieA.name == aCookieB.name &&
|
aCookieA.name == aCookieB.name &&
|
||||||
aCookieA.path == aCookieB.path &&
|
aCookieA.path == aCookieB.path &&
|
||||||
|
|
@ -75,7 +75,7 @@ var gCookiesWindow = {
|
||||||
aCookieB.originAttributes);
|
aCookieB.originAttributes);
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (aCookie, aTopic, aData) {
|
observe: function(aCookie, aTopic, aData) {
|
||||||
if (aTopic != "cookie-changed")
|
if (aTopic != "cookie-changed")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ var gCookiesWindow = {
|
||||||
// and is rather complicated as selection tracking is difficult
|
// and is rather complicated as selection tracking is difficult
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleCookieChanged: function (changedCookie, strippedHost) {
|
_handleCookieChanged: function(changedCookie, strippedHost) {
|
||||||
var rowIndex = 0;
|
var rowIndex = 0;
|
||||||
var cookieItem = null;
|
var cookieItem = null;
|
||||||
if (!this._view._filtered) {
|
if (!this._view._filtered) {
|
||||||
|
|
@ -159,7 +159,7 @@ var gCookiesWindow = {
|
||||||
this._updateCookieData(cookieItem);
|
this._updateCookieData(cookieItem);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleCookieAdded: function (changedCookie, strippedHost) {
|
_handleCookieAdded: function(changedCookie, strippedHost) {
|
||||||
var rowCountImpact = 0;
|
var rowCountImpact = 0;
|
||||||
var addedHost = { value: 0 };
|
var addedHost = { value: 0 };
|
||||||
this._addCookie(strippedHost, changedCookie, addedHost);
|
this._addCookie(strippedHost, changedCookie, addedHost);
|
||||||
|
|
@ -199,7 +199,7 @@ var gCookiesWindow = {
|
||||||
return this._rowCount;
|
return this._rowCount;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getItemAtIndex: function (aIndex) {
|
_getItemAtIndex: function(aIndex) {
|
||||||
if (this._filtered)
|
if (this._filtered)
|
||||||
return this._filterSet[aIndex];
|
return this._filterSet[aIndex];
|
||||||
|
|
||||||
|
|
@ -255,7 +255,7 @@ var gCookiesWindow = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeItemAtIndex: function (aIndex, aCount) {
|
_removeItemAtIndex: function(aIndex, aCount) {
|
||||||
var removeCount = aCount === undefined ? 1 : aCount;
|
var removeCount = aCount === undefined ? 1 : aCount;
|
||||||
if (this._filtered) {
|
if (this._filtered) {
|
||||||
// remove the cookies from the unfiltered set so that they
|
// remove the cookies from the unfiltered set so that they
|
||||||
|
|
@ -294,11 +294,11 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_invalidateCache: function (aIndex) {
|
_invalidateCache: function(aIndex) {
|
||||||
this._cacheValid = Math.min(this._cacheValid, aIndex);
|
this._cacheValid = Math.min(this._cacheValid, aIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
getCellText: function (aIndex, aColumn) {
|
getCellText: function(aIndex, aColumn) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
if (!item)
|
if (!item)
|
||||||
|
|
@ -320,10 +320,10 @@ var gCookiesWindow = {
|
||||||
_selection: null,
|
_selection: null,
|
||||||
get selection () { return this._selection; },
|
get selection () { return this._selection; },
|
||||||
set selection (val) { this._selection = val; return val; },
|
set selection (val) { this._selection = val; return val; },
|
||||||
getRowProperties: function (aIndex) { return ""; },
|
getRowProperties: function(aIndex) { return ""; },
|
||||||
getCellProperties: function (aIndex, aColumn) { return ""; },
|
getCellProperties: function(aIndex, aColumn) { return ""; },
|
||||||
getColumnProperties: function (aColumn) { return ""; },
|
getColumnProperties: function(aColumn) { return ""; },
|
||||||
isContainer: function (aIndex) {
|
isContainer: function(aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
if (!item) return false;
|
if (!item) return false;
|
||||||
|
|
@ -331,7 +331,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isContainerOpen: function (aIndex) {
|
isContainerOpen: function(aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
if (!item) return false;
|
if (!item) return false;
|
||||||
|
|
@ -339,7 +339,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isContainerEmpty: function (aIndex) {
|
isContainerEmpty: function(aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
if (!item) return false;
|
if (!item) return false;
|
||||||
|
|
@ -347,11 +347,11 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isSeparator: function (aIndex) { return false; },
|
isSeparator: function(aIndex) { return false; },
|
||||||
isSorted: function (aIndex) { return false; },
|
isSorted: function(aIndex) { return false; },
|
||||||
canDrop: function (aIndex, aOrientation) { return false; },
|
canDrop: function(aIndex, aOrientation) { return false; },
|
||||||
drop: function (aIndex, aOrientation) {},
|
drop: function(aIndex, aOrientation) {},
|
||||||
getParentIndex: function (aIndex) {
|
getParentIndex: function(aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
// If an item has no parent index (i.e. it is at the top level) this
|
// If an item has no parent index (i.e. it is at the top level) this
|
||||||
|
|
@ -363,7 +363,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
},
|
},
|
||||||
hasNextSibling: function (aParentIndex, aIndex) {
|
hasNextSibling: function(aParentIndex, aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
// |aParentIndex| appears to be bogus, but we can get the real
|
// |aParentIndex| appears to be bogus, but we can get the real
|
||||||
// parent index by getting the entry for |aIndex| and reading the
|
// parent index by getting the entry for |aIndex| and reading the
|
||||||
|
|
@ -390,7 +390,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
return aIndex < this.rowCount - 1;
|
return aIndex < this.rowCount - 1;
|
||||||
},
|
},
|
||||||
hasPreviousSibling: function (aIndex) {
|
hasPreviousSibling: function(aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
if (!item) return false;
|
if (!item) return false;
|
||||||
|
|
@ -400,7 +400,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
return aIndex > 0;
|
return aIndex > 0;
|
||||||
},
|
},
|
||||||
getLevel: function (aIndex) {
|
getLevel: function(aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
if (!item) return 0;
|
if (!item) return 0;
|
||||||
|
|
@ -408,11 +408,11 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
getImageSrc: function (aIndex, aColumn) {},
|
getImageSrc: function(aIndex, aColumn) {},
|
||||||
getProgressMode: function (aIndex, aColumn) {},
|
getProgressMode: function(aIndex, aColumn) {},
|
||||||
getCellValue: function (aIndex, aColumn) {},
|
getCellValue: function(aIndex, aColumn) {},
|
||||||
setTree: function (aTree) {},
|
setTree: function(aTree) {},
|
||||||
toggleOpenState: function (aIndex) {
|
toggleOpenState: function(aIndex) {
|
||||||
if (!this._filtered) {
|
if (!this._filtered) {
|
||||||
var item = this._getItemAtIndex(aIndex);
|
var item = this._getItemAtIndex(aIndex);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
@ -425,28 +425,28 @@ var gCookiesWindow = {
|
||||||
gCookiesWindow._tree.treeBoxObject.invalidateRow(aIndex);
|
gCookiesWindow._tree.treeBoxObject.invalidateRow(aIndex);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cycleHeader: function (aColumn) {},
|
cycleHeader: function(aColumn) {},
|
||||||
selectionChanged: function () {},
|
selectionChanged: function() {},
|
||||||
cycleCell: function (aIndex, aColumn) {},
|
cycleCell: function(aIndex, aColumn) {},
|
||||||
isEditable: function (aIndex, aColumn) {
|
isEditable: function(aIndex, aColumn) {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isSelectable: function (aIndex, aColumn) {
|
isSelectable: function(aIndex, aColumn) {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
setCellValue: function (aIndex, aColumn, aValue) {},
|
setCellValue: function(aIndex, aColumn, aValue) {},
|
||||||
setCellText: function (aIndex, aColumn, aValue) {},
|
setCellText: function(aIndex, aColumn, aValue) {},
|
||||||
performAction: function (aAction) {},
|
performAction: function(aAction) {},
|
||||||
performActionOnRow: function (aAction, aIndex) {},
|
performActionOnRow: function(aAction, aIndex) {},
|
||||||
performActionOnCell: function (aAction, aindex, aColumn) {}
|
performActionOnCell: function(aAction, aindex, aColumn) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeStrippedHost: function (aHost) {
|
_makeStrippedHost: function(aHost) {
|
||||||
var formattedHost = aHost.charAt(0) == "." ? aHost.substring(1, aHost.length) : aHost;
|
var formattedHost = aHost.charAt(0) == "." ? aHost.substring(1, aHost.length) : aHost;
|
||||||
return formattedHost.substring(0, 4) == "www." ? formattedHost.substring(4, formattedHost.length) : formattedHost;
|
return formattedHost.substring(0, 4) == "www." ? formattedHost.substring(4, formattedHost.length) : formattedHost;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addCookie: function (aStrippedHost, aCookie, aHostCount) {
|
_addCookie: function(aStrippedHost, aCookie, aHostCount) {
|
||||||
if (!(aStrippedHost in this._hosts) || !this._hosts[aStrippedHost]) {
|
if (!(aStrippedHost in this._hosts) || !this._hosts[aStrippedHost]) {
|
||||||
this._hosts[aStrippedHost] = { cookies : [],
|
this._hosts[aStrippedHost] = { cookies : [],
|
||||||
rawHost : aStrippedHost,
|
rawHost : aStrippedHost,
|
||||||
|
|
@ -461,7 +461,7 @@ var gCookiesWindow = {
|
||||||
this._hosts[aStrippedHost].cookies.push(c);
|
this._hosts[aStrippedHost].cookies.push(c);
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeCookieObject: function (aStrippedHost, aCookie) {
|
_makeCookieObject: function(aStrippedHost, aCookie) {
|
||||||
var host = aCookie.host;
|
var host = aCookie.host;
|
||||||
var formattedHost = host.charAt(0) == "." ? host.substring(1, host.length) : host;
|
var formattedHost = host.charAt(0) == "." ? host.substring(1, host.length) : host;
|
||||||
var c = { name : aCookie.name,
|
var c = { name : aCookie.name,
|
||||||
|
|
@ -478,7 +478,7 @@ var gCookiesWindow = {
|
||||||
return c;
|
return c;
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadCookies: function () {
|
_loadCookies: function() {
|
||||||
var e = this._cm.enumerator;
|
var e = this._cm.enumerator;
|
||||||
var hostCount = { value: 0 };
|
var hostCount = { value: 0 };
|
||||||
this._hosts = {};
|
this._hosts = {};
|
||||||
|
|
@ -495,7 +495,7 @@ var gCookiesWindow = {
|
||||||
this._view._rowCount = hostCount.value;
|
this._view._rowCount = hostCount.value;
|
||||||
},
|
},
|
||||||
|
|
||||||
formatExpiresString: function (aExpires) {
|
formatExpiresString: function(aExpires) {
|
||||||
if (aExpires) {
|
if (aExpires) {
|
||||||
var date = new Date(1000 * aExpires);
|
var date = new Date(1000 * aExpires);
|
||||||
return this._ds.FormatDateTime("", this._ds.dateFormatLong,
|
return this._ds.FormatDateTime("", this._ds.dateFormatLong,
|
||||||
|
|
@ -510,7 +510,7 @@ var gCookiesWindow = {
|
||||||
return this._bundle.getString("expireAtEndOfSession");
|
return this._bundle.getString("expireAtEndOfSession");
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCookieData: function (aItem) {
|
_updateCookieData: function(aItem) {
|
||||||
var seln = this._view.selection;
|
var seln = this._view.selection;
|
||||||
var ids = ["name", "value", "host", "path", "isSecure", "expires"];
|
var ids = ["name", "value", "host", "path", "isSecure", "expires"];
|
||||||
var properties;
|
var properties;
|
||||||
|
|
@ -537,7 +537,7 @@ var gCookiesWindow = {
|
||||||
document.getElementById(property).value = properties[property];
|
document.getElementById(property).value = properties[property];
|
||||||
},
|
},
|
||||||
|
|
||||||
onCookieSelected: function () {
|
onCookieSelected: function() {
|
||||||
var properties, item;
|
var properties, item;
|
||||||
var seln = this._tree.view.selection;
|
var seln = this._tree.view.selection;
|
||||||
var hasRows = this._tree.view.rowCount > 0;
|
var hasRows = this._tree.view.rowCount > 0;
|
||||||
|
|
@ -575,7 +575,7 @@ var gCookiesWindow = {
|
||||||
removeSelectedCookies.disabled = !hasRows || !hasSelection;
|
removeSelectedCookies.disabled = !hasRows || !hasSelection;
|
||||||
},
|
},
|
||||||
|
|
||||||
performDeletion: function (deleteItems) {
|
performDeletion: function(deleteItems) {
|
||||||
var psvc = Components.classes["@mozilla.org/preferences-service;1"]
|
var psvc = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
.getService(Components.interfaces.nsIPrefBranch);
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
var blockFutureCookies = false;
|
var blockFutureCookies = false;
|
||||||
|
|
@ -588,7 +588,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteCookie: function () {
|
deleteCookie: function() {
|
||||||
// Selection Notes
|
// Selection Notes
|
||||||
// - Selection always moves to *NEXT* adjacent item unless item
|
// - Selection always moves to *NEXT* adjacent item unless item
|
||||||
// is last child at a given level in which case it moves to *PREVIOUS*
|
// is last child at a given level in which case it moves to *PREVIOUS*
|
||||||
|
|
@ -714,7 +714,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteAllCookies: function () {
|
deleteAllCookies: function() {
|
||||||
if (this._view._filtered) {
|
if (this._view._filtered) {
|
||||||
var rowCount = this._view.rowCount;
|
var rowCount = this._view.rowCount;
|
||||||
var deleteItems = [];
|
var deleteItems = [];
|
||||||
|
|
@ -733,7 +733,7 @@ var gCookiesWindow = {
|
||||||
this.focusFilterBox();
|
this.focusFilterBox();
|
||||||
},
|
},
|
||||||
|
|
||||||
onCookieKeyPress: function (aEvent) {
|
onCookieKeyPress: function(aEvent) {
|
||||||
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
|
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
|| aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
|
|| aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
|
||||||
|
|
@ -745,7 +745,7 @@ var gCookiesWindow = {
|
||||||
|
|
||||||
_lastSortProperty : "",
|
_lastSortProperty : "",
|
||||||
_lastSortAscending: false,
|
_lastSortAscending: false,
|
||||||
sort: function (aProperty) {
|
sort: function(aProperty) {
|
||||||
var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
|
var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
|
||||||
// Sort the Non-Filtered Host Collections
|
// Sort the Non-Filtered Host Collections
|
||||||
if (aProperty == "rawHost") {
|
if (aProperty == "rawHost") {
|
||||||
|
|
@ -798,7 +798,7 @@ var gCookiesWindow = {
|
||||||
this._lastSortProperty = aProperty;
|
this._lastSortProperty = aProperty;
|
||||||
},
|
},
|
||||||
|
|
||||||
clearFilter: function () {
|
clearFilter: function() {
|
||||||
// Revert to single-select in the tree
|
// Revert to single-select in the tree
|
||||||
this._tree.setAttribute("seltype", "single");
|
this._tree.setAttribute("seltype", "single");
|
||||||
|
|
||||||
|
|
@ -840,13 +840,13 @@ var gCookiesWindow = {
|
||||||
this._updateRemoveAllButton();
|
this._updateRemoveAllButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
_cookieMatchesFilter: function (aCookie) {
|
_cookieMatchesFilter: function(aCookie) {
|
||||||
return aCookie.rawHost.indexOf(this._view._filterValue) != -1 ||
|
return aCookie.rawHost.indexOf(this._view._filterValue) != -1 ||
|
||||||
aCookie.name.indexOf(this._view._filterValue) != -1 ||
|
aCookie.name.indexOf(this._view._filterValue) != -1 ||
|
||||||
aCookie.value.indexOf(this._view._filterValue) != -1;
|
aCookie.value.indexOf(this._view._filterValue) != -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_filterCookies: function (aFilterValue) {
|
_filterCookies: function(aFilterValue) {
|
||||||
this._view._filterValue = aFilterValue;
|
this._view._filterValue = aFilterValue;
|
||||||
var cookies = [];
|
var cookies = [];
|
||||||
for (var i = 0; i < gCookiesWindow._hostOrder.length; ++i) { //var host in gCookiesWindow._hosts) {
|
for (var i = 0; i < gCookiesWindow._hostOrder.length; ++i) { //var host in gCookiesWindow._hosts) {
|
||||||
|
|
@ -863,7 +863,7 @@ var gCookiesWindow = {
|
||||||
|
|
||||||
_lastSelectedRanges: [],
|
_lastSelectedRanges: [],
|
||||||
_openIndices: [],
|
_openIndices: [],
|
||||||
_saveState: function () {
|
_saveState: function() {
|
||||||
// Save selection
|
// Save selection
|
||||||
var seln = this._view.selection;
|
var seln = this._view.selection;
|
||||||
this._lastSelectedRanges = [];
|
this._lastSelectedRanges = [];
|
||||||
|
|
@ -883,7 +883,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateRemoveAllButton: function () {
|
_updateRemoveAllButton: function() {
|
||||||
let removeAllCookies = document.getElementById("removeAllCookies");
|
let removeAllCookies = document.getElementById("removeAllCookies");
|
||||||
removeAllCookies.disabled = this._view._rowCount == 0;
|
removeAllCookies.disabled = this._view._rowCount == 0;
|
||||||
|
|
||||||
|
|
@ -897,7 +897,7 @@ var gCookiesWindow = {
|
||||||
removeAllCookies.setAttribute("accesskey", this._bundle.getString(accessKeyStringID));
|
removeAllCookies.setAttribute("accesskey", this._bundle.getString(accessKeyStringID));
|
||||||
},
|
},
|
||||||
|
|
||||||
filter: function () {
|
filter: function() {
|
||||||
var filter = document.getElementById("filter").value;
|
var filter = document.getElementById("filter").value;
|
||||||
if (filter == "") {
|
if (filter == "") {
|
||||||
gCookiesWindow.clearFilter();
|
gCookiesWindow.clearFilter();
|
||||||
|
|
@ -930,18 +930,18 @@ var gCookiesWindow = {
|
||||||
this._updateRemoveAllButton();
|
this._updateRemoveAllButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
setFilter: function (aFilterString) {
|
setFilter: function(aFilterString) {
|
||||||
document.getElementById("filter").value = aFilterString;
|
document.getElementById("filter").value = aFilterString;
|
||||||
this.filter();
|
this.filter();
|
||||||
},
|
},
|
||||||
|
|
||||||
focusFilterBox: function () {
|
focusFilterBox: function() {
|
||||||
var filter = document.getElementById("filter");
|
var filter = document.getElementById("filter");
|
||||||
filter.focus();
|
filter.focus();
|
||||||
filter.select();
|
filter.select();
|
||||||
},
|
},
|
||||||
|
|
||||||
onWindowKeyPress: function (aEvent) {
|
onWindowKeyPress: function(aEvent) {
|
||||||
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
|
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ var gPrivacyPane = {
|
||||||
* label of the "Clear Now..." button.
|
* label of the "Clear Now..." button.
|
||||||
* Also restores the previously selected tab or tab index passed as argument.
|
* Also restores the previously selected tab or tab index passed as argument.
|
||||||
*/
|
*/
|
||||||
init: function ()
|
init: function()
|
||||||
{
|
{
|
||||||
this._inited = true;
|
this._inited = true;
|
||||||
var privacyPrefs = document.getElementById("privacyPrefs");
|
var privacyPrefs = document.getElementById("privacyPrefs");
|
||||||
|
|
@ -47,7 +47,7 @@ var gPrivacyPane = {
|
||||||
* Stores the identity of the current tab in preferences so that the selected
|
* Stores the identity of the current tab in preferences so that the selected
|
||||||
* tab can be persisted between openings of the preferences window.
|
* tab can be persisted between openings of the preferences window.
|
||||||
*/
|
*/
|
||||||
tabSelectionChanged: function ()
|
tabSelectionChanged: function()
|
||||||
{
|
{
|
||||||
if (!this._inited)
|
if (!this._inited)
|
||||||
return;
|
return;
|
||||||
|
|
@ -112,10 +112,10 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Initialize the history mode menulist based on the privacy preferences
|
* Initialize the history mode menulist based on the privacy preferences
|
||||||
*/
|
*/
|
||||||
initializeHistoryMode: function ()
|
initializeHistoryMode: function()
|
||||||
{
|
{
|
||||||
let mode;
|
let mode;
|
||||||
let getVal = function (aPref)
|
let getVal = function(aPref)
|
||||||
document.getElementById(aPref).value;
|
document.getElementById(aPref).value;
|
||||||
|
|
||||||
if (this._checkDefaultValues(this.prefsForDefault)) {
|
if (this._checkDefaultValues(this.prefsForDefault)) {
|
||||||
|
|
@ -133,7 +133,7 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Update the selected pane based on the history mode menulist
|
* Update the selected pane based on the history mode menulist
|
||||||
*/
|
*/
|
||||||
updateHistoryModePane: function ()
|
updateHistoryModePane: function()
|
||||||
{
|
{
|
||||||
let selectedIndex = -1;
|
let selectedIndex = -1;
|
||||||
switch (document.getElementById("historyMode").value) {
|
switch (document.getElementById("historyMode").value) {
|
||||||
|
|
@ -154,7 +154,7 @@ var gPrivacyPane = {
|
||||||
* Update the private browsing auto-start pref and the history mode
|
* Update the private browsing auto-start pref and the history mode
|
||||||
* micro-management prefs based on the history mode menulist
|
* micro-management prefs based on the history mode menulist
|
||||||
*/
|
*/
|
||||||
updateHistoryModePrefs: function ()
|
updateHistoryModePrefs: function()
|
||||||
{
|
{
|
||||||
let pref = document.getElementById("browser.privatebrowsing.autostart");
|
let pref = document.getElementById("browser.privatebrowsing.autostart");
|
||||||
switch (document.getElementById("historyMode").value) {
|
switch (document.getElementById("historyMode").value) {
|
||||||
|
|
@ -187,13 +187,13 @@ var gPrivacyPane = {
|
||||||
* Update the privacy micro-management controls based on the
|
* Update the privacy micro-management controls based on the
|
||||||
* value of the private browsing auto-start checkbox.
|
* value of the private browsing auto-start checkbox.
|
||||||
*/
|
*/
|
||||||
updatePrivacyMicroControls: function ()
|
updatePrivacyMicroControls: function()
|
||||||
{
|
{
|
||||||
if (document.getElementById("historyMode").value == "custom") {
|
if (document.getElementById("historyMode").value == "custom") {
|
||||||
let disabled = this._autoStartPrivateBrowsing =
|
let disabled = this._autoStartPrivateBrowsing =
|
||||||
document.getElementById("privateBrowsingAutoStart").checked;
|
document.getElementById("privateBrowsingAutoStart").checked;
|
||||||
this.dependentControls
|
this.dependentControls
|
||||||
.forEach(function (aElement)
|
.forEach(function(aElement)
|
||||||
document.getElementById(aElement).disabled = disabled);
|
document.getElementById(aElement).disabled = disabled);
|
||||||
|
|
||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
|
|
@ -229,7 +229,7 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Initialize the starting state for the auto-start private browsing mode pref reverter.
|
* Initialize the starting state for the auto-start private browsing mode pref reverter.
|
||||||
*/
|
*/
|
||||||
initAutoStartPrivateBrowsingReverter: function ()
|
initAutoStartPrivateBrowsingReverter: function()
|
||||||
{
|
{
|
||||||
let mode = document.getElementById("historyMode");
|
let mode = document.getElementById("historyMode");
|
||||||
let autoStart = document.getElementById("privateBrowsingAutoStart");
|
let autoStart = document.getElementById("privateBrowsingAutoStart");
|
||||||
|
|
@ -239,7 +239,7 @@ var gPrivacyPane = {
|
||||||
|
|
||||||
_lastMode: null,
|
_lastMode: null,
|
||||||
_lasCheckState: null,
|
_lasCheckState: null,
|
||||||
updateAutostart: function () {
|
updateAutostart: function() {
|
||||||
let mode = document.getElementById("historyMode");
|
let mode = document.getElementById("historyMode");
|
||||||
let autoStart = document.getElementById("privateBrowsingAutoStart");
|
let autoStart = document.getElementById("privateBrowsingAutoStart");
|
||||||
let pref = document.getElementById("browser.privatebrowsing.autostart");
|
let pref = document.getElementById("browser.privatebrowsing.autostart");
|
||||||
|
|
@ -331,7 +331,7 @@ var gPrivacyPane = {
|
||||||
* enables/disables the rest of the cookie UI accordingly, returning true
|
* enables/disables the rest of the cookie UI accordingly, returning true
|
||||||
* if cookies are enabled.
|
* if cookies are enabled.
|
||||||
*/
|
*/
|
||||||
readAcceptCookies: function ()
|
readAcceptCookies: function()
|
||||||
{
|
{
|
||||||
var pref = document.getElementById("network.cookie.cookieBehavior");
|
var pref = document.getElementById("network.cookie.cookieBehavior");
|
||||||
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
|
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
|
||||||
|
|
@ -352,7 +352,7 @@ var gPrivacyPane = {
|
||||||
* Enables/disables the "keep until" label and menulist in response to the
|
* Enables/disables the "keep until" label and menulist in response to the
|
||||||
* "accept cookies" checkbox being checked or unchecked.
|
* "accept cookies" checkbox being checked or unchecked.
|
||||||
*/
|
*/
|
||||||
writeAcceptCookies: function ()
|
writeAcceptCookies: function()
|
||||||
{
|
{
|
||||||
var accept = document.getElementById("acceptCookies");
|
var accept = document.getElementById("acceptCookies");
|
||||||
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
|
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
|
||||||
|
|
@ -367,7 +367,7 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
|
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
|
||||||
*/
|
*/
|
||||||
readAcceptThirdPartyCookies: function ()
|
readAcceptThirdPartyCookies: function()
|
||||||
{
|
{
|
||||||
var pref = document.getElementById("network.cookie.cookieBehavior");
|
var pref = document.getElementById("network.cookie.cookieBehavior");
|
||||||
switch (pref.value)
|
switch (pref.value)
|
||||||
|
|
@ -385,7 +385,7 @@ var gPrivacyPane = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
writeAcceptThirdPartyCookies: function ()
|
writeAcceptThirdPartyCookies: function()
|
||||||
{
|
{
|
||||||
var accept = document.getElementById("acceptThirdPartyMenu").selectedItem;
|
var accept = document.getElementById("acceptThirdPartyMenu").selectedItem;
|
||||||
switch (accept.value)
|
switch (accept.value)
|
||||||
|
|
@ -404,7 +404,7 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Displays fine-grained, per-site preferences for cookies.
|
* Displays fine-grained, per-site preferences for cookies.
|
||||||
*/
|
*/
|
||||||
showCookieExceptions: function ()
|
showCookieExceptions: function()
|
||||||
{
|
{
|
||||||
var bundlePreferences = document.getElementById("bundlePreferences");
|
var bundlePreferences = document.getElementById("bundlePreferences");
|
||||||
var params = { blockVisible : true,
|
var params = { blockVisible : true,
|
||||||
|
|
@ -422,7 +422,7 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Displays all the user's cookies in a dialog.
|
* Displays all the user's cookies in a dialog.
|
||||||
*/
|
*/
|
||||||
showCookies: function (aCategory)
|
showCookies: function(aCategory)
|
||||||
{
|
{
|
||||||
document.documentElement.openWindow("Browser:Cookies",
|
document.documentElement.openWindow("Browser:Cookies",
|
||||||
"chrome://browser/content/preferences/cookies.xul",
|
"chrome://browser/content/preferences/cookies.xul",
|
||||||
|
|
@ -442,7 +442,7 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Displays the Clear Private Data settings dialog.
|
* Displays the Clear Private Data settings dialog.
|
||||||
*/
|
*/
|
||||||
showClearPrivateDataSettings: function ()
|
showClearPrivateDataSettings: function()
|
||||||
{
|
{
|
||||||
document.documentElement.openSubDialog("chrome://browser/content/preferences/sanitize.xul",
|
document.documentElement.openSubDialog("chrome://browser/content/preferences/sanitize.xul",
|
||||||
"", null);
|
"", null);
|
||||||
|
|
@ -453,7 +453,7 @@ var gPrivacyPane = {
|
||||||
* Displays a dialog from which individual parts of private data may be
|
* Displays a dialog from which individual parts of private data may be
|
||||||
* cleared.
|
* cleared.
|
||||||
*/
|
*/
|
||||||
clearPrivateDataNow: function (aClearEverything)
|
clearPrivateDataNow: function(aClearEverything)
|
||||||
{
|
{
|
||||||
var ts = document.getElementById("privacy.sanitize.timeSpan");
|
var ts = document.getElementById("privacy.sanitize.timeSpan");
|
||||||
var timeSpanOrig = ts.value;
|
var timeSpanOrig = ts.value;
|
||||||
|
|
@ -475,7 +475,7 @@ var gPrivacyPane = {
|
||||||
* Enables or disables the "Settings..." button depending
|
* Enables or disables the "Settings..." button depending
|
||||||
* on the privacy.sanitize.sanitizeOnShutdown preference value
|
* on the privacy.sanitize.sanitizeOnShutdown preference value
|
||||||
*/
|
*/
|
||||||
_updateSanitizeSettingsButton: function () {
|
_updateSanitizeSettingsButton: function() {
|
||||||
var settingsButton = document.getElementById("clearDataSettings");
|
var settingsButton = document.getElementById("clearDataSettings");
|
||||||
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
|
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* closes.
|
* closes.
|
||||||
*/
|
*/
|
||||||
var SelectBookmarkDialog = {
|
var SelectBookmarkDialog = {
|
||||||
init: function () {
|
init: function() {
|
||||||
document.getElementById("bookmarks").place =
|
document.getElementById("bookmarks").place =
|
||||||
"place:queryType=1&folder=" + PlacesUIUtils.allBookmarksFolderId;
|
"place:queryType=1&folder=" + PlacesUIUtils.allBookmarksFolderId;
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ var SelectBookmarkDialog = {
|
||||||
* Update the disabled state of the OK button as the user changes the
|
* Update the disabled state of the OK button as the user changes the
|
||||||
* selection within the view.
|
* selection within the view.
|
||||||
*/
|
*/
|
||||||
selectionChanged: function () {
|
selectionChanged: function() {
|
||||||
var accept = document.documentElement.getButton("accept");
|
var accept = document.documentElement.getButton("accept");
|
||||||
var bookmarks = document.getElementById("bookmarks");
|
var bookmarks = document.getElementById("bookmarks");
|
||||||
var disableAcceptButton = true;
|
var disableAcceptButton = true;
|
||||||
|
|
@ -38,7 +38,7 @@ var SelectBookmarkDialog = {
|
||||||
accept.disabled = disableAcceptButton;
|
accept.disabled = disableAcceptButton;
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemDblClick: function () {
|
onItemDblClick: function() {
|
||||||
var bookmarks = document.getElementById("bookmarks");
|
var bookmarks = document.getElementById("bookmarks");
|
||||||
var selectedNode = bookmarks.selectedNode;
|
var selectedNode = bookmarks.selectedNode;
|
||||||
if (selectedNode && PlacesUtils.nodeIsURI(selectedNode)) {
|
if (selectedNode && PlacesUtils.nodeIsURI(selectedNode)) {
|
||||||
|
|
@ -54,7 +54,7 @@ var SelectBookmarkDialog = {
|
||||||
* User accepts their selection. Set all the selected URLs or the contents
|
* User accepts their selection. Set all the selected URLs or the contents
|
||||||
* of the selected folder as the list of homepages.
|
* of the selected folder as the list of homepages.
|
||||||
*/
|
*/
|
||||||
accept: function () {
|
accept: function() {
|
||||||
var bookmarks = document.getElementById("bookmarks");
|
var bookmarks = document.getElementById("bookmarks");
|
||||||
NS_ASSERT(bookmarks.hasSelection,
|
NS_ASSERT(bookmarks.hasSelection,
|
||||||
"Should not be able to accept dialog if there is no selected URL!");
|
"Should not be able to accept dialog if there is no selected URL!");
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const BROWSER_SUGGEST_PREF = "browser.search.suggest.enabled";
|
||||||
var gEngineView = null;
|
var gEngineView = null;
|
||||||
|
|
||||||
var gEngineManagerDialog = {
|
var gEngineManagerDialog = {
|
||||||
init: function () {
|
init: function() {
|
||||||
gEngineView = new EngineView(new EngineStore());
|
gEngineView = new EngineView(new EngineStore());
|
||||||
|
|
||||||
var suggestEnabled = Services.prefs.getBoolPref(BROWSER_SUGGEST_PREF);
|
var suggestEnabled = Services.prefs.getBoolPref(BROWSER_SUGGEST_PREF);
|
||||||
|
|
@ -31,12 +31,12 @@ var gEngineManagerDialog = {
|
||||||
Services.obs.addObserver(this, "browser-search-engine-modified", false);
|
Services.obs.addObserver(this, "browser-search-engine-modified", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function() {
|
||||||
// Remove the observer
|
// Remove the observer
|
||||||
Services.obs.removeObserver(this, "browser-search-engine-modified");
|
Services.obs.removeObserver(this, "browser-search-engine-modified");
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (aEngine, aTopic, aVerb) {
|
observe: function(aEngine, aTopic, aVerb) {
|
||||||
if (aTopic == "browser-search-engine-modified") {
|
if (aTopic == "browser-search-engine-modified") {
|
||||||
aEngine.QueryInterface(Ci.nsISearchEngine);
|
aEngine.QueryInterface(Ci.nsISearchEngine);
|
||||||
switch (aVerb) {
|
switch (aVerb) {
|
||||||
|
|
@ -57,7 +57,7 @@ var gEngineManagerDialog = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onOK: function () {
|
onOK: function() {
|
||||||
// Set the preference
|
// Set the preference
|
||||||
var newSuggestEnabled = document.getElementById("enableSuggest").checked;
|
var newSuggestEnabled = document.getElementById("enableSuggest").checked;
|
||||||
Services.prefs.setBoolPref(BROWSER_SUGGEST_PREF, newSuggestEnabled);
|
Services.prefs.setBoolPref(BROWSER_SUGGEST_PREF, newSuggestEnabled);
|
||||||
|
|
@ -66,23 +66,23 @@ var gEngineManagerDialog = {
|
||||||
gEngineView._engineStore.commit();
|
gEngineView._engineStore.commit();
|
||||||
},
|
},
|
||||||
|
|
||||||
onRestoreDefaults: function () {
|
onRestoreDefaults: function() {
|
||||||
var num = gEngineView._engineStore.restoreDefaultEngines();
|
var num = gEngineView._engineStore.restoreDefaultEngines();
|
||||||
gEngineView.rowCountChanged(0, num);
|
gEngineView.rowCountChanged(0, num);
|
||||||
gEngineView.invalidate();
|
gEngineView.invalidate();
|
||||||
},
|
},
|
||||||
|
|
||||||
showRestoreDefaults: function (val) {
|
showRestoreDefaults: function(val) {
|
||||||
document.documentElement.getButton("extra2").disabled = !val;
|
document.documentElement.getButton("extra2").disabled = !val;
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAddEngines: function () {
|
loadAddEngines: function() {
|
||||||
this.onOK();
|
this.onOK();
|
||||||
window.opener.BrowserSearch.loadAddEngines();
|
window.opener.BrowserSearch.loadAddEngines();
|
||||||
window.close();
|
window.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function () {
|
remove: function() {
|
||||||
gEngineView._engineStore.removeEngine(gEngineView.selectedEngine);
|
gEngineView._engineStore.removeEngine(gEngineView.selectedEngine);
|
||||||
var index = gEngineView.selectedIndex;
|
var index = gEngineView.selectedIndex;
|
||||||
gEngineView.rowCountChanged(index, -1);
|
gEngineView.rowCountChanged(index, -1);
|
||||||
|
|
@ -97,7 +97,7 @@ var gEngineManagerDialog = {
|
||||||
* @param aDir
|
* @param aDir
|
||||||
* -1 to move the selected engine down, +1 to move it up.
|
* -1 to move the selected engine down, +1 to move it up.
|
||||||
*/
|
*/
|
||||||
bump: function (aDir) {
|
bump: function(aDir) {
|
||||||
var selectedEngine = gEngineView.selectedEngine;
|
var selectedEngine = gEngineView.selectedEngine;
|
||||||
var newIndex = gEngineView.selectedIndex - aDir;
|
var newIndex = gEngineView.selectedIndex - aDir;
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ var gEngineManagerDialog = {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
onSelect: function () {
|
onSelect: function() {
|
||||||
// Buttons only work if an engine is selected and it's not the last engine,
|
// Buttons only work if an engine is selected and it's not the last engine,
|
||||||
// the latter is true when the selected is first and last at the same time.
|
// the latter is true when the selected is first and last at the same time.
|
||||||
var lastSelected = (gEngineView.selectedIndex == gEngineView.lastIndex);
|
var lastSelected = (gEngineView.selectedIndex == gEngineView.lastIndex);
|
||||||
|
|
@ -197,7 +197,7 @@ function EngineMoveOp(aEngineClone, aNewIndex) {
|
||||||
EngineMoveOp.prototype = {
|
EngineMoveOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
_newIndex: null,
|
_newIndex: null,
|
||||||
commit: function () {
|
commit: function() {
|
||||||
Services.search.moveEngine(this._engine, this._newIndex);
|
Services.search.moveEngine(this._engine, this._newIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +209,7 @@ function EngineRemoveOp(aEngineClone) {
|
||||||
}
|
}
|
||||||
EngineRemoveOp.prototype = {
|
EngineRemoveOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
commit: function () {
|
commit: function() {
|
||||||
Services.search.removeEngine(this._engine);
|
Services.search.removeEngine(this._engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,7 +223,7 @@ function EngineUnhideOp(aEngineClone, aNewIndex) {
|
||||||
EngineUnhideOp.prototype = {
|
EngineUnhideOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
_newIndex: null,
|
_newIndex: null,
|
||||||
commit: function () {
|
commit: function() {
|
||||||
this._engine.hidden = false;
|
this._engine.hidden = false;
|
||||||
Services.search.moveEngine(this._engine, this._newIndex);
|
Services.search.moveEngine(this._engine, this._newIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +241,7 @@ EngineChangeOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
_prop: null,
|
_prop: null,
|
||||||
_newValue: null,
|
_newValue: null,
|
||||||
commit: function () {
|
commit: function() {
|
||||||
this._engine[this._prop] = this._newValue;
|
this._engine[this._prop] = this._newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ function EngineStore() {
|
||||||
this._ops = [];
|
this._ops = [];
|
||||||
|
|
||||||
// check if we need to disable the restore defaults button
|
// check if we need to disable the restore defaults button
|
||||||
var someHidden = this._defaultEngines.some(function (e) e.hidden);
|
var someHidden = this._defaultEngines.some(function(e) e.hidden);
|
||||||
gEngineManagerDialog.showRestoreDefaults(someHidden);
|
gEngineManagerDialog.showRestoreDefaults(someHidden);
|
||||||
}
|
}
|
||||||
EngineStore.prototype = {
|
EngineStore.prototype = {
|
||||||
|
|
@ -269,11 +269,11 @@ EngineStore.prototype = {
|
||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getIndexForEngine: function (aEngine) {
|
_getIndexForEngine: function(aEngine) {
|
||||||
return this._engines.indexOf(aEngine);
|
return this._engines.indexOf(aEngine);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getEngineByName: function (aName) {
|
_getEngineByName: function(aName) {
|
||||||
for each (var engine in this._engines)
|
for each (var engine in this._engines)
|
||||||
if (engine.name == aName)
|
if (engine.name == aName)
|
||||||
return engine;
|
return engine;
|
||||||
|
|
@ -281,7 +281,7 @@ EngineStore.prototype = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_cloneEngine: function (aEngine) {
|
_cloneEngine: function(aEngine) {
|
||||||
var clonedObj={};
|
var clonedObj={};
|
||||||
for (var i in aEngine)
|
for (var i in aEngine)
|
||||||
clonedObj[i] = aEngine[i];
|
clonedObj[i] = aEngine[i];
|
||||||
|
|
@ -290,11 +290,11 @@ EngineStore.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Callback for Array's some(). A thisObj must be passed to some()
|
// Callback for Array's some(). A thisObj must be passed to some()
|
||||||
_isSameEngine: function (aEngineClone) {
|
_isSameEngine: function(aEngineClone) {
|
||||||
return aEngineClone.originalEngine == this.originalEngine;
|
return aEngineClone.originalEngine == this.originalEngine;
|
||||||
},
|
},
|
||||||
|
|
||||||
commit: function () {
|
commit: function() {
|
||||||
var currentEngine = this._cloneEngine(Services.search.currentEngine);
|
var currentEngine = this._cloneEngine(Services.search.currentEngine);
|
||||||
for (var i = 0; i < this._ops.length; i++)
|
for (var i = 0; i < this._ops.length; i++)
|
||||||
this._ops[i].commit();
|
this._ops[i].commit();
|
||||||
|
|
@ -306,11 +306,11 @@ EngineStore.prototype = {
|
||||||
Services.search.currentEngine = currentEngine.originalEngine;
|
Services.search.currentEngine = currentEngine.originalEngine;
|
||||||
},
|
},
|
||||||
|
|
||||||
addEngine: function (aEngine) {
|
addEngine: function(aEngine) {
|
||||||
this._engines.push(this._cloneEngine(aEngine));
|
this._engines.push(this._cloneEngine(aEngine));
|
||||||
},
|
},
|
||||||
|
|
||||||
moveEngine: function (aEngine, aNewIndex) {
|
moveEngine: function(aEngine, aNewIndex) {
|
||||||
if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
|
if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
|
||||||
throw new Error("ES_moveEngine: invalid aNewIndex!");
|
throw new Error("ES_moveEngine: invalid aNewIndex!");
|
||||||
var index = this._getIndexForEngine(aEngine);
|
var index = this._getIndexForEngine(aEngine);
|
||||||
|
|
@ -327,7 +327,7 @@ EngineStore.prototype = {
|
||||||
this._ops.push(new EngineMoveOp(aEngine, aNewIndex));
|
this._ops.push(new EngineMoveOp(aEngine, aNewIndex));
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEngine: function (aEngine) {
|
removeEngine: function(aEngine) {
|
||||||
var index = this._getIndexForEngine(aEngine);
|
var index = this._getIndexForEngine(aEngine);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
throw new Error("invalid engine?");
|
throw new Error("invalid engine?");
|
||||||
|
|
@ -338,7 +338,7 @@ EngineStore.prototype = {
|
||||||
gEngineManagerDialog.showRestoreDefaults(true);
|
gEngineManagerDialog.showRestoreDefaults(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
restoreDefaultEngines: function () {
|
restoreDefaultEngines: function() {
|
||||||
var added = 0;
|
var added = 0;
|
||||||
|
|
||||||
for (var i = 0; i < this._defaultEngines.length; ++i) {
|
for (var i = 0; i < this._defaultEngines.length; ++i) {
|
||||||
|
|
@ -358,7 +358,7 @@ EngineStore.prototype = {
|
||||||
return added;
|
return added;
|
||||||
},
|
},
|
||||||
|
|
||||||
changeEngine: function (aEngine, aProp, aNewValue) {
|
changeEngine: function(aEngine, aProp, aNewValue) {
|
||||||
var index = this._getIndexForEngine(aEngine);
|
var index = this._getIndexForEngine(aEngine);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
throw new Error("invalid engine?");
|
throw new Error("invalid engine?");
|
||||||
|
|
@ -367,8 +367,8 @@ EngineStore.prototype = {
|
||||||
this._ops.push(new EngineChangeOp(aEngine, aProp, aNewValue));
|
this._ops.push(new EngineChangeOp(aEngine, aProp, aNewValue));
|
||||||
},
|
},
|
||||||
|
|
||||||
reloadIcons: function () {
|
reloadIcons: function() {
|
||||||
this._engines.forEach(function (e) {
|
this._engines.forEach(function(e) {
|
||||||
e.uri = e.originalEngine.uri;
|
e.uri = e.originalEngine.uri;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -398,19 +398,19 @@ EngineView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
rowCountChanged: function (index, count) {
|
rowCountChanged: function(index, count) {
|
||||||
this.tree.rowCountChanged(index, count);
|
this.tree.rowCountChanged(index, count);
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidate: function () {
|
invalidate: function() {
|
||||||
this.tree.invalidate();
|
this.tree.invalidate();
|
||||||
},
|
},
|
||||||
|
|
||||||
ensureRowIsVisible: function (index) {
|
ensureRowIsVisible: function(index) {
|
||||||
this.tree.ensureRowIsVisible(index);
|
this.tree.ensureRowIsVisible(index);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSourceIndexFromDrag: function (dataTransfer) {
|
getSourceIndexFromDrag: function(dataTransfer) {
|
||||||
return parseInt(dataTransfer.getData(ENGINE_FLAVOR));
|
return parseInt(dataTransfer.getData(ENGINE_FLAVOR));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ this.DocumentUtils = {
|
||||||
* @return object
|
* @return object
|
||||||
* Form data encoded in an object.
|
* Form data encoded in an object.
|
||||||
*/
|
*/
|
||||||
getFormData: function (aDocument) {
|
getFormData: function(aDocument) {
|
||||||
let formNodes = aDocument.evaluate(
|
let formNodes = aDocument.evaluate(
|
||||||
XPathGenerator.restorableFormNodes,
|
XPathGenerator.restorableFormNodes,
|
||||||
aDocument,
|
aDocument,
|
||||||
|
|
@ -117,7 +117,7 @@ this.DocumentUtils = {
|
||||||
* @param aData
|
* @param aData
|
||||||
* Object defining form data.
|
* Object defining form data.
|
||||||
*/
|
*/
|
||||||
mergeFormData: function (aDocument, aData) {
|
mergeFormData: function(aDocument, aData) {
|
||||||
if ("xpath" in aData) {
|
if ("xpath" in aData) {
|
||||||
for each (let [xpath, value] in Iterator(aData.xpath)) {
|
for each (let [xpath, value] in Iterator(aData.xpath)) {
|
||||||
let node = XPathGenerator.resolve(aDocument, xpath);
|
let node = XPathGenerator.resolve(aDocument, xpath);
|
||||||
|
|
@ -155,7 +155,7 @@ this.DocumentUtils = {
|
||||||
* DOMDocument node belongs to. If not defined, node.ownerDocument
|
* DOMDocument node belongs to. If not defined, node.ownerDocument
|
||||||
* is used.
|
* is used.
|
||||||
*/
|
*/
|
||||||
restoreFormValue: function (aNode, aValue, aDocument) {
|
restoreFormValue: function(aNode, aValue, aDocument) {
|
||||||
aDocument = aDocument || aNode.ownerDocument;
|
aDocument = aDocument || aNode.ownerDocument;
|
||||||
|
|
||||||
let eventType;
|
let eventType;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ this.SessionStorage = {
|
||||||
* @param aFullData
|
* @param aFullData
|
||||||
* always return privacy sensitive data (use with care)
|
* always return privacy sensitive data (use with care)
|
||||||
*/
|
*/
|
||||||
serialize: function (aDocShell, aFullData) {
|
serialize: function(aDocShell, aFullData) {
|
||||||
return DomStorage.read(aDocShell, aFullData);
|
return DomStorage.read(aDocShell, aFullData);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ this.SessionStorage = {
|
||||||
* @param aStorageData
|
* @param aStorageData
|
||||||
* Storage data to be restored
|
* Storage data to be restored
|
||||||
*/
|
*/
|
||||||
deserialize: function (aDocShell, aStorageData) {
|
deserialize: function(aDocShell, aStorageData) {
|
||||||
DomStorage.write(aDocShell, aStorageData);
|
DomStorage.write(aDocShell, aStorageData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -46,7 +46,7 @@ var DomStorage = {
|
||||||
* @param aFullData
|
* @param aFullData
|
||||||
* Always return privacy sensitive data (use with care)
|
* Always return privacy sensitive data (use with care)
|
||||||
*/
|
*/
|
||||||
read: function (aDocShell, aFullData) {
|
read: function(aDocShell, aFullData) {
|
||||||
let data = {};
|
let data = {};
|
||||||
let isPinned = aDocShell.isAppTab;
|
let isPinned = aDocShell.isAppTab;
|
||||||
let shistory = aDocShell.sessionHistory;
|
let shistory = aDocShell.sessionHistory;
|
||||||
|
|
@ -81,7 +81,7 @@ var DomStorage = {
|
||||||
* @param aStorageData
|
* @param aStorageData
|
||||||
* Storage data to be restored
|
* Storage data to be restored
|
||||||
*/
|
*/
|
||||||
write: function (aDocShell, aStorageData) {
|
write: function(aDocShell, aStorageData) {
|
||||||
for (let [host, data] in Iterator(aStorageData)) {
|
for (let [host, data] in Iterator(aStorageData)) {
|
||||||
let uri = Services.io.newURI(host, null, null);
|
let uri = Services.io.newURI(host, null, null);
|
||||||
let principal = Services.scriptSecurityManager.getDocShellCodebasePrincipal(uri, aDocShell);
|
let principal = Services.scriptSecurityManager.getDocShellCodebasePrincipal(uri, aDocShell);
|
||||||
|
|
@ -116,7 +116,7 @@ var DomStorage = {
|
||||||
* @param aDocShell
|
* @param aDocShell
|
||||||
* A tab's docshell (containing the sessionStorage)
|
* A tab's docshell (containing the sessionStorage)
|
||||||
*/
|
*/
|
||||||
_readEntry: function (aPrincipal, aDocShell) {
|
_readEntry: function(aPrincipal, aDocShell) {
|
||||||
let hostData = {};
|
let hostData = {};
|
||||||
let storage;
|
let storage;
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ var History = {
|
||||||
* @param aDocShell
|
* @param aDocShell
|
||||||
* That tab's docshell
|
* That tab's docshell
|
||||||
*/
|
*/
|
||||||
getPrincipalForEntry: function (aHistory,
|
getPrincipalForEntry: function(aHistory,
|
||||||
aIndex,
|
aIndex,
|
||||||
aDocShell) {
|
aDocShell) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,7 @@ this.XPathGenerator = {
|
||||||
/**
|
/**
|
||||||
* Generates an approximate XPath query to an (X)HTML node
|
* Generates an approximate XPath query to an (X)HTML node
|
||||||
*/
|
*/
|
||||||
generate: function (aNode) {
|
generate: function(aNode) {
|
||||||
// have we reached the document node already?
|
// have we reached the document node already?
|
||||||
if (!aNode.parentNode)
|
if (!aNode.parentNode)
|
||||||
return "";
|
return "";
|
||||||
|
|
@ -46,7 +46,7 @@ this.XPathGenerator = {
|
||||||
/**
|
/**
|
||||||
* Resolves an XPath query generated by XPathGenerator.generate
|
* Resolves an XPath query generated by XPathGenerator.generate
|
||||||
*/
|
*/
|
||||||
resolve: function (aDocument, aQuery) {
|
resolve: function(aDocument, aQuery) {
|
||||||
let xptype = Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
|
let xptype = Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
|
||||||
return aDocument.evaluate(aQuery, aDocument, this.resolveNS, xptype, null).singleNodeValue;
|
return aDocument.evaluate(aQuery, aDocument, this.resolveNS, xptype, null).singleNodeValue;
|
||||||
},
|
},
|
||||||
|
|
@ -54,14 +54,14 @@ this.XPathGenerator = {
|
||||||
/**
|
/**
|
||||||
* Namespace resolver for the above XPath resolver
|
* Namespace resolver for the above XPath resolver
|
||||||
*/
|
*/
|
||||||
resolveNS: function (aPrefix) {
|
resolveNS: function(aPrefix) {
|
||||||
return XPathGenerator.namespaceURIs[aPrefix] || null;
|
return XPathGenerator.namespaceURIs[aPrefix] || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns valid XPath for the given node (usually just the local name itself)
|
* @returns valid XPath for the given node (usually just the local name itself)
|
||||||
*/
|
*/
|
||||||
escapeName: function (aName) {
|
escapeName: function(aName) {
|
||||||
// we can't just use the node's local name, if it contains
|
// we can't just use the node's local name, if it contains
|
||||||
// special characters (cf. bug 485482)
|
// special characters (cf. bug 485482)
|
||||||
return /^\w+$/.test(aName) ? aName :
|
return /^\w+$/.test(aName) ? aName :
|
||||||
|
|
@ -71,7 +71,7 @@ this.XPathGenerator = {
|
||||||
/**
|
/**
|
||||||
* @returns a properly quoted string to insert into an XPath query
|
* @returns a properly quoted string to insert into an XPath query
|
||||||
*/
|
*/
|
||||||
quoteArgument: function (aArg) {
|
quoteArgument: function(aArg) {
|
||||||
return !/'/.test(aArg) ? "'" + aArg + "'" :
|
return !/'/.test(aArg) ? "'" + aArg + "'" :
|
||||||
!/"/.test(aArg) ? '"' + aArg + '"' :
|
!/"/.test(aArg) ? '"' + aArg + '"' :
|
||||||
"concat('" + aArg.replace(/'+/g, "',\"$&\",'") + "')";
|
"concat('" + aArg.replace(/'+/g, "',\"$&\",'") + "')";
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@ XPCOMUtils.defineLazyModuleGetter(this, "console",
|
||||||
"resource://gre/modules/Console.jsm");
|
"resource://gre/modules/Console.jsm");
|
||||||
|
|
||||||
// An encoder to UTF-8.
|
// An encoder to UTF-8.
|
||||||
XPCOMUtils.defineLazyGetter(this, "gEncoder", function () {
|
XPCOMUtils.defineLazyGetter(this, "gEncoder", function() {
|
||||||
return new TextEncoder();
|
return new TextEncoder();
|
||||||
});
|
});
|
||||||
// A decoder.
|
// A decoder.
|
||||||
XPCOMUtils.defineLazyGetter(this, "gDecoder", function () {
|
XPCOMUtils.defineLazyGetter(this, "gDecoder", function() {
|
||||||
return new TextDecoder();
|
return new TextDecoder();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -57,37 +57,37 @@ this._SessionFile = {
|
||||||
* A promise fulfilled once initialization (either synchronous or
|
* A promise fulfilled once initialization (either synchronous or
|
||||||
* asynchronous) is complete.
|
* asynchronous) is complete.
|
||||||
*/
|
*/
|
||||||
promiseInitialized: function () {
|
promiseInitialized: function() {
|
||||||
return SessionFileInternal.promiseInitialized;
|
return SessionFileInternal.promiseInitialized;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Read the contents of the session file, asynchronously.
|
* Read the contents of the session file, asynchronously.
|
||||||
*/
|
*/
|
||||||
read: function () {
|
read: function() {
|
||||||
return SessionFileInternal.read();
|
return SessionFileInternal.read();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Read the contents of the session file, synchronously.
|
* Read the contents of the session file, synchronously.
|
||||||
*/
|
*/
|
||||||
syncRead: function () {
|
syncRead: function() {
|
||||||
return SessionFileInternal.syncRead();
|
return SessionFileInternal.syncRead();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Write the contents of the session file, asynchronously.
|
* Write the contents of the session file, asynchronously.
|
||||||
*/
|
*/
|
||||||
write: function (aData) {
|
write: function(aData) {
|
||||||
return SessionFileInternal.write(aData);
|
return SessionFileInternal.write(aData);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Create a backup copy, asynchronously.
|
* Create a backup copy, asynchronously.
|
||||||
*/
|
*/
|
||||||
createBackupCopy: function () {
|
createBackupCopy: function() {
|
||||||
return SessionFileInternal.createBackupCopy();
|
return SessionFileInternal.createBackupCopy();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Wipe the contents of the session file, asynchronously.
|
* Wipe the contents of the session file, asynchronously.
|
||||||
*/
|
*/
|
||||||
wipe: function () {
|
wipe: function() {
|
||||||
return SessionFileInternal.wipe();
|
return SessionFileInternal.wipe();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -105,7 +105,7 @@ const TaskUtils = {
|
||||||
* @return {Promise} A promise behaving as |promise|, but with additional
|
* @return {Promise} A promise behaving as |promise|, but with additional
|
||||||
* logging in case of uncaught error.
|
* logging in case of uncaught error.
|
||||||
*/
|
*/
|
||||||
captureErrors: function (promise) {
|
captureErrors: function(promise) {
|
||||||
return promise.then(
|
return promise.then(
|
||||||
null,
|
null,
|
||||||
function onError(reason) {
|
function onError(reason) {
|
||||||
|
|
@ -152,7 +152,7 @@ var SessionFileInternal = {
|
||||||
* A path to read the file from.
|
* A path to read the file from.
|
||||||
* @returns string if successful, undefined otherwise.
|
* @returns string if successful, undefined otherwise.
|
||||||
*/
|
*/
|
||||||
readAuxSync: function (aPath) {
|
readAuxSync: function(aPath) {
|
||||||
let text;
|
let text;
|
||||||
try {
|
try {
|
||||||
let file = new FileUtils.File(aPath);
|
let file = new FileUtils.File(aPath);
|
||||||
|
|
@ -184,7 +184,7 @@ var SessionFileInternal = {
|
||||||
* happened between backup and write), attempt to read the sessionstore.bak
|
* happened between backup and write), attempt to read the sessionstore.bak
|
||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
syncRead: function () {
|
syncRead: function() {
|
||||||
// First read the sessionstore.js.
|
// First read the sessionstore.js.
|
||||||
let text = this.readAuxSync(this.path);
|
let text = this.readAuxSync(this.path);
|
||||||
if (typeof text === "undefined") {
|
if (typeof text === "undefined") {
|
||||||
|
|
@ -204,9 +204,9 @@ var SessionFileInternal = {
|
||||||
* incrementally updated by the worker process.
|
* incrementally updated by the worker process.
|
||||||
* @returns string if successful, undefined otherwise.
|
* @returns string if successful, undefined otherwise.
|
||||||
*/
|
*/
|
||||||
readAux: function (aPath, aReadOptions) {
|
readAux: function(aPath, aReadOptions) {
|
||||||
let self = this;
|
let self = this;
|
||||||
return TaskUtils.spawn(function () {
|
return TaskUtils.spawn(function() {
|
||||||
let text;
|
let text;
|
||||||
try {
|
try {
|
||||||
let bytes = yield OS.File.read(aPath, undefined, aReadOptions);
|
let bytes = yield OS.File.read(aPath, undefined, aReadOptions);
|
||||||
|
|
@ -228,7 +228,7 @@ var SessionFileInternal = {
|
||||||
* happened between backup and write), attempt to read the sessionstore.bak
|
* happened between backup and write), attempt to read the sessionstore.bak
|
||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
read: function () {
|
read: function() {
|
||||||
let self = this;
|
let self = this;
|
||||||
return TaskUtils.spawn(function task() {
|
return TaskUtils.spawn(function task() {
|
||||||
// Specify |outExecutionDuration| option to hold the combined duration of
|
// Specify |outExecutionDuration| option to hold the combined duration of
|
||||||
|
|
@ -253,7 +253,7 @@ var SessionFileInternal = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
write: function (aData) {
|
write: function(aData) {
|
||||||
let refObj = {};
|
let refObj = {};
|
||||||
let self = this;
|
let self = this;
|
||||||
return TaskUtils.spawn(function task() {
|
return TaskUtils.spawn(function task() {
|
||||||
|
|
@ -268,7 +268,7 @@ var SessionFileInternal = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createBackupCopy: function () {
|
createBackupCopy: function() {
|
||||||
let backupCopyOptions = {
|
let backupCopyOptions = {
|
||||||
outExecutionDuration: null
|
outExecutionDuration: null
|
||||||
};
|
};
|
||||||
|
|
@ -285,7 +285,7 @@ var SessionFileInternal = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
wipe: function () {
|
wipe: function() {
|
||||||
let self = this;
|
let self = this;
|
||||||
return TaskUtils.spawn(function task() {
|
return TaskUtils.spawn(function task() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -308,7 +308,7 @@ var SessionFileInternal = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_isNoSuchFile: function (aReason) {
|
_isNoSuchFile: function(aReason) {
|
||||||
return aReason instanceof OS.File.Error && aReason.becauseNoSuchFile;
|
return aReason instanceof OS.File.Error && aReason.becauseNoSuchFile;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ SessionStartup.prototype = {
|
||||||
/**
|
/**
|
||||||
* Initialize the component
|
* Initialize the component
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {
|
||||||
// do not need to initialize anything in auto-started private browsing sessions
|
// do not need to initialize anything in auto-started private browsing sessions
|
||||||
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
|
|
@ -88,14 +88,14 @@ SessionStartup.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Wrap a string as a nsISupports
|
// Wrap a string as a nsISupports
|
||||||
_createSupportsString: function (aData) {
|
_createSupportsString: function(aData) {
|
||||||
let string = Cc["@mozilla.org/supports-string;1"]
|
let string = Cc["@mozilla.org/supports-string;1"]
|
||||||
.createInstance(Ci.nsISupportsString);
|
.createInstance(Ci.nsISupportsString);
|
||||||
string.data = aData;
|
string.data = aData;
|
||||||
return string;
|
return string;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSessionFileRead: function (aStateString) {
|
_onSessionFileRead: function(aStateString) {
|
||||||
if (this._initialized) {
|
if (this._initialized) {
|
||||||
// Initialization is complete, nothing else to do
|
// Initialization is complete, nothing else to do
|
||||||
return;
|
return;
|
||||||
|
|
@ -174,7 +174,7 @@ SessionStartup.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handle notifications
|
* Handle notifications
|
||||||
*/
|
*/
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "app-startup":
|
case "app-startup":
|
||||||
Services.obs.addObserver(this, "final-ui-startup", true);
|
Services.obs.addObserver(this, "final-ui-startup", true);
|
||||||
|
|
@ -225,7 +225,7 @@ SessionStartup.prototype = {
|
||||||
* session file synchronously.
|
* session file synchronously.
|
||||||
* @returns bool
|
* @returns bool
|
||||||
*/
|
*/
|
||||||
doRestore: function () {
|
doRestore: function() {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
return this._willRestore();
|
return this._willRestore();
|
||||||
},
|
},
|
||||||
|
|
@ -234,7 +234,7 @@ SessionStartup.prototype = {
|
||||||
* Determines whether there is a pending session restore.
|
* Determines whether there is a pending session restore.
|
||||||
* @returns bool
|
* @returns bool
|
||||||
*/
|
*/
|
||||||
_willRestore: function () {
|
_willRestore: function() {
|
||||||
return this._sessionType == Ci.nsISessionStartup.RECOVER_SESSION ||
|
return this._sessionType == Ci.nsISessionStartup.RECOVER_SESSION ||
|
||||||
this._sessionType == Ci.nsISessionStartup.RESUME_SESSION;
|
this._sessionType == Ci.nsISessionStartup.RESUME_SESSION;
|
||||||
},
|
},
|
||||||
|
|
@ -272,7 +272,7 @@ SessionStartup.prototype = {
|
||||||
// Ensure that initialization is complete.
|
// Ensure that initialization is complete.
|
||||||
// If initialization is not complete yet, fall back to a synchronous
|
// If initialization is not complete yet, fall back to a synchronous
|
||||||
// initialization and kill ongoing asynchronous initialization
|
// initialization and kill ongoing asynchronous initialization
|
||||||
_ensureInitialized: function () {
|
_ensureInitialized: function() {
|
||||||
try {
|
try {
|
||||||
if (this._initialized) {
|
if (this._initialized) {
|
||||||
// Initialization is complete, nothing else to do
|
// Initialization is complete, nothing else to do
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
function nsSetDefaultBrowser() {}
|
function nsSetDefaultBrowser() {}
|
||||||
|
|
||||||
nsSetDefaultBrowser.prototype = {
|
nsSetDefaultBrowser.prototype = {
|
||||||
handle: function (aCmdline) {
|
handle: function(aCmdline) {
|
||||||
if (aCmdline.handleFlag("setDefaultBrowser", false)) {
|
if (aCmdline.handleFlag("setDefaultBrowser", false)) {
|
||||||
ShellService.setDefaultBrowser(true, true);
|
ShellService.setDefaultBrowser(true, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ const DEVICE_CONNECTED_PAGE = 2;
|
||||||
|
|
||||||
var gSyncAddDevice = {
|
var gSyncAddDevice = {
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
this.pin1.setAttribute("maxlength", PIN_PART_LENGTH);
|
this.pin1.setAttribute("maxlength", PIN_PART_LENGTH);
|
||||||
this.pin2.setAttribute("maxlength", PIN_PART_LENGTH);
|
this.pin2.setAttribute("maxlength", PIN_PART_LENGTH);
|
||||||
this.pin3.setAttribute("maxlength", PIN_PART_LENGTH);
|
this.pin3.setAttribute("maxlength", PIN_PART_LENGTH);
|
||||||
|
|
@ -34,7 +34,7 @@ var gSyncAddDevice = {
|
||||||
Weave.Service.scheduler.scheduleNextSync(0);
|
Weave.Service.scheduler.scheduleNextSync(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPageShow: function () {
|
onPageShow: function() {
|
||||||
this.wizard.getButton("back").hidden = true;
|
this.wizard.getButton("back").hidden = true;
|
||||||
|
|
||||||
switch (this.wizard.pageIndex) {
|
switch (this.wizard.pageIndex) {
|
||||||
|
|
@ -60,7 +60,7 @@ var gSyncAddDevice = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWizardAdvance: function () {
|
onWizardAdvance: function() {
|
||||||
switch (this.wizard.pageIndex) {
|
switch (this.wizard.pageIndex) {
|
||||||
case ADD_DEVICE_PAGE:
|
case ADD_DEVICE_PAGE:
|
||||||
this.startTransfer();
|
this.startTransfer();
|
||||||
|
|
@ -72,21 +72,21 @@ var gSyncAddDevice = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
startTransfer: function () {
|
startTransfer: function() {
|
||||||
this.errorRow.hidden = true;
|
this.errorRow.hidden = true;
|
||||||
// When onAbort is called, Weave may already be gone.
|
// When onAbort is called, Weave may already be gone.
|
||||||
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
|
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
|
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
|
||||||
onPaired: function () {
|
onPaired: function() {
|
||||||
let credentials = {account: Weave.Service.identity.account,
|
let credentials = {account: Weave.Service.identity.account,
|
||||||
password: Weave.Service.identity.basicPassword,
|
password: Weave.Service.identity.basicPassword,
|
||||||
synckey: Weave.Service.identity.syncKey,
|
synckey: Weave.Service.identity.syncKey,
|
||||||
serverURL: Weave.Service.serverURL};
|
serverURL: Weave.Service.serverURL};
|
||||||
jpakeclient.sendAndComplete(credentials);
|
jpakeclient.sendAndComplete(credentials);
|
||||||
},
|
},
|
||||||
onComplete: function () {
|
onComplete: function() {
|
||||||
delete self._jpakeclient;
|
delete self._jpakeclient;
|
||||||
self.wizard.pageIndex = DEVICE_CONNECTED_PAGE;
|
self.wizard.pageIndex = DEVICE_CONNECTED_PAGE;
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ var gSyncAddDevice = {
|
||||||
// device with which we just paired.
|
// device with which we just paired.
|
||||||
Weave.Service.scheduler.scheduleNextSync(Weave.Service.scheduler.activeInterval);
|
Weave.Service.scheduler.scheduleNextSync(Weave.Service.scheduler.activeInterval);
|
||||||
},
|
},
|
||||||
onAbort: function (error) {
|
onAbort: function(error) {
|
||||||
delete self._jpakeclient;
|
delete self._jpakeclient;
|
||||||
|
|
||||||
// Aborted by user, ignore.
|
// Aborted by user, ignore.
|
||||||
|
|
@ -118,7 +118,7 @@ var gSyncAddDevice = {
|
||||||
jpakeclient.pairWithPIN(pin, expectDelay);
|
jpakeclient.pairWithPIN(pin, expectDelay);
|
||||||
},
|
},
|
||||||
|
|
||||||
onWizardBack: function () {
|
onWizardBack: function() {
|
||||||
if (this.wizard.pageIndex != SYNC_KEY_PAGE)
|
if (this.wizard.pageIndex != SYNC_KEY_PAGE)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ var gSyncAddDevice = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
onWizardCancel: function () {
|
onWizardCancel: function() {
|
||||||
if (this._jpakeclient) {
|
if (this._jpakeclient) {
|
||||||
this._jpakeclient.abort();
|
this._jpakeclient.abort();
|
||||||
delete this._jpakeclient;
|
delete this._jpakeclient;
|
||||||
|
|
@ -134,7 +134,7 @@ var gSyncAddDevice = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onTextBoxInput: function (textbox) {
|
onTextBoxInput: function(textbox) {
|
||||||
if (textbox && textbox.value.length == PIN_PART_LENGTH)
|
if (textbox && textbox.value.length == PIN_PART_LENGTH)
|
||||||
this.nextFocusEl[textbox.id].focus();
|
this.nextFocusEl[textbox.id].focus();
|
||||||
|
|
||||||
|
|
@ -143,14 +143,14 @@ var gSyncAddDevice = {
|
||||||
&& this.pin3.value.length == PIN_PART_LENGTH);
|
&& this.pin3.value.length == PIN_PART_LENGTH);
|
||||||
},
|
},
|
||||||
|
|
||||||
goToSyncKeyPage: function () {
|
goToSyncKeyPage: function() {
|
||||||
this.wizard.pageIndex = SYNC_KEY_PAGE;
|
this.wizard.pageIndex = SYNC_KEY_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
// onWizardAdvance() and onPageShow() are run before init() so we'll set
|
// onWizardAdvance() and onPageShow() are run before init() so we'll set
|
||||||
// these up as lazy getters.
|
// these up as lazy getters.
|
||||||
["wizard", "pin1", "pin2", "pin3"].forEach(function (id) {
|
["wizard", "pin1", "pin2", "pin3"].forEach(function(id) {
|
||||||
XPCOMUtils.defineLazyGetter(gSyncAddDevice, id, function() {
|
XPCOMUtils.defineLazyGetter(gSyncAddDevice, id, function() {
|
||||||
return document.getElementById(id);
|
return document.getElementById(id);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ var Change = {
|
||||||
return this._dialogType == "UpdatePassphrase";
|
return this._dialogType == "UpdatePassphrase";
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad: function () {
|
onLoad: function() {
|
||||||
/* Load labels */
|
/* Load labels */
|
||||||
let introText = document.getElementById("introText");
|
let introText = document.getElementById("introText");
|
||||||
let introText2 = document.getElementById("introText2");
|
let introText2 = document.getElementById("introText2");
|
||||||
|
|
@ -112,16 +112,16 @@ var Change = {
|
||||||
.setAttribute("label", document.title);
|
.setAttribute("label", document.title);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearStatus: function () {
|
_clearStatus: function() {
|
||||||
this._status.value = "";
|
this._status.value = "";
|
||||||
this._statusIcon.removeAttribute("status");
|
this._statusIcon.removeAttribute("status");
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateStatus: function (str, state) {
|
_updateStatus: function(str, state) {
|
||||||
this._updateStatusWithString(this._str(str), state);
|
this._updateStatusWithString(this._str(str), state);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateStatusWithString: function (string, state) {
|
_updateStatusWithString: function(string, state) {
|
||||||
this._statusRow.hidden = false;
|
this._statusRow.hidden = false;
|
||||||
this._status.value = string;
|
this._status.value = string;
|
||||||
this._statusIcon.setAttribute("status", state);
|
this._statusIcon.setAttribute("status", state);
|
||||||
|
|
@ -148,13 +148,13 @@ var Change = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
doGeneratePassphrase: function () {
|
doGeneratePassphrase: function() {
|
||||||
let passphrase = Weave.Utils.generatePassphrase();
|
let passphrase = Weave.Utils.generatePassphrase();
|
||||||
this._passphraseBox.value = Weave.Utils.hyphenatePassphrase(passphrase);
|
this._passphraseBox.value = Weave.Utils.hyphenatePassphrase(passphrase);
|
||||||
this._dialog.getButton("finish").disabled = false;
|
this._dialog.getButton("finish").disabled = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
doChangePassphrase: function () {
|
doChangePassphrase: function() {
|
||||||
let pp = Weave.Utils.normalizePassphrase(this._passphraseBox.value);
|
let pp = Weave.Utils.normalizePassphrase(this._passphraseBox.value);
|
||||||
if (this._updatingPassphrase) {
|
if (this._updatingPassphrase) {
|
||||||
Weave.Service.identity.syncKey = pp;
|
Weave.Service.identity.syncKey = pp;
|
||||||
|
|
@ -179,7 +179,7 @@ var Change = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
doChangePassword: function () {
|
doChangePassword: function() {
|
||||||
if (this._currentPasswordInvalid) {
|
if (this._currentPasswordInvalid) {
|
||||||
Weave.Service.identity.basicPassword = this._firstBox.value;
|
Weave.Service.identity.basicPassword = this._firstBox.value;
|
||||||
if (Weave.Service.login()) {
|
if (Weave.Service.login()) {
|
||||||
|
|
@ -202,7 +202,7 @@ var Change = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
validate: function (event) {
|
validate: function(event) {
|
||||||
let valid = false;
|
let valid = false;
|
||||||
let errorString = "";
|
let errorString = "";
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ var Change = {
|
||||||
this._dialog.getButton("finish").disabled = !valid;
|
this._dialog.getButton("finish").disabled = !valid;
|
||||||
},
|
},
|
||||||
|
|
||||||
_str: function (str) {
|
_str: function(str) {
|
||||||
return this._stringBundle.GetStringFromName(str);
|
return this._stringBundle.GetStringFromName(str);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/DownloadUtils.jsm");
|
||||||
|
|
||||||
var gSyncQuota = {
|
var gSyncQuota = {
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
this.bundle = document.getElementById("quotaStrings");
|
this.bundle = document.getElementById("quotaStrings");
|
||||||
let caption = document.getElementById("treeCaption");
|
let caption = document.getElementById("treeCaption");
|
||||||
caption.firstChild.nodeValue = this.bundle.getString("quota.treeCaption.label");
|
caption.firstChild.nodeValue = this.bundle.getString("quota.treeCaption.label");
|
||||||
|
|
@ -24,9 +24,9 @@ var gSyncQuota = {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
|
|
||||||
loadData: function () {
|
loadData: function() {
|
||||||
this._usage_req = Weave.Service.getStorageInfo(Weave.INFO_COLLECTION_USAGE,
|
this._usage_req = Weave.Service.getStorageInfo(Weave.INFO_COLLECTION_USAGE,
|
||||||
function (error, usage) {
|
function(error, usage) {
|
||||||
delete gSyncQuota._usage_req;
|
delete gSyncQuota._usage_req;
|
||||||
// displayUsageData handles null values, so no need to check 'error'.
|
// displayUsageData handles null values, so no need to check 'error'.
|
||||||
gUsageTreeView.displayUsageData(usage);
|
gUsageTreeView.displayUsageData(usage);
|
||||||
|
|
@ -36,7 +36,7 @@ var gSyncQuota = {
|
||||||
let bundle = this.bundle;
|
let bundle = this.bundle;
|
||||||
|
|
||||||
this._quota_req = Weave.Service.getStorageInfo(Weave.INFO_QUOTA,
|
this._quota_req = Weave.Service.getStorageInfo(Weave.INFO_QUOTA,
|
||||||
function (error, quota) {
|
function(error, quota) {
|
||||||
delete gSyncQuota._quota_req;
|
delete gSyncQuota._quota_req;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
@ -57,7 +57,7 @@ var gSyncQuota = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onCancel: function () {
|
onCancel: function() {
|
||||||
if (this._usage_req) {
|
if (this._usage_req) {
|
||||||
this._usage_req.abort();
|
this._usage_req.abort();
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,7 @@ var gSyncQuota = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onAccept: function () {
|
onAccept: function() {
|
||||||
let engines = gUsageTreeView.getEnginesToDisable();
|
let engines = gUsageTreeView.getEnginesToDisable();
|
||||||
for each (let engine in engines) {
|
for each (let engine in engines) {
|
||||||
Weave.Service.engineManager.get(engine).enabled = false;
|
Weave.Service.engineManager.get(engine).enabled = false;
|
||||||
|
|
@ -80,7 +80,7 @@ var gSyncQuota = {
|
||||||
return this.onCancel();
|
return this.onCancel();
|
||||||
},
|
},
|
||||||
|
|
||||||
convertKB: function (value) {
|
convertKB: function(value) {
|
||||||
return DownloadUtils.convertByteUnits(value * 1024);
|
return DownloadUtils.convertByteUnits(value * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ var gUsageTreeView = {
|
||||||
_collections: [],
|
_collections: [],
|
||||||
_byname: {},
|
_byname: {},
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
let retrievingLabel = gSyncQuota.bundle.getString("quota.retrieving.label");
|
let retrievingLabel = gSyncQuota.bundle.getString("quota.retrieving.label");
|
||||||
for each (let engine in Weave.Service.engineManager.getEnabled()) {
|
for each (let engine in Weave.Service.engineManager.getEnabled()) {
|
||||||
if (this._ignored[engine.name])
|
if (this._ignored[engine.name])
|
||||||
|
|
@ -122,7 +122,7 @@ var gUsageTreeView = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_collectionTitle: function (engine) {
|
_collectionTitle: function(engine) {
|
||||||
try {
|
try {
|
||||||
return gSyncQuota.bundle.getString(
|
return gSyncQuota.bundle.getString(
|
||||||
"collection." + engine.prefName + ".label");
|
"collection." + engine.prefName + ".label");
|
||||||
|
|
@ -134,7 +134,7 @@ var gUsageTreeView = {
|
||||||
/*
|
/*
|
||||||
* Process the quota information as returned by info/collection_usage.
|
* Process the quota information as returned by info/collection_usage.
|
||||||
*/
|
*/
|
||||||
displayUsageData: function (data) {
|
displayUsageData: function(data) {
|
||||||
for each (let coll in this._collections) {
|
for each (let coll in this._collections) {
|
||||||
coll.size = 0;
|
coll.size = 0;
|
||||||
// If we couldn't retrieve any data, just blank out the label.
|
// If we couldn't retrieve any data, just blank out the label.
|
||||||
|
|
@ -157,7 +157,7 @@ var gUsageTreeView = {
|
||||||
/*
|
/*
|
||||||
* Handle click events on the tree.
|
* Handle click events on the tree.
|
||||||
*/
|
*/
|
||||||
onTreeClick: function (event) {
|
onTreeClick: function(event) {
|
||||||
if (event.button == 2)
|
if (event.button == 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ var gUsageTreeView = {
|
||||||
/*
|
/*
|
||||||
* Toggle enabled state of an engine.
|
* Toggle enabled state of an engine.
|
||||||
*/
|
*/
|
||||||
toggle: function (row) {
|
toggle: function(row) {
|
||||||
// Update the tree
|
// Update the tree
|
||||||
let collection = this._collections[row];
|
let collection = this._collections[row];
|
||||||
collection.enabled = !collection.enabled;
|
collection.enabled = !collection.enabled;
|
||||||
|
|
@ -180,7 +180,7 @@ var gUsageTreeView = {
|
||||||
* Return a list of engines (or rather their pref names) that should be
|
* Return a list of engines (or rather their pref names) that should be
|
||||||
* disabled.
|
* disabled.
|
||||||
*/
|
*/
|
||||||
getEnginesToDisable: function () {
|
getEnginesToDisable: function() {
|
||||||
// Tycho: return [coll.name for each (coll in this._collections) if (!coll.enabled)];
|
// Tycho: return [coll.name for each (coll in this._collections) if (!coll.enabled)];
|
||||||
let engines = [];
|
let engines = [];
|
||||||
for each (let coll in this._collections) {
|
for each (let coll in this._collections) {
|
||||||
|
|
@ -216,7 +216,7 @@ var gUsageTreeView = {
|
||||||
return this._collections[row].enabled;
|
return this._collections[row].enabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
getCellText: function (row, col) {
|
getCellText: function(row, col) {
|
||||||
let collection = this._collections[row];
|
let collection = this._collections[row];
|
||||||
switch (col.id) {
|
switch (col.id) {
|
||||||
case "collection":
|
case "collection":
|
||||||
|
|
@ -228,7 +228,7 @@ var gUsageTreeView = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setTree: function (tree) {
|
setTree: function(tree) {
|
||||||
this.treeBox = tree;
|
this.treeBox = tree;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -237,7 +237,7 @@ var gUsageTreeView = {
|
||||||
selectionChanged: function() {},
|
selectionChanged: function() {},
|
||||||
cycleCell: function(row, col) {},
|
cycleCell: function(row, col) {},
|
||||||
isEditable: function(row, col) { return false; },
|
isEditable: function(row, col) { return false; },
|
||||||
isSelectable: function (row, col) { return false; },
|
isSelectable: function(row, col) { return false; },
|
||||||
setCellValue: function(row, col, value) {},
|
setCellValue: function(row, col, value) {},
|
||||||
setCellText: function(row, col, value) {},
|
setCellText: function(row, col, value) {},
|
||||||
performAction: function(action) {},
|
performAction: function(action) {},
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ var gSyncSetup = {
|
||||||
return document.getElementById("existingServer").selectedIndex == 0;
|
return document.getElementById("existingServer").selectedIndex == 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
let obs = [
|
let obs = [
|
||||||
["weave:service:change-passphrase", "onResetPassphrase"],
|
["weave:service:change-passphrase", "onResetPassphrase"],
|
||||||
["weave:service:login:start", "onLoginStart"],
|
["weave:service:login:start", "onLoginStart"],
|
||||||
|
|
@ -80,7 +80,7 @@ var gSyncSetup = {
|
||||||
addRem(true);
|
addRem(true);
|
||||||
window.addEventListener("unload", function() addRem(false), false);
|
window.addEventListener("unload", function() addRem(false), false);
|
||||||
|
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function() {
|
||||||
// Force Service to be loaded so that engines are registered.
|
// Force Service to be loaded so that engines are registered.
|
||||||
// See Bug 670082.
|
// See Bug 670082.
|
||||||
Weave.Service;
|
Weave.Service;
|
||||||
|
|
@ -118,14 +118,14 @@ var gSyncSetup = {
|
||||||
.getAttribute("accesskey");
|
.getAttribute("accesskey");
|
||||||
},
|
},
|
||||||
|
|
||||||
startNewAccountSetup: function () {
|
startNewAccountSetup: function() {
|
||||||
if (!Weave.Utils.ensureMPUnlocked())
|
if (!Weave.Utils.ensureMPUnlocked())
|
||||||
return false;
|
return false;
|
||||||
this._settingUpNew = true;
|
this._settingUpNew = true;
|
||||||
this.wizard.pageIndex = NEW_ACCOUNT_START_PAGE;
|
this.wizard.pageIndex = NEW_ACCOUNT_START_PAGE;
|
||||||
},
|
},
|
||||||
|
|
||||||
useExistingAccount: function () {
|
useExistingAccount: function() {
|
||||||
if (!Weave.Utils.ensureMPUnlocked())
|
if (!Weave.Utils.ensureMPUnlocked())
|
||||||
return false;
|
return false;
|
||||||
this._settingUpNew = false;
|
this._settingUpNew = false;
|
||||||
|
|
@ -138,7 +138,7 @@ var gSyncSetup = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPassphrase: function () {
|
resetPassphrase: function() {
|
||||||
// Apply the existing form fields so that
|
// Apply the existing form fields so that
|
||||||
// Weave.Service.changePassphrase() has the necessary credentials.
|
// Weave.Service.changePassphrase() has the necessary credentials.
|
||||||
Weave.Service.identity.account = document.getElementById("existingAccountName").value;
|
Weave.Service.identity.account = document.getElementById("existingAccountName").value;
|
||||||
|
|
@ -170,22 +170,22 @@ var gSyncSetup = {
|
||||||
gSyncUtils.resetPassphrase(true);
|
gSyncUtils.resetPassphrase(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
onResetPassphrase: function () {
|
onResetPassphrase: function() {
|
||||||
document.getElementById("existingPassphrase").value =
|
document.getElementById("existingPassphrase").value =
|
||||||
Weave.Utils.hyphenatePassphrase(Weave.Service.identity.syncKey);
|
Weave.Utils.hyphenatePassphrase(Weave.Service.identity.syncKey);
|
||||||
this.checkFields();
|
this.checkFields();
|
||||||
this.wizard.advance();
|
this.wizard.advance();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoginStart: function () {
|
onLoginStart: function() {
|
||||||
this.toggleLoginFeedback(false);
|
this.toggleLoginFeedback(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoginEnd: function () {
|
onLoginEnd: function() {
|
||||||
this.toggleLoginFeedback(true);
|
this.toggleLoginFeedback(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
sendCredentialsAfterSync: function () {
|
sendCredentialsAfterSync: function() {
|
||||||
let send = function() {
|
let send = function() {
|
||||||
Services.obs.removeObserver("weave:service:sync:finish", send);
|
Services.obs.removeObserver("weave:service:sync:finish", send);
|
||||||
Services.obs.removeObserver("weave:service:sync:error", send);
|
Services.obs.removeObserver("weave:service:sync:error", send);
|
||||||
|
|
@ -199,7 +199,7 @@ var gSyncSetup = {
|
||||||
Services.obs.addObserver("weave:service:sync:error", send, false);
|
Services.obs.addObserver("weave:service:sync:error", send, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleLoginFeedback: function (stop) {
|
toggleLoginFeedback: function(stop) {
|
||||||
document.getElementById("login-throbber").hidden = stop;
|
document.getElementById("login-throbber").hidden = stop;
|
||||||
let password = document.getElementById("existingPasswordFeedbackRow");
|
let password = document.getElementById("existingPasswordFeedbackRow");
|
||||||
let server = document.getElementById("existingServerFeedbackRow");
|
let server = document.getElementById("existingServerFeedbackRow");
|
||||||
|
|
@ -228,7 +228,7 @@ var gSyncSetup = {
|
||||||
this._setFeedbackMessage(feedback, false, Weave.Status.login);
|
this._setFeedbackMessage(feedback, false, Weave.Status.login);
|
||||||
},
|
},
|
||||||
|
|
||||||
setupInitialSync: function () {
|
setupInitialSync: function() {
|
||||||
let action = document.getElementById("mergeChoiceRadio").selectedItem.id;
|
let action = document.getElementById("mergeChoiceRadio").selectedItem.id;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "resetClient":
|
case "resetClient":
|
||||||
|
|
@ -245,11 +245,11 @@ var gSyncSetup = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// fun with validation!
|
// fun with validation!
|
||||||
checkFields: function () {
|
checkFields: function() {
|
||||||
this.wizard.canAdvance = this.readyToAdvance();
|
this.wizard.canAdvance = this.readyToAdvance();
|
||||||
},
|
},
|
||||||
|
|
||||||
readyToAdvance: function () {
|
readyToAdvance: function() {
|
||||||
switch (this.wizard.pageIndex) {
|
switch (this.wizard.pageIndex) {
|
||||||
case INTRO_PAGE:
|
case INTRO_PAGE:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -290,11 +290,11 @@ var gSyncSetup = {
|
||||||
this.pin3.value.length == PIN_PART_LENGTH);
|
this.pin3.value.length == PIN_PART_LENGTH);
|
||||||
},
|
},
|
||||||
|
|
||||||
onEmailInput: function () {
|
onEmailInput: function() {
|
||||||
// Check account validity when the user stops typing for 1 second.
|
// Check account validity when the user stops typing for 1 second.
|
||||||
if (this._checkAccountTimer)
|
if (this._checkAccountTimer)
|
||||||
window.clearTimeout(this._checkAccountTimer);
|
window.clearTimeout(this._checkAccountTimer);
|
||||||
this._checkAccountTimer = window.setTimeout(function () {
|
this._checkAccountTimer = window.setTimeout(function() {
|
||||||
gSyncSetup.checkAccount();
|
gSyncSetup.checkAccount();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
@ -334,7 +334,7 @@ var gSyncSetup = {
|
||||||
this.checkFields();
|
this.checkFields();
|
||||||
},
|
},
|
||||||
|
|
||||||
onPasswordChange: function () {
|
onPasswordChange: function() {
|
||||||
let password = document.getElementById("weavePassword");
|
let password = document.getElementById("weavePassword");
|
||||||
let pwconfirm = document.getElementById("weavePasswordConfirm");
|
let pwconfirm = document.getElementById("weavePasswordConfirm");
|
||||||
let [valid, errorString] = gSyncUtils.validatePassword(password, pwconfirm);
|
let [valid, errorString] = gSyncUtils.validatePassword(password, pwconfirm);
|
||||||
|
|
@ -417,7 +417,7 @@ var gSyncSetup = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWizardAdvance: function () {
|
onWizardAdvance: function() {
|
||||||
// Check pageIndex so we don't prompt before the Sync setup wizard appears.
|
// Check pageIndex so we don't prompt before the Sync setup wizard appears.
|
||||||
// This is a fallback in case the Master Password gets locked mid-wizard.
|
// This is a fallback in case the Master Password gets locked mid-wizard.
|
||||||
if ((this.wizard.pageIndex >= 0) &&
|
if ((this.wizard.pageIndex >= 0) &&
|
||||||
|
|
@ -506,7 +506,7 @@ var gSyncSetup = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onWizardBack: function () {
|
onWizardBack: function() {
|
||||||
switch (this.wizard.pageIndex) {
|
switch (this.wizard.pageIndex) {
|
||||||
case NEW_ACCOUNT_START_PAGE:
|
case NEW_ACCOUNT_START_PAGE:
|
||||||
case EXISTING_ACCOUNT_LOGIN_PAGE:
|
case EXISTING_ACCOUNT_LOGIN_PAGE:
|
||||||
|
|
@ -533,7 +533,7 @@ var gSyncSetup = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
wizardFinish: function () {
|
wizardFinish: function() {
|
||||||
this.setupInitialSync();
|
this.setupInitialSync();
|
||||||
|
|
||||||
if (this.wizardType == "pair") {
|
if (this.wizardType == "pair") {
|
||||||
|
|
@ -568,7 +568,7 @@ var gSyncSetup = {
|
||||||
window.close();
|
window.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
onWizardCancel: function () {
|
onWizardCancel: function() {
|
||||||
if (this._resettingSync)
|
if (this._resettingSync)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -577,7 +577,7 @@ var gSyncSetup = {
|
||||||
Weave.Service.startOver();
|
Weave.Service.startOver();
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncOptions: function () {
|
onSyncOptions: function() {
|
||||||
this._beforeOptionsPage = this.wizard.pageIndex;
|
this._beforeOptionsPage = this.wizard.pageIndex;
|
||||||
this.wizard.pageIndex = OPTIONS_PAGE;
|
this.wizard.pageIndex = OPTIONS_PAGE;
|
||||||
},
|
},
|
||||||
|
|
@ -595,7 +595,7 @@ var gSyncSetup = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
startPairing: function () {
|
startPairing: function() {
|
||||||
this.pairDeviceErrorRow.hidden = true;
|
this.pairDeviceErrorRow.hidden = true;
|
||||||
// When onAbort is called, Weave may already be gone.
|
// When onAbort is called, Weave may already be gone.
|
||||||
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
|
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
|
||||||
|
|
@ -605,11 +605,11 @@ var gSyncSetup = {
|
||||||
onPaired: function onPaired() {
|
onPaired: function onPaired() {
|
||||||
self.wizard.pageIndex = INTRO_PAGE;
|
self.wizard.pageIndex = INTRO_PAGE;
|
||||||
},
|
},
|
||||||
onComplete: function () {
|
onComplete: function() {
|
||||||
// This method will never be called since SendCredentialsController
|
// This method will never be called since SendCredentialsController
|
||||||
// will take over after the wizard completes.
|
// will take over after the wizard completes.
|
||||||
},
|
},
|
||||||
onAbort: function (error) {
|
onAbort: function(error) {
|
||||||
delete self._jpakeclient;
|
delete self._jpakeclient;
|
||||||
|
|
||||||
// Aborted by user, ignore. The window is almost certainly going to close
|
// Aborted by user, ignore. The window is almost certainly going to close
|
||||||
|
|
@ -636,7 +636,7 @@ var gSyncSetup = {
|
||||||
jpakeclient.pairWithPIN(pin, expectDelay);
|
jpakeclient.pairWithPIN(pin, expectDelay);
|
||||||
},
|
},
|
||||||
|
|
||||||
completePairing: function () {
|
completePairing: function() {
|
||||||
if (!this._jpakeclient) {
|
if (!this._jpakeclient) {
|
||||||
// The channel was aborted while we were setting up the account
|
// The channel was aborted while we were setting up the account
|
||||||
// locally. XXX TODO should we do anything here, e.g. tell
|
// locally. XXX TODO should we do anything here, e.g. tell
|
||||||
|
|
@ -649,7 +649,7 @@ var gSyncSetup = {
|
||||||
this._jpakeclient.controller = controller;
|
this._jpakeclient.controller = controller;
|
||||||
},
|
},
|
||||||
|
|
||||||
startEasySetup: function () {
|
startEasySetup: function() {
|
||||||
// Don't do anything if we have a client already (e.g. we went to
|
// Don't do anything if we have a client already (e.g. we went to
|
||||||
// Sync Options and just came back).
|
// Sync Options and just came back).
|
||||||
if (this._jpakeclient)
|
if (this._jpakeclient)
|
||||||
|
|
@ -660,15 +660,15 @@ var gSyncSetup = {
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
this._jpakeclient = new Weave.JPAKEClient({
|
this._jpakeclient = new Weave.JPAKEClient({
|
||||||
displayPIN: function (pin) {
|
displayPIN: function(pin) {
|
||||||
document.getElementById("easySetupPIN1").value = pin.slice(0, 4);
|
document.getElementById("easySetupPIN1").value = pin.slice(0, 4);
|
||||||
document.getElementById("easySetupPIN2").value = pin.slice(4, 8);
|
document.getElementById("easySetupPIN2").value = pin.slice(4, 8);
|
||||||
document.getElementById("easySetupPIN3").value = pin.slice(8);
|
document.getElementById("easySetupPIN3").value = pin.slice(8);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPairingStart: function () {},
|
onPairingStart: function() {},
|
||||||
|
|
||||||
onComplete: function (credentials) {
|
onComplete: function(credentials) {
|
||||||
Weave.Service.identity.account = credentials.account;
|
Weave.Service.identity.account = credentials.account;
|
||||||
Weave.Service.identity.basicPassword = credentials.password;
|
Weave.Service.identity.basicPassword = credentials.password;
|
||||||
Weave.Service.identity.syncKey = credentials.synckey;
|
Weave.Service.identity.syncKey = credentials.synckey;
|
||||||
|
|
@ -676,7 +676,7 @@ var gSyncSetup = {
|
||||||
gSyncSetup.wizardFinish();
|
gSyncSetup.wizardFinish();
|
||||||
},
|
},
|
||||||
|
|
||||||
onAbort: function (error) {
|
onAbort: function(error) {
|
||||||
delete self._jpakeclient;
|
delete self._jpakeclient;
|
||||||
|
|
||||||
// Ignore if wizard is aborted.
|
// Ignore if wizard is aborted.
|
||||||
|
|
@ -696,7 +696,7 @@ var gSyncSetup = {
|
||||||
this._jpakeclient.receiveNoPIN();
|
this._jpakeclient.receiveNoPIN();
|
||||||
},
|
},
|
||||||
|
|
||||||
abortEasySetup: function () {
|
abortEasySetup: function() {
|
||||||
document.getElementById("easySetupPIN1").value = "";
|
document.getElementById("easySetupPIN1").value = "";
|
||||||
document.getElementById("easySetupPIN2").value = "";
|
document.getElementById("easySetupPIN2").value = "";
|
||||||
document.getElementById("easySetupPIN3").value = "";
|
document.getElementById("easySetupPIN3").value = "";
|
||||||
|
|
@ -707,7 +707,7 @@ var gSyncSetup = {
|
||||||
delete this._jpakeclient;
|
delete this._jpakeclient;
|
||||||
},
|
},
|
||||||
|
|
||||||
manualSetup: function () {
|
manualSetup: function() {
|
||||||
this.abortEasySetup();
|
this.abortEasySetup();
|
||||||
this.wizard.pageIndex = EXISTING_ACCOUNT_LOGIN_PAGE;
|
this.wizard.pageIndex = EXISTING_ACCOUNT_LOGIN_PAGE;
|
||||||
},
|
},
|
||||||
|
|
@ -715,7 +715,7 @@ var gSyncSetup = {
|
||||||
// _handleNoScript is needed because it blocks the captcha. So we temporarily
|
// _handleNoScript is needed because it blocks the captcha. So we temporarily
|
||||||
// allow the necessary sites so that we can verify the user is in fact a human.
|
// allow the necessary sites so that we can verify the user is in fact a human.
|
||||||
// This was done with the help of Giorgio (NoScript author). See bug 508112.
|
// This was done with the help of Giorgio (NoScript author). See bug 508112.
|
||||||
_handleNoScript: function (addExceptions) {
|
_handleNoScript: function(addExceptions) {
|
||||||
// if NoScript isn't installed, or is disabled, bail out.
|
// if NoScript isn't installed, or is disabled, bail out.
|
||||||
let ns = Cc["@maone.net/noscript-service;1"];
|
let ns = Cc["@maone.net/noscript-service;1"];
|
||||||
if (ns == null)
|
if (ns == null)
|
||||||
|
|
@ -739,7 +739,7 @@ var gSyncSetup = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onExistingServerCommand: function () {
|
onExistingServerCommand: function() {
|
||||||
let control = document.getElementById("existingServer");
|
let control = document.getElementById("existingServer");
|
||||||
if (control.selectedIndex == 0) {
|
if (control.selectedIndex == 0) {
|
||||||
control.removeAttribute("editable");
|
control.removeAttribute("editable");
|
||||||
|
|
@ -755,16 +755,16 @@ var gSyncSetup = {
|
||||||
this.checkFields();
|
this.checkFields();
|
||||||
},
|
},
|
||||||
|
|
||||||
onExistingServerInput: function () {
|
onExistingServerInput: function() {
|
||||||
// Check custom server validity when the user stops typing for 1 second.
|
// Check custom server validity when the user stops typing for 1 second.
|
||||||
if (this._existingServerTimer)
|
if (this._existingServerTimer)
|
||||||
window.clearTimeout(this._existingServerTimer);
|
window.clearTimeout(this._existingServerTimer);
|
||||||
this._existingServerTimer = window.setTimeout(function () {
|
this._existingServerTimer = window.setTimeout(function() {
|
||||||
gSyncSetup.checkFields();
|
gSyncSetup.checkFields();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
onServerCommand: function () {
|
onServerCommand: function() {
|
||||||
setVisibility(document.getElementById("TOSRow"), this._usingMainServers);
|
setVisibility(document.getElementById("TOSRow"), this._usingMainServers);
|
||||||
let control = document.getElementById("server");
|
let control = document.getElementById("server");
|
||||||
if (!this._usingMainServers) {
|
if (!this._usingMainServers) {
|
||||||
|
|
@ -788,16 +788,16 @@ var gSyncSetup = {
|
||||||
this.checkFields();
|
this.checkFields();
|
||||||
},
|
},
|
||||||
|
|
||||||
onServerInput: function () {
|
onServerInput: function() {
|
||||||
// Check custom server validity when the user stops typing for 1 second.
|
// Check custom server validity when the user stops typing for 1 second.
|
||||||
if (this._checkServerTimer)
|
if (this._checkServerTimer)
|
||||||
window.clearTimeout(this._checkServerTimer);
|
window.clearTimeout(this._checkServerTimer);
|
||||||
this._checkServerTimer = window.setTimeout(function () {
|
this._checkServerTimer = window.setTimeout(function() {
|
||||||
gSyncSetup.checkServer();
|
gSyncSetup.checkServer();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
checkServer: function () {
|
checkServer: function() {
|
||||||
delete this._checkServerTimer;
|
delete this._checkServerTimer;
|
||||||
let el = document.getElementById("server");
|
let el = document.getElementById("server");
|
||||||
let valid = false;
|
let valid = false;
|
||||||
|
|
@ -819,7 +819,7 @@ var gSyncSetup = {
|
||||||
this.checkFields();
|
this.checkFields();
|
||||||
},
|
},
|
||||||
|
|
||||||
_validateServer: function (element) {
|
_validateServer: function(element) {
|
||||||
let valid = false;
|
let valid = false;
|
||||||
let val = element.value;
|
let val = element.value;
|
||||||
if (!val)
|
if (!val)
|
||||||
|
|
@ -865,7 +865,7 @@ var gSyncSetup = {
|
||||||
return valid;
|
return valid;
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleChoice: function () {
|
_handleChoice: function() {
|
||||||
let desc = document.getElementById("mergeChoiceRadio").selectedIndex;
|
let desc = document.getElementById("mergeChoiceRadio").selectedIndex;
|
||||||
document.getElementById("chosenActionDeck").selectedIndex = desc;
|
document.getElementById("chosenActionDeck").selectedIndex = desc;
|
||||||
switch (desc) {
|
switch (desc) {
|
||||||
|
|
@ -994,7 +994,7 @@ var gSyncSetup = {
|
||||||
|
|
||||||
// sets class and string on a feedback element
|
// sets class and string on a feedback element
|
||||||
// if no property string is passed in, we clear label/style
|
// if no property string is passed in, we clear label/style
|
||||||
_setFeedback: function (element, success, string) {
|
_setFeedback: function(element, success, string) {
|
||||||
element.hidden = success || !string;
|
element.hidden = success || !string;
|
||||||
let classname = success ? "success" : "error";
|
let classname = success ? "success" : "error";
|
||||||
let image = element.getElementsByAttribute("class", "statusIcon")[0];
|
let image = element.getElementsByAttribute("class", "statusIcon")[0];
|
||||||
|
|
@ -1004,7 +1004,7 @@ var gSyncSetup = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// shim
|
// shim
|
||||||
_setFeedbackMessage: function (element, success, string) {
|
_setFeedbackMessage: function(element, success, string) {
|
||||||
let str = "";
|
let str = "";
|
||||||
if (string) {
|
if (string) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -1017,7 +1017,7 @@ var gSyncSetup = {
|
||||||
this._setFeedback(element, success, str);
|
this._setFeedback(element, success, str);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadCaptcha: function () {
|
loadCaptcha: function() {
|
||||||
let captchaURI = Weave.Service.miscAPI + "captcha_html";
|
let captchaURI = Weave.Service.miscAPI + "captcha_html";
|
||||||
// First check for NoScript and whitelist the right sites.
|
// First check for NoScript and whitelist the right sites.
|
||||||
this._handleNoScript(true);
|
this._handleNoScript(true);
|
||||||
|
|
@ -1043,7 +1043,7 @@ var gSyncSetup = {
|
||||||
onProgressChange: function() {},
|
onProgressChange: function() {},
|
||||||
onStatusChange: function() {},
|
onStatusChange: function() {},
|
||||||
onSecurityChange: function() {},
|
onSecurityChange: function() {},
|
||||||
onLocationChange: function () {}
|
onLocationChange: function() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define lazy getters for various XUL elements.
|
// Define lazy getters for various XUL elements.
|
||||||
|
|
@ -1056,12 +1056,12 @@ var gSyncSetup = {
|
||||||
"pin2",
|
"pin2",
|
||||||
"pin3",
|
"pin3",
|
||||||
"pairDeviceErrorRow",
|
"pairDeviceErrorRow",
|
||||||
"pairDeviceThrobber"].forEach(function (id) {
|
"pairDeviceThrobber"].forEach(function(id) {
|
||||||
XPCOMUtils.defineLazyGetter(gSyncSetup, id, function() {
|
XPCOMUtils.defineLazyGetter(gSyncSetup, id, function() {
|
||||||
return document.getElementById(id);
|
return document.getElementById(id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
XPCOMUtils.defineLazyGetter(gSyncSetup, "nextFocusEl", function () {
|
XPCOMUtils.defineLazyGetter(gSyncSetup, "nextFocusEl", function() {
|
||||||
return {pin1: this.pin2,
|
return {pin1: this.pin2,
|
||||||
pin2: this.pin3,
|
pin2: this.pin3,
|
||||||
pin3: this.wizard.getButton("next")};
|
pin3: this.wizard.getButton("next")};
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ var gSyncUtils = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// opens in a new window if we're in a modal prefwindow world, in a new tab otherwise
|
// opens in a new window if we're in a modal prefwindow world, in a new tab otherwise
|
||||||
_openLink: function (url) {
|
_openLink: function(url) {
|
||||||
let thisDocEl = document.documentElement,
|
let thisDocEl = document.documentElement,
|
||||||
openerDocEl = window.opener && window.opener.document.documentElement;
|
openerDocEl = window.opener && window.opener.document.documentElement;
|
||||||
if (thisDocEl.id == "accountSetup" && window.opener &&
|
if (thisDocEl.id == "accountSetup" && window.opener &&
|
||||||
|
|
@ -30,13 +30,13 @@ var gSyncUtils = {
|
||||||
openUILinkIn(url, "tab");
|
openUILinkIn(url, "tab");
|
||||||
},
|
},
|
||||||
|
|
||||||
changeName: function (input) {
|
changeName: function(input) {
|
||||||
// Make sure to update to a modified name, e.g., empty-string -> default
|
// Make sure to update to a modified name, e.g., empty-string -> default
|
||||||
Weave.Service.clientsEngine.localName = input.value;
|
Weave.Service.clientsEngine.localName = input.value;
|
||||||
input.value = Weave.Service.clientsEngine.localName;
|
input.value = Weave.Service.clientsEngine.localName;
|
||||||
},
|
},
|
||||||
|
|
||||||
openChange: function (type, duringSetup) {
|
openChange: function(type, duringSetup) {
|
||||||
// Just re-show the dialog if it's already open
|
// Just re-show the dialog if it's already open
|
||||||
let openedDialog = Services.wm.getMostRecentWindow("Sync:" + type);
|
let openedDialog = Services.wm.getMostRecentWindow("Sync:" + type);
|
||||||
if (openedDialog != null) {
|
if (openedDialog != null) {
|
||||||
|
|
@ -51,34 +51,34 @@ var gSyncUtils = {
|
||||||
type, duringSetup);
|
type, duringSetup);
|
||||||
},
|
},
|
||||||
|
|
||||||
changePassword: function () {
|
changePassword: function() {
|
||||||
if (Weave.Utils.ensureMPUnlocked())
|
if (Weave.Utils.ensureMPUnlocked())
|
||||||
this.openChange("ChangePassword");
|
this.openChange("ChangePassword");
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPassphrase: function (duringSetup) {
|
resetPassphrase: function(duringSetup) {
|
||||||
if (Weave.Utils.ensureMPUnlocked())
|
if (Weave.Utils.ensureMPUnlocked())
|
||||||
this.openChange("ResetPassphrase", duringSetup);
|
this.openChange("ResetPassphrase", duringSetup);
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePassphrase: function () {
|
updatePassphrase: function() {
|
||||||
if (Weave.Utils.ensureMPUnlocked())
|
if (Weave.Utils.ensureMPUnlocked())
|
||||||
this.openChange("UpdatePassphrase");
|
this.openChange("UpdatePassphrase");
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPassword: function () {
|
resetPassword: function() {
|
||||||
this._openLink(Weave.Service.pwResetURL);
|
this._openLink(Weave.Service.pwResetURL);
|
||||||
},
|
},
|
||||||
|
|
||||||
openToS: function () {
|
openToS: function() {
|
||||||
this._openLink(Weave.Svc.Prefs.get("termsURL"));
|
this._openLink(Weave.Svc.Prefs.get("termsURL"));
|
||||||
},
|
},
|
||||||
|
|
||||||
openPrivacyPolicy: function () {
|
openPrivacyPolicy: function() {
|
||||||
this._openLink(Weave.Svc.Prefs.get("privacyURL"));
|
this._openLink(Weave.Svc.Prefs.get("privacyURL"));
|
||||||
},
|
},
|
||||||
|
|
||||||
openFirstSyncProgressPage: function () {
|
openFirstSyncProgressPage: function() {
|
||||||
this._openLink("about:sync-progress");
|
this._openLink("about:sync-progress");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ var gSyncUtils = {
|
||||||
*
|
*
|
||||||
* returns [valid, errorString]
|
* returns [valid, errorString]
|
||||||
*/
|
*/
|
||||||
validatePassword: function (el1, el2) {
|
validatePassword: function(el1, el2) {
|
||||||
let valid = false;
|
let valid = false;
|
||||||
let val1 = el1.value;
|
let val1 = el1.value;
|
||||||
let val2 = el2 ? el2.value : "";
|
let val2 = el2 ? el2.value : "";
|
||||||
|
|
|
||||||
|
|
@ -49,18 +49,18 @@ function clearTimer(timer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.BrowserNewTabPreloader = {
|
this.BrowserNewTabPreloader = {
|
||||||
init: function () {
|
init: function() {
|
||||||
Initializer.start();
|
Initializer.start();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
Initializer.stop();
|
Initializer.stop();
|
||||||
HostFrame.destroy();
|
HostFrame.destroy();
|
||||||
Preferences.uninit();
|
Preferences.uninit();
|
||||||
HiddenBrowsers.uninit();
|
HiddenBrowsers.uninit();
|
||||||
},
|
},
|
||||||
|
|
||||||
newTab: function (aTab) {
|
newTab: function(aTab) {
|
||||||
let win = aTab.ownerDocument.defaultView;
|
let win = aTab.ownerDocument.defaultView;
|
||||||
if (win.gBrowser) {
|
if (win.gBrowser) {
|
||||||
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
|
@ -83,12 +83,12 @@ var Initializer = {
|
||||||
_timer: null,
|
_timer: null,
|
||||||
_observing: false,
|
_observing: false,
|
||||||
|
|
||||||
start: function () {
|
start: function() {
|
||||||
Services.obs.addObserver(this, TOPIC_DELAYED_STARTUP, false);
|
Services.obs.addObserver(this, TOPIC_DELAYED_STARTUP, false);
|
||||||
this._observing = true;
|
this._observing = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
stop: function () {
|
stop: function() {
|
||||||
this._timer = clearTimer(this._timer);
|
this._timer = clearTimer(this._timer);
|
||||||
|
|
||||||
if (this._observing) {
|
if (this._observing) {
|
||||||
|
|
@ -97,7 +97,7 @@ var Initializer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
if (aTopic == TOPIC_DELAYED_STARTUP) {
|
if (aTopic == TOPIC_DELAYED_STARTUP) {
|
||||||
Services.obs.removeObserver(this, TOPIC_DELAYED_STARTUP);
|
Services.obs.removeObserver(this, TOPIC_DELAYED_STARTUP);
|
||||||
this._observing = false;
|
this._observing = false;
|
||||||
|
|
@ -108,11 +108,11 @@ var Initializer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_startTimer: function () {
|
_startTimer: function() {
|
||||||
this._timer = createTimer(this, PRELOADER_INIT_DELAY_MS);
|
this._timer = createTimer(this, PRELOADER_INIT_DELAY_MS);
|
||||||
},
|
},
|
||||||
|
|
||||||
_startPreloader: function () {
|
_startPreloader: function() {
|
||||||
Preferences.init();
|
Preferences.init();
|
||||||
if (Preferences.enabled) {
|
if (Preferences.enabled) {
|
||||||
HiddenBrowsers.init();
|
HiddenBrowsers.init();
|
||||||
|
|
@ -133,19 +133,19 @@ var Preferences = {
|
||||||
return this._enabled;
|
return this._enabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
this._branch = Services.prefs.getBranch(PREF_BRANCH);
|
this._branch = Services.prefs.getBranch(PREF_BRANCH);
|
||||||
this._branch.addObserver("", this, false);
|
this._branch.addObserver("", this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
if (this._branch) {
|
if (this._branch) {
|
||||||
this._branch.removeObserver("", this);
|
this._branch.removeObserver("", this);
|
||||||
this._branch = null;
|
this._branch = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function () {
|
observe: function() {
|
||||||
let prevEnabled = this._enabled;
|
let prevEnabled = this._enabled;
|
||||||
this._enabled = null;
|
this._enabled = null;
|
||||||
|
|
||||||
|
|
@ -166,13 +166,13 @@ var HiddenBrowsers = {
|
||||||
TOPIC_XUL_WINDOW_CLOSED
|
TOPIC_XUL_WINDOW_CLOSED
|
||||||
],
|
],
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
this._browsers = new Map();
|
this._browsers = new Map();
|
||||||
this._updateBrowserSizes();
|
this._updateBrowserSizes();
|
||||||
this._topics.forEach(t => Services.obs.addObserver(this, t, false));
|
this._topics.forEach(t => Services.obs.addObserver(this, t, false));
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
if (this._browsers) {
|
if (this._browsers) {
|
||||||
this._topics.forEach(t => Services.obs.removeObserver(this, t, false));
|
this._topics.forEach(t => Services.obs.removeObserver(this, t, false));
|
||||||
this._updateTimer = clearTimer(this._updateTimer);
|
this._updateTimer = clearTimer(this._updateTimer);
|
||||||
|
|
@ -184,7 +184,7 @@ var HiddenBrowsers = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
get: function (width, height) {
|
get: function(width, height) {
|
||||||
// We haven't been initialized, yet.
|
// We haven't been initialized, yet.
|
||||||
if (!this._browsers) {
|
if (!this._browsers) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -212,7 +212,7 @@ var HiddenBrowsers = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
if (topic === TOPIC_TIMER_CALLBACK) {
|
if (topic === TOPIC_TIMER_CALLBACK) {
|
||||||
this._updateTimer = null;
|
this._updateTimer = null;
|
||||||
this._updateBrowserSizes();
|
this._updateBrowserSizes();
|
||||||
|
|
@ -222,7 +222,7 @@ var HiddenBrowsers = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBrowserSizes: function () {
|
_updateBrowserSizes: function() {
|
||||||
let sizes = this._collectTabBrowserSizes();
|
let sizes = this._collectTabBrowserSizes();
|
||||||
let toRemove = [];
|
let toRemove = [];
|
||||||
|
|
||||||
|
|
@ -259,7 +259,7 @@ var HiddenBrowsers = {
|
||||||
toRemove.forEach(b => b.destroy());
|
toRemove.forEach(b => b.destroy());
|
||||||
},
|
},
|
||||||
|
|
||||||
_collectTabBrowserSizes: function () {
|
_collectTabBrowserSizes: function() {
|
||||||
let sizes = new Map();
|
let sizes = new Map();
|
||||||
|
|
||||||
function tabBrowserBounds() {
|
function tabBrowserBounds() {
|
||||||
|
|
@ -314,7 +314,7 @@ HiddenBrowser.prototype = {
|
||||||
this._browser.currentURI.spec === NEWTAB_URL;
|
this._browser.currentURI.spec === NEWTAB_URL;
|
||||||
},
|
},
|
||||||
|
|
||||||
swapWithNewTab: function (aTab) {
|
swapWithNewTab: function(aTab) {
|
||||||
if (!this.isPreloaded || this._timer) {
|
if (!this.isPreloaded || this._timer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -349,27 +349,27 @@ HiddenBrowser.prototype = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function () {
|
observe: function() {
|
||||||
this._timer = null;
|
this._timer = null;
|
||||||
|
|
||||||
// Start pre-loading the new tab page.
|
// Start pre-loading the new tab page.
|
||||||
this._browser.loadURI(NEWTAB_URL);
|
this._browser.loadURI(NEWTAB_URL);
|
||||||
},
|
},
|
||||||
|
|
||||||
resize: function (width, height) {
|
resize: function(width, height) {
|
||||||
this._width = width;
|
this._width = width;
|
||||||
this._height = height;
|
this._height = height;
|
||||||
this._applySize();
|
this._applySize();
|
||||||
},
|
},
|
||||||
|
|
||||||
_applySize: function () {
|
_applySize: function() {
|
||||||
if (this._browser) {
|
if (this._browser) {
|
||||||
this._browser.style.width = this._width + "px";
|
this._browser.style.width = this._width + "px";
|
||||||
this._browser.style.height = this._height + "px";
|
this._browser.style.height = this._height + "px";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function() {
|
||||||
if (this._browser) {
|
if (this._browser) {
|
||||||
this._browser.remove();
|
this._browser.remove();
|
||||||
this._browser = null;
|
this._browser = null;
|
||||||
|
|
@ -391,7 +391,7 @@ var HostFrame = {
|
||||||
return this.hiddenDOMDocument.readyState === "complete";
|
return this.hiddenDOMDocument.readyState === "complete";
|
||||||
},
|
},
|
||||||
|
|
||||||
get: function () {
|
get: function() {
|
||||||
if (!this._deferred) {
|
if (!this._deferred) {
|
||||||
this._deferred = Promise.defer();
|
this._deferred = Promise.defer();
|
||||||
this._create();
|
this._create();
|
||||||
|
|
@ -400,7 +400,7 @@ var HostFrame = {
|
||||||
return this._deferred.promise;
|
return this._deferred.promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function() {
|
||||||
if (this._frame) {
|
if (this._frame) {
|
||||||
if (!Cu.isDeadWrapper(this._frame)) {
|
if (!Cu.isDeadWrapper(this._frame)) {
|
||||||
this._frame.removeEventListener("load", this, true);
|
this._frame.removeEventListener("load", this, true);
|
||||||
|
|
@ -412,7 +412,7 @@ var HostFrame = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function () {
|
handleEvent: function() {
|
||||||
let contentWindow = this._frame.contentWindow;
|
let contentWindow = this._frame.contentWindow;
|
||||||
if (contentWindow.location.href === XUL_PAGE) {
|
if (contentWindow.location.href === XUL_PAGE) {
|
||||||
this._frame.removeEventListener("load", this, true);
|
this._frame.removeEventListener("load", this, true);
|
||||||
|
|
@ -422,7 +422,7 @@ var HostFrame = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_create: function () {
|
_create: function() {
|
||||||
if (this.isReady) {
|
if (this.isReady) {
|
||||||
let doc = this.hiddenDOMDocument;
|
let doc = this.hiddenDOMDocument;
|
||||||
this._frame = doc.createElementNS(HTML_NS, "iframe");
|
this._frame = doc.createElementNS(HTML_NS, "iframe");
|
||||||
|
|
|
||||||
|
|
@ -65,13 +65,13 @@ function _handleEvent(aEvent) {
|
||||||
|
|
||||||
// Methods that impact a browser. Put into single object for organization.
|
// Methods that impact a browser. Put into single object for organization.
|
||||||
var BrowserHelper = {
|
var BrowserHelper = {
|
||||||
onOpen: function (aBrowser) {
|
onOpen: function(aBrowser) {
|
||||||
// If the tab is in the focused window, leave priority as it is
|
// If the tab is in the focused window, leave priority as it is
|
||||||
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
|
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
|
||||||
this.decreasePriority(aBrowser);
|
this.decreasePriority(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function (aBrowser) {
|
onSelect: function(aBrowser) {
|
||||||
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
|
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
|
||||||
if (windowEntry.lastSelectedBrowser)
|
if (windowEntry.lastSelectedBrowser)
|
||||||
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
||||||
|
|
@ -80,11 +80,11 @@ var BrowserHelper = {
|
||||||
windowEntry.lastSelectedBrowser = aBrowser;
|
windowEntry.lastSelectedBrowser = aBrowser;
|
||||||
},
|
},
|
||||||
|
|
||||||
increasePriority: function (aBrowser) {
|
increasePriority: function(aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA);
|
aBrowser.adjustPriority(PRIORITY_DELTA);
|
||||||
},
|
},
|
||||||
|
|
||||||
decreasePriority: function (aBrowser) {
|
decreasePriority: function(aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -92,7 +92,7 @@ var BrowserHelper = {
|
||||||
|
|
||||||
// Methods that impact a window. Put into single object for organization.
|
// Methods that impact a window. Put into single object for organization.
|
||||||
var WindowHelper = {
|
var WindowHelper = {
|
||||||
addWindow: function (aWindow) {
|
addWindow: function(aWindow) {
|
||||||
// Build internal data object
|
// Build internal data object
|
||||||
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ var WindowHelper = {
|
||||||
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeWindow: function (aWindow) {
|
removeWindow: function(aWindow) {
|
||||||
if (aWindow == _lastFocusedWindow)
|
if (aWindow == _lastFocusedWindow)
|
||||||
_lastFocusedWindow = null;
|
_lastFocusedWindow = null;
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ var WindowHelper = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onActivate: function (aWindow, aHasFocus) {
|
onActivate: function(aWindow, aHasFocus) {
|
||||||
// If this window was the last focused window, we don't need to do anything
|
// If this window was the last focused window, we don't need to do anything
|
||||||
if (aWindow == _lastFocusedWindow)
|
if (aWindow == _lastFocusedWindow)
|
||||||
return;
|
return;
|
||||||
|
|
@ -143,7 +143,7 @@ var WindowHelper = {
|
||||||
this.increasePriority(aWindow);
|
this.increasePriority(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleFocusedWindow: function (aWindow) {
|
handleFocusedWindow: function(aWindow) {
|
||||||
// If we have a last focused window, we need to deprioritize it first
|
// If we have a last focused window, we need to deprioritize it first
|
||||||
if (_lastFocusedWindow)
|
if (_lastFocusedWindow)
|
||||||
this.decreasePriority(_lastFocusedWindow);
|
this.decreasePriority(_lastFocusedWindow);
|
||||||
|
|
@ -153,23 +153,23 @@ var WindowHelper = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Auxiliary methods
|
// Auxiliary methods
|
||||||
increasePriority: function (aWindow) {
|
increasePriority: function(aWindow) {
|
||||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||||
BrowserHelper.increasePriority(aBrowser);
|
BrowserHelper.increasePriority(aBrowser);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
decreasePriority: function (aWindow) {
|
decreasePriority: function(aWindow) {
|
||||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||||
BrowserHelper.decreasePriority(aBrowser);
|
BrowserHelper.decreasePriority(aBrowser);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getEntry: function (aWindow) {
|
getEntry: function(aWindow) {
|
||||||
return _windows[this.getEntryIndex(aWindow)];
|
return _windows[this.getEntryIndex(aWindow)];
|
||||||
},
|
},
|
||||||
|
|
||||||
getEntryIndex: function (aWindow) {
|
getEntryIndex: function(aWindow) {
|
||||||
// Assumes that every object has a unique window & it's in the array
|
// Assumes that every object has a unique window & it's in the array
|
||||||
for (let i = 0; i < _windows.length; i++)
|
for (let i = 0; i < _windows.length; i++)
|
||||||
if (_windows[i].window == aWindow)
|
if (_windows[i].window == aWindow)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ Notification.prototype = {
|
||||||
/**
|
/**
|
||||||
* Removes the notification and updates the popup accordingly if needed.
|
* Removes the notification and updates the popup accordingly if needed.
|
||||||
*/
|
*/
|
||||||
remove: function () {
|
remove: function() {
|
||||||
this.owner.remove(this);
|
this.owner.remove(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ PopupNotifications.prototype = {
|
||||||
* @returns the corresponding Notification object, or null if no such
|
* @returns the corresponding Notification object, or null if no such
|
||||||
* notification exists.
|
* notification exists.
|
||||||
*/
|
*/
|
||||||
getNotification: function (id, browser) {
|
getNotification: function(id, browser) {
|
||||||
let n = null;
|
let n = null;
|
||||||
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
||||||
notifications.some(function(x) x.id == id && (n = x));
|
notifications.some(function(x) x.id == id && (n = x));
|
||||||
|
|
@ -292,7 +292,7 @@ PopupNotifications.prototype = {
|
||||||
* opens the URL in a new tab.
|
* opens the URL in a new tab.
|
||||||
* @returns the Notification object corresponding to the added notification.
|
* @returns the Notification object corresponding to the added notification.
|
||||||
*/
|
*/
|
||||||
show: function (browser, id, message, anchorID,
|
show: function(browser, id, message, anchorID,
|
||||||
mainAction, secondaryActions, options) {
|
mainAction, secondaryActions, options) {
|
||||||
function isInvalidAction(a) {
|
function isInvalidAction(a) {
|
||||||
return !a || !(typeof(a.callback) == "function") || !a.label || !a.accessKey;
|
return !a || !(typeof(a.callback) == "function") || !a.label || !a.accessKey;
|
||||||
|
|
@ -362,13 +362,13 @@ PopupNotifications.prototype = {
|
||||||
* Called by the consumer to indicate that a browser's location has changed,
|
* Called by the consumer to indicate that a browser's location has changed,
|
||||||
* so that we can update the active notifications accordingly.
|
* so that we can update the active notifications accordingly.
|
||||||
*/
|
*/
|
||||||
locationChange: function (aBrowser) {
|
locationChange: function(aBrowser) {
|
||||||
if (!aBrowser)
|
if (!aBrowser)
|
||||||
throw "PopupNotifications_locationChange: invalid browser";
|
throw "PopupNotifications_locationChange: invalid browser";
|
||||||
|
|
||||||
let notifications = this._getNotificationsForBrowser(aBrowser);
|
let notifications = this._getNotificationsForBrowser(aBrowser);
|
||||||
|
|
||||||
notifications = notifications.filter(function (notification) {
|
notifications = notifications.filter(function(notification) {
|
||||||
// The persistWhileVisible option allows an open notification to persist
|
// The persistWhileVisible option allows an open notification to persist
|
||||||
// across location changes
|
// across location changes
|
||||||
if (notification.options.persistWhileVisible &&
|
if (notification.options.persistWhileVisible &&
|
||||||
|
|
@ -415,7 +415,7 @@ PopupNotifications.prototype = {
|
||||||
* @param notification
|
* @param notification
|
||||||
* The Notification object to remove.
|
* The Notification object to remove.
|
||||||
*/
|
*/
|
||||||
remove: function (notification) {
|
remove: function(notification) {
|
||||||
this._remove(notification);
|
this._remove(notification);
|
||||||
|
|
||||||
if (notification.browser.docShell.isActive) {
|
if (notification.browser.docShell.isActive) {
|
||||||
|
|
@ -424,7 +424,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "popuphidden":
|
case "popuphidden":
|
||||||
this._onPopupHidden(aEvent);
|
this._onPopupHidden(aEvent);
|
||||||
|
|
@ -434,7 +434,7 @@ PopupNotifications.prototype = {
|
||||||
let self = this;
|
let self = this;
|
||||||
// setTimeout(..., 0) needed, otherwise openPopup from "activate" event
|
// setTimeout(..., 0) needed, otherwise openPopup from "activate" event
|
||||||
// handler results in the popup being hidden again for some reason...
|
// handler results in the popup being hidden again for some reason...
|
||||||
this.window.setTimeout(function () {
|
this.window.setTimeout(function() {
|
||||||
self._update();
|
self._update();
|
||||||
}, 0);
|
}, 0);
|
||||||
break;
|
break;
|
||||||
|
|
@ -459,7 +459,7 @@ PopupNotifications.prototype = {
|
||||||
return this.tabbrowser.selectedBrowser ? this._getNotificationsForBrowser(this.tabbrowser.selectedBrowser) : [];
|
return this.tabbrowser.selectedBrowser ? this._getNotificationsForBrowser(this.tabbrowser.selectedBrowser) : [];
|
||||||
},
|
},
|
||||||
|
|
||||||
_remove: function (notification) {
|
_remove: function(notification) {
|
||||||
// This notification may already be removed, in which case let's just fail
|
// This notification may already be removed, in which case let's just fail
|
||||||
// silently.
|
// silently.
|
||||||
let notifications = this._getNotificationsForBrowser(notification.browser);
|
let notifications = this._getNotificationsForBrowser(notification.browser);
|
||||||
|
|
@ -481,7 +481,7 @@ PopupNotifications.prototype = {
|
||||||
/**
|
/**
|
||||||
* Dismisses the notification without removing it.
|
* Dismisses the notification without removing it.
|
||||||
*/
|
*/
|
||||||
_dismiss: function () {
|
_dismiss: function() {
|
||||||
let browser = this.panel.firstChild &&
|
let browser = this.panel.firstChild &&
|
||||||
this.panel.firstChild.notification.browser;
|
this.panel.firstChild.notification.browser;
|
||||||
if (typeof this.panel.hidePopup === "function") {
|
if (typeof this.panel.hidePopup === "function") {
|
||||||
|
|
@ -494,7 +494,7 @@ PopupNotifications.prototype = {
|
||||||
/**
|
/**
|
||||||
* Hides the notification popup.
|
* Hides the notification popup.
|
||||||
*/
|
*/
|
||||||
_hidePanel: function () {
|
_hidePanel: function() {
|
||||||
this._ignoreDismissal = true;
|
this._ignoreDismissal = true;
|
||||||
if (typeof this.panel.hidePopup === "function") {
|
if (typeof this.panel.hidePopup === "function") {
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
|
|
@ -505,7 +505,7 @@ PopupNotifications.prototype = {
|
||||||
/**
|
/**
|
||||||
* Removes all notifications from the notification popup.
|
* Removes all notifications from the notification popup.
|
||||||
*/
|
*/
|
||||||
_clearPanel: function () {
|
_clearPanel: function() {
|
||||||
let popupnotification;
|
let popupnotification;
|
||||||
while ((popupnotification = this.panel.lastChild)) {
|
while ((popupnotification = this.panel.lastChild)) {
|
||||||
this.panel.removeChild(popupnotification);
|
this.panel.removeChild(popupnotification);
|
||||||
|
|
@ -536,12 +536,12 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_refreshPanel: function (notificationsToShow) {
|
_refreshPanel: function(notificationsToShow) {
|
||||||
this._clearPanel();
|
this._clearPanel();
|
||||||
|
|
||||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
|
|
||||||
notificationsToShow.forEach(function (n) {
|
notificationsToShow.forEach(function(n) {
|
||||||
let doc = this.window.document;
|
let doc = this.window.document;
|
||||||
|
|
||||||
// Append "-notification" to the ID to try to avoid ID conflicts with other stuff
|
// Append "-notification" to the ID to try to avoid ID conflicts with other stuff
|
||||||
|
|
@ -584,7 +584,7 @@ PopupNotifications.prototype = {
|
||||||
popupnotification.notification = n;
|
popupnotification.notification = n;
|
||||||
|
|
||||||
if (n.secondaryActions) {
|
if (n.secondaryActions) {
|
||||||
n.secondaryActions.forEach(function (a) {
|
n.secondaryActions.forEach(function(a) {
|
||||||
let item = doc.createElementNS(XUL_NS, "menuitem");
|
let item = doc.createElementNS(XUL_NS, "menuitem");
|
||||||
item.setAttribute("label", a.label);
|
item.setAttribute("label", a.label);
|
||||||
item.setAttribute("accesskey", a.accessKey);
|
item.setAttribute("accesskey", a.accessKey);
|
||||||
|
|
@ -653,10 +653,10 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showPanel: function (notificationsToShow, anchorElement) {
|
_showPanel: function(notificationsToShow, anchorElement) {
|
||||||
this.panel.hidden = false;
|
this.panel.hidden = false;
|
||||||
|
|
||||||
notificationsToShow.forEach(function (n) {
|
notificationsToShow.forEach(function(n) {
|
||||||
this._fireCallback(n, NOTIFICATION_EVENT_SHOWING);
|
this._fireCallback(n, NOTIFICATION_EVENT_SHOWING);
|
||||||
}, this);
|
}, this);
|
||||||
this._refreshPanel(notificationsToShow);
|
this._refreshPanel(notificationsToShow);
|
||||||
|
|
@ -686,12 +686,12 @@ PopupNotifications.prototype = {
|
||||||
// On OS X and Linux we need a different panel arrow color for
|
// On OS X and Linux we need a different panel arrow color for
|
||||||
// click-to-play plugins, so copy the popupid and use css.
|
// click-to-play plugins, so copy the popupid and use css.
|
||||||
this.panel.setAttribute("popupid", this.panel.firstChild.getAttribute("popupid"));
|
this.panel.setAttribute("popupid", this.panel.firstChild.getAttribute("popupid"));
|
||||||
notificationsToShow.forEach(function (n) {
|
notificationsToShow.forEach(function(n) {
|
||||||
// Remember the time the notification was shown for the security delay.
|
// Remember the time the notification was shown for the security delay.
|
||||||
n.timeShown = this.window.performance.now();
|
n.timeShown = this.window.performance.now();
|
||||||
}, this);
|
}, this);
|
||||||
this.panel.openPopup(anchorElement, "bottomcenter topleft");
|
this.panel.openPopup(anchorElement, "bottomcenter topleft");
|
||||||
notificationsToShow.forEach(function (n) {
|
notificationsToShow.forEach(function(n) {
|
||||||
this._fireCallback(n, NOTIFICATION_EVENT_SHOWN);
|
this._fireCallback(n, NOTIFICATION_EVENT_SHOWN);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
@ -709,7 +709,7 @@ PopupNotifications.prototype = {
|
||||||
* if there are no notifications to show. Otherwise,
|
* if there are no notifications to show. Otherwise,
|
||||||
* currently displayed notifications will be left alone.
|
* currently displayed notifications will be left alone.
|
||||||
*/
|
*/
|
||||||
_update: function (notifications, anchor, dismissShowing = false) {
|
_update: function(notifications, anchor, dismissShowing = false) {
|
||||||
let useIconBox = this.iconBox && (!anchor || anchor.parentNode == this.iconBox);
|
let useIconBox = this.iconBox && (!anchor || anchor.parentNode == this.iconBox);
|
||||||
if (useIconBox) {
|
if (useIconBox) {
|
||||||
// hide icons of the previous tab.
|
// hide icons of the previous tab.
|
||||||
|
|
@ -747,7 +747,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also filter out notifications that have been dismissed.
|
// Also filter out notifications that have been dismissed.
|
||||||
notificationsToShow = notifications.filter(function (n) {
|
notificationsToShow = notifications.filter(function(n) {
|
||||||
return !n.dismissed && n.anchorElement == anchorElement &&
|
return !n.dismissed && n.anchorElement == anchorElement &&
|
||||||
!n.options.neverShow;
|
!n.options.neverShow;
|
||||||
});
|
});
|
||||||
|
|
@ -777,7 +777,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showIcons: function (aCurrentNotifications) {
|
_showIcons: function(aCurrentNotifications) {
|
||||||
for (let notification of aCurrentNotifications) {
|
for (let notification of aCurrentNotifications) {
|
||||||
let anchorElm = notification.anchorElement;
|
let anchorElm = notification.anchorElement;
|
||||||
if (anchorElm) {
|
if (anchorElm) {
|
||||||
|
|
@ -786,7 +786,7 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideIcons: function () {
|
_hideIcons: function() {
|
||||||
let icons = this.iconBox.querySelectorAll(ICON_SELECTOR);
|
let icons = this.iconBox.querySelectorAll(ICON_SELECTOR);
|
||||||
for (let icon of icons) {
|
for (let icon of icons) {
|
||||||
icon.removeAttribute(ICON_ATTRIBUTE_SHOWING);
|
icon.removeAttribute(ICON_ATTRIBUTE_SHOWING);
|
||||||
|
|
@ -796,7 +796,7 @@ PopupNotifications.prototype = {
|
||||||
/**
|
/**
|
||||||
* Gets and sets notifications for the browser.
|
* Gets and sets notifications for the browser.
|
||||||
*/
|
*/
|
||||||
_getNotificationsForBrowser: function (browser) {
|
_getNotificationsForBrowser: function(browser) {
|
||||||
let notifications = popupNotificationsMap.get(browser);
|
let notifications = popupNotificationsMap.get(browser);
|
||||||
if (!notifications) {
|
if (!notifications) {
|
||||||
// Initialize the WeakMap for the browser so callers can reference/manipulate the array.
|
// Initialize the WeakMap for the browser so callers can reference/manipulate the array.
|
||||||
|
|
@ -805,12 +805,12 @@ PopupNotifications.prototype = {
|
||||||
}
|
}
|
||||||
return notifications;
|
return notifications;
|
||||||
},
|
},
|
||||||
_setNotificationsForBrowser: function (browser, notifications) {
|
_setNotificationsForBrowser: function(browser, notifications) {
|
||||||
popupNotificationsMap.set(browser, notifications);
|
popupNotificationsMap.set(browser, notifications);
|
||||||
return notifications;
|
return notifications;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIconBoxCommand: function (event) {
|
_onIconBoxCommand: function(event) {
|
||||||
// Left click, space or enter only
|
// Left click, space or enter only
|
||||||
let type = event.type;
|
let type = event.type;
|
||||||
if (type == "click" && event.button != 0)
|
if (type == "click" && event.button != 0)
|
||||||
|
|
@ -832,10 +832,10 @@ PopupNotifications.prototype = {
|
||||||
this._reshowNotifications(anchor);
|
this._reshowNotifications(anchor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_reshowNotifications: function (anchor, browser) {
|
_reshowNotifications: function(anchor, browser) {
|
||||||
// Mark notifications anchored to this anchor as un-dismissed
|
// Mark notifications anchored to this anchor as un-dismissed
|
||||||
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
||||||
notifications.forEach(function (n) {
|
notifications.forEach(function(n) {
|
||||||
if (n.anchorElement == anchor)
|
if (n.anchorElement == anchor)
|
||||||
n.dismissed = false;
|
n.dismissed = false;
|
||||||
});
|
});
|
||||||
|
|
@ -844,7 +844,7 @@ PopupNotifications.prototype = {
|
||||||
this._update(notifications, anchor);
|
this._update(notifications, anchor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_swapBrowserNotifications: function (ourBrowser, otherBrowser) {
|
_swapBrowserNotifications: function(ourBrowser, otherBrowser) {
|
||||||
// When swaping browser docshells (e.g. dragging tab to new window) we need
|
// When swaping browser docshells (e.g. dragging tab to new window) we need
|
||||||
// to update our notification map.
|
// to update our notification map.
|
||||||
|
|
||||||
|
|
@ -890,7 +890,7 @@ PopupNotifications.prototype = {
|
||||||
other._update(ourNotifications, ourNotifications[0].anchorElement);
|
other._update(ourNotifications, ourNotifications[0].anchorElement);
|
||||||
},
|
},
|
||||||
|
|
||||||
_fireCallback: function (n, event, ...args) {
|
_fireCallback: function(n, event, ...args) {
|
||||||
try {
|
try {
|
||||||
if (n.options.eventCallback)
|
if (n.options.eventCallback)
|
||||||
return n.options.eventCallback.call(n, event, ...args);
|
return n.options.eventCallback.call(n, event, ...args);
|
||||||
|
|
@ -900,7 +900,7 @@ PopupNotifications.prototype = {
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupHidden: function (event) {
|
_onPopupHidden: function(event) {
|
||||||
if (event.target != this.panel || this._ignoreDismissal)
|
if (event.target != this.panel || this._ignoreDismissal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -911,7 +911,7 @@ PopupNotifications.prototype = {
|
||||||
|
|
||||||
let notifications = this._getNotificationsForBrowser(browser);
|
let notifications = this._getNotificationsForBrowser(browser);
|
||||||
// Mark notifications as dismissed and call dismissal callbacks
|
// Mark notifications as dismissed and call dismissal callbacks
|
||||||
Array.forEach(this.panel.childNodes, function (nEl) {
|
Array.forEach(this.panel.childNodes, function(nEl) {
|
||||||
let notificationObj = nEl.notification;
|
let notificationObj = nEl.notification;
|
||||||
// Never call a dismissal handler on a notification that's been removed.
|
// Never call a dismissal handler on a notification that's been removed.
|
||||||
if (notifications.indexOf(notificationObj) == -1)
|
if (notifications.indexOf(notificationObj) == -1)
|
||||||
|
|
@ -932,7 +932,7 @@ PopupNotifications.prototype = {
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonCommand: function (event) {
|
_onButtonCommand: function(event) {
|
||||||
let notificationEl = getNotificationFromElement(event.originalTarget);
|
let notificationEl = getNotificationFromElement(event.originalTarget);
|
||||||
|
|
||||||
if (!notificationEl)
|
if (!notificationEl)
|
||||||
|
|
@ -968,7 +968,7 @@ PopupNotifications.prototype = {
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuCommand: function (event) {
|
_onMenuCommand: function(event) {
|
||||||
let target = event.originalTarget;
|
let target = event.originalTarget;
|
||||||
if (!target.action || !target.notification)
|
if (!target.action || !target.notification)
|
||||||
throw "menucommand target has no associated action/notification";
|
throw "menucommand target has no associated action/notification";
|
||||||
|
|
@ -988,7 +988,7 @@ PopupNotifications.prototype = {
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_notify: function (topic) {
|
_notify: function(topic) {
|
||||||
Services.obs.notifyObservers(null, "PopupNotifications-" + topic, "");
|
Services.obs.notifyObservers(null, "PopupNotifications-" + topic, "");
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ this.RecentWindow = {
|
||||||
* Omit the property to search in both groups.
|
* Omit the property to search in both groups.
|
||||||
* * allowPopups: true if popup windows are permissable.
|
* * allowPopups: true if popup windows are permissable.
|
||||||
*/
|
*/
|
||||||
getMostRecentBrowserWindow: function (aOptions) {
|
getMostRecentBrowserWindow: function(aOptions) {
|
||||||
let checkPrivacy = typeof aOptions == "object" &&
|
let checkPrivacy = typeof aOptions == "object" &&
|
||||||
"private" in aOptions;
|
"private" in aOptions;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ this.WinTaskbarJumpList =
|
||||||
* Startup, shutdown, and update
|
* Startup, shutdown, and update
|
||||||
*/
|
*/
|
||||||
|
|
||||||
startup: function () {
|
startup: function() {
|
||||||
// exit if this isn't win7 or higher.
|
// exit if this isn't win7 or higher.
|
||||||
if (!this._initTaskbar())
|
if (!this._initTaskbar())
|
||||||
return;
|
return;
|
||||||
|
|
@ -175,7 +175,7 @@ this.WinTaskbarJumpList =
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function () {
|
update: function() {
|
||||||
// are we disabled via prefs? don't do anything!
|
// are we disabled via prefs? don't do anything!
|
||||||
if (!this._enabled)
|
if (!this._enabled)
|
||||||
return;
|
return;
|
||||||
|
|
@ -184,7 +184,7 @@ this.WinTaskbarJumpList =
|
||||||
this._buildList();
|
this._buildList();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shutdown: function () {
|
_shutdown: function() {
|
||||||
this._shuttingDown = true;
|
this._shuttingDown = true;
|
||||||
|
|
||||||
// Correctly handle a clear history on shutdown. If there are no
|
// Correctly handle a clear history on shutdown. If there are no
|
||||||
|
|
@ -197,7 +197,7 @@ this.WinTaskbarJumpList =
|
||||||
this._free();
|
this._free();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shortcutMaintenance: function () {
|
_shortcutMaintenance: function() {
|
||||||
_winShellService.shortcutMaintenance();
|
_winShellService.shortcutMaintenance();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -212,11 +212,11 @@ this.WinTaskbarJumpList =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_pendingStatements: {},
|
_pendingStatements: {},
|
||||||
_hasPendingStatements: function () {
|
_hasPendingStatements: function() {
|
||||||
return Object.keys(this._pendingStatements).length > 0;
|
return Object.keys(this._pendingStatements).length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildList: function () {
|
_buildList: function() {
|
||||||
if (this._hasPendingStatements()) {
|
if (this._hasPendingStatements()) {
|
||||||
// We were requested to update the list while another update was in
|
// We were requested to update the list while another update was in
|
||||||
// progress, this could happen at shutdown, idle or privatebrowsing.
|
// progress, this could happen at shutdown, idle or privatebrowsing.
|
||||||
|
|
@ -255,7 +255,7 @@ this.WinTaskbarJumpList =
|
||||||
* Taskbar api wrappers
|
* Taskbar api wrappers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_startBuild: function () {
|
_startBuild: function() {
|
||||||
var removedItems = Cc["@mozilla.org/array;1"].
|
var removedItems = Cc["@mozilla.org/array;1"].
|
||||||
createInstance(Ci.nsIMutableArray);
|
createInstance(Ci.nsIMutableArray);
|
||||||
this._builder.abortListBuild();
|
this._builder.abortListBuild();
|
||||||
|
|
@ -267,16 +267,16 @@ this.WinTaskbarJumpList =
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_commitBuild: function () {
|
_commitBuild: function() {
|
||||||
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
||||||
this._builder.abortListBuild();
|
this._builder.abortListBuild();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildTasks: function () {
|
_buildTasks: function() {
|
||||||
var items = Cc["@mozilla.org/array;1"].
|
var items = Cc["@mozilla.org/array;1"].
|
||||||
createInstance(Ci.nsIMutableArray);
|
createInstance(Ci.nsIMutableArray);
|
||||||
this._tasks.forEach(function (task) {
|
this._tasks.forEach(function(task) {
|
||||||
if ((this._shuttingDown && !task.close) || (!this._shuttingDown && !task.open))
|
if ((this._shuttingDown && !task.close) || (!this._shuttingDown && !task.open))
|
||||||
return;
|
return;
|
||||||
var item = this._getHandlerAppItem(task.title, task.description,
|
var item = this._getHandlerAppItem(task.title, task.description,
|
||||||
|
|
@ -288,12 +288,12 @@ this.WinTaskbarJumpList =
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildCustom: function (title, items) {
|
_buildCustom: function(title, items) {
|
||||||
if (items.length > 0)
|
if (items.length > 0)
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildFrequent: function () {
|
_buildFrequent: function() {
|
||||||
// If history is empty, just bail out.
|
// If history is empty, just bail out.
|
||||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -313,7 +313,7 @@ this.WinTaskbarJumpList =
|
||||||
this._pendingStatements[LIST_TYPE.FREQUENT] = this._getHistoryResults(
|
this._pendingStatements[LIST_TYPE.FREQUENT] = this._getHistoryResults(
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING,
|
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING,
|
||||||
this._maxItemCount,
|
this._maxItemCount,
|
||||||
function (aResult) {
|
function(aResult) {
|
||||||
if (!aResult) {
|
if (!aResult) {
|
||||||
delete this._pendingStatements[LIST_TYPE.FREQUENT];
|
delete this._pendingStatements[LIST_TYPE.FREQUENT];
|
||||||
// The are no more results, build the list.
|
// The are no more results, build the list.
|
||||||
|
|
@ -333,7 +333,7 @@ this.WinTaskbarJumpList =
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildRecent: function () {
|
_buildRecent: function() {
|
||||||
// If history is empty, just bail out.
|
// If history is empty, just bail out.
|
||||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -348,7 +348,7 @@ this.WinTaskbarJumpList =
|
||||||
this._pendingStatements[LIST_TYPE.RECENT] = this._getHistoryResults(
|
this._pendingStatements[LIST_TYPE.RECENT] = this._getHistoryResults(
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING,
|
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING,
|
||||||
this._maxItemCount * 2,
|
this._maxItemCount * 2,
|
||||||
function (aResult) {
|
function(aResult) {
|
||||||
if (!aResult) {
|
if (!aResult) {
|
||||||
// The are no more results, build the list.
|
// The are no more results, build the list.
|
||||||
this._buildCustom(_getString("taskbar.recent.label"), items);
|
this._buildCustom(_getString("taskbar.recent.label"), items);
|
||||||
|
|
@ -378,7 +378,7 @@ this.WinTaskbarJumpList =
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_deleteActiveJumpList: function () {
|
_deleteActiveJumpList: function() {
|
||||||
this._builder.deleteActiveList();
|
this._builder.deleteActiveList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -386,7 +386,7 @@ this.WinTaskbarJumpList =
|
||||||
* Jump list item creation helpers
|
* Jump list item creation helpers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_getHandlerAppItem: function (name, description,
|
_getHandlerAppItem: function(name, description,
|
||||||
args, iconIndex,
|
args, iconIndex,
|
||||||
faviconPageUri) {
|
faviconPageUri) {
|
||||||
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
||||||
|
|
@ -408,7 +408,7 @@ this.WinTaskbarJumpList =
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSeparatorItem: function () {
|
_getSeparatorItem: function() {
|
||||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
||||||
createInstance(Ci.nsIJumpListSeparator);
|
createInstance(Ci.nsIJumpListSeparator);
|
||||||
return item;
|
return item;
|
||||||
|
|
@ -419,7 +419,7 @@ this.WinTaskbarJumpList =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_getHistoryResults:
|
_getHistoryResults:
|
||||||
function (aSortingMode, aLimit, aCallback, aScope) {
|
function(aSortingMode, aLimit, aCallback, aScope) {
|
||||||
var options = PlacesUtils.history.getNewQueryOptions();
|
var options = PlacesUtils.history.getNewQueryOptions();
|
||||||
options.maxResults = aLimit;
|
options.maxResults = aLimit;
|
||||||
options.sortingMode = aSortingMode;
|
options.sortingMode = aSortingMode;
|
||||||
|
|
@ -428,7 +428,7 @@ this.WinTaskbarJumpList =
|
||||||
// Return the pending statement to the caller, to allow cancelation.
|
// Return the pending statement to the caller, to allow cancelation.
|
||||||
return PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
|
return PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
|
||||||
.asyncExecuteLegacyQueries([query], 1, options, {
|
.asyncExecuteLegacyQueries([query], 1, options, {
|
||||||
handleResult: function (aResultSet) {
|
handleResult: function(aResultSet) {
|
||||||
for (let row; (row = aResultSet.getNextRow());) {
|
for (let row; (row = aResultSet.getNextRow());) {
|
||||||
try {
|
try {
|
||||||
aCallback.call(aScope,
|
aCallback.call(aScope,
|
||||||
|
|
@ -438,17 +438,17 @@ this.WinTaskbarJumpList =
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleError: function (aError) {
|
handleError: function(aError) {
|
||||||
Components.utils.reportError(
|
Components.utils.reportError(
|
||||||
"Async execution error (" + aError.result + "): " + aError.message);
|
"Async execution error (" + aError.result + "): " + aError.message);
|
||||||
},
|
},
|
||||||
handleCompletion: function (aReason) {
|
handleCompletion: function(aReason) {
|
||||||
aCallback.call(WinTaskbarJumpList, null);
|
aCallback.call(WinTaskbarJumpList, null);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearHistory: function (items) {
|
_clearHistory: function(items) {
|
||||||
if (!items)
|
if (!items)
|
||||||
return;
|
return;
|
||||||
var URIsToRemove = [];
|
var URIsToRemove = [];
|
||||||
|
|
@ -471,7 +471,7 @@ this.WinTaskbarJumpList =
|
||||||
* Prefs utilities
|
* Prefs utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_refreshPrefs: function () {
|
_refreshPrefs: function() {
|
||||||
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
||||||
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
||||||
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
||||||
|
|
@ -483,7 +483,7 @@ this.WinTaskbarJumpList =
|
||||||
* Init and shutdown utilities
|
* Init and shutdown utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_initTaskbar: function () {
|
_initTaskbar: function() {
|
||||||
this._builder = _taskbarService.createJumpListBuilder();
|
this._builder = _taskbarService.createJumpListBuilder();
|
||||||
if (!this._builder || !this._builder.available)
|
if (!this._builder || !this._builder.available)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -491,7 +491,7 @@ this.WinTaskbarJumpList =
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initObs: function () {
|
_initObs: function() {
|
||||||
// If the browser is closed while in private browsing mode, the "exit"
|
// If the browser is closed while in private browsing mode, the "exit"
|
||||||
// notification is fired on quit-application-granted.
|
// notification is fired on quit-application-granted.
|
||||||
// History cleanup can happen at profile-change-teardown.
|
// History cleanup can happen at profile-change-teardown.
|
||||||
|
|
@ -500,13 +500,13 @@ this.WinTaskbarJumpList =
|
||||||
_prefs.addObserver("", this, false);
|
_prefs.addObserver("", this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_freeObs: function () {
|
_freeObs: function() {
|
||||||
Services.obs.removeObserver(this, "profile-before-change");
|
Services.obs.removeObserver(this, "profile-before-change");
|
||||||
Services.obs.removeObserver(this, "browser:purge-session-history");
|
Services.obs.removeObserver(this, "browser:purge-session-history");
|
||||||
_prefs.removeObserver("", this);
|
_prefs.removeObserver("", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTimer: function () {
|
_updateTimer: function() {
|
||||||
if (this._enabled && !this._shuttingDown && !this._timer) {
|
if (this._enabled && !this._shuttingDown && !this._timer) {
|
||||||
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
this._timer.initWithCallback(this,
|
this._timer.initWithCallback(this,
|
||||||
|
|
@ -520,7 +520,7 @@ this.WinTaskbarJumpList =
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasIdleObserver: false,
|
_hasIdleObserver: false,
|
||||||
_updateIdleObserver: function () {
|
_updateIdleObserver: function() {
|
||||||
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
||||||
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||||
this._hasIdleObserver = true;
|
this._hasIdleObserver = true;
|
||||||
|
|
@ -531,7 +531,7 @@ this.WinTaskbarJumpList =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_free: function () {
|
_free: function() {
|
||||||
this._freeObs();
|
this._freeObs();
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
|
|
@ -542,13 +542,13 @@ this.WinTaskbarJumpList =
|
||||||
* Notification handlers
|
* Notification handlers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
notify: function (aTimer) {
|
notify: function(aTimer) {
|
||||||
// Add idle observer on the first notification so it doesn't hit startup.
|
// Add idle observer on the first notification so it doesn't hit startup.
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
var gOpenLocationLastURLData = "";
|
var gOpenLocationLastURLData = "";
|
||||||
|
|
||||||
var observer = {
|
var observer = {
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function(aIID) {
|
||||||
if (aIID.equals(Components.interfaces.nsIObserver) ||
|
if (aIID.equals(Components.interfaces.nsIObserver) ||
|
||||||
aIID.equals(Components.interfaces.nsISupports) ||
|
aIID.equals(Components.interfaces.nsISupports) ||
|
||||||
aIID.equals(Components.interfaces.nsISupportsWeakReference))
|
aIID.equals(Components.interfaces.nsISupportsWeakReference))
|
||||||
return this;
|
return this;
|
||||||
throw Components.results.NS_NOINTERFACE;
|
throw Components.results.NS_NOINTERFACE;
|
||||||
},
|
},
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "last-pb-context-exited":
|
case "last-pb-context-exited":
|
||||||
gOpenLocationLastURLData = "";
|
gOpenLocationLastURLData = "";
|
||||||
|
|
@ -46,7 +46,7 @@ this.OpenLocationLastURL = function OpenLocationLastURL(aWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenLocationLastURL.prototype = {
|
OpenLocationLastURL.prototype = {
|
||||||
isPrivate: function () {
|
isPrivate: function() {
|
||||||
// Assume not in private browsing mode, unless the browser window is
|
// Assume not in private browsing mode, unless the browser window is
|
||||||
// in private mode.
|
// in private mode.
|
||||||
if (!this.window)
|
if (!this.window)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue