diff options
Diffstat (limited to 'application/palemoon/base')
25 files changed, 600 insertions, 565 deletions
diff --git a/application/palemoon/base/content/autorecovery.js b/application/palemoon/base/content/autorecovery.js index 29ccaed3f..01a092f5c 100644 --- a/application/palemoon/base/content/autorecovery.js +++ b/application/palemoon/base/content/autorecovery.js @@ -10,9 +10,9 @@ * have been properly initialized already. */ -let Cc = Components.classes; -let Ci = Components.interfaces; -let Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; // Services = object with smart getters for common XPCOM services Cu.import("resource://gre/modules/Services.jsm"); diff --git a/application/palemoon/base/content/baseMenuOverlay.xul b/application/palemoon/base/content/baseMenuOverlay.xul index c6c1b16dc..f61348c9f 100644 --- a/application/palemoon/base/content/baseMenuOverlay.xul +++ b/application/palemoon/base/content/baseMenuOverlay.xul @@ -29,7 +29,7 @@ <menuitem id="menu_mac_show_all" label="&showAllAppsCmdMac.label;"/> </menupopup> <!-- Mac window menu --> -#include ../../../toolkit/content/macWindowMenu.inc +#include ../../../../toolkit/content/macWindowMenu.inc #endif #ifdef XP_WIN diff --git a/application/palemoon/base/content/browser-appmenu.inc b/application/palemoon/base/content/browser-appmenu.inc index 835bf22bc..cfc855484 100644 --- a/application/palemoon/base/content/browser-appmenu.inc +++ b/application/palemoon/base/content/browser-appmenu.inc @@ -132,38 +132,8 @@ </splitmenu> <menuseparator class="appmenu-menuseparator"/> <splitmenu id="appmenu_webDeveloper" - command="Tools:DevToolbox" label="&appMenuWebDeveloper.label;"> <menupopup id="appmenu_webDeveloper_popup"> -#ifdef MOZ_DEVTOOLS - <menuitem id="appmenu_devToolbox" - observes="devtoolsMenuBroadcaster_DevToolbox"/> - <menuseparator id="appmenu_devtools_separator"/> - <menuitem id="appmenu_devToolbar" - observes="devtoolsMenuBroadcaster_DevToolbar"/> - <menuitem id="appmenu_chromeDebugger" - observes="devtoolsMenuBroadcaster_ChromeDebugger"/> - <menuitem id="appmenu_browserConsole" - observes="devtoolsMenuBroadcaster_BrowserConsole"/> - <menuitem id="appmenu_responsiveUI" - observes="devtoolsMenuBroadcaster_ResponsiveUI"/> - <menuitem id="appmenu_eyedropper" - observes="devtoolsMenuBroadcaster_Eyedropper"/> - <menuitem id="appmenu_scratchpad" - observes="devtoolsMenuBroadcaster_Scratchpad"/> -#endif - <menuitem id="appmenu_pageSource" - observes="devtoolsMenuBroadcaster_PageSource"/> - <menuitem id="appmenu_errorConsole" - observes="devtoolsMenuBroadcaster_ErrorConsole"/> -#ifdef MOZ_DEVTOOLS - <menuitem id="appmenu_devtools_connect" - observes="devtoolsMenuBroadcaster_connect"/> -#endif - <menuseparator id="appmenu_devToolsEndSeparator"/> - <menuitem id="appmenu_getMoreDevtools" - observes="devtoolsMenuBroadcaster_GetMoreTools"/> - <menuseparator/> #define ID_PREFIX appmenu_developer_ #define OMIT_ACCESSKEYS #include browser-charsetmenu.inc @@ -173,6 +143,11 @@ type="checkbox" observes="workOfflineMenuitemState" oncommand="BrowserOffline.toggleOfflineStatus();"/> + <menuseparator/> + <menuitem id="appmenu_pageSource" + observes="devtoolsMenuBroadcaster_PageSource"/> + <menuitem id="appmenu_javascriptConsole" + observes="devtoolsMenuBroadcaster_ErrorConsole"/> </menupopup> </splitmenu> <menuseparator class="appmenu-menuseparator"/> diff --git a/application/palemoon/base/content/browser-devtools-theme.js b/application/palemoon/base/content/browser-devtools-theme.js new file mode 100644 index 000000000..7b21ddedc --- /dev/null +++ b/application/palemoon/base/content/browser-devtools-theme.js @@ -0,0 +1,91 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Listeners for the DevTools theme. + */ +var DevToolsTheme = { + _devtoolsThemePrefName: "devtools.theme", + styleSheet: null, + initialized: false, + + get isStyleSheetEnabled() { + return this.styleSheet && !this.styleSheet.sheet.disabled; + }, + + init: function () { + this.initialized = true; + Services.prefs.addObserver(this._devtoolsThemePrefName, this, false); + Services.obs.addObserver(this, "lightweight-theme-styling-update", false); + Services.obs.addObserver(this, "lightweight-theme-window-updated", false); + this._updateDevtoolsThemeAttribute(); + }, + + observe: function (subject, topic, data) { + if (topic == "lightweight-theme-styling-update") { + let newTheme = JSON.parse(data); + this._toggleStyleSheet(); + } + + if (topic == "nsPref:changed" && data == this._devtoolsThemePrefName) { + this._updateDevtoolsThemeAttribute(); + } + }, + + _inferBrightness: function() { + ToolbarIconColor.inferFromText(); + // Get an inverted full screen button if the dark theme is applied. + if (this.isStyleSheetEnabled && + document.documentElement.getAttribute("devtoolstheme") == "dark") { + document.documentElement.setAttribute("brighttitlebarforeground", "true"); + } else { + document.documentElement.removeAttribute("brighttitlebarforeground"); + } + }, + + _updateDevtoolsThemeAttribute: function() { + // Set an attribute on root element to make it possible + // to change colors based on the selected devtools theme. + let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName); + if (devtoolsTheme != "dark") { + devtoolsTheme = "light"; + } + document.documentElement.setAttribute("devtoolstheme", devtoolsTheme); + this._inferBrightness(); + }, + + handleEvent: function(e) { + if (e.type === "load") { + this.styleSheet.removeEventListener("load", this); + this.refreshBrowserDisplay(); + } + }, + + refreshBrowserDisplay: function() { + // Don't touch things on the browser if gBrowserInit.onLoad hasn't + // yet fired. + if (this.initialized) { + gBrowser.tabContainer._positionPinnedTabs(); + this._inferBrightness(); + } + }, + + _toggleStyleSheet: function() { + let wasEnabled = this.isStyleSheetEnabled; + if (wasEnabled) { + this.styleSheet.sheet.disabled = true; + this.refreshBrowserDisplay(); + } + }, + + uninit: function () { + Services.prefs.removeObserver(this._devtoolsThemePrefName, this); + Services.obs.removeObserver(this, "lightweight-theme-styling-update", false); + Services.obs.removeObserver(this, "lightweight-theme-window-updated", false); + if (this.styleSheet) { + this.styleSheet.removeEventListener("load", this); + } + this.styleSheet = null; + } +}; diff --git a/application/palemoon/base/content/browser-fullScreen.js b/application/palemoon/base/content/browser-fullScreen.js index b8a29199e..400340e77 100644 --- a/application/palemoon/base/content/browser-fullScreen.js +++ b/application/palemoon/base/content/browser-fullScreen.js @@ -304,7 +304,7 @@ var FullScreen = { }, _cancelAnimation: function() { - window.mozCancelAnimationFrame(this._animationHandle); + window.cancelAnimationFrame(this._animationHandle); this._animationHandle = 0; clearTimeout(this._animationTimeout); this._isAnimating = false; diff --git a/application/palemoon/base/content/browser-fullZoom.js b/application/palemoon/base/content/browser-fullZoom.js index 0837bf7c2..890cd8440 100644 --- a/application/palemoon/base/content/browser-fullZoom.js +++ b/application/palemoon/base/content/browser-fullZoom.js @@ -1,14 +1,6 @@ -/* -#ifdef 0 - * This Source Code Form is subject to the terms of the Mozilla Public +/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. -#endif - */ - -// One of the possible values for the mousewheel.* preferences. -// From nsEventStateManager.cpp. -const MOUSE_SCROLL_ZOOM = 3; + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * Controls the "full zoom" setting and its site-specific preferences. @@ -36,7 +28,6 @@ var FullZoom = { return this._siteSpecificPref; }, - //**************************************************************************// // nsISupports QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener, @@ -45,12 +36,10 @@ var FullZoom = { Ci.nsISupportsWeakReference, Ci.nsISupports]), - //**************************************************************************// // Initialization & Destruction init: function FullZoom_init() { - // Listen for scrollwheel events so we can save scrollwheel-based changes. - window.addEventListener("DOMMouseScroll", this, false); + gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this); // Register ourselves with the service so we know when our pref changes. this._cps2 = Cc["@mozilla.org/content-pref/service;1"]. @@ -74,76 +63,30 @@ var FullZoom = { } // This should be nulled after initialization. - this._initialLocations.clear(); this._initialLocations = null; }, destroy: function FullZoom_destroy() { gPrefService.removeObserver("browser.zoom.", this); this._cps2.removeObserverForName(this.name, this); - window.removeEventListener("DOMMouseScroll", this, false); + gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this); }, - //**************************************************************************// // Event Handlers // nsIDOMEventListener handleEvent: function FullZoom_handleEvent(event) { switch (event.type) { - case "DOMMouseScroll": - this._handleMouseScrolled(event); + case "ZoomChangeUsingMouseWheel": + let browser = this._getTargetedBrowser(event); + this._ignorePendingZoomAccesses(browser); + this._applyZoomToPref(browser); break; } }, - _handleMouseScrolled: function FullZoom__handleMouseScrolled(event) { - // Construct the "mousewheel action" pref key corresponding to this event. - // Based on nsEventStateManager::WheelPrefs::GetBasePrefName(). - var pref = "mousewheel."; - - var pressedModifierCount = event.shiftKey + event.ctrlKey + event.altKey + - event.metaKey + event.getModifierState("OS"); - if (pressedModifierCount != 1) { - pref += "default."; - } else if (event.shiftKey) { - pref += "with_shift."; - } else if (event.ctrlKey) { - pref += "with_control."; - } else if (event.altKey) { - pref += "with_alt."; - } else if (event.metaKey) { - pref += "with_meta."; - } else { - pref += "with_win."; - } - - pref += "action"; - - // Don't do anything if this isn't a "zoom" scroll event. - var isZoomEvent = false; - try { - isZoomEvent = (gPrefService.getIntPref(pref) == MOUSE_SCROLL_ZOOM); - } catch (e) {} - if (!isZoomEvent) - return; - - // XXX Lazily cache all the possible action prefs so we don't have to get - // them anew from the pref service for every scroll event? We'd have to - // make sure to observe them so we can update the cache when they change. - - // We have to call _applyZoomToPref in a timeout because we handle the - // event before the event state manager has a chance to apply the zoom - // during nsEventStateManager::PostHandleEvent. - let browser = gBrowser.selectedBrowser; - let token = this._getBrowserToken(browser); - window.setTimeout(function () { - if (token.isCurrent) - this._applyZoomToPref(browser); - }.bind(this), 0); - }, - // nsIObserver observe: function (aSubject, aTopic, aData) { @@ -165,12 +108,12 @@ var FullZoom = { // nsIContentPrefObserver - onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue) { - this._onContentPrefChanged(aGroup, aValue); + onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue, aIsPrivate) { + this._onContentPrefChanged(aGroup, aValue, aIsPrivate); }, - onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName) { - this._onContentPrefChanged(aGroup, undefined); + onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName, aIsPrivate) { + this._onContentPrefChanged(aGroup, undefined, aIsPrivate); }, /** @@ -181,7 +124,7 @@ var FullZoom = { * @param aValue The new value of the changed preference. Pass undefined to * indicate the preference's removal. */ - _onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue) { + _onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue, aIsPrivate) { if (this._isNextContentPrefChangeInternal) { // Ignore changes that FullZoom itself makes. This works because the // content pref service calls callbacks before notifying observers, and it @@ -194,9 +137,10 @@ var FullZoom = { if (!browser.currentURI) return; + let ctxt = this._loadContextFromBrowser(browser); let domain = this._cps2.extractDomain(browser.currentURI.spec); if (aGroup) { - if (aGroup == domain) + if (aGroup == domain && ctxt.usePrivateBrowsing == aIsPrivate) this._applyPrefToZoom(aValue, browser); return; } @@ -208,10 +152,9 @@ var FullZoom = { // zoom should be set to the new global preference now that the global // preference has changed. let hasPref = false; - let ctxt = this._loadContextFromBrowser(browser); let token = this._getBrowserToken(browser); this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, { - handleResult: function () hasPref = true, + handleResult: function () { hasPref = true; }, handleCompletion: function () { if (!hasPref && token.isCurrent) this._applyPrefToZoom(undefined, browser); @@ -234,6 +177,7 @@ var FullZoom = { */ onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) { let browser = aBrowser || gBrowser.selectedBrowser; + // If we haven't been initialized yet but receive an onLocationChange // notification then let's store and replay it upon initialization. if (this._initialLocations) { @@ -247,14 +191,14 @@ var FullZoom = { this._ignorePendingZoomAccesses(browser); if (!aURI || (aIsTabSwitch && !this.siteSpecific)) { - this._notifyOnLocationChange(); + this._notifyOnLocationChange(browser); return; } // Avoid the cps roundtrip and apply the default/global pref. if (aURI.spec == "about:blank") { this._applyPrefToZoom(undefined, browser, - this._notifyOnLocationChange.bind(this)); + this._notifyOnLocationChange.bind(this, browser)); return; } @@ -262,7 +206,7 @@ var FullZoom = { if (!aIsTabSwitch && browser.isSyntheticDocument) { ZoomManager.setZoomForBrowser(browser, 1); // _ignorePendingZoomAccesses already called above, so no need here. - this._notifyOnLocationChange(); + this._notifyOnLocationChange(browser); return; } @@ -271,7 +215,7 @@ var FullZoom = { let pref = this._cps2.getCachedByDomainAndName(aURI.spec, this.name, ctxt); if (pref) { this._applyPrefToZoom(pref.value, browser, - this._notifyOnLocationChange.bind(this)); + this._notifyOnLocationChange.bind(this, browser)); return; } @@ -279,14 +223,14 @@ var FullZoom = { let value = undefined; let token = this._getBrowserToken(browser); this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, { - handleResult: function (resultPref) value = resultPref.value, + handleResult: function (resultPref) { value = resultPref.value; }, handleCompletion: function () { if (!token.isCurrent) { - this._notifyOnLocationChange(); + this._notifyOnLocationChange(browser); return; } this._applyPrefToZoom(value, browser, - this._notifyOnLocationChange.bind(this)); + this._notifyOnLocationChange.bind(this, browser)); }.bind(this) }); }, @@ -299,7 +243,6 @@ var FullZoom = { menuItem.setAttribute("checked", !ZoomManager.useFullZoom); }, - //**************************************************************************// // Setting & Pref Manipulation /** @@ -323,19 +266,32 @@ var FullZoom = { }, /** - * Sets the zoom level of the page in the current browser to the global zoom + * Sets the zoom level for the given browser to the given floating + * point value, where 1 is the default zoom level. + */ + setZoom: function (value, browser = gBrowser.selectedBrowser) { + ZoomManager.setZoomForBrowser(browser, value); + this._ignorePendingZoomAccesses(browser); + this._applyZoomToPref(browser); + }, + + /** + * Sets the zoom level of the page in the given browser to the global zoom * level. + * + * @return A promise which resolves when the zoom reset has been applied. */ - reset: function FullZoom_reset() { - let browser = gBrowser.selectedBrowser; + reset: function FullZoom_reset(browser = gBrowser.selectedBrowser) { let token = this._getBrowserToken(browser); - this._getGlobalValue(browser, function (value) { + let result = this._getGlobalValue(browser).then(value => { if (token.isCurrent) { ZoomManager.setZoomForBrowser(browser, value === undefined ? 1 : value); this._ignorePendingZoomAccesses(browser); + Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", ""); } }); this._removePref(browser); + return result; }, /** @@ -383,7 +339,7 @@ var FullZoom = { } let token = this._getBrowserToken(aBrowser); - this._getGlobalValue(aBrowser, function (value) { + this._getGlobalValue(aBrowser).then(value => { if (token.isCurrent) { ZoomManager.setZoomForBrowser(aBrowser, value === undefined ? 1 : value); this._ignorePendingZoomAccesses(aBrowser); @@ -399,6 +355,7 @@ var FullZoom = { * @param browser The zoom of this browser will be saved. Required. */ _applyZoomToPref: function FullZoom__applyZoomToPref(browser) { + Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", ""); if (!this.siteSpecific || gInPrintPreviewMode || browser.isSyntheticDocument) @@ -419,6 +376,7 @@ var FullZoom = { * @param browser The zoom of this browser will be removed. Required. */ _removePref: function FullZoom__removePref(browser) { + Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", ""); if (browser.isSyntheticDocument) return; let ctxt = this._loadContextFromBrowser(browser); @@ -429,7 +387,6 @@ var FullZoom = { }); }, - //**************************************************************************// // Utilities /** @@ -462,6 +419,30 @@ var FullZoom = { }, /** + * Returns the browser that the supplied zoom event is associated with. + * @param event The ZoomChangeUsingMouseWheel event. + * @return The associated browser element, if one exists, otherwise null. + */ + _getTargetedBrowser: function FullZoom__getTargetedBrowser(event) { + let target = event.originalTarget; + + // With remote content browsers, the event's target is the browser + // we're looking for. + const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + if (target instanceof window.XULElement && + target.localName == "browser" && + target.namespaceURI == XUL_NS) + return target; + + // With in-process content browsers, the event's target is the content + // document. + if (target.nodeType == Node.DOCUMENT_NODE) + return gBrowser.getBrowserForDocument(target); + + throw new Error("Unexpected ZoomChangeUsingMouseWheel event source"); + }, + + /** * Increments the zoom change token for the given browser so that pending * async operations know that it may be unsafe to access they zoom when they * finish. @@ -491,54 +472,49 @@ var FullZoom = { /** * Gets the global browser.content.full-zoom content preference. * - * WARNING: callback may be called synchronously or asynchronously. The - * reason is that it's usually desirable to avoid turns of the event loop - * where possible, since they can lead to visible, jarring jumps in zoom - * level. It's not always possible to avoid them, though. As a convenience, - * then, this method takes a callback and returns nothing. - * - * @param browser The content browser pertaining to the zoom. - * @param callback Synchronously or asynchronously called when done. It's - * bound to this object (FullZoom) and called as: - * callback(prefValue) + * @param browser The browser pertaining to the zoom. + * @returns Promise<prefValue> + * Resolves to the preference value when done. */ - _getGlobalValue: function FullZoom__getGlobalValue(browser, callback) { + _getGlobalValue: function FullZoom__getGlobalValue(browser) { // * !("_globalValue" in this) => global value not yet cached. // * this._globalValue === undefined => global value known not to exist. // * Otherwise, this._globalValue is a number, the global value. - if ("_globalValue" in this) { - callback.call(this, this._globalValue, true); - return; - } - let value = undefined; - this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), { - handleResult: function (pref) value = pref.value, - handleCompletion: function (reason) { - this._globalValue = this._ensureValid(value); - callback.call(this, this._globalValue); - }.bind(this) + return new Promise(resolve => { + if ("_globalValue" in this) { + resolve(this._globalValue); + return; + } + let value = undefined; + this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), { + handleResult: function (pref) { value = pref.value; }, + handleCompletion: (reason) => { + this._globalValue = this._ensureValid(value); + resolve(this._globalValue); + } + }); }); }, /** - * Gets the load context from the given content browser. + * Gets the load context from the given Browser. * * @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) { return browser.loadContext; }, /** - * Asynchronously broadcasts a "browser-fullZoom:locationChange" notification - * so that tests can select tabs, load pages, etc. and be notified when the - * zoom levels on those pages change. The notification is always asynchronous - * so that observers are guaranteed a consistent behavior. + * Asynchronously broadcasts "browser-fullZoom:location-change" so that + * listeners can be notified when the zoom levels on those pages change. + * The notification is always asynchronous so that observers are guaranteed a + * consistent behavior. */ - _notifyOnLocationChange: function FullZoom__notifyOnLocationChange() { + _notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) { this._executeSoon(function () { - Services.obs.notifyObservers(null, "browser-fullZoom:locationChange", ""); + Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", ""); }); }, diff --git a/application/palemoon/base/content/browser-menubar.inc b/application/palemoon/base/content/browser-menubar.inc index fa9d7f0f4..fc6bc7694 100644 --- a/application/palemoon/base/content/browser-menubar.inc +++ b/application/palemoon/base/content/browser-menubar.inc @@ -534,43 +534,12 @@ label="&webDeveloperMenu.label;" accesskey="&webDeveloperMenu.accesskey;"> <menupopup id="menuWebDeveloperPopup"> -#ifdef MOZ_DEVTOOLS - <menuitem id="menu_devToolbox" - observes="devtoolsMenuBroadcaster_DevToolbox" - accesskey="&devToolboxMenuItem.accesskey;"/> - <menuseparator id="menu_devtools_separator"/> - <menuitem id="menu_devToolbar" - observes="devtoolsMenuBroadcaster_DevToolbar" - accesskey="&devToolbarMenu.accesskey;"/> - <menuitem id="menu_chromeDebugger" - observes="devtoolsMenuBroadcaster_ChromeDebugger"/> - <menuitem id="menu_browserConsole" - observes="devtoolsMenuBroadcaster_BrowserConsole" - accesskey="&browserConsoleCmd.accesskey;"/> - <menuitem id="menu_responsiveUI" - observes="devtoolsMenuBroadcaster_ResponsiveUI" - accesskey="&responsiveDesignTool.accesskey;"/> - <menuitem id="menu_eyedropper" - observes="devtoolsMenuBroadcaster_Eyedropper" - accesskey="&eyedropper.accesskey;"/> - <menuitem id="menu_scratchpad" - observes="devtoolsMenuBroadcaster_Scratchpad" - accesskey="&scratchpad.accesskey;"/> -#endif <menuitem id="menu_pageSource" observes="devtoolsMenuBroadcaster_PageSource" accesskey="&pageSourceCmd.accesskey;"/> <menuitem id="javascriptConsole" observes="devtoolsMenuBroadcaster_ErrorConsole" accesskey="&errorConsoleCmd.accesskey;"/> -#ifdef MOZ_DEVTOOLS - <menuitem id="menu_devtools_connect" - observes="devtoolsMenuBroadcaster_connect"/> -#endif - <menuseparator id="devToolsEndSeparator"/> - <menuitem id="getMoreDevtools" - observes="devtoolsMenuBroadcaster_GetMoreTools" - accesskey="&getMoreDevtoolsCmd.accesskey;"/> </menupopup> </menu> <menuitem id="menu_pageInfo" diff --git a/application/palemoon/base/content/browser-sets.inc b/application/palemoon/base/content/browser-sets.inc index 78cfb7faa..64228678e 100644 --- a/application/palemoon/base/content/browser-sets.inc +++ b/application/palemoon/base/content/browser-sets.inc @@ -92,24 +92,9 @@ <command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/> <command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/> -#ifdef MOZ_DEVTOOLS - <command id="Tools:DevToolbox" oncommand="gDevToolsBrowser.toggleToolboxCommand(gBrowser);"/> - <command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();" disabled="true" hidden="true"/> - <command id="Tools:DevToolbarFocus" oncommand="DeveloperToolbar.focusToggle();" disabled="true"/> - <command id="Tools:DevAppMgr" oncommand="gDevToolsBrowser.openAppManager(gBrowser);" disabled="true" hidden="true"/> - <command id="Tools:WebIDE" oncommand="gDevToolsBrowser.openWebIDE();" disabled="true" hidden="true"/> - <command id="Tools:ChromeDebugger" oncommand="BrowserToolboxProcess.init();" disabled="true" hidden="true"/> - <command id="Tools:BrowserConsole" oncommand="HUDService.openBrowserConsoleOrFocus();"/> - <command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true" hidden="true"/> - <command id="Tools:ResponsiveUI" oncommand="ResponsiveUI.toggle();" disabled="true" hidden="true"/> - <command id="Tools:Eyedropper" oncommand="openEyedropper();"/> -#endif <command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/> <command id="Tools:Permissions" oncommand="BrowserOpenPermissionsMgr();"/> <command id="Tools:ErrorConsole" oncommand="toJavaScriptConsole()" disabled="true" hidden="true"/> -#ifdef MOZ_DEVTOOLS - <command id="Tools:DevToolsConnect" oncommand="gDevToolsBrowser.openConnectScreen(gBrowser)" disabled="true" hidden="true"/> -#endif <command id="Tools:Sanitize" oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/> <command id="Tools:PrivateBrowsing" @@ -170,46 +155,6 @@ #endif <broadcaster id="workOfflineMenuitemState"/> -#ifdef MOZ_DEVTOOLS - <!-- DevTools broadcasters --> - <broadcaster id="devtoolsMenuBroadcaster_DevToolbox" - label="&devToolboxMenuItem.label;" - type="checkbox" autocheck="false" - command="Tools:DevToolbox" - key="key_devToolbox"/> - <broadcaster id="devtoolsMenuBroadcaster_DevToolbar" - label="&devToolbarMenu.label;" - type="checkbox" autocheck="false" - command="Tools:DevToolbar" - key="key_devToolbar"/> - <broadcaster id="devtoolsMenuBroadcaster_DevAppMgr" - label="&devAppMgrMenu.label;" - command="Tools:DevAppMgr"/> - <broadcaster id="devtoolsMenuBroadcaster_webide" - label="&webide.label;" - command="Tools:WebIDE" - key="key_webide"/> - <broadcaster id="devtoolsMenuBroadcaster_ChromeDebugger" - label="&chromeDebuggerMenu.label;" - command="Tools:ChromeDebugger"/> - <broadcaster id="devtoolsMenuBroadcaster_BrowserConsole" - label="&browserConsoleCmd.label;" - key="key_browserConsole" - command="Tools:BrowserConsole"/> - <broadcaster id="devtoolsMenuBroadcaster_Scratchpad" - label="&scratchpad.label;" - command="Tools:Scratchpad" - key="key_scratchpad"/> - <broadcaster id="devtoolsMenuBroadcaster_ResponsiveUI" - label="&responsiveDesignTool.label;" - type="checkbox" autocheck="false" - command="Tools:ResponsiveUI" - key="key_responsiveUI"/> - <broadcaster id="devtoolsMenuBroadcaster_Eyedropper" - label="&eyedropper.label;" - type="checkbox" autocheck="false" - command="Tools:Eyedropper"/> -#endif <broadcaster id="devtoolsMenuBroadcaster_PageSource" label="&pageSourceCmd.label;" key="key_viewSource" @@ -217,14 +162,6 @@ <broadcaster id="devtoolsMenuBroadcaster_ErrorConsole" label="&errorConsoleCmd.label;" command="Tools:ErrorConsole"/> - <broadcaster id="devtoolsMenuBroadcaster_GetMoreTools" - label="&getMoreDevtoolsCmd.label;" - oncommand="openUILinkIn(gPrefService.getCharPref('browser.getdevtools.url'), 'tab');"/> -#ifdef MOZ_DEVTOOLS - <broadcaster id="devtoolsMenuBroadcaster_connect" - label="&devtoolsConnect.label;" - command="Tools:DevToolsConnect"/> -#endif </broadcasterset> <keyset id="mainKeyset"> @@ -271,21 +208,6 @@ <key id="key_openDownloads" key="&downloads.commandkey;" command="Tools:Downloads" modifiers="accel"/> #endif <key id="key_openAddons" key="&addons.commandkey;" command="Tools:Addons" modifiers="accel,shift"/> -#ifdef MOZ_DEVTOOLS - <key id="key_browserConsole" key="&browserConsoleCmd.commandkey;" command="Tools:BrowserConsole" modifiers="accel,shift"/> - <key id="key_devToolbox" keycode="VK_F12" keytext="F12" command="Tools:DevToolbox"/> - <key id="key_devToolbar" keycode="&devToolbar.keycode;" modifiers="shift" - keytext="&devToolbar.keytext;" command="Tools:DevToolbarFocus"/> - <key id="key_responsiveUI" key="&responsiveDesignTool.commandkey;" command="Tools:ResponsiveUI" -#ifdef XP_MACOSX - modifiers="accel,alt" -#else - modifiers="accel,shift" -#endif - /> - <key id="key_scratchpad" keycode="&scratchpad.keycode;" modifiers="shift" - keytext="&scratchpad.keytext;" command="Tools:Scratchpad"/> -#endif <key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/> <key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/> <key id="printKb" key="&printCmd.commandkey;" command="cmd_print" modifiers="accel"/> diff --git a/application/palemoon/base/content/browser-thumbnails.js b/application/palemoon/base/content/browser-thumbnails.js index dbe33e3ed..b06dfd503 100644 --- a/application/palemoon/base/content/browser-thumbnails.js +++ b/application/palemoon/base/content/browser-thumbnails.js @@ -92,7 +92,12 @@ let gBrowserThumbnails = { filterForThumbnailExpiration: function Thumbnails_filterForThumbnailExpiration(aCallback) { - aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]); + // Tycho: aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]); + let result = []; + for (let browser of gBrowser.browsers) { + result.push(browser.currentURI.spec); + } + aCallback(result); }, /** @@ -137,7 +142,7 @@ let gBrowserThumbnails = { // FIXME Bug 720575 - Don't capture thumbnails for SVG or XML documents as // that currently regresses Talos SVG tests. - if (doc instanceof SVGDocument || doc instanceof XMLDocument) + if (doc instanceof XMLDocument) return false; // There's no point in taking screenshot of loading pages. diff --git a/application/palemoon/base/content/browser.css b/application/palemoon/base/content/browser.css index 2c8ba3e69..e6a84421b 100644 --- a/application/palemoon/base/content/browser.css +++ b/application/palemoon/base/content/browser.css @@ -115,8 +115,17 @@ toolbar[printpreview="true"] { #titlebar { -moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox"); + -moz-window-dragging: drag; } +%ifdef XP_WIN +#main-window[tabsontop="true"] #TabsToolbar, +#main-window[tabsontop="true"] #toolbar-menubar, +#main-window[tabsontop="true"] #navigator-toolbox > toolbar:-moz-lwtheme { + -moz-window-dragging: drag; +} +%endif + #titlebar-spacer { pointer-events: none; } diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 34b91b6cb..b2d260101 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -3,8 +3,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -let Ci = Components.interfaces; -let Cu = Components.utils; +var Ci = Components.interfaces; +var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/RecentWindow.jsm"); @@ -65,6 +65,9 @@ XPCOMUtils.defineLazyGetter(window, "gFindBar", function() { return findbar; }); +XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils", + "resource://gre/modules/BrowserUtils.jsm"); + XPCOMUtils.defineLazyGetter(this, "gPrefService", function() { return Services.prefs; }); @@ -109,20 +112,6 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () { } }); -#ifdef MOZ_DEVTOOLS -XPCOMUtils.defineLazyGetter(this, "DeveloperToolbar", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/DeveloperToolbar.jsm", tmp); - return new tmp.DeveloperToolbar(window, document.getElementById("developer-toolbar")); -}); - -XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/ToolboxProcess.jsm", tmp); - return tmp.BrowserToolboxProcess; -}); -#endif - XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs", "resource://gre/modules/PageThumbs.jsm"); @@ -152,7 +141,11 @@ let gInitialPages = [ #include browser-plugins.js #include browser-tabPreviews.js #include browser-thumbnails.js + +#ifdef MOZ_WEBRTC #include browser-webrtcUI.js +#endif + #include browser-gestureSupport.js #ifdef MOZ_SERVICES_SYNC @@ -336,6 +329,48 @@ const gSessionHistoryObserver = { } }; +var gURLBarSettings = { + prefSuggest: "browser.urlbar.suggest.", + /* + For searching in the source code: + browser.urlbar.suggest.bookmark + browser.urlbar.suggest.history + browser.urlbar.suggest.openpage + */ + prefSuggests: [ + "bookmark", + "history", + "openpage" + ], + prefKeyword: "keyword.enabled", + + observe: function(aSubject, aTopic, aData) { + if (aTopic != "nsPref:changed") + return; + + this.writePlaceholder(); + }, + + writePlaceholder: function() { + let attribute = "placeholder"; + let prefs = this.prefSuggests.map(pref => { + return this.prefSuggest + pref; + }); + prefs.push(this.prefKeyword); + let placeholderDefault = prefs.some(pref => { + return gPrefService.getBoolPref(pref); + }); + + if (placeholderDefault) { + gURLBar.setAttribute( + attribute, gNavigatorBundle.getString("urlbar.placeholder")); + } else { + gURLBar.setAttribute( + attribute, gNavigatorBundle.getString("urlbar.placeholderURLOnly")); + } + } +}; + /** * Given a starting docshell and a URI to look up, find the docshell the URI * is loaded in. @@ -663,6 +698,8 @@ const gXSSObserver = { }; var gBrowserInit = { + delayedStartupFinished: false, + onLoad: function() { gMultiProcessBrowser = gPrefService.getBoolPref("browser.tabs.remote"); @@ -685,6 +722,14 @@ var gBrowserInit = { window.addEventListener("AppCommand", HandleAppCommandEvent, true); + // These routines add message listeners. They must run before + // loading the frame script to ensure that we don't miss any + // message sent between when the frame script is loaded and when + // the listener is registered. +#ifdef MOZ_DEVTOOLS + DevToolsTheme.init(); +#endif + messageManager.loadFrameScript("chrome://browser/content/content.js", true); messageManager.loadFrameScript("chrome://browser/content/content-sessionStore.js", true); @@ -968,11 +1013,18 @@ var gBrowserInit = { Services.obs.addObserver(gXPInstallObserver, "addon-install-complete", false); Services.obs.addObserver(gXSSObserver, "xss-on-violate-policy", false); + gPrefService.addObserver(gURLBarSettings.prefSuggest, gURLBarSettings, false); + gPrefService.addObserver(gURLBarSettings.prefKeyword, gURLBarSettings, false); + + gURLBarSettings.writePlaceholder(); + BrowserOffline.init(); OfflineApps.init(); IndexedDBPromptHelper.init(); AddonManager.addAddonListener(AddonsMgrListener); +#ifdef MOZ_WEBRTC WebrtcIndicator.init(); +#endif // Ensure login manager is up and running. Services.logins; @@ -1114,27 +1166,6 @@ var gBrowserInit = { setUrlAndSearchBarWidthForConditionalForwardButton(); }); -#ifdef MOZ_DEVTOOLS - // Enable Chrome Debugger? - let chromeEnabled = gPrefService.getBoolPref("devtools.chrome.enabled"); - let remoteEnabled = chromeEnabled && - gPrefService.getBoolPref("devtools.debugger.chrome-enabled") && - gPrefService.getBoolPref("devtools.debugger.remote-enabled"); - if (remoteEnabled) { - let cmd = document.getElementById("Tools:ChromeDebugger"); - cmd.removeAttribute("disabled"); - cmd.removeAttribute("hidden"); - } - - // Enable Scratchpad in the UI, if the preference allows this. - let scratchpadEnabled = gPrefService.getBoolPref(Scratchpad.prefEnabledName); - if (scratchpadEnabled) { - let cmd = document.getElementById("Tools:Scratchpad"); - cmd.removeAttribute("disabled"); - cmd.removeAttribute("hidden"); - } -#endif - // Enable Error Console? let consoleEnabled = gPrefService.getBoolPref("devtools.errorconsole.enabled"); if (consoleEnabled) { @@ -1152,19 +1183,6 @@ var gBrowserInit = { document.getElementById("appmenu_charsetMenu").hidden = true; #endif -#ifdef MOZ_DEVTOOLS - // Enable Responsive UI? - let responsiveUIEnabled = gPrefService.getBoolPref("devtools.responsiveUI.enabled"); - if (responsiveUIEnabled) { - let cmd = document.getElementById("Tools:ResponsiveUI"); - cmd.removeAttribute("disabled"); - cmd.removeAttribute("hidden"); - } - - // Add Devtools menuitems and listeners - gDevToolsBrowser.registerBrowserWindow(window); -#endif - let appMenuButton = document.getElementById("appmenu-button"); let appMenuPopup = document.getElementById("appmenu-popup"); if (appMenuButton && appMenuPopup) { @@ -1205,6 +1223,8 @@ var gBrowserInit = { setTimeout(function () { BrowserChromeTest.markAsReady(); }, 0); }); + this.delayedStartupFinished = true; + Services.obs.notifyObservers(window, "browser-delayed-startup-finished", ""); }, @@ -1240,15 +1260,6 @@ var gBrowserInit = { if (!this._loadHandled) return; -#ifdef MOZ_DEVTOOLS - gDevToolsBrowser.forgetBrowserWindow(window); - - let desc = Object.getOwnPropertyDescriptor(window, "DeveloperToolbar"); - if (desc && !desc.get) { - DeveloperToolbar.destroy(); - } -#endif - // First clean up services initialized in gBrowserInit.onLoad (or those whose // uninit methods don't depend on the services having been initialized). @@ -1278,6 +1289,10 @@ var gBrowserInit = { ToolbarIconColor.uninit(); +#ifdef MOZ_DEVTOOLS + DevToolsTheme.uninit(); +#endif + var enumerator = Services.wm.getEnumerator(null); enumerator.getNext(); if (!enumerator.hasMoreElements()) { @@ -1314,6 +1329,13 @@ var gBrowserInit = { Services.obs.removeObserver(gXSSObserver, "xss-on-violate-policy"); try { + gPrefService.removeObserver(gURLBarSettings.prefSuggest, gURLBarSettings); + gPrefService.removeObserver(gURLBarSettings.prefKeyword, gURLBarSettings); + } catch (ex) { + Cu.reportError(ex); + } + + try { gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton); } catch (ex) { Cu.reportError(ex); @@ -2010,49 +2032,43 @@ function readFromClipboard() return url; } -function BrowserViewSourceOfDocument(aDocument) +function BrowserViewSourceOfDocument(aArgsOrDocument) { - var pageCookie; - var webNav; - - // Get the document charset - var docCharset = "charset=" + aDocument.characterSet; - - // Get the nsIWebNavigation associated with the document - try { - var win; - var ifRequestor; - - // Get the DOMWindow for the requested document. If the DOMWindow - // cannot be found, then just use the content window... - // - // XXX: This is a bit of a hack... - win = aDocument.defaultView; - if (win == window) { - win = content; - } - ifRequestor = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor); - - webNav = ifRequestor.getInterface(nsIWebNavigation); - } catch(err) { - // If nsIWebNavigation cannot be found, just get the one for the whole - // window... - webNav = gBrowser.webNavigation; + let args; + + if (aArgsOrDocument instanceof Document) { + let doc = aArgsOrDocument; + + let requestor = doc.defaultView + .QueryInterface(Ci.nsIInterfaceRequestor); + let browser = requestor.getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .chromeEventHandler; + let outerWindowID = requestor.getInterface(Ci.nsIDOMWindowUtils) + .outerWindowID; + let URL = browser.currentURI.spec; + args = { browser, outerWindowID, URL }; + } else { + args = aArgsOrDocument; } - // - // Get the 'PageDescriptor' for the current document. This allows the - // view-source to access the cached copy of the content rather than - // refetching it from the network... - // - try{ - var PageLoader = webNav.QueryInterface(Components.interfaces.nsIWebPageDescriptor); - pageCookie = PageLoader.currentDescriptor; - } catch(err) { - // If no page descriptor is available, just use the view-source URL... + let viewInternal = () => { + top.gViewSourceUtils.viewSource(args); } - top.gViewSourceUtils.viewSource(webNav.currentURI.spec, pageCookie, aDocument); + // Check if external view source is enabled. If so, try it. If it fails, + // fallback to internal view source. + if (Services.prefs.getBoolPref("view_source.editor.external")) { + top.gViewSourceUtils + .openInExternalEditor(args, null, null, null, result => { + if (!result) { + viewInternal(); + } + }); + } else { + // Display using internal view source + viewInternal(); + } } // doc - document to use for source, or null for this window's document @@ -2833,7 +2849,7 @@ const DOMLinkHandler = { break; let tab = gBrowser.tabs[browserIndex]; - gBrowser.setIcon(tab, uri.spec); + gBrowser.setIcon(tab, uri.spec, link.ownerDocument.nodePrincipal); iconAdded = true; } break; @@ -3425,26 +3441,6 @@ function updateCharacterEncodingMenuState() } } -/** - * Returns true if |aMimeType| is text-based, false otherwise. - * - * @param aMimeType - * The MIME type to check. - * - * If adding types to this function, please also check the similar - * function in findbar.xml - */ -function mimeTypeIsTextBased(aMimeType) -{ - return aMimeType.startsWith("text/") || - aMimeType.endsWith("+xml") || - aMimeType == "application/x-javascript" || - aMimeType == "application/javascript" || - aMimeType == "application/json" || - aMimeType == "application/xml" || - aMimeType == "mozilla.application/cached-xul"; -} - var XULBrowserWindow = { // Stored Status, Link and Loading values status: "", @@ -3668,7 +3664,7 @@ var XULBrowserWindow = { this.setDefaultStatus(msg); // Disable menu entries for images, enable otherwise - if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType)) + if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType)) this.isImage.removeAttribute('disabled'); else this.isImage.setAttribute('disabled', 'true'); @@ -3716,7 +3712,7 @@ var XULBrowserWindow = { } // Disable menu entries for images, enable otherwise - if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType)) + if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType)) this.isImage.removeAttribute('disabled'); else this.isImage.setAttribute('disabled', 'true'); @@ -3814,11 +3810,16 @@ var XULBrowserWindow = { gFindBar.close(); } + // XXX + // See: https://github.com/MoonchildProductions/Pale-Moon/issues/364 + // An actual preference: findbar.highlightAll + /* if (!(gPrefService.getBoolPref("accessibility.typeaheadfind.highlightallremember") || gPrefService.getBoolPref("accessibility.typeaheadfind.highlightallbydefault"))) { // fix bug 253793 - turn off highlight when page changes gFindBar.getElement("highlight").checked = false; } + */ } } UpdateBackForwardCommands(gBrowser.webNavigation); @@ -6825,20 +6826,9 @@ var TabContextMenu = { }; #ifdef MOZ_DEVTOOLS +// Note: Do not delete! It is used for: base/content/nsContextMenu.js XPCOMUtils.defineLazyModuleGetter(this, "gDevTools", - "resource://gre/modules/devtools/gDevTools.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "gDevToolsBrowser", - "resource://gre/modules/devtools/gDevTools.jsm"); - -Object.defineProperty(this, "HUDService", { - get: function HUDService_getter() { - let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; - return devtools.require("devtools/webconsole/hudservice").HUDService; - }, - configurable: true, - enumerable: true -}); + "resource://devtools/client/framework/gDevTools.jsm"); #endif // Prompt user to restart the browser in safe mode or normally @@ -6929,49 +6919,6 @@ function toggleAddonBar() { setToolbarVisibility(addonBar, addonBar.collapsed); } -#ifdef MOZ_DEVTOOLS -var Scratchpad = { - prefEnabledName: "devtools.scratchpad.enabled", - - openScratchpad: function SP_openScratchpad() { - return this.ScratchpadManager.openScratchpad(); - } -}; - -XPCOMUtils.defineLazyGetter(Scratchpad, "ScratchpadManager", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/scratchpad-manager.jsm", tmp); - return tmp.ScratchpadManager; -}); - -var ResponsiveUI = { - toggle: function RUI_toggle() { - this.ResponsiveUIManager.toggle(window, gBrowser.selectedTab); - } -}; - -XPCOMUtils.defineLazyGetter(ResponsiveUI, "ResponsiveUIManager", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/responsivedesign.jsm", tmp); - return tmp.ResponsiveUIManager; -}); - -function openEyedropper() { - var eyedropper = new this.Eyedropper(this, { context: "menu", - copyOnSelect: true }); - eyedropper.open(); -} - -Object.defineProperty(this, "Eyedropper", { - get: function() { - let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; - return devtools.require("devtools/eyedropper/eyedropper").Eyedropper; - }, - configurable: true, - enumerable: true -}); -#endif - XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () { #ifdef XP_WIN // Only show resizers on Windows 2000 and XP diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul index f83010023..df152bbaa 100644 --- a/application/palemoon/base/content/browser.xul +++ b/application/palemoon/base/content/browser.xul @@ -65,6 +65,9 @@ # wishes to include *must* go into the global-scripts.inc file # so that they can be shared by macBrowserOverlay.xul. #include global-scripts.inc +#ifdef MOZ_DEVTOOLS +#include global-devtools-theme-scripts.inc +#endif <script type="application/javascript" src="chrome://browser/content/nsContextMenu.js"/> <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/> @@ -410,7 +413,7 @@ <toolbaritem id="urlbar-container" align="center" flex="400" persist="width" combined="true" title="&locationItem.title;" class="chromeclass-location" removable="true"> <textbox id="urlbar" flex="1" - placeholder="&urlbar.placeholder2;" + placeholder="" type="autocomplete" autocompletesearch="urlinline history" autocompletesearchparam="enable-actions" @@ -440,8 +443,10 @@ <image id="alert-plugins-notification-icon" class="notification-anchor-icon" role="button"/> <image id="blocked-plugins-notification-icon" class="notification-anchor-icon" role="button"/> <image id="mixed-content-blocked-notification-icon" class="notification-anchor-icon" role="button"/> +#ifdef MOZ_WEBRTC <image id="webRTC-shareDevices-notification-icon" class="notification-anchor-icon" role="button"/> <image id="webRTC-sharingDevices-notification-icon" class="notification-anchor-icon" role="button"/> +#endif <image id="pointerLock-notification-icon" class="notification-anchor-icon" role="button"/> <image id="servicesInstall-notification-icon" class="notification-anchor-icon" role="button"/> </box> @@ -513,7 +518,7 @@ flex="100" persist="width" removable="true"> <searchbar id="searchbar" flex="1"/> </toolbaritem> - +#ifdef MOZ_WEBRTC <toolbarbutton id="webrtc-status-button" class="toolbarbutton-1 chromeclass-toolbar-additional" type="menu" @@ -525,7 +530,7 @@ onpopuphiding="WebrtcIndicator.clearPopup(this);" oncommand="WebrtcIndicator.menuCommand(event.target);"/> </toolbarbutton> - +#endif <toolbarbutton id="bookmarks-menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional" persist="class" @@ -971,33 +976,6 @@ <vbox id="browser-bottombox" layer="true"> <notificationbox id="global-notificationbox"/> -#ifdef MOZ_DEVTOOLS - <toolbar id="developer-toolbar" - class="devtools-toolbar" - hidden="true"> -#ifdef XP_MACOSX - <toolbarbutton id="developer-toolbar-closebutton" - class="devtools-closebutton" - oncommand="DeveloperToolbar.hide();" - tooltiptext="&devToolbarCloseButton.tooltiptext;"/> -#endif - <stack class="gclitoolbar-stack-node" flex="1"> - <textbox class="gclitoolbar-input-node" rows="1"/> - <hbox class="gclitoolbar-complete-node"/> - </stack> - <toolbarbutton id="developer-toolbar-toolbox-button" - class="developer-toolbar-button" - observes="devtoolsMenuBroadcaster_DevToolbox" - tooltiptext="&devToolbarToolsButton.tooltip;"/> -#ifndef XP_MACOSX - <toolbarbutton id="developer-toolbar-closebutton" - class="devtools-closebutton" - oncommand="DeveloperToolbar.hide();" - tooltiptext="&devToolbarCloseButton.tooltiptext;"/> -#endif - </toolbar> -#endif - <toolbar id="addon-bar" toolbarname="&statusBar.label;" accesskey="&statusBar.accesskey;" collapsed="true" diff --git a/application/palemoon/base/content/content.js b/application/palemoon/base/content/content.js index 19032eb84..19c8b0682 100644 --- a/application/palemoon/base/content/content.js +++ b/application/palemoon/base/content/content.js @@ -3,9 +3,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -let Cc = Components.classes; -let Ci = Components.interfaces; -let Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -13,6 +13,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils", "resource://gre/modules/BrowserUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerContent", "resource://gre/modules/LoginManagerContent.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "LoginFormFactory", + "resource://gre/modules/LoginManagerContent.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "InsecurePasswordUtils", "resource://gre/modules/InsecurePasswordUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "FormSubmitObserver", @@ -47,8 +49,9 @@ addMessageListener("Browser:HideSessionRestoreButton", function (message) { }); addEventListener("DOMFormHasPassword", function(event) { - InsecurePasswordUtils.checkForInsecurePasswords(event.target); - LoginManagerContent.onFormPassword(event); + LoginManagerContent.onDOMFormHasPassword(event, content); + let formLike = LoginFormFactory.createFromForm(event.target); + InsecurePasswordUtils.reportInsecurePasswords(formLike); }); addEventListener("DOMAutoComplete", function(event) { LoginManagerContent.onUsernameInput(event); @@ -61,4 +64,8 @@ addEventListener("blur", function(event) { addMessageListener("Finder:Initialize", function () { let {RemoteFinderListener} = Cu.import("resource://gre/modules/RemoteFinder.jsm", {}); new RemoteFinderListener(global); -});
\ No newline at end of file +}); + +addEventListener("DOMWebNotificationClicked", function(event) { + sendAsyncMessage("DOMWebNotificationClicked", {}); +}, false); diff --git a/application/palemoon/base/content/global-devtools-theme-scripts.inc b/application/palemoon/base/content/global-devtools-theme-scripts.inc new file mode 100644 index 000000000..408728ed5 --- /dev/null +++ b/application/palemoon/base/content/global-devtools-theme-scripts.inc @@ -0,0 +1,6 @@ +# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +<script type="application/javascript" src="chrome://browser/content/browser-devtools-theme.js"/> diff --git a/application/palemoon/base/content/macBrowserOverlay.xul b/application/palemoon/base/content/macBrowserOverlay.xul index a4d583e16..b1ae838d0 100644 --- a/application/palemoon/base/content/macBrowserOverlay.xul +++ b/application/palemoon/base/content/macBrowserOverlay.xul @@ -24,6 +24,9 @@ # wishes to include *must* go into the global-scripts.inc file # so that they can be shared by this overlay. #include global-scripts.inc +#ifdef MOZ_DEVTOOLS +#include global-devtools-theme-scripts.inc +#endif <script type="application/javascript"> function OpenBrowserWindowFromDockMenu(options) { diff --git a/application/palemoon/base/content/newtab/grid.js b/application/palemoon/base/content/newtab/grid.js index 37559a063..3b7dfc35f 100644 --- a/application/palemoon/base/content/newtab/grid.js +++ b/application/palemoon/base/content/newtab/grid.js @@ -109,7 +109,12 @@ let gGrid = { // (Re-)initialize all cells. let cellElements = this.node.querySelectorAll(".newtab-cell"); - this._cells = [new Cell(this, cell) for (cell of cellElements)]; + // Tycho: this._cells = [new Cell(this, cell) for (cell of cellElements)]; + this.cells = []; + + for (let cellItem of cellElements) { + this.cells.push(new Cell(this, cellItem)); + } }, /** diff --git a/application/palemoon/base/content/newtab/newTab.js b/application/palemoon/base/content/newtab/newTab.js index 77c929125..6d8647ab6 100644 --- a/application/palemoon/base/content/newtab/newTab.js +++ b/application/palemoon/base/content/newtab/newTab.js @@ -4,8 +4,8 @@ "use strict"; -let Cu = Components.utils; -let Ci = Components.interfaces; +var Cu = Components.utils; +var Ci = Components.interfaces; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js index 8e6bc96c2..017ab87cc 100644 --- a/application/palemoon/base/content/nsContextMenu.js +++ b/application/palemoon/base/content/nsContextMenu.js @@ -265,7 +265,7 @@ nsContextMenu.prototype = { // Hide menu entries for images, show otherwise if (this.inFrame) { - if (mimeTypeIsTextBased(this.target.ownerDocument.contentType)) + if (BrowserUtils.mimeTypeIsTextBased(this.target.ownerDocument.contentType)) this.isFrameImage.removeAttribute('hidden'); else this.isFrameImage.setAttribute('hidden', 'true'); @@ -422,12 +422,17 @@ nsContextMenu.prototype = { }, inspectNode: function CM_inspectNode() { - let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); + let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {}); let gBrowser = this.browser.ownerDocument.defaultView.gBrowser; - let tt = devtools.TargetFactory.forTab(gBrowser.selectedTab); - return gDevTools.showToolbox(tt, "inspector").then(function(toolbox) { + let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); + + return gDevTools.showToolbox(target, "inspector").then(function(toolbox) { let inspector = toolbox.getCurrentPanel(); - inspector.selection.setNode(this.target, "browser-context-menu"); + + this.browser.messageManager.sendAsyncMessage("debug:inspect", {}, {node: this.target}); + inspector.walker.findInspectingNode().then(nodeFront => { + inspector.selection.setNodeFront(nodeFront, "browser-context-menu"); + }); }.bind(this)); }, @@ -906,6 +911,9 @@ nsContextMenu.prototype = { }, saveVideoFrameAsImage: function () { + let referrerURI = document.documentURIObject; + let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); + urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal, Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); let name = ""; @@ -923,7 +931,9 @@ nsContextMenu.prototype = { canvas.height = video.videoHeight; var ctxDraw = canvas.getContext("2d"); ctxDraw.drawImage(video, 0, 0); - saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle", true, false, document.documentURIObject, this.target.ownerDocument); + saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle", + true, false, referrerURI, null, null, null, + isPrivate); }, fullScreenVideo: function () { @@ -1106,10 +1116,17 @@ nsContextMenu.prototype = { } } - // set up a channel to do the saving - var ioService = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); - var channel = ioService.newChannelFromURI(makeURI(linkURL)); + // setting up a new channel for 'right click - save link as ...' + // ideally we should use: + // * doc - as the loadingNode, and/or + // * this.principal - as the loadingPrincipal + // for now lets use systemPrincipal to bypass mixedContentBlocker + // checks after redirects, see bug: 1136055 + var channel = NetUtil.newChannel({ + uri: makeURI(linkURL), + loadUsingSystemPrincipal: true + }); + if (linkDownload) channel.contentDispositionFilename = linkDownload; if (channel instanceof Ci.nsIPrivateBrowsingChannel) { @@ -1142,7 +1159,7 @@ nsContextMenu.prototype = { timer.TYPE_ONE_SHOT); // kick off the channel with our proxy object as the listener - channel.asyncOpen(new saveAsListener(), null); + channel.asyncOpen2(new saveAsListener()); }, // Save URL of clicked-on link. @@ -1174,6 +1191,8 @@ nsContextMenu.prototype = { // Save URL of the clicked upon image, video, or audio. saveMedia: function() { var doc = this.target.ownerDocument; + let referrerURI = doc.documentURIObject; + let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); if (this.onCanvas) { // Bypass cache, since it's a blob: URL. var target = this.target; @@ -1189,14 +1208,16 @@ nsContextMenu.prototype = { resolve(win.URL.createObjectURL(blob)); }) }}).then(function (blobURL) { - saveImageURL(blobURL, "canvas.png", "SaveImageTitle", true, - false, doc.documentURIObject, doc); + saveImageURL(blobURL, "canvas.png", "SaveImageTitle", + true, false, referrerURI, null, null, null, + isPrivate); }, Components.utils.reportError); } } else if (this.onImage) { urlSecurityCheck(this.mediaURL, doc.nodePrincipal); - saveImageURL(this.mediaURL, null, "SaveImageTitle", false, - false, doc.documentURIObject, doc); + saveImageURL(this.mediaURL, null, "SaveImageTitle", + false, false, referrerURI, doc, null, null, + isPrivate); } else if (this.onVideo || this.onAudio) { urlSecurityCheck(this.mediaURL, doc.nodePrincipal); var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle"; diff --git a/application/palemoon/base/content/padlock.js b/application/palemoon/base/content/padlock.js index 53477fd17..9c29524ce 100644 --- a/application/palemoon/base/content/padlock.js +++ b/application/palemoon/base/content/padlock.js @@ -1,6 +1,6 @@ -let Cc = Components.classes; -let Ci = Components.interfaces; -let Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); var padlock_PadLock = diff --git a/application/palemoon/base/content/pageinfo/pageInfo.js b/application/palemoon/base/content/pageinfo/pageInfo.js index ba93ee817..83f0ddb91 100644 --- a/application/palemoon/base/content/pageinfo/pageInfo.js +++ b/application/palemoon/base/content/pageinfo/pageInfo.js @@ -359,7 +359,7 @@ function loadPageInfo() makeTabs(gDocument, gWindow); initFeedTab(); - onLoadPermission(); + onLoadPermission(gDocument.nodePrincipal); /* Call registered overlay init functions */ onLoadRegistry.forEach(function(func) { func(); }); @@ -857,7 +857,7 @@ function onBlockImage() if (checkbox.checked) permissionManager.add(uri, "image", nsIPermissionManager.DENY_ACTION); else - permissionManager.remove(uri.host, "image"); + permissionManager.remove(uri, "image"); } function onImageSelect() diff --git a/application/palemoon/base/content/pageinfo/permissions.js b/application/palemoon/base/content/pageinfo/permissions.js index 7a0006b61..2fa0cc303 100644 --- a/application/palemoon/base/content/pageinfo/permissions.js +++ b/application/palemoon/base/content/pageinfo/permissions.js @@ -12,9 +12,10 @@ const IMAGE_DENY = 2; const COOKIE_DENY = 2; const COOKIE_SESSION = 2; -const nsIQuotaManager = Components.interfaces.nsIQuotaManager; +const nsIQuotaManagerService = Components.interfaces.nsIQuotaManagerService; var gPermURI; +var gPermPrincipal; var gPrefs; var gUsageRequest; @@ -107,7 +108,7 @@ var permissionObserver = { } }; -function onLoadPermission() +function onLoadPermission(principal) { gPrefs = Components.classes[PREFERENCES_CONTRACTID] .getService(Components.interfaces.nsIPrefBranch); @@ -116,6 +117,7 @@ function onLoadPermission() var permTab = document.getElementById("permTab"); if (/^https?$/.test(uri.scheme)) { gPermURI = uri; + gPermPrincipal = principal; var hostText = document.getElementById("hostText"); hostText.value = gPermURI.host; @@ -187,7 +189,7 @@ function onCheckboxClick(aPartId) var command = document.getElementById("cmd_" + aPartId + "Toggle"); var checkbox = document.getElementById(aPartId + "Def"); if (checkbox.checked) { - permissionManager.remove(gPermURI.host, aPartId); + permissionManager.remove(gPermURI, aPartId); command.setAttribute("disabled", "true"); var perm = gPermObj[aPartId](); setRadioState(aPartId, perm); @@ -211,7 +213,7 @@ function onRadioClick(aPartId) var id = radioGroup.selectedItem.id; var permission = id.split('#')[1]; if (permission == UNKNOWN) { - permissionManager.remove(gPermURI.host, aPartId); + permissionManager.remove(gPermURI, aPartId); } else { permissionManager.add(gPermURI, aPartId, permission); } @@ -230,10 +232,13 @@ function initIndexedDBRow() row.appendChild(extras); - var quotaManager = Components.classes["@mozilla.org/dom/quota/manager;1"] - .getService(nsIQuotaManager); + var quotaManagerService = + Components.classes["@mozilla.org/dom/quota-manager-service;1"] + .getService(nsIQuotaManagerService); + gUsageRequest = - quotaManager.getUsageForURI(gPermURI, onIndexedDBUsageCallback); + quotaManagerService.getUsageForPrincipal(gPermPrincipal, + onIndexedDBUsageCallback); var status = document.getElementById("indexedDBStatus"); var button = document.getElementById("indexedDBClear"); @@ -245,22 +250,24 @@ function initIndexedDBRow() function onIndexedDBClear() { - Components.classes["@mozilla.org/dom/quota/manager;1"] - .getService(nsIQuotaManager) - .clearStoragesForURI(gPermURI); + Components.classes["@mozilla.org/dom/quota-manager-service;1"] + .getService(nsIQuotaManagerService) + .clearStoragesForPrincipal(gPermPrincipal); var permissionManager = Components.classes[PERMISSION_CONTRACTID] .getService(nsIPermissionManager); - permissionManager.remove(gPermURI.host, "indexedDB"); + permissionManager.remove(gPermURI, "indexedDB"); initIndexedDBRow(); } -function onIndexedDBUsageCallback(uri, usage, fileUsage) +function onIndexedDBUsageCallback(request) { + let uri = request.principal.URI; if (!uri.equals(gPermURI)) { - throw new Error("Callback received for bad URI: " + uri); + throw new Error("Callback received for bad URI: " + uri.spec); } + let usage = request.result.usage; if (usage) { if (!("DownloadUtils" in window)) { Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); @@ -355,20 +362,33 @@ function initPluginsRow() { } } - let entries = [ - { + // Tycho: + // let entries = [ + // { + // "permission": item[0], + // "obj": item[1], + // } + // for (item of permissionMap) + // ]; + let entries = []; + for (let item of permissionMap) { + entries.push({ "permission": item[0], - "obj": item[1], - } - for (item of permissionMap) - ]; + "obj": item[1] + }); + } entries.sort(function(a, b) { return ((a.obj.name < b.obj.name) ? -1 : (a.obj.name == b.obj.name ? 0 : 1)); }); - let permissionEntries = [ - fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries) - ]; + // Tycho: + // let permissionEntries = [ + // fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries) + // ]; + let permissionEntries = []; + entries.forEach(function (p) { + permissionEntries.push(fillInPluginPermissionTemplate(p.permission, p.obj)); + }); let permPluginsRow = document.getElementById("permPluginsRow"); clearPluginPermissionTemplate(); diff --git a/application/palemoon/base/content/popup-notifications.inc b/application/palemoon/base/content/popup-notifications.inc index 04f4cb5b7..7be975b7f 100644 --- a/application/palemoon/base/content/popup-notifications.inc +++ b/application/palemoon/base/content/popup-notifications.inc @@ -54,7 +54,7 @@ </hbox> </panel> - +#ifdef MOZ_WEBRTC <popupnotification id="webRTC-shareDevices-notification" hidden="true"> <popupnotificationcontent id="webRTC-selectCamera" orient="vertical"> <separator class="thin"/> @@ -75,7 +75,7 @@ </menulist> </popupnotificationcontent> </popupnotification> - +#endif <popupnotification id="servicesInstall-notification" hidden="true"> <popupnotificationcontent orient="vertical" align="start"> <!-- XXX bug 974146, tests are looking for this, can't remove yet. --> @@ -89,6 +89,14 @@ </popupnotificationcontent> </popupnotification> + <popupnotification id="password-notification" hidden="true"> + <popupnotificationcontent orient="vertical"> + <textbox id="password-notification-username"/> + <textbox id="password-notification-password" type="password" show-content=""/> + <checkbox id="password-notification-visibilityToggle" hidden="true"/> + </popupnotificationcontent> + </popupnotification> + <popupnotification id="mixed-content-blocked-notification" hidden="true"> <popupnotificationcontent orient="vertical" align="start"> <separator/> diff --git a/application/palemoon/base/content/sanitize.js b/application/palemoon/base/content/sanitize.js index 89843c86d..fccec6c98 100644 --- a/application/palemoon/base/content/sanitize.js +++ b/application/palemoon/base/content/sanitize.js @@ -15,7 +15,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Promise", XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "console", - "resource://gre/modules/devtools/Console.jsm"); + "resource://gre/modules/Console.jsm"); function Sanitizer() {} Sanitizer.prototype = { diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index b8d5f3e41..4b10855a7 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -73,7 +73,7 @@ .getService(Components.interfaces.nsIFaviconService); </field> <field name="_placesAutocomplete" readonly="true"> - Components.classes["@mozilla.org/autocomplete/search;1?name=history"] + Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"] .getService(Components.interfaces.mozIPlacesAutoComplete); </field> <field name="mTabBox" readonly="true"> @@ -302,6 +302,16 @@ </body> </method> + <method name="getBrowserForContentWindow"> + <parameter name="aWindow"/> + <body> + <![CDATA[ + var tab = this._getTabForContentWindow(aWindow); + return tab ? tab.linkedBrowser : null; + ]]> + </body> + </method> + <method name="getBrowserForOuterWindowID"> <parameter name="aID"/> <body> @@ -707,7 +717,8 @@ let autocomplete = this.mTabBrowser._placesAutocomplete; if (this.mBrowser.registeredOpenURI) { - autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI); + autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI, + this.mBrowser.getAttribute("usercontextid") || 0); delete this.mBrowser.registeredOpenURI; } // Tabs in private windows aren't registered as "Open" so @@ -715,7 +726,8 @@ if (!isBlankPageURL(aLocation.spec) && (!PrivateBrowsingUtils.isWindowPrivate(window) || PrivateBrowsingUtils.permanentPrivateBrowsing)) { - autocomplete.registerOpenPage(aLocation); + autocomplete.registerOpenPage(aLocation, + this.mBrowser.getAttribute("usercontextid") || 0); this.mBrowser.registeredOpenURI = aLocation; } } @@ -766,19 +778,28 @@ <method name="setIcon"> <parameter name="aTab"/> <parameter name="aURI"/> + <parameter name="aLoadingPrincipal"/> <body> <![CDATA[ - var browser = this.getBrowserForTab(aTab); + let browser = this.getBrowserForTab(aTab); browser.mIconURL = aURI instanceof Ci.nsIURI ? aURI.spec : aURI; if (aURI && this.mFaviconService) { - if (!(aURI instanceof Ci.nsIURI)) + if (!(aURI instanceof Ci.nsIURI)) { aURI = makeURI(aURI); - this.mFaviconService.setAndFetchFaviconForPage(browser.currentURI, - aURI, false, - PrivateBrowsingUtils.isWindowPrivate(window) ? - this.mFaviconService.FAVICON_LOAD_PRIVATE : - this.mFaviconService.FAVICON_LOAD_NON_PRIVATE); + } + // We do not serialize the principal from within SessionStore.jsm, + // hence if aLoadingPrincipal is null we default to the + // systemPrincipal which will allow the favicon to load. + let loadingPrincipal = aLoadingPrincipal + ? aLoadingPrincipal + : Services.scriptSecurityManager.getSystemPrincipal(); + let loadType = PrivateBrowsingUtils.isWindowPrivate(window) + ? this.mFaviconService.FAVICON_LOAD_PRIVATE + : this.mFaviconService.FAVICON_LOAD_NON_PRIVATE; + + this.mFaviconService.setAndFetchFaviconForPage( + browser.currentURI, aURI, false, loadType, null, loadingPrincipal); } let sizedIconUrl = browser.mIconURL || ""; @@ -874,7 +895,7 @@ if (!this.isFailedIcon(url)) icon = url; } - this.setIcon(aTab, icon); + this.setIcon(aTab, icon, browser.contentPrincipal); ]]> </body> </method> @@ -1566,7 +1587,7 @@ } if (animate) { - mozRequestAnimationFrame(function () { + requestAnimationFrame(function () { this.tabContainer._handleTabTelemetryStart(t, aURI); // kick the animation off @@ -1865,7 +1886,8 @@ this.mTabListeners[aTab._tPos].destroy(); if (browser.registeredOpenURI && !aTabWillBeMoved) { - this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI); + this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI, + browser.getAttribute("usercontextid") || 0); delete browser.registeredOpenURI; } @@ -2133,7 +2155,7 @@ // Workarounds for bug 458697 // Icon might have been set on DOMLinkAdded, don't override that. if (!ourBrowser.mIconURL && otherBrowser.mIconURL) - this.setIcon(aOurTab, otherBrowser.mIconURL); + this.setIcon(aOurTab, otherBrowser.mIconURL, otherBrowser.contentPrincipal); var isBusy = aOtherTab.hasAttribute("busy"); if (isBusy) { aOurTab.setAttribute("busy", "true"); @@ -2209,7 +2231,8 @@ <![CDATA[ // If the current URI is registered as open remove it from the list. if (aOurBrowser.registeredOpenURI) { - this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI); + this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI, + aOurBrowser.getAttribute("usercontextid") || 0); delete aOurBrowser.registeredOpenURI; } @@ -2716,6 +2739,9 @@ get finder() { return this.mTabBrowser.mCurrentBrowser.finder; }, + destroy: function() { + this.finder.destroy(); + }, addResultListener: function(aListener) { this.mListeners.add(aListener); this.finder.addResultListener(aListener); @@ -2736,21 +2762,33 @@ set caseSensitive(val) { return this.finder.caseSensitive = val; }, - fastFind: function(aSearchString, aLinksOnly, aDrawOutline) { - this.finder.fastFind(aSearchString, aLinksOnly, aDrawOutline); + set entireWord(val) { + return this.finder.entireWord = val; + }, + get highlighter() { + return this.finder.highlighter; + }, + get matchesCountLimit() { + return this.finder.matchesCountLimit; }, - findAgain: function(aFindBackwards, aLinksOnly, aDrawOutline) { - this.finder.findAgain(aFindBackwards, aLinksOnly, aDrawOutline); + fastFind: function(...args) { + this.finder.fastFind(...args); + }, + findAgain: function(...args) { + this.finder.findAgain(...args); }, setSearchStringToSelection: function() { return this.finder.setSearchStringToSelection(); }, - highlight: function(aHighlight, aWord) { - this.finder.highlight(aHighlight, aWord); + highlight: function(...args) { + this.finder.highlight(...args); }, getInitialSelection: function() { this.finder.getInitialSelection(); }, + getActiveSelectionText: function() { + return this.finder.getActiveSelectionText(); + }, enableSelection: function() { this.finder.enableSelection(); }, @@ -2760,11 +2798,38 @@ focusContent: function() { this.finder.focusContent(); }, + onFindbarClose: function() { + this.finder.onFindbarClose(); + }, + onFindbarOpen: function() { + this.finder.onFindbarOpen(); + }, + onModalHighlightChange: function(...args) { + return this.finder.onModalHighlightChange(...args); + }, + onHighlightAllChange: function(...args) { + return this.finder.onHighlightAllChange(...args); + }, keyPress: function(aEvent) { this.finder.keyPress(aEvent); }, - requestMatchesCount: function(aWord, aMatchLimit, aLinksOnly) { - this.finder.requestMatchesCount(aWord, aMatchLimit, aLinksOnly); + requestMatchesCount: function(...args) { + this.finder.requestMatchesCount(...args); + }, + onIteratorRangeFound: function(...args) { + this.finder.onIteratorRangeFound(...args); + }, + onIteratorReset: function() { + this.finder.onIteratorReset(); + }, + onIteratorRestart: function(...args) { + this.finder.onIteratorRestart(...args); + }, + onIteratorStart: function(...args) { + this.finder.onIteratorStart(...args); + }, + onLocationChange: function(...args) { + this.finder.onLocationChange(...args); } }) ]]></field> @@ -2773,6 +2838,19 @@ onget="return this.mCurrentBrowser.docShell" readonly="true"/> + <property name="messageManager" + readonly="true"> + <getter> + <![CDATA[ + let frameLoader = this.mCurrentBrowser.frameLoader; + if (!frameLoader) { + return null; + } + return frameLoader.messageManager; + ]]> + </getter> + </property> + <property name="webNavigation" onget="return this.mCurrentBrowser.webNavigation" readonly="true"/> @@ -2789,6 +2867,10 @@ readonly="true" onget="return this.mCurrentBrowser.contentWindow"/> + <property name="contentWindowAsCPOW" + readonly="true" + onget="return this.mCurrentBrowser.contentWindow;"/> + <property name="sessionHistory" onget="return this.mCurrentBrowser.sessionHistory;" readonly="true"/> @@ -2809,6 +2891,10 @@ onget="return this.mCurrentBrowser.contentDocument;" readonly="true"/> + <property name="contentDocumentAsCPOW" + onget="return this.mCurrentBrowser.contentDocument;" + readonly="true"/> + <property name="contentTitle" onget="return this.mCurrentBrowser.contentTitle;" readonly="true"/> @@ -2859,23 +2945,6 @@ } } - // We need to take care of FAYT-watching as long as the findbar - // isn't initialized. The checks on aEvent are copied from - // _shouldFastFind (see findbar.xml). - if (!gFindBarInitialized && - !(aEvent.ctrlKey || aEvent.metaKey) && - !aEvent.defaultPrevented) { - let charCode = aEvent.charCode; - if (charCode) { - let char = String.fromCharCode(charCode); - if (char == "'" || char == "/" || - Services.prefs.getBoolPref("accessibility.typeaheadfind")) { - gFindBar._onBrowserKeypress(aEvent); - return; - } - } - } - #ifdef XP_MACOSX if (!aEvent.metaKey) return; @@ -2950,13 +3019,31 @@ let browser = aMessage.target; switch (aMessage.name) { - case "DOMTitleChanged": + case "DOMTitleChanged": { let tab = this.getTabForBrowser(browser); if (!tab) return; let titleChanged = this.setTabTitle(tab); if (titleChanged && !tab.selected && !tab.hasAttribute("busy")) tab.setAttribute("titlechanged", "true"); + break; + } + case "DOMWebNotificationClicked": { + let tab = this.getTabForBrowser(browser); + if (!tab) + return; + this.selectedTab = tab; + window.focus(); + break; + } + case "Findbar:Keypress": + if (!gFindBarInitialized) { + // If the find bar for this tab is not yet alive, change that, + // and make sure we return the result: + return gFindBar.receiveMessage(aMessage); + } + break; + } ]]></body> </method> @@ -3022,6 +3109,8 @@ this._outerWindowIDBrowserMap.set(this.mCurrentBrowser.outerWindowID, this.mCurrentBrowser); } + messageManager.addMessageListener("DOMWebNotificationClicked", this); + messageManager.addMessageListener("Findbar:Keypress", this); ]]> </constructor> @@ -3055,7 +3144,8 @@ for (var i = 0; i < this.mTabListeners.length; ++i) { let browser = this.getBrowserAtIndex(i); if (browser.registeredOpenURI) { - this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI); + this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI, + browser.getAttribute("usercontextid") || 0); delete browser.registeredOpenURI; } browser.webProgress.removeProgressListener(this.mTabFilters[i]); diff --git a/application/palemoon/base/jar.mn b/application/palemoon/base/jar.mn index 9031f3beb..29896341e 100644 --- a/application/palemoon/base/jar.mn +++ b/application/palemoon/base/jar.mn @@ -53,6 +53,9 @@ browser.jar: content/browser/browser-title.css (content/browser-title.css) * content/browser/browser.js (content/browser.js) * content/browser/browser.xul (content/browser.xul) +#ifdef MOZ_DEVTOOLS + content/browser/browser-devtools-theme.js (content/browser-devtools-theme.js) +#endif * content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml) content/browser/content.js (content/content.js) content/browser/padlock.xul (content/padlock.xul) |