mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 02:47:31 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
9d612014f8
80 changed files with 1267 additions and 1198 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
* Tab previews utility, produces thumbnails
|
* Tab previews utility, produces thumbnails
|
||||||
*/
|
*/
|
||||||
var tabPreviews = {
|
var tabPreviews = {
|
||||||
init: function tabPreviews_init() {
|
init: function() {
|
||||||
if (this._selectedTab)
|
if (this._selectedTab)
|
||||||
return;
|
return;
|
||||||
this._selectedTab = gBrowser.selectedTab;
|
this._selectedTab = gBrowser.selectedTab;
|
||||||
|
|
@ -21,7 +21,7 @@ var tabPreviews = {
|
||||||
this.aspectRatio = height.value / width.value;
|
this.aspectRatio = height.value / width.value;
|
||||||
},
|
},
|
||||||
|
|
||||||
get: function tabPreviews_get(aTab) {
|
get: function(aTab) {
|
||||||
let uri = aTab.linkedBrowser.currentURI.spec;
|
let uri = aTab.linkedBrowser.currentURI.spec;
|
||||||
|
|
||||||
if (aTab.__thumbnail_lastURI &&
|
if (aTab.__thumbnail_lastURI &&
|
||||||
|
|
@ -42,7 +42,7 @@ var tabPreviews = {
|
||||||
return this.capture(aTab, !aTab.hasAttribute("busy"));
|
return this.capture(aTab, !aTab.hasAttribute("busy"));
|
||||||
},
|
},
|
||||||
|
|
||||||
capture: function tabPreviews_capture(aTab, aShouldCache) {
|
capture: function(aTab, aShouldCache) {
|
||||||
let browser = aTab.linkedBrowser;
|
let browser = aTab.linkedBrowser;
|
||||||
let uri = browser.currentURI.spec;
|
let uri = browser.currentURI.spec;
|
||||||
let canvas = PageThumbs.createCanvas(window);
|
let canvas = PageThumbs.createCanvas(window);
|
||||||
|
|
@ -67,7 +67,7 @@ var tabPreviews = {
|
||||||
return canvas;
|
return canvas;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function tabPreviews_handleEvent(event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "TabSelect":
|
case "TabSelect":
|
||||||
if (this._selectedTab &&
|
if (this._selectedTab &&
|
||||||
|
|
@ -193,7 +193,7 @@ var ctrlTab = {
|
||||||
return this._recentlyUsedTabs;
|
return this._recentlyUsedTabs;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function ctrlTab_init() {
|
init: function() {
|
||||||
if (!this._recentlyUsedTabs) {
|
if (!this._recentlyUsedTabs) {
|
||||||
tabPreviews.init();
|
tabPreviews.init();
|
||||||
|
|
||||||
|
|
@ -202,13 +202,13 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function ctrlTab_uninit() {
|
uninit: function() {
|
||||||
this._recentlyUsedTabs = null;
|
this._recentlyUsedTabs = null;
|
||||||
this._init(false);
|
this._init(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
prefName: "browser.ctrlTab.previews",
|
prefName: "browser.ctrlTab.previews",
|
||||||
readPref: function ctrlTab_readPref() {
|
readPref: function() {
|
||||||
var enable =
|
var enable =
|
||||||
gPrefService.getBoolPref(this.prefName) &&
|
gPrefService.getBoolPref(this.prefName) &&
|
||||||
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
|
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
|
||||||
|
|
@ -223,7 +223,7 @@ var ctrlTab = {
|
||||||
this.readPref();
|
this.readPref();
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreviews: function ctrlTab_updatePreviews() {
|
updatePreviews: function() {
|
||||||
for (let i = 0; i < this.previews.length; i++)
|
for (let i = 0; i < this.previews.length; i++)
|
||||||
this.updatePreview(this.previews[i], this.tabList[i]);
|
this.updatePreview(this.previews[i], this.tabList[i]);
|
||||||
|
|
||||||
|
|
@ -233,7 +233,7 @@ var ctrlTab = {
|
||||||
this.showAllButton.hidden = !allTabs.canOpen;
|
this.showAllButton.hidden = !allTabs.canOpen;
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreview: function ctrlTab_updatePreview(aPreview, aTab) {
|
updatePreview: function(aPreview, aTab) {
|
||||||
if (aPreview == this.showAllButton)
|
if (aPreview == this.showAllButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -267,7 +267,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
advanceFocus: function ctrlTab_advanceFocus(aForward) {
|
advanceFocus: function(aForward) {
|
||||||
let selectedIndex = Array.indexOf(this.previews, this.selected);
|
let selectedIndex = Array.indexOf(this.previews, this.selected);
|
||||||
do {
|
do {
|
||||||
selectedIndex += aForward ? 1 : -1;
|
selectedIndex += aForward ? 1 : -1;
|
||||||
|
|
@ -291,12 +291,12 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseOverFocus: function ctrlTab_mouseOverFocus(aPreview) {
|
_mouseOverFocus: function(aPreview) {
|
||||||
if (this._trackMouseOver)
|
if (this._trackMouseOver)
|
||||||
aPreview.focus();
|
aPreview.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
pick: function ctrlTab_pick(aPreview) {
|
pick: function(aPreview) {
|
||||||
if (!this.tabCount)
|
if (!this.tabCount)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -308,17 +308,17 @@ var ctrlTab = {
|
||||||
this.close(select._tab);
|
this.close(select._tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
showAllTabs: function ctrlTab_showAllTabs(aPreview) {
|
showAllTabs: function(aPreview) {
|
||||||
this.close();
|
this.close();
|
||||||
document.getElementById("Browser:ShowAllTabs").doCommand();
|
document.getElementById("Browser:ShowAllTabs").doCommand();
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function ctrlTab_remove(aPreview) {
|
remove: function(aPreview) {
|
||||||
if (aPreview._tab)
|
if (aPreview._tab)
|
||||||
gBrowser.removeTab(aPreview._tab);
|
gBrowser.removeTab(aPreview._tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
attachTab: function ctrlTab_attachTab(aTab, aPos) {
|
attachTab: function(aTab, aPos) {
|
||||||
if (aTab.closing)
|
if (aTab.closing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -330,13 +330,13 @@ var ctrlTab = {
|
||||||
this._recentlyUsedTabs.push(aTab);
|
this._recentlyUsedTabs.push(aTab);
|
||||||
},
|
},
|
||||||
|
|
||||||
detachTab: function ctrlTab_detachTab(aTab) {
|
detachTab: function(aTab) {
|
||||||
var i = this._recentlyUsedTabs.indexOf(aTab);
|
var i = this._recentlyUsedTabs.indexOf(aTab);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
this._recentlyUsedTabs.splice(i, 1);
|
this._recentlyUsedTabs.splice(i, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function ctrlTab_open() {
|
open: function() {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ var ctrlTab = {
|
||||||
}, 200, this);
|
}, 200, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_openPanel: function ctrlTab_openPanel() {
|
_openPanel: function() {
|
||||||
tabPreviewPanelHelper.opening(this);
|
tabPreviewPanelHelper.opening(this);
|
||||||
|
|
||||||
this.panel.width = Math.min(screen.availWidth * .99,
|
this.panel.width = Math.min(screen.availWidth * .99,
|
||||||
|
|
@ -364,7 +364,7 @@ var ctrlTab = {
|
||||||
false);
|
false);
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function ctrlTab_close(aTabToSelect) {
|
close: function(aTabToSelect) {
|
||||||
if (!this.isOpen)
|
if (!this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -381,7 +381,7 @@ var ctrlTab = {
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
},
|
},
|
||||||
|
|
||||||
setupGUI: function ctrlTab_setupGUI() {
|
setupGUI: function() {
|
||||||
this.selected.focus();
|
this.selected.focus();
|
||||||
this._selectedIndex = -1;
|
this._selectedIndex = -1;
|
||||||
|
|
||||||
|
|
@ -394,7 +394,7 @@ var ctrlTab = {
|
||||||
}, 0, this);
|
}, 0, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
suspendGUI: function ctrlTab_suspendGUI() {
|
suspendGUI: function() {
|
||||||
document.removeEventListener("keyup", this, true);
|
document.removeEventListener("keyup", this, true);
|
||||||
|
|
||||||
for (let preview of this.previews) {
|
for (let preview of this.previews) {
|
||||||
|
|
@ -447,7 +447,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
removeClosingTabFromUI: function ctrlTab_removeClosingTabFromUI(aTab) {
|
removeClosingTabFromUI: function(aTab) {
|
||||||
if (this.tabCount == 2) {
|
if (this.tabCount == 2) {
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
|
|
@ -468,7 +468,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function ctrlTab_handleEvent(event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "SSWindowRestored":
|
case "SSWindowRestored":
|
||||||
this._initRecentlyUsedTabs();
|
this._initRecentlyUsedTabs();
|
||||||
|
|
@ -528,7 +528,7 @@ var ctrlTab = {
|
||||||
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
|
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function ctrlTab__init(enable) {
|
_init: function(enable) {
|
||||||
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
||||||
|
|
||||||
window[toggleEventListener]("SSWindowRestored", this, false);
|
window[toggleEventListener]("SSWindowRestored", this, false);
|
||||||
|
|
@ -575,7 +575,7 @@ var allTabs = {
|
||||||
return isElementVisible(this.toolbarButton);
|
return isElementVisible(this.toolbarButton);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function allTabs_open() {
|
open: function() {
|
||||||
if (this.canOpen) {
|
if (this.canOpen) {
|
||||||
// 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.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// Initialization & Destruction
|
// Initialization & Destruction
|
||||||
|
|
||||||
init: function FullZoom_init() {
|
init: function() {
|
||||||
gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this);
|
gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this);
|
||||||
|
|
||||||
// Register ourselves with the service so we know when our pref changes.
|
// Register ourselves with the service so we know when our pref changes.
|
||||||
|
|
@ -66,7 +66,7 @@ var FullZoom = {
|
||||||
this._initialLocations = null;
|
this._initialLocations = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function FullZoom_destroy() {
|
destroy: function() {
|
||||||
gPrefService.removeObserver("browser.zoom.", this);
|
gPrefService.removeObserver("browser.zoom.", this);
|
||||||
this._cps2.removeObserverForName(this.name, this);
|
this._cps2.removeObserverForName(this.name, this);
|
||||||
gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
|
gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
|
||||||
|
|
@ -77,7 +77,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
|
|
||||||
handleEvent: function FullZoom_handleEvent(event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "ZoomChangeUsingMouseWheel":
|
case "ZoomChangeUsingMouseWheel":
|
||||||
let browser = this._getTargetedBrowser(event);
|
let browser = this._getTargetedBrowser(event);
|
||||||
|
|
@ -108,11 +108,11 @@ var FullZoom = {
|
||||||
|
|
||||||
// nsIContentPrefObserver
|
// nsIContentPrefObserver
|
||||||
|
|
||||||
onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue, aIsPrivate) {
|
onContentPrefSet: function(aGroup, aName, aValue, aIsPrivate) {
|
||||||
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
|
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName, aIsPrivate) {
|
onContentPrefRemoved: function(aGroup, aName, aIsPrivate) {
|
||||||
this._onContentPrefChanged(aGroup, undefined, aIsPrivate);
|
this._onContentPrefChanged(aGroup, undefined, aIsPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ var FullZoom = {
|
||||||
* @param aValue The new value of the changed preference. Pass undefined to
|
* @param aValue The new value of the changed preference. Pass undefined to
|
||||||
* indicate the preference's removal.
|
* indicate the preference's removal.
|
||||||
*/
|
*/
|
||||||
_onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue, aIsPrivate) {
|
_onContentPrefChanged: function(aGroup, aValue, aIsPrivate) {
|
||||||
if (this._isNextContentPrefChangeInternal) {
|
if (this._isNextContentPrefChangeInternal) {
|
||||||
// Ignore changes that FullZoom itself makes. This works because the
|
// Ignore changes that FullZoom itself makes. This works because the
|
||||||
// content pref service calls callbacks before notifying observers, and it
|
// content pref service calls callbacks before notifying observers, and it
|
||||||
|
|
@ -175,7 +175,7 @@ var FullZoom = {
|
||||||
* @param aBrowser
|
* @param aBrowser
|
||||||
* (optional) browser object displaying the document
|
* (optional) browser object displaying the document
|
||||||
*/
|
*/
|
||||||
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
|
onLocationChange: function(aURI, aIsTabSwitch, aBrowser) {
|
||||||
let browser = aBrowser || gBrowser.selectedBrowser;
|
let browser = aBrowser || gBrowser.selectedBrowser;
|
||||||
|
|
||||||
// If we haven't been initialized yet but receive an onLocationChange
|
// If we haven't been initialized yet but receive an onLocationChange
|
||||||
|
|
@ -237,7 +237,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// update state of zoom type menu item
|
// update state of zoom type menu item
|
||||||
|
|
||||||
updateMenu: function FullZoom_updateMenu() {
|
updateMenu: function() {
|
||||||
var menuItem = document.getElementById("toggle_zoom");
|
var menuItem = document.getElementById("toggle_zoom");
|
||||||
|
|
||||||
menuItem.setAttribute("checked", !ZoomManager.useFullZoom);
|
menuItem.setAttribute("checked", !ZoomManager.useFullZoom);
|
||||||
|
|
@ -248,7 +248,7 @@ var FullZoom = {
|
||||||
/**
|
/**
|
||||||
* Reduces the zoom level of the page in the current browser.
|
* Reduces the zoom level of the page in the current browser.
|
||||||
*/
|
*/
|
||||||
reduce: function FullZoom_reduce() {
|
reduce: function() {
|
||||||
ZoomManager.reduce();
|
ZoomManager.reduce();
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
this._ignorePendingZoomAccesses(browser);
|
this._ignorePendingZoomAccesses(browser);
|
||||||
|
|
@ -258,7 +258,7 @@ var FullZoom = {
|
||||||
/**
|
/**
|
||||||
* Enlarges the zoom level of the page in the current browser.
|
* Enlarges the zoom level of the page in the current browser.
|
||||||
*/
|
*/
|
||||||
enlarge: function FullZoom_enlarge() {
|
enlarge: function() {
|
||||||
ZoomManager.enlarge();
|
ZoomManager.enlarge();
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
this._ignorePendingZoomAccesses(browser);
|
this._ignorePendingZoomAccesses(browser);
|
||||||
|
|
@ -281,7 +281,7 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @return A promise which resolves when the zoom reset has been applied.
|
* @return A promise which resolves when the zoom reset has been applied.
|
||||||
*/
|
*/
|
||||||
reset: function FullZoom_reset(browser = gBrowser.selectedBrowser) {
|
reset: function(browser = gBrowser.selectedBrowser) {
|
||||||
let token = this._getBrowserToken(browser);
|
let token = this._getBrowserToken(browser);
|
||||||
let result = this._getGlobalValue(browser).then(value => {
|
let result = this._getGlobalValue(browser).then(value => {
|
||||||
if (token.isCurrent) {
|
if (token.isCurrent) {
|
||||||
|
|
@ -317,7 +317,7 @@ var FullZoom = {
|
||||||
* @param aBrowser The zoom is set in this browser. Required.
|
* @param aBrowser The zoom is set in this browser. Required.
|
||||||
* @param aCallback If given, it's asynchronously called when complete.
|
* @param aCallback If given, it's asynchronously called when complete.
|
||||||
*/
|
*/
|
||||||
_applyPrefToZoom: function FullZoom__applyPrefToZoom(aValue, aBrowser, aCallback) {
|
_applyPrefToZoom: function(aValue, aBrowser, aCallback) {
|
||||||
if (!this.siteSpecific || gInPrintPreviewMode) {
|
if (!this.siteSpecific || gInPrintPreviewMode) {
|
||||||
this._executeSoon(aCallback);
|
this._executeSoon(aCallback);
|
||||||
return;
|
return;
|
||||||
|
|
@ -354,7 +354,7 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @param browser The zoom of this browser will be saved. Required.
|
* @param browser The zoom of this browser will be saved. Required.
|
||||||
*/
|
*/
|
||||||
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
|
_applyZoomToPref: function(browser) {
|
||||||
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
|
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
|
||||||
if (!this.siteSpecific ||
|
if (!this.siteSpecific ||
|
||||||
gInPrintPreviewMode ||
|
gInPrintPreviewMode ||
|
||||||
|
|
@ -375,7 +375,7 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @param browser The zoom of this browser will be removed. Required.
|
* @param browser The zoom of this browser will be removed. Required.
|
||||||
*/
|
*/
|
||||||
_removePref: function FullZoom__removePref(browser) {
|
_removePref: function(browser) {
|
||||||
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
|
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
|
||||||
if (browser.isSyntheticDocument)
|
if (browser.isSyntheticDocument)
|
||||||
return;
|
return;
|
||||||
|
|
@ -401,7 +401,7 @@ var FullZoom = {
|
||||||
* @param browser The token of this browser will be returned.
|
* @param browser The token of this browser will be returned.
|
||||||
* @return An object with an "isCurrent" getter.
|
* @return An object with an "isCurrent" getter.
|
||||||
*/
|
*/
|
||||||
_getBrowserToken: function FullZoom__getBrowserToken(browser) {
|
_getBrowserToken: function(browser) {
|
||||||
let map = this._browserTokenMap;
|
let map = this._browserTokenMap;
|
||||||
if (!map.has(browser))
|
if (!map.has(browser))
|
||||||
map.set(browser, 0);
|
map.set(browser, 0);
|
||||||
|
|
@ -423,7 +423,7 @@ var FullZoom = {
|
||||||
* @param event The ZoomChangeUsingMouseWheel event.
|
* @param event The ZoomChangeUsingMouseWheel event.
|
||||||
* @return The associated browser element, if one exists, otherwise null.
|
* @return The associated browser element, if one exists, otherwise null.
|
||||||
*/
|
*/
|
||||||
_getTargetedBrowser: function FullZoom__getTargetedBrowser(event) {
|
_getTargetedBrowser: function(event) {
|
||||||
let target = event.originalTarget;
|
let target = event.originalTarget;
|
||||||
|
|
||||||
// With remote content browsers, the event's target is the browser
|
// With remote content browsers, the event's target is the browser
|
||||||
|
|
@ -449,12 +449,12 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @param browser Pending accesses in this browser will be ignored.
|
* @param browser Pending accesses in this browser will be ignored.
|
||||||
*/
|
*/
|
||||||
_ignorePendingZoomAccesses: function FullZoom__ignorePendingZoomAccesses(browser) {
|
_ignorePendingZoomAccesses: function(browser) {
|
||||||
let map = this._browserTokenMap;
|
let map = this._browserTokenMap;
|
||||||
map.set(browser, (map.get(browser) || 0) + 1);
|
map.set(browser, (map.get(browser) || 0) + 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureValid: function FullZoom__ensureValid(aValue) {
|
_ensureValid: function(aValue) {
|
||||||
// Note that undefined is a valid value for aValue that indicates a known-
|
// Note that undefined is a valid value for aValue that indicates a known-
|
||||||
// not-to-exist value.
|
// not-to-exist value.
|
||||||
if (isNaN(aValue))
|
if (isNaN(aValue))
|
||||||
|
|
@ -476,7 +476,7 @@ var FullZoom = {
|
||||||
* @returns Promise<prefValue>
|
* @returns Promise<prefValue>
|
||||||
* Resolves to the preference value when done.
|
* Resolves to the preference value when done.
|
||||||
*/
|
*/
|
||||||
_getGlobalValue: function FullZoom__getGlobalValue(browser) {
|
_getGlobalValue: function(browser) {
|
||||||
// * !("_globalValue" in this) => global value not yet cached.
|
// * !("_globalValue" in this) => global value not yet cached.
|
||||||
// * this._globalValue === undefined => global value known not to exist.
|
// * this._globalValue === undefined => global value known not to exist.
|
||||||
// * Otherwise, this._globalValue is a number, the global value.
|
// * Otherwise, this._globalValue is a number, the global value.
|
||||||
|
|
@ -502,7 +502,7 @@ var FullZoom = {
|
||||||
* @param Browser The Browser whose load context will be returned.
|
* @param Browser The Browser whose load context will be returned.
|
||||||
* @return The nsILoadContext of the given Browser.
|
* @return The nsILoadContext of the given Browser.
|
||||||
*/
|
*/
|
||||||
_loadContextFromBrowser: function FullZoom__loadContextFromBrowser(browser) {
|
_loadContextFromBrowser: function(browser) {
|
||||||
return browser.loadContext;
|
return browser.loadContext;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -512,13 +512,13 @@ var FullZoom = {
|
||||||
* The notification is always asynchronous so that observers are guaranteed a
|
* The notification is always asynchronous so that observers are guaranteed a
|
||||||
* consistent behavior.
|
* consistent behavior.
|
||||||
*/
|
*/
|
||||||
_notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) {
|
_notifyOnLocationChange: function(browser) {
|
||||||
this._executeSoon(function () {
|
this._executeSoon(function () {
|
||||||
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
|
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_executeSoon: function FullZoom__executeSoon(callback) {
|
_executeSoon: function(callback) {
|
||||||
if (!callback)
|
if (!callback)
|
||||||
return;
|
return;
|
||||||
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ var gGestureSupport = {
|
||||||
* @param aAddListener
|
* @param aAddListener
|
||||||
* True to add/init listeners and false to remove/uninit
|
* True to add/init listeners and false to remove/uninit
|
||||||
*/
|
*/
|
||||||
init: function GS_init(aAddListener) {
|
init: function(aAddListener) {
|
||||||
const gestureEvents = ["SwipeGestureMayStart", "SwipeGestureStart",
|
const gestureEvents = ["SwipeGestureMayStart", "SwipeGestureStart",
|
||||||
"SwipeGestureUpdate", "SwipeGestureEnd", "SwipeGesture",
|
"SwipeGestureUpdate", "SwipeGestureEnd", "SwipeGesture",
|
||||||
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
|
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
|
||||||
|
|
@ -47,7 +47,7 @@ var gGestureSupport = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The gesture event to handle
|
* The gesture event to handle
|
||||||
*/
|
*/
|
||||||
handleEvent: function GS_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
if (!Services.prefs.getBoolPref(
|
if (!Services.prefs.getBoolPref(
|
||||||
"dom.debug.propagate_gesture_events_through_content")) {
|
"dom.debug.propagate_gesture_events_through_content")) {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
|
|
@ -123,7 +123,7 @@ var gGestureSupport = {
|
||||||
* @param aDec
|
* @param aDec
|
||||||
* Command to trigger for decreasing motion (without gesture name)
|
* Command to trigger for decreasing motion (without gesture name)
|
||||||
*/
|
*/
|
||||||
_setupGesture: function GS__setupGesture(aEvent, aGesture, aPref, aInc, aDec) {
|
_setupGesture: function(aEvent, aGesture, aPref, aInc, aDec) {
|
||||||
// Try to load user-set values from preferences
|
// Try to load user-set values from preferences
|
||||||
for (let [pref, def] of Object.entries(aPref))
|
for (let [pref, def] of Object.entries(aPref))
|
||||||
aPref[pref] = this._getPref(aGesture + "." + pref, def);
|
aPref[pref] = this._getPref(aGesture + "." + pref, def);
|
||||||
|
|
@ -168,7 +168,7 @@ var gGestureSupport = {
|
||||||
* The swipe gesture event.
|
* The swipe gesture event.
|
||||||
* @return true if the swipe event may navigate the history, false othwerwise.
|
* @return true if the swipe event may navigate the history, false othwerwise.
|
||||||
*/
|
*/
|
||||||
_swipeNavigatesHistory: function GS__swipeNavigatesHistory(aEvent) {
|
_swipeNavigatesHistory: function(aEvent) {
|
||||||
return this._getCommand(aEvent, ["swipe", "left"])
|
return this._getCommand(aEvent, ["swipe", "left"])
|
||||||
== "Browser:BackOrBackDuplicate" &&
|
== "Browser:BackOrBackDuplicate" &&
|
||||||
this._getCommand(aEvent, ["swipe", "right"])
|
this._getCommand(aEvent, ["swipe", "right"])
|
||||||
|
|
@ -184,7 +184,7 @@ var gGestureSupport = {
|
||||||
* @return true if we're willing to start a swipe for this event, false
|
* @return true if we're willing to start a swipe for this event, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
_shouldDoSwipeGesture: function GS__shouldDoSwipeGesture(aEvent) {
|
_shouldDoSwipeGesture: function(aEvent) {
|
||||||
if (!this._swipeNavigatesHistory(aEvent)) {
|
if (!this._swipeNavigatesHistory(aEvent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -232,14 +232,14 @@ var gGestureSupport = {
|
||||||
* @return true if swipe gestures could successfully be set up, false
|
* @return true if swipe gestures could successfully be set up, false
|
||||||
* othwerwise.
|
* othwerwise.
|
||||||
*/
|
*/
|
||||||
_setupSwipeGesture: function GS__setupSwipeGesture() {
|
_setupSwipeGesture: function() {
|
||||||
gHistorySwipeAnimation.startAnimation(false);
|
gHistorySwipeAnimation.startAnimation(false);
|
||||||
|
|
||||||
this._doUpdate = function GS__doUpdate(aEvent) {
|
this._doUpdate = function(aEvent) {
|
||||||
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
|
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._doEnd = function GS__doEnd(aEvent) {
|
this._doEnd = function(aEvent) {
|
||||||
gHistorySwipeAnimation.swipeEndEventReceived();
|
gHistorySwipeAnimation.swipeEndEventReceived();
|
||||||
|
|
||||||
this._doUpdate = function (aEvent) {};
|
this._doUpdate = function (aEvent) {};
|
||||||
|
|
@ -255,7 +255,7 @@ var gGestureSupport = {
|
||||||
* Source array containing any number of elements
|
* Source array containing any number of elements
|
||||||
* @yield Array that is a subset of the input array from full set to empty
|
* @yield Array that is a subset of the input array from full set to empty
|
||||||
*/
|
*/
|
||||||
_power: function* GS__power(aArray) {
|
_power: function* (aArray) {
|
||||||
// Create a bitmask based on the length of the array
|
// Create a bitmask based on the length of the array
|
||||||
let num = 1 << aArray.length;
|
let num = 1 << aArray.length;
|
||||||
while (--num >= 0) {
|
while (--num >= 0) {
|
||||||
|
|
@ -279,7 +279,7 @@ var gGestureSupport = {
|
||||||
* @return Name of the executed command. Returns null if no command is
|
* @return Name of the executed command. Returns null if no command is
|
||||||
* found.
|
* found.
|
||||||
*/
|
*/
|
||||||
_doAction: function GS__doAction(aEvent, aGesture) {
|
_doAction: function(aEvent, aGesture) {
|
||||||
let command = this._getCommand(aEvent, aGesture);
|
let command = this._getCommand(aEvent, aGesture);
|
||||||
return command && this._doCommand(aEvent, command);
|
return command && this._doCommand(aEvent, command);
|
||||||
},
|
},
|
||||||
|
|
@ -293,7 +293,7 @@ var gGestureSupport = {
|
||||||
* @param aGesture
|
* @param aGesture
|
||||||
* Array of gesture name parts (to be joined by periods)
|
* Array of gesture name parts (to be joined by periods)
|
||||||
*/
|
*/
|
||||||
_getCommand: function GS__getCommand(aEvent, aGesture) {
|
_getCommand: function(aEvent, aGesture) {
|
||||||
// Create an array of pressed keys in a fixed order so that a command for
|
// Create an array of pressed keys in a fixed order so that a command for
|
||||||
// "meta" is preferred over "ctrl" when both buttons are pressed (and a
|
// "meta" is preferred over "ctrl" when both buttons are pressed (and a
|
||||||
// command for both don't exist)
|
// command for both don't exist)
|
||||||
|
|
@ -327,7 +327,7 @@ var gGestureSupport = {
|
||||||
* @param aCommand
|
* @param aCommand
|
||||||
* Name of the command found for the event's keys and gesture.
|
* Name of the command found for the event's keys and gesture.
|
||||||
*/
|
*/
|
||||||
_doCommand: function GS__doCommand(aEvent, aCommand) {
|
_doCommand: function(aEvent, aCommand) {
|
||||||
let node = document.getElementById(aCommand);
|
let node = document.getElementById(aCommand);
|
||||||
if (node) {
|
if (node) {
|
||||||
if (node.getAttribute("disabled") != "true") {
|
if (node.getAttribute("disabled") != "true") {
|
||||||
|
|
@ -367,7 +367,7 @@ var gGestureSupport = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The swipe event to handle
|
* The swipe event to handle
|
||||||
*/
|
*/
|
||||||
onSwipe: function GS_onSwipe(aEvent) {
|
onSwipe: function(aEvent) {
|
||||||
// Figure out which one (and only one) direction was triggered
|
// Figure out which one (and only one) direction was triggered
|
||||||
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
|
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
|
||||||
if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
|
if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
|
||||||
|
|
@ -385,7 +385,7 @@ var gGestureSupport = {
|
||||||
* @param aDir
|
* @param aDir
|
||||||
* The direction for the swipe event
|
* The direction for the swipe event
|
||||||
*/
|
*/
|
||||||
processSwipeEvent: function GS_processSwipeEvent(aEvent, aDir) {
|
processSwipeEvent: function(aEvent, aDir) {
|
||||||
this._doAction(aEvent, ["swipe", aDir.toLowerCase()]);
|
this._doAction(aEvent, ["swipe", aDir.toLowerCase()]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -419,7 +419,7 @@ var gGestureSupport = {
|
||||||
* @param aDef
|
* @param aDef
|
||||||
* Default value if the preference doesn't exist
|
* Default value if the preference doesn't exist
|
||||||
*/
|
*/
|
||||||
_getPref: function GS__getPref(aPref, aDef) {
|
_getPref: function(aPref, aDef) {
|
||||||
// Preferences branch under which all gestures preferences are stored
|
// Preferences branch under which all gestures preferences are stored
|
||||||
const branch = "browser.gesture.";
|
const branch = "browser.gesture.";
|
||||||
|
|
||||||
|
|
@ -582,7 +582,7 @@ var gHistorySwipeAnimation = {
|
||||||
* Initializes the support for history swipe animations, if it is supported
|
* Initializes the support for history swipe animations, if it is supported
|
||||||
* by the platform/configuration.
|
* by the platform/configuration.
|
||||||
*/
|
*/
|
||||||
init: function HSA_init() {
|
init: function() {
|
||||||
if (!this._isSupported())
|
if (!this._isSupported())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -612,7 +612,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Uninitializes the support for history swipe animations.
|
* Uninitializes the support for history swipe animations.
|
||||||
*/
|
*/
|
||||||
uninit: function HSA_uninit() {
|
uninit: function() {
|
||||||
gBrowser.removeEventListener("pagehide", this, false);
|
gBrowser.removeEventListener("pagehide", this, false);
|
||||||
gBrowser.removeEventListener("pageshow", this, false);
|
gBrowser.removeEventListener("pageshow", this, false);
|
||||||
gBrowser.removeEventListener("popstate", this, false);
|
gBrowser.removeEventListener("popstate", this, false);
|
||||||
|
|
@ -630,7 +630,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aIsVerticalSwipe
|
* @param aIsVerticalSwipe
|
||||||
* Whether we're dealing with a vertical swipe or not.
|
* Whether we're dealing with a vertical swipe or not.
|
||||||
*/
|
*/
|
||||||
startAnimation: function HSA_startAnimation(aIsVerticalSwipe) {
|
startAnimation: function(aIsVerticalSwipe) {
|
||||||
this._direction = aIsVerticalSwipe ? "vertical" : "horizontal";
|
this._direction = aIsVerticalSwipe ? "vertical" : "horizontal";
|
||||||
|
|
||||||
if (this.isAnimationRunning()) {
|
if (this.isAnimationRunning()) {
|
||||||
|
|
@ -672,7 +672,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Stops the swipe animation.
|
* Stops the swipe animation.
|
||||||
*/
|
*/
|
||||||
stopAnimation: function HSA_stopAnimation() {
|
stopAnimation: function() {
|
||||||
gHistorySwipeAnimation._removeBoxes();
|
gHistorySwipeAnimation._removeBoxes();
|
||||||
this._historyIndex = this._getCurrentHistoryIndex();
|
this._historyIndex = this._getCurrentHistoryIndex();
|
||||||
},
|
},
|
||||||
|
|
@ -684,7 +684,7 @@ var gHistorySwipeAnimation = {
|
||||||
* A floating point value that represents the progress of the
|
* A floating point value that represents the progress of the
|
||||||
* swipe gesture.
|
* swipe gesture.
|
||||||
*/
|
*/
|
||||||
updateAnimation: function HSA_updateAnimation(aVal) {
|
updateAnimation: function(aVal) {
|
||||||
if (!this.isAnimationRunning()) {
|
if (!this.isAnimationRunning()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -741,7 +741,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* An event to process.
|
* An event to process.
|
||||||
*/
|
*/
|
||||||
handleEvent: function HSA_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "TabClose":
|
case "TabClose":
|
||||||
|
|
@ -780,7 +780,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if the animation is currently running, false otherwise.
|
* @return true if the animation is currently running, false otherwise.
|
||||||
*/
|
*/
|
||||||
isAnimationRunning: function HSA_isAnimationRunning() {
|
isAnimationRunning: function() {
|
||||||
return !!this._container;
|
return !!this._container;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -792,7 +792,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aDir
|
* @param aDir
|
||||||
* The direction for the swipe event
|
* The direction for the swipe event
|
||||||
*/
|
*/
|
||||||
processSwipeEvent: function HSA_processSwipeEvent(aEvent, aDir) {
|
processSwipeEvent: function(aEvent, aDir) {
|
||||||
if (aDir == "RIGHT")
|
if (aDir == "RIGHT")
|
||||||
this._historyIndex += this.isLTR ? 1 : -1;
|
this._historyIndex += this.isLTR ? 1 : -1;
|
||||||
else if (aDir == "LEFT")
|
else if (aDir == "LEFT")
|
||||||
|
|
@ -807,7 +807,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if there is a previous page in history, false otherwise.
|
* @return true if there is a previous page in history, false otherwise.
|
||||||
*/
|
*/
|
||||||
canGoBack: function HSA_canGoBack() {
|
canGoBack: function() {
|
||||||
if (this.isAnimationRunning())
|
if (this.isAnimationRunning())
|
||||||
return this._doesIndexExistInHistory(this._historyIndex - 1);
|
return this._doesIndexExistInHistory(this._historyIndex - 1);
|
||||||
return gBrowser.webNavigation.canGoBack;
|
return gBrowser.webNavigation.canGoBack;
|
||||||
|
|
@ -818,7 +818,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if there is a next page in history, false otherwise.
|
* @return true if there is a next page in history, false otherwise.
|
||||||
*/
|
*/
|
||||||
canGoForward: function HSA_canGoForward() {
|
canGoForward: function() {
|
||||||
if (this.isAnimationRunning())
|
if (this.isAnimationRunning())
|
||||||
return this._doesIndexExistInHistory(this._historyIndex + 1);
|
return this._doesIndexExistInHistory(this._historyIndex + 1);
|
||||||
return gBrowser.webNavigation.canGoForward;
|
return gBrowser.webNavigation.canGoForward;
|
||||||
|
|
@ -829,7 +829,7 @@ var gHistorySwipeAnimation = {
|
||||||
* event and that we should navigate to the page that the user swiped to, if
|
* event and that we should navigate to the page that the user swiped to, if
|
||||||
* any. This will also result in the animation overlay to be torn down.
|
* any. This will also result in the animation overlay to be torn down.
|
||||||
*/
|
*/
|
||||||
swipeEndEventReceived: function HSA_swipeEndEventReceived() {
|
swipeEndEventReceived: function() {
|
||||||
// Update the session history before continuing.
|
// Update the session history before continuing.
|
||||||
let updateSessionHistory = sessionHistory => {
|
let updateSessionHistory = sessionHistory => {
|
||||||
if (this._lastSwipeDir != "" && this._historyIndex != this._startingIndex)
|
if (this._lastSwipeDir != "" && this._historyIndex != this._startingIndex)
|
||||||
|
|
@ -847,7 +847,7 @@ var gHistorySwipeAnimation = {
|
||||||
* The index to check for availability for in the history.
|
* The index to check for availability for in the history.
|
||||||
* @return true if the index exists in the browser history, false otherwise.
|
* @return true if the index exists in the browser history, false otherwise.
|
||||||
*/
|
*/
|
||||||
_doesIndexExistInHistory: function HSA__doesIndexExistInHistory(aIndex) {
|
_doesIndexExistInHistory: function(aIndex) {
|
||||||
try {
|
try {
|
||||||
return SessionStore.getSessionHistory(gBrowser.selectedTab).entries[aIndex] != null;
|
return SessionStore.getSessionHistory(gBrowser.selectedTab).entries[aIndex] != null;
|
||||||
}
|
}
|
||||||
|
|
@ -860,7 +860,7 @@ var gHistorySwipeAnimation = {
|
||||||
* Navigates to the index in history that is currently being tracked by
|
* Navigates to the index in history that is currently being tracked by
|
||||||
* |this|.
|
* |this|.
|
||||||
*/
|
*/
|
||||||
_navigateToHistoryIndex: function HSA__navigateToHistoryIndex() {
|
_navigateToHistoryIndex: function() {
|
||||||
if (this._doesIndexExistInHistory(this._historyIndex))
|
if (this._doesIndexExistInHistory(this._historyIndex))
|
||||||
gBrowser.webNavigation.gotoIndex(this._historyIndex);
|
gBrowser.webNavigation.gotoIndex(this._historyIndex);
|
||||||
else
|
else
|
||||||
|
|
@ -873,7 +873,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* return true if supported, false otherwise.
|
* return true if supported, false otherwise.
|
||||||
*/
|
*/
|
||||||
_isSupported: function HSA__isSupported() {
|
_isSupported: function() {
|
||||||
return window.matchMedia("(-moz-swipe-animation-enabled)").matches;
|
return window.matchMedia("(-moz-swipe-animation-enabled)").matches;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -882,7 +882,7 @@ var gHistorySwipeAnimation = {
|
||||||
* progress when a new one is initiated). This will swap out the snapshots
|
* progress when a new one is initiated). This will swap out the snapshots
|
||||||
* used in the previous animation with the appropriate new ones.
|
* used in the previous animation with the appropriate new ones.
|
||||||
*/
|
*/
|
||||||
_handleFastSwiping: function HSA__handleFastSwiping() {
|
_handleFastSwiping: function() {
|
||||||
this._installCurrentPageSnapshot(null);
|
this._installCurrentPageSnapshot(null);
|
||||||
this._installPrevAndNextSnapshots();
|
this._installPrevAndNextSnapshots();
|
||||||
},
|
},
|
||||||
|
|
@ -890,7 +890,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Adds the boxes that contain the snapshots used during the swipe animation.
|
* Adds the boxes that contain the snapshots used during the swipe animation.
|
||||||
*/
|
*/
|
||||||
_addBoxes: function HSA__addBoxes() {
|
_addBoxes: function() {
|
||||||
let browserStack =
|
let browserStack =
|
||||||
document.getAnonymousElementByAttribute(gBrowser.getNotificationBox(),
|
document.getAnonymousElementByAttribute(gBrowser.getNotificationBox(),
|
||||||
"class", "browserStack");
|
"class", "browserStack");
|
||||||
|
|
@ -918,7 +918,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Removes the boxes.
|
* Removes the boxes.
|
||||||
*/
|
*/
|
||||||
_removeBoxes: function HSA__removeBoxes() {
|
_removeBoxes: function() {
|
||||||
this._curBox = null;
|
this._curBox = null;
|
||||||
this._prevBox = null;
|
this._prevBox = null;
|
||||||
this._nextBox = null;
|
this._nextBox = null;
|
||||||
|
|
@ -938,7 +938,7 @@ var gHistorySwipeAnimation = {
|
||||||
* The name of the tag to create the element for.
|
* The name of the tag to create the element for.
|
||||||
* @return the newly created element.
|
* @return the newly created element.
|
||||||
*/
|
*/
|
||||||
_createElement: function HSA__createElement(aID, aTagName) {
|
_createElement: function(aID, aTagName) {
|
||||||
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
let element = document.createElementNS(XULNS, aTagName);
|
let element = document.createElementNS(XULNS, aTagName);
|
||||||
element.id = aID;
|
element.id = aID;
|
||||||
|
|
@ -953,7 +953,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aPosition
|
* @param aPosition
|
||||||
* The position (in X coordinates) to move the box element to.
|
* The position (in X coordinates) to move the box element to.
|
||||||
*/
|
*/
|
||||||
_positionBox: function HSA__positionBox(aBox, aPosition) {
|
_positionBox: function(aBox, aPosition) {
|
||||||
let transform = "";
|
let transform = "";
|
||||||
|
|
||||||
if (this._direction == "vertical")
|
if (this._direction == "vertical")
|
||||||
|
|
@ -970,14 +970,14 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if we're ready to take snapshots, false otherwise.
|
* @return true if we're ready to take snapshots, false otherwise.
|
||||||
*/
|
*/
|
||||||
_readyToTakeSnapshots: function HSA__readyToTakeSnapshots() {
|
_readyToTakeSnapshots: function() {
|
||||||
return (this._maxSnapshots >= 1 && this._getCurrentHistoryIndex() >= 0);
|
return (this._maxSnapshots >= 1 && this._getCurrentHistoryIndex() >= 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a snapshot of the page the browser is currently on.
|
* Takes a snapshot of the page the browser is currently on.
|
||||||
*/
|
*/
|
||||||
_takeSnapshot: function HSA__takeSnapshot() {
|
_takeSnapshot: function() {
|
||||||
if (!this._readyToTakeSnapshots()) {
|
if (!this._readyToTakeSnapshots()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1011,7 +1011,7 @@ var gHistorySwipeAnimation = {
|
||||||
* Retrieves the maximum number of snapshots that should be kept in memory.
|
* Retrieves the maximum number of snapshots that should be kept in memory.
|
||||||
* This limit is a global limit and is valid across all open tabs.
|
* This limit is a global limit and is valid across all open tabs.
|
||||||
*/
|
*/
|
||||||
_getMaxSnapshots: function HSA__getMaxSnapshots() {
|
_getMaxSnapshots: function() {
|
||||||
return gPrefService.getIntPref("browser.snapshots.limit");
|
return gPrefService.getIntPref("browser.snapshots.limit");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1083,7 +1083,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aBrowser
|
* @param aBrowser
|
||||||
* The browser the new snapshot was taken in.
|
* The browser the new snapshot was taken in.
|
||||||
*/
|
*/
|
||||||
_removeTrackedSnapshot: function HSA__removeTrackedSnapshot(aIndex, aBrowser) {
|
_removeTrackedSnapshot: function(aIndex, aBrowser) {
|
||||||
let arr = this._trackedSnapshots;
|
let arr = this._trackedSnapshots;
|
||||||
let requiresExactIndexMatch = aIndex >= 0;
|
let requiresExactIndexMatch = aIndex >= 0;
|
||||||
for (let i = 0; i < arr.length; i++) {
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
|
@ -1133,7 +1133,7 @@ var gHistorySwipeAnimation = {
|
||||||
* couldn't complete before this method was called.
|
* couldn't complete before this method was called.
|
||||||
* @return A new Image object representing the converted blob.
|
* @return A new Image object representing the converted blob.
|
||||||
*/
|
*/
|
||||||
_convertToImg: function HSA__convertToImg(aBlob) {
|
_convertToImg: function(aBlob) {
|
||||||
if (!aBlob)
|
if (!aBlob)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
@ -1165,7 +1165,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aBox
|
* @param aBox
|
||||||
* The box element that uses aSnapshot as background.
|
* The box element that uses aSnapshot as background.
|
||||||
*/
|
*/
|
||||||
_scaleSnapshot: function HSA__scaleSnapshot(aSnapshot, aScale, aBox) {
|
_scaleSnapshot: function(aSnapshot, aScale, aBox) {
|
||||||
if (aSnapshot && aScale != 1 && aBox) {
|
if (aSnapshot && aScale != 1 && aBox) {
|
||||||
if (aSnapshot instanceof HTMLCanvasElement) {
|
if (aSnapshot instanceof HTMLCanvasElement) {
|
||||||
aBox.style.backgroundSize =
|
aBox.style.backgroundSize =
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ var StarUI = {
|
||||||
["cmd_close", "cmd_closeWindow"].map(id => this._element(id));
|
["cmd_close", "cmd_closeWindow"].map(id => this._element(id));
|
||||||
},
|
},
|
||||||
|
|
||||||
_blockCommands: function SU__blockCommands() {
|
_blockCommands: function() {
|
||||||
this._blockedCommands.forEach(function (elt) {
|
this._blockedCommands.forEach(function (elt) {
|
||||||
// make sure not to permanently disable this item (see bug 409155)
|
// make sure not to permanently disable this item (see bug 409155)
|
||||||
if (elt.hasAttribute("wasDisabled"))
|
if (elt.hasAttribute("wasDisabled"))
|
||||||
|
|
@ -58,7 +58,7 @@ var StarUI = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_restoreCommandsState: function SU__restoreCommandsState() {
|
_restoreCommandsState: function() {
|
||||||
this._blockedCommands.forEach(function (elt) {
|
this._blockedCommands.forEach(function (elt) {
|
||||||
if (elt.getAttribute("wasDisabled") != "true")
|
if (elt.getAttribute("wasDisabled") != "true")
|
||||||
elt.removeAttribute("disabled");
|
elt.removeAttribute("disabled");
|
||||||
|
|
@ -331,13 +331,13 @@ var StarUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
quitEditMode: function SU_quitEditMode() {
|
quitEditMode: function() {
|
||||||
this._element("editBookmarkPanelContent").hidden = true;
|
this._element("editBookmarkPanelContent").hidden = true;
|
||||||
this._element("editBookmarkPanelBottomButtons").hidden = true;
|
this._element("editBookmarkPanelBottomButtons").hidden = true;
|
||||||
gEditItemOverlay.uninitPanel(true);
|
gEditItemOverlay.uninitPanel(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeBookmarkButtonCommand: function SU_removeBookmarkButtonCommand() {
|
removeBookmarkButtonCommand: function() {
|
||||||
this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
|
this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
},
|
},
|
||||||
|
|
@ -558,7 +558,7 @@ var PlacesCommandHook = {
|
||||||
/**
|
/**
|
||||||
* Adds a bookmark to the page loaded in the current tab.
|
* Adds a bookmark to the page loaded in the current tab.
|
||||||
*/
|
*/
|
||||||
bookmarkCurrentPage: function PCH_bookmarkCurrentPage(aShowEditUI, aParent) {
|
bookmarkCurrentPage: function(aShowEditUI, aParent) {
|
||||||
this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI);
|
this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -625,7 +625,7 @@ var PlacesCommandHook = {
|
||||||
* Adds a folder with bookmarks to all of the currently open tabs in this
|
* Adds a folder with bookmarks to all of the currently open tabs in this
|
||||||
* window.
|
* window.
|
||||||
*/
|
*/
|
||||||
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
|
bookmarkCurrentPages: function() {
|
||||||
let pages = this.uniqueCurrentPages;
|
let pages = this.uniqueCurrentPages;
|
||||||
if (pages.length > 1) {
|
if (pages.length > 1) {
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
||||||
|
|
@ -692,7 +692,7 @@ var PlacesCommandHook = {
|
||||||
* are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar,
|
* are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar,
|
||||||
* UnfiledBookmarks, Tags and Downloads.
|
* UnfiledBookmarks, Tags and Downloads.
|
||||||
*/
|
*/
|
||||||
showPlacesOrganizer: function PCH_showPlacesOrganizer(aLeftPaneRoot) {
|
showPlacesOrganizer: function(aLeftPaneRoot) {
|
||||||
var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
|
var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
|
||||||
// Due to bug 528706, getMostRecentWindow can return closed windows.
|
// Due to bug 528706, getMostRecentWindow can return closed windows.
|
||||||
if (!organizer || organizer.closed) {
|
if (!organizer || organizer.closed) {
|
||||||
|
|
@ -731,7 +731,7 @@ HistoryMenu.prototype = {
|
||||||
return SessionStore.getClosedTabCount(window);
|
return SessionStore.getClosedTabCount(window);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleRecentlyClosedTabs: function HM_toggleRecentlyClosedTabs() {
|
toggleRecentlyClosedTabs: function() {
|
||||||
// enable/disable the Recently Closed Tabs sub menu
|
// enable/disable the Recently Closed Tabs sub menu
|
||||||
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
||||||
|
|
||||||
|
|
@ -745,7 +745,7 @@ HistoryMenu.prototype = {
|
||||||
/**
|
/**
|
||||||
* Populate when the history menu is opened
|
* Populate when the history menu is opened
|
||||||
*/
|
*/
|
||||||
populateUndoSubmenu: function PHM_populateUndoSubmenu() {
|
populateUndoSubmenu: function() {
|
||||||
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
||||||
var undoPopup = undoMenu.firstChild;
|
var undoPopup = undoMenu.firstChild;
|
||||||
|
|
||||||
|
|
@ -767,7 +767,7 @@ HistoryMenu.prototype = {
|
||||||
undoPopup.appendChild(tabsFragment);
|
undoPopup.appendChild(tabsFragment);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleRecentlyClosedWindows: function PHM_toggleRecentlyClosedWindows() {
|
toggleRecentlyClosedWindows: function() {
|
||||||
// enable/disable the Recently Closed Windows sub menu
|
// enable/disable the Recently Closed Windows sub menu
|
||||||
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
||||||
|
|
||||||
|
|
@ -781,7 +781,7 @@ HistoryMenu.prototype = {
|
||||||
/**
|
/**
|
||||||
* Populate when the history menu is opened
|
* Populate when the history menu is opened
|
||||||
*/
|
*/
|
||||||
populateUndoWindowSubmenu: function PHM_populateUndoWindowSubmenu() {
|
populateUndoWindowSubmenu: function() {
|
||||||
let undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
let undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
||||||
let undoPopup = undoMenu.firstChild;
|
let undoPopup = undoMenu.firstChild;
|
||||||
|
|
||||||
|
|
@ -803,7 +803,7 @@ HistoryMenu.prototype = {
|
||||||
undoPopup.appendChild(windowsFragment);
|
undoPopup.appendChild(windowsFragment);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleTabsFromOtherComputers: function PHM_toggleTabsFromOtherComputers() {
|
toggleTabsFromOtherComputers: function() {
|
||||||
// This is a no-op if MOZ_SERVICES_SYNC isn't defined
|
// This is a no-op if MOZ_SERVICES_SYNC isn't defined
|
||||||
#ifdef MOZ_SERVICES_SYNC
|
#ifdef MOZ_SERVICES_SYNC
|
||||||
// Enable/disable the Tabs From Other Computers menu. Some of the menus handled
|
// Enable/disable the Tabs From Other Computers menu. Some of the menus handled
|
||||||
|
|
@ -829,7 +829,7 @@ HistoryMenu.prototype = {
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupShowing: function HM__onPopupShowing(aEvent) {
|
_onPopupShowing: function(aEvent) {
|
||||||
PlacesMenu.prototype._onPopupShowing.apply(this, arguments);
|
PlacesMenu.prototype._onPopupShowing.apply(this, arguments);
|
||||||
|
|
||||||
// Don't handle events for submenus.
|
// Don't handle events for submenus.
|
||||||
|
|
@ -841,7 +841,7 @@ HistoryMenu.prototype = {
|
||||||
this.toggleTabsFromOtherComputers();
|
this.toggleTabsFromOtherComputers();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCommand: function HM__onCommand(aEvent) {
|
_onCommand: function(aEvent) {
|
||||||
let placesNode = aEvent.target._placesNode;
|
let placesNode = aEvent.target._placesNode;
|
||||||
if (placesNode) {
|
if (placesNode) {
|
||||||
if (!PrivateBrowsingUtils.isWindowPrivate(window))
|
if (!PrivateBrowsingUtils.isWindowPrivate(window))
|
||||||
|
|
@ -866,7 +866,7 @@ var BookmarksEventHandler = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* The places view which aEvent should be associated with.
|
* The places view which aEvent should be associated with.
|
||||||
*/
|
*/
|
||||||
onClick: function BEH_onClick(aEvent, aView) {
|
onClick: function(aEvent, aView) {
|
||||||
// Only handle middle-click or left-click with modifiers.
|
// Only handle middle-click or left-click with modifiers.
|
||||||
let modifKey;
|
let modifKey;
|
||||||
if (AppConstants.platform == "macosx") {
|
if (AppConstants.platform == "macosx") {
|
||||||
|
|
@ -915,13 +915,13 @@ var BookmarksEventHandler = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* The places view which aEvent should be associated with.
|
* The places view which aEvent should be associated with.
|
||||||
*/
|
*/
|
||||||
onCommand: function BEH_onCommand(aEvent, aView) {
|
onCommand: function(aEvent, aView) {
|
||||||
var target = aEvent.originalTarget;
|
var target = aEvent.originalTarget;
|
||||||
if (target._placesNode)
|
if (target._placesNode)
|
||||||
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
|
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
|
||||||
},
|
},
|
||||||
|
|
||||||
fillInBHTooltip: function BEH_fillInBHTooltip(aDocument, aEvent) {
|
fillInBHTooltip: function(aDocument, aEvent) {
|
||||||
var node;
|
var node;
|
||||||
var cropped = false;
|
var cropped = false;
|
||||||
var targetURI;
|
var targetURI;
|
||||||
|
|
@ -991,7 +991,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @param event
|
* @param event
|
||||||
* The DragEnter event that spawned the opening.
|
* The DragEnter event that spawned the opening.
|
||||||
*/
|
*/
|
||||||
onDragEnter: function PMDH_onDragEnter(event) {
|
onDragEnter: function(event) {
|
||||||
// Opening menus in a Places popup is handled by the view itself.
|
// Opening menus in a Places popup is handled by the view itself.
|
||||||
if (!this._isStaticContainer(event.target))
|
if (!this._isStaticContainer(event.target))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1022,7 +1022,7 @@ var PlacesMenuDNDHandler = {
|
||||||
/**
|
/**
|
||||||
* Handles dragleave on the <menu> element.
|
* Handles dragleave on the <menu> element.
|
||||||
*/
|
*/
|
||||||
onDragLeave: function PMDH_onDragLeave(event) {
|
onDragLeave: function(event) {
|
||||||
// Handle menu-button separate targets.
|
// Handle menu-button separate targets.
|
||||||
if (event.relatedTarget === event.currentTarget ||
|
if (event.relatedTarget === event.currentTarget ||
|
||||||
(event.relatedTarget &&
|
(event.relatedTarget &&
|
||||||
|
|
@ -1063,7 +1063,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @returns true if the element is a container element (menu or
|
* @returns true if the element is a container element (menu or
|
||||||
*` menu-toolbarbutton), false otherwise.
|
*` menu-toolbarbutton), false otherwise.
|
||||||
*/
|
*/
|
||||||
_isStaticContainer: function PMDH__isContainer(node) {
|
_isStaticContainer: function(node) {
|
||||||
let isMenu = node.localName == "menu" ||
|
let isMenu = node.localName == "menu" ||
|
||||||
(node.localName == "toolbarbutton" &&
|
(node.localName == "toolbarbutton" &&
|
||||||
(node.getAttribute("type") == "menu" ||
|
(node.getAttribute("type") == "menu" ||
|
||||||
|
|
@ -1079,7 +1079,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @param event
|
* @param event
|
||||||
* The DragOver event.
|
* The DragOver event.
|
||||||
*/
|
*/
|
||||||
onDragOver: function PMDH_onDragOver(event) {
|
onDragOver: function(event) {
|
||||||
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
Components.interfaces.nsITreeView.DROP_ON);
|
Components.interfaces.nsITreeView.DROP_ON);
|
||||||
|
|
@ -1094,7 +1094,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @param event
|
* @param event
|
||||||
* The Drop event.
|
* The Drop event.
|
||||||
*/
|
*/
|
||||||
onDrop: function PMDH_onDrop(event) {
|
onDrop: function(event) {
|
||||||
// Put the item at the end of bookmark menu.
|
// Put the item at the end of bookmark menu.
|
||||||
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
|
|
@ -1120,7 +1120,7 @@ var PlacesToolbarHelper = {
|
||||||
return document.getElementById("bookmarks-toolbar-placeholder");
|
return document.getElementById("bookmarks-toolbar-placeholder");
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function PTH_init(forceToolbarOverflowCheck) {
|
init: function(forceToolbarOverflowCheck) {
|
||||||
let viewElt = this._viewElt;
|
let viewElt = this._viewElt;
|
||||||
if (!viewElt || viewElt._placesView)
|
if (!viewElt || viewElt._placesView)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1148,11 +1148,11 @@ var PlacesToolbarHelper = {
|
||||||
this._setupPlaceholder();
|
this._setupPlaceholder();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function PTH_uninit() {
|
uninit: function() {
|
||||||
CustomizableUI.removeListener(this);
|
CustomizableUI.removeListener(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeStart: function PTH_customizeStart() {
|
customizeStart: function() {
|
||||||
try {
|
try {
|
||||||
let viewElt = this._viewElt;
|
let viewElt = this._viewElt;
|
||||||
if (viewElt && viewElt._placesView)
|
if (viewElt && viewElt._placesView)
|
||||||
|
|
@ -1163,11 +1163,11 @@ var PlacesToolbarHelper = {
|
||||||
this._shouldWrap = this._getShouldWrap();
|
this._shouldWrap = this._getShouldWrap();
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeChange: function PTH_customizeChange() {
|
customizeChange: function() {
|
||||||
this._setupPlaceholder();
|
this._setupPlaceholder();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupPlaceholder: function PTH_setupPlaceholder() {
|
_setupPlaceholder: function() {
|
||||||
let placeholder = this._placeholder;
|
let placeholder = this._placeholder;
|
||||||
if (!placeholder) {
|
if (!placeholder) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1184,12 +1184,12 @@ var PlacesToolbarHelper = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeDone: function PTH_customizeDone() {
|
customizeDone: function() {
|
||||||
this._isCustomizing = false;
|
this._isCustomizing = false;
|
||||||
this.init(true);
|
this.init(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getShouldWrap: function PTH_getShouldWrap() {
|
_getShouldWrap: function() {
|
||||||
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
|
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
|
||||||
let area = placement && placement.area;
|
let area = placement && placement.area;
|
||||||
let areaType = area && CustomizableUI.getAreaType(area);
|
let areaType = area && CustomizableUI.getAreaType(area);
|
||||||
|
|
@ -1351,11 +1351,11 @@ var BookmarkingUI = {
|
||||||
* reasons.
|
* reasons.
|
||||||
*/
|
*/
|
||||||
_popupNeedsUpdate: true,
|
_popupNeedsUpdate: true,
|
||||||
onToolbarVisibilityChange: function BUI_onToolbarVisibilityChange() {
|
onToolbarVisibilityChange: function() {
|
||||||
this._popupNeedsUpdate = true;
|
this._popupNeedsUpdate = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onPopupShowing: function BUI_onPopupShowing(event) {
|
onPopupShowing: function(event) {
|
||||||
// Don't handle events for submenus.
|
// Don't handle events for submenus.
|
||||||
if (event.target != event.currentTarget)
|
if (event.target != event.currentTarget)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1554,12 +1554,12 @@ var BookmarkingUI = {
|
||||||
Services.prefs.setBoolPref(this.RECENTLY_BOOKMARKED_PREF, false);
|
Services.prefs.setBoolPref(this.RECENTLY_BOOKMARKED_PREF, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCustomizationState: function BUI__updateCustomizationState() {
|
_updateCustomizationState: function() {
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(this.BOOKMARK_BUTTON_ID);
|
let placement = CustomizableUI.getPlacementOfWidget(this.BOOKMARK_BUTTON_ID);
|
||||||
this._currentAreaType = placement && CustomizableUI.getAreaType(placement.area);
|
this._currentAreaType = placement && CustomizableUI.getAreaType(placement.area);
|
||||||
},
|
},
|
||||||
|
|
||||||
_uninitView: function BUI__uninitView() {
|
_uninitView: function() {
|
||||||
// When an element with a placesView attached is removed and re-inserted,
|
// 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.
|
||||||
|
|
@ -1581,38 +1581,38 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCustomizeStart: function BUI_customizeStart(aWindow) {
|
onCustomizeStart: function(aWindow) {
|
||||||
if (aWindow == window) {
|
if (aWindow == window) {
|
||||||
this._uninitView();
|
this._uninitView();
|
||||||
this._isCustomizing = true;
|
this._isCustomizing = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetAdded: function BUI_widgetAdded(aWidgetId) {
|
onWidgetAdded: function(aWidgetId) {
|
||||||
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetRemoved: function BUI_widgetRemoved(aWidgetId) {
|
onWidgetRemoved: function(aWidgetId) {
|
||||||
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetReset: function BUI_widgetReset(aNode, aContainer) {
|
onWidgetReset: function(aNode, aContainer) {
|
||||||
if (aNode == this.button) {
|
if (aNode == this.button) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetUndoMove: function BUI_undoWidgetUndoMove(aNode, aContainer) {
|
onWidgetUndoMove: function(aNode, aContainer) {
|
||||||
if (aNode == this.button) {
|
if (aNode == this.button) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWidgetWasMoved: function BUI_widgetWasMoved() {
|
_onWidgetWasMoved: function() {
|
||||||
let usedToUpdateStarState = this._shouldUpdateStarState();
|
let usedToUpdateStarState = this._shouldUpdateStarState();
|
||||||
this._updateCustomizationState();
|
this._updateCustomizationState();
|
||||||
if (!usedToUpdateStarState && this._shouldUpdateStarState()) {
|
if (!usedToUpdateStarState && this._shouldUpdateStarState()) {
|
||||||
|
|
@ -1627,7 +1627,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCustomizeEnd: function BUI_customizeEnd(aWindow) {
|
onCustomizeEnd: function(aWindow) {
|
||||||
if (aWindow == window) {
|
if (aWindow == window) {
|
||||||
this._isCustomizing = false;
|
this._isCustomizing = false;
|
||||||
this.onToolbarVisibilityChange();
|
this.onToolbarVisibilityChange();
|
||||||
|
|
@ -1641,7 +1641,7 @@ var BookmarkingUI = {
|
||||||
|
|
||||||
_hasBookmarksObserver: false,
|
_hasBookmarksObserver: false,
|
||||||
_itemIds: [],
|
_itemIds: [],
|
||||||
uninit: function BUI_uninit() {
|
uninit: function() {
|
||||||
this._updateBookmarkPageMenuItem(true);
|
this._updateBookmarkPageMenuItem(true);
|
||||||
CustomizableUI.removeListener(this);
|
CustomizableUI.removeListener(this);
|
||||||
|
|
||||||
|
|
@ -1657,14 +1657,14 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLocationChange: function BUI_onLocationChange() {
|
onLocationChange: function() {
|
||||||
if (this._uri && gBrowser.currentURI.equals(this._uri)) {
|
if (this._uri && gBrowser.currentURI.equals(this._uri)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.updateStarState();
|
this.updateStarState();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateStarState: function BUI_updateStarState() {
|
updateStarState: function() {
|
||||||
// Reset tracked values.
|
// Reset tracked values.
|
||||||
this._uri = gBrowser.currentURI;
|
this._uri = gBrowser.currentURI;
|
||||||
this._itemIds = [];
|
this._itemIds = [];
|
||||||
|
|
@ -1704,7 +1704,7 @@ var BookmarkingUI = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateStar: function BUI__updateStar() {
|
_updateStar: function() {
|
||||||
if (!this._shouldUpdateStarState()) {
|
if (!this._shouldUpdateStarState()) {
|
||||||
if (this.broadcaster.hasAttribute("starred")) {
|
if (this.broadcaster.hasAttribute("starred")) {
|
||||||
this.broadcaster.removeAttribute("starred");
|
this.broadcaster.removeAttribute("starred");
|
||||||
|
|
@ -1733,7 +1733,7 @@ var BookmarkingUI = {
|
||||||
* forceReset is passed when we're destroyed and the label should go back
|
* forceReset is passed when we're destroyed and the label should go back
|
||||||
* to the default (Bookmark This Page) for OS X.
|
* to the default (Bookmark This Page) for OS X.
|
||||||
*/
|
*/
|
||||||
_updateBookmarkPageMenuItem: function BUI__updateBookmarkPageMenuItem(forceReset) {
|
_updateBookmarkPageMenuItem: function(forceReset) {
|
||||||
let isStarred = !forceReset && this._itemIds.length > 0;
|
let isStarred = !forceReset && this._itemIds.length > 0;
|
||||||
let label = isStarred ? "editlabel" : "bookmarklabel";
|
let label = isStarred ? "editlabel" : "bookmarklabel";
|
||||||
if (this.broadcaster) {
|
if (this.broadcaster) {
|
||||||
|
|
@ -1741,7 +1741,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onMainMenuPopupShowing: function BUI_onMainMenuPopupShowing(event) {
|
onMainMenuPopupShowing: 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;
|
||||||
|
|
@ -1751,7 +1751,7 @@ var BookmarkingUI = {
|
||||||
this._initRecentBookmarks(document.getElementById("menu_recentBookmarks"));
|
this._initRecentBookmarks(document.getElementById("menu_recentBookmarks"));
|
||||||
},
|
},
|
||||||
|
|
||||||
_showBookmarkedNotification: function BUI_showBookmarkedNotification() {
|
_showBookmarkedNotification: function() {
|
||||||
function getCenteringTransformForRects(rectToPosition, referenceRect) {
|
function getCenteringTransformForRects(rectToPosition, referenceRect) {
|
||||||
let topDiff = referenceRect.top - rectToPosition.top;
|
let topDiff = referenceRect.top - rectToPosition.top;
|
||||||
let leftDiff = referenceRect.left - rectToPosition.left;
|
let leftDiff = referenceRect.left - rectToPosition.left;
|
||||||
|
|
@ -1824,7 +1824,7 @@ var BookmarkingUI = {
|
||||||
CustomizableUI.AREA_PANEL);
|
CustomizableUI.AREA_PANEL);
|
||||||
},
|
},
|
||||||
|
|
||||||
onCommand: function BUI_onCommand(aEvent) {
|
onCommand: function(aEvent) {
|
||||||
if (aEvent.target != aEvent.currentTarget) {
|
if (aEvent.target != aEvent.currentTarget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1855,7 +1855,7 @@ var BookmarkingUI = {
|
||||||
this._updateBookmarkPageMenuItem();
|
this._updateBookmarkPageMenuItem();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function BUI_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "ViewShowing":
|
case "ViewShowing":
|
||||||
this.onPanelMenuViewShowing(aEvent);
|
this.onPanelMenuViewShowing(aEvent);
|
||||||
|
|
@ -1866,7 +1866,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onPanelMenuViewShowing: function BUI_onViewShowing(aEvent) {
|
onPanelMenuViewShowing: function(aEvent) {
|
||||||
this._updateBookmarkPageMenuItem();
|
this._updateBookmarkPageMenuItem();
|
||||||
// Update checked status of the toolbar toggle.
|
// Update checked status of the toolbar toggle.
|
||||||
let viewToolbar = document.getElementById("panelMenu_viewBookmarksToolbar");
|
let viewToolbar = document.getElementById("panelMenu_viewBookmarksToolbar");
|
||||||
|
|
@ -1891,13 +1891,13 @@ var BookmarkingUI = {
|
||||||
aEvent.target.removeEventListener("ViewShowing", this);
|
aEvent.target.removeEventListener("ViewShowing", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPanelMenuViewHiding: function BUI_onViewHiding(aEvent) {
|
onPanelMenuViewHiding: function(aEvent) {
|
||||||
this._panelMenuView.uninit();
|
this._panelMenuView.uninit();
|
||||||
delete this._panelMenuView;
|
delete this._panelMenuView;
|
||||||
aEvent.target.removeEventListener("ViewHiding", this);
|
aEvent.target.removeEventListener("ViewHiding", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPanelMenuViewCommand: function BUI_onPanelMenuViewCommand(aEvent, aView) {
|
onPanelMenuViewCommand: function(aEvent, aView) {
|
||||||
let target = aEvent.originalTarget;
|
let target = aEvent.originalTarget;
|
||||||
if (!target._placesNode)
|
if (!target._placesNode)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1909,7 +1909,7 @@ var BookmarkingUI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsINavBookmarkObserver
|
// nsINavBookmarkObserver
|
||||||
onItemAdded: function BUI_onItemAdded(aItemId, aParentId, aIndex, aItemType,
|
onItemAdded: function(aItemId, aParentId, aIndex, aItemType,
|
||||||
aURI) {
|
aURI) {
|
||||||
if (aURI && aURI.equals(this._uri)) {
|
if (aURI && aURI.equals(this._uri)) {
|
||||||
// If a new bookmark has been added to the tracked uri, register it.
|
// If a new bookmark has been added to the tracked uri, register it.
|
||||||
|
|
@ -1923,7 +1923,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemRemoved: function BUI_onItemRemoved(aItemId) {
|
onItemRemoved: function(aItemId) {
|
||||||
let index = this._itemIds.indexOf(aItemId);
|
let index = this._itemIds.indexOf(aItemId);
|
||||||
// If one of the tracked bookmarks has been removed, unregister it.
|
// If one of the tracked bookmarks has been removed, unregister it.
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|
@ -1935,7 +1935,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemChanged: function BUI_onItemChanged(aItemId, aProperty,
|
onItemChanged: function(aItemId, aProperty,
|
||||||
aIsAnnotationProperty, aNewValue) {
|
aIsAnnotationProperty, aNewValue) {
|
||||||
if (aProperty == "uri") {
|
if (aProperty == "uri") {
|
||||||
let index = this._itemIds.indexOf(aItemId);
|
let index = this._itemIds.indexOf(aItemId);
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ var gPluginHandler = {
|
||||||
openUILinkIn(url, "tab");
|
openUILinkIn(url, "tab");
|
||||||
},
|
},
|
||||||
|
|
||||||
submitReport: function submitReport(runID, keyVals, submitURLOptIn) {
|
submitReport: function(runID, keyVals, submitURLOptIn) {
|
||||||
/*** STUB ***/
|
/*** STUB ***/
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
@ -110,7 +110,7 @@ var gPluginHandler = {
|
||||||
openHelpLink("plugin-crashed", false);
|
openHelpLink("plugin-crashed", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clickToPlayNotificationEventCallback: function PH_ctpEventCallback(event) {
|
_clickToPlayNotificationEventCallback: function(event) {
|
||||||
if (event == "showing") {
|
if (event == "showing") {
|
||||||
Services.telemetry.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
|
Services.telemetry.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
|
||||||
.add(!this.options.primaryPlugin);
|
.add(!this.options.primaryPlugin);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ var gSyncUI = {
|
||||||
|
|
||||||
_unloaded: false,
|
_unloaded: false,
|
||||||
|
|
||||||
init: function SUI_init() {
|
init: function() {
|
||||||
// Proceed to set up the UI if Sync has already started up.
|
// Proceed to set up the UI if Sync has already started up.
|
||||||
// Otherwise we'll do it when Sync is firing up.
|
// Otherwise we'll do it when Sync is firing up.
|
||||||
let xps = Components.classes["@mozilla.org/weave/service;1"]
|
let xps = Components.classes["@mozilla.org/weave/service;1"]
|
||||||
|
|
@ -48,7 +48,7 @@ var gSyncUI = {
|
||||||
}, false);
|
}, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
initUI: function SUI_initUI() {
|
initUI: function() {
|
||||||
// If this is a browser window?
|
// If this is a browser window?
|
||||||
if (gBrowser) {
|
if (gBrowser) {
|
||||||
this._obs.push("weave:notification:added");
|
this._obs.push("weave:notification:added");
|
||||||
|
|
@ -64,7 +64,7 @@ var gSyncUI = {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
initNotifications: function SUI_initNotifications() {
|
initNotifications: function() {
|
||||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
let notificationbox = document.createElementNS(XULNS, "notificationbox");
|
let notificationbox = document.createElementNS(XULNS, "notificationbox");
|
||||||
notificationbox.id = "sync-notifications";
|
notificationbox.id = "sync-notifications";
|
||||||
|
|
@ -82,7 +82,7 @@ var gSyncUI = {
|
||||||
|
|
||||||
_wasDelayed: false,
|
_wasDelayed: false,
|
||||||
|
|
||||||
_needsSetup: function SUI__needsSetup() {
|
_needsSetup: function() {
|
||||||
let firstSync = "";
|
let firstSync = "";
|
||||||
try {
|
try {
|
||||||
firstSync = Services.prefs.getCharPref("services.sync.firstSync");
|
firstSync = Services.prefs.getCharPref("services.sync.firstSync");
|
||||||
|
|
@ -91,7 +91,7 @@ var gSyncUI = {
|
||||||
firstSync == "notReady";
|
firstSync == "notReady";
|
||||||
},
|
},
|
||||||
|
|
||||||
updateUI: function SUI_updateUI() {
|
updateUI: function() {
|
||||||
let needsSetup = this._needsSetup();
|
let needsSetup = this._needsSetup();
|
||||||
document.getElementById("sync-setup-state").hidden = !needsSetup;
|
document.getElementById("sync-setup-state").hidden = !needsSetup;
|
||||||
document.getElementById("sync-syncnow-state").hidden = needsSetup;
|
document.getElementById("sync-syncnow-state").hidden = needsSetup;
|
||||||
|
|
@ -111,7 +111,7 @@ var gSyncUI = {
|
||||||
|
|
||||||
|
|
||||||
// Functions called by observers
|
// Functions called by observers
|
||||||
onActivityStart: function SUI_onActivityStart() {
|
onActivityStart: function() {
|
||||||
if (!gBrowser)
|
if (!gBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ var gSyncUI = {
|
||||||
button.setAttribute("status", "active");
|
button.setAttribute("status", "active");
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncDelay: function SUI_onSyncDelay() {
|
onSyncDelay: function() {
|
||||||
// basically, we want to just inform users that stuff is going to take a while
|
// basically, we want to just inform users that stuff is going to take a while
|
||||||
let title = this._stringBundle.GetStringFromName("error.sync.no_node_found.title");
|
let title = this._stringBundle.GetStringFromName("error.sync.no_node_found.title");
|
||||||
let description = this._stringBundle.GetStringFromName("error.sync.no_node_found");
|
let description = this._stringBundle.GetStringFromName("error.sync.no_node_found");
|
||||||
|
|
@ -137,17 +137,17 @@ var gSyncUI = {
|
||||||
this._wasDelayed = true;
|
this._wasDelayed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoginFinish: function SUI_onLoginFinish() {
|
onLoginFinish: function() {
|
||||||
// Clear out any login failure notifications
|
// Clear out any login failure notifications
|
||||||
let title = this._stringBundle.GetStringFromName("error.login.title");
|
let title = this._stringBundle.GetStringFromName("error.login.title");
|
||||||
this.clearError(title);
|
this.clearError(title);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSetupComplete: function SUI_onSetupComplete() {
|
onSetupComplete: function() {
|
||||||
this.onLoginFinish();
|
this.onLoginFinish();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoginError: function SUI_onLoginError() {
|
onLoginError: function() {
|
||||||
// if login fails, any other notifications are essentially moot
|
// if login fails, any other notifications are essentially moot
|
||||||
Weave.Notifications.removeAll();
|
Weave.Notifications.removeAll();
|
||||||
|
|
||||||
|
|
@ -185,15 +185,15 @@ var gSyncUI = {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLogout: function SUI_onLogout() {
|
onLogout: function() {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onStartOver: function SUI_onStartOver() {
|
onStartOver: function() {
|
||||||
this.clearError();
|
this.clearError();
|
||||||
},
|
},
|
||||||
|
|
||||||
onQuotaNotice: function onQuotaNotice(subject, data) {
|
onQuotaNotice: function(subject, data) {
|
||||||
let title = this._stringBundle.GetStringFromName("warning.sync.quota.label");
|
let title = this._stringBundle.GetStringFromName("warning.sync.quota.label");
|
||||||
let description = this._stringBundle.GetStringFromName("warning.sync.quota.description");
|
let description = this._stringBundle.GetStringFromName("warning.sync.quota.description");
|
||||||
let buttons = [];
|
let buttons = [];
|
||||||
|
|
@ -214,11 +214,11 @@ var gSyncUI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
doSync: function SUI_doSync() {
|
doSync: function() {
|
||||||
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
|
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleToolbarButton: function SUI_handleStatusbarButton() {
|
handleToolbarButton: function() {
|
||||||
if (this._needsSetup())
|
if (this._needsSetup())
|
||||||
this.openSetup();
|
this.openSetup();
|
||||||
else
|
else
|
||||||
|
|
@ -238,7 +238,7 @@ var gSyncUI = {
|
||||||
* "reset" -- reset sync
|
* "reset" -- reset sync
|
||||||
*/
|
*/
|
||||||
|
|
||||||
openSetup: function SUI_openSetup(wizardType) {
|
openSetup: function(wizardType) {
|
||||||
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
|
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
|
||||||
if (win)
|
if (win)
|
||||||
win.focus();
|
win.focus();
|
||||||
|
|
@ -261,7 +261,7 @@ var gSyncUI = {
|
||||||
"syncAddDevice", "centerscreen,chrome,resizable=no");
|
"syncAddDevice", "centerscreen,chrome,resizable=no");
|
||||||
},
|
},
|
||||||
|
|
||||||
openQuotaDialog: function SUI_openQuotaDialog() {
|
openQuotaDialog: function() {
|
||||||
let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
|
let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
|
||||||
if (win)
|
if (win)
|
||||||
win.focus();
|
win.focus();
|
||||||
|
|
@ -271,12 +271,12 @@ var gSyncUI = {
|
||||||
"centerscreen,chrome,dialog,modal");
|
"centerscreen,chrome,dialog,modal");
|
||||||
},
|
},
|
||||||
|
|
||||||
openPrefs: function SUI_openPrefs() {
|
openPrefs: function() {
|
||||||
openPreferences("paneSync");
|
openPreferences("paneSync");
|
||||||
},
|
},
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
_updateLastSyncTime: function SUI__updateLastSyncTime() {
|
_updateLastSyncTime: function() {
|
||||||
if (!gBrowser)
|
if (!gBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -302,12 +302,12 @@ var gSyncUI = {
|
||||||
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
||||||
},
|
},
|
||||||
|
|
||||||
clearError: function SUI_clearError(errorString) {
|
clearError: function(errorString) {
|
||||||
Weave.Notifications.removeAll(errorString);
|
Weave.Notifications.removeAll(errorString);
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncFinish: function SUI_onSyncFinish() {
|
onSyncFinish: function() {
|
||||||
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
||||||
|
|
||||||
// Clear out sync failures on a successful sync
|
// Clear out sync failures on a successful sync
|
||||||
|
|
@ -320,7 +320,7 @@ var gSyncUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncError: function SUI_onSyncError() {
|
onSyncError: function() {
|
||||||
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
||||||
|
|
||||||
if (Weave.Status.login != Weave.LOGIN_SUCCEEDED) {
|
if (Weave.Status.login != Weave.LOGIN_SUCCEEDED) {
|
||||||
|
|
@ -401,7 +401,7 @@ var gSyncUI = {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function SUI_observe(subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
if (this._unloaded) {
|
if (this._unloaded) {
|
||||||
Cu.reportError("SyncUI observer called after unload: " + topic);
|
Cu.reportError("SyncUI observer called after unload: " + topic);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ var TabsInTitlebar = {
|
||||||
init: function () {},
|
init: function () {},
|
||||||
uninit: function () {},
|
uninit: function () {},
|
||||||
allowedBy: function (condition, allow) {},
|
allowedBy: function (condition, allow) {},
|
||||||
updateAppearance: function updateAppearance(aForce) {},
|
updateAppearance: function(aForce) {},
|
||||||
get enabled() {
|
get enabled() {
|
||||||
return document.documentElement.getAttribute("tabsintitlebar") == "true";
|
return document.documentElement.getAttribute("tabsintitlebar") == "true";
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ var TabsInTitlebar = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateAppearance: function updateAppearance(aForce) {
|
updateAppearance: function(aForce) {
|
||||||
this._update(aForce);
|
this._update(aForce);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ var gBrowserThumbnails = {
|
||||||
*/
|
*/
|
||||||
_tabEvents: ["TabClose", "TabSelect"],
|
_tabEvents: ["TabClose", "TabSelect"],
|
||||||
|
|
||||||
init: function Thumbnails_init() {
|
init: function() {
|
||||||
PageThumbs.addExpirationFilter(this);
|
PageThumbs.addExpirationFilter(this);
|
||||||
gBrowser.addTabsProgressListener(this);
|
gBrowser.addTabsProgressListener(this);
|
||||||
Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false);
|
Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false);
|
||||||
|
|
@ -43,7 +43,7 @@ var gBrowserThumbnails = {
|
||||||
this._timeouts = new WeakMap();
|
this._timeouts = new WeakMap();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function Thumbnails_uninit() {
|
uninit: function() {
|
||||||
PageThumbs.removeExpirationFilter(this);
|
PageThumbs.removeExpirationFilter(this);
|
||||||
gBrowser.removeTabsProgressListener(this);
|
gBrowser.removeTabsProgressListener(this);
|
||||||
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
|
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
|
||||||
|
|
@ -53,7 +53,7 @@ var gBrowserThumbnails = {
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function Thumbnails_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "scroll":
|
case "scroll":
|
||||||
let browser = aEvent.currentTarget;
|
let browser = aEvent.currentTarget;
|
||||||
|
|
@ -70,7 +70,7 @@ var gBrowserThumbnails = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function Thumbnails_observe() {
|
observe: function() {
|
||||||
this._sslDiskCacheEnabled =
|
this._sslDiskCacheEnabled =
|
||||||
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
||||||
},
|
},
|
||||||
|
|
@ -83,14 +83,14 @@ var gBrowserThumbnails = {
|
||||||
/**
|
/**
|
||||||
* State change progress listener for all tabs.
|
* State change progress listener for all tabs.
|
||||||
*/
|
*/
|
||||||
onStateChange: function Thumbnails_onStateChange(aBrowser, aWebProgress,
|
onStateChange: function(aBrowser, aWebProgress,
|
||||||
aRequest, aStateFlags, aStatus) {
|
aRequest, aStateFlags, aStatus) {
|
||||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)
|
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)
|
||||||
this._delayedCapture(aBrowser);
|
this._delayedCapture(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
_capture: function Thumbnails_capture(aBrowser) {
|
_capture: function(aBrowser) {
|
||||||
// Only capture about:newtab top sites.
|
// Only capture about:newtab top sites.
|
||||||
if (this._topSiteURLs.indexOf(aBrowser.currentURI.spec) == -1)
|
if (this._topSiteURLs.indexOf(aBrowser.currentURI.spec) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
@ -101,7 +101,7 @@ var gBrowserThumbnails = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
|
_delayedCapture: function(aBrowser) {
|
||||||
if (this._timeouts.has(aBrowser))
|
if (this._timeouts.has(aBrowser))
|
||||||
clearTimeout(this._timeouts.get(aBrowser));
|
clearTimeout(this._timeouts.get(aBrowser));
|
||||||
else
|
else
|
||||||
|
|
@ -115,7 +115,7 @@ var gBrowserThumbnails = {
|
||||||
this._timeouts.set(aBrowser, timeout);
|
this._timeouts.set(aBrowser, timeout);
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldCapture: function Thumbnails_shouldCapture(aBrowser, aCallback) {
|
_shouldCapture: function(aBrowser, aCallback) {
|
||||||
// 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) {
|
||||||
aCallback(false);
|
aCallback(false);
|
||||||
|
|
@ -132,7 +132,7 @@ var gBrowserThumbnails = {
|
||||||
}, []);
|
}, []);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearTimeout: function Thumbnails_clearTimeout(aBrowser) {
|
_clearTimeout: function(aBrowser) {
|
||||||
if (this._timeouts.has(aBrowser)) {
|
if (this._timeouts.has(aBrowser)) {
|
||||||
aBrowser.removeEventListener("scroll", this, false);
|
aBrowser.removeEventListener("scroll", this, false);
|
||||||
clearTimeout(this._timeouts.get(aBrowser));
|
clearTimeout(this._timeouts.get(aBrowser));
|
||||||
|
|
|
||||||
|
|
@ -3393,7 +3393,7 @@ const BrowserSearch = {
|
||||||
* the default engine's search form otherwise. For Mac, opens a new window
|
* the default engine's search form otherwise. For Mac, opens a new window
|
||||||
* or focuses an existing window, if necessary.
|
* or focuses an existing window, if necessary.
|
||||||
*/
|
*/
|
||||||
webSearch: function BrowserSearch_webSearch() {
|
webSearch: function() {
|
||||||
if (window.location.href != getBrowserURL()) {
|
if (window.location.href != getBrowserURL()) {
|
||||||
var win = getTopWin();
|
var win = getTopWin();
|
||||||
if (win) {
|
if (win) {
|
||||||
|
|
@ -3504,7 +3504,7 @@ const BrowserSearch = {
|
||||||
* @return string Name of the search engine used to perform a search or null
|
* @return string Name of the search engine used to perform a search or null
|
||||||
* if a search was not performed.
|
* if a search was not performed.
|
||||||
*/
|
*/
|
||||||
loadSearch: function BrowserSearch_search(searchText, useNewTab, purpose) {
|
loadSearch: function(searchText, useNewTab, purpose) {
|
||||||
let engine = BrowserSearch._loadSearch(searchText, useNewTab, purpose);
|
let engine = BrowserSearch._loadSearch(searchText, useNewTab, purpose);
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -3542,7 +3542,7 @@ const BrowserSearch = {
|
||||||
return formatURL("browser.search.searchEnginesURL", true);
|
return formatURL("browser.search.searchEnginesURL", true);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAddEngines: function BrowserSearch_loadAddEngines() {
|
loadAddEngines: function() {
|
||||||
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
|
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
|
||||||
var where = newWindowPref == 3 ? "tab" : "window";
|
var where = newWindowPref == 3 ? "tab" : "window";
|
||||||
openUILinkIn(this.searchEnginesURL, where);
|
openUILinkIn(this.searchEnginesURL, where);
|
||||||
|
|
@ -4397,7 +4397,7 @@ var XULBrowserWindow = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// simulate all change notifications after switching tabs
|
// simulate all change notifications after switching tabs
|
||||||
onUpdateCurrentBrowser: function XWB_onUpdateCurrentBrowser(aStateFlags, aStatus, aMessage, aTotalProgress) {
|
onUpdateCurrentBrowser: function(aStateFlags, aStatus, aMessage, aTotalProgress) {
|
||||||
if (FullZoom.updateBackgroundTabs)
|
if (FullZoom.updateBackgroundTabs)
|
||||||
FullZoom.onLocationChange(gBrowser.currentURI, true);
|
FullZoom.onLocationChange(gBrowser.currentURI, true);
|
||||||
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
||||||
|
|
@ -4765,7 +4765,7 @@ nsBrowserAccess.prototype = {
|
||||||
return newWindow;
|
return newWindow;
|
||||||
},
|
},
|
||||||
|
|
||||||
openURIInFrame: function browser_openURIInFrame(aURI, aParams, aWhere, aFlags) {
|
openURIInFrame: function(aURI, aParams, aWhere, aFlags) {
|
||||||
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
||||||
dump("Error: openURIInFrame can only open in new tabs");
|
dump("Error: openURIInFrame can only open in new tabs");
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -7304,7 +7304,7 @@ function getNavToolbox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var gPrivateBrowsingUI = {
|
var gPrivateBrowsingUI = {
|
||||||
init: function PBUI_init() {
|
init: function() {
|
||||||
// Do nothing for normal windows
|
// Do nothing for normal windows
|
||||||
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -7542,7 +7542,7 @@ var TabContextMenu = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateContextMenu: function updateContextMenu(aPopupMenu) {
|
updateContextMenu: function(aPopupMenu) {
|
||||||
this.contextTab = aPopupMenu.triggerNode.localName == "tab" ?
|
this.contextTab = aPopupMenu.triggerNode.localName == "tab" ?
|
||||||
aPopupMenu.triggerNode : gBrowser.selectedTab;
|
aPopupMenu.triggerNode : gBrowser.selectedTab;
|
||||||
let disabled = gBrowser.tabs.length == 1;
|
let disabled = gBrowser.tabs.length == 1;
|
||||||
|
|
|
||||||
|
|
@ -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 Cell_containsPinnedSite() {
|
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 Cell_isEmpty() {
|
isEmpty: function() {
|
||||||
return !this.site;
|
return !this.site;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all cell events.
|
* Handles all cell events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Cell_handleEvent(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 Drag_start(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 Drag_drag(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 Drag_end(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 Drag_isValid(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 Drag_setDragData(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 DragDataHelper_getLinkFromDragEvent(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 Drop_enter(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 Drop_exit(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 Drop_drop(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,7 +64,7 @@ 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 Drop_repinSitesAfterDrop(aCell) {
|
_repinSitesAfterDrop: function(aCell) {
|
||||||
let sites = gDropPreview.rearrange(aCell);
|
let sites = gDropPreview.rearrange(aCell);
|
||||||
|
|
||||||
// Filter out pinned sites.
|
// Filter out pinned sites.
|
||||||
|
|
@ -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 Drop_pinDraggedSite(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 Drop_delayedRearrange(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 Drop_cancelDelayedArrange() {
|
_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 Drop_rearrange(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 DropPreview_rearrange(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 DropPreview_insertDraggedSite(aSites, aCell) {
|
_insertDraggedSite: function(aSites, aCell) {
|
||||||
let dropIndex = aCell.index;
|
let dropIndex = aCell.index;
|
||||||
let draggedSite = gDrag.draggedSite;
|
let draggedSite = gDrag.draggedSite;
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ 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 DropPreview_filterPinnedSites(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
|
||||||
|
|
@ -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 DropPreview_getPinnedRange(aCell) {
|
_getPinnedRange: function(aCell) {
|
||||||
let dropIndex = aCell.index;
|
let dropIndex = aCell.index;
|
||||||
let range = {start: dropIndex, end: dropIndex};
|
let range = {start: dropIndex, end: dropIndex};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ 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 DropTargetShim_getCellPositions() {
|
_getCellPositions: function() {
|
||||||
if (this._cellPositions)
|
if (this._cellPositions)
|
||||||
return this._cellPositions;
|
return this._cellPositions;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,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 Grid_init() {
|
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();
|
||||||
|
|
@ -77,7 +77,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 Grid_createSite(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);
|
||||||
|
|
@ -86,7 +86,7 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Handles all grid events.
|
* Handles all grid events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Grid_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "load":
|
case "load":
|
||||||
case "resize":
|
case "resize":
|
||||||
|
|
@ -98,14 +98,14 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Locks the grid to block all pointer events.
|
* Locks the grid to block all pointer events.
|
||||||
*/
|
*/
|
||||||
lock: function Grid_lock() {
|
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 Grid_unlock() {
|
unlock: function() {
|
||||||
this.node.removeAttribute("locked");
|
this.node.removeAttribute("locked");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ var gGrid = {
|
||||||
* Calculate the height for a number of rows up to the maximum rows
|
* Calculate the height for a number of rows up to the maximum rows
|
||||||
* @param rows Number of rows defaulting to the max
|
* @param rows Number of rows defaulting to the max
|
||||||
*/
|
*/
|
||||||
_computeHeight: function Grid_computeHeight(aRows) {
|
_computeHeight: function(aRows) {
|
||||||
let {gridRows} = gGridPrefs;
|
let {gridRows} = gGridPrefs;
|
||||||
aRows = aRows === undefined ? gridRows : Math.min(gridRows, aRows);
|
aRows = aRows === undefined ? gridRows : Math.min(gridRows, aRows);
|
||||||
return aRows * this._cellHeight + GRID_BOTTOM_EXTRA;
|
return aRows * this._cellHeight + GRID_BOTTOM_EXTRA;
|
||||||
|
|
@ -167,7 +167,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 Grid_createSiteFragment() {
|
_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");
|
||||||
|
|
@ -192,7 +192,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 Grid_isHistoricalTile(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");
|
||||||
},
|
},
|
||||||
|
|
@ -200,7 +200,7 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Make sure the correct number of rows and columns are visible
|
* Make sure the correct number of rows and columns are visible
|
||||||
*/
|
*/
|
||||||
_resizeGrid: function Grid_resizeGrid() {
|
_resizeGrid: function() {
|
||||||
// If we're somehow called before the page has finished loading,
|
// If we're somehow called before the page has finished loading,
|
||||||
// let's bail out to avoid caching zero heights and widths.
|
// let's bail out to avoid caching zero heights and widths.
|
||||||
// We'll be called again when DOMContentLoaded fires.
|
// We'll be called again when DOMContentLoaded fires.
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Initializes the page.
|
* Initializes the page.
|
||||||
*/
|
*/
|
||||||
init: function Page_init() {
|
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);
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Listens for notifications specific to this page.
|
* Listens for notifications specific to this page.
|
||||||
*/
|
*/
|
||||||
observe: function Page_observe(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
if (aTopic == "nsPref:changed") {
|
if (aTopic == "nsPref:changed") {
|
||||||
gCustomize.updateSelected();
|
gCustomize.updateSelected();
|
||||||
|
|
||||||
|
|
@ -100,7 +100,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 Page_init() {
|
_init: function() {
|
||||||
if (this._initialized)
|
if (this._initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -137,7 +137,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 Page_updateAttributes(aValue) {
|
_updateAttributes: function(aValue) {
|
||||||
// Set the nodes' states.
|
// Set the nodes' states.
|
||||||
let nodeSelector = "#newtab-grid, #newtab-search-container";
|
let nodeSelector = "#newtab-grid, #newtab-search-container";
|
||||||
for (let node of document.querySelectorAll(nodeSelector)) {
|
for (let node of document.querySelectorAll(nodeSelector)) {
|
||||||
|
|
@ -160,14 +160,14 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Handles unload event
|
* Handles unload event
|
||||||
*/
|
*/
|
||||||
_handleUnloadEvent: function Page_handleUnloadEvent() {
|
_handleUnloadEvent: function() {
|
||||||
gAllPages.unregister(this);
|
gAllPages.unregister(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all page events.
|
* Handles all page events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Page_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "load":
|
case "load":
|
||||||
this.onPageVisibleAndLoaded();
|
this.onPageVisibleAndLoaded();
|
||||||
|
|
|
||||||
|
|
@ -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 Site_pin(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 Site_unpin() {
|
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 Site_isPinned() {
|
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 Site_block() {
|
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 Site_querySelector(aSelector) {
|
_querySelector: function(aSelector) {
|
||||||
return this.node.querySelector(aSelector);
|
return this.node.querySelector(aSelector);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -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 Site_checkLinkEndTime() {
|
_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 Site_render() {
|
_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
|
||||||
|
|
@ -188,7 +188,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 Site_onFirstVisible() {
|
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();
|
||||||
|
|
@ -202,7 +202,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 Site_captureIfMissing() {
|
captureIfMissing: function() {
|
||||||
if (!document.hidden && !this.link.imageURI) {
|
if (!document.hidden && !this.link.imageURI) {
|
||||||
BackgroundPageThumbs.captureIfMissing(this.url);
|
BackgroundPageThumbs.captureIfMissing(this.url);
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +211,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Refreshes the thumbnail for the site.
|
* Refreshes the thumbnail for the site.
|
||||||
*/
|
*/
|
||||||
refreshThumbnail: function Site_refreshThumbnail() {
|
refreshThumbnail: function() {
|
||||||
// Only enhance tiles if that feature is turned on
|
// Only enhance tiles if that feature is turned on
|
||||||
let link = this.link;
|
let link = this.link;
|
||||||
|
|
||||||
|
|
@ -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 Site_addEventHandlers() {
|
_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 Site_speculativeConnect() {
|
_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 Site_recordSiteClicked(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) {
|
||||||
|
|
@ -287,7 +287,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handles site click events.
|
* Handles site click events.
|
||||||
*/
|
*/
|
||||||
onClick: function Site_onClick(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;
|
||||||
|
|
@ -326,7 +326,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handles all site events.
|
* Handles all site events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Site_handleEvent(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 Transformation_getNodePosition(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,7 +43,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.
|
||||||
*/
|
*/
|
||||||
fadeNodeIn: function Transformation_fadeNodeIn(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 Transformation_fadeNodeOut(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 Transformation_showSite(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 Transformation_hideSite(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 Transformation_setSitePosition(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 Transformation_freezeSitePosition(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 Transformation_unfreezeSitePosition(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 Transformation_slideSiteTo(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,7 +168,7 @@ 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 Transformation_rearrangeSites(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;
|
||||||
|
|
@ -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 Transformation_getNodeOpacity(aNode) {
|
_getNodeOpacity: function(aNode) {
|
||||||
let cstyle = window.getComputedStyle(aNode, null);
|
let cstyle = window.getComputedStyle(aNode, null);
|
||||||
return cstyle.getPropertyValue("opacity");
|
return cstyle.getPropertyValue("opacity");
|
||||||
},
|
},
|
||||||
|
|
@ -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 Transformation_moveSite(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 Transformation_isFrozen(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 UndoDialog_init() {
|
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 UndoDialog_show(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 UndoDialog_hide() {
|
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 UndoDialog_handleEvent(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 UndoDialog_undo() {
|
_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 UndoDialog_undoAll() {
|
_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 Updater_updateGrid(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,7 +50,7 @@ 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 Updater_findRemainingSites(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.
|
||||||
|
|
@ -69,7 +69,7 @@ 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 Updater_freezeSitePositions(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 Updater_moveSiteNodes(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.
|
||||||
|
|
@ -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 Updater_rearrangeSites(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,7 +123,7 @@ 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 Updater_removeLegacySites(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.
|
||||||
|
|
@ -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 Updater_fillEmptyCells(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.
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ function nsContextMenu(aXulMenu, aIsShift) {
|
||||||
|
|
||||||
// Prototype for nsContextMenu "class."
|
// Prototype for nsContextMenu "class."
|
||||||
nsContextMenu.prototype = {
|
nsContextMenu.prototype = {
|
||||||
initMenu: function CM_initMenu(aXulMenu, aIsShift) {
|
initMenu: function(aXulMenu, aIsShift) {
|
||||||
// Get contextual info.
|
// Get contextual info.
|
||||||
this.setTarget(document.popupNode, document.popupRangeParent,
|
this.setTarget(document.popupNode, document.popupRangeParent,
|
||||||
document.popupRangeOffset);
|
document.popupRangeOffset);
|
||||||
|
|
@ -87,7 +87,7 @@ nsContextMenu.prototype = {
|
||||||
this.initItems();
|
this.initItems();
|
||||||
},
|
},
|
||||||
|
|
||||||
hiding: function CM_hiding() {
|
hiding: function() {
|
||||||
gContextMenuContentData = null;
|
gContextMenuContentData = null;
|
||||||
InlineSpellCheckerUI.clearSuggestionsFromMenu();
|
InlineSpellCheckerUI.clearSuggestionsFromMenu();
|
||||||
InlineSpellCheckerUI.clearDictionaryListFromMenu();
|
InlineSpellCheckerUI.clearDictionaryListFromMenu();
|
||||||
|
|
@ -100,7 +100,7 @@ nsContextMenu.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initItems: function CM_initItems() {
|
initItems: function() {
|
||||||
this.initPageMenuSeparator();
|
this.initPageMenuSeparator();
|
||||||
this.initOpenItems();
|
this.initOpenItems();
|
||||||
this.initNavigationItems();
|
this.initNavigationItems();
|
||||||
|
|
@ -115,11 +115,11 @@ nsContextMenu.prototype = {
|
||||||
this.initPasswordManagerItems();
|
this.initPasswordManagerItems();
|
||||||
},
|
},
|
||||||
|
|
||||||
initPageMenuSeparator: function CM_initPageMenuSeparator() {
|
initPageMenuSeparator: function() {
|
||||||
this.showItem("page-menu-separator", this.hasPageMenu);
|
this.showItem("page-menu-separator", this.hasPageMenu);
|
||||||
},
|
},
|
||||||
|
|
||||||
initOpenItems: function CM_initOpenItems() {
|
initOpenItems: function() {
|
||||||
var isMailtoInternal = false;
|
var isMailtoInternal = false;
|
||||||
if (this.onMailtoLink) {
|
if (this.onMailtoLink) {
|
||||||
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||||
|
|
@ -167,7 +167,7 @@ nsContextMenu.prototype = {
|
||||||
this.showItem("context-sep-open", shouldShow);
|
this.showItem("context-sep-open", shouldShow);
|
||||||
},
|
},
|
||||||
|
|
||||||
initNavigationItems: function CM_initNavigationItems() {
|
initNavigationItems: function() {
|
||||||
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
|
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
|
||||||
this.onCanvas || this.onVideo || this.onAudio ||
|
this.onCanvas || this.onVideo || this.onAudio ||
|
||||||
this.onTextInput);
|
this.onTextInput);
|
||||||
|
|
@ -188,7 +188,7 @@ nsContextMenu.prototype = {
|
||||||
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
||||||
},
|
},
|
||||||
|
|
||||||
initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() {
|
initLeaveDOMFullScreenItems: function() {
|
||||||
// only show the option if the user is in DOM fullscreen
|
// only show the option if the user is in DOM fullscreen
|
||||||
var shouldShow = (this.target.ownerDocument.fullscreenElement != null);
|
var shouldShow = (this.target.ownerDocument.fullscreenElement != null);
|
||||||
this.showItem("context-leave-dom-fullscreen", shouldShow);
|
this.showItem("context-leave-dom-fullscreen", shouldShow);
|
||||||
|
|
@ -198,7 +198,7 @@ nsContextMenu.prototype = {
|
||||||
this.showItem("context-media-sep-commands", true);
|
this.showItem("context-media-sep-commands", true);
|
||||||
},
|
},
|
||||||
|
|
||||||
initSaveItems: function CM_initSaveItems() {
|
initSaveItems: function() {
|
||||||
var shouldShow = !(this.onTextInput || this.onLink ||
|
var shouldShow = !(this.onTextInput || this.onLink ||
|
||||||
this.isContentSelected || this.onImage ||
|
this.isContentSelected || this.onImage ||
|
||||||
this.onCanvas || this.onVideo || this.onAudio);
|
this.onCanvas || this.onVideo || this.onAudio);
|
||||||
|
|
@ -223,7 +223,7 @@ nsContextMenu.prototype = {
|
||||||
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
|
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
|
||||||
},
|
},
|
||||||
|
|
||||||
initViewItems: function CM_initViewItems() {
|
initViewItems: function() {
|
||||||
// View source is always OK, unless in directory listing.
|
// View source is always OK, unless in directory listing.
|
||||||
this.showItem("context-viewpartialsource-selection",
|
this.showItem("context-viewpartialsource-selection",
|
||||||
this.isContentSelected);
|
this.isContentSelected);
|
||||||
|
|
@ -286,7 +286,7 @@ nsContextMenu.prototype = {
|
||||||
this.showItem("context-viewimagedesc", this.onImage && this.imageDescURL !== "");
|
this.showItem("context-viewimagedesc", this.onImage && this.imageDescURL !== "");
|
||||||
},
|
},
|
||||||
|
|
||||||
initMiscItems: function CM_initMiscItems() {
|
initMiscItems: function() {
|
||||||
// Use "Bookmark This Link" if on a link.
|
// Use "Bookmark This Link" if on a link.
|
||||||
let bookmarkPage = document.getElementById("context-bookmarkpage");
|
let bookmarkPage = document.getElementById("context-bookmarkpage");
|
||||||
this.showItem(bookmarkPage,
|
this.showItem(bookmarkPage,
|
||||||
|
|
@ -1240,7 +1240,7 @@ nsContextMenu.prototype = {
|
||||||
saveAsListener.prototype = {
|
saveAsListener.prototype = {
|
||||||
extListener: null,
|
extListener: null,
|
||||||
|
|
||||||
onStartRequest: function saveLinkAs_onStartRequest(aRequest, aContext) {
|
onStartRequest: function(aRequest, aContext) {
|
||||||
|
|
||||||
// if the timer fired, the error status will have been caused by that,
|
// if the timer fired, the error status will have been caused by that,
|
||||||
// and we'll be restarting in onStopRequest, so no reason to notify
|
// and we'll be restarting in onStopRequest, so no reason to notify
|
||||||
|
|
@ -1281,7 +1281,7 @@ nsContextMenu.prototype = {
|
||||||
this.extListener.onStartRequest(aRequest, aContext);
|
this.extListener.onStartRequest(aRequest, aContext);
|
||||||
},
|
},
|
||||||
|
|
||||||
onStopRequest: function saveLinkAs_onStopRequest(aRequest, aContext,
|
onStopRequest: function(aRequest, aContext,
|
||||||
aStatusCode) {
|
aStatusCode) {
|
||||||
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
|
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
|
||||||
// do it the old fashioned way, which will pick the best filename
|
// do it the old fashioned way, which will pick the best filename
|
||||||
|
|
@ -1293,7 +1293,7 @@ nsContextMenu.prototype = {
|
||||||
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
|
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDataAvailable: function saveLinkAs_onDataAvailable(aRequest, aContext,
|
onDataAvailable: function(aRequest, aContext,
|
||||||
aInputStream,
|
aInputStream,
|
||||||
aOffset, aCount) {
|
aOffset, aCount) {
|
||||||
this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
|
this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
|
||||||
|
|
@ -1303,7 +1303,7 @@ nsContextMenu.prototype = {
|
||||||
|
|
||||||
function callbacks() {}
|
function callbacks() {}
|
||||||
callbacks.prototype = {
|
callbacks.prototype = {
|
||||||
getInterface: function sLA_callbacks_getInterface(aIID) {
|
getInterface: function(aIID) {
|
||||||
if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) {
|
if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) {
|
||||||
// If the channel demands authentication prompt, we must cancel it
|
// If the channel demands authentication prompt, we must cancel it
|
||||||
// because the save-as-timer would expire and cancel the channel
|
// because the save-as-timer would expire and cancel the channel
|
||||||
|
|
@ -1322,7 +1322,7 @@ nsContextMenu.prototype = {
|
||||||
// we give up waiting for the filename.
|
// we give up waiting for the filename.
|
||||||
function timerCallback() {}
|
function timerCallback() {}
|
||||||
timerCallback.prototype = {
|
timerCallback.prototype = {
|
||||||
notify: function sLA_timer_notify(aTimer) {
|
notify: function(aTimer) {
|
||||||
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
|
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1643,16 +1643,16 @@ nsContextMenu.prototype = {
|
||||||
openUILinkIn(uri, where);
|
openUILinkIn(uri, where);
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkThisPage: function CM_bookmarkThisPage() {
|
bookmarkThisPage: function() {
|
||||||
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
|
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkLink: function CM_bookmarkLink() {
|
bookmarkLink: function() {
|
||||||
window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId,
|
window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId,
|
||||||
this.linkURL, this.linkTextStr);
|
this.linkURL, this.linkTextStr);
|
||||||
},
|
},
|
||||||
|
|
||||||
addBookmarkForFrame: function CM_addBookmarkForFrame() {
|
addBookmarkForFrame: function() {
|
||||||
let uri = gContextMenuContentData.documentURIObject;
|
let uri = gContextMenuContentData.documentURIObject;
|
||||||
let mm = this.browser.messageManager;
|
let mm = this.browser.messageManager;
|
||||||
|
|
||||||
|
|
@ -1670,19 +1670,19 @@ nsContextMenu.prototype = {
|
||||||
mm.sendAsyncMessage("ContextMenu:BookmarkFrame", null, { target: this.target });
|
mm.sendAsyncMessage("ContextMenu:BookmarkFrame", null, { target: this.target });
|
||||||
},
|
},
|
||||||
|
|
||||||
savePageAs: function CM_savePageAs() {
|
savePageAs: function() {
|
||||||
saveBrowser(this.browser);
|
saveBrowser(this.browser);
|
||||||
},
|
},
|
||||||
|
|
||||||
printFrame: function CM_printFrame() {
|
printFrame: function() {
|
||||||
PrintUtils.printWindow(this.frameOuterWindowID, this.browser);
|
PrintUtils.printWindow(this.frameOuterWindowID, this.browser);
|
||||||
},
|
},
|
||||||
|
|
||||||
switchPageDirection: function CM_switchPageDirection() {
|
switchPageDirection: function() {
|
||||||
this.browser.messageManager.sendAsyncMessage("SwitchDocumentDirection");
|
this.browser.messageManager.sendAsyncMessage("SwitchDocumentDirection");
|
||||||
},
|
},
|
||||||
|
|
||||||
mediaCommand : function CM_mediaCommand(command, data) {
|
mediaCommand : function(command, data) {
|
||||||
let mm = this.browser.messageManager;
|
let mm = this.browser.messageManager;
|
||||||
let win = this.browser.ownerGlobal;
|
let win = this.browser.ownerGlobal;
|
||||||
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
|
|
||||||
|
|
@ -568,7 +568,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* view
|
* view
|
||||||
* @return The new view
|
* @return The new view
|
||||||
*/
|
*/
|
||||||
setTree: function CSTH_setTree(aTreeElement, aProtoTreeView)
|
setTree: function(aTreeElement, aProtoTreeView)
|
||||||
{
|
{
|
||||||
this._tree = aTreeElement;
|
this._tree = aTreeElement;
|
||||||
var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view);
|
var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view);
|
||||||
|
|
@ -583,7 +583,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
*
|
*
|
||||||
* @return The row index of the grippy
|
* @return The row index of the grippy
|
||||||
*/
|
*/
|
||||||
getGrippyRow: function CSTH_getGrippyRow()
|
getGrippyRow: function()
|
||||||
{
|
{
|
||||||
var sel = this.tree.view.selection;
|
var sel = this.tree.view.selection;
|
||||||
var rangeCount = sel.getRangeCount();
|
var rangeCount = sel.getRangeCount();
|
||||||
|
|
@ -605,7 +605,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed dragover event
|
* The observed dragover event
|
||||||
*/
|
*/
|
||||||
ondragover: function CSTH_ondragover(aEvent)
|
ondragover: function(aEvent)
|
||||||
{
|
{
|
||||||
// Without this when dragging on Windows the mouse cursor is a "no" sign.
|
// Without this when dragging on Windows the mouse cursor is a "no" sign.
|
||||||
// This makes it a drop symbol.
|
// This makes it a drop symbol.
|
||||||
|
|
@ -632,7 +632,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed dragstart event
|
* The observed dragstart event
|
||||||
*/
|
*/
|
||||||
ondragstart: function CSTH_ondragstart(aEvent)
|
ondragstart: function(aEvent)
|
||||||
{
|
{
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
||||||
|
|
@ -667,7 +667,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed keypress event
|
* The observed keypress event
|
||||||
*/
|
*/
|
||||||
onkeypress: function CSTH_onkeypress(aEvent)
|
onkeypress: function(aEvent)
|
||||||
{
|
{
|
||||||
var grippyRow = this.getGrippyRow();
|
var grippyRow = this.getGrippyRow();
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
|
|
@ -728,7 +728,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed mousedown event
|
* The observed mousedown event
|
||||||
*/
|
*/
|
||||||
onmousedown: function CSTH_onmousedown(aEvent)
|
onmousedown: function(aEvent)
|
||||||
{
|
{
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
||||||
|
|
@ -750,7 +750,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEndRow
|
* @param aEndRow
|
||||||
* The range [0, aEndRow] will be selected.
|
* The range [0, aEndRow] will be selected.
|
||||||
*/
|
*/
|
||||||
rangedSelect: function CSTH_rangedSelect(aEndRow)
|
rangedSelect: function(aEndRow)
|
||||||
{
|
{
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
if (aEndRow < 0)
|
if (aEndRow < 0)
|
||||||
|
|
@ -763,7 +763,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
/**
|
/**
|
||||||
* Scrolls the tree so that the grippy row is in the center of the view.
|
* Scrolls the tree so that the grippy row is in the center of the view.
|
||||||
*/
|
*/
|
||||||
scrollToGrippy: function CSTH_scrollToGrippy()
|
scrollToGrippy: function()
|
||||||
{
|
{
|
||||||
var rowCount = this.tree.view.rowCount;
|
var rowCount = this.tree.view.rowCount;
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
|
|
@ -796,7 +796,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aProtoTreeView
|
* @param aProtoTreeView
|
||||||
* Used as the new view's prototype if specified
|
* Used as the new view's prototype if specified
|
||||||
*/
|
*/
|
||||||
_makeTreeView: function CSTH__makeTreeView(aProtoTreeView)
|
_makeTreeView: function(aProtoTreeView)
|
||||||
{
|
{
|
||||||
var view = aProtoTreeView;
|
var view = aProtoTreeView;
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ pref("@GUAO_PREF@.accounts.firefox.com", "Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION
|
||||||
pref("@GUAO_PREF@.addons.mozilla.org", "Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@");
|
pref("@GUAO_PREF@.addons.mozilla.org", "Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@");
|
||||||
|
|
||||||
// Required for domains that have proven unresponsive to requests from users
|
// Required for domains that have proven unresponsive to requests from users
|
||||||
pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0 @APP_SLICE@");
|
pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:62.0) @GK_SLICE@ Firefox/62.0 @APP_SLICE@");
|
||||||
pref("@GUAO_PREF@.gaming.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0");
|
pref("@GUAO_PREF@.gaming.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:62.0) @GK_SLICE@ Firefox/62.0");
|
||||||
pref("@GUAO_PREF@.netflix.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0 @APP_SLICE@");
|
pref("@GUAO_PREF@.netflix.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0 @APP_SLICE@");
|
||||||
|
|
||||||
// The never-ending Facebook debacle...
|
// The never-ending Facebook debacle...
|
||||||
|
|
@ -37,7 +37,7 @@ pref("@GUAO_PREF@.dailymotion.com","Mozilla/5.0 (@OS_SLICE@ rv:52.0) @GK_SLICE@
|
||||||
// The following requires native mode. Or it blocks.. "too old firefox", breakage, etc.
|
// The following requires native mode. Or it blocks.. "too old firefox", breakage, etc.
|
||||||
|
|
||||||
// UA-Sniffing domains below have indicated no interest in supporting Pale Moon (BOO!)
|
// UA-Sniffing domains below have indicated no interest in supporting Pale Moon (BOO!)
|
||||||
pref("@GUAO_PREF@.whatsapp.com","Mozilla/5.0 (@OS_SLICE@ rv:68.0) @GK_SLICE@ Firefox/68.0");
|
pref("@GUAO_PREF@.whatsapp.com","Mozilla/5.0 (@OS_SLICE@ rv:68.0) @GK_SLICE@ Firefox/68.0");
|
||||||
|
|
||||||
// UA-sniffing domains that are "app/vendor-specific" and do not like Pale Moon
|
// UA-sniffing domains that are "app/vendor-specific" and do not like Pale Moon
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ DistributionCustomizer.prototype = {
|
||||||
return this._ioSvc;
|
return this._ioSvc;
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeURI: function DIST__makeURI(spec) {
|
_makeURI: function(spec) {
|
||||||
return this._ioSvc.newURI(spec, null, null);
|
return this._ioSvc.newURI(spec, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -234,7 +234,7 @@ DistributionCustomizer.prototype = {
|
||||||
|
|
||||||
_newProfile: false,
|
_newProfile: false,
|
||||||
_customizationsApplied: false,
|
_customizationsApplied: false,
|
||||||
applyCustomizations: function DIST_applyCustomizations() {
|
applyCustomizations: function() {
|
||||||
this._customizationsApplied = true;
|
this._customizationsApplied = true;
|
||||||
|
|
||||||
if (!Services.prefs.prefHasUserValue("browser.migration.version"))
|
if (!Services.prefs.prefHasUserValue("browser.migration.version"))
|
||||||
|
|
@ -296,7 +296,7 @@ DistributionCustomizer.prototype = {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_prefDefaultsApplied: false,
|
_prefDefaultsApplied: false,
|
||||||
applyPrefDefaults: function DIST_applyPrefDefaults() {
|
applyPrefDefaults: function() {
|
||||||
this._prefDefaultsApplied = true;
|
this._prefDefaultsApplied = true;
|
||||||
if (!this._ini)
|
if (!this._ini)
|
||||||
return this._checkCustomizationComplete();
|
return this._checkCustomizationComplete();
|
||||||
|
|
@ -435,7 +435,7 @@ DistributionCustomizer.prototype = {
|
||||||
return this._checkCustomizationComplete();
|
return this._checkCustomizationComplete();
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkCustomizationComplete: function DIST__checkCustomizationComplete() {
|
_checkCustomizationComplete: function() {
|
||||||
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
|
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
|
||||||
|
|
||||||
if (this._newProfile) {
|
if (this._newProfile) {
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,15 @@ var SubscribeHandler = {
|
||||||
*/
|
*/
|
||||||
_feedWriter: null,
|
_feedWriter: null,
|
||||||
|
|
||||||
init: function SH_init() {
|
init: function() {
|
||||||
this._feedWriter = new BrowserFeedWriter();
|
this._feedWriter = new BrowserFeedWriter();
|
||||||
},
|
},
|
||||||
|
|
||||||
writeContent: function SH_writeContent() {
|
writeContent: function() {
|
||||||
this._feedWriter.writeContent();
|
this._feedWriter.writeContent();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function SH_uninit() {
|
uninit: function() {
|
||||||
this._feedWriter.close();
|
this._feedWriter.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ ChromeProfileMigrator.prototype.getLastUsedDate =
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceProfiles", {
|
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceProfiles", {
|
||||||
get: function Chrome_sourceProfiles() {
|
get: function() {
|
||||||
if ("__sourceProfiles" in this)
|
if ("__sourceProfiles" in this)
|
||||||
return this.__sourceProfiles;
|
return this.__sourceProfiles;
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ Object.defineProperty(ChromeProfileMigrator.prototype, "sourceProfiles", {
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceHomePageURL", {
|
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceHomePageURL", {
|
||||||
get: function Chrome_sourceHomePageURL() {
|
get: function() {
|
||||||
let prefsFile = this._chromeUserDataFolder.clone();
|
let prefsFile = this._chromeUserDataFolder.clone();
|
||||||
prefsFile.append("Preferences");
|
prefsFile.append("Preferences");
|
||||||
if (prefsFile.exists()) {
|
if (prefsFile.exists()) {
|
||||||
|
|
@ -243,7 +243,7 @@ Object.defineProperty(ChromeProfileMigrator.prototype, "sourceHomePageURL", {
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceLocked", {
|
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceLocked", {
|
||||||
get: function Chrome_sourceLocked() {
|
get: function() {
|
||||||
// There is an exclusive lock on some SQLite databases. Assume they are locked for now.
|
// There is an exclusive lock on some SQLite databases. Assume they are locked for now.
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ History.prototype = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
migrate: function H_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
let places = [];
|
let places = [];
|
||||||
let typedURLs = MSMigrationUtils.getTypedURLs("Software\\Microsoft\\Internet Explorer");
|
let typedURLs = MSMigrationUtils.getTypedURLs("Software\\Microsoft\\Internet Explorer");
|
||||||
let historyEnumerator = Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"].
|
let historyEnumerator = Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"].
|
||||||
|
|
@ -349,7 +349,7 @@ Settings.prototype = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
migrate: function S_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
// Converts from yes/no to a boolean.
|
// Converts from yes/no to a boolean.
|
||||||
let yesNoToBoolean = v => v == "yes";
|
let yesNoToBoolean = v => v == "yes";
|
||||||
|
|
||||||
|
|
@ -437,7 +437,7 @@ Settings.prototype = {
|
||||||
* @param [optional] aTransformFn
|
* @param [optional] aTransformFn
|
||||||
* Conversion function from the Registry format to the pref format.
|
* Conversion function from the Registry format to the pref format.
|
||||||
*/
|
*/
|
||||||
_set: function S__set(aPath, aKey, aPref, aTransformFn) {
|
_set: function(aPath, aKey, aPref, aTransformFn) {
|
||||||
let value = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
let value = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
||||||
aPath, aKey);
|
aPath, aKey);
|
||||||
// Don't import settings that have never been flipped.
|
// Don't import settings that have never been flipped.
|
||||||
|
|
@ -509,7 +509,7 @@ IEProfileMigrator.prototype.getLastUsedDate = function IE_getLastUsedDate() {
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty(IEProfileMigrator.prototype, "sourceHomePageURL", {
|
Object.defineProperty(IEProfileMigrator.prototype, "sourceHomePageURL", {
|
||||||
get: function IE_get_sourceHomePageURL() {
|
get: function() {
|
||||||
let defaultStartPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
|
let defaultStartPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
|
||||||
kMainKey, "Default_Page_URL");
|
kMainKey, "Default_Page_URL");
|
||||||
let startPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
let startPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ Bookmarks.prototype = {
|
||||||
return this.__toolbarFolderName;
|
return this.__toolbarFolderName;
|
||||||
},
|
},
|
||||||
|
|
||||||
migrate: function B_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
return Task.spawn(function* () {
|
return Task.spawn(function* () {
|
||||||
// Import to the bookmarks menu.
|
// Import to the bookmarks menu.
|
||||||
let folderGuid = PlacesUtils.bookmarks.menuGuid;
|
let folderGuid = PlacesUtils.bookmarks.menuGuid;
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ this.MigratorPrototype = {
|
||||||
* aProfile is a value returned by the sourceProfiles getter (see
|
* aProfile is a value returned by the sourceProfiles getter (see
|
||||||
* above).
|
* above).
|
||||||
*/
|
*/
|
||||||
getResources: function MP_getResources(/* aProfile */) {
|
getResources: function(/* aProfile */) {
|
||||||
throw new Error("getResources must be overridden");
|
throw new Error("getResources must be overridden");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -203,7 +203,7 @@ this.MigratorPrototype = {
|
||||||
*
|
*
|
||||||
* @see nsIBrowserProfileMigrator
|
* @see nsIBrowserProfileMigrator
|
||||||
*/
|
*/
|
||||||
getMigrateData: function MP_getMigrateData(aProfile) {
|
getMigrateData: function(aProfile) {
|
||||||
let resources = this._getMaybeCachedResources(aProfile);
|
let resources = this._getMaybeCachedResources(aProfile);
|
||||||
if (!resources) {
|
if (!resources) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -212,7 +212,7 @@ this.MigratorPrototype = {
|
||||||
return types.reduce((a, b) => { a |= b; return a }, 0);
|
return types.reduce((a, b) => { a |= b; return a }, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
getBrowserKey: function MP_getBrowserKey() {
|
getBrowserKey: function() {
|
||||||
return this.contractID.match(/\=([^\=]+)$/)[1];
|
return this.contractID.match(/\=([^\=]+)$/)[1];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ this.MigratorPrototype = {
|
||||||
*
|
*
|
||||||
* @see nsIBrowserProfileMigrator
|
* @see nsIBrowserProfileMigrator
|
||||||
*/
|
*/
|
||||||
migrate: function MP_migrate(aItems, aStartup, aProfile) {
|
migrate: function(aItems, aStartup, aProfile) {
|
||||||
let resources = this._getMaybeCachedResources(aProfile);
|
let resources = this._getMaybeCachedResources(aProfile);
|
||||||
if (resources.length == 0)
|
if (resources.length == 0)
|
||||||
throw new Error("migrate called for a non-existent source");
|
throw new Error("migrate called for a non-existent source");
|
||||||
|
|
@ -426,7 +426,7 @@ this.MigratorPrototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/** * PRIVATE STUFF - DO NOT OVERRIDE ***/
|
/** * PRIVATE STUFF - DO NOT OVERRIDE ***/
|
||||||
_getMaybeCachedResources: function PMB__getMaybeCachedResources(aProfile) {
|
_getMaybeCachedResources: function(aProfile) {
|
||||||
let profileKey = aProfile ? aProfile.id : "";
|
let profileKey = aProfile ? aProfile.id : "";
|
||||||
if (this._resourcesByProfile) {
|
if (this._resourcesByProfile) {
|
||||||
if (profileKey in this._resourcesByProfile)
|
if (profileKey in this._resourcesByProfile)
|
||||||
|
|
@ -487,7 +487,7 @@ this.MigrationUtils = Object.freeze({
|
||||||
* the callback function passed to |migrate|.
|
* the callback function passed to |migrate|.
|
||||||
* @return the wrapped function.
|
* @return the wrapped function.
|
||||||
*/
|
*/
|
||||||
wrapMigrateFunction: function MU_wrapMigrateFunction(aFunction, aCallback) {
|
wrapMigrateFunction: function(aFunction, aCallback) {
|
||||||
return function() {
|
return function() {
|
||||||
let success = false;
|
let success = false;
|
||||||
try {
|
try {
|
||||||
|
|
@ -520,7 +520,7 @@ this.MigrationUtils = Object.freeze({
|
||||||
*
|
*
|
||||||
* @see nsIStringBundle
|
* @see nsIStringBundle
|
||||||
*/
|
*/
|
||||||
getLocalizedString: function MU_getLocalizedString(aKey, aReplacements) {
|
getLocalizedString: function(aKey, aReplacements) {
|
||||||
aKey = aKey.replace(/_(canary|chromium)$/, "_chrome");
|
aKey = aKey.replace(/_(canary|chromium)$/, "_chrome");
|
||||||
|
|
||||||
const OVERRIDES = {
|
const OVERRIDES = {
|
||||||
|
|
@ -678,7 +678,7 @@ this.MigrationUtils = Object.freeze({
|
||||||
* @return profile migrator implementing nsIBrowserProfileMigrator, if it can
|
* @return profile migrator implementing nsIBrowserProfileMigrator, if it can
|
||||||
* import any data, null otherwise.
|
* import any data, null otherwise.
|
||||||
*/
|
*/
|
||||||
getMigrator: function MU_getMigrator(aKey) {
|
getMigrator: function(aKey) {
|
||||||
let migrator = null;
|
let migrator = null;
|
||||||
if (this._migrators.has(aKey)) {
|
if (this._migrators.has(aKey)) {
|
||||||
migrator = this._migrators.get(aKey);
|
migrator = this._migrators.get(aKey);
|
||||||
|
|
@ -1071,7 +1071,7 @@ this.MigrationUtils = Object.freeze({
|
||||||
/**
|
/**
|
||||||
* Cleans up references to migrators and nsIProfileInstance instances.
|
* Cleans up references to migrators and nsIProfileInstance instances.
|
||||||
*/
|
*/
|
||||||
finishMigration: function MU_finishMigration() {
|
finishMigration: function() {
|
||||||
gMigrators = null;
|
gMigrators = null;
|
||||||
gProfileStartup = null;
|
gProfileStartup = null;
|
||||||
gMigrationBundle = null;
|
gMigrationBundle = null;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ function Bookmarks(aBookmarksFile) {
|
||||||
Bookmarks.prototype = {
|
Bookmarks.prototype = {
|
||||||
type: MigrationUtils.resourceTypes.BOOKMARKS,
|
type: MigrationUtils.resourceTypes.BOOKMARKS,
|
||||||
|
|
||||||
migrate: function B_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
return Task.spawn(function* () {
|
return Task.spawn(function* () {
|
||||||
let dict = yield new Promise(resolve =>
|
let dict = yield new Promise(resolve =>
|
||||||
PropertyListUtils.read(this._file, resolve)
|
PropertyListUtils.read(this._file, resolve)
|
||||||
|
|
@ -188,7 +188,7 @@ History.prototype = {
|
||||||
// Helper method for converting the visit date property to a PRTime value.
|
// Helper method for converting the visit date property to a PRTime value.
|
||||||
// The visit date is stored as a string, so it's not read as a Date
|
// The visit date is stored as a string, so it's not read as a Date
|
||||||
// object by PropertyListUtils.
|
// object by PropertyListUtils.
|
||||||
_parseCocoaDate: function H___parseCocoaDate(aCocoaDateStr) {
|
_parseCocoaDate: function(aCocoaDateStr) {
|
||||||
let asDouble = parseFloat(aCocoaDateStr);
|
let asDouble = parseFloat(aCocoaDateStr);
|
||||||
if (!isNaN(asDouble)) {
|
if (!isNaN(asDouble)) {
|
||||||
// reference date of NSDate.
|
// reference date of NSDate.
|
||||||
|
|
@ -199,7 +199,7 @@ History.prototype = {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
migrate: function H_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
PropertyListUtils.read(this._file, function migrateHistory(aDict) {
|
PropertyListUtils.read(this._file, function migrateHistory(aDict) {
|
||||||
try {
|
try {
|
||||||
if (!aDict)
|
if (!aDict)
|
||||||
|
|
@ -270,7 +270,7 @@ MainPreferencesPropertyList.prototype = {
|
||||||
/**
|
/**
|
||||||
* @see PropertyListUtils.read
|
* @see PropertyListUtils.read
|
||||||
*/
|
*/
|
||||||
read: function MPPL_read(aCallback) {
|
read: function(aCallback) {
|
||||||
if ("_dict" in this) {
|
if ("_dict" in this) {
|
||||||
aCallback(this._dict);
|
aCallback(this._dict);
|
||||||
return;
|
return;
|
||||||
|
|
@ -296,7 +296,7 @@ MainPreferencesPropertyList.prototype = {
|
||||||
|
|
||||||
// Workaround for nsIBrowserProfileMigrator.sourceHomePageURL until
|
// Workaround for nsIBrowserProfileMigrator.sourceHomePageURL until
|
||||||
// it's replaced with an async method.
|
// it's replaced with an async method.
|
||||||
_readSync: function MPPL__readSync() {
|
_readSync: function() {
|
||||||
if ("_dict" in this)
|
if ("_dict" in this)
|
||||||
return this._dict;
|
return this._dict;
|
||||||
|
|
||||||
|
|
@ -319,7 +319,7 @@ function Preferences(aMainPreferencesPropertyListInstance) {
|
||||||
Preferences.prototype = {
|
Preferences.prototype = {
|
||||||
type: MigrationUtils.resourceTypes.SETTINGS,
|
type: MigrationUtils.resourceTypes.SETTINGS,
|
||||||
|
|
||||||
migrate: function MPR_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
this._mainPreferencesPropertyList.read(aDict => {
|
this._mainPreferencesPropertyList.read(aDict => {
|
||||||
Task.spawn(function* () {
|
Task.spawn(function* () {
|
||||||
if (!aDict)
|
if (!aDict)
|
||||||
|
|
@ -370,7 +370,7 @@ Preferences.prototype = {
|
||||||
* at all.
|
* at all.
|
||||||
* @return whether or not aMozPref was set.
|
* @return whether or not aMozPref was set.
|
||||||
*/
|
*/
|
||||||
_set: function MPR_set(aSafariKey, aMozPref, aConvertFunction) {
|
_set: function(aSafariKey, aMozPref, aConvertFunction) {
|
||||||
if (this._dict.has(aSafariKey)) {
|
if (this._dict.has(aSafariKey)) {
|
||||||
let safariVal = this._dict.get(aSafariKey);
|
let safariVal = this._dict.get(aSafariKey);
|
||||||
let mozVal = aConvertFunction !== undefined ?
|
let mozVal = aConvertFunction !== undefined ?
|
||||||
|
|
@ -417,7 +417,7 @@ Preferences.prototype = {
|
||||||
// we set it for all languages.
|
// we set it for all languages.
|
||||||
// As for the font type of the default font (serif/sans-serif), the default
|
// As for the font type of the default font (serif/sans-serif), the default
|
||||||
// type for the given language is used (set in font.default.LANGGROUP).
|
// type for the given language is used (set in font.default.LANGGROUP).
|
||||||
_migrateFontSettings: function MPR__migrateFontSettings() {
|
_migrateFontSettings: function() {
|
||||||
// If "Never use font sizes smaller than [ ] is set", migrate it for all
|
// If "Never use font sizes smaller than [ ] is set", migrate it for all
|
||||||
// languages.
|
// languages.
|
||||||
if (this._dict.has("WebKitMinimumFontSize")) {
|
if (this._dict.has("WebKitMinimumFontSize")) {
|
||||||
|
|
@ -453,7 +453,7 @@ Preferences.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get the language group for the system locale.
|
// Get the language group for the system locale.
|
||||||
_getLocaleLangGroup: function MPR__getLocaleLangGroup() {
|
_getLocaleLangGroup: function() {
|
||||||
let locale = Services.locale.getLocaleComponentForUserAgent();
|
let locale = Services.locale.getLocaleComponentForUserAgent();
|
||||||
|
|
||||||
// See nsLanguageAtomService::GetLanguageGroup
|
// See nsLanguageAtomService::GetLanguageGroup
|
||||||
|
|
@ -506,7 +506,7 @@ function SearchStrings(aMainPreferencesPropertyListInstance) {
|
||||||
SearchStrings.prototype = {
|
SearchStrings.prototype = {
|
||||||
type: MigrationUtils.resourceTypes.OTHERDATA,
|
type: MigrationUtils.resourceTypes.OTHERDATA,
|
||||||
|
|
||||||
migrate: function SS_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
this._mainPreferencesPropertyList.read(MigrationUtils.wrapMigrateFunction(
|
this._mainPreferencesPropertyList.read(MigrationUtils.wrapMigrateFunction(
|
||||||
function migrateSearchStrings(aDict) {
|
function migrateSearchStrings(aDict) {
|
||||||
if (!aDict)
|
if (!aDict)
|
||||||
|
|
@ -534,7 +534,7 @@ function WebFoundationCookieBehavior(aWebFoundationFile) {
|
||||||
WebFoundationCookieBehavior.prototype = {
|
WebFoundationCookieBehavior.prototype = {
|
||||||
type: MigrationUtils.resourceTypes.SETTINGS,
|
type: MigrationUtils.resourceTypes.SETTINGS,
|
||||||
|
|
||||||
migrate: function WFPL_migrate(aCallback) {
|
migrate: function(aCallback) {
|
||||||
PropertyListUtils.read(this._file, MigrationUtils.wrapMigrateFunction(
|
PropertyListUtils.read(this._file, MigrationUtils.wrapMigrateFunction(
|
||||||
function migrateCookieBehavior(aDict) {
|
function migrateCookieBehavior(aDict) {
|
||||||
if (!aDict)
|
if (!aDict)
|
||||||
|
|
@ -614,7 +614,7 @@ SafariProfileMigrator.prototype.getLastUsedDate = function SM_getLastUsedDate()
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty(SafariProfileMigrator.prototype, "mainPreferencesPropertyList", {
|
Object.defineProperty(SafariProfileMigrator.prototype, "mainPreferencesPropertyList", {
|
||||||
get: function get_mainPreferencesPropertyList() {
|
get: function() {
|
||||||
if (this._mainPreferencesPropertyList === undefined) {
|
if (this._mainPreferencesPropertyList === undefined) {
|
||||||
let file = FileUtils.getDir("UsrPrfs", [], false);
|
let file = FileUtils.getDir("UsrPrfs", [], false);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
|
|
@ -633,7 +633,7 @@ Object.defineProperty(SafariProfileMigrator.prototype, "mainPreferencesPropertyL
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.defineProperty(SafariProfileMigrator.prototype, "sourceHomePageURL", {
|
Object.defineProperty(SafariProfileMigrator.prototype, "sourceHomePageURL", {
|
||||||
get: function get_sourceHomePageURL() {
|
get: function() {
|
||||||
if (this.mainPreferencesPropertyList) {
|
if (this.mainPreferencesPropertyList) {
|
||||||
let dict = this.mainPreferencesPropertyList._readSync();
|
let dict = this.mainPreferencesPropertyList._readSync();
|
||||||
if (dict.has("HomePage"))
|
if (dict.has("HomePage"))
|
||||||
|
|
|
||||||
|
|
@ -52,18 +52,18 @@ Links.prototype = {
|
||||||
* All history events are emitted from this object.
|
* All history events are emitted from this object.
|
||||||
*/
|
*/
|
||||||
historyObserver: {
|
historyObserver: {
|
||||||
onDeleteURI: function historyObserver_onDeleteURI(aURI) {
|
onDeleteURI: function(aURI) {
|
||||||
// let observers remove sensetive data associated with deleted visit
|
// let observers remove sensetive data associated with deleted visit
|
||||||
gLinks.emit("deleteURI", {
|
gLinks.emit("deleteURI", {
|
||||||
url: aURI.spec,
|
url: aURI.spec,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onClearHistory: function historyObserver_onClearHistory() {
|
onClearHistory: function() {
|
||||||
gLinks.emit("clearHistory");
|
gLinks.emit("clearHistory");
|
||||||
},
|
},
|
||||||
|
|
||||||
onFrecencyChanged: function historyObserver_onFrecencyChanged(aURI,
|
onFrecencyChanged: function(aURI,
|
||||||
aNewFrecency, aGUID, aHidden, aLastVisitDate) { // jshint ignore:line
|
aNewFrecency, aGUID, aHidden, aLastVisitDate) { // jshint ignore:line
|
||||||
// The implementation of the query in getLinks excludes hidden and
|
// The implementation of the query in getLinks excludes hidden and
|
||||||
// unvisited pages, so it's important to exclude them here, too.
|
// unvisited pages, so it's important to exclude them here, too.
|
||||||
|
|
@ -78,13 +78,13 @@ Links.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onManyFrecenciesChanged: function historyObserver_onManyFrecenciesChanged() {
|
onManyFrecenciesChanged: function() {
|
||||||
// Called when frecencies are invalidated and also when clearHistory is called
|
// Called when frecencies are invalidated and also when clearHistory is called
|
||||||
// See toolkit/components/places/tests/unit/test_frecency_observers.js
|
// See toolkit/components/places/tests/unit/test_frecency_observers.js
|
||||||
gLinks.emit("manyLinksChanged");
|
gLinks.emit("manyLinksChanged");
|
||||||
},
|
},
|
||||||
|
|
||||||
onTitleChanged: function historyObserver_onTitleChanged(aURI, aNewTitle) {
|
onTitleChanged: function(aURI, aNewTitle) {
|
||||||
if (NewTabUtils.linkChecker.checkLoadURI(aURI.spec)) {
|
if (NewTabUtils.linkChecker.checkLoadURI(aURI.spec)) {
|
||||||
gLinks.emit("linkChanged", {
|
gLinks.emit("linkChanged", {
|
||||||
url: aURI.spec,
|
url: aURI.spec,
|
||||||
|
|
@ -101,7 +101,7 @@ Links.prototype = {
|
||||||
* Must be called before the provider is used.
|
* Must be called before the provider is used.
|
||||||
* Makes it easy to disable under pref
|
* Makes it easy to disable under pref
|
||||||
*/
|
*/
|
||||||
init: function PlacesProvider_init() {
|
init: function() {
|
||||||
try {
|
try {
|
||||||
PlacesUtils.history.addObserver(this.historyObserver, true);
|
PlacesUtils.history.addObserver(this.historyObserver, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,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 bch_factory_ci(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);
|
||||||
|
|
@ -304,7 +304,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
nsICommandLineValidator]),
|
nsICommandLineValidator]),
|
||||||
|
|
||||||
/* nsICommandLineHandler */
|
/* nsICommandLineHandler */
|
||||||
handle : function bch_handle(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",
|
||||||
|
|
@ -565,7 +565,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
|
|
||||||
mFeatures : null,
|
mFeatures : null,
|
||||||
|
|
||||||
getFeatures : function bch_features(cmdLine) {
|
getFeatures : function(cmdLine) {
|
||||||
if (this.mFeatures === null) {
|
if (this.mFeatures === null) {
|
||||||
this.mFeatures = "";
|
this.mFeatures = "";
|
||||||
|
|
||||||
|
|
@ -593,7 +593,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
|
|
||||||
/* nsIContentHandler */
|
/* nsIContentHandler */
|
||||||
|
|
||||||
handleContent : function bch_handleContent(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);
|
||||||
|
|
@ -611,7 +611,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/* nsICommandLineValidator */
|
/* nsICommandLineValidator */
|
||||||
validate : function bch_validate(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);
|
||||||
|
|
@ -676,7 +676,7 @@ nsDefaultCommandLineHandler.prototype = {
|
||||||
classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"),
|
classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"),
|
||||||
|
|
||||||
/* nsISupports */
|
/* nsISupports */
|
||||||
QueryInterface : function dch_QI(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;
|
||||||
|
|
@ -687,7 +687,7 @@ nsDefaultCommandLineHandler.prototype = {
|
||||||
_haveProfile: false,
|
_haveProfile: false,
|
||||||
|
|
||||||
/* nsICommandLineHandler */
|
/* nsICommandLineHandler */
|
||||||
handle : function dch_handle(cmdLine) {
|
handle : function(cmdLine) {
|
||||||
// The -url flag is inserted by the operating system when the default
|
// The -url flag is inserted by the operating system when the default
|
||||||
// application handler is used. We check for default browser to remove
|
// application handler is used. We check for default browser to remove
|
||||||
// instances where users explicitly decide to "open with" the browser.
|
// instances where users explicitly decide to "open with" the browser.
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ const BOOKMARKS_BACKUP_MAX_INTERVAL_DAYS = 3;
|
||||||
// Factory object
|
// Factory object
|
||||||
const BrowserGlueServiceFactory = {
|
const BrowserGlueServiceFactory = {
|
||||||
_instance: null,
|
_instance: null,
|
||||||
createInstance: function BGSF_createInstance(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 ?
|
||||||
|
|
@ -129,7 +129,7 @@ BrowserGlue.prototype = {
|
||||||
_isPlacesDatabaseLocked: false,
|
_isPlacesDatabaseLocked: false,
|
||||||
_migrationImportsDefaultBookmarks: false,
|
_migrationImportsDefaultBookmarks: false,
|
||||||
|
|
||||||
_setPrefToSaveSession: function BG__setPrefToSaveSession(aForce) {
|
_setPrefToSaveSession: function(aForce) {
|
||||||
if (!this._saveSession && !aForce)
|
if (!this._saveSession && !aForce)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -142,7 +142,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
#ifdef MOZ_SERVICES_SYNC
|
#ifdef MOZ_SERVICES_SYNC
|
||||||
_setSyncAutoconnectDelay: function BG__setSyncAutoconnectDelay() {
|
_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");
|
||||||
|
|
@ -166,7 +166,7 @@ BrowserGlue.prototype = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// nsIObserver implementation
|
// nsIObserver implementation
|
||||||
observe: function BG_observe(subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case "notifications-open-settings":
|
case "notifications-open-settings":
|
||||||
this._openPreferences("content");
|
this._openPreferences("content");
|
||||||
|
|
@ -410,7 +410,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// initialization (called on application startup)
|
// initialization (called on application startup)
|
||||||
_init: function BG__init() {
|
_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);
|
||||||
|
|
@ -461,7 +461,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// cleanup (called on application shutdown)
|
// cleanup (called on application shutdown)
|
||||||
_dispose: function BG__dispose() {
|
_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");
|
||||||
|
|
@ -499,13 +499,13 @@ BrowserGlue.prototype = {
|
||||||
os.removeObserver(this, "autocomplete-did-enter-text");
|
os.removeObserver(this, "autocomplete-did-enter-text");
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAppDefaults: function BG__onAppDefaults() {
|
_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();
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifySlowAddon: function BG_notifySlowAddon(addonId) {
|
_notifySlowAddon: function(addonId) {
|
||||||
let addonCallback = function(addon) {
|
let addonCallback = function(addon) {
|
||||||
if (!addon) {
|
if (!addon) {
|
||||||
Cu.reportError("couldn't look up addon: " + addonId);
|
Cu.reportError("couldn't look up addon: " + addonId);
|
||||||
|
|
@ -617,7 +617,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 BG__finalUIStartup() {
|
_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) {
|
||||||
|
|
@ -705,7 +705,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSafeModeRestart: function BG_onSafeModeRestart() {
|
_onSafeModeRestart: function() {
|
||||||
// prompt the user to confirm
|
// prompt the user to confirm
|
||||||
let strings = gBrowserBundle;
|
let strings = gBrowserBundle;
|
||||||
let promptTitle = strings.GetStringFromName("safeModeRestartPromptTitle");
|
let promptTitle = strings.GetStringFromName("safeModeRestartPromptTitle");
|
||||||
|
|
@ -896,7 +896,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// the first browser window has finished initializing
|
// the first browser window has finished initializing
|
||||||
_onFirstWindowLoaded: function BG__onFirstWindowLoaded(aWindow) {
|
_onFirstWindowLoaded: function(aWindow) {
|
||||||
// Initialize PdfJs when running in-process and remote. This only
|
// Initialize PdfJs when running in-process and remote. This only
|
||||||
// happens once since PdfJs registers global hooks. If the PdfJs
|
// happens once since PdfJs registers global hooks. If the PdfJs
|
||||||
// extension is installed the init method below will be overridden
|
// extension is installed the init method below will be overridden
|
||||||
|
|
@ -1017,7 +1017,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// All initial windows have opened.
|
// All initial windows have opened.
|
||||||
_onWindowsRestored: function BG__onWindowsRestored() {
|
_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();
|
||||||
|
|
@ -1151,7 +1151,7 @@ BrowserGlue.prototype = {
|
||||||
E10SAccessibilityCheck.onWindowsRestored();
|
E10SAccessibilityCheck.onWindowsRestored();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onQuitRequest: function BG__onQuitRequest(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;
|
||||||
|
|
@ -1283,7 +1283,7 @@ BrowserGlue.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showUpdateNotification: function BG__showUpdateNotification() {
|
_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"].
|
||||||
|
|
@ -1402,7 +1402,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 BG__initPlaces(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).
|
||||||
|
|
@ -1585,7 +1585,7 @@ BrowserGlue.prototype = {
|
||||||
/**
|
/**
|
||||||
* If a backup for today doesn't exist, this creates one.
|
* If a backup for today doesn't exist, this creates one.
|
||||||
*/
|
*/
|
||||||
_backupBookmarks: function BG__backupBookmarks() {
|
_backupBookmarks: function() {
|
||||||
return Task.spawn(function*() {
|
return Task.spawn(function*() {
|
||||||
let lastBackupFile = yield PlacesBackups.getMostRecentBackup();
|
let lastBackupFile = yield PlacesBackups.getMostRecentBackup();
|
||||||
// Should backup bookmarks if there are no backups or the maximum
|
// Should backup bookmarks if there are no backups or the maximum
|
||||||
|
|
@ -1601,7 +1601,7 @@ BrowserGlue.prototype = {
|
||||||
/**
|
/**
|
||||||
* Show the notificationBox for a locked places database.
|
* Show the notificationBox for a locked places database.
|
||||||
*/
|
*/
|
||||||
_showPlacesLockedNotificationBox: function BG__showPlacesLockedNotificationBox() {
|
_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");
|
||||||
|
|
@ -1650,7 +1650,7 @@ BrowserGlue.prototype = {
|
||||||
AlertsService.showAlertNotification(null, title, body, true, null, clickCallback);
|
AlertsService.showAlertNotification(null, title, body, true, null, clickCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
_migrateUI: function BG__migrateUI() {
|
_migrateUI: function() {
|
||||||
const UI_VERSION = 42;
|
const UI_VERSION = 42;
|
||||||
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
|
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
|
||||||
|
|
||||||
|
|
@ -1976,7 +1976,7 @@ BrowserGlue.prototype = {
|
||||||
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
|
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasExistingNotificationPermission: function BG__hasExistingNotificationPermission() {
|
_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);
|
||||||
|
|
@ -2023,7 +2023,7 @@ BrowserGlue.prototype = {
|
||||||
// public nsIBrowserGlue members
|
// public nsIBrowserGlue members
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
|
|
||||||
sanitize: function BG_sanitize(aParentWindow) {
|
sanitize: function(aParentWindow) {
|
||||||
this._sanitizer.sanitize(aParentWindow);
|
this._sanitizer.sanitize(aParentWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -2180,7 +2180,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 _onDisplaySyncURI(data) {
|
_onDisplaySyncURI: function(data) {
|
||||||
try {
|
try {
|
||||||
let tabbrowser = RecentWindow.getMostRecentBrowserWindow({private: false}).gBrowser;
|
let tabbrowser = RecentWindow.getMostRecentBrowserWindow({private: false}).gBrowser;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,11 +231,11 @@ this.PlacesUIUtils = {
|
||||||
* The string spec of the URI
|
* The string spec of the URI
|
||||||
* @return A URI object for the spec.
|
* @return A URI object for the spec.
|
||||||
*/
|
*/
|
||||||
createFixedURI: function PUIU_createFixedURI(aSpec) {
|
createFixedURI: function(aSpec) {
|
||||||
return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormattedString: function PUIU_getFormattedString(key, params) {
|
getFormattedString: function(key, params) {
|
||||||
return bundle.formatStringFromName(key, params, params.length);
|
return bundle.formatStringFromName(key, params, params.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -254,7 +254,7 @@ 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 PUIU_getPluralString(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.
|
||||||
|
|
@ -264,7 +264,7 @@ this.PlacesUIUtils = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getString: function PUIU_getString(key) {
|
getString: function(key) {
|
||||||
return bundle.GetStringFromName(key);
|
return bundle.GetStringFromName(key);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -660,7 +660,7 @@ this.PlacesUIUtils = {
|
||||||
return ("performed" in aInfo && aInfo.performed);
|
return ("performed" in aInfo && aInfo.performed);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getTopBrowserWin: function PUIU__getTopBrowserWin() {
|
_getTopBrowserWin: function() {
|
||||||
return RecentWindow.getMostRecentBrowserWindow();
|
return RecentWindow.getMostRecentBrowserWindow();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -683,7 +683,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 PUIU_getViewForNode(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
|
||||||
|
|
@ -712,7 +712,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 PUIU_markPageAsTyped(aURL) {
|
markPageAsTyped: function(aURL) {
|
||||||
PlacesUtils.history.markPageAsTyped(this.createFixedURI(aURL));
|
PlacesUtils.history.markPageAsTyped(this.createFixedURI(aURL));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -723,7 +723,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 PUIU_markPageAsFollowedBookmark(aURL) {
|
markPageAsFollowedBookmark: function(aURL) {
|
||||||
PlacesUtils.history.markPageAsFollowedBookmark(this.createFixedURI(aURL));
|
PlacesUtils.history.markPageAsFollowedBookmark(this.createFixedURI(aURL));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -733,7 +733,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 PUIU_markPageAsFollowedLink(aURL) {
|
markPageAsFollowedLink: function(aURL) {
|
||||||
PlacesUtils.history.markPageAsFollowedLink(this.createFixedURI(aURL));
|
PlacesUtils.history.markPageAsFollowedLink(this.createFixedURI(aURL));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -747,7 +747,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 PUIU_checkURLSecurity(aURINode, aWindow) {
|
checkURLSecurity: function(aURINode, aWindow) {
|
||||||
if (PlacesUtils.nodeIsBookmark(aURINode))
|
if (PlacesUtils.nodeIsBookmark(aURINode))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -774,7 +774,7 @@ this.PlacesUIUtils = {
|
||||||
* @return A description string if a META element was discovered with a
|
* @return 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 PUIU_getDescriptionFromDocument(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" ||
|
||||||
|
|
@ -792,7 +792,7 @@ this.PlacesUIUtils = {
|
||||||
* @return the description of the given item, or an empty string if it is
|
* @return the description of the given item, or an empty string if it is
|
||||||
* not set.
|
* not set.
|
||||||
*/
|
*/
|
||||||
getItemDescription: function PUIU_getItemDescription(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 "";
|
||||||
|
|
@ -932,7 +932,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 PUIU__openTabset(aItemsToOpen, aEvent, aWindow) {
|
_openTabset: function(aItemsToOpen, aEvent, aWindow) {
|
||||||
if (!aItemsToOpen.length)
|
if (!aItemsToOpen.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1009,7 +1009,7 @@ this.PlacesUIUtils = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent, aView) {
|
openURINodesInTabs: function(aNodes, aEvent, aView) {
|
||||||
let window = aView.ownerWindow;
|
let window = aView.ownerWindow;
|
||||||
|
|
||||||
let urlsToOpen = [];
|
let urlsToOpen = [];
|
||||||
|
|
@ -1044,12 +1044,12 @@ this.PlacesUIUtils = {
|
||||||
* web panel.
|
* web panel.
|
||||||
* see also openUILinkIn
|
* see also openUILinkIn
|
||||||
*/
|
*/
|
||||||
openNodeIn: function PUIU_openNodeIn(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 PUIU_openNodeIn(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);
|
||||||
|
|
@ -1092,11 +1092,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 PUIU_guessUrlSchemeForUI(aUrlString) {
|
guessUrlSchemeForUI: function(aUrlString) {
|
||||||
return aUrlString.substr(0, aUrlString.indexOf(":"));
|
return aUrlString.substr(0, aUrlString.indexOf(":"));
|
||||||
},
|
},
|
||||||
|
|
||||||
getBestTitle: function PUIU_getBestTitle(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
|
||||||
|
|
@ -1284,7 +1284,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 CB_create_query(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,
|
||||||
|
|
@ -1301,7 +1301,7 @@ this.PlacesUIUtils = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Helper to create an organizer special folder.
|
// Helper to create an organizer special folder.
|
||||||
create_folder: function CB_create_folder(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,
|
||||||
|
|
@ -1325,7 +1325,7 @@ this.PlacesUIUtils = {
|
||||||
return folderId;
|
return folderId;
|
||||||
},
|
},
|
||||||
|
|
||||||
runBatched: function CB_runBatched(aUserData) {
|
runBatched: function(aUserData) {
|
||||||
delete PlacesUIUtils.leftPaneQueries;
|
delete PlacesUIUtils.leftPaneQueries;
|
||||||
PlacesUIUtils.leftPaneQueries = { };
|
PlacesUIUtils.leftPaneQueries = { };
|
||||||
|
|
||||||
|
|
@ -1392,7 +1392,7 @@ this.PlacesUIUtils = {
|
||||||
* @param aItemId id of a container
|
* @param aItemId id of a container
|
||||||
* @return the name of the query, or empty string if not a left-pane query
|
* @return the name of the query, or empty string if not a left-pane query
|
||||||
*/
|
*/
|
||||||
getLeftPaneQueryNameFromId: function PUIU_getLeftPaneQueryNameFromId(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.
|
||||||
|
|
|
||||||
|
|
@ -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 BPP__getAcceptLabel() {
|
_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 BPP__getDialogTitle() {
|
_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");
|
||||||
|
|
@ -255,7 +255,7 @@ var BookmarkPropertiesPanel = {
|
||||||
*
|
*
|
||||||
* @returns a title string
|
* @returns a title string
|
||||||
*/
|
*/
|
||||||
_getURITitleFromHistory: function BPP__getURITitleFromHistory(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
|
||||||
|
|
@ -355,7 +355,7 @@ var BookmarkPropertiesPanel = {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
handleEvent: function BPP_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
var target = aEvent.target;
|
var target = aEvent.target;
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "input":
|
case "input":
|
||||||
|
|
@ -410,7 +410,7 @@ var BookmarkPropertiesPanel = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
QueryInterface: function BPP_QueryInterface(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;
|
||||||
|
|
@ -418,7 +418,7 @@ var BookmarkPropertiesPanel = {
|
||||||
throw Cr.NS_NOINTERFACE;
|
throw Cr.NS_NOINTERFACE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_element: function BPP__element(aID) {
|
_element: function(aID) {
|
||||||
return document.getElementById("editBMPanel_" + aID);
|
return document.getElementById("editBMPanel_" + aID);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -463,7 +463,7 @@ var BookmarkPropertiesPanel = {
|
||||||
*
|
*
|
||||||
* @returns true if the input is valid, false otherwise
|
* @returns true if the input is valid, false otherwise
|
||||||
*/
|
*/
|
||||||
_inputIsValid: function BPP__inputIsValid() {
|
_inputIsValid: function() {
|
||||||
if (this._itemType == BOOKMARK_ITEM &&
|
if (this._itemType == BOOKMARK_ITEM &&
|
||||||
!this._containsValidURI("locationField"))
|
!this._containsValidURI("locationField"))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -482,7 +482,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 BPP__containsValidURI(aTextboxID) {
|
_containsValidURI: function(aTextboxID) {
|
||||||
try {
|
try {
|
||||||
var value = this._element(aTextboxID).value;
|
var value = this._element(aTextboxID).value;
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
@ -500,7 +500,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 BPP__getInsertionPointDetails() {
|
_getInsertionPointDetails: function() {
|
||||||
var containerId = this._defaultInsertionPoint.itemId;
|
var containerId = this._defaultInsertionPoint.itemId;
|
||||||
var indexInContainer = this._defaultInsertionPoint.index;
|
var indexInContainer = this._defaultInsertionPoint.index;
|
||||||
|
|
||||||
|
|
@ -554,7 +554,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 BPP__getTransactionsForURIList() {
|
_getTransactionsForURIList: function() {
|
||||||
var transactions = [];
|
var transactions = [];
|
||||||
for (let uri of this._URIs) {
|
for (let uri of this._URIs) {
|
||||||
// uri should be an object in the form { url, title }. Though add-ons
|
// uri should be an object in the form { url, title }. Though add-ons
|
||||||
|
|
|
||||||
|
|
@ -222,17 +222,17 @@ PlacesViewBase.prototype = {
|
||||||
index, orientation, tagName);
|
index, orientation, tagName);
|
||||||
},
|
},
|
||||||
|
|
||||||
buildContextMenu: function PVB_buildContextMenu(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 PVB_destroyContextMenu(aPopup) {
|
destroyContextMenu: function(aPopup) {
|
||||||
this._contextMenuShown = null;
|
this._contextMenuShown = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_cleanPopup: function PVB_cleanPopup(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) {
|
||||||
|
|
@ -255,7 +255,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_rebuildPopup: function PVB__rebuildPopup(aPopup) {
|
_rebuildPopup: function(aPopup) {
|
||||||
let resultNode = aPopup._placesNode;
|
let resultNode = aPopup._placesNode;
|
||||||
if (!resultNode.containerOpen)
|
if (!resultNode.containerOpen)
|
||||||
return;
|
return;
|
||||||
|
|
@ -284,7 +284,7 @@ PlacesViewBase.prototype = {
|
||||||
aPopup._built = true;
|
aPopup._built = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeChild: function PVB__removeChild(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".
|
||||||
|
|
@ -487,7 +487,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCutNode: function PVB_toggleCutNode(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.
|
||||||
|
|
@ -499,7 +499,7 @@ PlacesViewBase.prototype = {
|
||||||
elt.removeAttribute("cutting");
|
elt.removeAttribute("cutting");
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeURIChanged: function PVB_nodeURIChanged(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>.
|
||||||
|
|
@ -509,7 +509,7 @@ PlacesViewBase.prototype = {
|
||||||
elt.setAttribute("scheme", PlacesUIUtils.guessUrlSchemeForUI(aURIString));
|
elt.setAttribute("scheme", PlacesUIUtils.guessUrlSchemeForUI(aURIString));
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeIconChanged: function PVB_nodeIconChanged(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
|
||||||
|
|
@ -701,7 +701,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateLivemarkPopup: function PVB__populateLivemarkPopup(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.
|
||||||
|
|
@ -731,7 +731,7 @@ PlacesViewBase.prototype = {
|
||||||
}, Components.utils.reportError);
|
}, Components.utils.reportError);
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer: function PVB_invalidateContainer(aPlacesNode) {
|
invalidateContainer: function(aPlacesNode) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
elt._built = false;
|
elt._built = false;
|
||||||
|
|
||||||
|
|
@ -740,7 +740,7 @@ PlacesViewBase.prototype = {
|
||||||
this._rebuildPopup(elt);
|
this._rebuildPopup(elt);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function PVB_uninit() {
|
uninit: function() {
|
||||||
if (this._result) {
|
if (this._result) {
|
||||||
this._result.removeObserver(this);
|
this._result.removeObserver(this);
|
||||||
this._resultNode.containerOpen = false;
|
this._resultNode.containerOpen = false;
|
||||||
|
|
@ -783,7 +783,7 @@ PlacesViewBase.prototype = {
|
||||||
* @param aPopup
|
* @param aPopup
|
||||||
* a Places popup.
|
* a Places popup.
|
||||||
*/
|
*/
|
||||||
_mayAddCommandsItems: function PVB__mayAddCommandsItems(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;
|
||||||
|
|
@ -860,7 +860,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureMarkers: function PVB__ensureMarkers(aPopup) {
|
_ensureMarkers: function(aPopup) {
|
||||||
if (aPopup._startMarker)
|
if (aPopup._startMarker)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -904,7 +904,7 @@ PlacesViewBase.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupShowing: function PVB__onPopupShowing(aEvent) {
|
_onPopupShowing: function(aEvent) {
|
||||||
// Avoid handling popupshowing of inner views.
|
// Avoid handling popupshowing of inner views.
|
||||||
let popup = aEvent.originalTarget;
|
let popup = aEvent.originalTarget;
|
||||||
|
|
||||||
|
|
@ -991,7 +991,7 @@ PlacesToolbar.prototype = {
|
||||||
_cbEvents: ["dragstart", "dragover", "dragexit", "dragend", "drop",
|
_cbEvents: ["dragstart", "dragover", "dragexit", "dragend", "drop",
|
||||||
"mousemove", "mouseover", "mouseout"],
|
"mousemove", "mouseover", "mouseout"],
|
||||||
|
|
||||||
QueryInterface: function PT_QueryInterface(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;
|
||||||
|
|
@ -999,7 +999,7 @@ PlacesToolbar.prototype = {
|
||||||
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function PT_uninit() {
|
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);
|
||||||
|
|
@ -1017,7 +1017,7 @@ PlacesToolbar.prototype = {
|
||||||
_openedMenuButton: null,
|
_openedMenuButton: null,
|
||||||
_allowPopupShowing: true,
|
_allowPopupShowing: true,
|
||||||
|
|
||||||
_rebuild: function PT__rebuild() {
|
_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)
|
||||||
|
|
@ -1120,7 +1120,7 @@ PlacesToolbar.prototype = {
|
||||||
this._updateChevronPopupNodesVisibility();
|
this._updateChevronPopupNodesVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function PT_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "unload":
|
case "unload":
|
||||||
this.uninit();
|
this.uninit();
|
||||||
|
|
@ -1188,12 +1188,12 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_isOverflowStateEventRelevant: function PT_isOverflowStateEventRelevant(aEvent) {
|
_isOverflowStateEventRelevant: function(aEvent) {
|
||||||
// Ignore events not aimed at ourselves, as well as purely vertical ones:
|
// Ignore events not aimed at ourselves, as well as purely vertical ones:
|
||||||
return aEvent.target == aEvent.currentTarget && aEvent.detail > 0;
|
return aEvent.target == aEvent.currentTarget && aEvent.detail > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOverflow: function PT_onOverflow() {
|
_onOverflow: function() {
|
||||||
// Attach the popup binding to the chevron popup if it has not yet
|
// Attach the popup binding to the chevron popup if it has not yet
|
||||||
// been initialized.
|
// been initialized.
|
||||||
if (!this._chevronPopup.hasAttribute("type")) {
|
if (!this._chevronPopup.hasAttribute("type")) {
|
||||||
|
|
@ -1204,12 +1204,12 @@ PlacesToolbar.prototype = {
|
||||||
this.updateChevron();
|
this.updateChevron();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUnderflow: function PT_onUnderflow() {
|
_onUnderflow: function() {
|
||||||
this.updateChevron();
|
this.updateChevron();
|
||||||
this._chevron.collapsed = true;
|
this._chevron.collapsed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateChevron: function PT_updateChevron() {
|
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;
|
||||||
|
|
@ -1222,7 +1222,7 @@ PlacesToolbar.prototype = {
|
||||||
this._updateChevronTimer = this._setTimer(100);
|
this._updateChevronTimer = this._setTimer(100);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateChevronTimerCallback: function PT__updateChevronTimerCallback() {
|
_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++) {
|
||||||
|
|
@ -1337,7 +1337,7 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTitleChanged: function PT_nodeTitleChanged(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
|
||||||
|
|
@ -1357,7 +1357,7 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer: function PT_invalidateContainer(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.
|
||||||
|
|
@ -1373,7 +1373,7 @@ PlacesToolbar.prototype = {
|
||||||
hoverTime: 350,
|
hoverTime: 350,
|
||||||
closeTimer: null },
|
closeTimer: null },
|
||||||
|
|
||||||
_clearOverFolder: function PT__clearOverFolder() {
|
_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.
|
||||||
|
|
@ -1401,7 +1401,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 PT__getDropPoint(aEvent) {
|
_getDropPoint: function(aEvent) {
|
||||||
if (!PlacesUtils.nodeIsFolder(this._resultNode))
|
if (!PlacesUtils.nodeIsFolder(this._resultNode))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
@ -1485,13 +1485,13 @@ PlacesToolbar.prototype = {
|
||||||
return dropPoint;
|
return dropPoint;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setTimer: function PT_setTimer(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 PT_notify(aTimer) {
|
notify: function(aTimer) {
|
||||||
if (aTimer == this._updateChevronTimer) {
|
if (aTimer == this._updateChevronTimer) {
|
||||||
this._updateChevronTimer = null;
|
this._updateChevronTimer = null;
|
||||||
this._updateChevronTimerCallback();
|
this._updateChevronTimerCallback();
|
||||||
|
|
@ -1536,18 +1536,18 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseOver: function PT__onMouseOver(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 PT__onMouseOut(aEvent) {
|
_onMouseOut: function(aEvent) {
|
||||||
window.XULBrowserWindow.setOverLink("", null);
|
window.XULBrowserWindow.setOverLink("", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_cleanupDragDetails: function PT__cleanupDragDetails() {
|
_cleanupDragDetails: function() {
|
||||||
// Called on dragend and drop.
|
// Called on dragend and drop.
|
||||||
PlacesControllerDragHelper.currentDropTarget = null;
|
PlacesControllerDragHelper.currentDropTarget = null;
|
||||||
this._draggedElt = null;
|
this._draggedElt = null;
|
||||||
|
|
@ -1557,7 +1557,7 @@ PlacesToolbar.prototype = {
|
||||||
this._dropIndicator.collapsed = true;
|
this._dropIndicator.collapsed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragStart: function PT__onDragStart(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)
|
||||||
|
|
@ -1592,7 +1592,7 @@ PlacesToolbar.prototype = {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragOver: function PT__onDragOver(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;
|
||||||
|
|
@ -1669,7 +1669,7 @@ PlacesToolbar.prototype = {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDrop: function PT__onDrop(aEvent) {
|
_onDrop: function(aEvent) {
|
||||||
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
|
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
|
||||||
|
|
||||||
let dropPoint = this._getDropPoint(aEvent);
|
let dropPoint = this._getDropPoint(aEvent);
|
||||||
|
|
@ -1683,7 +1683,7 @@ PlacesToolbar.prototype = {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragExit: function PT__onDragExit(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
|
||||||
|
|
@ -1698,11 +1698,11 @@ PlacesToolbar.prototype = {
|
||||||
this._overFolder.closeTimer = this._setTimer(this._overFolder.hoverTime);
|
this._overFolder.closeTimer = this._setTimer(this._overFolder.hoverTime);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function PT_onDragEnd(aEvent) {
|
_onDragEnd: function(aEvent) {
|
||||||
this._cleanupDragDetails();
|
this._cleanupDragDetails();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupShowing: function PT__onPopupShowing(aEvent) {
|
_onPopupShowing: function(aEvent) {
|
||||||
if (!this._allowPopupShowing) {
|
if (!this._allowPopupShowing) {
|
||||||
this._allowPopupShowing = true;
|
this._allowPopupShowing = true;
|
||||||
aEvent.preventDefault();
|
aEvent.preventDefault();
|
||||||
|
|
@ -1716,7 +1716,7 @@ PlacesToolbar.prototype = {
|
||||||
PlacesViewBase.prototype._onPopupShowing.apply(this, arguments);
|
PlacesViewBase.prototype._onPopupShowing.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupHidden: function PT__onPopupHidden(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
|
||||||
|
|
@ -1742,7 +1742,7 @@ PlacesToolbar.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseMove: function PT__onMouseMove(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;
|
||||||
|
|
||||||
|
|
@ -1788,18 +1788,18 @@ function PlacesMenu(aPopupShowingEvent, aPlace, aOptions) {
|
||||||
PlacesMenu.prototype = {
|
PlacesMenu.prototype = {
|
||||||
__proto__: PlacesViewBase.prototype,
|
__proto__: PlacesViewBase.prototype,
|
||||||
|
|
||||||
QueryInterface: function PM_QueryInterface(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 PM_removeChild(aChild) {
|
_removeChild: function(aChild) {
|
||||||
PlacesViewBase.prototype._removeChild.apply(this, arguments);
|
PlacesViewBase.prototype._removeChild.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function PM_uninit() {
|
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);
|
||||||
|
|
@ -1807,7 +1807,7 @@ PlacesMenu.prototype = {
|
||||||
PlacesViewBase.prototype.uninit.apply(this, arguments);
|
PlacesViewBase.prototype.uninit.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function PM_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "unload":
|
case "unload":
|
||||||
this.uninit();
|
this.uninit();
|
||||||
|
|
@ -1821,7 +1821,7 @@ PlacesMenu.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupHidden: function PM__onPopupHidden(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;
|
||||||
|
|
@ -1856,11 +1856,11 @@ function PlacesPanelMenuView(aPlace, aViewId, aRootId, aOptions) {
|
||||||
PlacesPanelMenuView.prototype = {
|
PlacesPanelMenuView.prototype = {
|
||||||
__proto__: PlacesViewBase.prototype,
|
__proto__: PlacesViewBase.prototype,
|
||||||
|
|
||||||
QueryInterface: function PAMV_QueryInterface(aIID) {
|
QueryInterface: function(aIID) {
|
||||||
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function PAMV_uninit() {
|
uninit: function() {
|
||||||
PlacesViewBase.prototype.uninit.apply(this, arguments);
|
PlacesViewBase.prototype.uninit.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1969,7 +1969,7 @@ PlacesPanelMenuView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTitleChanged: function PAMV_nodeTitleChanged(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.
|
// There's no UI representation for the root node.
|
||||||
|
|
@ -1979,7 +1979,7 @@ PlacesPanelMenuView.prototype = {
|
||||||
PlacesViewBase.prototype.nodeTitleChanged.apply(this, arguments);
|
PlacesViewBase.prototype.nodeTitleChanged.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer: function PAMV_invalidateContainer(aPlacesNode) {
|
invalidateContainer: function(aPlacesNode) {
|
||||||
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
|
||||||
if (elt != this._rootElt)
|
if (elt != this._rootElt)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -105,15 +105,15 @@ PlacesController.prototype = {
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// nsIClipboardOwner
|
// nsIClipboardOwner
|
||||||
LosingOwnership: function PC_LosingOwnership (aXferable) {
|
LosingOwnership: function(aXferable) {
|
||||||
this.cutNodes = [];
|
this.cutNodes = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
terminate: function PC_terminate() {
|
terminate: function() {
|
||||||
this._releaseClipboardOwnership();
|
this._releaseClipboardOwnership();
|
||||||
},
|
},
|
||||||
|
|
||||||
supportsCommand: function PC_supportsCommand(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":
|
||||||
|
|
@ -132,7 +132,7 @@ PlacesController.prototype = {
|
||||||
return (aCommand.substr(0, CMD_PREFIX.length) == CMD_PREFIX);
|
return (aCommand.substr(0, CMD_PREFIX.length) == CMD_PREFIX);
|
||||||
},
|
},
|
||||||
|
|
||||||
isCommandEnabled: function PC_isCommandEnabled(aCommand) {
|
isCommandEnabled: function(aCommand) {
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "cmd_undo":
|
case "cmd_undo":
|
||||||
if (!PlacesUIUtils.useAsyncTransactions)
|
if (!PlacesUIUtils.useAsyncTransactions)
|
||||||
|
|
@ -213,7 +213,7 @@ PlacesController.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
doCommand: function PC_doCommand(aCommand) {
|
doCommand: function(aCommand) {
|
||||||
switch (aCommand) {
|
switch (aCommand) {
|
||||||
case "cmd_undo":
|
case "cmd_undo":
|
||||||
if (!PlacesUIUtils.useAsyncTransactions) {
|
if (!PlacesUIUtils.useAsyncTransactions) {
|
||||||
|
|
@ -307,7 +307,7 @@ PlacesController.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onEvent: function PC_onEvent(eventName) { },
|
onEvent: function(eventName) { },
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -345,7 +345,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 PC__canInsert(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);
|
||||||
},
|
},
|
||||||
|
|
@ -358,7 +358,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 PC__isClipboardDataPasteable() {
|
_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.
|
||||||
|
|
||||||
|
|
@ -418,7 +418,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 PC__buildSelectionMetadata() {
|
_buildSelectionMetadata: function() {
|
||||||
var metadata = [];
|
var metadata = [];
|
||||||
var nodes = this._view.selectedNodes;
|
var nodes = this._view.selectedNodes;
|
||||||
|
|
||||||
|
|
@ -501,7 +501,7 @@ PlacesController.prototype = {
|
||||||
* @return true if the conditions (see buildContextMenu) are satisfied
|
* @return 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 PC__shouldShowMenuItem(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";
|
||||||
|
|
@ -596,7 +596,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 PC_buildContextMenu(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;
|
||||||
|
|
@ -665,7 +665,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Select all links in the current view.
|
* Select all links in the current view.
|
||||||
*/
|
*/
|
||||||
selectAll: function PC_selectAll() {
|
selectAll: function() {
|
||||||
this._view.selectAll();
|
this._view.selectAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -687,7 +687,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 PC__assertURINotString(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.");
|
||||||
},
|
},
|
||||||
|
|
@ -695,7 +695,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Reloads the selected livemark if any.
|
* Reloads the selected livemark if any.
|
||||||
*/
|
*/
|
||||||
reloadSelectedLivemark: function PC_reloadSelectedLivemark() {
|
reloadSelectedLivemark: function() {
|
||||||
var selectedNode = this._view.selectedNode;
|
var selectedNode = this._view.selectedNode;
|
||||||
if (selectedNode) {
|
if (selectedNode) {
|
||||||
let itemId = selectedNode.itemId;
|
let itemId = selectedNode.itemId;
|
||||||
|
|
@ -709,7 +709,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 PC_openLinksInTabs(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:
|
||||||
|
|
@ -728,7 +728,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 PC_newItem(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;
|
||||||
|
|
@ -776,7 +776,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Opens a dialog for moving the selected nodes.
|
* Opens a dialog for moving the selected nodes.
|
||||||
*/
|
*/
|
||||||
moveSelectedBookmarks: function PC_moveBookmarks() {
|
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);
|
||||||
|
|
@ -806,7 +806,7 @@ PlacesController.prototype = {
|
||||||
* List of folders the calling function has already traversed
|
* List of folders the calling function has already traversed
|
||||||
* @return true if the node should be skipped, false otherwise.
|
* @return true if the node should be skipped, false otherwise.
|
||||||
*/
|
*/
|
||||||
_shouldSkipNode: function PC_shouldSkipNode(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
|
||||||
|
|
@ -842,7 +842,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 PC__removeRange(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 = [];
|
||||||
|
|
@ -954,7 +954,7 @@ PlacesController.prototype = {
|
||||||
*
|
*
|
||||||
* @note history deletes are not undoable.
|
* @note history deletes are not undoable.
|
||||||
*/
|
*/
|
||||||
_removeRowsFromHistory: function PC__removeRowsFromHistory() {
|
_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) {
|
||||||
|
|
@ -994,7 +994,7 @@ PlacesController.prototype = {
|
||||||
*
|
*
|
||||||
* @note history deletes are not undoable.
|
* @note history deletes are not undoable.
|
||||||
*/
|
*/
|
||||||
_removeHistoryContainer: function PC__removeHistoryContainer(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);
|
||||||
|
|
@ -1059,7 +1059,7 @@ PlacesController.prototype = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The dragstart event.
|
* The dragstart event.
|
||||||
*/
|
*/
|
||||||
setDataTransfer: function PC_setDataTransfer(aEvent) {
|
setDataTransfer: function(aEvent) {
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
|
|
||||||
let result = this._view.result;
|
let result = this._view.result;
|
||||||
|
|
@ -1129,14 +1129,14 @@ PlacesController.prototype = {
|
||||||
return action;
|
return action;
|
||||||
},
|
},
|
||||||
|
|
||||||
_releaseClipboardOwnership: function PC__releaseClipboardOwnership() {
|
_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 PC__clearClipboard() {
|
_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);
|
||||||
|
|
@ -1147,7 +1147,7 @@ PlacesController.prototype = {
|
||||||
this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateClipboard: function PC__populateClipboard(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 = [
|
||||||
|
|
@ -1231,7 +1231,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Copy Bookmarks and Folders to the clipboard
|
* Copy Bookmarks and Folders to the clipboard
|
||||||
*/
|
*/
|
||||||
copy: function PC_copy() {
|
copy: function() {
|
||||||
let result = this._view.result;
|
let result = this._view.result;
|
||||||
let didSuppressNotifications = result.suppressNotifications;
|
let didSuppressNotifications = result.suppressNotifications;
|
||||||
if (!didSuppressNotifications)
|
if (!didSuppressNotifications)
|
||||||
|
|
@ -1248,7 +1248,7 @@ PlacesController.prototype = {
|
||||||
/**
|
/**
|
||||||
* Cut Bookmarks and Folders to the clipboard
|
* Cut Bookmarks and Folders to the clipboard
|
||||||
*/
|
*/
|
||||||
cut: function PC_cut() {
|
cut: function() {
|
||||||
let result = this._view.result;
|
let result = this._view.result;
|
||||||
let didSuppressNotifications = result.suppressNotifications;
|
let didSuppressNotifications = result.suppressNotifications;
|
||||||
if (!didSuppressNotifications)
|
if (!didSuppressNotifications)
|
||||||
|
|
@ -1390,7 +1390,7 @@ PlacesController.prototype = {
|
||||||
* @param aLivemarkInfo
|
* @param aLivemarkInfo
|
||||||
* a mozILivemarkInfo object.
|
* a mozILivemarkInfo object.
|
||||||
*/
|
*/
|
||||||
cacheLivemarkInfo: function PC_cacheLivemarkInfo(aNode, aLivemarkInfo) {
|
cacheLivemarkInfo: function(aNode, aLivemarkInfo) {
|
||||||
this._cachedLivemarkInfoObjects.set(aNode, aLivemarkInfo);
|
this._cachedLivemarkInfoObjects.set(aNode, aLivemarkInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1401,7 +1401,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 PC_hasCachedLivemarkInfo(aNode) {
|
hasCachedLivemarkInfo: function(aNode) {
|
||||||
return this._cachedLivemarkInfoObjects.has(aNode);
|
return this._cachedLivemarkInfoObjects.has(aNode);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1412,7 +1412,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 PC_getCachedLivemarkInfo(aNode) {
|
getCachedLivemarkInfo: function(aNode) {
|
||||||
return this._cachedLivemarkInfoObjects.get(aNode, null);
|
return this._cachedLivemarkInfoObjects.get(aNode, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1438,7 +1438,7 @@ var PlacesControllerDragHelper = {
|
||||||
* @return true if the user is dragging over a node within the hierarchy of
|
* @return true if the user is dragging over a node within the hierarchy of
|
||||||
* the container, false otherwise.
|
* the container, false otherwise.
|
||||||
*/
|
*/
|
||||||
draggingOverChildNode: function PCDH_draggingOverChildNode(node) {
|
draggingOverChildNode: function(node) {
|
||||||
let currentNode = this.currentDropTarget;
|
let currentNode = this.currentDropTarget;
|
||||||
while (currentNode) {
|
while (currentNode) {
|
||||||
if (currentNode == node)
|
if (currentNode == node)
|
||||||
|
|
@ -1451,7 +1451,7 @@ var PlacesControllerDragHelper = {
|
||||||
/**
|
/**
|
||||||
* @return The current active drag session. Returns null if there is none.
|
* @return The current active drag session. Returns null if there is none.
|
||||||
*/
|
*/
|
||||||
getSession: function PCDH__getSession() {
|
getSession: function() {
|
||||||
return this.dragService.getCurrentSession();
|
return this.dragService.getCurrentSession();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1460,7 +1460,7 @@ var PlacesControllerDragHelper = {
|
||||||
* @param aFlavors
|
* @param aFlavors
|
||||||
* The flavors list of type DOMStringList.
|
* The flavors list of type DOMStringList.
|
||||||
*/
|
*/
|
||||||
getFirstValidFlavor: function PCDH_getFirstValidFlavor(aFlavors) {
|
getFirstValidFlavor: function(aFlavors) {
|
||||||
for (let i = 0; i < aFlavors.length; i++) {
|
for (let i = 0; i < aFlavors.length; i++) {
|
||||||
if (PlacesUIUtils.SUPPORTED_FLAVORS.includes(aFlavors[i]))
|
if (PlacesUIUtils.SUPPORTED_FLAVORS.includes(aFlavors[i]))
|
||||||
return aFlavors[i];
|
return aFlavors[i];
|
||||||
|
|
@ -1482,7 +1482,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 PCDH_canDrop(ip, dt) {
|
canDrop: function(ip, dt) {
|
||||||
let dropCount = dt.mozItemCount;
|
let dropCount = dt.mozItemCount;
|
||||||
|
|
||||||
// Check every dragged item.
|
// Check every dragged item.
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,7 @@ var gEditItemOverlay = {
|
||||||
return folderMenuItem;
|
return folderMenuItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initFolderMenuList: function EIO__initFolderMenuList(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)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ var gMoveBookmarksDialog = {
|
||||||
PlacesUIUtils.allBookmarksFolderId;
|
PlacesUIUtils.allBookmarksFolderId;
|
||||||
},
|
},
|
||||||
|
|
||||||
onOK: function MBD_onOK(aEvent) {
|
onOK: function(aEvent) {
|
||||||
let selectedNode = this.foldersTree.selectedNode;
|
let selectedNode = this.foldersTree.selectedNode;
|
||||||
let selectedFolderId = PlacesUtils.getConcreteItemId(selectedNode);
|
let selectedFolderId = PlacesUtils.getConcreteItemId(selectedNode);
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ var gMoveBookmarksDialog = {
|
||||||
}.bind(this)).then(null, Components.utils.reportError);
|
}.bind(this)).then(null, Components.utils.reportError);
|
||||||
},
|
},
|
||||||
|
|
||||||
newFolder: function MBD_newFolder() {
|
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");
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,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 PO_selectLeftPaneQuery(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
|
||||||
|
|
@ -87,7 +87,7 @@ var PlacesOrganizer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function PO_init() {
|
init: function() {
|
||||||
ContentArea.init();
|
ContentArea.init();
|
||||||
|
|
||||||
this._places = document.getElementById("placesList");
|
this._places = document.getElementById("placesList");
|
||||||
|
|
@ -135,7 +135,7 @@ var PlacesOrganizer = {
|
||||||
ContentArea.focus();
|
ContentArea.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function PO_QueryInterface(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;
|
||||||
|
|
@ -143,7 +143,7 @@ var PlacesOrganizer = {
|
||||||
throw Components.results.NS_NOINTERFACE;
|
throw Components.results.NS_NOINTERFACE;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function PO_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
if (aEvent.type != "AppCommand")
|
if (aEvent.type != "AppCommand")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -163,7 +163,7 @@ var PlacesOrganizer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function PO_destroy() {
|
destroy: function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
_location: null,
|
_location: null,
|
||||||
|
|
@ -205,13 +205,13 @@ var PlacesOrganizer = {
|
||||||
_backHistory: [],
|
_backHistory: [],
|
||||||
_forwardHistory: [],
|
_forwardHistory: [],
|
||||||
|
|
||||||
back: function PO_back() {
|
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 PO_forward() {
|
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;
|
||||||
|
|
@ -229,7 +229,7 @@ var PlacesOrganizer = {
|
||||||
* deleting its text, this will be false.
|
* deleting its text, this will be false.
|
||||||
*/
|
*/
|
||||||
_cachedLeftPaneSelectedURI: null,
|
_cachedLeftPaneSelectedURI: null,
|
||||||
onPlaceSelected: function PO_onPlaceSelected(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;
|
||||||
|
|
@ -275,7 +275,7 @@ var PlacesOrganizer = {
|
||||||
* @param aNode
|
* @param aNode
|
||||||
* the node to set up scope from
|
* the node to set up scope from
|
||||||
*/
|
*/
|
||||||
_setSearchScopeForNode: function PO__setScopeForNode(aNode) {
|
_setSearchScopeForNode: function(aNode) {
|
||||||
let itemId = aNode.itemId;
|
let itemId = aNode.itemId;
|
||||||
|
|
||||||
if (PlacesUtils.nodeIsHistoryContainer(aNode) ||
|
if (PlacesUtils.nodeIsHistoryContainer(aNode) ||
|
||||||
|
|
@ -298,7 +298,7 @@ var PlacesOrganizer = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The mouse event.
|
* The mouse event.
|
||||||
*/
|
*/
|
||||||
onPlacesListClick: function PO_onPlacesListClick(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;
|
||||||
|
|
@ -318,7 +318,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 PO_updateDetailsPane() {
|
updateDetailsPane: function() {
|
||||||
if (!ContentArea.currentViewOptions.showDetailsPane)
|
if (!ContentArea.currentViewOptions.showDetailsPane)
|
||||||
return;
|
return;
|
||||||
let view = PlacesUIUtils.getViewForNode(document.activeElement);
|
let view = PlacesUIUtils.getViewForNode(document.activeElement);
|
||||||
|
|
@ -329,7 +329,7 @@ var PlacesOrganizer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openFlatContainer: function PO_openFlatContainerFlatContainer(aContainer) {
|
openFlatContainer: function(aContainer) {
|
||||||
if (aContainer.itemId != -1) {
|
if (aContainer.itemId != -1) {
|
||||||
PlacesUtils.asContainer(this._places.selectedNode).containerOpen = true;
|
PlacesUtils.asContainer(this._places.selectedNode).containerOpen = true;
|
||||||
this._places.selectItems([aContainer.itemId], false);
|
this._places.selectItems([aContainer.itemId], false);
|
||||||
|
|
@ -343,7 +343,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 PO_getCurrentOptions() {
|
getCurrentOptions: function() {
|
||||||
return PlacesUtils.asQuery(ContentArea.currentView.result.root).queryOptions;
|
return PlacesUtils.asQuery(ContentArea.currentView.result.root).queryOptions;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ 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 PO_getCurrentQueries() {
|
getCurrentQueries: function() {
|
||||||
return PlacesUtils.asQuery(ContentArea.currentView.result.root).getQueries();
|
return PlacesUtils.asQuery(ContentArea.currentView.result.root).getQueries();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -359,7 +359,7 @@ var PlacesOrganizer = {
|
||||||
* Show the migration wizard for importing passwords,
|
* Show the migration wizard for importing passwords,
|
||||||
* cookies, history, preferences, and bookmarks.
|
* cookies, history, preferences, and bookmarks.
|
||||||
*/
|
*/
|
||||||
importFromBrowser: function PO_importFromBrowser() {
|
importFromBrowser: function() {
|
||||||
// We pass in the type of source we're using for use in telemetry:
|
// We pass in the type of source we're using for use in telemetry:
|
||||||
MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_PLACES]);
|
MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_PLACES]);
|
||||||
},
|
},
|
||||||
|
|
@ -367,7 +367,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* 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 PO_importFromFile() {
|
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) {
|
||||||
|
|
@ -386,7 +386,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Allows simple exporting of bookmarks.
|
* Allows simple exporting of bookmarks.
|
||||||
*/
|
*/
|
||||||
exportBookmarks: function PO_exportBookmarks() {
|
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) {
|
||||||
|
|
@ -406,7 +406,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 PO_populateRestoreMenu() {
|
populateRestoreMenu: function() {
|
||||||
let restorePopup = document.getElementById("fileRestorePopup");
|
let restorePopup = document.getElementById("fileRestorePopup");
|
||||||
|
|
||||||
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||||
|
|
@ -475,7 +475,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 PO_onRestoreBookmarksFromFile() {
|
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);
|
||||||
|
|
@ -498,7 +498,7 @@ var PlacesOrganizer = {
|
||||||
/**
|
/**
|
||||||
* Restores bookmarks from a JSON file.
|
* Restores bookmarks from a JSON file.
|
||||||
*/
|
*/
|
||||||
restoreBookmarksFromFile: function PO_restoreBookmarksFromFile(aFilePath) {
|
restoreBookmarksFromFile: function(aFilePath) {
|
||||||
// check file extension
|
// check file extension
|
||||||
if (!aFilePath.toLowerCase().endsWith("json") &&
|
if (!aFilePath.toLowerCase().endsWith("json") &&
|
||||||
!aFilePath.toLowerCase().endsWith("jsonlz4")) {
|
!aFilePath.toLowerCase().endsWith("jsonlz4")) {
|
||||||
|
|
@ -523,7 +523,7 @@ var PlacesOrganizer = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_showErrorAlert: function PO__showErrorAlert(aMsg) {
|
_showErrorAlert: function(aMsg) {
|
||||||
var brandShortName = document.getElementById("brandStrings").
|
var brandShortName = document.getElementById("brandStrings").
|
||||||
getString("brandShortName");
|
getString("brandShortName");
|
||||||
|
|
||||||
|
|
@ -537,7 +537,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 PO_backupBookmarks() {
|
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);
|
||||||
|
|
@ -596,7 +596,7 @@ var PlacesOrganizer = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// NOT YET USED
|
// NOT YET USED
|
||||||
updateThumbnailProportions: function PO_updateThumbnailProportions() {
|
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;
|
||||||
|
|
@ -605,7 +605,7 @@ var PlacesOrganizer = {
|
||||||
canvas.height = height;
|
canvas.height = height;
|
||||||
},
|
},
|
||||||
|
|
||||||
_fillDetailsPane: function PO__fillDetailsPane(aNodeList) {
|
_fillDetailsPane: function(aNodeList) {
|
||||||
var infoBox = document.getElementById("infoBox");
|
var infoBox = document.getElementById("infoBox");
|
||||||
var detailsDeck = document.getElementById("detailsDeck");
|
var detailsDeck = document.getElementById("detailsDeck");
|
||||||
|
|
||||||
|
|
@ -697,7 +697,7 @@ var PlacesOrganizer = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// NOT YET USED
|
// NOT YET USED
|
||||||
_updateThumbnail: function PO__updateThumbnail() {
|
_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;
|
||||||
|
|
@ -718,7 +718,7 @@ var PlacesOrganizer = {
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleAdditionalInfoFields: function PO_toggleAdditionalInfoFields() {
|
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");
|
||||||
|
|
@ -777,7 +777,7 @@ var PlacesSearchBox = {
|
||||||
* @param filterString
|
* @param filterString
|
||||||
* The text to search for.
|
* The text to search for.
|
||||||
*/
|
*/
|
||||||
search: function PSB_search(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.
|
||||||
|
|
@ -840,7 +840,7 @@ var PlacesSearchBox = {
|
||||||
/**
|
/**
|
||||||
* Finds across all history, downloads or all bookmarks.
|
* Finds across all history, downloads or all bookmarks.
|
||||||
*/
|
*/
|
||||||
findAll: function PSB_findAll() {
|
findAll: function() {
|
||||||
switch (this.filterCollection) {
|
switch (this.filterCollection) {
|
||||||
case "history":
|
case "history":
|
||||||
PlacesQueryBuilder.setScope("history");
|
PlacesQueryBuilder.setScope("history");
|
||||||
|
|
@ -860,7 +860,7 @@ var PlacesSearchBox = {
|
||||||
* @param aTitle
|
* @param aTitle
|
||||||
* The title of the current collection.
|
* The title of the current collection.
|
||||||
*/
|
*/
|
||||||
updateCollectionTitle: function PSB_updateCollectionTitle(aTitle) {
|
updateCollectionTitle: function(aTitle) {
|
||||||
let title = "";
|
let title = "";
|
||||||
switch (this.filterCollection) {
|
switch (this.filterCollection) {
|
||||||
case "history":
|
case "history":
|
||||||
|
|
@ -894,14 +894,14 @@ var PlacesSearchBox = {
|
||||||
/**
|
/**
|
||||||
* Focus the search box
|
* Focus the search box
|
||||||
*/
|
*/
|
||||||
focus: function PSB_focus() {
|
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 PSB_init() {
|
init: function() {
|
||||||
this.updateCollectionTitle();
|
this.updateCollectionTitle();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -933,7 +933,7 @@ var PlacesQueryBuilder = {
|
||||||
* The search scope: "bookmarks", "collection", "downloads" or
|
* The search scope: "bookmarks", "collection", "downloads" or
|
||||||
* "history".
|
* "history".
|
||||||
*/
|
*/
|
||||||
setScope: function PQB_setScope(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 = [];
|
||||||
|
|
@ -987,7 +987,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 VM__clean(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) {
|
||||||
|
|
@ -1035,7 +1035,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 VM_fillWithColumns(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);
|
||||||
|
|
||||||
|
|
@ -1086,7 +1086,7 @@ var ViewMenu = {
|
||||||
/**
|
/**
|
||||||
* Set up the content of the view menu.
|
* Set up the content of the view menu.
|
||||||
*/
|
*/
|
||||||
populateSortMenu: function VM_populateSortMenu(event) {
|
populateSortMenu: function(event) {
|
||||||
this.fillWithColumns(event, "viewUnsorted", "directionSeparator", "radio", "view.sortBy.1.");
|
this.fillWithColumns(event, "viewUnsorted", "directionSeparator", "radio", "view.sortBy.1.");
|
||||||
|
|
||||||
var sortColumn = this._getSortColumn();
|
var sortColumn = this._getSortColumn();
|
||||||
|
|
@ -1117,7 +1117,7 @@ var ViewMenu = {
|
||||||
* @param element
|
* @param element
|
||||||
* The menuitem element for the column
|
* The menuitem element for the column
|
||||||
*/
|
*/
|
||||||
showHideColumn: function VM_showHideColumn(element) {
|
showHideColumn: function(element) {
|
||||||
var column = element.column;
|
var column = element.column;
|
||||||
|
|
||||||
var splitter = column.nextSibling;
|
var splitter = column.nextSibling;
|
||||||
|
|
@ -1140,7 +1140,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 VM__getSortColumn() {
|
_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) {
|
||||||
|
|
@ -1163,7 +1163,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 VM_setSortColumn(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;
|
||||||
|
|
@ -1222,7 +1222,7 @@ var ViewMenu = {
|
||||||
var ContentArea = {
|
var ContentArea = {
|
||||||
_specialViews: new Map(),
|
_specialViews: new Map(),
|
||||||
|
|
||||||
init: function CA_init() {
|
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();
|
||||||
|
|
@ -1313,7 +1313,7 @@ var ContentArea = {
|
||||||
/**
|
/**
|
||||||
* Applies view options.
|
* Applies view options.
|
||||||
*/
|
*/
|
||||||
_setupView: function CA__setupView() {
|
_setupView: function() {
|
||||||
let options = this.currentViewOptions;
|
let options = this.currentViewOptions;
|
||||||
|
|
||||||
// showDetailsPane.
|
// showDetailsPane.
|
||||||
|
|
@ -1357,7 +1357,7 @@ var ContentArea = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var ContentTree = {
|
var ContentTree = {
|
||||||
init: function CT_init() {
|
init: function() {
|
||||||
this._view = document.getElementById("placeContent");
|
this._view = document.getElementById("placeContent");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1372,12 +1372,12 @@ var ContentTree = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
openSelectedNode: function CT_openSelectedNode(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 CT_onClick(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;
|
||||||
|
|
@ -1395,7 +1395,7 @@ var ContentTree = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyPress: function CT_onKeyPress(aEvent) {
|
onKeyPress: function(aEvent) {
|
||||||
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
||||||
this.openSelectedNode(aEvent);
|
this.openSelectedNode(aEvent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||||
|
|
||||||
var SidebarUtils = {
|
var SidebarUtils = {
|
||||||
handleTreeClick: function SU_handleTreeClick(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;
|
||||||
|
|
@ -59,7 +59,7 @@ var SidebarUtils = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleTreeKeyPress: function SU_handleTreeKeyPress(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;
|
||||||
|
|
@ -73,7 +73,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 SU_handleTreeMouseMove(aEvent) {
|
handleTreeMouseMove: function(aEvent) {
|
||||||
if (aEvent.target.localName != "treechildren")
|
if (aEvent.target.localName != "treechildren")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ var SidebarUtils = {
|
||||||
this.setMouseoverURL("");
|
this.setMouseoverURL("");
|
||||||
},
|
},
|
||||||
|
|
||||||
setMouseoverURL: function SU_setMouseoverURL(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.
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,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 PTV__finishInit() {
|
_finishInit: function() {
|
||||||
let selection = this.selection;
|
let selection = this.selection;
|
||||||
if (selection)
|
if (selection)
|
||||||
selection.selectEventsSuppressed = true;
|
selection.selectEventsSuppressed = true;
|
||||||
|
|
@ -89,7 +89,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 PTV__isPlainContainer(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;
|
||||||
|
|
@ -204,7 +204,7 @@ PlacesTreeView.prototype = {
|
||||||
* Row number.
|
* Row number.
|
||||||
* @return [parentNode, parentRow]
|
* @return [parentNode, parentRow]
|
||||||
*/
|
*/
|
||||||
_getParentByChildRow: function PTV__getParentByChildRow(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;
|
||||||
|
|
||||||
|
|
@ -219,7 +219,7 @@ PlacesTreeView.prototype = {
|
||||||
/**
|
/**
|
||||||
* Gets the node at a given row.
|
* Gets the node at a given row.
|
||||||
*/
|
*/
|
||||||
_getNodeForRow: function PTV__getNodeForRow(aRow) {
|
_getNodeForRow: function(aRow) {
|
||||||
if (aRow < 0) {
|
if (aRow < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -481,7 +481,7 @@ PlacesTreeView.prototype = {
|
||||||
this._tree.ensureRowIsVisible(scrollToRow);
|
this._tree.ensureRowIsVisible(scrollToRow);
|
||||||
},
|
},
|
||||||
|
|
||||||
_convertPRTimeToString: function PTV__convertPRTimeToString(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
|
||||||
|
|
@ -537,7 +537,7 @@ PlacesTreeView.prototype = {
|
||||||
COLUMN_TYPE_LASTMODIFIED: 7,
|
COLUMN_TYPE_LASTMODIFIED: 7,
|
||||||
COLUMN_TYPE_TAGS: 8,
|
COLUMN_TYPE_TAGS: 8,
|
||||||
|
|
||||||
_getColumnType: function PTV__getColumnType(aColumn) {
|
_getColumnType: function(aColumn) {
|
||||||
let columnType = aColumn.element.getAttribute("anonid") || aColumn.id;
|
let columnType = aColumn.element.getAttribute("anonid") || aColumn.id;
|
||||||
|
|
||||||
switch (columnType) {
|
switch (columnType) {
|
||||||
|
|
@ -561,7 +561,7 @@ PlacesTreeView.prototype = {
|
||||||
return this.COLUMN_TYPE_UNKNOWN;
|
return this.COLUMN_TYPE_UNKNOWN;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sortTypeToColumnType: function PTV__sortTypeToColumnType(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];
|
||||||
|
|
@ -603,7 +603,7 @@ PlacesTreeView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsINavHistoryResultObserver
|
// nsINavHistoryResultObserver
|
||||||
nodeInserted: function PTV_nodeInserted(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;
|
||||||
|
|
@ -677,7 +677,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 PTV_nodeRemoved(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;
|
||||||
|
|
@ -776,7 +776,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_invalidateCellValue: function PTV__invalidateCellValue(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)
|
||||||
|
|
@ -803,7 +803,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateLivemarkContainer: function PTV__populateLivemarkContainer(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;
|
||||||
|
|
@ -819,20 +819,20 @@ PlacesTreeView.prototype = {
|
||||||
}, Components.utils.reportError);
|
}, Components.utils.reportError);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTitleChanged: function PTV_nodeTitleChanged(aNode, aNewTitle) {
|
nodeTitleChanged: function(aNode, aNewTitle) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeURIChanged: function PTV_nodeURIChanged(aNode, aNewURI) {
|
nodeURIChanged: function(aNode, aNewURI) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_URI);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_URI);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeIconChanged: function PTV_nodeIconChanged(aNode) {
|
nodeIconChanged: function(aNode) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeHistoryDetailsChanged:
|
nodeHistoryDetailsChanged:
|
||||||
function PTV_nodeHistoryDetailsChanged(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.
|
||||||
|
|
@ -852,13 +852,13 @@ PlacesTreeView.prototype = {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_VISITCOUNT);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_VISITCOUNT);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeTagsChanged: function PTV_nodeTagsChanged(aNode) {
|
nodeTagsChanged: function(aNode) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeKeywordChanged(aNode, aNewKeyword) {},
|
nodeKeywordChanged(aNode, aNewKeyword) {},
|
||||||
|
|
||||||
nodeAnnotationChanged: function PTV_nodeAnnotationChanged(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);
|
||||||
}
|
}
|
||||||
|
|
@ -874,17 +874,17 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeDateAddedChanged: function PTV_nodeDateAddedChanged(aNode, aNewValue) {
|
nodeDateAddedChanged: function(aNode, aNewValue) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeLastModifiedChanged:
|
nodeLastModifiedChanged:
|
||||||
function PTV_nodeLastModifiedChanged(aNode, aNewValue) {
|
function(aNode, aNewValue) {
|
||||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
|
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
|
||||||
},
|
},
|
||||||
|
|
||||||
containerStateChanged:
|
containerStateChanged:
|
||||||
function PTV_containerStateChanged(aNode, aOldState, aNewState) {
|
function(aNode, aOldState, aNewState) {
|
||||||
this.invalidateContainer(aNode);
|
this.invalidateContainer(aNode);
|
||||||
|
|
||||||
if (PlacesUtils.nodeIsFolder(aNode) ||
|
if (PlacesUtils.nodeIsFolder(aNode) ||
|
||||||
|
|
@ -915,7 +915,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidateContainer: function PTV_invalidateContainer(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;
|
||||||
|
|
@ -1021,7 +1021,7 @@ PlacesTreeView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_columns: [],
|
_columns: [],
|
||||||
_findColumnByType: function PTV__findColumnByType(aColumnType) {
|
_findColumnByType: function(aColumnType) {
|
||||||
if (this._columns[aColumnType])
|
if (this._columns[aColumnType])
|
||||||
return this._columns[aColumnType];
|
return this._columns[aColumnType];
|
||||||
|
|
||||||
|
|
@ -1040,7 +1040,7 @@ PlacesTreeView.prototype = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
sortingChanged: function PTV__sortingChanged(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 PTV__batching(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) {
|
||||||
|
|
@ -1109,14 +1109,14 @@ PlacesTreeView.prototype = {
|
||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeForTreeIndex: function PTV_nodeForTreeIndex(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 PTV_treeNodeForIndex(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);
|
||||||
|
|
@ -1140,7 +1140,7 @@ PlacesTreeView.prototype = {
|
||||||
getRowProperties: function() { return ""; },
|
getRowProperties: function() { return ""; },
|
||||||
|
|
||||||
getCellProperties:
|
getCellProperties:
|
||||||
function PTV_getCellProperties(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");
|
||||||
|
|
@ -1221,7 +1221,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
getColumnProperties: function(aColumn) { return ""; },
|
getColumnProperties: function(aColumn) { return ""; },
|
||||||
|
|
||||||
isContainer: function PTV_isContainer(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)
|
||||||
|
|
@ -1246,7 +1246,7 @@ PlacesTreeView.prototype = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
isContainerOpen: function PTV_isContainerOpen(aRow) {
|
isContainerOpen: function(aRow) {
|
||||||
if (this._flatList)
|
if (this._flatList)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -1254,7 +1254,7 @@ PlacesTreeView.prototype = {
|
||||||
return this._rows[aRow].containerOpen;
|
return this._rows[aRow].containerOpen;
|
||||||
},
|
},
|
||||||
|
|
||||||
isContainerEmpty: function PTV_isContainerEmpty(aRow) {
|
isContainerEmpty: function(aRow) {
|
||||||
if (this._flatList)
|
if (this._flatList)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -1268,18 +1268,18 @@ PlacesTreeView.prototype = {
|
||||||
return !node.hasChildren;
|
return !node.hasChildren;
|
||||||
},
|
},
|
||||||
|
|
||||||
isSeparator: function PTV_isSeparator(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 PTV_isSorted() {
|
isSorted: function() {
|
||||||
return this._result.sortingMode !=
|
return this._result.sortingMode !=
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||||
},
|
},
|
||||||
|
|
||||||
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) {
|
canDrop: function(aRow, aOrientation, aDataTransfer) {
|
||||||
if (!this._result)
|
if (!this._result)
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
throw Cr.NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
|
@ -1291,7 +1291,7 @@ PlacesTreeView.prototype = {
|
||||||
return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer);
|
return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getInsertionPoint: function PTV__getInsertionPoint(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
|
||||||
|
|
@ -1370,7 +1370,7 @@ PlacesTreeView.prototype = {
|
||||||
dropNearItemId);
|
dropNearItemId);
|
||||||
},
|
},
|
||||||
|
|
||||||
drop: function PTV_drop(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.
|
||||||
|
|
@ -1383,12 +1383,12 @@ PlacesTreeView.prototype = {
|
||||||
PlacesControllerDragHelper.currentDropTarget = null;
|
PlacesControllerDragHelper.currentDropTarget = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getParentIndex: function PTV_getParentIndex(aRow) {
|
getParentIndex: function(aRow) {
|
||||||
let [, parentRow] = this._getParentByChildRow(aRow);
|
let [, parentRow] = this._getParentByChildRow(aRow);
|
||||||
return parentRow;
|
return parentRow;
|
||||||
},
|
},
|
||||||
|
|
||||||
hasNextSibling: function PTV_hasNextSibling(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;
|
||||||
|
|
@ -1420,7 +1420,7 @@ PlacesTreeView.prototype = {
|
||||||
return this._getNodeForRow(aRow).indentLevel;
|
return this._getNodeForRow(aRow).indentLevel;
|
||||||
},
|
},
|
||||||
|
|
||||||
getImageSrc: function PTV_getImageSrc(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 "";
|
||||||
|
|
@ -1432,7 +1432,7 @@ PlacesTreeView.prototype = {
|
||||||
getProgressMode: function(aRow, aColumn) { },
|
getProgressMode: function(aRow, aColumn) { },
|
||||||
getCellValue: function(aRow, aColumn) { },
|
getCellValue: function(aRow, aColumn) { },
|
||||||
|
|
||||||
getCellText: function PTV_getCellText(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:
|
||||||
|
|
@ -1484,7 +1484,7 @@ PlacesTreeView.prototype = {
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
setTree: function PTV_setTree(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.
|
||||||
|
|
@ -1507,7 +1507,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleOpenState: function PTV_toggleOpenState(aRow) {
|
toggleOpenState: function(aRow) {
|
||||||
if (!this._result)
|
if (!this._result)
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
throw Cr.NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
|
@ -1535,7 +1535,7 @@ PlacesTreeView.prototype = {
|
||||||
node.containerOpen = !node.containerOpen;
|
node.containerOpen = !node.containerOpen;
|
||||||
},
|
},
|
||||||
|
|
||||||
cycleHeader: function PTV_cycleHeader(aColumn) {
|
cycleHeader: function(aColumn) {
|
||||||
if (!this._result)
|
if (!this._result)
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
throw Cr.NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
|
@ -1650,7 +1650,7 @@ PlacesTreeView.prototype = {
|
||||||
this._result.sortingMode = newSort;
|
this._result.sortingMode = newSort;
|
||||||
},
|
},
|
||||||
|
|
||||||
isEditable: function PTV_isEditable(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;
|
||||||
|
|
@ -1693,7 +1693,7 @@ PlacesTreeView.prototype = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
setCellText: function PTV_setCellText(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) {
|
||||||
|
|
@ -1707,7 +1707,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCutNode: function PTV_toggleCutNode(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)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ var Ci = Components.interfaces;
|
||||||
var gAppManagerDialog = {
|
var gAppManagerDialog = {
|
||||||
_removed: [],
|
_removed: [],
|
||||||
|
|
||||||
init: function appManager_init() {
|
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 appManager_onOK() {
|
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 appManager_onCancel() {
|
onCancel: function() {
|
||||||
// do nothing
|
// do nothing
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function appManager_remove() {
|
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 appManager_onSelect() {
|
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;
|
||||||
|
|
|
||||||
|
|
@ -597,7 +597,7 @@ var gCookiesWindow = {
|
||||||
removeSelectedCookies.disabled = !hasRows || !hasSelection;
|
removeSelectedCookies.disabled = !hasRows || !hasSelection;
|
||||||
},
|
},
|
||||||
|
|
||||||
performDeletion: function gCookiesWindow_performDeletion(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;
|
||||||
|
|
@ -902,7 +902,7 @@ var gCookiesWindow = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateRemoveAllButton: function gCookiesWindow__updateRemoveAllButton() {
|
_updateRemoveAllButton: function() {
|
||||||
let removeAllCookies = document.getElementById("removeAllCookies");
|
let removeAllCookies = document.getElementById("removeAllCookies");
|
||||||
removeAllCookies.disabled = this._view._rowCount == 0;
|
removeAllCookies.disabled = this._view._rowCount == 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ var gPrivacyPane = {
|
||||||
/**
|
/**
|
||||||
* Initialize the history mode menulist based on the privacy preferences
|
* Initialize the history mode menulist based on the privacy preferences
|
||||||
*/
|
*/
|
||||||
initializeHistoryMode: function PPP_initializeHistoryMode()
|
initializeHistoryMode: function()
|
||||||
{
|
{
|
||||||
let mode;
|
let mode;
|
||||||
let getVal = aPref => document.getElementById(aPref).value;
|
let getVal = aPref => document.getElementById(aPref).value;
|
||||||
|
|
@ -312,7 +312,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 PPP_updateHistoryModePane()
|
updateHistoryModePane: function()
|
||||||
{
|
{
|
||||||
let selectedIndex = -1;
|
let selectedIndex = -1;
|
||||||
switch (document.getElementById("historyMode").value) {
|
switch (document.getElementById("historyMode").value) {
|
||||||
|
|
@ -333,7 +333,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 PPP_updateHistoryModePrefs()
|
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) {
|
||||||
|
|
@ -368,7 +368,7 @@ 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 PPP_updatePrivacyMicroControls()
|
updatePrivacyMicroControls: function()
|
||||||
{
|
{
|
||||||
if (document.getElementById("historyMode").value == "custom") {
|
if (document.getElementById("historyMode").value == "custom") {
|
||||||
let disabled = this._autoStartPrivateBrowsing =
|
let disabled = this._autoStartPrivateBrowsing =
|
||||||
|
|
@ -420,7 +420,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 PPP_initAutoStartPrivateBrowsingReverter()
|
initAutoStartPrivateBrowsingReverter: function()
|
||||||
{
|
{
|
||||||
let mode = document.getElementById("historyMode");
|
let mode = document.getElementById("historyMode");
|
||||||
let autoStart = document.getElementById("privateBrowsingAutoStart");
|
let autoStart = document.getElementById("privateBrowsingAutoStart");
|
||||||
|
|
@ -430,7 +430,7 @@ var gPrivacyPane = {
|
||||||
|
|
||||||
_lastMode: null,
|
_lastMode: null,
|
||||||
_lastCheckState: null,
|
_lastCheckState: null,
|
||||||
updateAutostart: function PPP_updateAutostart() {
|
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");
|
||||||
|
|
|
||||||
|
|
@ -345,15 +345,15 @@ EngineStore.prototype = {
|
||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getIndexForEngine: function ES_getIndexForEngine(aEngine) {
|
_getIndexForEngine: function(aEngine) {
|
||||||
return this._engines.indexOf(aEngine);
|
return this._engines.indexOf(aEngine);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getEngineByName: function ES_getEngineByName(aName) {
|
_getEngineByName: function(aName) {
|
||||||
return this._engines.find(engine => engine.name == aName);
|
return this._engines.find(engine => engine.name == aName);
|
||||||
},
|
},
|
||||||
|
|
||||||
_cloneEngine: function ES_cloneEngine(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];
|
||||||
|
|
@ -363,15 +363,15 @@ 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 ES_isSameEngine(aEngineClone) {
|
_isSameEngine: function(aEngineClone) {
|
||||||
return aEngineClone.originalEngine == this.originalEngine;
|
return aEngineClone.originalEngine == this.originalEngine;
|
||||||
},
|
},
|
||||||
|
|
||||||
addEngine: function ES_addEngine(aEngine) {
|
addEngine: function(aEngine) {
|
||||||
this._engines.push(this._cloneEngine(aEngine));
|
this._engines.push(this._cloneEngine(aEngine));
|
||||||
},
|
},
|
||||||
|
|
||||||
moveEngine: function ES_moveEngine(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);
|
||||||
|
|
@ -388,7 +388,7 @@ EngineStore.prototype = {
|
||||||
Services.search.moveEngine(aEngine.originalEngine, aNewIndex);
|
Services.search.moveEngine(aEngine.originalEngine, aNewIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEngine: function ES_removeEngine(aEngine) {
|
removeEngine: function(aEngine) {
|
||||||
if (this._engines.length == 1) {
|
if (this._engines.length == 1) {
|
||||||
throw new Error("Cannot remove last engine!");
|
throw new Error("Cannot remove last engine!");
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +407,7 @@ EngineStore.prototype = {
|
||||||
return index;
|
return index;
|
||||||
},
|
},
|
||||||
|
|
||||||
restoreDefaultEngines: function ES_restoreDefaultEngines() {
|
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) {
|
||||||
|
|
@ -436,7 +436,7 @@ EngineStore.prototype = {
|
||||||
return added;
|
return added;
|
||||||
},
|
},
|
||||||
|
|
||||||
changeEngine: function ES_changeEngine(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?");
|
||||||
|
|
@ -445,7 +445,7 @@ EngineStore.prototype = {
|
||||||
aEngine.originalEngine[aProp] = aNewValue;
|
aEngine.originalEngine[aProp] = aNewValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
reloadIcons: function ES_reloadIcons() {
|
reloadIcons: function() {
|
||||||
this._engines.forEach(function (e) {
|
this._engines.forEach(function (e) {
|
||||||
e.uri = e.originalEngine.uri;
|
e.uri = e.originalEngine.uri;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* closes.
|
* closes.
|
||||||
*/
|
*/
|
||||||
var SelectBookmarkDialog = {
|
var SelectBookmarkDialog = {
|
||||||
init: function SBD_init() {
|
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 SBD_selectionChanged() {
|
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 SBD_onItemDblClick() {
|
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 SBD_accept() {
|
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!");
|
||||||
|
|
|
||||||
|
|
@ -321,13 +321,13 @@ loadListener.prototype = {
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// nsIRequestObserver
|
// nsIRequestObserver
|
||||||
onStartRequest: function SRCH_loadStartR(aRequest, aContext) {
|
onStartRequest: function(aRequest, aContext) {
|
||||||
LOG("loadListener: Starting request: " + aRequest.name);
|
LOG("loadListener: Starting request: " + aRequest.name);
|
||||||
this._stream = Cc["@mozilla.org/binaryinputstream;1"].
|
this._stream = Cc["@mozilla.org/binaryinputstream;1"].
|
||||||
createInstance(Ci.nsIBinaryInputStream);
|
createInstance(Ci.nsIBinaryInputStream);
|
||||||
},
|
},
|
||||||
|
|
||||||
onStopRequest: function SRCH_loadStopR(aRequest, aContext, aStatusCode) {
|
onStopRequest: function(aRequest, aContext, aStatusCode) {
|
||||||
LOG("loadListener: Stopping request: " + aRequest.name);
|
LOG("loadListener: Stopping request: " + aRequest.name);
|
||||||
|
|
||||||
var requestFailed = !Components.isSuccessCode(aStatusCode);
|
var requestFailed = !Components.isSuccessCode(aStatusCode);
|
||||||
|
|
@ -345,7 +345,7 @@ loadListener.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIStreamListener
|
// nsIStreamListener
|
||||||
onDataAvailable: function SRCH_loadDAvailable(aRequest, aContext,
|
onDataAvailable: function(aRequest, aContext,
|
||||||
aInputStream, aOffset,
|
aInputStream, aOffset,
|
||||||
aCount) {
|
aCount) {
|
||||||
this._stream.setInputStream(aInputStream);
|
this._stream.setInputStream(aInputStream);
|
||||||
|
|
@ -356,14 +356,14 @@ loadListener.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIChannelEventSink
|
// nsIChannelEventSink
|
||||||
asyncOnChannelRedirect: function SRCH_loadCRedirect(aOldChannel, aNewChannel,
|
asyncOnChannelRedirect: function(aOldChannel, aNewChannel,
|
||||||
aFlags, callback) {
|
aFlags, callback) {
|
||||||
this._channel = aNewChannel;
|
this._channel = aNewChannel;
|
||||||
callback.onRedirectVerifyCallback(Components.results.NS_OK);
|
callback.onRedirectVerifyCallback(Components.results.NS_OK);
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIInterfaceRequestor
|
// nsIInterfaceRequestor
|
||||||
getInterface: function SRCH_load_GI(aIID) {
|
getInterface: function(aIID) {
|
||||||
return this.QueryInterface(aIID);
|
return this.QueryInterface(aIID);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -688,18 +688,18 @@ function EngineURL(aType, aMethod, aTemplate, aResultDomain) {
|
||||||
}
|
}
|
||||||
EngineURL.prototype = {
|
EngineURL.prototype = {
|
||||||
|
|
||||||
addParam: function SRCH_EURL_addParam(aName, aValue, aPurpose) {
|
addParam: function(aName, aValue, aPurpose) {
|
||||||
this.params.push(new QueryParameter(aName, aValue, aPurpose));
|
this.params.push(new QueryParameter(aName, aValue, aPurpose));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Note: This method requires that aObj has a unique name or the previous MozParams entry with
|
// Note: This method requires that aObj has a unique name or the previous MozParams entry with
|
||||||
// that name will be overwritten.
|
// that name will be overwritten.
|
||||||
_addMozParam: function SRCH_EURL__addMozParam(aObj) {
|
_addMozParam: function(aObj) {
|
||||||
aObj.mozparam = true;
|
aObj.mozparam = true;
|
||||||
this.mozparams[aObj.name] = aObj;
|
this.mozparams[aObj.name] = aObj;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSubmission: function SRCH_EURL_getSubmission(aSearchTerms, aEngine, aPurpose) {
|
getSubmission: function(aSearchTerms, aEngine, aPurpose) {
|
||||||
var url = ParamSubstitution(this.template, aSearchTerms, aEngine);
|
var url = ParamSubstitution(this.template, aSearchTerms, aEngine);
|
||||||
// Default to searchbar if the purpose is not provided
|
// Default to searchbar if the purpose is not provided
|
||||||
var purpose = aPurpose || "searchbar";
|
var purpose = aPurpose || "searchbar";
|
||||||
|
|
@ -747,16 +747,16 @@ EngineURL.prototype = {
|
||||||
return new Submission(makeURI(url), postData);
|
return new Submission(makeURI(url), postData);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getTermsParameterName: function SRCH_EURL__getTermsParameterName() {
|
_getTermsParameterName: function() {
|
||||||
let queryParam = this.params.find(p => p.value == USER_DEFINED);
|
let queryParam = this.params.find(p => p.value == USER_DEFINED);
|
||||||
return queryParam ? queryParam.name : "";
|
return queryParam ? queryParam.name : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasRelation: function SRC_EURL__hasRelation(aRel) {
|
_hasRelation: function(aRel) {
|
||||||
return this.rels.some(e => e == aRel.toLowerCase());
|
return this.rels.some(e => e == aRel.toLowerCase());
|
||||||
},
|
},
|
||||||
|
|
||||||
_initWithJSON: function SRC_EURL__initWithJSON(aJson, aEngine) {
|
_initWithJSON: function(aJson, aEngine) {
|
||||||
if (!aJson.params)
|
if (!aJson.params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -780,7 +780,7 @@ EngineURL.prototype = {
|
||||||
* Creates a JavaScript object that represents this URL.
|
* Creates a JavaScript object that represents this URL.
|
||||||
* @returns An object suitable for serialization as JSON.
|
* @returns An object suitable for serialization as JSON.
|
||||||
**/
|
**/
|
||||||
toJSON: function SRCH_EURL_toJSON() {
|
toJSON: function() {
|
||||||
var json = {
|
var json = {
|
||||||
template: this.template,
|
template: this.template,
|
||||||
rels: this.rels,
|
rels: this.rels,
|
||||||
|
|
@ -947,7 +947,7 @@ Engine.prototype = {
|
||||||
* Retrieves the data from the engine's file.
|
* Retrieves the data from the engine's file.
|
||||||
* The document element is placed in the engine's data field.
|
* The document element is placed in the engine's data field.
|
||||||
*/
|
*/
|
||||||
_initFromFile: function SRCH_ENG_initFromFile(file) {
|
_initFromFile: function(file) {
|
||||||
if (!file || !file.exists())
|
if (!file || !file.exists())
|
||||||
FAIL("File must exist before calling initFromFile!", Cr.NS_ERROR_UNEXPECTED);
|
FAIL("File must exist before calling initFromFile!", Cr.NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
|
@ -995,7 +995,7 @@ Engine.prototype = {
|
||||||
*
|
*
|
||||||
* @param uri The uri to load the search plugin from.
|
* @param uri The uri to load the search plugin from.
|
||||||
*/
|
*/
|
||||||
_initFromURIAndLoad: function SRCH_ENG_initFromURIAndLoad(uri) {
|
_initFromURIAndLoad: function(uri) {
|
||||||
ENSURE_WARN(uri instanceof Ci.nsIURI,
|
ENSURE_WARN(uri instanceof Ci.nsIURI,
|
||||||
"Must have URI when calling _initFromURIAndLoad!",
|
"Must have URI when calling _initFromURIAndLoad!",
|
||||||
Cr.NS_ERROR_UNEXPECTED);
|
Cr.NS_ERROR_UNEXPECTED);
|
||||||
|
|
@ -1039,7 +1039,7 @@ Engine.prototype = {
|
||||||
* @returns {Promise} A promise, resolved successfully if retrieveing data
|
* @returns {Promise} A promise, resolved successfully if retrieveing data
|
||||||
* succeeds.
|
* succeeds.
|
||||||
*/
|
*/
|
||||||
_retrieveSearchXMLData: function SRCH_ENG__retrieveSearchXMLData(aURL) {
|
_retrieveSearchXMLData: function(aURL) {
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
||||||
createInstance(Ci.nsIXMLHttpRequest);
|
createInstance(Ci.nsIXMLHttpRequest);
|
||||||
|
|
@ -1058,7 +1058,7 @@ Engine.prototype = {
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initFromURISync: function SRCH_ENG_initFromURISync(uri) {
|
_initFromURISync: function(uri) {
|
||||||
ENSURE_WARN(uri instanceof Ci.nsIURI,
|
ENSURE_WARN(uri instanceof Ci.nsIURI,
|
||||||
"Must have URI when calling _initFromURISync!",
|
"Must have URI when calling _initFromURISync!",
|
||||||
Cr.NS_ERROR_UNEXPECTED);
|
Cr.NS_ERROR_UNEXPECTED);
|
||||||
|
|
@ -1094,7 +1094,7 @@ Engine.prototype = {
|
||||||
* @param aType string to match the EngineURL's type attribute
|
* @param aType string to match the EngineURL's type attribute
|
||||||
* @param aRel [optional] only return URLs that with this rel value
|
* @param aRel [optional] only return URLs that with this rel value
|
||||||
*/
|
*/
|
||||||
_getURLOfType: function SRCH_ENG__getURLOfType(aType, aRel) {
|
_getURLOfType: function(aType, aRel) {
|
||||||
for (var i = 0; i < this._urls.length; ++i) {
|
for (var i = 0; i < this._urls.length; ++i) {
|
||||||
if (this._urls[i].type == aType && (!aRel || this._urls[i]._hasRelation(aRel)))
|
if (this._urls[i].type == aType && (!aRel || this._urls[i]._hasRelation(aRel)))
|
||||||
return this._urls[i];
|
return this._urls[i];
|
||||||
|
|
@ -1103,7 +1103,7 @@ Engine.prototype = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_confirmAddEngine: function SRCH_SVC_confirmAddEngine() {
|
_confirmAddEngine: function() {
|
||||||
var stringBundle = Services.strings.createBundle(SEARCH_BUNDLE);
|
var stringBundle = Services.strings.createBundle(SEARCH_BUNDLE);
|
||||||
var titleMessage = stringBundle.GetStringFromName("addEngineConfirmTitle");
|
var titleMessage = stringBundle.GetStringFromName("addEngineConfirmTitle");
|
||||||
|
|
||||||
|
|
@ -1143,7 +1143,7 @@ Engine.prototype = {
|
||||||
* triggers parsing of the data. The engine is then flushed to disk. Notifies
|
* triggers parsing of the data. The engine is then flushed to disk. Notifies
|
||||||
* the search service once initialization is complete.
|
* the search service once initialization is complete.
|
||||||
*/
|
*/
|
||||||
_onLoad: function SRCH_ENG_onLoad(aBytes, aEngine) {
|
_onLoad: function(aBytes, aEngine) {
|
||||||
/**
|
/**
|
||||||
* Handle an error during the load of an engine by notifying the engine's
|
* Handle an error during the load of an engine by notifying the engine's
|
||||||
* error callback, if any.
|
* error callback, if any.
|
||||||
|
|
@ -1271,7 +1271,7 @@ Engine.prototype = {
|
||||||
* Height of the icon.
|
* Height of the icon.
|
||||||
* @returns key string
|
* @returns key string
|
||||||
*/
|
*/
|
||||||
_getIconKey: function SRCH_ENG_getIconKey(aWidth, aHeight) {
|
_getIconKey: function(aWidth, aHeight) {
|
||||||
let keyObj = {
|
let keyObj = {
|
||||||
width: aWidth,
|
width: aWidth,
|
||||||
height: aHeight
|
height: aHeight
|
||||||
|
|
@ -1290,7 +1290,7 @@ Engine.prototype = {
|
||||||
* @param aURISpec
|
* @param aURISpec
|
||||||
* String with the icon's URI.
|
* String with the icon's URI.
|
||||||
*/
|
*/
|
||||||
_addIconToMap: function SRCH_ENG_addIconToMap(aWidth, aHeight, aURISpec) {
|
_addIconToMap: function(aWidth, aHeight, aURISpec) {
|
||||||
if (aWidth == 16 && aHeight == 16) {
|
if (aWidth == 16 && aHeight == 16) {
|
||||||
// The 16x16 icon is stored in _iconURL, we don't need to store it twice.
|
// The 16x16 icon is stored in _iconURL, we don't need to store it twice.
|
||||||
return;
|
return;
|
||||||
|
|
@ -1320,7 +1320,7 @@ Engine.prototype = {
|
||||||
* @param aHeight (optional)
|
* @param aHeight (optional)
|
||||||
* Height of the icon.
|
* Height of the icon.
|
||||||
*/
|
*/
|
||||||
_setIcon: function SRCH_ENG_setIcon(aIconURL, aIsPreferred, aWidth, aHeight) {
|
_setIcon: function(aIconURL, aIsPreferred, aWidth, aHeight) {
|
||||||
var uri = makeURI(aIconURL);
|
var uri = makeURI(aIconURL);
|
||||||
|
|
||||||
// Ignore bad URIs
|
// Ignore bad URIs
|
||||||
|
|
@ -1401,7 +1401,7 @@ Engine.prototype = {
|
||||||
/**
|
/**
|
||||||
* Initialize this Engine object from the collected data.
|
* Initialize this Engine object from the collected data.
|
||||||
*/
|
*/
|
||||||
_initFromData: function SRCH_ENG_initFromData() {
|
_initFromData: function() {
|
||||||
ENSURE_WARN(this._data, "Can't init an engine with no data!",
|
ENSURE_WARN(this._data, "Can't init an engine with no data!",
|
||||||
Cr.NS_ERROR_UNEXPECTED);
|
Cr.NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
|
@ -1426,7 +1426,7 @@ Engine.prototype = {
|
||||||
/**
|
/**
|
||||||
* Initialize this Engine object from a collection of metadata.
|
* Initialize this Engine object from a collection of metadata.
|
||||||
*/
|
*/
|
||||||
_initFromMetadata: function SRCH_ENG_initMetaData(aName, aIconURL, aAlias,
|
_initFromMetadata: function(aName, aIconURL, aAlias,
|
||||||
aDescription, aMethod,
|
aDescription, aMethod,
|
||||||
aTemplate, aExtensionID) {
|
aTemplate, aExtensionID) {
|
||||||
ENSURE_WARN(!this._readOnly,
|
ENSURE_WARN(!this._readOnly,
|
||||||
|
|
@ -1451,7 +1451,7 @@ Engine.prototype = {
|
||||||
* @see http://opensearch.a9.com/spec/1.1/querysyntax/#urltag.
|
* @see http://opensearch.a9.com/spec/1.1/querysyntax/#urltag.
|
||||||
* @see EngineURL()
|
* @see EngineURL()
|
||||||
*/
|
*/
|
||||||
_parseURL: function SRCH_ENG_parseURL(aElement) {
|
_parseURL: function(aElement) {
|
||||||
var type = aElement.getAttribute("type");
|
var type = aElement.getAttribute("type");
|
||||||
// According to the spec, method is optional, defaulting to "GET" if not
|
// According to the spec, method is optional, defaulting to "GET" if not
|
||||||
// specified
|
// specified
|
||||||
|
|
@ -1525,7 +1525,7 @@ Engine.prototype = {
|
||||||
* Get the icon from an OpenSearch Image element.
|
* Get the icon from an OpenSearch Image element.
|
||||||
* @see http://opensearch.a9.com/spec/1.1/description/#image
|
* @see http://opensearch.a9.com/spec/1.1/description/#image
|
||||||
*/
|
*/
|
||||||
_parseImage: function SRCH_ENG_parseImage(aElement) {
|
_parseImage: function(aElement) {
|
||||||
LOG("_parseImage: Image textContent: \"" + limitURILength(aElement.textContent) + "\"");
|
LOG("_parseImage: Image textContent: \"" + limitURILength(aElement.textContent) + "\"");
|
||||||
|
|
||||||
let width = parseInt(aElement.getAttribute("width"), 10);
|
let width = parseInt(aElement.getAttribute("width"), 10);
|
||||||
|
|
@ -1544,7 +1544,7 @@ Engine.prototype = {
|
||||||
* Extract search engine information from the collected data to initialize
|
* Extract search engine information from the collected data to initialize
|
||||||
* the engine object.
|
* the engine object.
|
||||||
*/
|
*/
|
||||||
_parse: function SRCH_ENG_parse() {
|
_parse: function() {
|
||||||
var doc = this._data;
|
var doc = this._data;
|
||||||
|
|
||||||
// The OpenSearch spec sets a default value for the input encoding.
|
// The OpenSearch spec sets a default value for the input encoding.
|
||||||
|
|
@ -1601,7 +1601,7 @@ Engine.prototype = {
|
||||||
/**
|
/**
|
||||||
* Init from a JSON record.
|
* Init from a JSON record.
|
||||||
**/
|
**/
|
||||||
_initWithJSON: function SRCH_ENG__initWithJSON(aJson) {
|
_initWithJSON: function(aJson) {
|
||||||
this._name = aJson._name;
|
this._name = aJson._name;
|
||||||
this._shortName = aJson._shortName;
|
this._shortName = aJson._shortName;
|
||||||
this._loadPath = aJson._loadPath;
|
this._loadPath = aJson._loadPath;
|
||||||
|
|
@ -1640,7 +1640,7 @@ Engine.prototype = {
|
||||||
* Creates a JavaScript object that represents this engine.
|
* Creates a JavaScript object that represents this engine.
|
||||||
* @returns An object suitable for serialization as JSON.
|
* @returns An object suitable for serialization as JSON.
|
||||||
**/
|
**/
|
||||||
toJSON: function SRCH_ENG_toJSON() {
|
toJSON: function() {
|
||||||
var json = {
|
var json = {
|
||||||
_name: this._name,
|
_name: this._name,
|
||||||
_shortName: this._shortName,
|
_shortName: this._shortName,
|
||||||
|
|
@ -1933,7 +1933,7 @@ Engine.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// from nsISearchEngine
|
// from nsISearchEngine
|
||||||
addParam: function SRCH_ENG_addParam(aName, aValue, aResponseType) {
|
addParam: function(aName, aValue, aResponseType) {
|
||||||
if (!aName || (aValue == null))
|
if (!aName || (aValue == null))
|
||||||
FAIL("missing name or value for nsISearchEngine::addParam!");
|
FAIL("missing name or value for nsISearchEngine::addParam!");
|
||||||
ENSURE_WARN(!this._readOnly,
|
ENSURE_WARN(!this._readOnly,
|
||||||
|
|
@ -1983,7 +1983,7 @@ Engine.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// from nsISearchEngine
|
// from nsISearchEngine
|
||||||
getSubmission: function SRCH_ENG_getSubmission(aData, aResponseType, aPurpose) {
|
getSubmission: function(aData, aResponseType, aPurpose) {
|
||||||
if (!aResponseType) {
|
if (!aResponseType) {
|
||||||
aResponseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
|
aResponseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
|
||||||
URLTYPE_SEARCH_HTML;
|
URLTYPE_SEARCH_HTML;
|
||||||
|
|
@ -2031,12 +2031,12 @@ Engine.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// from nsISearchEngine
|
// from nsISearchEngine
|
||||||
supportsResponseType: function SRCH_ENG_supportsResponseType(type) {
|
supportsResponseType: function(type) {
|
||||||
return (this._getURLOfType(type) != null);
|
return (this._getURLOfType(type) != null);
|
||||||
},
|
},
|
||||||
|
|
||||||
// from nsISearchEngine
|
// from nsISearchEngine
|
||||||
getResultDomain: function SRCH_ENG_getResultDomain(aResponseType) {
|
getResultDomain: function(aResponseType) {
|
||||||
if (!aResponseType) {
|
if (!aResponseType) {
|
||||||
aResponseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
|
aResponseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
|
||||||
URLTYPE_SEARCH_HTML;
|
URLTYPE_SEARCH_HTML;
|
||||||
|
|
@ -2093,7 +2093,7 @@ Engine.prototype = {
|
||||||
* @param height
|
* @param height
|
||||||
* Height of the requested icon.
|
* Height of the requested icon.
|
||||||
*/
|
*/
|
||||||
getIconURLBySize: function SRCH_ENG_getIconURLBySize(aWidth, aHeight) {
|
getIconURLBySize: function(aWidth, aHeight) {
|
||||||
if (aWidth == 16 && aHeight == 16)
|
if (aWidth == 16 && aHeight == 16)
|
||||||
return this._iconURL;
|
return this._iconURL;
|
||||||
|
|
||||||
|
|
@ -2113,7 +2113,7 @@ Engine.prototype = {
|
||||||
* represent the icon's dimensions. url is a string with the URL for
|
* represent the icon's dimensions. url is a string with the URL for
|
||||||
* the icon.
|
* the icon.
|
||||||
*/
|
*/
|
||||||
getIcons: function SRCH_ENG_getIcons() {
|
getIcons: function() {
|
||||||
let result = [];
|
let result = [];
|
||||||
if (this._iconURL)
|
if (this._iconURL)
|
||||||
result.push({width: 16, height: 16, url: this._iconURL});
|
result.push({width: 16, height: 16, url: this._iconURL});
|
||||||
|
|
@ -2144,7 +2144,7 @@ Engine.prototype = {
|
||||||
* @throws NS_ERROR_INVALID_ARG if options is omitted or lacks required
|
* @throws NS_ERROR_INVALID_ARG if options is omitted or lacks required
|
||||||
* elemeents
|
* elemeents
|
||||||
*/
|
*/
|
||||||
speculativeConnect: function SRCH_ENG_speculativeConnect(options) {
|
speculativeConnect: function(options) {
|
||||||
if (!options || !options.window) {
|
if (!options || !options.window) {
|
||||||
Cu.reportError("invalid options arg passed to nsISearchEngine.speculativeConnect");
|
Cu.reportError("invalid options arg passed to nsISearchEngine.speculativeConnect");
|
||||||
throw Cr.NS_ERROR_INVALID_ARG;
|
throw Cr.NS_ERROR_INVALID_ARG;
|
||||||
|
|
@ -2262,7 +2262,7 @@ SearchService.prototype = {
|
||||||
// If initialization has not been completed yet, perform synchronous
|
// If initialization has not been completed yet, perform synchronous
|
||||||
// initialization.
|
// initialization.
|
||||||
// Throws in case of initialization error.
|
// Throws in case of initialization error.
|
||||||
_ensureInitialized: function SRCH_SVC__ensureInitialized() {
|
_ensureInitialized: function() {
|
||||||
if (gInitialized) {
|
if (gInitialized) {
|
||||||
if (!Components.isSuccessCode(this._initRV)) {
|
if (!Components.isSuccessCode(this._initRV)) {
|
||||||
LOG("_ensureInitialized: failure");
|
LOG("_ensureInitialized: failure");
|
||||||
|
|
@ -2287,7 +2287,7 @@ SearchService.prototype = {
|
||||||
// Synchronous implementation of the initializer.
|
// Synchronous implementation of the initializer.
|
||||||
// Used by |_ensureInitialized| as a fallback if initialization is not
|
// Used by |_ensureInitialized| as a fallback if initialization is not
|
||||||
// complete.
|
// complete.
|
||||||
_syncInit: function SRCH_SVC__syncInit() {
|
_syncInit: function() {
|
||||||
LOG("_syncInit start");
|
LOG("_syncInit start");
|
||||||
this._initStarted = true;
|
this._initStarted = true;
|
||||||
|
|
||||||
|
|
@ -2405,11 +2405,11 @@ SearchService.prototype = {
|
||||||
return this.getEngineByName(defaultEngine);
|
return this.getEngineByName(defaultEngine);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetToOriginalDefaultEngine: function SRCH_SVC__resetToOriginalDefaultEngine() {
|
resetToOriginalDefaultEngine: function() {
|
||||||
this.currentEngine = this.originalDefaultEngine;
|
this.currentEngine = this.originalDefaultEngine;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildCache: function SRCH_SVC__buildCache() {
|
_buildCache: function() {
|
||||||
if (this._batchTask)
|
if (this._batchTask)
|
||||||
this._batchTask.disarm();
|
this._batchTask.disarm();
|
||||||
|
|
||||||
|
|
@ -2458,7 +2458,7 @@ SearchService.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncLoadEngines: function SRCH_SVC__syncLoadEngines(cache) {
|
_syncLoadEngines: function(cache) {
|
||||||
LOG("_syncLoadEngines: start");
|
LOG("_syncLoadEngines: start");
|
||||||
// See if we have a cache file so we don't have to parse a bunch of XML.
|
// See if we have a cache file so we don't have to parse a bunch of XML.
|
||||||
let chromeURIs = this._findJAREngines();
|
let chromeURIs = this._findJAREngines();
|
||||||
|
|
@ -2732,7 +2732,7 @@ SearchService.prototype = {
|
||||||
*
|
*
|
||||||
* @returns A JS object containing the cached data.
|
* @returns A JS object containing the cached data.
|
||||||
*/
|
*/
|
||||||
_readCacheFile: function SRCH_SVC__readCacheFile() {
|
_readCacheFile: function() {
|
||||||
if (this._cacheFileJSON) {
|
if (this._cacheFileJSON) {
|
||||||
return this._cacheFileJSON;
|
return this._cacheFileJSON;
|
||||||
}
|
}
|
||||||
|
|
@ -2854,7 +2854,7 @@ SearchService.prototype = {
|
||||||
return this._batchTask;
|
return this._batchTask;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addEngineToStore: function SRCH_SVC_addEngineToStore(aEngine) {
|
_addEngineToStore: function(aEngine) {
|
||||||
LOG("_addEngineToStore: Adding engine: \"" + aEngine.name + "\"");
|
LOG("_addEngineToStore: Adding engine: \"" + aEngine.name + "\"");
|
||||||
|
|
||||||
// See if there is an existing engine with the same name. However, if this
|
// See if there is an existing engine with the same name. However, if this
|
||||||
|
|
@ -2909,7 +2909,7 @@ SearchService.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadEnginesMetadataFromCache: function SRCH_SVC__loadEnginesMetadataFromCache(cache) {
|
_loadEnginesMetadataFromCache: function(cache) {
|
||||||
if (cache._oldMetadata) {
|
if (cache._oldMetadata) {
|
||||||
// If we have old metadata in the cache, we had no valid cache
|
// If we have old metadata in the cache, we had no valid cache
|
||||||
// file and read data from search-metadata.json.
|
// file and read data from search-metadata.json.
|
||||||
|
|
@ -2933,7 +2933,7 @@ SearchService.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadEnginesFromCache: function SRCH_SVC__loadEnginesFromCache(cache,
|
_loadEnginesFromCache: function(cache,
|
||||||
skipReadOnly) {
|
skipReadOnly) {
|
||||||
if (!cache.engines)
|
if (!cache.engines)
|
||||||
return;
|
return;
|
||||||
|
|
@ -2956,7 +2956,7 @@ SearchService.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadEngineFromCache: function SRCH_SVC__loadEngineFromCache(json) {
|
_loadEngineFromCache: function(json) {
|
||||||
try {
|
try {
|
||||||
let engine = new Engine(json._shortName, json._readOnly == undefined);
|
let engine = new Engine(json._shortName, json._readOnly == undefined);
|
||||||
engine._initWithJSON(json);
|
engine._initWithJSON(json);
|
||||||
|
|
@ -2967,7 +2967,7 @@ SearchService.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadEnginesFromDir: function SRCH_SVC__loadEnginesFromDir(aDir) {
|
_loadEnginesFromDir: function(aDir) {
|
||||||
LOG("_loadEnginesFromDir: Searching in " + aDir.path + " for search engines.");
|
LOG("_loadEnginesFromDir: Searching in " + aDir.path + " for search engines.");
|
||||||
|
|
||||||
// Check whether aDir is the user profile dir
|
// Check whether aDir is the user profile dir
|
||||||
|
|
@ -3064,7 +3064,7 @@ SearchService.prototype = {
|
||||||
return engines;
|
return engines;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_loadFromChromeURLs: function SRCH_SVC_loadFromChromeURLs(aURLs) {
|
_loadFromChromeURLs: function(aURLs) {
|
||||||
aURLs.forEach(function (url) {
|
aURLs.forEach(function (url) {
|
||||||
try {
|
try {
|
||||||
LOG("_loadFromChromeURLs: loading engine from chrome url: " + url);
|
LOG("_loadFromChromeURLs: loading engine from chrome url: " + url);
|
||||||
|
|
@ -3117,7 +3117,7 @@ SearchService.prototype = {
|
||||||
return fileURI.file;
|
return fileURI.file;
|
||||||
},
|
},
|
||||||
|
|
||||||
_findJAREngines: function SRCH_SVC_findJAREngines() {
|
_findJAREngines: function() {
|
||||||
LOG("_findJAREngines: looking for engines in JARs")
|
LOG("_findJAREngines: looking for engines in JARs")
|
||||||
|
|
||||||
let chan = makeChannel(APP_SEARCH_PREFIX + "list.json");
|
let chan = makeChannel(APP_SEARCH_PREFIX + "list.json");
|
||||||
|
|
@ -3192,7 +3192,7 @@ SearchService.prototype = {
|
||||||
return uris;
|
return uris;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_parseListJSON: function SRCH_SVC_parseListJSON(list, uris) {
|
_parseListJSON: function(list, uris) {
|
||||||
let searchSettings;
|
let searchSettings;
|
||||||
try {
|
try {
|
||||||
searchSettings = JSON.parse(list);
|
searchSettings = JSON.parse(list);
|
||||||
|
|
@ -3247,7 +3247,7 @@ SearchService.prototype = {
|
||||||
this._visibleDefaultEngines = engineNames;
|
this._visibleDefaultEngines = engineNames;
|
||||||
},
|
},
|
||||||
|
|
||||||
_parseListTxt: function SRCH_SVC_parseListTxt(list, uris) {
|
_parseListTxt: function(list, uris) {
|
||||||
let names = list.split("\n").filter(n => !!n);
|
let names = list.split("\n").filter(n => !!n);
|
||||||
// This maps the names of our built-in engines to a boolean
|
// This maps the names of our built-in engines to a boolean
|
||||||
// indicating whether it should be hidden by default.
|
// indicating whether it should be hidden by default.
|
||||||
|
|
@ -3301,7 +3301,7 @@ SearchService.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_saveSortedEngineList: function SRCH_SVC_saveSortedEngineList() {
|
_saveSortedEngineList: function() {
|
||||||
LOG("SRCH_SVC_saveSortedEngineList: starting");
|
LOG("SRCH_SVC_saveSortedEngineList: starting");
|
||||||
|
|
||||||
// Set the useDB pref to indicate that from now on we should use the order
|
// Set the useDB pref to indicate that from now on we should use the order
|
||||||
|
|
@ -3317,7 +3317,7 @@ SearchService.prototype = {
|
||||||
LOG("SRCH_SVC_saveSortedEngineList: done");
|
LOG("SRCH_SVC_saveSortedEngineList: done");
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildSortedEngineList: function SRCH_SVC_buildSortedEngineList() {
|
_buildSortedEngineList: function() {
|
||||||
LOG("_buildSortedEngineList: building list");
|
LOG("_buildSortedEngineList: building list");
|
||||||
var addedEngines = { };
|
var addedEngines = { };
|
||||||
this.__sortedEngines = [];
|
this.__sortedEngines = [];
|
||||||
|
|
@ -3419,7 +3419,7 @@ SearchService.prototype = {
|
||||||
* @param aWithHidden
|
* @param aWithHidden
|
||||||
* True if hidden plugins should be included in the result.
|
* True if hidden plugins should be included in the result.
|
||||||
*/
|
*/
|
||||||
_getSortedEngines: function SRCH_SVC_getSorted(aWithHidden) {
|
_getSortedEngines: function(aWithHidden) {
|
||||||
if (aWithHidden)
|
if (aWithHidden)
|
||||||
return this._sortedEngines;
|
return this._sortedEngines;
|
||||||
|
|
||||||
|
|
@ -3429,7 +3429,7 @@ SearchService.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIBrowserSearchService
|
// nsIBrowserSearchService
|
||||||
init: function SRCH_SVC_init(observer) {
|
init: function(observer) {
|
||||||
LOG("SearchService.init");
|
LOG("SearchService.init");
|
||||||
let self = this;
|
let self = this;
|
||||||
if (!this._initStarted) {
|
if (!this._initStarted) {
|
||||||
|
|
@ -3469,7 +3469,7 @@ SearchService.prototype = {
|
||||||
return gInitialized;
|
return gInitialized;
|
||||||
},
|
},
|
||||||
|
|
||||||
getEngines: function SRCH_SVC_getEngines(aCount) {
|
getEngines: function(aCount) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
LOG("getEngines: getting all engines");
|
LOG("getEngines: getting all engines");
|
||||||
var engines = this._getSortedEngines(true);
|
var engines = this._getSortedEngines(true);
|
||||||
|
|
@ -3477,7 +3477,7 @@ SearchService.prototype = {
|
||||||
return engines;
|
return engines;
|
||||||
},
|
},
|
||||||
|
|
||||||
getVisibleEngines: function SRCH_SVC_getVisible(aCount) {
|
getVisibleEngines: function(aCount) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
LOG("getVisibleEngines: getting all visible engines");
|
LOG("getVisibleEngines: getting all visible engines");
|
||||||
var engines = this._getSortedEngines(false);
|
var engines = this._getSortedEngines(false);
|
||||||
|
|
@ -3485,7 +3485,7 @@ SearchService.prototype = {
|
||||||
return engines;
|
return engines;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultEngines: function SRCH_SVC_getDefault(aCount) {
|
getDefaultEngines: function(aCount) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
function isDefault(engine) {
|
function isDefault(engine) {
|
||||||
return engine._isDefault;
|
return engine._isDefault;
|
||||||
|
|
@ -3544,12 +3544,12 @@ SearchService.prototype = {
|
||||||
return engines;
|
return engines;
|
||||||
},
|
},
|
||||||
|
|
||||||
getEngineByName: function SRCH_SVC_getEngineByName(aEngineName) {
|
getEngineByName: function(aEngineName) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
return this._engines[aEngineName] || null;
|
return this._engines[aEngineName] || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getEngineByAlias: function SRCH_SVC_getEngineByAlias(aAlias) {
|
getEngineByAlias: function(aAlias) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
for (var engineName in this._engines) {
|
for (var engineName in this._engines) {
|
||||||
var engine = this._engines[engineName];
|
var engine = this._engines[engineName];
|
||||||
|
|
@ -3559,7 +3559,7 @@ SearchService.prototype = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
addEngineWithDetails: function SRCH_SVC_addEWD(aName, aIconURL, aAlias,
|
addEngineWithDetails: function(aName, aIconURL, aAlias,
|
||||||
aDescription, aMethod,
|
aDescription, aMethod,
|
||||||
aTemplate, aExtensionID) {
|
aTemplate, aExtensionID) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
|
|
@ -3579,7 +3579,7 @@ SearchService.prototype = {
|
||||||
this._addEngineToStore(engine);
|
this._addEngineToStore(engine);
|
||||||
},
|
},
|
||||||
|
|
||||||
addEngine: function SRCH_SVC_addEngine(aEngineURL, aDataType, aIconURL,
|
addEngine: function(aEngineURL, aDataType, aIconURL,
|
||||||
aConfirm, aCallback) {
|
aConfirm, aCallback) {
|
||||||
LOG("addEngine: Adding \"" + aEngineURL + "\".");
|
LOG("addEngine: Adding \"" + aEngineURL + "\".");
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
|
|
@ -3611,7 +3611,7 @@ SearchService.prototype = {
|
||||||
engine._confirm = aConfirm;
|
engine._confirm = aConfirm;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEngine: function SRCH_SVC_removeEngine(aEngine) {
|
removeEngine: function(aEngine) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
if (!aEngine)
|
if (!aEngine)
|
||||||
FAIL("no engine passed to removeEngine!");
|
FAIL("no engine passed to removeEngine!");
|
||||||
|
|
@ -3660,7 +3660,7 @@ SearchService.prototype = {
|
||||||
notifyAction(engineToRemove, SEARCH_ENGINE_REMOVED);
|
notifyAction(engineToRemove, SEARCH_ENGINE_REMOVED);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveEngine: function SRCH_SVC_moveEngine(aEngine, aNewIndex) {
|
moveEngine: function(aEngine, aNewIndex) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
if ((aNewIndex > this._sortedEngines.length) || (aNewIndex < 0))
|
if ((aNewIndex > this._sortedEngines.length) || (aNewIndex < 0))
|
||||||
FAIL("SRCH_SVC_moveEngine: Index out of bounds!");
|
FAIL("SRCH_SVC_moveEngine: Index out of bounds!");
|
||||||
|
|
@ -3710,7 +3710,7 @@ SearchService.prototype = {
|
||||||
this._saveSortedEngineList();
|
this._saveSortedEngineList();
|
||||||
},
|
},
|
||||||
|
|
||||||
restoreDefaultEngines: function SRCH_SVC_resetDefaultEngines() {
|
restoreDefaultEngines: function() {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
for (let name in this._engines) {
|
for (let name in this._engines) {
|
||||||
let e = this._engines[name];
|
let e = this._engines[name];
|
||||||
|
|
@ -3928,7 +3928,7 @@ SearchService.prototype = {
|
||||||
*/
|
*/
|
||||||
_parseSubmissionMap: null,
|
_parseSubmissionMap: null,
|
||||||
|
|
||||||
_buildParseSubmissionMap: function SRCH_SVC__buildParseSubmissionMap() {
|
_buildParseSubmissionMap: function() {
|
||||||
LOG("_buildParseSubmissionMap");
|
LOG("_buildParseSubmissionMap");
|
||||||
this._parseSubmissionMap = new Map();
|
this._parseSubmissionMap = new Map();
|
||||||
|
|
||||||
|
|
@ -4041,7 +4041,7 @@ SearchService.prototype = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
parseSubmissionURL: function SRCH_SVC_parseSubmissionURL(aURL) {
|
parseSubmissionURL: function(aURL) {
|
||||||
this._ensureInitialized();
|
this._ensureInitialized();
|
||||||
LOG("parseSubmissionURL: Parsing \"" + aURL + "\".");
|
LOG("parseSubmissionURL: Parsing \"" + aURL + "\".");
|
||||||
|
|
||||||
|
|
@ -4128,7 +4128,7 @@ SearchService.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIObserver
|
// nsIObserver
|
||||||
observe: function SRCH_SVC_observe(aEngine, aTopic, aVerb) {
|
observe: function(aEngine, aTopic, aVerb) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case SEARCH_ENGINE_TOPIC:
|
case SEARCH_ENGINE_TOPIC:
|
||||||
switch (aVerb) {
|
switch (aVerb) {
|
||||||
|
|
@ -4170,7 +4170,7 @@ SearchService.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsITimerCallback
|
// nsITimerCallback
|
||||||
notify: function SRCH_SVC_notify(aTimer) {
|
notify: function(aTimer) {
|
||||||
LOG("_notify: checking for updates");
|
LOG("_notify: checking for updates");
|
||||||
|
|
||||||
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
|
||||||
|
|
@ -4208,7 +4208,7 @@ SearchService.prototype = {
|
||||||
} // end engine iteration
|
} // end engine iteration
|
||||||
},
|
},
|
||||||
|
|
||||||
_addObservers: function SRCH_SVC_addObservers() {
|
_addObservers: function() {
|
||||||
if (this._observersAdded) {
|
if (this._observersAdded) {
|
||||||
// There might be a race between synchronous and asynchronous
|
// There might be a race between synchronous and asynchronous
|
||||||
// initialization for which we try to register the observers twice.
|
// initialization for which we try to register the observers twice.
|
||||||
|
|
@ -4256,7 +4256,7 @@ SearchService.prototype = {
|
||||||
},
|
},
|
||||||
_observersAdded: false,
|
_observersAdded: false,
|
||||||
|
|
||||||
_removeObservers: function SRCH_SVC_removeObservers() {
|
_removeObservers: function() {
|
||||||
Services.obs.removeObserver(this, SEARCH_ENGINE_TOPIC);
|
Services.obs.removeObserver(this, SEARCH_ENGINE_TOPIC);
|
||||||
Services.obs.removeObserver(this, QUIT_APPLICATION_TOPIC);
|
Services.obs.removeObserver(this, QUIT_APPLICATION_TOPIC);
|
||||||
},
|
},
|
||||||
|
|
@ -4283,13 +4283,13 @@ function ULOG(aText) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var engineUpdateService = {
|
var engineUpdateService = {
|
||||||
scheduleNextUpdate: function eus_scheduleNextUpdate(aEngine) {
|
scheduleNextUpdate: function(aEngine) {
|
||||||
var interval = aEngine._updateInterval || SEARCH_DEFAULT_UPDATE_INTERVAL;
|
var interval = aEngine._updateInterval || SEARCH_DEFAULT_UPDATE_INTERVAL;
|
||||||
var milliseconds = interval * 86400000; // |interval| is in days
|
var milliseconds = interval * 86400000; // |interval| is in days
|
||||||
aEngine.setAttr("updateexpir", Date.now() + milliseconds);
|
aEngine.setAttr("updateexpir", Date.now() + milliseconds);
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function eus_Update(aEngine) {
|
update: function(aEngine) {
|
||||||
let engine = aEngine.wrappedJSObject;
|
let engine = aEngine.wrappedJSObject;
|
||||||
ULOG("update called for " + aEngine._name);
|
ULOG("update called for " + aEngine._name);
|
||||||
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
|
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
|
||||||
"resource://gre/modules/AsyncShutdown.jsm");
|
"resource://gre/modules/AsyncShutdown.jsm");
|
||||||
|
|
||||||
Object.defineProperty(this, "HUDService", {
|
Object.defineProperty(this, "HUDService", {
|
||||||
get: function HUDService_getter() {
|
get: function() {
|
||||||
let devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools;
|
let devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools;
|
||||||
return devtools.require("devtools/client/webconsole/hudservice").HUDService;
|
return devtools.require("devtools/client/webconsole/hudservice").HUDService;
|
||||||
},
|
},
|
||||||
|
|
@ -223,111 +223,111 @@ this.SessionStore = {
|
||||||
return SessionStoreInternal.lastClosedObjectType;
|
return SessionStoreInternal.lastClosedObjectType;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function ss_init() {
|
init: function() {
|
||||||
SessionStoreInternal.init();
|
SessionStoreInternal.init();
|
||||||
},
|
},
|
||||||
|
|
||||||
getBrowserState: function ss_getBrowserState() {
|
getBrowserState: function() {
|
||||||
return SessionStoreInternal.getBrowserState();
|
return SessionStoreInternal.getBrowserState();
|
||||||
},
|
},
|
||||||
|
|
||||||
setBrowserState: function ss_setBrowserState(aState) {
|
setBrowserState: function(aState) {
|
||||||
SessionStoreInternal.setBrowserState(aState);
|
SessionStoreInternal.setBrowserState(aState);
|
||||||
},
|
},
|
||||||
|
|
||||||
getWindowState: function ss_getWindowState(aWindow) {
|
getWindowState: function(aWindow) {
|
||||||
return SessionStoreInternal.getWindowState(aWindow);
|
return SessionStoreInternal.getWindowState(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
setWindowState: function ss_setWindowState(aWindow, aState, aOverwrite) {
|
setWindowState: function(aWindow, aState, aOverwrite) {
|
||||||
SessionStoreInternal.setWindowState(aWindow, aState, aOverwrite);
|
SessionStoreInternal.setWindowState(aWindow, aState, aOverwrite);
|
||||||
},
|
},
|
||||||
|
|
||||||
getTabState: function ss_getTabState(aTab) {
|
getTabState: function(aTab) {
|
||||||
return SessionStoreInternal.getTabState(aTab);
|
return SessionStoreInternal.getTabState(aTab);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTabState: function ss_setTabState(aTab, aState) {
|
setTabState: function(aTab, aState) {
|
||||||
SessionStoreInternal.setTabState(aTab, aState);
|
SessionStoreInternal.setTabState(aTab, aState);
|
||||||
},
|
},
|
||||||
|
|
||||||
duplicateTab: function ss_duplicateTab(aWindow, aTab, aDelta = 0) {
|
duplicateTab: function(aWindow, aTab, aDelta = 0) {
|
||||||
return SessionStoreInternal.duplicateTab(aWindow, aTab, aDelta);
|
return SessionStoreInternal.duplicateTab(aWindow, aTab, aDelta);
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedTabCount: function ss_getClosedTabCount(aWindow) {
|
getClosedTabCount: function(aWindow) {
|
||||||
return SessionStoreInternal.getClosedTabCount(aWindow);
|
return SessionStoreInternal.getClosedTabCount(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedTabData: function ss_getClosedTabData(aWindow, aAsString = true) {
|
getClosedTabData: function(aWindow, aAsString = true) {
|
||||||
return SessionStoreInternal.getClosedTabData(aWindow, aAsString);
|
return SessionStoreInternal.getClosedTabData(aWindow, aAsString);
|
||||||
},
|
},
|
||||||
|
|
||||||
undoCloseTab: function ss_undoCloseTab(aWindow, aIndex) {
|
undoCloseTab: function(aWindow, aIndex) {
|
||||||
return SessionStoreInternal.undoCloseTab(aWindow, aIndex);
|
return SessionStoreInternal.undoCloseTab(aWindow, aIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
forgetClosedTab: function ss_forgetClosedTab(aWindow, aIndex) {
|
forgetClosedTab: function(aWindow, aIndex) {
|
||||||
return SessionStoreInternal.forgetClosedTab(aWindow, aIndex);
|
return SessionStoreInternal.forgetClosedTab(aWindow, aIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedWindowCount: function ss_getClosedWindowCount() {
|
getClosedWindowCount: function() {
|
||||||
return SessionStoreInternal.getClosedWindowCount();
|
return SessionStoreInternal.getClosedWindowCount();
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedWindowData: function ss_getClosedWindowData(aAsString = true) {
|
getClosedWindowData: function(aAsString = true) {
|
||||||
return SessionStoreInternal.getClosedWindowData(aAsString);
|
return SessionStoreInternal.getClosedWindowData(aAsString);
|
||||||
},
|
},
|
||||||
|
|
||||||
undoCloseWindow: function ss_undoCloseWindow(aIndex) {
|
undoCloseWindow: function(aIndex) {
|
||||||
return SessionStoreInternal.undoCloseWindow(aIndex);
|
return SessionStoreInternal.undoCloseWindow(aIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
forgetClosedWindow: function ss_forgetClosedWindow(aIndex) {
|
forgetClosedWindow: function(aIndex) {
|
||||||
return SessionStoreInternal.forgetClosedWindow(aIndex);
|
return SessionStoreInternal.forgetClosedWindow(aIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
getWindowValue: function ss_getWindowValue(aWindow, aKey) {
|
getWindowValue: function(aWindow, aKey) {
|
||||||
return SessionStoreInternal.getWindowValue(aWindow, aKey);
|
return SessionStoreInternal.getWindowValue(aWindow, aKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
setWindowValue: function ss_setWindowValue(aWindow, aKey, aStringValue) {
|
setWindowValue: function(aWindow, aKey, aStringValue) {
|
||||||
SessionStoreInternal.setWindowValue(aWindow, aKey, aStringValue);
|
SessionStoreInternal.setWindowValue(aWindow, aKey, aStringValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteWindowValue: function ss_deleteWindowValue(aWindow, aKey) {
|
deleteWindowValue: function(aWindow, aKey) {
|
||||||
SessionStoreInternal.deleteWindowValue(aWindow, aKey);
|
SessionStoreInternal.deleteWindowValue(aWindow, aKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
getTabValue: function ss_getTabValue(aTab, aKey) {
|
getTabValue: function(aTab, aKey) {
|
||||||
return SessionStoreInternal.getTabValue(aTab, aKey);
|
return SessionStoreInternal.getTabValue(aTab, aKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTabValue: function ss_setTabValue(aTab, aKey, aStringValue) {
|
setTabValue: function(aTab, aKey, aStringValue) {
|
||||||
SessionStoreInternal.setTabValue(aTab, aKey, aStringValue);
|
SessionStoreInternal.setTabValue(aTab, aKey, aStringValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTabValue: function ss_deleteTabValue(aTab, aKey) {
|
deleteTabValue: function(aTab, aKey) {
|
||||||
SessionStoreInternal.deleteTabValue(aTab, aKey);
|
SessionStoreInternal.deleteTabValue(aTab, aKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
getGlobalValue: function ss_getGlobalValue(aKey) {
|
getGlobalValue: function(aKey) {
|
||||||
return SessionStoreInternal.getGlobalValue(aKey);
|
return SessionStoreInternal.getGlobalValue(aKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
setGlobalValue: function ss_setGlobalValue(aKey, aStringValue) {
|
setGlobalValue: function(aKey, aStringValue) {
|
||||||
SessionStoreInternal.setGlobalValue(aKey, aStringValue);
|
SessionStoreInternal.setGlobalValue(aKey, aStringValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteGlobalValue: function ss_deleteGlobalValue(aKey) {
|
deleteGlobalValue: function(aKey) {
|
||||||
SessionStoreInternal.deleteGlobalValue(aKey);
|
SessionStoreInternal.deleteGlobalValue(aKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
persistTabAttribute: function ss_persistTabAttribute(aName) {
|
persistTabAttribute: function(aName) {
|
||||||
SessionStoreInternal.persistTabAttribute(aName);
|
SessionStoreInternal.persistTabAttribute(aName);
|
||||||
},
|
},
|
||||||
|
|
||||||
restoreLastSession: function ss_restoreLastSession() {
|
restoreLastSession: function() {
|
||||||
SessionStoreInternal.restoreLastSession();
|
SessionStoreInternal.restoreLastSession();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -661,7 +661,7 @@ var SessionStoreInternal = {
|
||||||
* Called on application shutdown, after notifications:
|
* Called on application shutdown, after notifications:
|
||||||
* quit-application-granted, quit-application
|
* quit-application-granted, quit-application
|
||||||
*/
|
*/
|
||||||
_uninit: function ssi_uninit() {
|
_uninit: function() {
|
||||||
if (!this._initialized) {
|
if (!this._initialized) {
|
||||||
throw new Error("SessionStore is not initialized.");
|
throw new Error("SessionStore is not initialized.");
|
||||||
}
|
}
|
||||||
|
|
@ -684,7 +684,7 @@ var SessionStoreInternal = {
|
||||||
/**
|
/**
|
||||||
* Handle notifications
|
* Handle notifications
|
||||||
*/
|
*/
|
||||||
observe: function ssi_observe(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "browser-window-before-show": // catch new windows
|
case "browser-window-before-show": // catch new windows
|
||||||
this.onBeforeBrowserWindowShown(aSubject);
|
this.onBeforeBrowserWindowShown(aSubject);
|
||||||
|
|
@ -936,7 +936,7 @@ var SessionStoreInternal = {
|
||||||
/**
|
/**
|
||||||
* Implement nsIDOMEventListener for handling various window and tab events
|
* Implement nsIDOMEventListener for handling various window and tab events
|
||||||
*/
|
*/
|
||||||
handleEvent: function ssi_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
let win = aEvent.currentTarget.ownerGlobal;
|
let win = aEvent.currentTarget.ownerGlobal;
|
||||||
let target = aEvent.originalTarget;
|
let target = aEvent.originalTarget;
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
|
|
@ -990,7 +990,7 @@ var SessionStoreInternal = {
|
||||||
* @return string
|
* @return string
|
||||||
* A unique string to identify a window
|
* A unique string to identify a window
|
||||||
*/
|
*/
|
||||||
_generateWindowID: function ssi_generateWindowID() {
|
_generateWindowID: function() {
|
||||||
return "window" + (this._nextWindowID++);
|
return "window" + (this._nextWindowID++);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1259,7 +1259,7 @@ var SessionStoreInternal = {
|
||||||
* @param aWindow
|
* @param aWindow
|
||||||
* Window reference
|
* Window reference
|
||||||
*/
|
*/
|
||||||
onClose: function ssi_onClose(aWindow) {
|
onClose: function(aWindow) {
|
||||||
// this window was about to be restored - conserve its original data, if any
|
// this window was about to be restored - conserve its original data, if any
|
||||||
let isFullyLoaded = this._isWindowLoaded(aWindow);
|
let isFullyLoaded = this._isWindowLoaded(aWindow);
|
||||||
if (!isFullyLoaded) {
|
if (!isFullyLoaded) {
|
||||||
|
|
@ -1490,7 +1490,7 @@ var SessionStoreInternal = {
|
||||||
/**
|
/**
|
||||||
* On quit application granted
|
* On quit application granted
|
||||||
*/
|
*/
|
||||||
onQuitApplicationGranted: function ssi_onQuitApplicationGranted(syncShutdown=false) {
|
onQuitApplicationGranted: function(syncShutdown=false) {
|
||||||
// Collect an initial snapshot of window data before we do the flush
|
// Collect an initial snapshot of window data before we do the flush
|
||||||
this._forEachBrowserWindow((win) => {
|
this._forEachBrowserWindow((win) => {
|
||||||
this._collectWindowData(win);
|
this._collectWindowData(win);
|
||||||
|
|
@ -1607,7 +1607,7 @@ var SessionStoreInternal = {
|
||||||
/**
|
/**
|
||||||
* On last browser window close
|
* On last browser window close
|
||||||
*/
|
*/
|
||||||
onLastWindowCloseGranted: function ssi_onLastWindowCloseGranted() {
|
onLastWindowCloseGranted: function() {
|
||||||
// last browser window is quitting.
|
// last browser window is quitting.
|
||||||
// remember to restore the last window when another browser window is opened
|
// remember to restore the last window when another browser window is opened
|
||||||
// do not account for pref(resume_session_once) at this point, as it might be
|
// do not account for pref(resume_session_once) at this point, as it might be
|
||||||
|
|
@ -1620,7 +1620,7 @@ var SessionStoreInternal = {
|
||||||
* @param aData
|
* @param aData
|
||||||
* String type of quitting
|
* String type of quitting
|
||||||
*/
|
*/
|
||||||
onQuitApplication: function ssi_onQuitApplication(aData) {
|
onQuitApplication: function(aData) {
|
||||||
if (aData == "restart") {
|
if (aData == "restart") {
|
||||||
this._prefBranch.setBoolPref("sessionstore.resume_session_once", true);
|
this._prefBranch.setBoolPref("sessionstore.resume_session_once", true);
|
||||||
// The browser:purge-session-history notification fires after the
|
// The browser:purge-session-history notification fires after the
|
||||||
|
|
@ -1643,7 +1643,7 @@ var SessionStoreInternal = {
|
||||||
/**
|
/**
|
||||||
* On purge of session history
|
* On purge of session history
|
||||||
*/
|
*/
|
||||||
onPurgeSessionHistory: function ssi_onPurgeSessionHistory() {
|
onPurgeSessionHistory: function() {
|
||||||
SessionFile.wipe();
|
SessionFile.wipe();
|
||||||
// If the browser is shutting down, simply return after clearing the
|
// If the browser is shutting down, simply return after clearing the
|
||||||
// session data on disk as this notification fires after the
|
// session data on disk as this notification fires after the
|
||||||
|
|
@ -1683,7 +1683,7 @@ var SessionStoreInternal = {
|
||||||
* @param aData
|
* @param aData
|
||||||
* String domain data
|
* String domain data
|
||||||
*/
|
*/
|
||||||
onPurgeDomainData: function ssi_onPurgeDomainData(aData) {
|
onPurgeDomainData: function(aData) {
|
||||||
// does a session history entry contain a url for the given domain?
|
// does a session history entry contain a url for the given domain?
|
||||||
function containsDomain(aEntry) {
|
function containsDomain(aEntry) {
|
||||||
if (Utils.hasRootDomain(aEntry.url, aData)) {
|
if (Utils.hasRootDomain(aEntry.url, aData)) {
|
||||||
|
|
@ -1741,7 +1741,7 @@ var SessionStoreInternal = {
|
||||||
* @param aData
|
* @param aData
|
||||||
* String preference changed
|
* String preference changed
|
||||||
*/
|
*/
|
||||||
onPrefChange: function ssi_onPrefChange(aData) {
|
onPrefChange: function(aData) {
|
||||||
switch (aData) {
|
switch (aData) {
|
||||||
// if the user decreases the max number of closed tabs they want
|
// if the user decreases the max number of closed tabs they want
|
||||||
// preserved update our internal states to match that max
|
// preserved update our internal states to match that max
|
||||||
|
|
@ -1763,7 +1763,7 @@ var SessionStoreInternal = {
|
||||||
* @param aWindow
|
* @param aWindow
|
||||||
* Window reference
|
* Window reference
|
||||||
*/
|
*/
|
||||||
onTabAdd: function ssi_onTabAdd(aWindow) {
|
onTabAdd: function(aWindow) {
|
||||||
this.saveStateDelayed(aWindow);
|
this.saveStateDelayed(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1774,7 +1774,7 @@ var SessionStoreInternal = {
|
||||||
* @param aTab
|
* @param aTab
|
||||||
* Tab reference
|
* Tab reference
|
||||||
*/
|
*/
|
||||||
onTabBrowserInserted: function ssi_onTabBrowserInserted(aWindow, aTab) {
|
onTabBrowserInserted: function(aWindow, aTab) {
|
||||||
let browser = aTab.linkedBrowser;
|
let browser = aTab.linkedBrowser;
|
||||||
browser.addEventListener("SwapDocShells", this);
|
browser.addEventListener("SwapDocShells", this);
|
||||||
browser.addEventListener("oop-browser-crashed", this);
|
browser.addEventListener("oop-browser-crashed", this);
|
||||||
|
|
@ -1793,7 +1793,7 @@ var SessionStoreInternal = {
|
||||||
* @param aNoNotification
|
* @param aNoNotification
|
||||||
* bool Do not save state if we're updating an existing tab
|
* bool Do not save state if we're updating an existing tab
|
||||||
*/
|
*/
|
||||||
onTabRemove: function ssi_onTabRemove(aWindow, aTab, aNoNotification) {
|
onTabRemove: function(aWindow, aTab, aNoNotification) {
|
||||||
let browser = aTab.linkedBrowser;
|
let browser = aTab.linkedBrowser;
|
||||||
browser.removeEventListener("SwapDocShells", this);
|
browser.removeEventListener("SwapDocShells", this);
|
||||||
browser.removeEventListener("oop-browser-crashed", this);
|
browser.removeEventListener("oop-browser-crashed", this);
|
||||||
|
|
@ -1820,7 +1820,7 @@ var SessionStoreInternal = {
|
||||||
* @param aTab
|
* @param aTab
|
||||||
* Tab reference
|
* Tab reference
|
||||||
*/
|
*/
|
||||||
onTabClose: function ssi_onTabClose(aWindow, aTab) {
|
onTabClose: function(aWindow, aTab) {
|
||||||
// notify the tabbrowser that the tab state will be retrieved for the last time
|
// notify the tabbrowser that the tab state will be retrieved for the last time
|
||||||
// (so that extension authors can easily set data on soon-to-be-closed tabs)
|
// (so that extension authors can easily set data on soon-to-be-closed tabs)
|
||||||
var event = aWindow.document.createEvent("Events");
|
var event = aWindow.document.createEvent("Events");
|
||||||
|
|
@ -1943,7 +1943,7 @@ var SessionStoreInternal = {
|
||||||
* @param aWindow
|
* @param aWindow
|
||||||
* Window reference
|
* Window reference
|
||||||
*/
|
*/
|
||||||
onTabSelect: function ssi_onTabSelect(aWindow) {
|
onTabSelect: function(aWindow) {
|
||||||
if (RunState.isRunning) {
|
if (RunState.isRunning) {
|
||||||
this._windows[aWindow.__SSi].selected = aWindow.gBrowser.tabContainer.selectedIndex;
|
this._windows[aWindow.__SSi].selected = aWindow.gBrowser.tabContainer.selectedIndex;
|
||||||
|
|
||||||
|
|
@ -1970,7 +1970,7 @@ var SessionStoreInternal = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onTabShow: function ssi_onTabShow(aWindow, aTab) {
|
onTabShow: function(aWindow, aTab) {
|
||||||
// If the tab hasn't been restored yet, move it into the right bucket
|
// If the tab hasn't been restored yet, move it into the right bucket
|
||||||
if (aTab.linkedBrowser.__SS_restoreState &&
|
if (aTab.linkedBrowser.__SS_restoreState &&
|
||||||
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
|
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
|
||||||
|
|
@ -1987,7 +1987,7 @@ var SessionStoreInternal = {
|
||||||
this.saveStateDelayed(aWindow);
|
this.saveStateDelayed(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
onTabHide: function ssi_onTabHide(aWindow, aTab) {
|
onTabHide: function(aWindow, aTab) {
|
||||||
// If the tab hasn't been restored yet, move it into the right bucket
|
// If the tab hasn't been restored yet, move it into the right bucket
|
||||||
if (aTab.linkedBrowser.__SS_restoreState &&
|
if (aTab.linkedBrowser.__SS_restoreState &&
|
||||||
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
|
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
|
||||||
|
|
@ -2076,7 +2076,7 @@ var SessionStoreInternal = {
|
||||||
|
|
||||||
/* ........ nsISessionStore API .............. */
|
/* ........ nsISessionStore API .............. */
|
||||||
|
|
||||||
getBrowserState: function ssi_getBrowserState() {
|
getBrowserState: function() {
|
||||||
let state = this.getCurrentState();
|
let state = this.getCurrentState();
|
||||||
|
|
||||||
// Don't include the last session state in getBrowserState().
|
// Don't include the last session state in getBrowserState().
|
||||||
|
|
@ -2088,7 +2088,7 @@ var SessionStoreInternal = {
|
||||||
return JSON.stringify(state);
|
return JSON.stringify(state);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBrowserState: function ssi_setBrowserState(aState) {
|
setBrowserState: function(aState) {
|
||||||
this._handleClosedWindows();
|
this._handleClosedWindows();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -2136,7 +2136,7 @@ var SessionStoreInternal = {
|
||||||
this.restoreWindows(window, state, {overwriteTabs: true});
|
this.restoreWindows(window, state, {overwriteTabs: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
getWindowState: function ssi_getWindowState(aWindow) {
|
getWindowState: function(aWindow) {
|
||||||
if ("__SSi" in aWindow) {
|
if ("__SSi" in aWindow) {
|
||||||
return JSON.stringify(this._getWindowState(aWindow));
|
return JSON.stringify(this._getWindowState(aWindow));
|
||||||
}
|
}
|
||||||
|
|
@ -2149,7 +2149,7 @@ var SessionStoreInternal = {
|
||||||
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||||
},
|
},
|
||||||
|
|
||||||
setWindowState: function ssi_setWindowState(aWindow, aState, aOverwrite) {
|
setWindowState: function(aWindow, aState, aOverwrite) {
|
||||||
if (!aWindow.__SSi) {
|
if (!aWindow.__SSi) {
|
||||||
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||||
}
|
}
|
||||||
|
|
@ -2157,7 +2157,7 @@ var SessionStoreInternal = {
|
||||||
this.restoreWindows(aWindow, aState, {overwriteTabs: aOverwrite});
|
this.restoreWindows(aWindow, aState, {overwriteTabs: aOverwrite});
|
||||||
},
|
},
|
||||||
|
|
||||||
getTabState: function ssi_getTabState(aTab) {
|
getTabState: function(aTab) {
|
||||||
if (!aTab.ownerGlobal.__SSi) {
|
if (!aTab.ownerGlobal.__SSi) {
|
||||||
throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||||
}
|
}
|
||||||
|
|
@ -2195,7 +2195,7 @@ var SessionStoreInternal = {
|
||||||
this.restoreTab(aTab, tabState);
|
this.restoreTab(aTab, tabState);
|
||||||
},
|
},
|
||||||
|
|
||||||
duplicateTab: function ssi_duplicateTab(aWindow, aTab, aDelta = 0, aRestoreImmediately = true) {
|
duplicateTab: function(aWindow, aTab, aDelta = 0, aRestoreImmediately = true) {
|
||||||
if (!aTab.ownerGlobal.__SSi) {
|
if (!aTab.ownerGlobal.__SSi) {
|
||||||
throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||||
}
|
}
|
||||||
|
|
@ -2251,7 +2251,7 @@ var SessionStoreInternal = {
|
||||||
return newTab;
|
return newTab;
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedTabCount: function ssi_getClosedTabCount(aWindow) {
|
getClosedTabCount: function(aWindow) {
|
||||||
if ("__SSi" in aWindow) {
|
if ("__SSi" in aWindow) {
|
||||||
return this._windows[aWindow.__SSi]._closedTabs.length;
|
return this._windows[aWindow.__SSi]._closedTabs.length;
|
||||||
}
|
}
|
||||||
|
|
@ -2263,7 +2263,7 @@ var SessionStoreInternal = {
|
||||||
return DyingWindowCache.get(aWindow)._closedTabs.length;
|
return DyingWindowCache.get(aWindow)._closedTabs.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedTabData: function ssi_getClosedTabData(aWindow, aAsString = true) {
|
getClosedTabData: function(aWindow, aAsString = true) {
|
||||||
if ("__SSi" in aWindow) {
|
if ("__SSi" in aWindow) {
|
||||||
return aAsString ?
|
return aAsString ?
|
||||||
JSON.stringify(this._windows[aWindow.__SSi]._closedTabs) :
|
JSON.stringify(this._windows[aWindow.__SSi]._closedTabs) :
|
||||||
|
|
@ -2278,7 +2278,7 @@ var SessionStoreInternal = {
|
||||||
return aAsString ? JSON.stringify(data._closedTabs) : Cu.cloneInto(data._closedTabs, {});
|
return aAsString ? JSON.stringify(data._closedTabs) : Cu.cloneInto(data._closedTabs, {});
|
||||||
},
|
},
|
||||||
|
|
||||||
undoCloseTab: function ssi_undoCloseTab(aWindow, aIndex) {
|
undoCloseTab: function(aWindow, aIndex) {
|
||||||
if (!aWindow.__SSi) {
|
if (!aWindow.__SSi) {
|
||||||
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||||
}
|
}
|
||||||
|
|
@ -2310,7 +2310,7 @@ var SessionStoreInternal = {
|
||||||
return tab;
|
return tab;
|
||||||
},
|
},
|
||||||
|
|
||||||
forgetClosedTab: function ssi_forgetClosedTab(aWindow, aIndex) {
|
forgetClosedTab: function(aWindow, aIndex) {
|
||||||
if (!aWindow.__SSi) {
|
if (!aWindow.__SSi) {
|
||||||
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||||
}
|
}
|
||||||
|
|
@ -2327,15 +2327,15 @@ var SessionStoreInternal = {
|
||||||
this.removeClosedTabData(closedTabs, aIndex);
|
this.removeClosedTabData(closedTabs, aIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedWindowCount: function ssi_getClosedWindowCount() {
|
getClosedWindowCount: function() {
|
||||||
return this._closedWindows.length;
|
return this._closedWindows.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
getClosedWindowData: function ssi_getClosedWindowData(aAsString = true) {
|
getClosedWindowData: function(aAsString = true) {
|
||||||
return aAsString ? JSON.stringify(this._closedWindows) : Cu.cloneInto(this._closedWindows, {});
|
return aAsString ? JSON.stringify(this._closedWindows) : Cu.cloneInto(this._closedWindows, {});
|
||||||
},
|
},
|
||||||
|
|
||||||
undoCloseWindow: function ssi_undoCloseWindow(aIndex) {
|
undoCloseWindow: function(aIndex) {
|
||||||
if (!(aIndex in this._closedWindows)) {
|
if (!(aIndex in this._closedWindows)) {
|
||||||
throw Components.Exception("Invalid index: not in the closed windows", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Invalid index: not in the closed windows", Cr.NS_ERROR_INVALID_ARG);
|
||||||
}
|
}
|
||||||
|
|
@ -2349,7 +2349,7 @@ var SessionStoreInternal = {
|
||||||
return window;
|
return window;
|
||||||
},
|
},
|
||||||
|
|
||||||
forgetClosedWindow: function ssi_forgetClosedWindow(aIndex) {
|
forgetClosedWindow: function(aIndex) {
|
||||||
// default to the most-recently closed window
|
// default to the most-recently closed window
|
||||||
aIndex = aIndex || 0;
|
aIndex = aIndex || 0;
|
||||||
if (!(aIndex in this._closedWindows)) {
|
if (!(aIndex in this._closedWindows)) {
|
||||||
|
|
@ -2362,7 +2362,7 @@ var SessionStoreInternal = {
|
||||||
this._saveableClosedWindowData.delete(winData);
|
this._saveableClosedWindowData.delete(winData);
|
||||||
},
|
},
|
||||||
|
|
||||||
getWindowValue: function ssi_getWindowValue(aWindow, aKey) {
|
getWindowValue: function(aWindow, aKey) {
|
||||||
if ("__SSi" in aWindow) {
|
if ("__SSi" in aWindow) {
|
||||||
var data = this._windows[aWindow.__SSi].extData || {};
|
var data = this._windows[aWindow.__SSi].extData || {};
|
||||||
return data[aKey] || "";
|
return data[aKey] || "";
|
||||||
|
|
@ -2376,7 +2376,7 @@ var SessionStoreInternal = {
|
||||||
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||||
},
|
},
|
||||||
|
|
||||||
setWindowValue: function ssi_setWindowValue(aWindow, aKey, aStringValue) {
|
setWindowValue: function(aWindow, aKey, aStringValue) {
|
||||||
if (typeof aStringValue != "string") {
|
if (typeof aStringValue != "string") {
|
||||||
throw new TypeError("setWindowValue only accepts string values");
|
throw new TypeError("setWindowValue only accepts string values");
|
||||||
}
|
}
|
||||||
|
|
@ -2391,18 +2391,18 @@ var SessionStoreInternal = {
|
||||||
this.saveStateDelayed(aWindow);
|
this.saveStateDelayed(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteWindowValue: function ssi_deleteWindowValue(aWindow, aKey) {
|
deleteWindowValue: function(aWindow, aKey) {
|
||||||
if (aWindow.__SSi && this._windows[aWindow.__SSi].extData &&
|
if (aWindow.__SSi && this._windows[aWindow.__SSi].extData &&
|
||||||
this._windows[aWindow.__SSi].extData[aKey])
|
this._windows[aWindow.__SSi].extData[aKey])
|
||||||
delete this._windows[aWindow.__SSi].extData[aKey];
|
delete this._windows[aWindow.__SSi].extData[aKey];
|
||||||
this.saveStateDelayed(aWindow);
|
this.saveStateDelayed(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
getTabValue: function ssi_getTabValue(aTab, aKey) {
|
getTabValue: function(aTab, aKey) {
|
||||||
return (aTab.__SS_extdata || {})[aKey] || "";
|
return (aTab.__SS_extdata || {})[aKey] || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
setTabValue: function ssi_setTabValue(aTab, aKey, aStringValue) {
|
setTabValue: function(aTab, aKey, aStringValue) {
|
||||||
if (typeof aStringValue != "string") {
|
if (typeof aStringValue != "string") {
|
||||||
throw new TypeError("setTabValue only accepts string values");
|
throw new TypeError("setTabValue only accepts string values");
|
||||||
}
|
}
|
||||||
|
|
@ -2417,18 +2417,18 @@ var SessionStoreInternal = {
|
||||||
this.saveStateDelayed(aTab.ownerGlobal);
|
this.saveStateDelayed(aTab.ownerGlobal);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTabValue: function ssi_deleteTabValue(aTab, aKey) {
|
deleteTabValue: function(aTab, aKey) {
|
||||||
if (aTab.__SS_extdata && aKey in aTab.__SS_extdata) {
|
if (aTab.__SS_extdata && aKey in aTab.__SS_extdata) {
|
||||||
delete aTab.__SS_extdata[aKey];
|
delete aTab.__SS_extdata[aKey];
|
||||||
this.saveStateDelayed(aTab.ownerGlobal);
|
this.saveStateDelayed(aTab.ownerGlobal);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getGlobalValue: function ssi_getGlobalValue(aKey) {
|
getGlobalValue: function(aKey) {
|
||||||
return this._globalState.get(aKey);
|
return this._globalState.get(aKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
setGlobalValue: function ssi_setGlobalValue(aKey, aStringValue) {
|
setGlobalValue: function(aKey, aStringValue) {
|
||||||
if (typeof aStringValue != "string") {
|
if (typeof aStringValue != "string") {
|
||||||
throw new TypeError("setGlobalValue only accepts string values");
|
throw new TypeError("setGlobalValue only accepts string values");
|
||||||
}
|
}
|
||||||
|
|
@ -2437,12 +2437,12 @@ var SessionStoreInternal = {
|
||||||
this.saveStateDelayed();
|
this.saveStateDelayed();
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteGlobalValue: function ssi_deleteGlobalValue(aKey) {
|
deleteGlobalValue: function(aKey) {
|
||||||
this._globalState.delete(aKey);
|
this._globalState.delete(aKey);
|
||||||
this.saveStateDelayed();
|
this.saveStateDelayed();
|
||||||
},
|
},
|
||||||
|
|
||||||
persistTabAttribute: function ssi_persistTabAttribute(aName) {
|
persistTabAttribute: function(aName) {
|
||||||
if (TabAttributes.persist(aName)) {
|
if (TabAttributes.persist(aName)) {
|
||||||
this.saveStateDelayed();
|
this.saveStateDelayed();
|
||||||
}
|
}
|
||||||
|
|
@ -2491,7 +2491,7 @@ var SessionStoreInternal = {
|
||||||
* that window will be opened into that window. Otherwise new windows will
|
* that window will be opened into that window. Otherwise new windows will
|
||||||
* be opened.
|
* be opened.
|
||||||
*/
|
*/
|
||||||
restoreLastSession: function ssi_restoreLastSession() {
|
restoreLastSession: function() {
|
||||||
// Use the public getter since it also checks PB mode
|
// Use the public getter since it also checks PB mode
|
||||||
if (!this.canRestoreLastSession) {
|
if (!this.canRestoreLastSession) {
|
||||||
throw Components.Exception("Last session can not be restored");
|
throw Components.Exception("Last session can not be restored");
|
||||||
|
|
@ -2772,7 +2772,7 @@ var SessionStoreInternal = {
|
||||||
* canOverwriteTabs: all of the current tabs are home pages and we
|
* canOverwriteTabs: all of the current tabs are home pages and we
|
||||||
* can overwrite them
|
* can overwrite them
|
||||||
*/
|
*/
|
||||||
_prepWindowToRestoreInto: function ssi_prepWindowToRestoreInto(aWindow) {
|
_prepWindowToRestoreInto: function(aWindow) {
|
||||||
if (!aWindow)
|
if (!aWindow)
|
||||||
return [false, false];
|
return [false, false];
|
||||||
|
|
||||||
|
|
@ -2819,7 +2819,7 @@ var SessionStoreInternal = {
|
||||||
* @param aWindow
|
* @param aWindow
|
||||||
* Window reference
|
* Window reference
|
||||||
*/
|
*/
|
||||||
_updateWindowFeatures: function ssi_updateWindowFeatures(aWindow) {
|
_updateWindowFeatures: function(aWindow) {
|
||||||
var winData = this._windows[aWindow.__SSi];
|
var winData = this._windows[aWindow.__SSi];
|
||||||
|
|
||||||
WINDOW_ATTRIBUTES.forEach(function(aAttr) {
|
WINDOW_ATTRIBUTES.forEach(function(aAttr) {
|
||||||
|
|
@ -2972,7 +2972,7 @@ var SessionStoreInternal = {
|
||||||
* Window reference
|
* Window reference
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
_getWindowState: function ssi_getWindowState(aWindow) {
|
_getWindowState: function(aWindow) {
|
||||||
if (!this._isWindowLoaded(aWindow))
|
if (!this._isWindowLoaded(aWindow))
|
||||||
return this._statesToRestore[aWindow.__SS_restoreID];
|
return this._statesToRestore[aWindow.__SS_restoreID];
|
||||||
|
|
||||||
|
|
@ -2995,7 +2995,7 @@ var SessionStoreInternal = {
|
||||||
* @returns a Map mapping the browser tabs from aWindow to the tab
|
* @returns a Map mapping the browser tabs from aWindow to the tab
|
||||||
* entry that was put into the window data in this._windows.
|
* entry that was put into the window data in this._windows.
|
||||||
*/
|
*/
|
||||||
_collectWindowData: function ssi_collectWindowData(aWindow) {
|
_collectWindowData: function(aWindow) {
|
||||||
let tabMap = new Map();
|
let tabMap = new Map();
|
||||||
|
|
||||||
if (!this._isWindowLoaded(aWindow))
|
if (!this._isWindowLoaded(aWindow))
|
||||||
|
|
@ -3041,7 +3041,7 @@ var SessionStoreInternal = {
|
||||||
* restoring in this session, that might open an
|
* restoring in this session, that might open an
|
||||||
* external link as well
|
* external link as well
|
||||||
*/
|
*/
|
||||||
restoreWindow: function ssi_restoreWindow(aWindow, winData, aOptions = {}) {
|
restoreWindow: function(aWindow, winData, aOptions = {}) {
|
||||||
let overwriteTabs = aOptions && aOptions.overwriteTabs;
|
let overwriteTabs = aOptions && aOptions.overwriteTabs;
|
||||||
let isFollowUp = aOptions && aOptions.isFollowUp;
|
let isFollowUp = aOptions && aOptions.isFollowUp;
|
||||||
let firstWindow = aOptions && aOptions.firstWindow;
|
let firstWindow = aOptions && aOptions.firstWindow;
|
||||||
|
|
@ -3248,7 +3248,7 @@ var SessionStoreInternal = {
|
||||||
* restoring in this session, that might open an
|
* restoring in this session, that might open an
|
||||||
* external link as well
|
* external link as well
|
||||||
*/
|
*/
|
||||||
restoreWindows: function ssi_restoreWindows(aWindow, aState, aOptions = {}) {
|
restoreWindows: function(aWindow, aState, aOptions = {}) {
|
||||||
let isFollowUp = aOptions && aOptions.isFollowUp;
|
let isFollowUp = aOptions && aOptions.isFollowUp;
|
||||||
|
|
||||||
if (isFollowUp) {
|
if (isFollowUp) {
|
||||||
|
|
@ -3608,7 +3608,7 @@ var SessionStoreInternal = {
|
||||||
* if there are no tabs to restore
|
* if there are no tabs to restore
|
||||||
* if we have already reached the limit for number of tabs to restore
|
* if we have already reached the limit for number of tabs to restore
|
||||||
*/
|
*/
|
||||||
restoreNextTab: function ssi_restoreNextTab() {
|
restoreNextTab: function() {
|
||||||
// If we call in here while quitting, we don't actually want to do anything
|
// If we call in here while quitting, we don't actually want to do anything
|
||||||
if (RunState.isQuitting)
|
if (RunState.isQuitting)
|
||||||
return;
|
return;
|
||||||
|
|
@ -3630,7 +3630,7 @@ var SessionStoreInternal = {
|
||||||
* @param aWinData
|
* @param aWinData
|
||||||
* Object containing session data for the window
|
* Object containing session data for the window
|
||||||
*/
|
*/
|
||||||
restoreWindowFeatures: function ssi_restoreWindowFeatures(aWindow, aWinData) {
|
restoreWindowFeatures: function(aWindow, aWinData) {
|
||||||
var hidden = (aWinData.hidden)?aWinData.hidden.split(","):[];
|
var hidden = (aWinData.hidden)?aWinData.hidden.split(","):[];
|
||||||
WINDOW_HIDEABLE_FEATURES.forEach(function(aItem) {
|
WINDOW_HIDEABLE_FEATURES.forEach(function(aItem) {
|
||||||
aWindow[aItem].visible = hidden.indexOf(aItem) == -1;
|
aWindow[aItem].visible = hidden.indexOf(aItem) == -1;
|
||||||
|
|
@ -3677,7 +3677,7 @@ var SessionStoreInternal = {
|
||||||
* @param aSidebar
|
* @param aSidebar
|
||||||
* Sidebar command
|
* Sidebar command
|
||||||
*/
|
*/
|
||||||
restoreDimensions: function ssi_restoreDimensions(aWindow, aWidth, aHeight, aLeft, aTop, aSizeMode, aSidebar) {
|
restoreDimensions: function(aWindow, aWidth, aHeight, aLeft, aTop, aSizeMode, aSidebar) {
|
||||||
var win = aWindow;
|
var win = aWindow;
|
||||||
var _this = this;
|
var _this = this;
|
||||||
function win_(aName) { return _this._getWindowDimension(win, aName); }
|
function win_(aName) { return _this._getWindowDimension(win, aName); }
|
||||||
|
|
@ -3838,7 +3838,7 @@ var SessionStoreInternal = {
|
||||||
* @param state
|
* @param state
|
||||||
* The session state.
|
* The session state.
|
||||||
*/
|
*/
|
||||||
_updateSessionStartTime: function ssi_updateSessionStartTime(state) {
|
_updateSessionStartTime: function(state) {
|
||||||
// Attempt to load the session start time from the session state
|
// Attempt to load the session start time from the session state
|
||||||
if (state.session && state.session.startTime) {
|
if (state.session && state.session.startTime) {
|
||||||
this._sessionStartTime = state.session.startTime;
|
this._sessionStartTime = state.session.startTime;
|
||||||
|
|
@ -3851,7 +3851,7 @@ var SessionStoreInternal = {
|
||||||
* @param aFunc
|
* @param aFunc
|
||||||
* Callback each window is passed to
|
* Callback each window is passed to
|
||||||
*/
|
*/
|
||||||
_forEachBrowserWindow: function ssi_forEachBrowserWindow(aFunc) {
|
_forEachBrowserWindow: function(aFunc) {
|
||||||
var windowsEnum = Services.wm.getEnumerator("navigator:browser");
|
var windowsEnum = Services.wm.getEnumerator("navigator:browser");
|
||||||
|
|
||||||
while (windowsEnum.hasMoreElements()) {
|
while (windowsEnum.hasMoreElements()) {
|
||||||
|
|
@ -3866,7 +3866,7 @@ var SessionStoreInternal = {
|
||||||
* Returns most recent window
|
* Returns most recent window
|
||||||
* @returns Window reference
|
* @returns Window reference
|
||||||
*/
|
*/
|
||||||
_getMostRecentBrowserWindow: function ssi_getMostRecentBrowserWindow() {
|
_getMostRecentBrowserWindow: function() {
|
||||||
return RecentWindow.getMostRecentBrowserWindow({ allowPopups: true });
|
return RecentWindow.getMostRecentBrowserWindow({ allowPopups: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -3875,7 +3875,7 @@ var SessionStoreInternal = {
|
||||||
* destroyed yet, which would otherwise cause getBrowserState and
|
* destroyed yet, which would otherwise cause getBrowserState and
|
||||||
* setBrowserState to treat them as open windows.
|
* setBrowserState to treat them as open windows.
|
||||||
*/
|
*/
|
||||||
_handleClosedWindows: function ssi_handleClosedWindows() {
|
_handleClosedWindows: function() {
|
||||||
var windowsEnum = Services.wm.getEnumerator("navigator:browser");
|
var windowsEnum = Services.wm.getEnumerator("navigator:browser");
|
||||||
|
|
||||||
while (windowsEnum.hasMoreElements()) {
|
while (windowsEnum.hasMoreElements()) {
|
||||||
|
|
@ -3892,7 +3892,7 @@ var SessionStoreInternal = {
|
||||||
* @param aState
|
* @param aState
|
||||||
* Object containing session data
|
* Object containing session data
|
||||||
*/
|
*/
|
||||||
_openWindowWithState: function ssi_openWindowWithState(aState) {
|
_openWindowWithState: function(aState) {
|
||||||
var argString = Cc["@mozilla.org/supports-string;1"].
|
var argString = Cc["@mozilla.org/supports-string;1"].
|
||||||
createInstance(Ci.nsISupportsString);
|
createInstance(Ci.nsISupportsString);
|
||||||
argString.data = "";
|
argString.data = "";
|
||||||
|
|
@ -3926,7 +3926,7 @@ var SessionStoreInternal = {
|
||||||
* Whether or not to resume session, if not recovering from a crash.
|
* Whether or not to resume session, if not recovering from a crash.
|
||||||
* @returns bool
|
* @returns bool
|
||||||
*/
|
*/
|
||||||
_doResumeSession: function ssi_doResumeSession() {
|
_doResumeSession: function() {
|
||||||
return this._prefBranch.getIntPref("startup.page") == 3 ||
|
return this._prefBranch.getIntPref("startup.page") == 3 ||
|
||||||
this._prefBranch.getBoolPref("sessionstore.resume_session_once");
|
this._prefBranch.getBoolPref("sessionstore.resume_session_once");
|
||||||
},
|
},
|
||||||
|
|
@ -3937,7 +3937,7 @@ var SessionStoreInternal = {
|
||||||
* C.f.: nsBrowserContentHandler's defaultArgs implementation.
|
* C.f.: nsBrowserContentHandler's defaultArgs implementation.
|
||||||
* @returns bool
|
* @returns bool
|
||||||
*/
|
*/
|
||||||
_isCmdLineEmpty: function ssi_isCmdLineEmpty(aWindow, aState) {
|
_isCmdLineEmpty: function(aWindow, aState) {
|
||||||
var pinnedOnly = aState.windows &&
|
var pinnedOnly = aState.windows &&
|
||||||
aState.windows.every(win =>
|
aState.windows.every(win =>
|
||||||
win.tabs.every(tab => tab.pinned));
|
win.tabs.every(tab => tab.pinned));
|
||||||
|
|
@ -3966,7 +3966,7 @@ var SessionStoreInternal = {
|
||||||
* String sizemode | width | height | other window attribute
|
* String sizemode | width | height | other window attribute
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
_getWindowDimension: function ssi_getWindowDimension(aWindow, aAttribute) {
|
_getWindowDimension: function(aWindow, aAttribute) {
|
||||||
if (aAttribute == "sizemode") {
|
if (aAttribute == "sizemode") {
|
||||||
switch (aWindow.windowState) {
|
switch (aWindow.windowState) {
|
||||||
case aWindow.STATE_FULLSCREEN:
|
case aWindow.STATE_FULLSCREEN:
|
||||||
|
|
@ -4003,7 +4003,7 @@ var SessionStoreInternal = {
|
||||||
* @param aRecentCrashes is the number of consecutive crashes
|
* @param aRecentCrashes is the number of consecutive crashes
|
||||||
* @returns whether a restore page will be needed for the session state
|
* @returns whether a restore page will be needed for the session state
|
||||||
*/
|
*/
|
||||||
_needsRestorePage: function ssi_needsRestorePage(aState, aRecentCrashes) {
|
_needsRestorePage: function(aState, aRecentCrashes) {
|
||||||
const SIX_HOURS_IN_MS = 6 * 60 * 60 * 1000;
|
const SIX_HOURS_IN_MS = 6 * 60 * 60 * 1000;
|
||||||
|
|
||||||
// don't display the page when there's nothing to restore
|
// don't display the page when there's nothing to restore
|
||||||
|
|
@ -4056,7 +4056,7 @@ var SessionStoreInternal = {
|
||||||
* The current tab state
|
* The current tab state
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
_shouldSaveTabState: function ssi_shouldSaveTabState(aTabState) {
|
_shouldSaveTabState: function(aTabState) {
|
||||||
// If the tab has only a transient about: history entry, no other
|
// If the tab has only a transient about: history entry, no other
|
||||||
// session history, and no userTypedValue, then we don't actually want to
|
// session history, and no userTypedValue, then we don't actually want to
|
||||||
// store this tab's data.
|
// store this tab's data.
|
||||||
|
|
@ -4085,7 +4085,7 @@ var SessionStoreInternal = {
|
||||||
* The state, presumably from nsISessionStartup.state
|
* The state, presumably from nsISessionStartup.state
|
||||||
* @returns [defaultState, state]
|
* @returns [defaultState, state]
|
||||||
*/
|
*/
|
||||||
_prepDataForDeferredRestore: function ssi_prepDataForDeferredRestore(state) {
|
_prepDataForDeferredRestore: function(state) {
|
||||||
// Make sure that we don't modify the global state as provided by
|
// Make sure that we don't modify the global state as provided by
|
||||||
// nsSessionStartup.state.
|
// nsSessionStartup.state.
|
||||||
state = Cu.cloneInto(state, {});
|
state = Cu.cloneInto(state, {});
|
||||||
|
|
@ -4196,7 +4196,7 @@ var SessionStoreInternal = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_sendRestoreCompletedNotifications: function ssi_sendRestoreCompletedNotifications() {
|
_sendRestoreCompletedNotifications: function() {
|
||||||
// not all windows restored, yet
|
// not all windows restored, yet
|
||||||
if (this._restoreCount > 1) {
|
if (this._restoreCount > 1) {
|
||||||
this._restoreCount--;
|
this._restoreCount--;
|
||||||
|
|
@ -4238,7 +4238,7 @@ var SessionStoreInternal = {
|
||||||
* Set the given window's state to 'not busy'.
|
* Set the given window's state to 'not busy'.
|
||||||
* @param aWindow the window
|
* @param aWindow the window
|
||||||
*/
|
*/
|
||||||
_setWindowStateReady: function ssi_setWindowStateReady(aWindow) {
|
_setWindowStateReady: function(aWindow) {
|
||||||
let newCount = (this._windowBusyStates.get(aWindow) || 0) - 1;
|
let newCount = (this._windowBusyStates.get(aWindow) || 0) - 1;
|
||||||
if (newCount < 0) {
|
if (newCount < 0) {
|
||||||
throw new Error("Invalid window busy state (less than zero).");
|
throw new Error("Invalid window busy state (less than zero).");
|
||||||
|
|
@ -4255,7 +4255,7 @@ var SessionStoreInternal = {
|
||||||
* Set the given window's state to 'busy'.
|
* Set the given window's state to 'busy'.
|
||||||
* @param aWindow the window
|
* @param aWindow the window
|
||||||
*/
|
*/
|
||||||
_setWindowStateBusy: function ssi_setWindowStateBusy(aWindow) {
|
_setWindowStateBusy: function(aWindow) {
|
||||||
let newCount = (this._windowBusyStates.get(aWindow) || 0) + 1;
|
let newCount = (this._windowBusyStates.get(aWindow) || 0) + 1;
|
||||||
this._windowBusyStates.set(aWindow, newCount);
|
this._windowBusyStates.set(aWindow, newCount);
|
||||||
|
|
||||||
|
|
@ -4270,7 +4270,7 @@ var SessionStoreInternal = {
|
||||||
* @param aWindow the window
|
* @param aWindow the window
|
||||||
* @param aType the type of event, SSWindowState will be prepended to this string
|
* @param aType the type of event, SSWindowState will be prepended to this string
|
||||||
*/
|
*/
|
||||||
_sendWindowStateEvent: function ssi_sendWindowStateEvent(aWindow, aType) {
|
_sendWindowStateEvent: function(aWindow, aType) {
|
||||||
let event = aWindow.document.createEvent("Events");
|
let event = aWindow.document.createEvent("Events");
|
||||||
event.initEvent("SSWindowState" + aType, true, false);
|
event.initEvent("SSWindowState" + aType, true, false);
|
||||||
aWindow.dispatchEvent(event);
|
aWindow.dispatchEvent(event);
|
||||||
|
|
@ -4309,7 +4309,7 @@ var SessionStoreInternal = {
|
||||||
* @returns whether this window's data is still cached in _statesToRestore
|
* @returns whether this window's data is still cached in _statesToRestore
|
||||||
* because it's not fully loaded yet
|
* because it's not fully loaded yet
|
||||||
*/
|
*/
|
||||||
_isWindowLoaded: function ssi_isWindowLoaded(aWindow) {
|
_isWindowLoaded: function(aWindow) {
|
||||||
return !aWindow.__SS_restoreID;
|
return !aWindow.__SS_restoreID;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -4321,7 +4321,7 @@ var SessionStoreInternal = {
|
||||||
*
|
*
|
||||||
* @returns aString that has been updated with the new title
|
* @returns aString that has been updated with the new title
|
||||||
*/
|
*/
|
||||||
_replaceLoadingTitle : function ssi_replaceLoadingTitle(aString, aTabbrowser, aTab) {
|
_replaceLoadingTitle : function(aString, aTabbrowser, aTab) {
|
||||||
if (aString == aTabbrowser.mStringBundle.getString("tabs.connecting")) {
|
if (aString == aTabbrowser.mStringBundle.getString("tabs.connecting")) {
|
||||||
aTabbrowser.setTabTitle(aTab);
|
aTabbrowser.setTabTitle(aTab);
|
||||||
[aString, aTab.label] = [aTab.label, aString];
|
[aString, aTab.label] = [aTab.label, aString];
|
||||||
|
|
@ -4334,7 +4334,7 @@ var SessionStoreInternal = {
|
||||||
* where we don't have any non-popup windows on Windows and Linux. Then we must
|
* where we don't have any non-popup windows on Windows and Linux. Then we must
|
||||||
* resize such that we have at least one non-popup window.
|
* resize such that we have at least one non-popup window.
|
||||||
*/
|
*/
|
||||||
_capClosedWindows : function ssi_capClosedWindows() {
|
_capClosedWindows : function() {
|
||||||
if (this._closedWindows.length <= this._max_windows_undo)
|
if (this._closedWindows.length <= this._max_windows_undo)
|
||||||
return;
|
return;
|
||||||
let spliceTo = this._max_windows_undo;
|
let spliceTo = this._max_windows_undo;
|
||||||
|
|
@ -4359,7 +4359,7 @@ var SessionStoreInternal = {
|
||||||
* windows that have been closed before are not part of a series of closing
|
* windows that have been closed before are not part of a series of closing
|
||||||
* windows.
|
* windows.
|
||||||
*/
|
*/
|
||||||
_clearRestoringWindows: function ssi_clearRestoringWindows() {
|
_clearRestoringWindows: function() {
|
||||||
for (let i = 0; i < this._closedWindows.length; i++) {
|
for (let i = 0; i < this._closedWindows.length; i++) {
|
||||||
delete this._closedWindows[i]._shouldRestore;
|
delete this._closedWindows[i]._shouldRestore;
|
||||||
}
|
}
|
||||||
|
|
@ -4368,7 +4368,7 @@ var SessionStoreInternal = {
|
||||||
/**
|
/**
|
||||||
* Reset state to prepare for a new session state to be restored.
|
* Reset state to prepare for a new session state to be restored.
|
||||||
*/
|
*/
|
||||||
_resetRestoringState: function ssi_initRestoringState() {
|
_resetRestoringState: function() {
|
||||||
TabRestoreQueue.reset();
|
TabRestoreQueue.reset();
|
||||||
this._tabsRestoringCount = 0;
|
this._tabsRestoringCount = 0;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ SessionStartup.prototype = {
|
||||||
/**
|
/**
|
||||||
* Initialize the component
|
* Initialize the component
|
||||||
*/
|
*/
|
||||||
init: function sss_init() {
|
init: function() {
|
||||||
Services.obs.notifyObservers(null, "sessionstore-init-started", null);
|
Services.obs.notifyObservers(null, "sessionstore-init-started", null);
|
||||||
StartupPerformance.init();
|
StartupPerformance.init();
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ SessionStartup.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Wrap a string as a nsISupports
|
// Wrap a string as a nsISupports
|
||||||
_createSupportsString: function ssfi_createSupportsString(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;
|
||||||
|
|
@ -232,7 +232,7 @@ SessionStartup.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handle notifications
|
* Handle notifications
|
||||||
*/
|
*/
|
||||||
observe: function sss_observe(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);
|
||||||
|
|
@ -281,7 +281,7 @@ SessionStartup.prototype = {
|
||||||
* called after initialization has completed.
|
* called after initialization has completed.
|
||||||
* @returns bool
|
* @returns bool
|
||||||
*/
|
*/
|
||||||
doRestore: function sss_doRestore() {
|
doRestore: function() {
|
||||||
return this._willRestore();
|
return this._willRestore();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
function nsSetDefaultBrowser() {}
|
function nsSetDefaultBrowser() {}
|
||||||
|
|
||||||
nsSetDefaultBrowser.prototype = {
|
nsSetDefaultBrowser.prototype = {
|
||||||
handle: function nsSetDefault_handle(aCmdline) {
|
handle: function(aCmdline) {
|
||||||
if (aCmdline.handleFlag("setDefaultBrowser", false)) {
|
if (aCmdline.handleFlag("setDefaultBrowser", false)) {
|
||||||
ShellService.setDefaultBrowser(true, true);
|
ShellService.setDefaultBrowser(true, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ var gSyncAddDevice = {
|
||||||
Weave.Service.scheduler.scheduleNextSync(0);
|
Weave.Service.scheduler.scheduleNextSync(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPageShow: function onPageShow() {
|
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() {
|
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() {
|
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() {
|
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() {
|
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 onAbort(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() {
|
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() {
|
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 onTextBoxInput(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,7 +143,7 @@ var gSyncAddDevice = {
|
||||||
&& this.pin3.value.length == PIN_PART_LENGTH);
|
&& this.pin3.value.length == PIN_PART_LENGTH);
|
||||||
},
|
},
|
||||||
|
|
||||||
goToSyncKeyPage: function goToSyncKeyPage() {
|
goToSyncKeyPage: function() {
|
||||||
this.wizard.pageIndex = SYNC_KEY_PAGE;
|
this.wizard.pageIndex = SYNC_KEY_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ var Change = {
|
||||||
return this._dialogType == "UpdatePassphrase";
|
return this._dialogType == "UpdatePassphrase";
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad: function Change_onLoad() {
|
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() {
|
_clearStatus: function() {
|
||||||
this._status.value = "";
|
this._status.value = "";
|
||||||
this._statusIcon.removeAttribute("status");
|
this._statusIcon.removeAttribute("status");
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateStatus: function Change__updateStatus(str, state) {
|
_updateStatus: function(str, state) {
|
||||||
this._updateStatusWithString(this._str(str), state);
|
this._updateStatusWithString(this._str(str), state);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateStatusWithString: function Change__updateStatusWithString(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);
|
||||||
|
|
@ -154,7 +154,7 @@ var Change = {
|
||||||
this._dialog.getButton("finish").disabled = false;
|
this._dialog.getButton("finish").disabled = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
doChangePassphrase: function Change_doChangePassphrase() {
|
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 Change_doChangePassword() {
|
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()) {
|
||||||
|
|
@ -228,7 +228,7 @@ var Change = {
|
||||||
this._dialog.getButton("finish").disabled = !valid;
|
this._dialog.getButton("finish").disabled = !valid;
|
||||||
},
|
},
|
||||||
|
|
||||||
_str: function Change__string(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() {
|
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,7 +24,7 @@ var gSyncQuota = {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
|
|
||||||
loadData: function loadData() {
|
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;
|
||||||
|
|
@ -57,7 +57,7 @@ var gSyncQuota = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onCancel: function onCancel() {
|
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() {
|
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 convertKB(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() {
|
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 _collectionTitle(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 displayUsageData(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 onTreeClick(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 toggle(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() {
|
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) {
|
||||||
|
|
@ -228,7 +228,7 @@ var gUsageTreeView = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setTree: function setTree(tree) {
|
setTree: function(tree) {
|
||||||
this.treeBox = tree;
|
this.treeBox = tree;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ var gSyncSetup = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPassphrase: function resetPassphrase() {
|
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;
|
||||||
|
|
@ -281,7 +281,7 @@ var gSyncSetup = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onPINInput: function onPINInput(textbox) {
|
onPINInput: 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();
|
||||||
}
|
}
|
||||||
|
|
@ -595,21 +595,21 @@ var gSyncSetup = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
startPairing: function startPairing() {
|
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;
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
|
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
|
||||||
onPaired: function onPaired() {
|
onPaired: function() {
|
||||||
self.wizard.pageIndex = INTRO_PAGE;
|
self.wizard.pageIndex = INTRO_PAGE;
|
||||||
},
|
},
|
||||||
onComplete: function onComplete() {
|
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 onAbort(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() {
|
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
|
||||||
|
|
@ -660,15 +660,15 @@ var gSyncSetup = {
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
this._jpakeclient = new Weave.JPAKEClient({
|
this._jpakeclient = new Weave.JPAKEClient({
|
||||||
displayPIN: function displayPIN(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() {},
|
onPairingStart: function() {},
|
||||||
|
|
||||||
onComplete: function onComplete(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 onAbort(error) {
|
onAbort: function(error) {
|
||||||
delete self._jpakeclient;
|
delete self._jpakeclient;
|
||||||
|
|
||||||
// Ignore if wizard is aborted.
|
// Ignore if wizard is aborted.
|
||||||
|
|
@ -1017,7 +1017,7 @@ var gSyncSetup = {
|
||||||
this._setFeedback(element, success, str);
|
this._setFeedback(element, success, str);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadCaptcha: function loadCaptcha() {
|
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);
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,13 @@ var gSyncUtils = {
|
||||||
openUILinkIn(url, "tab");
|
openUILinkIn(url, "tab");
|
||||||
},
|
},
|
||||||
|
|
||||||
changeName: function changeName(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 openChange(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) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@
|
||||||
#ifdef HAVE_MAKENSISU
|
#ifdef HAVE_MAKENSISU
|
||||||
@BINPATH@/uninstall/helper.exe
|
@BINPATH@/uninstall/helper.exe
|
||||||
#endif
|
#endif
|
||||||
@RESPATH@/update.locale
|
|
||||||
#ifdef MOZ_UPDATER
|
#ifdef MOZ_UPDATER
|
||||||
@RESPATH@/updater.ini
|
@RESPATH@/updater.ini
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ function _handleEvent(aEvent) {
|
||||||
|
|
||||||
// Methods that impact a browser. Put into single object for organization.
|
// Methods that impact a browser. Put into single object for organization.
|
||||||
var BrowserHelper = {
|
var BrowserHelper = {
|
||||||
onOpen: function NP_BH_onOpen(aBrowser) {
|
onOpen: function(aBrowser) {
|
||||||
_priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL);
|
_priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL);
|
||||||
|
|
||||||
// If the tab is in the focused window, leave priority as it is
|
// If the tab is in the focused window, leave priority as it is
|
||||||
|
|
@ -78,7 +78,7 @@ var BrowserHelper = {
|
||||||
this.decreasePriority(aBrowser);
|
this.decreasePriority(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function NP_BH_onSelect(aBrowser) {
|
onSelect: function(aBrowser) {
|
||||||
let windowEntry = WindowHelper.getEntry(aBrowser.ownerGlobal);
|
let windowEntry = WindowHelper.getEntry(aBrowser.ownerGlobal);
|
||||||
if (windowEntry.lastSelectedBrowser)
|
if (windowEntry.lastSelectedBrowser)
|
||||||
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
||||||
|
|
@ -91,13 +91,13 @@ var BrowserHelper = {
|
||||||
aBrowser.setPriority(_priorityBackup.get(aBrowser.permanentKey));
|
aBrowser.setPriority(_priorityBackup.get(aBrowser.permanentKey));
|
||||||
},
|
},
|
||||||
|
|
||||||
increasePriority: function NP_BH_increasePriority(aBrowser) {
|
increasePriority: function(aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA);
|
aBrowser.adjustPriority(PRIORITY_DELTA);
|
||||||
_priorityBackup.set(aBrowser.permanentKey,
|
_priorityBackup.set(aBrowser.permanentKey,
|
||||||
_priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA);
|
_priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA);
|
||||||
},
|
},
|
||||||
|
|
||||||
decreasePriority: function NP_BH_decreasePriority(aBrowser) {
|
decreasePriority: function(aBrowser) {
|
||||||
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
||||||
_priorityBackup.set(aBrowser.permanentKey,
|
_priorityBackup.set(aBrowser.permanentKey,
|
||||||
_priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA);
|
_priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA);
|
||||||
|
|
@ -107,7 +107,7 @@ var BrowserHelper = {
|
||||||
|
|
||||||
// Methods that impact a window. Put into single object for organization.
|
// Methods that impact a window. Put into single object for organization.
|
||||||
var WindowHelper = {
|
var WindowHelper = {
|
||||||
addWindow: function NP_WH_addWindow(aWindow) {
|
addWindow: function(aWindow) {
|
||||||
// Build internal data object
|
// Build internal data object
|
||||||
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ var WindowHelper = {
|
||||||
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeWindow: function NP_WH_removeWindow(aWindow) {
|
removeWindow: function(aWindow) {
|
||||||
if (aWindow == _lastFocusedWindow)
|
if (aWindow == _lastFocusedWindow)
|
||||||
_lastFocusedWindow = null;
|
_lastFocusedWindow = null;
|
||||||
|
|
||||||
|
|
@ -146,7 +146,7 @@ var WindowHelper = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onActivate: function NP_WH_onActivate(aWindow, aHasFocus) {
|
onActivate: function(aWindow, aHasFocus) {
|
||||||
// If this window was the last focused window, we don't need to do anything
|
// If this window was the last focused window, we don't need to do anything
|
||||||
if (aWindow == _lastFocusedWindow)
|
if (aWindow == _lastFocusedWindow)
|
||||||
return;
|
return;
|
||||||
|
|
@ -158,7 +158,7 @@ var WindowHelper = {
|
||||||
this.increasePriority(aWindow);
|
this.increasePriority(aWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleFocusedWindow: function NP_WH_handleFocusedWindow(aWindow) {
|
handleFocusedWindow: function(aWindow) {
|
||||||
// If we have a last focused window, we need to deprioritize it first
|
// If we have a last focused window, we need to deprioritize it first
|
||||||
if (_lastFocusedWindow)
|
if (_lastFocusedWindow)
|
||||||
this.decreasePriority(_lastFocusedWindow);
|
this.decreasePriority(_lastFocusedWindow);
|
||||||
|
|
@ -168,23 +168,23 @@ var WindowHelper = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Auxiliary methods
|
// Auxiliary methods
|
||||||
increasePriority: function NP_WH_increasePriority(aWindow) {
|
increasePriority: function(aWindow) {
|
||||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||||
BrowserHelper.increasePriority(aBrowser);
|
BrowserHelper.increasePriority(aBrowser);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
decreasePriority: function NP_WH_decreasePriority(aWindow) {
|
decreasePriority: function(aWindow) {
|
||||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||||
BrowserHelper.decreasePriority(aBrowser);
|
BrowserHelper.decreasePriority(aBrowser);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getEntry: function NP_WH_getEntry(aWindow) {
|
getEntry: function(aWindow) {
|
||||||
return _windows[this.getEntryIndex(aWindow)];
|
return _windows[this.getEntryIndex(aWindow)];
|
||||||
},
|
},
|
||||||
|
|
||||||
getEntryIndex: function NP_WH_getEntryAtIndex(aWindow) {
|
getEntryIndex: function(aWindow) {
|
||||||
// Assumes that every object has a unique window & it's in the array
|
// Assumes that every object has a unique window & it's in the array
|
||||||
for (let i = 0; i < _windows.length; i++)
|
for (let i = 0; i < _windows.length; i++)
|
||||||
if (_windows[i].window == aWindow)
|
if (_windows[i].window == aWindow)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ this.RecentWindow = {
|
||||||
* Omit the property to search in both groups.
|
* Omit the property to search in both groups.
|
||||||
* * allowPopups: true if popup windows are permissable.
|
* * allowPopups: true if popup windows are permissable.
|
||||||
*/
|
*/
|
||||||
getMostRecentBrowserWindow: function RW_getMostRecentBrowserWindow(aOptions) {
|
getMostRecentBrowserWindow: function(aOptions) {
|
||||||
let checkPrivacy = typeof aOptions == "object" &&
|
let checkPrivacy = typeof aOptions == "object" &&
|
||||||
"private" in aOptions;
|
"private" in aOptions;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ this.WinTaskbarJumpList =
|
||||||
* Startup, shutdown, and update
|
* Startup, shutdown, and update
|
||||||
*/
|
*/
|
||||||
|
|
||||||
startup: function WTBJL_startup() {
|
startup: function() {
|
||||||
// exit if this isn't win7 or higher.
|
// exit if this isn't win7 or higher.
|
||||||
if (!this._initTaskbar())
|
if (!this._initTaskbar())
|
||||||
return;
|
return;
|
||||||
|
|
@ -173,7 +173,7 @@ this.WinTaskbarJumpList =
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function WTBJL_update() {
|
update: function() {
|
||||||
// are we disabled via prefs? don't do anything!
|
// are we disabled via prefs? don't do anything!
|
||||||
if (!this._enabled)
|
if (!this._enabled)
|
||||||
return;
|
return;
|
||||||
|
|
@ -182,7 +182,7 @@ this.WinTaskbarJumpList =
|
||||||
this._buildList();
|
this._buildList();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shutdown: function WTBJL__shutdown() {
|
_shutdown: function() {
|
||||||
this._shuttingDown = true;
|
this._shuttingDown = true;
|
||||||
|
|
||||||
// Correctly handle a clear history on shutdown. If there are no
|
// Correctly handle a clear history on shutdown. If there are no
|
||||||
|
|
@ -195,7 +195,7 @@ this.WinTaskbarJumpList =
|
||||||
this._free();
|
this._free();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shortcutMaintenance: function WTBJL__maintenace() {
|
_shortcutMaintenance: function() {
|
||||||
_winShellService.shortcutMaintenance();
|
_winShellService.shortcutMaintenance();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -210,11 +210,11 @@ this.WinTaskbarJumpList =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_pendingStatements: {},
|
_pendingStatements: {},
|
||||||
_hasPendingStatements: function WTBJL__hasPendingStatements() {
|
_hasPendingStatements: function() {
|
||||||
return Object.keys(this._pendingStatements).length > 0;
|
return Object.keys(this._pendingStatements).length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildList: function WTBJL__buildList() {
|
_buildList: function() {
|
||||||
if (this._hasPendingStatements()) {
|
if (this._hasPendingStatements()) {
|
||||||
// We were requested to update the list while another update was in
|
// We were requested to update the list while another update was in
|
||||||
// progress, this could happen at shutdown, idle or privatebrowsing.
|
// progress, this could happen at shutdown, idle or privatebrowsing.
|
||||||
|
|
@ -253,7 +253,7 @@ this.WinTaskbarJumpList =
|
||||||
* Taskbar api wrappers
|
* Taskbar api wrappers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_startBuild: function WTBJL__startBuild() {
|
_startBuild: function() {
|
||||||
var removedItems = Cc["@mozilla.org/array;1"].
|
var removedItems = Cc["@mozilla.org/array;1"].
|
||||||
createInstance(Ci.nsIMutableArray);
|
createInstance(Ci.nsIMutableArray);
|
||||||
this._builder.abortListBuild();
|
this._builder.abortListBuild();
|
||||||
|
|
@ -265,13 +265,13 @@ this.WinTaskbarJumpList =
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_commitBuild: function WTBJL__commitBuild() {
|
_commitBuild: function() {
|
||||||
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
||||||
this._builder.abortListBuild();
|
this._builder.abortListBuild();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildTasks: function WTBJL__buildTasks() {
|
_buildTasks: function() {
|
||||||
var items = Cc["@mozilla.org/array;1"].
|
var items = Cc["@mozilla.org/array;1"].
|
||||||
createInstance(Ci.nsIMutableArray);
|
createInstance(Ci.nsIMutableArray);
|
||||||
this._tasks.forEach(function (task) {
|
this._tasks.forEach(function (task) {
|
||||||
|
|
@ -286,12 +286,12 @@ this.WinTaskbarJumpList =
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildCustom: function WTBJL__buildCustom(title, items) {
|
_buildCustom: function(title, items) {
|
||||||
if (items.length > 0)
|
if (items.length > 0)
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildFrequent: function WTBJL__buildFrequent() {
|
_buildFrequent: function() {
|
||||||
// If history is empty, just bail out.
|
// If history is empty, just bail out.
|
||||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -331,7 +331,7 @@ this.WinTaskbarJumpList =
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildRecent: function WTBJL__buildRecent() {
|
_buildRecent: function() {
|
||||||
// If history is empty, just bail out.
|
// If history is empty, just bail out.
|
||||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -376,7 +376,7 @@ this.WinTaskbarJumpList =
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_deleteActiveJumpList: function WTBJL__deleteAJL() {
|
_deleteActiveJumpList: function() {
|
||||||
this._builder.deleteActiveList();
|
this._builder.deleteActiveList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -384,7 +384,7 @@ this.WinTaskbarJumpList =
|
||||||
* Jump list item creation helpers
|
* Jump list item creation helpers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_getHandlerAppItem: function WTBJL__getHandlerAppItem(name, description,
|
_getHandlerAppItem: function(name, description,
|
||||||
args, iconIndex,
|
args, iconIndex,
|
||||||
faviconPageUri) {
|
faviconPageUri) {
|
||||||
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
||||||
|
|
@ -406,7 +406,7 @@ this.WinTaskbarJumpList =
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSeparatorItem: function WTBJL__getSeparatorItem() {
|
_getSeparatorItem: function() {
|
||||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
||||||
createInstance(Ci.nsIJumpListSeparator);
|
createInstance(Ci.nsIJumpListSeparator);
|
||||||
return item;
|
return item;
|
||||||
|
|
@ -446,7 +446,7 @@ this.WinTaskbarJumpList =
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearHistory: function WTBJL__clearHistory(items) {
|
_clearHistory: function(items) {
|
||||||
if (!items)
|
if (!items)
|
||||||
return;
|
return;
|
||||||
var URIsToRemove = [];
|
var URIsToRemove = [];
|
||||||
|
|
@ -469,7 +469,7 @@ this.WinTaskbarJumpList =
|
||||||
* Prefs utilities
|
* Prefs utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_refreshPrefs: function WTBJL__refreshPrefs() {
|
_refreshPrefs: function() {
|
||||||
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
||||||
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
||||||
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
||||||
|
|
@ -481,7 +481,7 @@ this.WinTaskbarJumpList =
|
||||||
* Init and shutdown utilities
|
* Init and shutdown utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_initTaskbar: function WTBJL__initTaskbar() {
|
_initTaskbar: function() {
|
||||||
this._builder = _taskbarService.createJumpListBuilder();
|
this._builder = _taskbarService.createJumpListBuilder();
|
||||||
if (!this._builder || !this._builder.available)
|
if (!this._builder || !this._builder.available)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -489,7 +489,7 @@ this.WinTaskbarJumpList =
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initObs: function WTBJL__initObs() {
|
_initObs: function() {
|
||||||
// If the browser is closed while in private browsing mode, the "exit"
|
// If the browser is closed while in private browsing mode, the "exit"
|
||||||
// notification is fired on quit-application-granted.
|
// notification is fired on quit-application-granted.
|
||||||
// History cleanup can happen at profile-change-teardown.
|
// History cleanup can happen at profile-change-teardown.
|
||||||
|
|
@ -498,13 +498,13 @@ this.WinTaskbarJumpList =
|
||||||
_prefs.addObserver("", this, false);
|
_prefs.addObserver("", this, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_freeObs: function WTBJL__freeObs() {
|
_freeObs: function() {
|
||||||
Services.obs.removeObserver(this, "profile-before-change");
|
Services.obs.removeObserver(this, "profile-before-change");
|
||||||
Services.obs.removeObserver(this, "browser:purge-session-history");
|
Services.obs.removeObserver(this, "browser:purge-session-history");
|
||||||
_prefs.removeObserver("", this);
|
_prefs.removeObserver("", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTimer: function WTBJL__updateTimer() {
|
_updateTimer: function() {
|
||||||
if (this._enabled && !this._shuttingDown && !this._timer) {
|
if (this._enabled && !this._shuttingDown && !this._timer) {
|
||||||
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
this._timer.initWithCallback(this,
|
this._timer.initWithCallback(this,
|
||||||
|
|
@ -518,7 +518,7 @@ this.WinTaskbarJumpList =
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasIdleObserver: false,
|
_hasIdleObserver: false,
|
||||||
_updateIdleObserver: function WTBJL__updateIdleObserver() {
|
_updateIdleObserver: function() {
|
||||||
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
||||||
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||||
this._hasIdleObserver = true;
|
this._hasIdleObserver = true;
|
||||||
|
|
@ -529,7 +529,7 @@ this.WinTaskbarJumpList =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_free: function WTBJL__free() {
|
_free: function() {
|
||||||
this._freeObs();
|
this._freeObs();
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
|
|
@ -540,13 +540,13 @@ this.WinTaskbarJumpList =
|
||||||
* Notification handlers
|
* Notification handlers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
notify: function WTBJL_notify(aTimer) {
|
notify: function(aTimer) {
|
||||||
// Add idle observer on the first notification so it doesn't hit startup.
|
// Add idle observer on the first notification so it doesn't hit startup.
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function WTBJL_observe(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ if CONFIG['LIBXUL_SDK']:
|
||||||
|
|
||||||
SOURCES += ['nsBrowserApp.cpp']
|
SOURCES += ['nsBrowserApp.cpp']
|
||||||
|
|
||||||
FINAL_TARGET_FILES += ['blocklist.xml']
|
FINAL_TARGET_FILES += [
|
||||||
|
'blocklist.xml',
|
||||||
|
'ua-update.json'
|
||||||
|
]
|
||||||
FINAL_TARGET_FILES.defaults += ['permissions']
|
FINAL_TARGET_FILES.defaults += ['permissions']
|
||||||
FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js']
|
FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js']
|
||||||
|
|
||||||
|
|
|
||||||
1
application/palemoon/app/ua-update.json
Normal file
1
application/palemoon/app/ua-update.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
||||||
|
|
@ -11,76 +11,68 @@
|
||||||
#define GK_SLICE Gecko/20100101
|
#define GK_SLICE Gecko/20100101
|
||||||
#define FX_SLICE Firefox/@GK_VERSION@
|
#define FX_SLICE Firefox/@GK_VERSION@
|
||||||
|
|
||||||
#ifdef XP_UNIX
|
// %OS_SLICE% macro is resolved at runtime, see MoonchildProductions/UXP/issues/1473
|
||||||
#ifndef XP_MACOSX
|
|
||||||
#define OS_SLICE X11; Linux x86_64;
|
|
||||||
#else
|
|
||||||
#define OS_SLICE Macintosh; Intel Mac OS X 10.11;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define OS_SLICE Windows NT 6.1; WOW64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Special-case AMO
|
// Special-case AMO
|
||||||
// We send the native UA slice now, since they no longer offer any compatible extensions for us.
|
// We send the native UA slice now, since they no longer offer any compatible extensions for us.
|
||||||
// This will result in an "only with Firefox" message which suits us fine, because it's the truth.
|
// This will result in an "only with Firefox" message which suits us fine, because it's the truth.
|
||||||
pref("@GUAO_PREF@.addons.mozilla.org","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.addons.mozilla.org","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
|
|
||||||
// Required for domains that have proven unresponsive to requests from users
|
// Required for domains that have proven unresponsive to requests from users
|
||||||
pref("@GUAO_PREF@.live.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.live.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.msn.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.msn.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.bing.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.bing.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.outlook.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.outlook.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.web.de","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.web.de","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.aol.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.aol.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.calendar.yahoo.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.calendar.yahoo.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.google.com","Mozilla/5.0 (@OS_SLICE@ rv:71.0) @GK_SLICE@ Firefox/71.0 @PM_SLICE@");
|
pref("@GUAO_PREF@.google.com","Mozilla/5.0 (%OS_SLICE% rv:71.0) @GK_SLICE@ Firefox/71.0 @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.googlevideos.com","Mozilla/5.0 (@OS_SLICE@ rv:38.9) @GK_SLICE@ @GRE_VERSION_SLICE@ Firefox/38.9 @PM_SLICE@");
|
pref("@GUAO_PREF@.googlevideos.com","Mozilla/5.0 (%OS_SLICE% rv:38.9) @GK_SLICE@ @GRE_VERSION_SLICE@ Firefox/38.9 @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.gstatic.com","Mozilla/5.0 (@OS_SLICE@ rv:71.0) @GK_SLICE@ Firefox/71.0 @PM_SLICE@");
|
pref("@GUAO_PREF@.gstatic.com","Mozilla/5.0 (%OS_SLICE% rv:71.0) @GK_SLICE@ Firefox/71.0 @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.yahoo.com","Mozilla/5.0 (@OS_SLICE@ rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
pref("@GUAO_PREF@.yahoo.com","Mozilla/5.0 (%OS_SLICE% rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:60.0) @GK_SLICE@ Firefox/60.0 @PM_SLICE@");
|
pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (%OS_SLICE% rv:60.0) @GK_SLICE@ Firefox/60.0 @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.gaming.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0");
|
pref("@GUAO_PREF@.gaming.youtube.com","Mozilla/5.0 (%OS_SLICE% rv:42.0) @GK_SLICE@ Firefox/42.0");
|
||||||
pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (@OS_SLICE@ rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (%OS_SLICE% rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
||||||
|
|
||||||
pref("@GUAO_PREF@.players.brightcove.net","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
|
pref("@GUAO_PREF@.players.brightcove.net","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
|
||||||
|
|
||||||
// The never-ending Facebook debacle...
|
// The never-ending Facebook debacle...
|
||||||
pref("@GUAO_PREF@.facebook.com","Mozilla/5.0 (@OS_SLICE@ rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
pref("@GUAO_PREF@.facebook.com","Mozilla/5.0 (%OS_SLICE% rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.fbcdn.net","Mozilla/5.0 (@OS_SLICE@ rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
pref("@GUAO_PREF@.fbcdn.net","Mozilla/5.0 (%OS_SLICE% rv:99.9) @GK_SLICE@ Firefox/99.9 (Pale Moon)");
|
||||||
|
|
||||||
|
|
||||||
// UA-Sniffing domains below are pending responses from their operators - temp workaround
|
// UA-Sniffing domains below are pending responses from their operators - temp workaround
|
||||||
pref("@GUAO_PREF@.chase.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@");
|
pref("@GUAO_PREF@.chase.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@");
|
||||||
// For Amazon Prime videos
|
// For Amazon Prime videos
|
||||||
pref("@GUAO_PREF@.www.amazon.com","Mozilla/5.0 (@OS_SLICE@ rv:45.9) @GK_SLICE@ Firefox/45.9 (Pale Moon)");
|
pref("@GUAO_PREF@.www.amazon.com","Mozilla/5.0 (%OS_SLICE% rv:45.9) @GK_SLICE@ Firefox/45.9 (Pale Moon)");
|
||||||
// Soundcloud uses Firefox-exclusive combinations of code. Never pass Firefox slice.
|
// Soundcloud uses Firefox-exclusive combinations of code. Never pass Firefox slice.
|
||||||
pref("@GUAO_PREF@.soundcloud.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.soundcloud.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
// Daily motion only likes strict Firefox UAs
|
// Daily motion only likes strict Firefox UAs
|
||||||
pref("@GUAO_PREF@.dailymotion.com","Mozilla/5.0 (@OS_SLICE@ rv:52.0) @GK_SLICE@ Firefox/52.0");
|
pref("@GUAO_PREF@.dailymotion.com","Mozilla/5.0 (%OS_SLICE% rv:52.0) @GK_SLICE@ Firefox/52.0");
|
||||||
|
|
||||||
|
|
||||||
// The following requires native mode. Or it blocks.. "too old firefox", breakage, etc.
|
// The following requires native mode. Or it blocks.. "too old firefox", breakage, etc.
|
||||||
pref("@GUAO_PREF@.deviantart.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.deviantart.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.deviantart.net","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.deviantart.net","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.altibox.dk","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.altibox.dk","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.altibox.no","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.altibox.no","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.firefox.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.firefox.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.mozilla.org","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.mozilla.org","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.mozilla.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.mozilla.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
pref("@GUAO_PREF@.github.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.github.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
|
||||||
|
|
||||||
// UA-Sniffing domains below have indicated no interest in supporting Pale Moon (BOO!)
|
// UA-Sniffing domains below have indicated no interest in supporting Pale Moon (BOO!)
|
||||||
pref("@GUAO_PREF@.humblebundle.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
pref("@GUAO_PREF@.humblebundle.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.privat24.ua","Mozilla/5.0 (@OS_SLICE@ rv:38.0) @GK_SLICE@ Firefox/38.0");
|
pref("@GUAO_PREF@.privat24.ua","Mozilla/5.0 (%OS_SLICE% rv:38.0) @GK_SLICE@ Firefox/38.0");
|
||||||
pref("@GUAO_PREF@.citi.com","Mozilla/5.0 (@OS_SLICE@ rv:57.0) @GK_SLICE@ Firefox/57.0 (Pale Moon)");
|
pref("@GUAO_PREF@.citi.com","Mozilla/5.0 (%OS_SLICE% rv:57.0) @GK_SLICE@ Firefox/57.0 (Pale Moon)");
|
||||||
pref("@GUAO_PREF@.netflix.com","Mozilla/5.0 (@OS_SLICE@ rv:45.9) @GK_SLICE@ Firefox/45.9");
|
pref("@GUAO_PREF@.netflix.com","Mozilla/5.0 (%OS_SLICE% rv:45.9) @GK_SLICE@ Firefox/45.9");
|
||||||
pref("@GUAO_PREF@.netflximg.net","Mozilla/5.0 (@OS_SLICE@ rv:45.9) @GK_SLICE@ Firefox/45.9");
|
pref("@GUAO_PREF@.netflximg.net","Mozilla/5.0 (%OS_SLICE% rv:45.9) @GK_SLICE@ Firefox/45.9");
|
||||||
|
|
||||||
// UA-sniffing domains that are "app/vendor-specific" and do not like Pale Moon
|
// UA-sniffing domains that are "app/vendor-specific" and do not like Pale Moon
|
||||||
pref("@GUAO_PREF@.web.whatsapp.com","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36");
|
pref("@GUAO_PREF@.web.whatsapp.com","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36");
|
||||||
|
|
||||||
// The following domains do not like the Goanna slice
|
// The following domains do not like the Goanna slice
|
||||||
pref("@GUAO_PREF@.hitbox.tv","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@");
|
pref("@GUAO_PREF@.hitbox.tv","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@");
|
||||||
pref("@GUAO_PREF@.yuku.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ @PM_SLICE@");
|
pref("@GUAO_PREF@.yuku.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ @PM_SLICE@");
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@
|
||||||
#ifdef XP_WIN32
|
#ifdef XP_WIN32
|
||||||
@BINPATH@/uninstall/helper.exe
|
@BINPATH@/uninstall/helper.exe
|
||||||
#endif
|
#endif
|
||||||
@RESPATH@/update.locale
|
|
||||||
#ifdef MOZ_UPDATER
|
#ifdef MOZ_UPDATER
|
||||||
@RESPATH@/updater.ini
|
@RESPATH@/updater.ini
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -134,6 +133,7 @@
|
||||||
@BINPATH@/@DLL_PREFIX@mozavcodec@DLL_SUFFIX@
|
@BINPATH@/@DLL_PREFIX@mozavcodec@DLL_SUFFIX@
|
||||||
#endif
|
#endif
|
||||||
@RESPATH@/browser/blocklist.xml
|
@RESPATH@/browser/blocklist.xml
|
||||||
|
@RESPATH@/browser/ua-update.json
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
#ifndef XP_MACOSX
|
#ifndef XP_MACOSX
|
||||||
@RESPATH@/run-mozilla.sh
|
@RESPATH@/run-mozilla.sh
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# UXP Coding Style Guide
|
# UXP Coding Style Guide
|
||||||
While our source tree is currently in a number of different Coding Styles and the general rule applies to adhere to style of surrounding code when you are making changes, it is our goal to unify the style of our source tree and making it adhere to a single style.
|
While our source tree is currently in a number of different Coding Styles and the general rule applies to adhere to style of surrounding code when you are making changes, it is our goal to unify the style of our source tree and making it adhere to a single style.
|
||||||
This document describes the preferred style for new source code files and the preferred style to convert existing files to.
|
This document describes the preferred style for new source code files and the preferred style to convert existing files to.
|
||||||
|
|
||||||
|
|
@ -225,15 +225,257 @@ somelongvariable = somelongexpression ?
|
||||||
|
|
||||||
## JavaScript
|
## JavaScript
|
||||||
Applies to `*.js` and `*.jsm`.
|
Applies to `*.js` and `*.jsm`.
|
||||||
|
### General formatting guidelines
|
||||||
|
- Place function signatures on the same line as js object identifiers, and do not use named function syntax in that case:
|
||||||
|
```JavaScript
|
||||||
|
var myObject = {
|
||||||
|
myIdentifier: function(var1, var2) {
|
||||||
|
...
|
||||||
|
},
|
||||||
|
myIdentifier2: function() {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- Variable initializers should be placed on the variable declaration line if needed.
|
||||||
|
```JavaScript
|
||||||
|
var fwdCommand = document.getElementById("Browser:Forward");
|
||||||
|
```
|
||||||
|
```JavaScript
|
||||||
|
var myObject = {
|
||||||
|
myVariable: null,
|
||||||
|
myString: "Something"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- Avoid placing executed code on the expression line. Preferably brace executed code.
|
||||||
|
|
||||||
|
WRONG:
|
||||||
|
```JavaScript
|
||||||
|
if (a == b) do_something();
|
||||||
|
if (a == b) { do_something(); }
|
||||||
|
```
|
||||||
|
DISCOURAGED:
|
||||||
|
```JavaScript
|
||||||
|
if (a == b)
|
||||||
|
do_something();
|
||||||
|
```
|
||||||
|
CORRECT:
|
||||||
|
```JavaScript
|
||||||
|
if (a == b) {
|
||||||
|
do_something();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- Format in-lined variable functions as if you would format normal functions with the exception of closure: break with the opening brace, followed by code, and closing brace on its own line, followed immediately by any other variables passed in-line.
|
||||||
|
```JavaScript
|
||||||
|
appMenuButton.addEventListener("mousedown", function(event) {
|
||||||
|
if (event.button == 0) {
|
||||||
|
appMenuOpening = new Date();
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
```
|
||||||
|
- Use a single space between `{` `}` braces in empty js objects.
|
||||||
|
|
||||||
|
### Flow control
|
||||||
|
Flow control expressions should follow the following guidelines:
|
||||||
|
- Scopes have their opening braces on the expression line
|
||||||
|
- Scopes have their closing braces on a separate line, indent-aligned with the flow control expression
|
||||||
|
- Any alternative flow control paths are generally started with an expression on the closing brace line. The logic behind this is that you should keep the flow control level visually the same for the executed code blocks with no breaks (a closing brace on its own line means "done").
|
||||||
|
- Case statements are indented by 2 on a new line with the case expression on its own line.
|
||||||
|
- Flow control default scopes are always placed at the bottom.
|
||||||
|
|
||||||
|
#### if..else
|
||||||
|
`if..else` statements example:
|
||||||
|
```JavaScript
|
||||||
|
if (something == somethingelse) {
|
||||||
|
true_case_code here;
|
||||||
|
} else {
|
||||||
|
false_case_code here;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (case1) {
|
||||||
|
case1_code here;
|
||||||
|
} else if (case2) {
|
||||||
|
case2_code here;
|
||||||
|
} else {
|
||||||
|
other_case_code here;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (case1) {
|
||||||
|
case1_code here;
|
||||||
|
} else {
|
||||||
|
if (case2) {
|
||||||
|
case2_code here;
|
||||||
|
}
|
||||||
|
case2_and_other_code here;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
#### for
|
||||||
|
`for` loop example:
|
||||||
|
```JavaScript
|
||||||
|
for (let i = 1; i < max; i++) {
|
||||||
|
loop_code here;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0;; i++) {
|
||||||
|
do_something_with(i);
|
||||||
|
if (i > max) break;
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
#### while
|
||||||
|
`while` loop example:
|
||||||
|
```JavaScript
|
||||||
|
while (something == true) {
|
||||||
|
loop_code here;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
execute_me_at_least_once();
|
||||||
|
...
|
||||||
|
} while (something == true);
|
||||||
|
```
|
||||||
|
#### switch..case
|
||||||
|
`switch..case` flow control example:
|
||||||
|
```JavaScript
|
||||||
|
switch (variable) {
|
||||||
|
case value1:
|
||||||
|
// Comment describing 1
|
||||||
|
code_for_1;
|
||||||
|
code_for_1;
|
||||||
|
break;
|
||||||
|
case value2:
|
||||||
|
code_for_2;
|
||||||
|
code_for_2;
|
||||||
|
// fallthrough
|
||||||
|
case value3:
|
||||||
|
case value4:
|
||||||
|
code_for_3_and_4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
code_for_default;
|
||||||
|
code_for_default;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Alternatively (braced):
|
||||||
|
```JavaScript
|
||||||
|
switch (variable) {
|
||||||
|
case value1: {
|
||||||
|
// Comment describing 1
|
||||||
|
code_for_1;
|
||||||
|
code_for_1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case value2: {
|
||||||
|
code_for_2;
|
||||||
|
code_for_2;
|
||||||
|
// fallthrough
|
||||||
|
}
|
||||||
|
case value3:
|
||||||
|
case value4: {
|
||||||
|
code_for_3_and_4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
code_for_default;
|
||||||
|
code_for_default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### try..catch
|
||||||
|
- When using `try..catch` blocks, the use of optional catch binding is discouraged. Please always include the error variable.
|
||||||
|
|
||||||
|
`try..catch` flow control examples:
|
||||||
|
```JavaScript
|
||||||
|
try {
|
||||||
|
do_something();
|
||||||
|
} catch(e) {
|
||||||
|
handle_error(e);
|
||||||
|
} finally {
|
||||||
|
always();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
do_something();
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
do_something();
|
||||||
|
} finally {
|
||||||
|
always();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
DISCOURAGED
|
||||||
|
```JavaScript
|
||||||
|
try {
|
||||||
|
do_something();
|
||||||
|
} catch {
|
||||||
|
// No error processing
|
||||||
|
do_something_else();
|
||||||
|
}
|
||||||
|
|
||||||
|
// No closing brace on its own line
|
||||||
|
try {
|
||||||
|
do_something();
|
||||||
|
} catch(ex) { }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Long line wrapping
|
||||||
|
If statements on a single line become overly long, they should be split into multiple lines:
|
||||||
|
- Binary operators (including ternary) must be left on their original lines if the line break happens around the operator. The second line should start in the same column as the start of the expression in the first line.
|
||||||
|
- Lists of variables (e.g. when calling or declaring a function) should be split at the wrapping column.
|
||||||
|
- Long OOP calls should be split at the period with the period on the start of the new line, indented to the column of the first object, filling to the wrapping column where possible, including additional terms.
|
||||||
|
- When breaking assignments/operations/logic, break right after the operator (`=`, `+`, `&&`, `||`, etc.)
|
||||||
|
- **Don't break too rigorously**; short additions should be kept on the same line to keep things legible - use common sense and context for flexibility.
|
||||||
|
|
||||||
|
WRONG:
|
||||||
|
```JavaScript
|
||||||
|
somelongobjectname.somelongfunction(
|
||||||
|
var1, var2, var3, var4, var5);
|
||||||
|
|
||||||
|
if (somelongvariable == somelongothervariable
|
||||||
|
|| somelongvariable2 == somelongothervariable2) {
|
||||||
|
|
||||||
|
somelongvariable = somelongexpression ? somevalue1
|
||||||
|
: somevalue2;
|
||||||
|
|
||||||
|
var iShouldntBeUsingThisLongOfAVarName
|
||||||
|
= someValueToAdd + someValueToAdd + someValueToAdd
|
||||||
|
+ someValueToAdd;
|
||||||
|
|
||||||
|
Cu.import("resource:///modules/DownloadsCommon.jsm", {}).
|
||||||
|
DownloadsCommon.initializeAllDataLinks();
|
||||||
|
```
|
||||||
|
CORRECT:
|
||||||
|
```JavaScript
|
||||||
|
somelongobjectname.somelongfunction(var1, var2, var3,
|
||||||
|
var4, var5);
|
||||||
|
|
||||||
|
if (somelongvariable == somelongothervariable ||
|
||||||
|
somelongvariable2 == somelongothervariable2) {
|
||||||
|
|
||||||
|
somelongvariable = somelongexpression ?
|
||||||
|
somevalue1 :
|
||||||
|
somevalue2;
|
||||||
|
|
||||||
|
var iShouldntBeUsingThisLongOfAVarName =
|
||||||
|
someValueToAdd + someValueToAdd + someValueToAdd +
|
||||||
|
someValueToAdd;
|
||||||
|
|
||||||
|
Cu.import("resource:///modules/DownloadsCommon.jsm", {})
|
||||||
|
.DownloadsCommon.initializeAllDataLinks();
|
||||||
|
|
||||||
|
let sessionStartup = Cc["@mozilla.org/browser/sessionstartup;1"]
|
||||||
|
.getService(Ci.nsISessionStartup);
|
||||||
|
```
|
||||||
|
|
||||||
## XUL and other XML-derivatives
|
## XUL and other XML-derivatives
|
||||||
Applies to `*.xul`, `*.html`, `*.xhtml`.
|
Applies to `*.xul`, `*.html`, `*.xhtml`.
|
||||||
|
TODO
|
||||||
## IDL
|
## IDL
|
||||||
Applies to `*.idl`, `*.xpidl` and `*.webidl`.
|
Applies to `*.idl`, `*.xpidl` and `*.webidl`.
|
||||||
|
TODO
|
||||||
<!--stackedit_data:
|
## Python-esque
|
||||||
eyJoaXN0b3J5IjpbMjUzODYzMzMsMjg5MjUwODIsLTQzMjMzNz
|
Applies to `*.py`, `mozbuild` etc.
|
||||||
ExMSw4MzQ2MjYwNDksLTE5MDMyNzE5OTYsLTEwMTIwMjc3ODMs
|
TODO
|
||||||
LTE4MzgzODM5MDIsODA5MjEzNTEyLC01Mzg0MjM4MDAsMzgyNj
|
|
||||||
I3NDYzLDIwODYwMjIwODUsLTE1MjU5MjE2MjIsLTY1OTMzMTA0
|
|
||||||
MCwtNzQwOTE5MDQ1LDE4Njc1NTQxNDJdfQ==
|
|
||||||
-->
|
|
||||||
|
|
|
||||||
|
|
@ -8434,9 +8434,13 @@ UnionBorderBoxes(nsIFrame* aFrame, bool aApplyTransform,
|
||||||
Maybe<nsRect> clipPropClipRect =
|
Maybe<nsRect> clipPropClipRect =
|
||||||
aFrame->GetClipPropClipRect(disp, effects, bounds.Size());
|
aFrame->GetClipPropClipRect(disp, effects, bounds.Size());
|
||||||
|
|
||||||
// Iterate over all children except pop-ups.
|
// Iterate over all children except pop-ups, absolutely positioned children,
|
||||||
|
// fixed-positioned children and floats.
|
||||||
const nsIFrame::ChildListIDs skip(nsIFrame::kPopupList |
|
const nsIFrame::ChildListIDs skip(nsIFrame::kPopupList |
|
||||||
nsIFrame::kSelectPopupList);
|
nsIFrame::kSelectPopupList |
|
||||||
|
nsIFrame::kAbsoluteList |
|
||||||
|
nsIFrame::kFixedList |
|
||||||
|
nsIFrame::kFloatList);
|
||||||
for (nsIFrame::ChildListIterator childLists(aFrame);
|
for (nsIFrame::ChildListIterator childLists(aFrame);
|
||||||
!childLists.IsDone(); childLists.Next()) {
|
!childLists.IsDone(); childLists.Next()) {
|
||||||
if (skip.Contains(childLists.CurrentID())) {
|
if (skip.Contains(childLists.CurrentID())) {
|
||||||
|
|
@ -8446,6 +8450,12 @@ UnionBorderBoxes(nsIFrame* aFrame, bool aApplyTransform,
|
||||||
nsFrameList children = childLists.CurrentList();
|
nsFrameList children = childLists.CurrentList();
|
||||||
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {
|
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {
|
||||||
nsIFrame* child = e.get();
|
nsIFrame* child = e.get();
|
||||||
|
|
||||||
|
if (child->GetType() == nsGkAtoms::placeholderFrame) {
|
||||||
|
// Skip placeholders too.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Note that passing |true| for aApplyTransform when
|
// Note that passing |true| for aApplyTransform when
|
||||||
// child->Combines3DTransformWithAncestors() is incorrect if our
|
// child->Combines3DTransformWithAncestors() is incorrect if our
|
||||||
// aApplyTransform is false... but the opposite would be as
|
// aApplyTransform is false... but the opposite would be as
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ namespace net {
|
||||||
nsIOService* gIOService = nullptr;
|
nsIOService* gIOService = nullptr;
|
||||||
static bool gHasWarnedUploadChannel2;
|
static bool gHasWarnedUploadChannel2;
|
||||||
|
|
||||||
|
static bool gCaptivePortalEnabled = false;
|
||||||
static LazyLogModule gIOServiceLog("nsIOService");
|
static LazyLogModule gIOServiceLog("nsIOService");
|
||||||
#undef LOG
|
#undef LOG
|
||||||
#define LOG(args) MOZ_LOG(gIOServiceLog, LogLevel::Debug, args)
|
#define LOG(args) MOZ_LOG(gIOServiceLog, LogLevel::Debug, args)
|
||||||
|
|
@ -1142,7 +1143,7 @@ nsIOService::SetConnectivityInternal(bool aConnectivity)
|
||||||
mConnectivity = aConnectivity;
|
mConnectivity = aConnectivity;
|
||||||
|
|
||||||
if (mCaptivePortalService) {
|
if (mCaptivePortalService) {
|
||||||
if (aConnectivity && !xpc::AreNonLocalConnectionsDisabled()) {
|
if (aConnectivity && !xpc::AreNonLocalConnectionsDisabled() && gCaptivePortalEnabled) {
|
||||||
// This will also trigger a captive portal check for the new network
|
// This will also trigger a captive portal check for the new network
|
||||||
static_cast<CaptivePortalService*>(mCaptivePortalService.get())->Start();
|
static_cast<CaptivePortalService*>(mCaptivePortalService.get())->Start();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1285,10 +1286,9 @@ nsIOService::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pref || strcmp(pref, NETWORK_CAPTIVE_PORTAL_PREF) == 0) {
|
if (!pref || strcmp(pref, NETWORK_CAPTIVE_PORTAL_PREF) == 0) {
|
||||||
bool captivePortalEnabled;
|
nsresult rv = prefs->GetBoolPref(NETWORK_CAPTIVE_PORTAL_PREF, &gCaptivePortalEnabled);
|
||||||
nsresult rv = prefs->GetBoolPref(NETWORK_CAPTIVE_PORTAL_PREF, &captivePortalEnabled);
|
|
||||||
if (NS_SUCCEEDED(rv) && mCaptivePortalService) {
|
if (NS_SUCCEEDED(rv) && mCaptivePortalService) {
|
||||||
if (captivePortalEnabled && !xpc::AreNonLocalConnectionsDisabled()) {
|
if (gCaptivePortalEnabled && !xpc::AreNonLocalConnectionsDisabled()) {
|
||||||
static_cast<CaptivePortalService*>(mCaptivePortalService.get())->Start();
|
static_cast<CaptivePortalService*>(mCaptivePortalService.get())->Start();
|
||||||
} else {
|
} else {
|
||||||
static_cast<CaptivePortalService*>(mCaptivePortalService.get())->Stop();
|
static_cast<CaptivePortalService*>(mCaptivePortalService.get())->Stop();
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ const PREF_OVERRIDES_ENABLED = "general.useragent.site_specific_overrides";
|
||||||
const DEFAULT_UA = Cc["@mozilla.org/network/protocol;1?name=http"]
|
const DEFAULT_UA = Cc["@mozilla.org/network/protocol;1?name=http"]
|
||||||
.getService(Ci.nsIHttpProtocolHandler)
|
.getService(Ci.nsIHttpProtocolHandler)
|
||||||
.userAgent;
|
.userAgent;
|
||||||
|
const OS_SLICE = Cc["@mozilla.org/network/protocol;1?name=http"]
|
||||||
|
.getService(Ci.nsIHttpProtocolHandler)
|
||||||
|
.oscpu + ";";
|
||||||
const MAX_OVERRIDE_FOR_HOST_CACHE_SIZE = 250;
|
const MAX_OVERRIDE_FOR_HOST_CACHE_SIZE = 250;
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||||
|
|
@ -143,7 +146,7 @@ function getUserAgentFromOverride(override)
|
||||||
if (search && replace) {
|
if (search && replace) {
|
||||||
userAgent = DEFAULT_UA.replace(new RegExp(search, "g"), replace);
|
userAgent = DEFAULT_UA.replace(new RegExp(search, "g"), replace);
|
||||||
} else {
|
} else {
|
||||||
userAgent = override;
|
userAgent = override.replace(/%OS_SLICE%/g, OS_SLICE);
|
||||||
}
|
}
|
||||||
gBuiltUAs.set(override, userAgent);
|
gBuiltUAs.set(override, userAgent);
|
||||||
return userAgent;
|
return userAgent;
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(
|
XPCOMUtils.defineLazyModuleGetter(
|
||||||
this, "FileUtils", "resource://gre/modules/FileUtils.jsm");
|
this, "FileUtils", "resource://gre/modules/FileUtils.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(
|
|
||||||
this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(
|
XPCOMUtils.defineLazyModuleGetter(
|
||||||
this, "OS", "resource://gre/modules/osfile.jsm");
|
this, "OS", "resource://gre/modules/osfile.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(
|
|
||||||
this, "Promise", "resource://gre/modules/Promise.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(
|
XPCOMUtils.defineLazyModuleGetter(
|
||||||
this, "UpdateUtils", "resource://gre/modules/UpdateUtils.jsm");
|
this, "UpdateUtils", "resource://gre/modules/UpdateUtils.jsm");
|
||||||
|
|
||||||
|
|
@ -64,30 +58,6 @@ const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";
|
||||||
|
|
||||||
var gInitialized = false;
|
var gInitialized = false;
|
||||||
|
|
||||||
function readChannel(url) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
let channel = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
|
|
||||||
channel.contentType = "application/json";
|
|
||||||
|
|
||||||
NetUtil.asyncFetch(channel, (inputStream, status) => {
|
|
||||||
if (!Components.isSuccessCode(status)) {
|
|
||||||
reject();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let data = JSON.parse(
|
|
||||||
NetUtil.readInputStreamToString(inputStream, inputStream.available())
|
|
||||||
);
|
|
||||||
resolve(data);
|
|
||||||
});
|
|
||||||
} catch (ex) {
|
|
||||||
reject(new Error("UserAgentUpdates: Could not fetch " + url + " " +
|
|
||||||
ex + "\n" + ex.stack));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.UserAgentUpdates = {
|
this.UserAgentUpdates = {
|
||||||
init: function(callback) {
|
init: function(callback) {
|
||||||
if (gInitialized) {
|
if (gInitialized) {
|
||||||
|
|
|
||||||
|
|
@ -320,5 +320,4 @@ class OmniJarSubFormatter(PiecemealFormatter):
|
||||||
'modules',
|
'modules',
|
||||||
'goanna.js',
|
'goanna.js',
|
||||||
'hyphenation',
|
'hyphenation',
|
||||||
'update.locale',
|
|
||||||
] or path[0] in STARTUP_CACHE_PATHS
|
] or path[0] in STARTUP_CACHE_PATHS
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,6 @@ class TestFormatters(unittest.TestCase):
|
||||||
self.assertTrue(is_resource(base, 'modules/foo.jsm'))
|
self.assertTrue(is_resource(base, 'modules/foo.jsm'))
|
||||||
self.assertTrue(is_resource(base, 'goanna.js'))
|
self.assertTrue(is_resource(base, 'goanna.js'))
|
||||||
self.assertTrue(is_resource(base, 'hyphenation/foo'))
|
self.assertTrue(is_resource(base, 'hyphenation/foo'))
|
||||||
self.assertTrue(is_resource(base, 'update.locale'))
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
is_resource(base, 'jsloader/resource/gre/modules/foo.jsm'))
|
is_resource(base, 'jsloader/resource/gre/modules/foo.jsm'))
|
||||||
self.assertFalse(is_resource(base, 'foo'))
|
self.assertFalse(is_resource(base, 'foo'))
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,7 @@ var Impl = {
|
||||||
|
|
||||||
let updateChannel = null;
|
let updateChannel = null;
|
||||||
try {
|
try {
|
||||||
updateChannel = UpdateUtils.getUpdateChannel(false);
|
updateChannel = UpdateUtils.UpdateChannel;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._log.trace("_getApplicationSection - Unable to get update channel.", e);
|
this._log.trace("_getApplicationSection - Unable to get update channel.", e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1106,7 +1106,7 @@ EnvironmentCache.prototype = {
|
||||||
_updateSettings: function () {
|
_updateSettings: function () {
|
||||||
let updateChannel = null;
|
let updateChannel = null;
|
||||||
try {
|
try {
|
||||||
updateChannel = UpdateUtils.getUpdateChannel(false);
|
updateChannel = UpdateUtils.UpdateChannel;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
this._currentEnvironment.settings = {
|
this._currentEnvironment.settings = {
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ var TelemetryReportingPolicyImpl = {
|
||||||
// use the general minimum policy version.
|
// use the general minimum policy version.
|
||||||
let channel = "";
|
let channel = "";
|
||||||
try {
|
try {
|
||||||
channel = UpdateUtils.getUpdateChannel(false);
|
channel = UpdateUtils.UpdateChannel;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._log.error("minimumPolicyVersion - Unable to retrieve the current channel.");
|
this._log.error("minimumPolicyVersion - Unable to retrieve the current channel.");
|
||||||
return minPolicyVersion;
|
return minPolicyVersion;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,3 @@ chrome-%:
|
||||||
@$(MAKE) -C $(DEPTH)/security/manager/locales/ chrome AB_CD=$*
|
@$(MAKE) -C $(DEPTH)/security/manager/locales/ chrome AB_CD=$*
|
||||||
@$(MAKE) chrome AB_CD=$*
|
@$(MAKE) chrome AB_CD=$*
|
||||||
|
|
||||||
libs:: update.locale
|
|
||||||
sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
%AB_CD%
|
|
||||||
|
|
@ -13,162 +13,86 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
#ifdef XP_WIN
|
||||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
|
||||||
Cu.import("resource://gre/modules/ctypes.jsm");
|
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||||
|
Cu.import("resource://gre/modules/WindowsRegistry.jsm");
|
||||||
|
|
||||||
const FILE_UPDATE_LOCALE = "update.locale";
|
const WINREG_HKLM = Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE;
|
||||||
|
const WINREG_WINNT = "Software\\Microsoft\\Windows NT\\CurrentVersion";
|
||||||
|
#endif
|
||||||
const PREF_APP_DISTRIBUTION = "distribution.id";
|
const PREF_APP_DISTRIBUTION = "distribution.id";
|
||||||
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";
|
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";
|
||||||
const PREF_APP_B2G_VERSION = "b2g.version";
|
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||||
const PREF_APP_UPDATE_CUSTOM = "app.update.custom";
|
const PREF_APP_UPDATE_CUSTOM = "app.update.custom";
|
||||||
const PREF_APP_UPDATE_IMEI_HASH = "app.update.imei_hash";
|
const PREF_APP_UPDATE_IMEI_HASH = "app.update.imei_hash";
|
||||||
|
const PREF_LOCALE = "general.useragent.locale";
|
||||||
|
|
||||||
this.UpdateUtils = {
|
this.UpdateUtils = {
|
||||||
/**
|
get UpdateChannel() {
|
||||||
* Read the update channel from defaults only. We do this to ensure that
|
return Services.prefs.getDefaultBranch(null)
|
||||||
* the channel is tightly coupled with the application and does not apply
|
.getCharPref(PREF_APP_UPDATE_CHANNEL, "@MOZ_UPDATE_CHANNEL@");
|
||||||
* to other instances of the application that may use the same profile.
|
|
||||||
*
|
|
||||||
* @param [optional] aIncludePartners
|
|
||||||
* Whether or not to include the partner bits. Default: true.
|
|
||||||
*/
|
|
||||||
getUpdateChannel(aIncludePartners = true) {
|
|
||||||
let defaults = Services.prefs.getDefaultBranch(null);
|
|
||||||
#expand let channel = defaults.getCharPref("app.update.channel", "__MOZ_UPDATE_CHANNEL__");
|
|
||||||
|
|
||||||
if (aIncludePartners) {
|
|
||||||
try {
|
|
||||||
let partners = Services.prefs.getChildList("app.partner.").sort();
|
|
||||||
if (partners.length) {
|
|
||||||
channel += "-cck";
|
|
||||||
partners.forEach(function (prefName) {
|
|
||||||
channel += "-" + Services.prefs.getCharPref(prefName);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
Cu.reportError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return channel;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get UpdateChannel() {
|
get Locale() {
|
||||||
return this.getUpdateChannel();
|
return Services.prefs.getDefaultBranch(null)
|
||||||
|
.getCharPref(PREF_LOCALE, "en-US");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a URL by replacing %...% values with OS, build and locale specific
|
* Formats a URL by replacing %...% values with OS, build and locale specific
|
||||||
* values.
|
* values.
|
||||||
*
|
*
|
||||||
* @param url
|
* @param aUpdateURL
|
||||||
* The URL to format.
|
* The URL to format.
|
||||||
|
* @param aAdditionalSubsts
|
||||||
* @return The formatted URL.
|
* @return The formatted URL.
|
||||||
*/
|
*/
|
||||||
formatUpdateURL(url) {
|
formatUpdateURL: function(aUpdateURL, aAdditionalSubsts = null) {
|
||||||
url = url.replace(/%ID%/g, Services.appinfo.ID);
|
// We want to be able to accept additional substs but also to have them be able to
|
||||||
url = url.replace(/%PRODUCT%/g, Services.appinfo.name);
|
// override the default ones below
|
||||||
url = url.replace(/%VERSION%/g, Services.appinfo.version);
|
if (aAdditionalSubsts) {
|
||||||
url = url.replace(/%BUILD_ID%/g, Services.appinfo.appBuildID);
|
try {
|
||||||
url = url.replace(/%BUILD_TARGET%/g, Services.appinfo.OS + "_" + this.ABI);
|
aAdditionalSubsts.forEach(([_subst, _value]) => aUpdateURL = aUpdateURL.replace(_subst, _value));
|
||||||
url = url.replace(/%BUILD_SPECIAL%/g, "@MOZ_PKG_SPECIAL@");
|
} catch(ex) {
|
||||||
url = url.replace(/%OS_VERSION%/g, this.OSVersion);
|
Cu.reportError(ex);
|
||||||
url = url.replace(/%WIDGET_TOOLKIT%/g, "@MOZ_WIDGET_TOOLKIT@");
|
}
|
||||||
url = url.replace(/%CHANNEL%/g, this.UpdateChannel);
|
|
||||||
|
|
||||||
if (/%LOCALE%/.test(url)) {
|
|
||||||
url = url.replace(/%LOCALE%/g, this.Locale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
url = url.replace(/%CUSTOM%/g, Preferences.get(PREF_APP_UPDATE_CUSTOM, ""));
|
// appName SHOULD be lower case and not contain spaces even if it has in the past
|
||||||
url = url.replace(/\+/g, "%2B");
|
let appName = Services.appinfo.name.replace(/\s+/g, '').toLowerCase()
|
||||||
|
|
||||||
url = url.replace(/%SYSTEM_CAPABILITIES%/g, gSystemCapabilities);
|
// We want default pref values if they exist
|
||||||
url = url.replace(/%PLATFORM_VERSION%/g, Services.appinfo.platformVersion);
|
let prefBranch = Services.prefs.getDefaultBranch(null)
|
||||||
url = url.replace(/%DISTRIBUTION%/g,
|
let custom = prefBranch.getCharPref(PREF_APP_UPDATE_CUSTOM, "");
|
||||||
getDistributionPrefValue(PREF_APP_DISTRIBUTION));
|
let distribution = prefBranch.getCharPref(PREF_APP_DISTRIBUTION, "default");
|
||||||
url = url.replace(/%DISTRIBUTION_VERSION%/g,
|
let distributionVersion = prefBranch.getCharPref(PREF_APP_DISTRIBUTION_VERSION, "default");
|
||||||
getDistributionPrefValue(PREF_APP_DISTRIBUTION_VERSION));
|
|
||||||
|
|
||||||
return url;
|
let substs = [
|
||||||
|
[/%ID%/g, Services.appinfo.ID],
|
||||||
|
[/%PRODUCT%/g, appName],
|
||||||
|
[/%VERSION%/g, Services.appinfo.version],
|
||||||
|
[/%BUILD_ID%/g, Services.appinfo.appBuildID],
|
||||||
|
[/%BUILD_TARGET%/g, Services.appinfo.OS + "_" + this.ABI],
|
||||||
|
[/%BUILD_SPECIAL%/g, "@MOZ_PKG_SPECIAL@"],
|
||||||
|
[/%OS_VERSION%/g, this.OSVersion],
|
||||||
|
[/%WIDGET_TOOLKIT%/g, "@MOZ_WIDGET_TOOLKIT@"],
|
||||||
|
[/%CHANNEL%/g, this.UpdateChannel],
|
||||||
|
[/%CUSTOM%/g, custom],
|
||||||
|
[/%PLATFORM_VERSION%/g, Services.appinfo.platformVersion],
|
||||||
|
[/%DISTRIBUTION%/g, distribution],
|
||||||
|
[/%DISTRIBUTION_VERSION%/g, distributionVersion],
|
||||||
|
[/%LOCALE%/g, this.Locale]
|
||||||
|
];
|
||||||
|
|
||||||
|
substs.forEach(([_subst, _value]) => aUpdateURL = aUpdateURL.replace(_subst, _value));
|
||||||
|
|
||||||
|
// We do this last to make sure all pluses are converted
|
||||||
|
aUpdateURL = aUpdateURL.replace(/\+/g, "%2B");
|
||||||
|
|
||||||
|
return aUpdateURL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get the distribution pref values, from defaults only */
|
|
||||||
function getDistributionPrefValue(aPrefName) {
|
|
||||||
return prefValue = Services.prefs.getDefaultBranch(null).getCharPref(aPrefName, "default");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the locale from the update.locale file for replacing %LOCALE% in the
|
|
||||||
* update url. The update.locale file can be located in the application
|
|
||||||
* directory or the GRE directory with preference given to it being located in
|
|
||||||
* the application directory.
|
|
||||||
*/
|
|
||||||
XPCOMUtils.defineLazyGetter(UpdateUtils, "Locale", function() {
|
|
||||||
let channel;
|
|
||||||
let locale;
|
|
||||||
for (let res of ['app', 'gre']) {
|
|
||||||
channel = NetUtil.newChannel({
|
|
||||||
uri: "resource://" + res + "/" + FILE_UPDATE_LOCALE,
|
|
||||||
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_XMLHTTPREQUEST,
|
|
||||||
loadUsingSystemPrincipal: true
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
let inputStream = channel.open2();
|
|
||||||
locale = NetUtil.readInputStreamToString(inputStream, inputStream.available());
|
|
||||||
} catch (e) {}
|
|
||||||
if (locale)
|
|
||||||
return locale.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
Cu.reportError(FILE_UPDATE_LOCALE + " file doesn't exist in either the " +
|
|
||||||
"application or GRE directories");
|
|
||||||
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides adhoc system capability information for application update.
|
|
||||||
*/
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "gSystemCapabilities", function aus_gSC() {
|
|
||||||
#ifdef XP_WIN
|
|
||||||
const PF_MMX_INSTRUCTIONS_AVAILABLE = 3; // MMX
|
|
||||||
const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; // SSE
|
|
||||||
const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10; // SSE2
|
|
||||||
const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13; // SSE3
|
|
||||||
|
|
||||||
let lib = ctypes.open("kernel32.dll");
|
|
||||||
let IsProcessorFeaturePresent = lib.declare("IsProcessorFeaturePresent",
|
|
||||||
ctypes.winapi_abi,
|
|
||||||
ctypes.int32_t, /* success */
|
|
||||||
ctypes.uint32_t); /* DWORD */
|
|
||||||
let instructionSet = "unknown";
|
|
||||||
try {
|
|
||||||
if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) {
|
|
||||||
instructionSet = "SSE3";
|
|
||||||
} else if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) {
|
|
||||||
instructionSet = "SSE2";
|
|
||||||
} else if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) {
|
|
||||||
instructionSet = "SSE";
|
|
||||||
} else if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE)) {
|
|
||||||
instructionSet = "MMX";
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
instructionSet = "error";
|
|
||||||
Cu.reportError("Error getting processor instruction set. " +
|
|
||||||
"Exception: " + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
lib.close();
|
|
||||||
return instructionSet;
|
|
||||||
#else
|
|
||||||
return "NA"
|
|
||||||
#endif
|
|
||||||
});
|
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
/* Windows only getter that returns the processor architecture. */
|
/* Windows only getter that returns the processor architecture. */
|
||||||
XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
|
XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
|
||||||
|
|
@ -182,24 +106,24 @@ XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
|
||||||
// http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
|
// http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
|
||||||
const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
|
const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
|
||||||
[
|
[
|
||||||
{wProcessorArchitecture: WORD},
|
{wProcessorArchitecture: WORD},
|
||||||
{wReserved: WORD},
|
{wReserved: WORD},
|
||||||
{dwPageSize: DWORD},
|
{dwPageSize: DWORD},
|
||||||
{lpMinimumApplicationAddress: ctypes.voidptr_t},
|
{lpMinimumApplicationAddress: ctypes.voidptr_t},
|
||||||
{lpMaximumApplicationAddress: ctypes.voidptr_t},
|
{lpMaximumApplicationAddress: ctypes.voidptr_t},
|
||||||
{dwActiveProcessorMask: DWORD.ptr},
|
{dwActiveProcessorMask: DWORD.ptr},
|
||||||
{dwNumberOfProcessors: DWORD},
|
{dwNumberOfProcessors: DWORD},
|
||||||
{dwProcessorType: DWORD},
|
{dwProcessorType: DWORD},
|
||||||
{dwAllocationGranularity: DWORD},
|
{dwAllocationGranularity: DWORD},
|
||||||
{wProcessorLevel: WORD},
|
{wProcessorLevel: WORD},
|
||||||
{wProcessorRevision: WORD}
|
{wProcessorRevision: WORD}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let kernel32 = false;
|
let kernel32 = false;
|
||||||
try {
|
try {
|
||||||
kernel32 = ctypes.open("Kernel32");
|
kernel32 = ctypes.open("Kernel32");
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
Cu.reportError("Unable to open kernel32! Exception: " + e);
|
Cu.reportError("Unable to open kernel32! Exception: " + ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kernel32) {
|
if (kernel32) {
|
||||||
|
|
@ -224,9 +148,9 @@ XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
|
||||||
arch = "x86";
|
arch = "x86";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
Cu.reportError("Error getting processor architecture. " +
|
Cu.reportError("Error getting processor architecture. " +
|
||||||
"Exception: " + e);
|
"Exception: " + ex);
|
||||||
} finally {
|
} finally {
|
||||||
kernel32.close();
|
kernel32.close();
|
||||||
}
|
}
|
||||||
|
|
@ -240,8 +164,7 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() {
|
||||||
let abi = null;
|
let abi = null;
|
||||||
try {
|
try {
|
||||||
abi = Services.appinfo.XPCOMABI;
|
abi = Services.appinfo.XPCOMABI;
|
||||||
}
|
} catch (ex) {
|
||||||
catch (e) {
|
|
||||||
Cu.reportError("XPCOM ABI unknown");
|
Cu.reportError("XPCOM ABI unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,101 +187,34 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() {
|
||||||
try {
|
try {
|
||||||
osVersion = Services.sysinfo.getProperty("name") + " " +
|
osVersion = Services.sysinfo.getProperty("name") + " " +
|
||||||
Services.sysinfo.getProperty("version");
|
Services.sysinfo.getProperty("version");
|
||||||
}
|
} catch(ex) {
|
||||||
catch (e) {
|
|
||||||
Cu.reportError("OS Version unknown.");
|
Cu.reportError("OS Version unknown.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
if (osVersion) {
|
if (osVersion) {
|
||||||
const BYTE = ctypes.uint8_t;
|
let currentBuild = WindowsRegistry.readRegKey(WINREG_HKLM, WINREG_WINNT, "CurrentBuild");
|
||||||
const WORD = ctypes.uint16_t;
|
let CSDBuildNumber = WindowsRegistry.readRegKey(WINREG_HKLM, WINREG_WINNT, "CSDBuildNumber");
|
||||||
const DWORD = ctypes.uint32_t;
|
|
||||||
const WCHAR = ctypes.char16_t;
|
if (!CSDBuildNumber) {
|
||||||
const BOOL = ctypes.int;
|
CSDBuildNumber = "0";
|
||||||
|
|
||||||
// This structure is described at:
|
|
||||||
// http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
|
|
||||||
const SZCSDVERSIONLENGTH = 128;
|
|
||||||
const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
|
|
||||||
[
|
|
||||||
{dwOSVersionInfoSize: DWORD},
|
|
||||||
{dwMajorVersion: DWORD},
|
|
||||||
{dwMinorVersion: DWORD},
|
|
||||||
{dwBuildNumber: DWORD},
|
|
||||||
{dwPlatformId: DWORD},
|
|
||||||
{szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
|
|
||||||
{wServicePackMajor: WORD},
|
|
||||||
{wServicePackMinor: WORD},
|
|
||||||
{wSuiteMask: WORD},
|
|
||||||
{wProductType: BYTE},
|
|
||||||
{wReserved: BYTE}
|
|
||||||
]);
|
|
||||||
|
|
||||||
// This structure is described at:
|
|
||||||
// http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
|
|
||||||
const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
|
|
||||||
[
|
|
||||||
{wProcessorArchitecture: WORD},
|
|
||||||
{wReserved: WORD},
|
|
||||||
{dwPageSize: DWORD},
|
|
||||||
{lpMinimumApplicationAddress: ctypes.voidptr_t},
|
|
||||||
{lpMaximumApplicationAddress: ctypes.voidptr_t},
|
|
||||||
{dwActiveProcessorMask: DWORD.ptr},
|
|
||||||
{dwNumberOfProcessors: DWORD},
|
|
||||||
{dwProcessorType: DWORD},
|
|
||||||
{dwAllocationGranularity: DWORD},
|
|
||||||
{wProcessorLevel: WORD},
|
|
||||||
{wProcessorRevision: WORD}
|
|
||||||
]);
|
|
||||||
|
|
||||||
let kernel32 = false;
|
|
||||||
try {
|
|
||||||
kernel32 = ctypes.open("Kernel32");
|
|
||||||
} catch (e) {
|
|
||||||
Cu.reportError("Unable to open kernel32! " + e);
|
|
||||||
osVersion += ".unknown (unknown)";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kernel32) {
|
osVersion = osVersion.replace(/Windows_NT/g, "WINNT");
|
||||||
try {
|
osVersion += "." + currentBuild + "." + CSDBuildNumber
|
||||||
// Get Service pack info
|
|
||||||
try {
|
|
||||||
let GetVersionEx = kernel32.declare("GetVersionExW",
|
|
||||||
ctypes.default_abi,
|
|
||||||
BOOL,
|
|
||||||
OSVERSIONINFOEXW.ptr);
|
|
||||||
let winVer = OSVERSIONINFOEXW();
|
|
||||||
winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
|
|
||||||
|
|
||||||
if (0 !== GetVersionEx(winVer.address())) {
|
// Add processor architecture
|
||||||
osVersion += "." + winVer.wServicePackMajor +
|
osVersion += " (" + gWinCPUArch + ")";
|
||||||
"." + winVer.wServicePackMinor;
|
|
||||||
} else {
|
|
||||||
Cu.reportError("Unknown failure in GetVersionEX (returned 0)");
|
|
||||||
osVersion += ".unknown";
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
Cu.reportError("Error getting service pack information. Exception: " + e);
|
|
||||||
osVersion += ".unknown";
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
kernel32.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add processor architecture
|
|
||||||
osVersion += " (" + gWinCPUArch + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
try {
|
try {
|
||||||
osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")";
|
osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")";
|
||||||
}
|
} catch(ex) {
|
||||||
catch (e) {
|
|
||||||
// Not all platforms have a secondary widget library, so an error is nothing to worry about.
|
// Not all platforms have a secondary widget library, so an error is nothing to worry about.
|
||||||
}
|
}
|
||||||
|
|
||||||
osVersion = encodeURIComponent(osVersion);
|
osVersion = encodeURIComponent(osVersion);
|
||||||
#endif
|
|
||||||
|
|
||||||
return osVersion;
|
return osVersion;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ NON_CHROME = set([
|
||||||
'hyphenation',
|
'hyphenation',
|
||||||
'defaults/profile',
|
'defaults/profile',
|
||||||
'defaults/pref*/*-l10n.js',
|
'defaults/pref*/*-l10n.js',
|
||||||
'update.locale',
|
|
||||||
'updater.ini',
|
'updater.ini',
|
||||||
'extensions/langpack-*@*',
|
'extensions/langpack-*@*',
|
||||||
'distribution/extensions/langpack-*@*',
|
'distribution/extensions/langpack-*@*',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue