mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1522663 - Stop referencing sourceClient.isBlackboxed. r=loganfsmyth
Differential Revision: https://phabricator.services.mozilla.com/D17549 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
68cbcb9990
commit
32016ba41e
@ -802,9 +802,7 @@ function getSourceContent(sourceClient) {
|
||||
* @returns Promise<SourceClient>
|
||||
*/
|
||||
async function getSource(threadClient, url) {
|
||||
const {sources} = await threadClient.getSources();
|
||||
const source = sources.find((s) => s.url === url);
|
||||
|
||||
const source = await getSourceForm(threadClient, url);
|
||||
if (source) {
|
||||
return threadClient.source(source);
|
||||
}
|
||||
@ -813,11 +811,15 @@ async function getSource(threadClient, url) {
|
||||
}
|
||||
|
||||
async function getSourceById(threadClient, id) {
|
||||
const { sources } = await threadClient.getSources();
|
||||
const form = sources.find(source => source.actor == id);
|
||||
const form = await getSourceFormById(threadClient, id);
|
||||
return threadClient.source(form);
|
||||
}
|
||||
|
||||
async function getSourceForm(threadClient, url) {
|
||||
const {sources} = await threadClient.getSources();
|
||||
return sources.find((s) => s.url === url);
|
||||
}
|
||||
|
||||
async function getSourceFormById(threadClient, id) {
|
||||
const { sources } = await threadClient.getSources();
|
||||
return sources.find(source => source.actor == id);
|
||||
|
@ -30,6 +30,7 @@ const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
const testBlackBox = async function() {
|
||||
const packet = await executeOnNextTickAndWaitForPause(evalCode, gClient);
|
||||
|
||||
const bpSource = await getSourceById(
|
||||
gThreadClient,
|
||||
packet.frame.where.actor
|
||||
@ -38,9 +39,9 @@ const testBlackBox = async function() {
|
||||
await setBreakpoint(bpSource, { line: 2 });
|
||||
await resume(gThreadClient);
|
||||
|
||||
const sourceClient = await getSource(gThreadClient, BLACK_BOXED_URL);
|
||||
let sourceForm = await getSourceForm(gThreadClient, BLACK_BOXED_URL);
|
||||
|
||||
Assert.ok(!sourceClient.isBlackBoxed,
|
||||
Assert.ok(!sourceForm.isBlackBoxed,
|
||||
"By default the source is not black boxed.");
|
||||
|
||||
// Test that we can step into `doStuff` when we are not black boxed.
|
||||
@ -58,8 +59,10 @@ const testBlackBox = async function() {
|
||||
}
|
||||
);
|
||||
|
||||
await blackBox(sourceClient);
|
||||
Assert.ok(sourceClient.isBlackBoxed);
|
||||
const blackboxedSource = await getSource(gThreadClient, BLACK_BOXED_URL);
|
||||
await blackBox(blackboxedSource);
|
||||
sourceForm = await getSourceForm(gThreadClient, BLACK_BOXED_URL);
|
||||
Assert.ok(sourceForm.isBlackBoxed);
|
||||
|
||||
// Test that we step through `doStuff` when we are black boxed and its frame
|
||||
// doesn't show up.
|
||||
@ -81,8 +84,9 @@ const testBlackBox = async function() {
|
||||
}
|
||||
);
|
||||
|
||||
await unBlackBox(sourceClient);
|
||||
Assert.ok(!sourceClient.isBlackBoxed);
|
||||
await unBlackBox(blackboxedSource);
|
||||
sourceForm = await getSourceForm(gThreadClient, BLACK_BOXED_URL);
|
||||
Assert.ok(!sourceForm.isBlackBoxed);
|
||||
|
||||
// Test that we can step into `doStuff` again.
|
||||
await runTest(
|
||||
|
@ -19,7 +19,6 @@ const noop = () => {};
|
||||
*/
|
||||
function SourceClient(client, form) {
|
||||
this._form = form;
|
||||
this._isBlackBoxed = form.isBlackBoxed;
|
||||
this._activeThread = client;
|
||||
this._client = client.client;
|
||||
}
|
||||
@ -28,9 +27,6 @@ SourceClient.prototype = {
|
||||
get _transport() {
|
||||
return this._client._transport;
|
||||
},
|
||||
get isBlackBoxed() {
|
||||
return this._isBlackBoxed;
|
||||
},
|
||||
get actor() {
|
||||
return this._form.actor;
|
||||
},
|
||||
@ -51,15 +47,6 @@ SourceClient.prototype = {
|
||||
},
|
||||
{
|
||||
telemetry: "BLACKBOX",
|
||||
after: function(response) {
|
||||
if (!response.error) {
|
||||
this._isBlackBoxed = true;
|
||||
if (this._activeThread) {
|
||||
this._activeThread.emit("blackboxchange", this);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
},
|
||||
},
|
||||
),
|
||||
|
||||
@ -73,15 +60,6 @@ SourceClient.prototype = {
|
||||
},
|
||||
{
|
||||
telemetry: "UNBLACKBOX",
|
||||
after: function(response) {
|
||||
if (!response.error) {
|
||||
this._isBlackBoxed = false;
|
||||
if (this._activeThread) {
|
||||
this._activeThread.emit("blackboxchange", this);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
},
|
||||
},
|
||||
),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user