Backed out 4 changesets (bug 1314057) for devtool failures. a=backout

Backed out changeset f46426835026 (bug 1314057)
Backed out changeset 90480b4b4c43 (bug 1314057)
Backed out changeset fa0d46e77437 (bug 1314057)
Backed out changeset 241f876d557f (bug 1314057)

--HG--
rename : devtools/client/shared/test/addon1.xpi => devtools/client/debugger/test/mochitest/addon1.xpi
rename : devtools/client/shared/test/addon2.xpi => devtools/client/debugger/test/mochitest/addon2.xpi
rename : devtools/client/debugger/new/test/mochitest/browser_dbg_global-method-override.js => devtools/client/debugger/test/mochitest/browser_dbg_global-method-override.js
rename : devtools/client/shared/test/browser_dbg_globalactor.js => devtools/client/debugger/test/mochitest/browser_dbg_globalactor.js
rename : devtools/client/shared/test/browser_dbg_listaddons.js => devtools/client/debugger/test/mochitest/browser_dbg_listaddons.js
rename : devtools/client/shared/test/browser_dbg_listtabs-01.js => devtools/client/debugger/test/mochitest/browser_dbg_listtabs-01.js
rename : devtools/client/shared/test/browser_dbg_listtabs-02.js => devtools/client/debugger/test/mochitest/browser_dbg_listtabs-02.js
rename : devtools/client/shared/test/browser_dbg_listtabs-03.js => devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js
rename : devtools/client/shared/test/browser_dbg_multiple-windows.js => devtools/client/debugger/test/mochitest/browser_dbg_multiple-windows.js
rename : devtools/client/shared/test/browser_dbg_navigation.js => devtools/client/debugger/test/mochitest/browser_dbg_navigation.js
rename : devtools/client/shared/test/browser_dbg_target-scoped-actor-01.js => devtools/client/debugger/test/mochitest/browser_dbg_target-scoped-actor-01.js
rename : devtools/client/shared/test/browser_dbg_target-scoped-actor-02.js => devtools/client/debugger/test/mochitest/browser_dbg_target-scoped-actor-02.js
rename : devtools/client/debugger/new/test/mochitest/examples/doc_global-method-override.html => devtools/client/debugger/test/mochitest/doc_global-method-override.html
This commit is contained in:
Dorel Luca 2018-10-10 09:16:11 +03:00
Родитель fa37566219
Коммит c5bc5672ed
28 изменённых файлов: 470 добавлений и 575 удалений

Просмотреть файл

@ -624,7 +624,6 @@ support-files =
examples/doc-pause-points.html
examples/doc-return-values.html
examples/doc-wasm-sourcemaps.html
examples/doc_global-method-override.html
examples/asm.js
examples/async.js
examples/bogus-map.js
@ -687,8 +686,6 @@ skip-if = (os == "win" && ccov) # Bug 1424154
[browser_dbg-ember-quickstart.js]
[browser_dbg-expressions.js]
[browser_dbg-expressions-error.js]
[browser_dbg_global-method-override.js]
skip-if = e10s && debug
[browser_dbg-iframes.js]
[browser_dbg-inline-cache.js]
[browser_dbg-keyboard-navigation.js]

Просмотреть файл

@ -1,18 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that scripts that override properties of the global object, like
* toString, don't break the debugger. The test page used to cause the debugger
* to throw when trying to attach to the thread actor.
*/
"use strict";
add_task(async function() {
const dbg = await initDebugger("doc_global-method-override.html");
ok(dbg, "Should have a debugger available.");
is(dbg.toolbox.threadClient.state, "attached", "Debugger should be attached.");
});

Просмотреть файл

@ -6,6 +6,8 @@ tags = devtools
subsuite = devtools
skip-if = (os == 'linux' && debug && bits == 32)
support-files =
addon1.xpi
addon2.xpi
addon4.xpi
addon5.xpi
addon-webext-contentscript.xpi
@ -68,6 +70,7 @@ support-files =
doc_function-display-name.html
doc_function-jump.html
doc_function-search.html
doc_global-method-override.html
doc_iframes.html
doc_included-script.html
doc_inline-debugger-statement.html
@ -144,6 +147,10 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_bug-896139.js]
skip-if = e10s && debug
[browser_dbg_chrome-create.js]
skip-if = (e10s && debug) || (verify && os == "linux") # Exit code mismatch with verify
[browser_dbg_chrome-debugging.js]
skip-if = e10s && debug
[browser_dbg_clean-exit.js]
skip-if = true # Bug 1044985 (racy test)
[browser_dbg_closure-inspection.js]
@ -186,6 +193,10 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_file-reload.js]
skip-if = e10s && debug
[browser_dbg_global-method-override.js]
skip-if = e10s && debug
[browser_dbg_globalactor.js]
skip-if = e10s
[browser_dbg_host-layout.js]
skip-if = e10s && debug
[browser_dbg_jump-to-function-definition.js]
@ -194,4 +205,15 @@ skip-if = e10s && debug
skip-if = e10s # TODO
[browser_dbg_interrupts.js]
skip-if = e10s && debug
[browser_dbg_listaddons.js]
skip-if = e10s && debug
tags = addons
[browser_dbg_listtabs-01.js]
[browser_dbg_listtabs-02.js]
skip-if = true # Never worked for remote frames, needs a mock DebuggerServerConnection
[browser_dbg_listtabs-03.js]
skip-if = e10s && debug
[browser_dbg_listworkers.js]
[browser_dbg_multiple-windows.js]
[browser_dbg_navigation.js]
skip-if = e10s && debug

