mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1169343 - Implement DebuggerView.Workers;r=jlong
This commit is contained in:
parent
e4cb9a625b
commit
e082f25d10
@ -1442,9 +1442,10 @@ pref("devtools.debugger.pretty-print-enabled", true);
|
||||
pref("devtools.debugger.auto-pretty-print", false);
|
||||
pref("devtools.debugger.auto-black-box", true);
|
||||
pref("devtools.debugger.tracer", false);
|
||||
pref("devtools.debugger.workers", false);
|
||||
|
||||
// The default Debugger UI settings
|
||||
pref("devtools.debugger.ui.panes-sources-width", 200);
|
||||
pref("devtools.debugger.ui.panes-workers-and-sources-width", 200);
|
||||
pref("devtools.debugger.ui.panes-instruments-width", 300);
|
||||
pref("devtools.debugger.ui.panes-visible-on-startup", false);
|
||||
pref("devtools.debugger.ui.variables-sorting-enabled", true);
|
||||
|
@ -182,6 +182,9 @@ let DebuggerController = {
|
||||
this.SourceScripts.disconnect();
|
||||
this.StackFrames.disconnect();
|
||||
this.ThreadState.disconnect();
|
||||
if (this._target.isTabActor) {
|
||||
this.Workers.disconnect();
|
||||
}
|
||||
this.Tracer.disconnect();
|
||||
this.disconnect();
|
||||
|
||||
@ -319,6 +322,7 @@ let DebuggerController = {
|
||||
return;
|
||||
}
|
||||
this.activeThread = aThreadClient;
|
||||
this.Workers.connect();
|
||||
this.ThreadState.connect();
|
||||
this.StackFrames.connect();
|
||||
this.SourceScripts.connect();
|
||||
@ -446,6 +450,75 @@ let DebuggerController = {
|
||||
activeThread: null
|
||||
};
|
||||
|
||||
function Workers() {
|
||||
this._workerClients = new Map();
|
||||
this._onWorkerListChanged = this._onWorkerListChanged.bind(this);
|
||||
this._onWorkerFreeze = this._onWorkerFreeze.bind(this);
|
||||
this._onWorkerThaw = this._onWorkerThaw.bind(this);
|
||||
}
|
||||
|
||||
Workers.prototype = {
|
||||
get _tabClient() {
|
||||
return DebuggerController._target.activeTab;
|
||||
},
|
||||
|
||||
connect: function () {
|
||||
if (!Prefs.workersEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._updateWorkerList();
|
||||
this._tabClient.addListener("workerListChanged", this._onWorkerListChanged);
|
||||
},
|
||||
|
||||
disconnect: function () {
|
||||
this._tabClient.removeListener("workerListChanged", this._onWorkerListChanged);
|
||||
},
|
||||
|
||||
_updateWorkerList: function () {
|
||||
this._tabClient.listWorkers((response) => {
|
||||
let workerActors = new Set();
|
||||
for (let worker of response.workers) {
|
||||
workerActors.add(worker.actor);
|
||||
}
|
||||
|
||||
for (let [workerActor, workerClient] of this._workerClients) {
|
||||
if (!workerActors.has(workerActor)) {
|
||||
workerClient.removeListener("freeze", this._onWorkerFreeze);
|
||||
workerClient.removeListener("thaw", this._onWorkerThaw);
|
||||
this._workerClients.delete(workerActor);
|
||||
DebuggerView.Workers.removeWorker(workerActor);
|
||||
}
|
||||
}
|
||||
|
||||
for (let actor of workerActors) {
|
||||
let workerActor = actor
|
||||
if (!this._workerClients.has(workerActor)) {
|
||||
this._tabClient.attachWorker(workerActor, (response, workerClient) => {
|
||||
workerClient.addListener("freeze", this._onWorkerFreeze);
|
||||
workerClient.addListener("thaw", this._onWorkerThaw);
|
||||
this._workerClients.set(workerActor, workerClient);
|
||||
DebuggerView.Workers.addWorker(workerActor, workerClient.url);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_onWorkerListChanged: function () {
|
||||
this._updateWorkerList();
|
||||
},
|
||||
|
||||
_onWorkerFreeze: function (type, packet) {
|
||||
DebuggerView.Workers.removeWorker(packet.from);
|
||||
},
|
||||
|
||||
_onWorkerThaw: function (type, packet) {
|
||||
let workerClient = this._workerClients.get(packet.from);
|
||||
DebuggerView.Workers.addWorker(packet.from, workerClient.url);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ThreadState keeps the UI up to date with the state of the
|
||||
* thread (paused/attached/etc.).
|
||||
@ -2424,7 +2497,7 @@ let L10N = new ViewHelpers.L10N(DBG_STRINGS_URI);
|
||||
* Shortcuts for accessing various debugger preferences.
|
||||
*/
|
||||
let Prefs = new ViewHelpers.Prefs("devtools", {
|
||||
sourcesWidth: ["Int", "debugger.ui.panes-sources-width"],
|
||||
workersAndSourcesWidth: ["Int", "debugger.ui.panes-workers-and-sources-width"],
|
||||
instrumentsWidth: ["Int", "debugger.ui.panes-instruments-width"],
|
||||
panesVisibleOnStartup: ["Bool", "debugger.ui.panes-visible-on-startup"],
|
||||
variablesSortingEnabled: ["Bool", "debugger.ui.variables-sorting-enabled"],
|
||||
@ -2436,6 +2509,7 @@ let Prefs = new ViewHelpers.Prefs("devtools", {
|
||||
prettyPrintEnabled: ["Bool", "debugger.pretty-print-enabled"],
|
||||
autoPrettyPrint: ["Bool", "debugger.auto-pretty-print"],
|
||||
tracerEnabled: ["Bool", "debugger.tracer"],
|
||||
workersEnabled: ["Bool", "debugger.workers"],
|
||||
editorTabSize: ["Int", "editor.tabsize"],
|
||||
autoBlackBox: ["Bool", "debugger.auto-black-box"]
|
||||
});
|
||||
@ -2450,6 +2524,7 @@ EventEmitter.decorate(this);
|
||||
*/
|
||||
DebuggerController.initialize();
|
||||
DebuggerController.Parser = new Parser();
|
||||
DebuggerController.Workers = new Workers();
|
||||
DebuggerController.ThreadState = new ThreadState();
|
||||
DebuggerController.StackFrames = new StackFrames();
|
||||
DebuggerController.SourceScripts = new SourceScripts();
|
||||
|
@ -55,6 +55,7 @@ let DebuggerView = {
|
||||
this.Filtering.initialize();
|
||||
this.StackFrames.initialize();
|
||||
this.StackFramesClassicList.initialize();
|
||||
this.Workers.initialize();
|
||||
this.Sources.initialize();
|
||||
this.VariableBubble.initialize();
|
||||
this.Tracer.initialize();
|
||||
@ -108,7 +109,7 @@ let DebuggerView = {
|
||||
|
||||
this._body = document.getElementById("body");
|
||||
this._editorDeck = document.getElementById("editor-deck");
|
||||
this._sourcesPane = document.getElementById("sources-pane");
|
||||
this._workersAndSourcesPane = document.getElementById("workers-and-sources-pane");
|
||||
this._instrumentsPane = document.getElementById("instruments-pane");
|
||||
this._instrumentsPaneToggleButton = document.getElementById("instruments-pane-toggle");
|
||||
|
||||
@ -123,7 +124,7 @@ let DebuggerView = {
|
||||
this._collapsePaneString = L10N.getStr("collapsePanes");
|
||||
this._expandPaneString = L10N.getStr("expandPanes");
|
||||
|
||||
this._sourcesPane.setAttribute("width", Prefs.sourcesWidth);
|
||||
this._workersAndSourcesPane.setAttribute("width", Prefs.workersAndSourcesWidth);
|
||||
this._instrumentsPane.setAttribute("width", Prefs.instrumentsWidth);
|
||||
this.toggleInstrumentsPane({ visible: Prefs.panesVisibleOnStartup });
|
||||
|
||||
@ -140,11 +141,11 @@ let DebuggerView = {
|
||||
dumpn("Destroying the DebuggerView panes");
|
||||
|
||||
if (gHostType != "side") {
|
||||
Prefs.sourcesWidth = this._sourcesPane.getAttribute("width");
|
||||
Prefs.workersAndSourcesWidth = this._workersAndSourcesPane.getAttribute("width");
|
||||
Prefs.instrumentsWidth = this._instrumentsPane.getAttribute("width");
|
||||
}
|
||||
|
||||
this._sourcesPane = null;
|
||||
this._workersAndSourcesPane = null;
|
||||
this._instrumentsPane = null;
|
||||
this._instrumentsPaneToggleButton = null;
|
||||
},
|
||||
@ -613,7 +614,7 @@ let DebuggerView = {
|
||||
|
||||
// Move the soruces and instruments panes in a different container.
|
||||
let splitter = document.getElementById("sources-and-instruments-splitter");
|
||||
vertContainer.insertBefore(this._sourcesPane, splitter);
|
||||
vertContainer.insertBefore(this._workersAndSourcesPane, splitter);
|
||||
vertContainer.appendChild(this._instrumentsPane);
|
||||
|
||||
// Make sure the vertical layout container's height doesn't repeatedly
|
||||
@ -632,12 +633,12 @@ let DebuggerView = {
|
||||
// The sources and instruments pane need to be inserted at their
|
||||
// previous locations in their normal container.
|
||||
let splitter = document.getElementById("sources-and-editor-splitter");
|
||||
normContainer.insertBefore(this._sourcesPane, splitter);
|
||||
normContainer.insertBefore(this._workersAndSourcesPane, splitter);
|
||||
normContainer.appendChild(this._instrumentsPane);
|
||||
|
||||
// Revert to the preferred sources and instruments widths, because
|
||||
// they flexed in the vertical layout.
|
||||
this._sourcesPane.setAttribute("width", Prefs.sourcesWidth);
|
||||
this._workersAndSourcesPane.setAttribute("width", Prefs.workersAndSourcesWidth);
|
||||
this._instrumentsPane.setAttribute("width", Prefs.instrumentsWidth);
|
||||
},
|
||||
|
||||
@ -682,7 +683,7 @@ let DebuggerView = {
|
||||
_loadingText: "",
|
||||
_body: null,
|
||||
_editorDeck: null,
|
||||
_sourcesPane: null,
|
||||
_workersAndSourcesPane: null,
|
||||
_instrumentsPane: null,
|
||||
_instrumentsPaneToggleButton: null,
|
||||
_collapsePaneString: "",
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
/* Side pane views */
|
||||
|
||||
#workers-pane > tabpanels > tabpanel,
|
||||
#sources-pane > tabpanels > tabpanel,
|
||||
#instruments-pane > tabpanels > tabpanel {
|
||||
-moz-box-orient: vertical;
|
||||
@ -23,7 +24,7 @@
|
||||
-moz-box-orient: vertical;
|
||||
}
|
||||
|
||||
#body[layout=vertical] #sources-pane {
|
||||
#body[layout=vertical] #workers-and-sources-pane {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
<script type="text/javascript" src="debugger-controller.js"/>
|
||||
<script type="text/javascript" src="debugger-view.js"/>
|
||||
<script type="text/javascript" src="debugger/utils.js"/>
|
||||
<script type="text/javascript" src="debugger/workers-view.js"/>
|
||||
<script type="text/javascript" src="debugger/sources-view.js"/>
|
||||
<script type="text/javascript" src="debugger/variable-bubble-view.js"/>
|
||||
<script type="text/javascript" src="debugger/tracer-view.js"/>
|
||||
@ -312,61 +313,78 @@
|
||||
<vbox id="globalsearch" orient="vertical" hidden="true"/>
|
||||
<splitter class="devtools-horizontal-splitter" hidden="true"/>
|
||||
<hbox id="debugger-widgets" flex="1">
|
||||
<tabbox id="sources-pane"
|
||||
class="devtools-sidebar-tabs">
|
||||
<tabs>
|
||||
<tab id="sources-tab" label="&debuggerUI.tabs.sources;"/>
|
||||
<tab id="callstack-tab" label="&debuggerUI.tabs.callstack;"/>
|
||||
<tab id="tracer-tab" label="&debuggerUI.tabs.traces;" hidden="true"/>
|
||||
</tabs>
|
||||
<tabpanels flex="1">
|
||||
<tabpanel id="sources-tabpanel">
|
||||
<vbox id="sources" flex="1"/>
|
||||
<toolbar id="sources-toolbar" class="devtools-toolbar">
|
||||
<hbox id="sources-controls"
|
||||
class="devtools-toolbarbutton-group">
|
||||
<toolbarbutton id="black-box"
|
||||
<vbox id="workers-and-sources-pane">
|
||||
<tabbox id="workers-pane"
|
||||
class="devtools-sidebar-tabs"
|
||||
flex="0"
|
||||
hidden="true">
|
||||
<tabs>
|
||||
<tab id="workers-tab" label="&debuggerUI.tabs.workers;"/>
|
||||
</tabs>
|
||||
<tabpanels flex="1">
|
||||
<tabpanel>
|
||||
<vbox id="workers" flex="1"/>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
<splitter class="devtools-horizontal-splitter"/>
|
||||
<tabbox id="sources-pane"
|
||||
class="devtools-sidebar-tabs"
|
||||
flex="1">
|
||||
<tabs>
|
||||
<tab id="sources-tab" label="&debuggerUI.tabs.sources;"/>
|
||||
<tab id="callstack-tab" label="&debuggerUI.tabs.callstack;"/>
|
||||
<tab id="tracer-tab" label="&debuggerUI.tabs.traces;" hidden="true"/>
|
||||
</tabs>
|
||||
<tabpanels flex="1">
|
||||
<tabpanel id="sources-tabpanel">
|
||||
<vbox id="sources" flex="1"/>
|
||||
<toolbar id="sources-toolbar" class="devtools-toolbar">
|
||||
<hbox id="sources-controls"
|
||||
class="devtools-toolbarbutton-group">
|
||||
<toolbarbutton id="black-box"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.sources.blackBoxTooltip;"
|
||||
command="blackBoxCommand"/>
|
||||
<toolbarbutton id="pretty-print"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.sources.prettyPrint;"
|
||||
command="prettyPrintCommand"
|
||||
hidden="true"/>
|
||||
</hbox>
|
||||
<vbox class="devtools-separator"/>
|
||||
<toolbarbutton id="toggle-breakpoints"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.sources.blackBoxTooltip;"
|
||||
command="blackBoxCommand"/>
|
||||
<toolbarbutton id="pretty-print"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.sources.prettyPrint;"
|
||||
command="prettyPrintCommand"
|
||||
hidden="true"/>
|
||||
tooltiptext="&debuggerUI.sources.toggleBreakpoints;"
|
||||
command="toggleBreakpointsCommand"/>
|
||||
</toolbar>
|
||||
</tabpanel>
|
||||
<tabpanel id="callstack-tabpanel">
|
||||
<vbox id="callstack-list" flex="1"/>
|
||||
</tabpanel>
|
||||
<tabpanel id="tracer-tabpanel">
|
||||
<vbox id="tracer-traces" flex="1"/>
|
||||
<hbox class="trace-item-template" hidden="true">
|
||||
<hbox class="trace-item" align="center" flex="1" crop="end">
|
||||
<label class="trace-type plain"/>
|
||||
<label class="trace-name plain" crop="end"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<vbox class="devtools-separator"/>
|
||||
<toolbarbutton id="toggle-breakpoints"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.sources.toggleBreakpoints;"
|
||||
command="toggleBreakpointsCommand"/>
|
||||
</toolbar>
|
||||
</tabpanel>
|
||||
<tabpanel id="callstack-tabpanel">
|
||||
<vbox id="callstack-list" flex="1"/>
|
||||
</tabpanel>
|
||||
<tabpanel id="tracer-tabpanel">
|
||||
<vbox id="tracer-traces" flex="1"/>
|
||||
<hbox class="trace-item-template" hidden="true">
|
||||
<hbox class="trace-item" align="center" flex="1" crop="end">
|
||||
<label class="trace-type plain"/>
|
||||
<label class="trace-name plain" crop="end"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<toolbar id="tracer-toolbar" class="devtools-toolbar">
|
||||
<toolbarbutton id="clear-tracer"
|
||||
label="&debuggerUI.clearButton;"
|
||||
tooltiptext="&debuggerUI.clearButton.tooltip;"
|
||||
command="clearTraces"
|
||||
class="devtools-toolbarbutton"/>
|
||||
<textbox id="tracer-search"
|
||||
class="devtools-searchinput"
|
||||
flex="1"
|
||||
type="search"/>
|
||||
</toolbar>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
<toolbar id="tracer-toolbar" class="devtools-toolbar">
|
||||
<toolbarbutton id="clear-tracer"
|
||||
label="&debuggerUI.clearButton;"
|
||||
tooltiptext="&debuggerUI.clearButton.tooltip;"
|
||||
command="clearTraces"
|
||||
class="devtools-toolbarbutton"/>
|
||||
<textbox id="tracer-search"
|
||||
class="devtools-searchinput"
|
||||
flex="1"
|
||||
type="search"/>
|
||||
</toolbar>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
</vbox>
|
||||
<splitter id="sources-and-editor-splitter"
|
||||
class="devtools-side-splitter"/>
|
||||
<deck id="editor-deck" flex="1" class="devtools-main-content">
|
||||
|
@ -71,13 +71,13 @@ function testHost(aTab, aPanel, aHostType, aLayoutType) {
|
||||
"The default host type is present as an attribute on the panel's body.");
|
||||
|
||||
if (aLayoutType == "horizontal") {
|
||||
is(gView._sourcesPane.parentNode.id, "debugger-widgets",
|
||||
"The sources pane's parent is correct for the horizontal layout.");
|
||||
is(gView._workersAndSourcesPane.parentNode.id, "debugger-widgets",
|
||||
"The workers and sources pane's parent is correct for the horizontal layout.");
|
||||
is(gView._instrumentsPane.parentNode.id, "debugger-widgets",
|
||||
"The instruments pane's parent is correct for the horizontal layout.");
|
||||
} else {
|
||||
is(gView._sourcesPane.parentNode.id, "vertical-layout-panes-container",
|
||||
"The sources pane's parent is correct for the vertical layout.");
|
||||
is(gView._workersAndSourcesPane.parentNode.id, "vertical-layout-panes-container",
|
||||
"The workers and sources pane's parent is correct for the vertical layout.");
|
||||
is(gView._instrumentsPane.parentNode.id, "vertical-layout-panes-container",
|
||||
"The instruments pane's parent is correct for the vertical layout.");
|
||||
}
|
||||
|
@ -17,63 +17,63 @@ function test() {
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gPrefs = gDebugger.Prefs;
|
||||
gSources = gDebugger.document.getElementById("sources-pane");
|
||||
gSources = gDebugger.document.getElementById("workers-and-sources-pane");
|
||||
gInstruments = gDebugger.document.getElementById("instruments-pane");
|
||||
|
||||
waitForSourceShown(gPanel, ".html").then(performTest);
|
||||
});
|
||||
|
||||
function performTest() {
|
||||
let preferredSw = Services.prefs.getIntPref("devtools.debugger.ui.panes-sources-width");
|
||||
let preferredWsw = Services.prefs.getIntPref("devtools.debugger.ui.panes-workers-and-sources-width");
|
||||
let preferredIw = Services.prefs.getIntPref("devtools.debugger.ui.panes-instruments-width");
|
||||
let someWidth1, someWidth2;
|
||||
|
||||
do {
|
||||
someWidth1 = parseInt(Math.random() * 200) + 100;
|
||||
someWidth2 = parseInt(Math.random() * 300) + 100;
|
||||
} while ((someWidth1 == preferredSw) || (someWidth2 == preferredIw));
|
||||
} while ((someWidth1 == preferredWsw) || (someWidth2 == preferredIw));
|
||||
|
||||
info("Preferred sources width: " + preferredSw);
|
||||
info("Preferred sources width: " + preferredWsw);
|
||||
info("Preferred instruments width: " + preferredIw);
|
||||
info("Generated sources width: " + someWidth1);
|
||||
info("Generated instruments width: " + someWidth2);
|
||||
|
||||
ok(gPrefs.sourcesWidth,
|
||||
"The debugger preferences should have a saved sourcesWidth value.");
|
||||
ok(gPrefs.workersAndSourcesWidth,
|
||||
"The debugger preferences should have a saved workersAndSourcesWidth value.");
|
||||
ok(gPrefs.instrumentsWidth,
|
||||
"The debugger preferences should have a saved instrumentsWidth value.");
|
||||
|
||||
is(gPrefs.sourcesWidth, preferredSw,
|
||||
"The debugger preferences should have a correct sourcesWidth value.");
|
||||
is(gPrefs.workersAndSourcesWidth, preferredWsw,
|
||||
"The debugger preferences should have a correct workersAndSourcesWidth value.");
|
||||
is(gPrefs.instrumentsWidth, preferredIw,
|
||||
"The debugger preferences should have a correct instrumentsWidth value.");
|
||||
|
||||
is(gSources.getAttribute("width"), gPrefs.sourcesWidth,
|
||||
"The sources pane width should be the same as the preferred value.");
|
||||
is(gSources.getAttribute("width"), gPrefs.workersAndSourcesWidth,
|
||||
"The workers and sources pane width should be the same as the preferred value.");
|
||||
is(gInstruments.getAttribute("width"), gPrefs.instrumentsWidth,
|
||||
"The instruments pane width should be the same as the preferred value.");
|
||||
|
||||
gSources.setAttribute("width", someWidth1);
|
||||
gInstruments.setAttribute("width", someWidth2);
|
||||
|
||||
is(gPrefs.sourcesWidth, preferredSw,
|
||||
"The sources pane width pref should still be the same as the preferred value.");
|
||||
is(gPrefs.workersAndSourcesWidth, preferredWsw,
|
||||
"The workers and sources pane width pref should still be the same as the preferred value.");
|
||||
is(gPrefs.instrumentsWidth, preferredIw,
|
||||
"The instruments pane width pref should still be the same as the preferred value.");
|
||||
|
||||
isnot(gSources.getAttribute("width"), gPrefs.sourcesWidth,
|
||||
"The sources pane width should not be the preferred value anymore.");
|
||||
isnot(gSources.getAttribute("width"), gPrefs.workersAndSourcesWidth,
|
||||
"The workers and sources pane width should not be the preferred value anymore.");
|
||||
isnot(gInstruments.getAttribute("width"), gPrefs.instrumentsWidth,
|
||||
"The instruments pane width should not be the preferred value anymore.");
|
||||
|
||||
teardown(gPanel).then(() => {
|
||||
is(gPrefs.sourcesWidth, someWidth1,
|
||||
"The sources pane width should have been saved by now.");
|
||||
is(gPrefs.workersAndSourcesWidth, someWidth1,
|
||||
"The workers and sources pane width should have been saved by now.");
|
||||
is(gPrefs.instrumentsWidth, someWidth2,
|
||||
"The instruments pane width should have been saved by now.");
|
||||
|
||||
// Cleanup after ourselves!
|
||||
Services.prefs.setIntPref("devtools.debugger.ui.panes-sources-width", preferredSw);
|
||||
Services.prefs.setIntPref("devtools.debugger.ui.panes-workers-and-sources-width", preferredWsw);
|
||||
Services.prefs.setIntPref("devtools.debugger.ui.panes-instruments-width", preferredIw);
|
||||
|
||||
finish();
|
||||
|
36
browser/devtools/debugger/views/workers-view.js
Normal file
36
browser/devtools/debugger/views/workers-view.js
Normal file
@ -0,0 +1,36 @@
|
||||
/* 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 WorkersView() {}
|
||||
|
||||
WorkersView.prototype = Heritage.extend(WidgetMethods, {
|
||||
initialize: function () {
|
||||
if (!Prefs.workersEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById("workers-pane").removeAttribute("hidden");
|
||||
|
||||
this.widget = new SideMenuWidget(document.getElementById("workers"), {
|
||||
showArrows: true,
|
||||
});
|
||||
this.emptyText = L10N.getStr("noWorkersText");
|
||||
},
|
||||
|
||||
addWorker: function (actor, name) {
|
||||
let element = document.createElement("label");
|
||||
element.className = "plain dbg-worker-item";
|
||||
element.setAttribute("value", name);
|
||||
element.setAttribute("flex", "1");
|
||||
|
||||
this.push([element, actor], {});
|
||||
},
|
||||
|
||||
removeWorker: function (actor) {
|
||||
this.remove(this.getItemByValue(actor));
|
||||
}
|
||||
});
|
||||
|
||||
DebuggerView.Workers = new WorkersView();
|
@ -159,6 +159,11 @@
|
||||
tooltiptext="&options.enableRemote.tooltip;"
|
||||
data-pref="devtools.debugger.remote-enabled"/>
|
||||
</hbox>
|
||||
<hbox class="hidden-labels-box">
|
||||
<checkbox label="&options.enableWorkers.label;"
|
||||
tooltiptext="&options.enableWorkers.tooltip;"
|
||||
data-pref="devtools.debugger.workers"/>
|
||||
</hbox>
|
||||
<label class="options-citation-label theme-comment"
|
||||
>&options.context.triggersPageRefresh;</label>
|
||||
</vbox>
|
||||
|
@ -68,6 +68,7 @@ browser.jar:
|
||||
content/browser/devtools/debugger.css (debugger/debugger.css)
|
||||
content/browser/devtools/debugger-controller.js (debugger/debugger-controller.js)
|
||||
content/browser/devtools/debugger-view.js (debugger/debugger-view.js)
|
||||
content/browser/devtools/debugger/workers-view.js (debugger/views/workers-view.js)
|
||||
content/browser/devtools/debugger/sources-view.js (debugger/views/sources-view.js)
|
||||
content/browser/devtools/debugger/variable-bubble-view.js (debugger/views/variable-bubble-view.js)
|
||||
content/browser/devtools/debugger/tracer-view.js (debugger/views/tracer-view.js)
|
||||
|
@ -165,6 +165,7 @@
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.tabs.*): This is the text that
|
||||
- appears in the debugger's side pane tabs. -->
|
||||
<!ENTITY debuggerUI.tabs.workers "Workers">
|
||||
<!ENTITY debuggerUI.tabs.sources "Sources">
|
||||
<!ENTITY debuggerUI.tabs.traces "Traces">
|
||||
<!ENTITY debuggerUI.tabs.callstack "Call Stack">
|
||||
|
@ -78,8 +78,12 @@ stepOutTooltip=Step Out (%S)
|
||||
# when there are no chrome globals available.
|
||||
noGlobalsText=No globals
|
||||
|
||||
# LOCALIZATION NOTE (noSourcesText): The text to display in the sources menu
|
||||
# when there are no scripts.
|
||||
# LOCALIZATION NOTE (noWorkersText): The text to display in the workers list
|
||||
# when there are no workers.
|
||||
noWorkersText=This page has no workers.
|
||||
|
||||
# LOCALIZATION NOTE (noSourcesText): The text to display in the sources list
|
||||
# when there are no sources.
|
||||
noSourcesText=This page has no sources.
|
||||
|
||||
# LOCALIZATION NOTE (loadingSourcesText): The text to display in the sources menu
|
||||
@ -320,4 +324,5 @@ resumptionOrderPanelTitle=There are one or more paused debuggers. Please resume
|
||||
variablesViewOptimizedOut=(optimized away)
|
||||
variablesViewUninitialized=(uninitialized)
|
||||
variablesViewMissingArgs=(unavailable)
|
||||
|
||||
anonymousSourcesLabel=Anonymous Sources
|
||||
|
@ -92,6 +92,12 @@
|
||||
<!ENTITY options.enableRemote.label3 "Enable remote debugging">
|
||||
<!ENTITY options.enableRemote.tooltip "Turning this option on will allow the developer tools to debug remote Firefox instance like Firefox OS">
|
||||
|
||||
<!-- LOCALIZATION NOTE (options.enableWorkers.label): This is the label for the
|
||||
- checkbox that toggles worker debugging, i.e. devtools.debugger.workers
|
||||
- boolean preference in about:config, in the options panel. -->
|
||||
<!ENTITY options.enableWorkers.label "Enable worker debugging (in development)">
|
||||
<!ENTITY options.enableWorkers.tooltip "Turning this option on will allow the developer tools to debug workers">
|
||||
|
||||
<!-- LOCALIZATION NOTE (options.disableJavaScript.label,
|
||||
- options.disableJavaScript.tooltip): This is the options panel label and
|
||||
- tooltip for the checkbox that toggles JavaScript on or off. -->
|
||||
|
@ -1364,6 +1364,7 @@ function WorkerClient(aClient, aForm) {
|
||||
this._actor = aForm.from;
|
||||
this._isClosed = false;
|
||||
this._isFrozen = aForm.isFrozen;
|
||||
this._url = aForm.url;
|
||||
|
||||
this._onClose = this._onClose.bind(this);
|
||||
this._onFreeze = this._onFreeze.bind(this);
|
||||
@ -1387,6 +1388,10 @@ WorkerClient.prototype = {
|
||||
return this._actor;
|
||||
},
|
||||
|
||||
get url() {
|
||||
return this._url;
|
||||
},
|
||||
|
||||
get isClosed() {
|
||||
return this._isClosed;
|
||||
},
|
||||
|
@ -1091,6 +1091,7 @@ TabActor.prototype = {
|
||||
onListWorkers: function BTA_onListWorkers(aRequest) {
|
||||
if (this._workerActorList === null) {
|
||||
this._workerActorList = new WorkerActorList({
|
||||
type: Ci.nsIWorkerDebugger.TYPE_DEDICATED,
|
||||
window: this.window
|
||||
});
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
);
|
||||
|
||||
function matchWorkerDebugger(dbg, options) {
|
||||
if ("type" in options && dbg.type !== options.type) {
|
||||
return false;
|
||||
}
|
||||
if ("window" in options) {
|
||||
let window = dbg.window;
|
||||
while (window !== null && window.parent !== window) {
|
||||
@ -55,7 +58,8 @@ WorkerActor.prototype = {
|
||||
|
||||
return {
|
||||
type: "attached",
|
||||
isFrozen: this._dbg.isFrozen
|
||||
isFrozen: this._dbg.isFrozen,
|
||||
url: this._dbg.url
|
||||
};
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user