Bug 1291049 - Bundle temporary environment bundle with the inspector
MozReview-Commit-ID: Iea7CDpp90Y
--- a/devtools/client/inspector/inspector.html/main.js
+++ b/devtools/client/inspector/inspector.html/main.js
@@ -161,31 +161,27 @@
return { type: "firefox", param: firefoxMatch[1] };
} else if (chromeMatch) {
return { type: "chrome", param: chromeMatch[1] };
}
return null;
}
- function* getTabTarget(targetEnv) {
- var tabs = yield firefox.connectClient();
- var tab = tabs.find(t => t.id.indexOf(connTarget.param) !== -1);
- yield firefox.connectTab(tab.tab);
- return targetEnv.getTabTarget();
- }
-
var connTarget = getTargetFromQuery();
if (connTarget) {
Task.spawn(function* () {
var _window = window;
var buildFakeToolbox = _window.buildFakeToolbox;
var Inspector = _window.Inspector;
- var tabTarget = yield getTabTarget(firefox);
+ var tabs = yield firefox.connectClient();
+ var tab = tabs.find(t => t.id.indexOf(connTarget.param) !== -1);
+ yield firefox.connectTab(tab.tab);
+ var tabTarget = yield firefox.getTabTarget();
var fakeToolbox = yield buildFakeToolbox(tabTarget);
var inspector = new Inspector(fakeToolbox);
inspector.init();
});
} else if (isFirefoxPanel()) {
(function () {
var sourceMap = __webpack_require__(371);
--- a/devtools/client/inspector/inspector.xhtml
+++ b/devtools/client/inspector/inspector.xhtml
@@ -2,57 +2,54 @@
<!-- 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="" class="theme-light" platform="mac">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <script type="application/javascript;version=1.8"
- src="chrome://devtools/content/shared/theme-switching.js"></script>
+
+ <link rel="stylesheet" type="text/css" href="chrome://global/skin/"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/light-theme.css"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/widgets.css"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/inspector.css"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/rules.css"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/computed.css"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/fonts.css"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/boxmodel.css"/>
+ <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/animationinspector.css"/>
+ <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/widgets/widgets.css"/>
+ <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/sidebar-toggle.css"/>
+ <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/tabs/tabs.css"/>
+ <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/tabs/tabbar.css"/>
+ <link rel="stylesheet" type="text/css" href="resource://devtools/client/inspector/components/inspector-tab-panel.css"/>
+ <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/splitter/split-box.css"/>
+
+ <script type="application/javascript;version=1.8" src="chrome://devtools/content/shared/theme-switching.js"></script>
<script>
let appendScriptTag = function (src) {
let script = document.createElement("script");
script.setAttribute("type", "application/javascript;version=1.8");
script.setAttribute("defer", "true");
script.src = src;
document.head.appendChild(script);
};
let loadInChrome = window.location.href.includes("chrome:");
if (loadInChrome) {
var Cu = Components.utils;
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
appendScriptTag("inspector.js");
} else {
- appendScriptTag("inspector.bundle.js");
- appendScriptTag("inspector.html/main.js");
- }
- </script>
-
- <link rel="stylesheet" type="text/css" href="chrome://global/skin/">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/light-theme.css">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/widgets.css">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/inspector.css">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/rules.css">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/computed.css">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/fonts.css">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/boxmodel.css">
- <link rel="stylesheet" type="text/css" href="chrome://devtools/skin/animationinspector.css">
- <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/widgets/widgets.css">
- <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/sidebar-toggle.css">
- <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/tabs/tabs.css">
- <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/tabs/tabbar.css">
- <link rel="stylesheet" type="text/css" href="resource://devtools/client/inspector/components/inspector-tab-panel.css">
- <link rel="stylesheet" type="text/css" href="resource://devtools/client/shared/components/splitter/split-box.css">
- <script type="text/javascript">
+ appendScriptTag("inspector.bundle.js");;
for (let link of [...document.head.querySelectorAll("link")]) {
link.href = link.href.replace(/\w+\:\/\//, "");
}
+ }
</script>
</head>
<body class="theme-body" role="application">
<div id="mount"></div>
<div class="inspector-responsive-container theme-body inspector">
<!-- Main Panel Content -->
<div id="inspector-main-content" class="devtools-main-content">
--- a/devtools/client/webpack.config.js
+++ b/devtools/client/webpack.config.js
@@ -37,20 +37,25 @@ module.exports = [{
output: {
filename: "./sourceeditor/codemirror/codemirror.bundle.js",
libraryTarget: "var",
library: "CodeMirror",
},
}, {
bail: true,
- entry: './inspector/inspector.js',
+ entry: [
+ // Inspector bundle
+ "./inspector/inspector.js",
+ // Landing page + local environment pre-bundled from a fork of debugger.html.
+ "./inspector/inspector.html/main.js"
+ ],
output: {
- filename: './inspector/inspector.bundle.js',
- library: 'InspectorBundle',
+ filename: "./inspector/inspector.bundle.js",
+ library: "InspectorBundle",
},
module: {
// Disable handling of unknown requires
unknownContextRegExp: /$^/,
unknownContextCritical: false,
// Disable handling of requires with a single expression
exprContextRegExp: /$^/,
@@ -58,23 +63,23 @@ module.exports = [{
// Warn for every expression in require
wrappedContextCritical: true,
loaders: [
{
test: /event-emitter/,
exclude: /node_modules/,
- loaders: [__dirname + '/webpack/rewrite-event-emitter'],
+ loaders: [__dirname + "/webpack/rewrite-event-emitter"],
},
]
},
resolveLoader: {
root: [
- path.resolve('./node_modules'),
+ path.resolve("./node_modules"),
path.resolve("./webpack"),
]
},
resolve: {
alias: {
"devtools-shared/locale": path.join(__dirname, "../shared/locales/en-US"),
"devtools/locale": path.join(__dirname, "./locales/en-US"),
"global/locale": path.join(__dirname, "../../toolkit/locales/en-US/chrome/global"),
@@ -110,18 +115,18 @@ module.exports = [{
// Just trying to get build to work. These should be removed eventually:
"chrome": "{}",
// In case you end up in chrome-land you can use this to help track down issues.
// SDK for instance does a bunch of this so if you somehow end up importing an SDK
// dependency this might help for debugging:
// "chrome": `{
// Cc: {
- // '@mozilla.org/uuid-generator;1': { getService: () => { return {} } },
- // '@mozilla.org/observer-service;1': { getService: () => { return {} } },
+ // "@mozilla.org/uuid-generator;1": { getService: () => { return {} } },
+ // "@mozilla.org/observer-service;1": { getService: () => { return {} } },
// },
// Ci: {},
// Cr: {},
// Cm: {},
// components: { classesByID: () => {} , ID: () => {} }
// }`,
"resource://gre/modules/XPCOMUtils.jsm": "{}",
--- a/devtools/client/webpack/prefs-loader.js
+++ b/devtools/client/webpack/prefs-loader.js
@@ -14,16 +14,17 @@ module.exports = function (content) {
// This maps the text of a "#if" to its truth value. This has to
// cover all uses of #if in devtools.js.
const ifMap = {
"#if MOZ_UPDATE_CHANNEL == beta": false,
"#if defined(NIGHTLY_BUILD)": false,
"#ifdef NIGHTLY_BUILD": false,
"#ifdef MOZ_DEV_EDITION": false,
+ "#ifdef RELEASE_OR_BETA": true,
"#ifdef RELEASE_BUILD": true,
};
let lines = content.split("\n");
let ignoring = false;
let newLines = [];
let continuation = false;
for (let line of lines) {