Просмотреть файл

@ -6,6 +6,8 @@ tags = devtools
subsuite = devtools
skip-if = (os == 'linux' && debug && bits == 32)
support-files =
addon1.xpi
addon2.xpi
addon4.xpi
addon5.xpi
addon-webext-contentscript.xpi
@ -68,6 +70,7 @@ support-files =
doc_function-display-name.html
doc_function-jump.html
doc_function-search.html
doc_global-method-override.html
doc_iframes.html
doc_included-script.html
doc_inline-debugger-statement.html
@ -156,6 +159,8 @@ uses-unsafe-cpows = true
skip-if = e10s && debug
[browser_dbg_split-console-paused-reload.js]
skip-if = true # Bug 1288348 - previously e10s && debug
[browser_dbg_target-scoped-actor-01.js]
[browser_dbg_target-scoped-actor-02.js]
[browser_dbg_terminate-on-tab-close.js]
uses-unsafe-cpows = true
skip-if = e10s && debug

Просмотреть файл

@ -0,0 +1,70 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that a chrome debugger can be created in a new process.
*/
// There are shutdown issues for which multiple rejections are left uncaught.
// See bug 1018184 for resolving these issues.
const { PromiseTestUtils } = scopedCuImport("resource://testing-common/PromiseTestUtils.jsm");
PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
PromiseTestUtils.whitelistRejectionsGlobally(/NS_ERROR_FAILURE/);
var gProcess;
function test() {
// Windows XP and 8.1 test slaves are terribly slow at this test.
requestLongerTimeout(5);
Services.prefs.setBoolPref("devtools.chrome.enabled", true);
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
initChromeDebugger(aOnClose).then(aProcess => {
gProcess = aProcess;
info("Starting test...");
performTest();
});
}
function performTest() {
ok(gProcess._dbgProcess,
"The remote debugger process wasn't created properly!");
ok(gProcess._dbgProcess.exitCode == null,
"The remote debugger process isn't running!");
is(typeof gProcess._dbgProcess.pid, "number",
"The remote debugger process doesn't have a pid (?!)");
info("process location: " + gProcess._dbgProcess.location);
info("process pid: " + gProcess._dbgProcess.pid);
info("process name: " + gProcess._dbgProcess.processName);
info("process sig: " + gProcess._dbgProcess.processSignature);
ok(gProcess._dbgProfilePath,
"The remote debugger profile wasn't created properly!");
is(gProcess._dbgProfilePath, OS.Path.join(OS.Constants.Path.profileDir, "chrome_debugger_profile"),
"The remote debugger profile isn't where we expect it!");
info("profile path: " + gProcess._dbgProfilePath);
gProcess.close();
}
function aOnClose() {
is(gProcess._dbgProcess.exitCode, (Services.appinfo.OS == "WINNT" ? -9 : -15),
"The remote debugger process didn't die cleanly.");
info("process exit value: " + gProcess._dbgProcess.exitValue);
info("profile path: " + gProcess._dbgProfilePath);
finish();
}
registerCleanupFunction(function () {
Services.prefs.clearUserPref("devtools.chrome.enabled");
Services.prefs.clearUserPref("devtools.debugger.remote-enabled");
gProcess = null;
});

Просмотреть файл

