Bug 1297758 - Throw when accessing any unimplemented toolbox function when loading inspector in a tab. r=pbro
MozReview-Commit-ID: AsI0Fluyu7j
--- 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 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() {}
};