Bug 989374: Consolidate logic from browser_dbg_addon-* tests. r=fitzgen

This commit is contained in:
Dave Townsend 2014-04-07 12:49:43 -07:00
parent a629db3a79
commit 8e5a9f9524
5 changed files with 212 additions and 433 deletions

View File

@ -3,135 +3,46 @@
// Make sure the add-on actor can see loaded JS Modules from an add-on
const ADDON5_URL = EXAMPLE_URL + "addon5.xpi";
let gAddon, gClient, gThreadClient, gDebugger, gSources, gTitle;
function onMessage(event) {
try {
let json = JSON.parse(event.data);
switch (json.name) {
case "toolbox-title":
gTitle = json.data.value;
break;
}
} catch(e) {
DevToolsUtils.reportException("onMessage", e);
}
}
const ADDON_URL = EXAMPLE_URL + "addon5.xpi";
function test() {
Task.spawn(function () {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.addBrowserActors();
}
let addon = yield addAddon(ADDON_URL);
let addonDebugger = yield initAddonDebugger(ADDON_URL);
gBrowser.selectedTab = gBrowser.addTab();
let iframe = document.createElement("iframe");
document.documentElement.appendChild(iframe);
is(addonDebugger.title, "Debugger - Test unpacked add-on with JS Modules", "Saw the right toolbox title.");
window.addEventListener("message", onMessage);
// Check the inital list of sources is correct
let groups = yield addonDebugger.getSourceGroups();
is(groups[0].name, "browser_dbg_addon5@tests.mozilla.org", "Add-on code should be the first group");
is(groups.length, 1, "Should be only one group.");
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
let connected = promise.defer();
gClient.connect(connected.resolve);
yield connected.promise;
yield installAddon();
let debuggerPanel = yield initAddonDebugger(gClient, ADDON5_URL, iframe);
gDebugger = debuggerPanel.panelWin;
gThreadClient = gDebugger.gThreadClient;
gSources = gDebugger.DebuggerView.Sources;
yield testSources(false);
let sources = groups[0].sources;
is(sources.length, 2, "Should be two sources");
ok(sources[0].url.endsWith("/browser_dbg_addon5@tests.mozilla.org/bootstrap.js"), "correct url for bootstrap code")
is(sources[0].label, "bootstrap.js", "correct label for bootstrap code")
is(sources[1].url, "resource://browser_dbg_addon5/test.jsm", "correct url for addon code")
is(sources[1].label, "test.jsm", "correct label for addon code")
// Load a new module and check it appears in the list of sources
Cu.import("resource://browser_dbg_addon5/test2.jsm", {});
yield testSources(true);
groups = yield addonDebugger.getSourceGroups();
is(groups[0].name, "browser_dbg_addon5@tests.mozilla.org", "Add-on code should be the first group");
is(groups.length, 1, "Should be only one group.");
sources = groups[0].sources;
is(sources.length, 3, "Should be three sources");
ok(sources[0].url.endsWith("/browser_dbg_addon5@tests.mozilla.org/bootstrap.js"), "correct url for bootstrap code")
is(sources[0].label, "bootstrap.js", "correct label for bootstrap code")
is(sources[1].url, "resource://browser_dbg_addon5/test.jsm", "correct url for addon code")
is(sources[1].label, "test.jsm", "correct label for addon code")
is(sources[2].url, "resource://browser_dbg_addon5/test2.jsm", "correct url for addon code")
is(sources[2].label, "test2.jsm", "correct label for addon code")
Cu.unload("resource://browser_dbg_addon5/test2.jsm");
yield uninstallAddon();
yield closeConnection();
yield debuggerPanel._toolbox.destroy();
iframe.remove();
window.removeEventListener("message", onMessage);
yield addonDebugger.destroy();
yield removeAddon(addon);
finish();
});
}
function installAddon () {
return addAddon(ADDON5_URL).then(aAddon => {
gAddon = aAddon;
});
}
function testSources(expectSecondModule) {
let deferred = promise.defer();
let foundAddonModule = false;
let foundAddonModule2 = false;
let foundAddonBootstrap = false;
gThreadClient.getSources(({sources}) => {
ok(sources.length, "retrieved sources");
for (let source of sources) {
let url = source.url.split(" -> ").pop();
let { label, group } = gSources.getItemByValue(source.url).attachment;
if (url.indexOf("resource://browser_dbg_addon5/test.jsm") === 0) {
is(label, "test.jsm", "correct label for addon code");
is(group, "browser_dbg_addon5@tests.mozilla.org", "addon module is in the add-on's group");
foundAddonModule = true;
} else if (url.indexOf("resource://browser_dbg_addon5/test2.jsm") === 0) {
is(label, "test2.jsm", "correct label for addon code");
is(group, "browser_dbg_addon5@tests.mozilla.org", "addon module is in the add-on's group");
foundAddonModule2 = true;
} else if (url.endsWith("/browser_dbg_addon5@tests.mozilla.org/bootstrap.js")) {
is(label, "bootstrap.js", "correct label for bootstrap code");
is(group, "browser_dbg_addon5@tests.mozilla.org", "addon bootstrap script is in the add-on's group");
foundAddonBootstrap = true;
} else {
ok(false, "Saw an unexpected source: " + url);
}
}
ok(foundAddonModule, "found JS module for the addon in the list");
is(foundAddonModule2, expectSecondModule, "saw the second addon module");
ok(foundAddonBootstrap, "found bootstrap script for the addon in the list");
is(gTitle, "Debugger - Test unpacked add-on with JS Modules", "Saw the right toolbox title.");
let groups = gDebugger.document.querySelectorAll(".side-menu-widget-group-title .name");
is(groups[0].value, "browser_dbg_addon5@tests.mozilla.org", "Add-on code should be the first group");
is(groups.length, 1, "Should be only one group.");
deferred.resolve();
});
return deferred.promise;
}
function uninstallAddon() {
return removeAddon(gAddon);
}
function closeConnection () {
let deferred = promise.defer();
gClient.close(deferred.resolve);
return deferred.promise;
}
registerCleanupFunction(function() {
gClient = null;
gAddon = null;
gThreadClient = null;
gDebugger = null;
gSources = null;
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});