@ -0,0 +1,89 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that chrome debugging works.
*/
const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
var gClient, gThreadClient;
var gAttached = promise.defer();
var gNewChromeSource = promise.defer();
var { DevToolsLoader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
var customLoader = new DevToolsLoader();
customLoader.invisibleToDebugger = true;
var { DebuggerServer } = customLoader.require("devtools/server/main");
function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");
promise.all([gAttached.promise, gNewChromeSource.promise])
.then(resumeAndCloseConnection)
.then(finish)
.catch(aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
testParentProcessTargetActor();
});
}
function testParentProcessTargetActor() {
gClient.getProcess().then(aResponse => {
let actor = aResponse.form.actor;
gClient.attachTarget(actor).then(([response, tabClient]) => {
tabClient.attachThread(null).then(([aResponse, aThreadClient]) => {
gThreadClient = aThreadClient;
gThreadClient.addListener("newSource", onNewSource);
if (aResponse.error) {
ok(false, "Couldn't attach to the chrome debugger.");
gAttached.reject();
} else {
ok(true, "Attached to the chrome debugger.");
gAttached.resolve();
// Ensure that a new chrome global will be created.
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
}
});
});
});
}
function onNewSource(aEvent, aPacket) {
if (aPacket.source.url.startsWith("chrome:")) {
ok(true, "Received a new chrome source: " + aPacket.source.url);
gThreadClient.removeListener("newSource", onNewSource);
gNewChromeSource.resolve();
}
}
function resumeAndCloseConnection() {
let deferred = promise.defer();
gThreadClient.resume(() => deferred.resolve(gClient.close()));
return deferred.promise;
}
registerCleanupFunction(function () {
gClient = null;
gThreadClient = null;
gAttached = null;
gNewChromeSource = null;
customLoader = null;
DebuggerServer = null;
});

Просмотреть файл

@ -0,0 +1,26 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that scripts that override properties of the global object, like
* toString don't break the debugger. The test page used to cause the debugger
* to throw when trying to attach to the thread actor.
*/
const TAB_URL = EXAMPLE_URL + "doc_global-method-override.html";
function test() {
let options = {
source: TAB_URL,
line: 1
};
initDebugger(TAB_URL, options).then(([aTab, aPanel]) => {
let gDebugger = aPanel.panelWin;
ok(gDebugger, "Should have a debugger available.");
is(gDebugger.gThreadClient.state, "attached", "Debugger should be attached.");
closeDebuggerAndFinish(aPanel);
});
}

Просмотреть файл

@ -7,13 +7,7 @@
* Check extension-added global actor API.
*/
"use strict";
var { DebuggerServer } = require("devtools/server/main");
var { ActorRegistry } = require("devtools/server/actors/utils/actor-registry");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
const ACTORS_URL = EXAMPLE_URL + "testactors.js";
const ACTORS_URL = CHROME_URL + "testactors.js";
add_task(async function() {
DebuggerServer.init();
@ -49,7 +43,7 @@ add_task(async function() {
for (const connID of Object.getOwnPropertyNames(DebuggerServer._connections)) {
const conn = DebuggerServer._connections[connID];
const actorPrefix = conn._prefix + "testOne";
for (const pool of conn._extraPools) {
for (let pool of conn._extraPools) {
for (const actor of pool.poolChildren()) {
if (actor.actorID.startsWith(actorPrefix)) {
count++;

Просмотреть файл

@ -0,0 +1,110 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure the listAddons request works as specified.
*/
const ADDON1_ID = "jid1-oBAwBoE5rSecNg@jetpack";
const ADDON1_PATH = "addon1.xpi";
const ADDON2_ID = "jid1-qjtzNGV8xw5h2A@jetpack";
const ADDON2_PATH = "addon2.xpi";
var gAddon1, gAddon1Actor, gAddon2, gAddon2Actor, gClient;
function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");
promise.resolve(null)
.then(testFirstAddon)
.then(testSecondAddon)
.then(testRemoveFirstAddon)
.then(testRemoveSecondAddon)
.then(() => gClient.close())
.then(finish)
.catch(aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
});
}
function testFirstAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", () => {
addonListChanged = true;
});
return addTemporaryAddon(ADDON1_PATH).then(aAddon => {
gAddon1 = aAddon;
return getAddonActorForId(gClient, ADDON1_ID).then(aGrip => {
ok(!addonListChanged, "Should not yet be notified that list of addons changed.");
ok(aGrip, "Should find an addon actor for addon1.");
gAddon1Actor = aGrip.actor;
});
});
}
function testSecondAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function () {
addonListChanged = true;
});
return addTemporaryAddon(ADDON2_PATH).then(aAddon => {
gAddon2 = aAddon;
return getAddonActorForId(gClient, ADDON1_ID).then(aFirstGrip => {
return getAddonActorForId(gClient, ADDON2_ID).then(aSecondGrip => {
ok(addonListChanged, "Should be notified that list of addons changed.");
is(aFirstGrip.actor, gAddon1Actor, "First addon's actor shouldn't have changed.");
ok(aSecondGrip, "Should find a addon actor for the second addon.");
gAddon2Actor = aSecondGrip.actor;
});
});
});
}
function testRemoveFirstAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function () {
addonListChanged = true;
});
return removeAddon(gAddon1).then(() => {
return getAddonActorForId(gClient, ADDON1_ID).then(aGrip => {
ok(addonListChanged, "Should be notified that list of addons changed.");
ok(!aGrip, "Shouldn't find a addon actor for the first addon anymore.");
});
});
}
function testRemoveSecondAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function () {
addonListChanged = true;
});
return removeAddon(gAddon2).then(() => {
return getAddonActorForId(gClient, ADDON2_ID).then(aGrip => {
ok(addonListChanged, "Should be notified that list of addons changed.");
ok(!aGrip, "Shouldn't find a addon actor for the second addon anymore.");
});
});
}
registerCleanupFunction(function () {
gAddon1 = null;
gAddon1Actor = null;
gAddon2 = null;
gAddon2Actor = null;
gClient = null;
});

