Bug 1297758 - Throw when accessing any unimplemented toolbox function when loading inspector in a tab. r=pbro
☠☠ backed out by ea0886a6ed22 ☠ ☠
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 26 Sep 2016 07:08:00 -0700
changeset 315378 95ca02cec38d17f853320e86c916598f57047ce9
parent 315377 80bc957e105281545ca872e67fa9f47015fec7f2
child 315379 3bbbac2f677513473f3181b129d03f4baabe07e8
push id30748
push usercbook@mozilla.com
push dateWed, 28 Sep 2016 13:53:19 +0000
treeherdermozilla-central@8c84b7618840 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1297758
milestone52.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 1297758 - Throw when accessing any unimplemented toolbox function when loading inspector in a tab. r=pbro MozReview-Commit-ID: AsI0Fluyu7j
devtools/client/inspector/inspector.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -1836,16 +1836,19 @@ if (url.search.length > 1) {
 
   const { Selection } = require("devtools/client/framework/selection");
   const { InspectorFront } = require("devtools/shared/fronts/inspector");
   const { getHighlighterUtils } = require("devtools/client/framework/toolbox-highlighter-utils");
 
   Task.spawn(function* () {
     let target = yield targetFromURL(url);
 
+    let notImplemented = function () {
+      throw new Error("Not implemented when the inspector is in a tab");
+    };
     let fakeToolbox = {
       target,
       hostType: "bottom",
       doc: window.document,
       win: window,
       on() {}, emit() {}, off() {},
       initInspector() {},
       browserRequire: BrowserLoader({
@@ -1856,16 +1859,31 @@ if (url.search.length > 1) {
         return this.browserRequire("devtools/client/shared/vendor/react");
       },
       get ReactDOM() {
         return this.browserRequire("devtools/client/shared/vendor/react-dom");
       },
       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,
+
       // For attachThread:
       highlightTool() {},
       unhighlightTool() {},
       selectTool() {},
       raise() {},
       getNotificationBox() {}
     };