Bug 1456075 - Remove standalone inspector initialization code;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 23 Apr 2018 12:16:08 +0200
changeset 468576 0483916013c87e92f9ed6a6974f7ccfec7958c94
parent 468575 b094c196229b40cbf044771c45fbb03b065dc557
child 468577 47284c0bd982997909f68f17363e340b0717aa3f
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1456075
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1456075 - Remove standalone inspector initialization code;r=ochameau MozReview-Commit-ID: 6uwKogI7079
devtools/client/inspector/inspector.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -2431,120 +2431,9 @@ Inspector.prototype = {
       return false;
     }
 
     await this.selection.setNodeFront(nodeFront, { reason: inspectFromAnnotation });
     return true;
   },
 };
 
-/**
- * Create a fake toolbox when running the inspector standalone, either in a chrome tab or
- * in a content tab.
- *
- * @param {Target} target to debug
- * @param {Function} createThreadClient
- *        When supported the thread client needs a reference to the toolbox.
- *        This callback will be called right after the toolbox object is created.
- * @param {Object} dependencies
- *        - react
- *        - reactDOM
- *        - browserRequire
- */
-const buildFakeToolbox = async function(
-  target, createThreadClient, {
-    React,
-    ReactDOM,
-    browserRequire
-  }) {
-  const { InspectorFront } = require("devtools/shared/fronts/inspector");
-  const { Selection } = require("devtools/client/framework/selection");
-  const { getHighlighterUtils } = require("devtools/client/framework/toolbox-highlighter-utils");
-
-  let notImplemented = function() {
-    throw new Error("Not implemented in a tab");
-  };
-  let fakeToolbox = {
-    target,
-    hostType: "bottom",
-    doc: window.document,
-    win: window,
-    on() {}, emit() {}, off() {},
-    initInspector() {},
-    browserRequire,
-    React,
-    ReactDOM,
-    isToolRegistered() {
-      return false;
-    },
-    currentToolId: "inspector",
-    getCurrentPanel() {
-      return "inspector";
-    },
-    get textboxContextMenuPopup() {
-      notImplemented();
-    },
-    getPanel: notImplemented,
-    openSplitConsole: notImplemented,
-    viewCssSourceInStyleEditor: notImplemented,
-    viewJsSourceInDebugger: notImplemented,
-    viewSource: notImplemented,
-    viewSourceInDebugger: notImplemented,
-    viewSourceInStyleEditor: notImplemented,
-
-    get inspectorExtensionSidebars() {
-      notImplemented();
-    },
-
-    // For attachThread:
-    highlightTool() {},
-    unhighlightTool() {},
-    selectTool() {},
-    raise() {},
-    getNotificationBox() {}
-  };
-
-  fakeToolbox.threadClient = await createThreadClient(fakeToolbox);
-
-  let inspector = InspectorFront(target.client, target.form);
-  let showAllAnonymousContent =
-    Services.prefs.getBoolPref("devtools.inspector.showAllAnonymousContent");
-  let walker = await inspector.getWalker({ showAllAnonymousContent });
-  let selection = new Selection(walker);
-  let highlighter = await inspector.getHighlighter(false);
-  fakeToolbox.highlighterUtils = getHighlighterUtils(fakeToolbox);
-
-  fakeToolbox.inspector = inspector;
-  fakeToolbox.walker = walker;
-  fakeToolbox.selection = selection;
-  fakeToolbox.highlighter = highlighter;
-  return fakeToolbox;
-};
-
-// URL constructor doesn't support chrome: scheme
-let href = window.location.href.replace(/chrome:/, "http://");
-let url = new window.URL(href);
-
-// If query parameters are given in a chrome tab, the inspector is running in standalone.
-if (window.location.protocol === "chrome:" && url.search.length > 1) {
-  const { targetFromURL } = require("devtools/client/framework/target-from-url");
-  const { attachThread } = require("devtools/client/framework/attach-thread");
-
-  const browserRequire = BrowserLoader({ window, useOnlyShared: true }).require;
-  const React = browserRequire("devtools/client/shared/vendor/react");
-  const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
-
-  (async function() {
-    let target = await targetFromURL(url);
-    let fakeToolbox = await buildFakeToolbox(
-      target,
-      (toolbox) => attachThread(toolbox),
-      { React, ReactDOM, browserRequire }
-    );
-    let inspectorUI = new Inspector(fakeToolbox);
-    inspectorUI.init();
-  })().catch(e => {
-    window.alert("Unable to start the inspector:" + e.message + "\n" + e.stack);
-  });
-}
-
 exports.Inspector = Inspector;
-exports.buildFakeToolbox = buildFakeToolbox;