View File

@ -3,135 +3,46 @@
// Make sure the add-on actor can see loaded JS Modules from an add-on
const ADDON4_URL = EXAMPLE_URL + "addon4.xpi";
let gAddon, gClient, gThreadClient, gDebugger, gSources, gTitle;
function onMessage(event) {
try {
let json = JSON.parse(event.data);
switch (json.name) {
case "toolbox-title":
gTitle = json.data.value;
break;
}
} catch(e) {
DevToolsUtils.reportException("onMessage", e);
}
}
const ADDON_URL = EXAMPLE_URL + "addon4.xpi";
function test() {
Task.spawn(function () {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.addBrowserActors();
}
let addon = yield addAddon(ADDON_URL);
let addonDebugger = yield initAddonDebugger(ADDON_URL);
gBrowser.selectedTab = gBrowser.addTab();
let iframe = document.createElement("iframe");
document.documentElement.appendChild(iframe);
is(addonDebugger.title, "Debugger - Test add-on with JS Modules", "Saw the right toolbox title.");
window.addEventListener("message", onMessage);
// Check the inital list of sources is correct
let groups = yield addonDebugger.getSourceGroups();
is(groups[0].name, "browser_dbg_addon4@tests.mozilla.org", "Add-on code should be the first group");
is(groups.length, 1, "Should be only one group.");
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
let connected = promise.defer();
gClient.connect(connected.resolve);
yield connected.promise;
yield installAddon();
let debuggerPanel = yield initAddonDebugger(gClient, ADDON4_URL, iframe);
gDebugger = debuggerPanel.panelWin;
gThreadClient = gDebugger.gThreadClient;
gSources = gDebugger.DebuggerView.Sources;
yield testSources(false);
let sources = groups[0].sources;
is(sources.length, 2, "Should be two sources");
ok(sources[0].url.endsWith("/browser_dbg_addon4@tests.mozilla.org.xpi!/bootstrap.js"), "correct url for bootstrap code")
is(sources[0].label, "bootstrap.js", "correct label for bootstrap code")
is(sources[1].url, "resource://browser_dbg_addon4/test.jsm", "correct url for addon code")
is(sources[1].label, "test.jsm", "correct label for addon code")
// Load a new module and check it appears in the list of sources
Cu.import("resource://browser_dbg_addon4/test2.jsm", {});
yield testSources(true);
groups = yield addonDebugger.getSourceGroups();
is(groups[0].name, "browser_dbg_addon4@tests.mozilla.org", "Add-on code should be the first group");
is(groups.length, 1, "Should be only one group.");
sources = groups[0].sources;
is(sources.length, 3, "Should be three sources");
ok(sources[0].url.endsWith("/browser_dbg_addon4@tests.mozilla.org.xpi!/bootstrap.js"), "correct url for bootstrap code")
is(sources[0].label, "bootstrap.js", "correct label for bootstrap code")
is(sources[1].url, "resource://browser_dbg_addon4/test.jsm", "correct url for addon code")
is(sources[1].label, "test.jsm", "correct label for addon code")
is(sources[2].url, "resource://browser_dbg_addon4/test2.jsm", "correct url for addon code")
is(sources[2].label, "test2.jsm", "correct label for addon code")
Cu.unload("resource://browser_dbg_addon4/test2.jsm");
yield uninstallAddon();
yield closeConnection();
yield debuggerPanel._toolbox.destroy();
iframe.remove();
window.removeEventListener("message", onMessage);
yield addonDebugger.destroy();
yield removeAddon(addon);
finish();
});
}
function installAddon () {
return addAddon(ADDON4_URL).then(aAddon => {
gAddon = aAddon;
});
}
function testSources(expectSecondModule) {
let deferred = promise.defer();
let foundAddonModule = false;
let foundAddonModule2 = false;
let foundAddonBootstrap = false;
gThreadClient.getSources(({sources}) => {
ok(sources.length, "retrieved sources");
for (let source of sources) {
let url = source.url.split(" -> ").pop();
let { label, group } = gSources.getItemByValue(source.url).attachment;
if (url.indexOf("resource://browser_dbg_addon4/test.jsm") === 0) {
is(label, "test.jsm", "correct label for addon code");
is(group, "browser_dbg_addon4@tests.mozilla.org", "addon module is in the add-on's group");
foundAddonModule = true;
} else if (url.indexOf("resource://browser_dbg_addon4/test2.jsm") === 0) {
is(label, "test2.jsm", "correct label for addon code");
is(group, "browser_dbg_addon4@tests.mozilla.org", "addon module is in the add-on's group");
foundAddonModule2 = true;
} else if (url.endsWith("/browser_dbg_addon4@tests.mozilla.org.xpi!/bootstrap.js")) {
is(label, "bootstrap.js", "correct label for bootstrap code");
is(group, "browser_dbg_addon4@tests.mozilla.org", "addon bootstrap script is in the add-on's group");
foundAddonBootstrap = true;
} else {
ok(false, "Saw an unexpected source: " + url);
}
}
ok(foundAddonModule, "found JS module for the addon in the list");
is(foundAddonModule2, expectSecondModule, "saw the second addon module");
ok(foundAddonBootstrap, "found bootstrap script for the addon in the list");
is(gTitle, "Debugger - Test add-on with JS Modules", "Saw the right toolbox title.");
let groups = gDebugger.document.querySelectorAll(".side-menu-widget-group-title .name");
is(groups[0].value, "browser_dbg_addon4@tests.mozilla.org", "Add-on code should be the first group");
is(groups.length, 1, "Should be only one group.");
deferred.resolve();
});
return deferred.promise;
}
function uninstallAddon() {
return removeAddon(gAddon);
}
function closeConnection () {
let deferred = promise.defer();
gClient.close(deferred.resolve);
return deferred.promise;
}
registerCleanupFunction(function() {
gClient = null;
gAddon = null;
gThreadClient = null;
gDebugger = null;
gSources = null;
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});

