summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content/browser.js
diff options
context:
space:
mode:
Diffstat (limited to 'application/palemoon/base/content/browser.js')
-rw-r--r--application/palemoon/base/content/browser.js200
1 files changed, 46 insertions, 154 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index ffb133963..8b3fa0b4f 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -3,9 +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 Cc = Components.classes;
-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");
@@ -110,20 +109,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");
@@ -153,7 +138,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
@@ -706,6 +695,8 @@ const gXSSObserver = {
};
var gBrowserInit = {
+ delayedStartupFinished: false,
+
onLoad: function() {
gMultiProcessBrowser = gPrefService.getBoolPref("browser.tabs.remote");
@@ -1020,7 +1011,9 @@ var gBrowserInit = {
OfflineApps.init();
IndexedDBPromptHelper.init();
AddonManager.addAddonListener(AddonsMgrListener);
+#ifdef MOZ_WEBRTC
WebrtcIndicator.init();
+#endif
// Ensure login manager is up and running.
Services.logins;
@@ -1162,27 +1155,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) {
@@ -1200,19 +1172,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) {
@@ -1253,6 +1212,8 @@ var gBrowserInit = {
setTimeout(function () { BrowserChromeTest.markAsReady(); }, 0);
});
+ this.delayedStartupFinished = true;
+
Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
},
@@ -1288,15 +1249,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).
@@ -2065,49 +2017,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
@@ -6880,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
@@ -6984,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