Skip to content

Commit 5b9c371

Browse files
pfaffeDevtools-frontend LUCI CQ
authored andcommitted
Migrate and reeanble sourcemap_tests
Fixed: 327580855 Change-Id: I554c0174eacb920f831f4ddd562a7db4cec4db1b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6596877 Auto-Submit: Philip Pfaffe <pfaffe@chromium.org> Reviewed-by: Changhao Han <changhaohan@chromium.org> Commit-Queue: Changhao Han <changhaohan@chromium.org>
1 parent 95700cc commit 5b9c371

File tree

16 files changed

+709
-768
lines changed

16 files changed

+709
-768
lines changed

front_end/panels/network/NetworkDataGridNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ export class NetworkRequestNode extends NetworkNode {
13731373
case SDK.NetworkRequest.InitiatorType.SCRIPT: {
13741374
const target = SDK.NetworkManager.NetworkManager.forRequest(request)?.target() || null;
13751375
const linkifier = this.parentView().linkifier();
1376-
if (initiator.stack) {
1376+
if (initiator.stack?.callFrames.length) {
13771377
this.linkifiedInitiatorAnchor = linkifier.linkifyStackTraceTopFrame(target, initiator.stack);
13781378
} else {
13791379
this.linkifiedInitiatorAnchor = linkifier.linkifyScriptLocation(

front_end/panels/sources/ResourceOriginPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class ResourceOriginPlugin extends Plugin {
6767

6868
// Handle anonymous scripts with an originStackTrace.
6969
for (const script of debuggerWorkspaceBinding.scriptsForUISourceCode(this.uiSourceCode)) {
70-
if (script.originStackTrace) {
70+
if (script.originStackTrace?.callFrames.length) {
7171
const link = linkifier.linkifyStackTraceTopFrame(script.debuggerModel.target(), script.originStackTrace);
7272
return [new UI.Toolbar.ToolbarItem(i18n.i18n.getFormatLocalizedString(str_, UIStrings.fromS, {PH1: link}))];
7373
}

front_end/ui/legacy/components/utils/Linkifier.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,9 @@ export class Linkifier extends Common.ObjectWrapper.ObjectWrapper<EventTypes> im
389389
// associated, whereas all active targets have one such pool. This ensures
390390
// that the fallbackAnchor is only ever used when the target was disposed.
391391
const pool = this.locationPoolByTarget.get(target);
392-
if (!pool) {
393-
console.assert(target.isDisposed());
392+
if (!pool || target.isDisposed()) {
394393
return fallbackAnchor;
395394
}
396-
console.assert(!target.isDisposed());
397395

398396
// All targets that can report stack traces also have a debugger model.
399397
const debuggerModel = target.model(SDK.DebuggerModel.DebuggerModel) as SDK.DebuggerModel.DebuggerModel;

test/e2e/helpers/console-helpers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ export async function getStructuredConsoleMessages(devToolsPage?: DevToolsPage)
225225
export async function focusConsolePrompt(devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
226226
await devToolsPage.click(CONSOLE_PROMPT_SELECTOR);
227227
await devToolsPage.waitFor('[aria-label="Console prompt"]');
228-
// FIXME(crbug/1112692): Refactor test to remove the timeout.
229-
await devToolsPage.timeout(50);
230228
}
231229

232230
export async function showVerboseMessages(devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {

test/e2e/helpers/context-menu-helpers.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {assert} from 'chai';
66
import type * as puppeteer from 'puppeteer-core';
77

88
import type {DevToolsPage} from '../../e2e_non_hosted/shared/frontend-helper.js';
9-
import {$, $$, click, waitForFunction} from '../../shared/helper.js';
9+
import {$, $$, waitForFunction} from '../../shared/helper.js';
1010
import {getBrowserAndPagesWrappers} from '../../shared/non_hosted_wrappers.js';
1111

1212
export async function waitForSoftContextMenu(devToolsPage: DevToolsPage = getBrowserAndPagesWrappers().devToolsPage):
@@ -65,13 +65,14 @@ export async function assertSubMenuItemsText(subMenuText: string, expectedOption
6565
assert.deepEqual(subMenuItemsText, expectedOptions);
6666
}
6767

68-
export async function openSoftContextMenuAndClickOnItem(selector: string, label: string) {
68+
export async function openSoftContextMenuAndClickOnItem(
69+
selector: string, label: string, devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
6970
// Find the selected node, right click.
70-
await click(selector, {clickOptions: {button: 'right'}});
71+
await devToolsPage.click(selector, {clickOptions: {button: 'right'}});
7172

7273
// Wait for the context menu option, and click it.
73-
const root = await waitForSoftContextMenu();
74-
await click(`[aria-label="${label}"]`, {root});
74+
const root = await waitForSoftContextMenu(devToolsPage);
75+
await devToolsPage.click(`[aria-label="${label}"]`, {root});
7576
}
7677

7778
export async function openSubMenu(

test/e2e/helpers/elements-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ export const getStyleRuleWithSourcePosition =
711711
return getStyleRule(styleSelector, devToolsPage);
712712
}
713713
const selector = getStyleRuleSelector(styleSelector);
714-
return waitForFunction(async () => {
714+
return devToolsPage.waitForFunction(async () => {
715715
const candidate = await devToolsPage.waitFor(selector);
716716
if (candidate) {
717717
const sourcePositionElement = await candidate.$('.styles-section-subtitle .devtools-link');

test/e2e/helpers/sources-helpers.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
waitFor,
2828
waitForAria,
2929
waitForFunction,
30-
waitForFunctionWithTries,
3130
waitForNone,
3231
waitForVisible,
3332
} from '../../shared/helper.js';
@@ -253,13 +252,14 @@ export async function addBreakpointForLine(
253252
await devToolsPage.waitForFunction(async () => await isBreakpointSet(index, devToolsPage));
254253
}
255254

256-
export async function removeBreakpointForLine(index: number|string) {
257-
const breakpointLine = await getLineNumberElement(index);
255+
export async function removeBreakpointForLine(
256+
index: number|string, devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
257+
const breakpointLine = await getLineNumberElement(index, devToolsPage);
258258
assertNotNullOrUndefined(breakpointLine);
259259

260-
await waitForFunction(async () => await isBreakpointSet(index));
261-
await clickElement(breakpointLine);
262-
await waitForFunction(async () => !(await isBreakpointSet(index)));
260+
await devToolsPage.waitForFunction(async () => await isBreakpointSet(index, devToolsPage));
261+
await devToolsPage.clickElement(breakpointLine);
262+
await devToolsPage.waitForFunction(async () => !(await isBreakpointSet(index, devToolsPage)));
263263
}
264264

265265
export async function addLogpointForLine(index: number, condition: string) {
@@ -335,9 +335,9 @@ export async function checkBreakpointDidNotActivate() {
335335
}
336336

337337
export async function getBreakpointDecorators(
338-
disabledOnly = false, devToolsPage: DevToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
338+
disabledOnly = false, expected = 0, devToolsPage: DevToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
339339
const selector = `.cm-breakpoint${disabledOnly ? '-disabled' : ''}`;
340-
const breakpointDecorators = await devToolsPage.$$(selector);
340+
const breakpointDecorators = await devToolsPage.waitForMany(selector, expected);
341341
return await Promise.all(
342342
breakpointDecorators.map(breakpointDecorator => breakpointDecorator.evaluate(n => Number(n.textContent))));
343343
}
@@ -385,7 +385,8 @@ export async function switchToCallFrame(index: number) {
385385
}
386386

387387
export async function retrieveTopCallFrameScriptLocation(
388-
script: string, target: puppeteer.Page, devToolsPage: DevToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
388+
script: string, target: puppeteer.Page|InspectedPage,
389+
devToolsPage: DevToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
389390
// The script will run into a breakpoint, which means that it will not actually
390391
// finish the evaluation, until we continue executing.
391392
// Thus, we have to await it at a later point, while stepping through the code.
@@ -418,12 +419,12 @@ export async function retrieveTopCallFrameWithoutResuming(
418419
return scriptLocation;
419420
}
420421

421-
export async function waitForStackTopMatch(matcher: RegExp) {
422+
export async function waitForStackTopMatch(matcher: RegExp, devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
422423
// The call stack is updated asynchronously, so let us wait until we see the correct one
423424
// (or report the last one we have seen before timeout).
424425
let stepLocation = '<no call stack>';
425-
await waitForFunctionWithTries(async () => {
426-
stepLocation = await retrieveTopCallFrameWithoutResuming() ?? '<invalid>';
426+
await devToolsPage.waitForFunctionWithTries(async () => {
427+
stepLocation = await retrieveTopCallFrameWithoutResuming(devToolsPage) ?? '<invalid>';
427428
return stepLocation?.match(matcher);
428429
}, {tries: 10});
429430
return stepLocation;

test/e2e/sources/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ node_ts_library("sources") {
2222
"overrides_test.ts",
2323
"restart-frame_test.ts",
2424
"snippets_test.ts",
25-
"sourcemap_test.ts",
2625
"syntax-highlighting_test.ts",
2726
"watch-expressions_test.ts",
2827
"worker-relative-sourcemap_test.ts",

0 commit comments

Comments
 (0)