View File

@ -4,7 +4,7 @@
// Ensure that only panels that are relevant to the addon debugger
// display in the toolbox
const ADDON3_URL = EXAMPLE_URL + "addon3.xpi";
const ADDON_URL = EXAMPLE_URL + "addon3.xpi";
let gAddon, gClient, gThreadClient, gDebugger, gSources;
let PREFS = [
@ -15,10 +15,8 @@ let PREFS = [
];
function test() {
Task.spawn(function () {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.addBrowserActors();
}
let addon = yield addAddon(ADDON_URL);
let addonDebugger = yield initAddonDebugger(ADDON_URL);
// Store and enable all optional dev tools panels
let originalPrefs = PREFS.map(pref => {
@ -27,69 +25,20 @@ function test() {
return original;
});
gBrowser.selectedTab = gBrowser.addTab();
let iframe = document.createElement("iframe");
document.documentElement.appendChild(iframe);
let tabs = addonDebugger.frame.contentDocument.getElementById("toolbox-tabs").children;
let expectedTabs = ["options", "jsdebugger"];
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
is(tabs.length, 2, "displaying only 2 tabs in addon debugger");
Array.forEach(tabs, (tab, i) => {
let toolName = expectedTabs[i];
is(tab.getAttribute("toolid"), toolName, "displaying " + toolName);
});
let connected = promise.defer();
gClient.connect(connected.resolve);
yield connected.promise;
yield installAddon();
let debuggerPanel = yield initAddonDebugger(gClient, ADDON3_URL, iframe);
gDebugger = debuggerPanel.panelWin;
gThreadClient = gDebugger.gThreadClient;
gSources = gDebugger.DebuggerView.Sources;
testPanels(iframe);
yield uninstallAddon();
yield closeConnection();
yield debuggerPanel._toolbox.destroy();
iframe.remove();
yield addonDebugger.destroy();
yield removeAddon(addon);
PREFS.forEach((pref, i) => Services.prefs.setBoolPref(pref, originalPrefs[i]));
finish();
});
}
function installAddon () {
return addAddon(ADDON3_URL).then(aAddon => {
gAddon = aAddon;
});
}
function testPanels(frame) {
let tabs = frame.contentDocument.getElementById("toolbox-tabs").children;
let expectedTabs = ["options", "jsdebugger"];
is(tabs.length, 2, "displaying only 2 tabs in addon debugger");
Array.forEach(tabs, (tab, i) => {
let toolName = expectedTabs[i];
is(tab.getAttribute("toolid"), toolName, "displaying " + toolName);
});
}
function uninstallAddon() {
return removeAddon(gAddon);
}
function closeConnection () {
let deferred = promise.defer();
gClient.close(deferred.resolve);
return deferred.promise;
}
registerCleanupFunction(function() {
gClient = null;
gAddon = null;
gThreadClient = null;
gDebugger = null;
gSources = null;
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});

View File

@ -4,136 +4,32 @@
// Ensure that the sources listed when debugging an addon are either from the
// addon itself, or the SDK, with proper groups and labels.
const ADDON3_URL = EXAMPLE_URL + "addon3.xpi";
let gAddon, gClient, gThreadClient, gDebugger, gSources, gTitle;
function onMessage(event) {
try {
let json = JSON.parse(event.data);
switch (json.name) {
case "toolbox-title":
gTitle = json.data.value;
break;
}
} catch(e) {
DevToolsUtils.reportException("onMessage", e);
}
}
const ADDON_URL = EXAMPLE_URL + "addon3.xpi";
function test() {
Task.spawn(function () {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.addBrowserActors();
}
let addon = yield addAddon(ADDON_URL);
let addonDebugger = yield initAddonDebugger(ADDON_URL);
gBrowser.selectedTab = gBrowser.addTab();
let iframe = document.createElement("iframe");
document.documentElement.appendChild(iframe);
is(addonDebugger.title, "Debugger - browser_dbg_addon3", "Saw the right toolbox title.");
window.addEventListener("message", onMessage);
// Check the inital list of sources is correct
let groups = yield addonDebugger.getSourceGroups();
is(groups[0].name, "jid1-ami3akps3baaeg@jetpack", "Add-on code should be the first group");
is(groups[1].name, "Add-on SDK", "Add-on SDK should be the second group");
is(groups.length, 2, "Should be only two groups.");
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
let sources = groups[0].sources;
is(sources.length, 2, "Should be two sources");
ok(sources[0].url.endsWith("/jid1-ami3akps3baaeg@jetpack.xpi!/bootstrap.js"), "correct url for bootstrap code")
is(sources[0].label, "bootstrap.js", "correct label for bootstrap code")
is(sources[1].url, "resource://jid1-ami3akps3baaeg-at-jetpack/browser_dbg_addon3/lib/main.js", "correct url for add-on code")
is(sources[1].label, "resources/browser_dbg_addon3/lib/main.js", "correct label for add-on code")
let connected = promise.defer();
gClient.connect(connected.resolve);
yield connected.promise;
ok(groups[1].sources.length > 10, "SDK modules are listed");
yield installAddon();
let debuggerPanel = yield initAddonDebugger(gClient, ADDON3_URL, iframe);
gDebugger = debuggerPanel.panelWin;
gThreadClient = gDebugger.gThreadClient;
gSources = gDebugger.DebuggerView.Sources;
yield testSources();
yield uninstallAddon();
yield closeConnection();
yield debuggerPanel._toolbox.destroy();
iframe.remove();
window.removeEventListener("message", onMessage);
yield addonDebugger.destroy();
yield removeAddon(addon);
finish();
});
}
function installAddon () {
return addAddon(ADDON3_URL).then(aAddon => {
gAddon = aAddon;
});
}
function testSources() {
let deferred = promise.defer();
let foundAddonModule = false;
let foundSDKModule = 0;
let foundAddonBootstrap = false;
gThreadClient.getSources(({sources}) => {
ok(sources.length, "retrieved sources");
for (let source of sources) {
let url = source.url.split(" -> ").pop();
info(source.url + "\n\n\n" + url);
let { label, group } = gSources.getItemByValue(source.url).attachment;
if (url.indexOf("resource://gre/modules/commonjs/") === 0) {
is(label, url.substring(32), "correct truncated label");
is(group, "Add-on SDK", "correct SDK group");
foundSDKModule++;
} else if (url.indexOf("resource://gre/modules/commonjs/method") === 0) {
is(label.indexOf("method/"), 0, "correct truncated label");
is(group, "Add-on SDK", "correct SDK group");
foundSDKModule++;
} else if (url.indexOf("resource://jid1-ami3akps3baaeg-at-jetpack") === 0) {
is(label, "resources/browser_dbg_addon3/lib/main.js", "correct label for addon code");
is(group, "jid1-ami3akps3baaeg@jetpack", "addon code is in the add-on's group");
foundAddonModule = true;
} else if (url.endsWith("/jid1-ami3akps3baaeg@jetpack.xpi!/bootstrap.js")) {
is(label, "bootstrap.js", "correct label for bootstrap script");
is(group, "jid1-ami3akps3baaeg@jetpack", "addon code is in the add-on's group");
foundAddonBootstrap = true;
} else {
ok(false, "Saw an unexpected source: " + url);
}
}
ok(foundAddonModule, "found code for the addon in the list");
ok(foundAddonBootstrap, "found bootstrap for the addon in the list");
// Be flexible in this number, as SDK changes could change the exact number of
// built-in browser SDK modules
ok(foundSDKModule > 10, "SDK modules are listed");
is(gTitle, "Debugger - browser_dbg_addon3", "Saw the right toolbox title.");
let groups = gDebugger.document.querySelectorAll(".side-menu-widget-group-title .name");
is(groups[0].value, "jid1-ami3akps3baaeg@jetpack", "Add-on code should be the first group");
is(groups[1].value, "Add-on SDK", "Add-on SDK should be the second group");
is(groups.length, 2, "Should be only two groups.");
deferred.resolve();
});
return deferred.promise;
}
function uninstallAddon() {
return removeAddon(gAddon);
}
function closeConnection () {
let deferred = promise.defer();
gClient.close(deferred.resolve);
return deferred.promise;
}
registerCleanupFunction(function() {
gClient = null;
gAddon = null;
gThreadClient = null;
gDebugger = null;
gSources = null;
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});