Просмотреть файл

@ -0,0 +1,96 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure the listTabs request works as specified.
*/
const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
const TAB2_URL = EXAMPLE_URL + "doc_empty-tab-02.html";
var gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");
promise.resolve(null)
.then(testFirstTab)
.then(testSecondTab)
.then(testRemoveTab)
.then(testAttachRemovedTab)
.then(() => gClient.close())
.then(finish)
.catch(aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
});
}
function testFirstTab() {
return addTab(TAB1_URL).then(aTab => {
gTab1 = aTab;
return getTargetActorForUrl(gClient, TAB1_URL).then(aGrip => {
ok(aGrip, "Should find a target actor for the first tab.");
gTab1Actor = aGrip.actor;
});
});
}
function testSecondTab() {
return addTab(TAB2_URL).then(aTab => {
gTab2 = aTab;
return getTargetActorForUrl(gClient, TAB1_URL).then(aFirstGrip => {
return getTargetActorForUrl(gClient, TAB2_URL).then(aSecondGrip => {
is(aFirstGrip.actor, gTab1Actor, "First tab's actor shouldn't have changed.");
ok(aSecondGrip, "Should find a target actor for the second tab.");
gTab2Actor = aSecondGrip.actor;
});
});
});
}
function testRemoveTab() {
return removeTab(gTab1).then(() => {
return getTargetActorForUrl(gClient, TAB1_URL).then(aGrip => {
ok(!aGrip, "Shouldn't find a target actor for the first tab anymore.");
});
});
}
function testAttachRemovedTab() {
return removeTab(gTab2).then(() => {
let deferred = promise.defer();
gClient.addListener("paused", (aEvent, aPacket) => {
ok(false, "Attaching to an exited target actor shouldn't generate a pause.");
deferred.reject();
});
gClient.request({ to: gTab2Actor, type: "attach" }, aResponse => {
is(aResponse.error, "connectionClosed",
"Connection is gone since the tab was removed.");
deferred.resolve();
});
return deferred.promise;
});
}
registerCleanupFunction(function () {
gTab1 = null;
gTab1Actor = null;
gTab2 = null;
gTab2Actor = null;
gClient = null;
});

Просмотреть файл

