From e3f2f0fb2722106c875c253203e6f25884e79fd3 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Tue, 27 Sep 2016 18:21:57 -0700 Subject: [PATCH] Backed out 4 changesets (bug 1297758) for browser_dbg_variables-view-popup-13.js failures CLOSED TREE Backed out changeset 95ca02cec38d (bug 1297758) Backed out changeset 80bc957e1052 (bug 1297758) Backed out changeset fee0da956618 (bug 1297758) Backed out changeset 1ac36ff4b601 (bug 1297758) --HG-- rename : devtools/client/inspector/inspector.js => devtools/client/inspector/inspector-panel.js --- .../animation-controller.js | 2 +- devtools/client/definitions.js | 2 +- .../client/inspector/components/box-model.js | 12 +- .../{inspector.js => inspector-panel.js} | 111 ++---------------- devtools/client/inspector/inspector.xhtml | 1 - .../browser_markup_update-on-navigtion.js | 2 +- devtools/client/inspector/moz.build | 2 +- devtools/client/inspector/panel.js | 19 --- devtools/client/inspector/rules/rules.js | 2 +- .../inspector/rules/views/rule-editor.js | 2 +- .../test/browser_inspector_highlighter-03.js | 2 +- .../test/browser_inspector_highlighter-04.js | 6 +- .../browser_inspector_highlighter-hover_02.js | 4 +- ...ser_inspector_highlighter-keybinding_03.js | 2 +- .../browser_inspector_highlighter-options.js | 6 +- .../test/browser_inspector_highlighter-xbl.js | 2 +- .../test/browser_inspector_invalidate.js | 4 +- .../browser_inspector_pseudoclass-lock.js | 7 +- devtools/client/jar.mn | 1 - devtools/client/shared/widgets/Tooltip.js | 2 +- 20 files changed, 39 insertions(+), 152 deletions(-) rename devtools/client/inspector/{inspector.js => inspector-panel.js} (94%) delete mode 100644 devtools/client/inspector/panel.js diff --git a/devtools/client/animationinspector/animation-controller.js b/devtools/client/animationinspector/animation-controller.js index 82e8a775b522..59ac5f84c033 100644 --- a/devtools/client/animationinspector/animation-controller.js +++ b/devtools/client/animationinspector/animation-controller.js @@ -142,7 +142,7 @@ var AnimationsController = { this.onNewNodeFront = this.onNewNodeFront.bind(this); this.onAnimationMutations = this.onAnimationMutations.bind(this); - let target = gInspector.target; + let target = gToolbox.target; this.animationsFront = new AnimationsFront(target.client, target.form); // Expose actor capabilities. diff --git a/devtools/client/definitions.js b/devtools/client/definitions.js index acbc710a22ab..22f85a3367d4 100644 --- a/devtools/client/definitions.js +++ b/devtools/client/definitions.js @@ -9,7 +9,7 @@ const osString = Services.appinfo.OS; // Panels loader.lazyGetter(this, "OptionsPanel", () => require("devtools/client/framework/toolbox-options").OptionsPanel); -loader.lazyGetter(this, "InspectorPanel", () => require("devtools/client/inspector/panel").InspectorPanel); +loader.lazyGetter(this, "InspectorPanel", () => require("devtools/client/inspector/inspector-panel").InspectorPanel); loader.lazyGetter(this, "WebConsolePanel", () => require("devtools/client/webconsole/panel").WebConsolePanel); loader.lazyGetter(this, "DebuggerPanel", () => require("devtools/client/debugger/panel").DebuggerPanel); loader.lazyGetter(this, "StyleEditorPanel", () => require("devtools/client/styleeditor/styleeditor-panel").StyleEditorPanel); diff --git a/devtools/client/inspector/components/box-model.js b/devtools/client/inspector/components/box-model.js index dbcae56c9792..d7d23de94e8c 100644 --- a/devtools/client/inspector/components/box-model.js +++ b/devtools/client/inspector/components/box-model.js @@ -341,10 +341,10 @@ BoxModelView.prototype = { */ trackReflows: function () { if (!this.reflowFront) { - let { target } = this.inspector; - if (target.form.reflowActor) { - this.reflowFront = ReflowFront(target.client, - target.form); + let toolbox = this.inspector.toolbox; + if (toolbox.target.form.reflowActor) { + this.reflowFront = ReflowFront(toolbox.target.client, + toolbox.target.form); } else { return; } @@ -468,7 +468,7 @@ BoxModelView.prototype = { this.inspector.sidebar.off("computedview-selected", this.onNewNode); this.inspector.selection.off("new-node-front", this.onNewSelection); this.inspector.sidebar.off("select", this.onSidebarSelect); - this.inspector.target.off("will-navigate", this.onWillNavigate); + this.inspector._target.off("will-navigate", this.onWillNavigate); this.inspector.off("computed-view-filtered", this.onFilterComputedView); this.inspector = null; @@ -792,7 +792,7 @@ BoxModelView.prototype = { this.inspector.markup.on("node-hover", this.onMarkupViewNodeHover); // Release the actor on will-navigate event - this.inspector.target.once("will-navigate", this.onWillNavigate); + this.inspector._target.once("will-navigate", this.onWillNavigate); }); }, diff --git a/devtools/client/inspector/inspector.js b/devtools/client/inspector/inspector-panel.js similarity index 94% rename from devtools/client/inspector/inspector.js rename to devtools/client/inspector/inspector-panel.js index dc3690af7aa9..802574093c79 100644 --- a/devtools/client/inspector/inspector.js +++ b/devtools/client/inspector/inspector-panel.js @@ -4,12 +4,8 @@ * 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/. */ -/* global window */ - "use strict"; -var Cu = Components.utils; -var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {}); var Services = require("Services"); var promise = require("promise"); var defer = require("devtools/shared/defer"); @@ -85,11 +81,11 @@ const PORTRAIT_MODE_WIDTH = 700; * Fired when the stylesheet source links have been updated (when switching * to source-mapped files) */ -function Inspector(toolbox) { +function InspectorPanel(iframeWindow, toolbox) { this._toolbox = toolbox; this._target = toolbox.target; - this.panelDoc = window.document; - this.panelWin = window; + this.panelDoc = iframeWindow.document; + this.panelWin = iframeWindow; this.panelWin.inspector = this; this.telemetry = new Telemetry(); @@ -116,11 +112,13 @@ function Inspector(toolbox) { EventEmitter.decorate(this); } -Inspector.prototype = { +exports.InspectorPanel = InspectorPanel; + +InspectorPanel.prototype = { /** * open is effectively an asynchronous constructor */ - init: Task.async(function* () { + open: Task.async(function* () { // Localize all the nodes containing a data-localization attribute. localizeMarkup(this.panelDoc); @@ -148,10 +146,6 @@ Inspector.prototype = { return this._toolbox.selection; }, - get highlighter() { - return this._toolbox.highlighter; - }, - get isOuterHTMLEditable() { return this._target.client.traits.editOuterHTML; }, @@ -281,7 +275,7 @@ Inspector.prototype = { }, _getPageStyle: function () { - return this.inspector.getPageStyle().then(pageStyle => { + return this._toolbox.inspector.getPageStyle().then(pageStyle => { this.pageStyle = pageStyle; }, this._handleRejectionIfNotDestroyed); }, @@ -608,7 +602,7 @@ Inspector.prototype = { // Setup the eye-dropper icon if we're in an HTML document and we have actor support. if (this.selection.nodeFront && this.selection.nodeFront.isInHTMLDocument) { - this.target.actorHasMethod("inspector", "pickColorFromPage").then(value => { + this.toolbox.target.actorHasMethod("inspector", "pickColorFromPage").then(value => { if (!value) { return; } @@ -1822,90 +1816,3 @@ Inspector.prototype = { }, console.error); } }; - -// URL constructor doesn't support chrome: scheme -let href = window.location.href.replace(/chrome:/, "http://"); -let url = new window.URL(href); - -// Only use this method to attach the toolbox if some query parameters are given -if (url.search.length > 1) { - const { targetFromURL } = require("devtools/client/framework/target-from-url"); - const { attachThread } = require("devtools/client/framework/attach-thread"); - const { BrowserLoader } = - Cu.import("resource://devtools/client/shared/browser-loader.js", {}); - - 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({ - window: window, - useOnlyShared: true - }).require, - get React() { - 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() {} - }; - - // attachThread also expect a toolbox as argument - fakeToolbox.threadClient = yield attachThread(fakeToolbox); - - let inspector = InspectorFront(target.client, target.form); - let showAllAnonymousContent = - Services.prefs.getBoolPref("devtools.inspector.showAllAnonymousContent"); - let walker = yield inspector.getWalker({ showAllAnonymousContent }); - let selection = new Selection(walker); - let highlighter = yield inspector.getHighlighter(false); - - fakeToolbox.inspector = inspector; - fakeToolbox.walker = walker; - fakeToolbox.selection = selection; - fakeToolbox.highlighter = highlighter; - fakeToolbox.highlighterUtils = getHighlighterUtils(fakeToolbox); - - let inspectorUI = new Inspector(fakeToolbox); - inspectorUI.init(); - }).then(null, e => { - window.alert("Unable to start the inspector:" + e.message + "\n" + e.stack); - }); -} diff --git a/devtools/client/inspector/inspector.xhtml b/devtools/client/inspector/inspector.xhtml index eac5c7e4e948..106c03697f4d 100644 --- a/devtools/client/inspector/inspector.xhtml +++ b/devtools/client/inspector/inspector.xhtml @@ -25,7 +25,6 @@ -
diff --git a/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js b/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js index 241cea672360..55e771599f44 100644 --- a/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js +++ b/devtools/client/inspector/markup/test/browser_markup_update-on-navigtion.js @@ -15,7 +15,7 @@ add_task(function* () { assertMarkupViewIsLoaded(); yield selectNode("#one", inspector); - let willNavigate = inspector.target.once("will-navigate"); + let willNavigate = inspector.toolbox.target.once("will-navigate"); yield testActor.eval(`content.location = "${URL_2}"`); info("Waiting for will-navigate"); diff --git a/devtools/client/inspector/moz.build b/devtools/client/inspector/moz.build index c2013bd0893e..dad750369bc9 100644 --- a/devtools/client/inspector/moz.build +++ b/devtools/client/inspector/moz.build @@ -14,9 +14,9 @@ DIRS += [ DevToolsModules( 'breadcrumbs.js', 'inspector-commands.js', + 'inspector-panel.js', 'inspector-search.js', 'inspector.xhtml', - 'panel.js', 'toolsidebar.js', ) diff --git a/devtools/client/inspector/panel.js b/devtools/client/inspector/panel.js deleted file mode 100644 index 7f733491b952..000000000000 --- a/devtools/client/inspector/panel.js +++ /dev/null @@ -1,19 +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/. */ - -"use strict"; - -function InspectorPanel(iframeWindow, toolbox) { - this._inspector = new iframeWindow.Inspector(toolbox); -} -InspectorPanel.prototype = { - open() { - return this._inspector.init(); - }, - - destroy() { - return this._inspector.destroy(); - } -}; -exports.InspectorPanel = InspectorPanel; diff --git a/devtools/client/inspector/rules/rules.js b/devtools/client/inspector/rules/rules.js index 6ae8064a3c6b..beb0c08b2a13 100644 --- a/devtools/client/inspector/rules/rules.js +++ b/devtools/client/inspector/rules/rules.js @@ -470,7 +470,7 @@ CssRuleView.prototype = { _onAddRule: function () { let elementStyle = this._elementStyle; let element = elementStyle.element; - let client = this.inspector.target.client; + let client = this.inspector.toolbox.target.client; let pseudoClasses = element.pseudoClassLocks; if (!client.traits.addNewRule) { diff --git a/devtools/client/inspector/rules/views/rule-editor.js b/devtools/client/inspector/rules/views/rule-editor.js index 08c6ea7b4694..530a86700386 100644 --- a/devtools/client/inspector/rules/views/rule-editor.js +++ b/devtools/client/inspector/rules/views/rule-editor.js @@ -87,7 +87,7 @@ RuleEditor.prototype = { get isSelectorEditable() { let trait = this.isEditable && - this.ruleView.inspector.target.client.traits.selectorEditable && + this.toolbox.target.client.traits.selectorEditable && this.rule.domRule.type !== ELEMENT_STYLE && this.rule.domRule.type !== CSSRule.KEYFRAME_RULE; diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-03.js b/devtools/client/inspector/test/browser_inspector_highlighter-03.js index 344b5c6c8f9f..e3c801e57117 100644 --- a/devtools/client/inspector/test/browser_inspector_highlighter-03.js +++ b/devtools/client/inspector/test/browser_inspector_highlighter-03.js @@ -34,7 +34,7 @@ add_task(function* () { info("Waiting for box mode to show."); let body = yield getNodeFront("body", inspector); - yield inspector.highlighter.showBoxModel(body); + yield toolbox.highlighter.showBoxModel(body); info("Waiting for element picker to become active."); yield startPicker(toolbox); diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-04.js b/devtools/client/inspector/test/browser_inspector_highlighter-04.js index d87f20e94280..ca1de9eb745d 100644 --- a/devtools/client/inspector/test/browser_inspector_highlighter-04.js +++ b/devtools/client/inspector/test/browser_inspector_highlighter-04.js @@ -27,11 +27,11 @@ const ELEMENTS = ["box-model-root", "box-model-infobar-dimensions"]; add_task(function* () { - let {inspector, testActor} = yield openInspectorForURL(TEST_URL); + let {inspector, toolbox, testActor} = yield openInspectorForURL(TEST_URL); info("Show the box-model highlighter"); let divFront = yield getNodeFront("div", inspector); - yield inspector.highlighter.showBoxModel(divFront); + yield toolbox.highlighter.showBoxModel(divFront); for (let id of ELEMENTS) { let foundId = yield testActor.getHighlighterNodeAttribute(id, "id"); @@ -39,5 +39,5 @@ add_task(function* () { } info("Hide the box-model highlighter"); - yield inspector.highlighter.hideBoxModel(); + yield toolbox.highlighter.hideBoxModel(); }); diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-hover_02.js b/devtools/client/inspector/test/browser_inspector_highlighter-hover_02.js index e853b396399b..87abafdf10ef 100644 --- a/devtools/client/inspector/test/browser_inspector_highlighter-hover_02.js +++ b/devtools/client/inspector/test/browser_inspector_highlighter-hover_02.js @@ -11,7 +11,7 @@ const TEST_URL = "data:text/html;charset=utf-8,

Select me!

"; add_task(function* () { - let {inspector, testActor} = yield openInspectorForURL(TEST_URL); + let {toolbox, inspector, testActor} = yield openInspectorForURL(TEST_URL); info("hover over the

line in the markup-view so that it's the " + "currently hovered node"); @@ -24,7 +24,7 @@ add_task(function* () { info("listen to the highlighter's hidden event"); let onHidden = testActor.waitForHighlighterEvent("hidden", - inspector.highlighter); + toolbox.highlighter); info("mouse-leave the markup-view"); yield mouseLeaveMarkupView(inspector); yield onHidden; diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-keybinding_03.js b/devtools/client/inspector/test/browser_inspector_highlighter-keybinding_03.js index 51189f6e7e9e..0a7966f43498 100644 --- a/devtools/client/inspector/test/browser_inspector_highlighter-keybinding_03.js +++ b/devtools/client/inspector/test/browser_inspector_highlighter-keybinding_03.js @@ -46,7 +46,7 @@ add_task(function* () { info("Key pressed. Waiting for element to be picked"); testActor.synthesizeKey(args); return promise.all([ - inspector.selection.once("new-node-front"), + toolbox.selection.once("new-node-front"), inspector.once("inspector-updated") ]); } diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-options.js b/devtools/client/inspector/test/browser_inspector_highlighter-options.js index 65a6ec4b0ac5..6738f3cdc32f 100644 --- a/devtools/client/inspector/test/browser_inspector_highlighter-options.js +++ b/devtools/client/inspector/test/browser_inspector_highlighter-options.js @@ -185,7 +185,7 @@ const TEST_DATA = [ ]; add_task(function* () { - let {inspector, testActor} = yield openInspectorForURL( + let {inspector, toolbox, testActor} = yield openInspectorForURL( "data:text/html;charset=utf-8," + encodeURI(TEST_URL)); let divFront = yield getNodeFront("div", inspector); @@ -194,11 +194,11 @@ add_task(function* () { info("Running test: " + desc); info("Show the box-model highlighter with options " + options); - yield inspector.highlighter.showBoxModel(divFront, options); + yield toolbox.highlighter.showBoxModel(divFront, options); yield checkHighlighter(testActor); info("Hide the box-model highlighter"); - yield inspector.highlighter.hideBoxModel(); + yield toolbox.highlighter.hideBoxModel(); } }); diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-xbl.js b/devtools/client/inspector/test/browser_inspector_highlighter-xbl.js index 2421fd3f3250..3cab403e4ec3 100644 --- a/devtools/client/inspector/test/browser_inspector_highlighter-xbl.js +++ b/devtools/client/inspector/test/browser_inspector_highlighter-xbl.js @@ -22,7 +22,7 @@ add_task(function* () { info("Key pressed. Waiting for element to be picked"); testActor.synthesizeKey(msg); return promise.all([ - inspector.selection.once("new-node-front"), + toolbox.selection.once("new-node-front"), inspector.once("inspector-updated") ]); } diff --git a/devtools/client/inspector/test/browser_inspector_invalidate.js b/devtools/client/inspector/test/browser_inspector_invalidate.js index 040bd1c1cd65..2a53854836d1 100644 --- a/devtools/client/inspector/test/browser_inspector_invalidate.js +++ b/devtools/client/inspector/test/browser_inspector_invalidate.js @@ -15,7 +15,7 @@ add_task(function* () { let divFront = yield getNodeFront("div", inspector); info("Waiting for highlighter to activate"); - yield inspector.highlighter.showBoxModel(divFront); + yield inspector.toolbox.highlighter.showBoxModel(divFront); let rect = yield testActor.getSimpleBorderRect(); is(rect.width, 100, "The highlighter has the right width."); @@ -31,5 +31,5 @@ add_task(function* () { is(rect.width, 200, "The highlighter has the right width after update"); info("Waiting for highlighter to hide"); - yield inspector.highlighter.hideBoxModel(); + yield inspector.toolbox.highlighter.hideBoxModel(); }); diff --git a/devtools/client/inspector/test/browser_inspector_pseudoclass-lock.js b/devtools/client/inspector/test/browser_inspector_pseudoclass-lock.js index 17b6b13eba1b..ee31dfe32bf2 100644 --- a/devtools/client/inspector/test/browser_inspector_pseudoclass-lock.js +++ b/devtools/client/inspector/test/browser_inspector_pseudoclass-lock.js @@ -89,8 +89,9 @@ function* testNavigate(inspector, testActor, ruleview) { } function* showPickerOn(selector, inspector) { + let highlighter = inspector.toolbox.highlighter; let nodeFront = yield getNodeFront(selector, inspector); - yield inspector.highlighter.showBoxModel(nodeFront); + yield highlighter.showBoxModel(nodeFront); } function* assertPseudoAddedToNode(inspector, testActor, ruleview) { @@ -118,7 +119,7 @@ function* assertPseudoAddedToNode(inspector, testActor, ruleview) { let value = yield testActor.getHighlighterNodeTextContent( "box-model-infobar-pseudo-classes"); is(value, PSEUDO, "pseudo-class in infobar selector"); - yield inspector.highlighter.hideBoxModel(); + yield inspector.toolbox.highlighter.hideBoxModel(); } function* assertPseudoRemovedFromNode(testActor) { @@ -144,5 +145,5 @@ function* assertPseudoRemovedFromView(inspector, testActor, ruleview) { let value = yield testActor.getHighlighterNodeTextContent( "box-model-infobar-pseudo-classes"); is(value, "", "pseudo-class removed from infobar selector"); - yield inspector.highlighter.hideBoxModel(); + yield inspector.toolbox.highlighter.hideBoxModel(); } diff --git a/devtools/client/jar.mn b/devtools/client/jar.mn index 2fd4d0d6b342..153602a02a2c 100644 --- a/devtools/client/jar.mn +++ b/devtools/client/jar.mn @@ -25,7 +25,6 @@ devtools.jar: 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) - content/inspector/inspector.js (inspector/inspector.js) content/inspector/fonts/fonts.js (inspector/fonts/fonts.js) content/inspector/markup/markup.xhtml (inspector/markup/markup.xhtml) content/animationinspector/animation-controller.js (animationinspector/animation-controller.js) diff --git a/devtools/client/shared/widgets/Tooltip.js b/devtools/client/shared/widgets/Tooltip.js index 8f85d3f0c4d8..ed3ae4865ee6 100644 --- a/devtools/client/shared/widgets/Tooltip.js +++ b/devtools/client/shared/widgets/Tooltip.js @@ -741,7 +741,7 @@ Heritage.extend(SwatchBasedEditorTooltip.prototype, { this.spectrum.updateUI(); } - let {target} = this.inspector; + let {target} = this.inspector.toolbox; target.actorHasMethod("inspector", "pickColorFromPage").then(value => { let tooltipDoc = this.tooltip.doc; let eyeButton = tooltipDoc.querySelector("#eyedropper-button");