View File

@ -471,6 +471,14 @@ function getTab(aTarget, aWindow) {
}
}
function getSources(aClient) {
let deferred = promise.defer();
aClient.getSources(({sources}) => deferred.resolve(sources));
return deferred.promise;
}
function initDebugger(aTarget, aWindow) {
info("Initializing a debugger panel.");
@ -500,32 +508,136 @@ function initDebugger(aTarget, aWindow) {
});
}
function initAddonDebugger(aClient, aUrl, aFrame) {
info("Initializing an addon debugger panel.");
// Creates an add-on debugger for a given add-on. The returned AddonDebugger
// object must be destroyed before finishing the test
function initAddonDebugger(aUrl) {
let addonDebugger = new AddonDebugger();
return addonDebugger.init(aUrl).then(() => addonDebugger);
}
function AddonDebugger() {
this._onMessage = this._onMessage.bind(this);
}
AddonDebugger.prototype = {
init: Task.async(function*(aUrl) {
info("Initializing an addon debugger panel.");
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.addBrowserActors();
}
this.frame = document.createElement("iframe");
this.frame.setAttribute("height", 400);
document.documentElement.appendChild(this.frame);
window.addEventListener("message", this._onMessage);
let transport = DebuggerServer.connectPipe();
this.client = new DebuggerClient(transport);
let connected = promise.defer();
this.client.connect(connected.resolve);
yield connected.promise;
let addonActor = yield getAddonActorForUrl(this.client, aUrl);
return getAddonActorForUrl(aClient, aUrl).then((addonActor) => {
let targetOptions = {
form: { addonActor: addonActor.actor, title: addonActor.name },
client: aClient,
client: this.client,
chrome: true
};
let toolboxOptions = {
customIframe: aFrame
customIframe: this.frame
};
let target = devtools.TargetFactory.forTab(targetOptions);
return gDevTools.showToolbox(target, "jsdebugger", devtools.Toolbox.HostType.CUSTOM, toolboxOptions);
}).then(aToolbox => {
let toolbox = yield gDevTools.showToolbox(target, "jsdebugger", devtools.Toolbox.HostType.CUSTOM, toolboxOptions);
info("Addon debugger panel shown successfully.");
let debuggerPanel = aToolbox.getCurrentPanel();
this.debuggerPanel = toolbox.getCurrentPanel();
// Wait for the initial resume...
return waitForClientEvents(debuggerPanel, "resumed")
.then(() => prepareDebugger(debuggerPanel))
.then(() => debuggerPanel);
});
yield waitForClientEvents(this.debuggerPanel, "resumed");
yield prepareDebugger(this.debuggerPanel);
}),
destroy: Task.async(function*() {
let deferred = promise.defer();
this.client.close(deferred.resolve);
yield deferred.promise;
yield this.debuggerPanel._toolbox.destroy();
this.frame.remove();
window.removeEventListener("message", this._onMessage);
}),
/**
* Returns a list of the groups and sources in the UI. The returned array
* contains objects for each group with properties name and sources. The
* sources property contains an array with objects for each source for that
* group with properties label and url.
*/
getSourceGroups: Task.async(function*() {
let debuggerWin = this.debuggerPanel.panelWin;
let sources = yield getSources(debuggerWin.gThreadClient);
ok(sources.length, "retrieved sources");
// groups will be the return value, groupmap and the maps we put in it will
// be used as quick lookups to add the url information in below
let groups = [];
let groupmap = new Map();
let uigroups = this.debuggerPanel.panelWin.document.querySelectorAll(".side-menu-widget-group");
for (let g of uigroups) {
let name = g.querySelector(".side-menu-widget-group-title .name").value;
let group = {
name: name,
sources: []
};
groups.push(group);
let labelmap = new Map();
groupmap.set(name, labelmap);
for (let l of g.querySelectorAll(".dbg-source-item")) {
let source = {
label: l.value,
url: null
};
labelmap.set(l.value, source);
group.sources.push(source);
}
}
for (let source of sources) {
let { label, group } = debuggerWin.DebuggerView.Sources.getItemByValue(source.url).attachment;
if (!groupmap.has(group)) {
ok(false, "Saw a source group not in the UI: " + group);
continue;
}
if (!groupmap.get(group).has(label)) {
ok(false, "Saw a source label not in the UI: " + label);
continue;
}
groupmap.get(group).get(label).url = source.url.split(" -> ").pop();
}
return groups;
}),
_onMessage: function(event) {
let json = JSON.parse(event.data);
switch (json.name) {
case "toolbox-title":
this.title = json.data.value;
break;
}
}
}
function initChromeDebugger(aOnClose) {