summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/new/panel.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/debugger/new/panel.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/debugger/new/panel.js')
-rw-r--r--devtools/client/debugger/new/panel.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/devtools/client/debugger/new/panel.js b/devtools/client/debugger/new/panel.js
new file mode 100644
index 000000000..62d4a9f4f
--- /dev/null
+++ b/devtools/client/debugger/new/panel.js
@@ -0,0 +1,77 @@
+/* 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";
+
+const { Task } = require("devtools/shared/task");
+var {LocalizationHelper} = require("devtools/shared/l10n");
+
+const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
+var L10N = new LocalizationHelper(DBG_STRINGS_URI);
+
+function DebuggerPanel(iframeWindow, toolbox) {
+ this.panelWin = iframeWindow;
+ this.panelWin.L10N = L10N;
+ this.toolbox = toolbox;
+}
+
+DebuggerPanel.prototype = {
+ open: Task.async(function* () {
+ if (!this.toolbox.target.isRemote) {
+ yield this.toolbox.target.makeRemote();
+ }
+
+ yield this.panelWin.Debugger.bootstrap({
+ threadClient: this.toolbox.threadClient,
+ tabTarget: this.toolbox.target
+ });
+
+ this.isReady = true;
+ return this;
+ }),
+
+ _store: function () {
+ return this.panelWin.Debugger.store;
+ },
+
+ _getState: function () {
+ return this._store().getState();
+ },
+
+ _actions: function () {
+ return this.panelWin.Debugger.actions;
+ },
+
+ _selectors: function () {
+ return this.panelWin.Debugger.selectors;
+ },
+
+ getFrames: function () {
+ let frames = this._selectors().getFrames(this._getState());
+
+ // Frames is null when the debugger is not paused.
+ if (!frames) {
+ return {
+ frames: [],
+ selected: -1
+ };
+ }
+
+ frames = frames.toJS();
+ const selectedFrame = this._selectors().getSelectedFrame(this._getState());
+ const selected = frames.findIndex(frame => frame.id == selectedFrame.id);
+
+ frames.forEach(frame => {
+ frame.actor = frame.id;
+ });
+
+ return { frames, selected };
+ },
+
+ destroy: function () {
+ this.panelWin.Debugger.destroy();
+ this.emit("destroyed");
+ }
+};
+
+exports.DebuggerPanel = DebuggerPanel;