@ -8,7 +8,6 @@
*/
var { BrowserTabList } = require("devtools/server/actors/webbrowser");
var { DebuggerServer } = require("devtools/server/main");
var gTestPage = "data:text/html;charset=utf-8," + encodeURIComponent(
"<title>JS Debugger BrowserTabList test page</title><body>Yo.</body>");
@ -55,18 +54,14 @@ function checkSingleTab() {
return gTabList.getList().then(targetActors => {
is(targetActors.length, 1, "initial tab list: contains initial tab");
gFirstActor = targetActors[0];
is(
gFirstActor.url,
"about:blank",
"initial tab list: initial tab URL is 'about:blank'"
);
is(gFirstActor.url, "about:blank", "initial tab list: initial tab URL is 'about:blank'");
is(gFirstActor.title, "New Tab", "initial tab list: initial tab title is 'New Tab'");
});
}
function addTabA() {
return addTab(gTestPage).then(tab => {
gTabA = tab;
return addTab(gTestPage).then(aTab => {
gTabA = aTab;
});
}
@ -81,17 +76,13 @@ function testTabA() {
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gTabA opened: new tab URL");
is(
gActorA.title,
"JS Debugger BrowserTabList test page",
"gTabA opened: new tab title"
);
is(gActorA.title, "JS Debugger BrowserTabList test page", "gTabA opened: new tab title");
});
}
function addTabB() {
return addTab(gTestPage).then(tab => {
gTabB = tab;
return addTab(gTestPage).then(aTab => {
gTabB = aTab;
});
}
@ -105,10 +96,10 @@ function testTabB() {
}
function removeTabA() {
const deferred = promise.defer();
let deferred = promise.defer();
once(gBrowser.tabContainer, "TabClose").then(event => {
ok(!event.detail.adoptedBy, "This was a normal tab close");
once(gBrowser.tabContainer, "TabClose").then(aEvent => {
ok(!aEvent.detail.adoptedBy, "This was a normal tab close");
// Let the actor's TabClose handler finish first.
executeSoon(deferred.resolve);
@ -129,17 +120,13 @@ function testTabClosed() {
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gTabA closed: new tab URL");
is(
gActorA.title,
"JS Debugger BrowserTabList test page",
"gTabA closed: new tab title"
);
is(gActorA.title, "JS Debugger BrowserTabList test page", "gTabA closed: new tab title");
});
}
function addTabC() {
return addTab(gTestPage).then(tab => {
gTabC = tab;
return addTab(gTestPage).then(aTab => {
gTabC = aTab;
});
}
@ -153,10 +140,10 @@ function testTabC() {
}
function removeTabC() {
const deferred = promise.defer();
let deferred = promise.defer();
once(gBrowser.tabContainer, "TabClose").then(event => {
ok(event.detail.adoptedBy, "This was a tab closed by moving");
once(gBrowser.tabContainer, "TabClose").then(aEvent => {
ok(aEvent.detail.adoptedBy, "This was a tab closed by moving");
// Let the actor's TabClose handler finish first.
executeSoon(deferred.resolve);
@ -177,19 +164,15 @@ function testNewWindow() {
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gTabC closed: new tab URL");
is(
gActorA.title,
"JS Debugger BrowserTabList test page",
"gTabC closed: new tab title"
);
is(gActorA.title, "JS Debugger BrowserTabList test page", "gTabC closed: new tab title");
});
}
function removeNewWindow() {
const deferred = promise.defer();
let deferred = promise.defer();
once(gNewWindow, "unload").then(event => {
ok(!event.detail, "This was a normal window close");
once(gNewWindow, "unload").then(aEvent => {
ok(!aEvent.detail, "This was a normal window close");
// Let the actor's TabClose handler finish first.
executeSoon(deferred.resolve);
@ -210,19 +193,15 @@ function testWindowClosed() {
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gNewWindow closed: new tab URL");
is(
gActorA.title,
"JS Debugger BrowserTabList test page",
"gNewWindow closed: new tab title"
);
is(gActorA.title, "JS Debugger BrowserTabList test page", "gNewWindow closed: new tab title");
});
}
function removeTabB() {
const deferred = promise.defer();
let deferred = promise.defer();
once(gBrowser.tabContainer, "TabClose").then(event => {
ok(!event.detail.adoptedBy, "This was a normal tab close");
once(gBrowser.tabContainer, "TabClose").then(aEvent => {
ok(!aEvent.detail.adoptedBy, "This was a normal tab close");
// Let the actor's TabClose handler finish first.
executeSoon(deferred.resolve);

Просмотреть файл

@ -3,34 +3,28 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Make sure the listTabs request works as specified.
*/
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
var { Task } = require("devtools/shared/task");
const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
var gClient;
var gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
const transport = DebuggerServer.connectPipe();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(Task.async(function* ([aType, aTraits]) {
is(aType, "browser",
"Root actor should identify itself as a browser.");
const tab = yield addTab(TAB1_URL);
let tab = yield addTab(TAB1_URL);
let { tabs } = yield gClient.listTabs();
is(tabs.length, 2, "Should be two tabs");
const tabGrip = tabs.filter(a => a.url == TAB1_URL).pop();
let tabGrip = tabs.filter(a => a.url == TAB1_URL).pop();
ok(tabGrip, "Should have an actor for the tab");
let response = yield gClient.request({ to: tabGrip.actor, type: "attach" });
@ -42,7 +36,7 @@ function test() {
response = yield gClient.request({ to: tabGrip.actor, type: "detach" });
is(response.type, "detached", "Should have detached");
const newGrip = tabs.filter(a => a.url == TAB1_URL).pop();
let newGrip = tabs.filter(a => a.url == TAB1_URL).pop();
is(newGrip.actor, tabGrip.actor, "Should have the same actor for the same tab");
response = yield gClient.request({ to: tabGrip.actor, type: "attach" });
@ -56,6 +50,10 @@ function test() {
}));
}
registerCleanupFunction(function() {
registerCleanupFunction(function () {
gTab1 = null;
gTab1Actor = null;
gTab2 = null;
gTab2Actor = null;
gClient = null;
});

Просмотреть файл

@ -3,16 +3,11 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Make sure that the debugger attaches to the right tab when multiple windows
* are open.
*/
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
const TAB1_URL = EXAMPLE_URL + "doc_script-switching-01.html";
const TAB2_URL = EXAMPLE_URL + "doc_script-switching-02.html";
@ -92,7 +87,8 @@ async function testRemoveTab(client, win, tab) {
await continue_remove_tab(client, tab);
}
async function continue_remove_tab(client, tab) {
async function continue_remove_tab(client, tab)
{
removeTab(tab);
const response = await client.listTabs();
@ -104,12 +100,3 @@ async function continue_remove_tab(client, tab) {
is(response.selected, 0, "The original tab is selected.");
}
function addWindow(url) {
info("Adding window: " + url);
return promise.resolve(getChromeWindow(window.open(url)));
}
function getChromeWindow(win) {
return win.docShell.rootTreeItem.domWindow;
}

Просмотреть файл

@ -3,18 +3,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check tab attach/navigation.
*/
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
const TAB2_FILE = "doc_empty-tab-02.html";
const TAB2_URL = EXAMPLE_URL + TAB2_FILE;
const TAB2_URL = EXAMPLE_URL + "doc_empty-tab-02.html";
var gClient;
@ -22,7 +16,7 @@ function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
const transport = DebuggerServer.connectPipe();
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
@ -33,23 +27,20 @@ function test() {
.then(testNavigate)
.then(testDetach)
.then(finish)
.catch(error => {
ok(false, "Got an error: " + error.message + "\n" + error.stack);
.catch(aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
});
}
function testNavigate([aGrip, aResponse]) {
const outstanding = [promise.defer(), promise.defer()];
let outstanding = [promise.defer(), promise.defer()];
gClient.addListener("tabNavigated", function onTabNavigated(event, packet) {
is(packet.url.split("/").pop(), TAB2_FILE,
gClient.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
is(aPacket.url, TAB2_URL,
"Got a tab navigation notification.");
info(JSON.stringify(packet));
info(JSON.stringify(event));
if (packet.state == "start") {
if (aPacket.state == "start") {
ok(true, "Tab started to navigate.");
outstanding[0].resolve();
} else {
@ -64,12 +55,12 @@ function testNavigate([aGrip, aResponse]) {
.then(() => aGrip.actor);
}
function testDetach(actor) {
const deferred = promise.defer();
function testDetach(aActor) {
let deferred = promise.defer();
gClient.addOneTimeListener("tabDetached", (type, packet) => {
gClient.addOneTimeListener("tabDetached", (aType, aPacket) => {
ok(true, "Got a tab detach notification.");
is(packet.from, actor, "tab detach message comes from the expected actor");
is(aPacket.from, aActor, "tab detach message comes from the expected actor");
deferred.resolve(gClient.close());
});
@ -77,23 +68,6 @@ function testDetach(actor) {
return deferred.promise;
}
registerCleanupFunction(function() {
registerCleanupFunction(function () {
gClient = null;
});
async function attachTargetActorForUrl(client, url) {
const grip = await getTargetActorForUrl(client, url);
const [ response ] = await client.attachTarget(grip.actor);
return [grip, response];
}
function getTargetActorForUrl(client, url) {
const deferred = promise.defer();
client.listTabs().then(response => {
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
deferred.resolve(targetActor);
});
return deferred.promise;
}

Просмотреть файл

@ -3,16 +3,11 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check target-scoped actor lifetimes.
*/
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
const ACTORS_URL = EXAMPLE_URL + "testactors.js";
const ACTORS_URL = CHROME_URL + "testactors.js";
const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
add_task(async function test() {
@ -47,20 +42,3 @@ async function testTargetScopedActor(client, grip) {
const response = await client.request({ to: grip.testOneActor, type: "ping" });
is(response.pong, "pong", "Actor should respond to requests.");
}
async function attachTargetActorForUrl(client, url) {
const grip = await getTargetActorForUrl(client, url);
const [ response ] = await client.attachTarget(grip.actor);
return [grip, response];
}
function getTargetActorForUrl(client, url) {
const deferred = promise.defer();
client.listTabs().then(response => {
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
deferred.resolve(targetActor);
});
return deferred.promise;
}

Просмотреть файл

@ -3,16 +3,11 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check target-scoped actor lifetimes.
*/
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
const ACTORS_URL = EXAMPLE_URL + "testactors.js";
const ACTORS_URL = CHROME_URL + "testactors.js";
const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
add_task(async function() {
@ -58,20 +53,3 @@ async function closeTab(client, grip) {
`can't be sent as the connection just closed.`,
"testOneActor went away.");
}
async function attachTargetActorForUrl(client, url) {
const grip = await getTargetActorForUrl(client, url);
const [ response ] = await client.attachTarget(grip.actor);
return [grip, response];
}
function getTargetActorForUrl(client, url) {
const deferred = promise.defer();
client.listTabs().then(response => {
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
deferred.resolve(targetActor);
});
return deferred.promise;
}

Просмотреть файл

@ -2,13 +2,9 @@
tags = devtools
subsuite = devtools
support-files =
addon1.xpi
addon2.xpi
browser_devices.json
doc_cubic-bezier-01.html
doc_cubic-bezier-02.html
doc_empty-tab-01.html
doc_empty-tab-02.html
doc_filter-editor-01.html
doc_html_tooltip-02.xul
doc_html_tooltip-03.xul
@ -25,8 +21,6 @@ support-files =
doc_layoutHelpers-getBoxQuads.html
doc_layoutHelpers.html
doc_options-view.xul
doc_script-switching-01.html
doc_script-switching-02.html
doc_spectrum.html
doc_tableWidget_basic.html
doc_tableWidget_keyboard_interaction.xul
@ -44,7 +38,6 @@ support-files =
telemetry-test-helpers.js
test-actor-registry.js
test-actor.js
testactors.js
!/devtools/client/responsive.html/test/browser/devices.json
[browser_autocomplete_popup.js]
@ -57,8 +50,6 @@ support-files =
[browser_cubic-bezier-05.js]
[browser_cubic-bezier-06.js]
[browser_cubic-bezier-07.js]
[browser_dbg_globalactor.js]
skip-if = e10s
[browser_filter-editor-01.js]
[browser_filter-editor-02.js]
[browser_filter-editor-03.js]
@ -213,16 +204,3 @@ skip-if = !e10s || os == "win" # RDM only works for remote tabs, Win: bug 140419
[browser_devices.js]
skip-if = verify
[browser_theme_switching.js]
[browser_dbg_listaddons.js]
skip-if = e10s && debug
tags = addons
[browser_dbg_listtabs-01.js]
[browser_dbg_listtabs-02.js]
skip-if = true # Never worked for remote frames, needs a mock DebuggerServerConnection
[browser_dbg_listtabs-03.js]
skip-if = e10s && debug
[browser_dbg_multiple-windows.js]
[browser_dbg_navigation.js]
skip-if = e10s && debug
[browser_dbg_target-scoped-actor-01.js]
[browser_dbg_target-scoped-actor-02.js]

Просмотреть файл

@ -1,163 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
const chromeRegistry =
Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
const DEBUGGER_CHROME_URL = "chrome://mochitests/content/browser/devtools/client/shared/test/";
const DEBUGGER_CHROME_URI = Services.io.newURI(DEBUGGER_CHROME_URL);
/**
* Make sure the listAddons request works as specified.
*/
const ADDON1_ID = "jid1-oBAwBoE5rSecNg@jetpack";
const ADDON1_PATH = "addon1.xpi";
const ADDON2_ID = "jid1-qjtzNGV8xw5h2A@jetpack";
const ADDON2_PATH = "addon2.xpi";
var gAddon1, gAddon1Actor, gAddon2, gClient;
function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
const transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");
promise.resolve(null)
.then(testFirstAddon)
.then(testSecondAddon)
.then(testRemoveFirstAddon)
.then(testRemoveSecondAddon)
.then(() => gClient.close())
.then(finish)
.catch(error => {
ok(false, "Got an error: " + error.message + "\n" + error.stack);
});
});
}
function testFirstAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", () => {
addonListChanged = true;
});
return addTemporaryAddon(ADDON1_PATH).then(addon => {
gAddon1 = addon;
return getAddonActorForId(gClient, ADDON1_ID).then(grip => {
ok(!addonListChanged, "Should not yet be notified that list of addons changed.");
ok(grip, "Should find an addon actor for addon1.");
gAddon1Actor = grip.actor;
});
});
}
function testSecondAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function() {
addonListChanged = true;
});
return addTemporaryAddon(ADDON2_PATH).then(addon => {
gAddon2 = addon;
return getAddonActorForId(gClient, ADDON1_ID).then(fistGrip => {
return getAddonActorForId(gClient, ADDON2_ID).then(secondGrip => {
ok(addonListChanged, "Should be notified that list of addons changed.");
is(fistGrip.actor, gAddon1Actor, "First addon's actor shouldn't have changed.");
ok(secondGrip, "Should find a addon actor for the second addon.");
});
});
});
}
function testRemoveFirstAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function() {
addonListChanged = true;
});
return removeAddon(gAddon1).then(() => {
return getAddonActorForId(gClient, ADDON1_ID).then(grip => {
ok(addonListChanged, "Should be notified that list of addons changed.");
ok(!grip, "Shouldn't find a addon actor for the first addon anymore.");
});
});
}
function testRemoveSecondAddon() {
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function() {
addonListChanged = true;
});
return removeAddon(gAddon2).then(() => {
return getAddonActorForId(gClient, ADDON2_ID).then(grip => {
ok(addonListChanged, "Should be notified that list of addons changed.");
ok(!grip, "Shouldn't find a addon actor for the second addon anymore.");
});
});
}
registerCleanupFunction(function() {
gAddon1 = null;
gAddon1Actor = null;
gAddon2 = null;
gClient = null;
});
function getAddonURIFromPath(path) {
const chromeURI = Services.io.newURI(path, null, DEBUGGER_CHROME_URI);
return chromeRegistry.convertChromeURL(chromeURI).QueryInterface(Ci.nsIFileURL);
}
function addTemporaryAddon(path) {
const addonFile = getAddonURIFromPath(path).file;
info("Installing addon: " + addonFile.path);
return AddonManager.installTemporaryAddon(addonFile);
}
function getAddonActorForId(client, addonId) {
info("Get addon actor for ID: " + addonId);
const deferred = promise.defer();
client.listAddons(response => {
const addonTargetActor = response.addons.filter(grip => grip.id == addonId).pop();
info("got addon actor for ID: " + addonId);
deferred.resolve(addonTargetActor);
});
return deferred.promise;
}
function removeAddon(addon) {
info("Removing addon.");
const deferred = promise.defer();
const listener = {
onUninstalled: function(uninstalledAddon) {
if (uninstalledAddon != addon) {
return;
}
AddonManager.removeAddonListener(listener);
deferred.resolve();
}
};
AddonManager.addAddonListener(listener);
addon.uninstall();
return deferred.promise;
}

Просмотреть файл

@ -1,112 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Make sure the listTabs request works as specified.
*/
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
const TAB2_URL = EXAMPLE_URL + "doc_empty-tab-02.html";
var gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
const transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");
promise.resolve(null)
.then(testFirstTab)
.then(testSecondTab)
.then(testRemoveTab)
.then(testAttachRemovedTab)
.then(() => gClient.close())
.then(finish)
.catch(error => {
ok(false, "Got an error: " + error.message + "\n" + error.stack);
});
});
}
function testFirstTab() {
return addTab(TAB1_URL).then(tab => {
gTab1 = tab;
return getTargetActorForUrl(gClient, TAB1_URL).then(grip => {
ok(grip, "Should find a target actor for the first tab.");
gTab1Actor = grip.actor;
});
});
}
function testSecondTab() {
return addTab(TAB2_URL).then(tab => {
gTab2 = tab;
return getTargetActorForUrl(gClient, TAB1_URL).then(firstGrip => {
return getTargetActorForUrl(gClient, TAB2_URL).then(secondGrip => {
is(firstGrip.actor, gTab1Actor, "First tab's actor shouldn't have changed.");
ok(secondGrip, "Should find a target actor for the second tab.");
gTab2Actor = secondGrip.actor;
});
});
});
}
function testRemoveTab() {
return removeTab(gTab1).then(() => {
return getTargetActorForUrl(gClient, TAB1_URL).then(grip => {
ok(!grip, "Shouldn't find a target actor for the first tab anymore.");
});
});
}
function testAttachRemovedTab() {
return removeTab(gTab2).then(() => {
const deferred = promise.defer();
gClient.addListener("paused", () => {
ok(false, "Attaching to an exited target actor shouldn't generate a pause.");
deferred.reject();
});
gClient.request({ to: gTab2Actor, type: "attach" }, response => {
is(response.error, "connectionClosed",
"Connection is gone since the tab was removed.");
deferred.resolve();
});
return deferred.promise;
});
}
registerCleanupFunction(function() {
gTab1 = null;
gTab1Actor = null;
gTab2 = null;
gTab2Actor = null;
gClient = null;
});
function getTargetActorForUrl(client, url) {
const deferred = promise.defer();
client.listTabs().then(response => {
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
deferred.resolve(targetActor);
});
return deferred.promise;
}

Просмотреть файл

@ -1,14 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Empty test page 1</title>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -1,14 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Empty test page 2</title>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -1,18 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<button onclick="firstCall()">Click me!</button>
<script type="text/javascript" src="code_script-switching-01.js"></script>
<script type="text/javascript" src="code_script-switching-02.js"></script>
</body>
</html>

Просмотреть файл

@ -1,18 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<button onclick="firstCall()">Click me!</button>
<script type="text/javascript" src="code_script-switching-01.js"></script>
<script type="text/javascript" src="code_script-switching-02.js?foo=bar,baz|lol"></script>
</body>
</html>

Просмотреть файл

@ -16,8 +16,6 @@ const {Hosts} = require("devtools/client/framework/toolbox-hosts");
const TEST_URI_ROOT = "http://example.com/browser/devtools/client/shared/test/";
const OPTIONS_VIEW_URL = TEST_URI_ROOT + "doc_options-view.xul";
const EXAMPLE_URL = "chrome://mochitests/content/browser/devtools/client/shared/test/";
function catchFail(func) {
return function() {
try {

Просмотреть файл

@ -1,27 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function TestActor1(connection, tab) {
this.conn = connection;
this.tab = tab;
}
TestActor1.prototype = {
actorPrefix: "testOne",
grip: function TA1_grip() {
return { actor: this.actorID,
test: "TestActor1" };
},
onPing: function TA1_onPing() {
return { pong: "pong" };
}
};
TestActor1.prototype.requestTypes = {
"ping": TestActor1.prototype.onPing
};
exports.TestActor1 = TestActor1;