Bug 1350215 - Merge toolbox launcher in index.html r?honza,gasolin
MozReview-Commit-ID: B4AzUVmD2f4
--- a/devtools/client/definitions.js
+++ b/devtools/client/definitions.js
@@ -303,17 +303,17 @@ Tools.netMonitor = {
id: "netmonitor",
accesskey: l10n("netmonitor.accesskey"),
key: l10n("netmonitor.commandkey"),
ordinal: 9,
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
visibilityswitch: "devtools.netmonitor.enabled",
icon: "chrome://devtools/skin/images/tool-network.svg",
invertIconForDarkTheme: true,
- url: "chrome://devtools/content/netmonitor/netmonitor.xhtml",
+ url: "chrome://devtools/content/netmonitor/index.html",
label: l10n("netmonitor.label"),
panelLabel: l10n("netmonitor.panelLabel"),
get tooltip() {
return l10n("netmonitor.tooltip2",
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
},
inMenu: true,
--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -5,18 +5,17 @@
devtools.jar:
% content devtools %content/
content/shared/vendor/d3.js (shared/vendor/d3.js)
content/shared/vendor/dagre-d3.js (shared/vendor/dagre-d3.js)
content/shared/widgets/widgets.css (shared/widgets/widgets.css)
content/shared/widgets/VariablesView.xul (shared/widgets/VariablesView.xul)
content/projecteditor/chrome/content/projecteditor.xul (projecteditor/chrome/content/projecteditor.xul)
content/projecteditor/lib/helpers/readdir.js (projecteditor/lib/helpers/readdir.js)
- content/netmonitor/netmonitor.xhtml (netmonitor/netmonitor.xhtml)
- content/netmonitor/netmonitor.js (netmonitor/netmonitor.js)
+ content/netmonitor/index.html (netmonitor/index.html)
content/webconsole/webconsole.xul (webconsole/webconsole.xul)
* content/scratchpad/scratchpad.xul (scratchpad/scratchpad.xul)
content/scratchpad/scratchpad.js (scratchpad/scratchpad.js)
content/shared/splitview.css (shared/splitview.css)
content/shared/theme-switching.js (shared/theme-switching.js)
content/shared/frame-script-utils.js (shared/frame-script-utils.js)
content/styleeditor/styleeditor.xul (styleeditor/styleeditor.xul)
content/storage/storage.xul (storage/storage.xul)
new file mode 100644
--- /dev/null
+++ b/devtools/client/netmonitor/index.html
@@ -0,0 +1,58 @@
+<!-- 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/. -->
+<!DOCTYPE html>
+<html dir="">
+ <head>
+ <link rel="stylesheet" href="chrome://devtools/content/shared/widgets/widgets.css"/>
+ <link rel="stylesheet" href="chrome://devtools/skin/widgets.css"/>
+ <link rel="stylesheet" href="chrome://devtools/skin/netmonitor.css"/>
+ <script type="application/javascript;version=1.8"
+ src="chrome://devtools/content/shared/theme-switching.js">
+ </script>
+ </head>
+ <body class="theme-sidebar" role="application">
+ <div id="mount"></div>
+ <script>
+ const { BrowserLoader } = Components.utils.import("resource://devtools/client/shared/browser-loader.js", {});
+ const { require } = BrowserLoader({
+ baseURI: "resource://devtools/client/netmonitor/",
+ window,
+ });
+
+ const EventEmitter = require("devtools/shared/event-emitter");
+ const { createFactory } = require("devtools/client/shared/vendor/react");
+ const { render, unmountComponentAtNode } = require("devtools/client/shared/vendor/react-dom");
+ const Provider = createFactory(require("devtools/client/shared/vendor/react-redux").Provider);
+ const { configureStore } = require("./src/utils/create-store");
+ const store = window.gStore = configureStore();
+ const { NetMonitorController } = require("./src/netmonitor-controller");
+
+ // Inject EventEmitter into global window.
+ EventEmitter.decorate(window);
+
+ // Export NetMonitorController to global window
+ // FIXME: Use module export mechanism instead of this tricky global variables
+ window.NetMonitorController = NetMonitorController;
+
+ window.Netmonitor = {
+ bootstrap({ toolbox }) {
+ this.mount = document.querySelector("#mount");
+ const App = createFactory(require("./src/components/App"));
+ render(Provider({ store }, App()), this.mount);
+ return NetMonitorController.startupNetMonitor({
+ client: {
+ getTabTarget: () => toolbox.target,
+ },
+ toolbox,
+ });
+ },
+
+ destroy() {
+ unmountComponentAtNode(this.mount);
+ return NetMonitorController.shutdownNetMonitor();
+ }
+ };
+ </script>
+ </body>
+</html>
--- a/devtools/client/netmonitor/moz.build
+++ b/devtools/client/netmonitor/moz.build
@@ -2,16 +2,15 @@
# 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/.
DIRS += [
'src'
]
DevToolsModules(
- 'netmonitor.js',
'panel.js'
)
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Netmonitor')
deleted file mode 100644
--- a/devtools/client/netmonitor/netmonitor.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* 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/. */
-
-/* exported Netmonitor */
-
-"use strict";
-
-const { BrowserLoader } = Components.utils.import("resource://devtools/client/shared/browser-loader.js", {});
-
-var Netmonitor = {
- bootstrap: ({ tabTarget, toolbox }) => {
- const require = window.windowRequire = BrowserLoader({
- baseURI: "resource://devtools/client/netmonitor/",
- window,
- commonLibRequire: toolbox.browserRequire,
- }).require;
-
- const EventEmitter = require("devtools/shared/event-emitter");
- const { createFactory } = require("devtools/client/shared/vendor/react");
- const { render } = require("devtools/client/shared/vendor/react-dom");
- const Provider = createFactory(require("devtools/client/shared/vendor/react-redux").Provider);
- const { configureStore } = require("./src/utils/create-store");
- const store = window.gStore = configureStore();
- const { NetMonitorController } = require("./src/netmonitor-controller");
- NetMonitorController.toolbox = toolbox;
- NetMonitorController._target = toolbox.target;
- this.NetMonitorController = NetMonitorController;
-
- // Inject EventEmitter into netmonitor window.
- EventEmitter.decorate(window);
-
- // Components
- const App = createFactory(require("./src/components/App"));
-
- this.root = document.querySelector(".root");
-
- render(Provider({ store }, App()), this.root);
-
- return NetMonitorController.startupNetMonitor({
- client: {
- getTabTarget: () => toolbox.target,
- },
- toolbox,
- });
- },
-
- destroy: () => {
- const require = window.windowRequire;
- const { unmountComponentAtNode } = require("devtools/client/shared/vendor/react-dom");
-
- unmountComponentAtNode(this.root);
-
- return this.NetMonitorController.shutdownNetMonitor();
- }
-};
deleted file mode 100644
--- a/devtools/client/netmonitor/netmonitor.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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/. -->
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" dir="">
- <head>
- <link rel="stylesheet" href="chrome://devtools/content/shared/widgets/widgets.css"/>
- <link rel="stylesheet" href="chrome://devtools/skin/widgets.css"/>
- <link rel="stylesheet" href="chrome://devtools/skin/netmonitor.css"/>
- <script src="chrome://devtools/content/shared/theme-switching.js"/>
- </head>
- <body class="theme-sidebar" role="application">
- <div class="root"></div>
- <script src="netmonitor.js"/>
- </body>
-</html>
--- a/devtools/client/netmonitor/panel.js
+++ b/devtools/client/netmonitor/panel.js
@@ -10,17 +10,16 @@ function NetMonitorPanel(iframeWindow, t
}
NetMonitorPanel.prototype = {
async open() {
if (!this.toolbox.target.isRemote) {
await this.toolbox.target.makeRemote();
}
await this.panelWin.Netmonitor.bootstrap({
- tabTarget: this.toolbox.target,
toolbox: this.toolbox,
});
this.emit("ready");
this.isReady = true;
return this;
},
async destroy() {
--- a/devtools/client/themes/netmonitor.css
+++ b/devtools/client/themes/netmonitor.css
@@ -1303,16 +1303,16 @@
}
.split-box {
overflow: hidden;
}
html,
body,
-.root,
+#mount,
.network-monitor,
.monitor-panel {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}