Skip to content

Commit

Permalink
Bug 1492830 - Move toolbox code from attach-thread.js to toolbox; r=j…
Browse files Browse the repository at this point in the history
…descottes

this code can be merged with the toolbox code

Differential Revision: https://phabricator.services.mozilla.com/D29367

--HG--
extra : moz-landing-system : lando
  • Loading branch information
codehag committed May 16, 2019
1 parent 7be4ef1 commit 25c2664
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 48 deletions.
26 changes: 0 additions & 26 deletions devtools/client/framework/attach-thread.js

This file was deleted.

1 change: 0 additions & 1 deletion devtools/client/framework/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ DIRS += [
]

DevToolsModules(
'attach-thread.js',
'browser-menus.js',
'devtools-browser.js',
'devtools.js',
Expand Down
53 changes: 32 additions & 21 deletions devtools/client/framework/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var {gDevTools} = require("devtools/client/framework/devtools");
var EventEmitter = require("devtools/shared/event-emitter");
var Telemetry = require("devtools/client/shared/telemetry");
const { getUnicodeUrl } = require("devtools/client/shared/unicode-url");
var { attachThread } = require("./attach-thread");
var { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm");
const { KeyCodes } = require("devtools/client/shared/keycodes");
var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports)
Expand Down Expand Up @@ -486,6 +485,37 @@ Toolbox.prototype = {
this.threadClient.removeListener("resumed", this._onResumedState);
},

_attachAndResumeThread: async function() {
const threadOptions = {
autoBlackBox: false,
ignoreFrameEnvironment: true,
pauseOnExceptions:
Services.prefs.getBoolPref("devtools.debugger.pause-on-exceptions"),
ignoreCaughtExceptions:
Services.prefs.getBoolPref("devtools.debugger.ignore-caught-exceptions"),
};
const [, threadClient] = await this._target.attachThread(threadOptions);

try {
await threadClient.resume();
} catch (ex) {
// Interpret a possible error thrown by ThreadActor.resume
if (ex.error === "wrongOrder") {
const box = this.getNotificationBox();
box.appendNotification(
L10N.getStr("toolbox.resumeOrderWarning"),
"wrong-resume-order",
"",
box.PRIORITY_WARNING_HIGH
);
} else {
throw ex;
}
}

return threadClient;
},

/**
* Open the toolbox
*/
Expand Down Expand Up @@ -525,26 +555,7 @@ Toolbox.prototype = {
]);
}

// Attach the thread
this._threadClient = await attachThread(this._target);

try {
await this._threadClient.resume();
} catch (ex) {
// Interpret a possible error thrown by ThreadActor.resume
if (ex.error === "wrongOrder") {
const box = this.getNotificationBox();
box.appendNotification(
L10N.getStr("toolbox.resumeOrderWarning"),
"wrong-resume-order",
"",
box.PRIORITY_WARNING_HIGH
);
} else {
throw ex;
}
}

this._threadClient = await this._attachAndResumeThread();
this._startThreadClientListeners();

await domReady;
Expand Down

0 comments on commit 25c2664

Please sign in to comment.