Bug 1314057 - Remove unnecessary debugger pref declarations, fix browser_webconsole_object_inspector_while_debugging_and_inspecting test r=davidwalsh

--HG--
extra : histedit_source : 1b10cfaec1b0580f53bab0fb93e7fbe34935fd02
This commit is contained in:
David Walsh 2018-09-14 21:12:34 -05:00
Родитель 088e31f9d2
Коммит 719cfbddd5
8 изменённых файлов: 50 добавлений и 23 удалений

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

@ -5,6 +5,7 @@ skip-if = (os == 'linux' && debug && bits == 32)
support-files =
head.js
helpers.js
helpers/context.js
!/devtools/client/shared/test/shared-head.js
!/devtools/client/shared/test/telemetry-test-helpers.js
## START-SOURCEMAPPED-FIXTURES - Generated by examples/sourcemapped/build.js

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

@ -0,0 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Helper method to create a "dbg" context for other tools to use
*/
function createDebuggerContext(toolbox) {
const panel = toolbox.getPanel("jsdebugger");
const win = panel.panelWin;
const { store, client, selectors, actions } = panel.getVarsForTests();
return {
actions: actions,
selectors: selectors,
getState: store.getState,
store: store,
client: client,
toolbox: toolbox,
win: win,
panel: panel
};
}

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

@ -156,6 +156,8 @@ support-files =
!/devtools/client/netmonitor/test/sjs_cors-test-server.sjs
!/image/test/mochitest/blue.png
!/devtools/client/shared/test/shared-head.js
!/devtools/client/debugger/new/test/mochitest/helpers.js
!/devtools/client/debugger/new/test/mochitest/helpers/context.js
!/devtools/client/shared/test/telemetry-test-helpers.js
!/devtools/client/shared/test/test-actor.js
!/devtools/client/shared/test/test-actor-registry.js

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

@ -19,9 +19,6 @@ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-location-debugger-link.html";
add_task(async function() {
// Force the new debugger UI, in case this gets uplifted with the old
// debugger still turned on
await pushPref("devtools.debugger.new-debugger-frontend", true);
await pushPref("devtools.webconsole.filter.error", true);
await pushPref("devtools.webconsole.filter.log", true);

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

@ -12,8 +12,6 @@ const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" +
"test/mochitest/test-eval-in-stackframe.html";
add_task(async function() {
// Force the old debugger UI since it's directly used (see Bug 1301705)
await pushPref("devtools.debugger.new-debugger-frontend", false);
const hud = await openNewTabAndConsole(TEST_URI);
info("Switch to the debugger");
@ -24,7 +22,9 @@ add_task(async function() {
await gDevTools.showToolbox(target, "inspector");
info("Call firstCall() and wait for the debugger statement to be reached.");
await waitForFrameAdded();
const toolbox = gDevTools.getToolbox(target);
const dbg = createDebuggerContext(toolbox);
await pauseDebugger(dbg);
info("Switch back to the console");
await gDevTools.showToolbox(target, "webconsole");
@ -63,16 +63,10 @@ add_task(async function() {
ok(oiNodes[2].textContent.includes(`<prototype>: Object { \u2026 }`));
});
async function waitForFrameAdded() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = gDevTools.getToolbox(target);
const thread = toolbox.threadClient;
info("Waiting for framesadded");
await new Promise(resolve => {
thread.addOneTimeListener("framesadded", resolve);
async function pauseDebugger(dbg) {
info("Waiting for debugger to pause");
ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
content.wrappedJSObject.firstCall();
});
});
await waitForPaused(dbg);
}

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

@ -25,9 +25,6 @@ const PAGE_URL = `data:text/html,
</html>`;
add_task(async function() {
// Force the new debugger UI, in case this gets uplifted with the old
// debugger still turned on
await pushPref("devtools.debugger.new-debugger-frontend", true);
await pushPref("devtools.source-map.client-service.enabled", true);
const hud = await openNewTabAndConsole(PAGE_URL);

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

@ -21,7 +21,6 @@ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
add_task(async function() {
Services.prefs.setBoolPref("devtools.webconsole.filter.log", true);
registerCleanupFunction(async function() {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
Services.prefs.clearUserPref("devtools.webconsole.filter.log");
});

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

@ -19,6 +19,12 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
this);
// Import helpers for the new debugger
/* import-globals-from ../../../debugger/new/test/mochitest/helpers/context.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
this);
var {HUDService} = require("devtools/client/webconsole/hudservice");
var WCUL10n = require("devtools/client/webconsole/webconsole-l10n");
const DOCS_GA_PARAMS = `?${new URLSearchParams({
@ -535,9 +541,17 @@ async function openDebugger(options = {}) {
const panel = toolbox.getCurrentPanel();
// Do not clear VariableView lazily so it doesn't disturb test ending.
if (panel._view) {
panel._view.Variables.lazyEmpty = false;
}
// Old debugger
if (panel.panelWin && panel.panelWin.DebuggerController) {
await panel.panelWin.DebuggerController.waitForSourcesLoaded();
} else {
// New debugger
await toolbox.threadClient.getSources();
}
return {target, toolbox, panel};
}