Bug 1237593 - [devtools] Test breakpoints on sources generated from source map with sections r=ochameau

Breakpoints seem to now work with sources generated from sourcemaps where the
mappings are defined in the sections property.

Differential Revision: https://phabricator.services.mozilla.com/D158424
This commit is contained in:
Hubert Boma Manilla 2022-10-11 13:39:24 +00:00
Родитель dc7ead2648
Коммит 5dc9073bec
6 изменённых файлов: 58 добавлений и 0 удалений

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

@ -84,6 +84,7 @@ skip-if = os == "win"
[browser_dbg-breakpoints-reloading.js]
[browser_dbg-breakpoints-same-file-per-target.js]
[browser_dbg-breakpoints-scroll-to-log.js]
[browser_dbg-breakpoints-sourcemap-with-sections.js]
[browser_dbg-breakpoint-skipping.js]
[browser_dbg-breakpoint-skipping-console.js]
[browser_dbg-call-stack.js]

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

@ -0,0 +1,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
"use strict";
// Test that breakpoints gets hit in sources generated from a sourcemap
// where the mappings are put in the `sections` property.
add_task(async function() {
const dbg = await initDebugger("doc-sourcemaps.html", "xbundle.js");
await selectSource(dbg, "xbundle.js");
await waitForSelectedSource(dbg, "xbundle.js");
await addBreakpoint(dbg, "xbundle.js", 5);
await waitForPaused(dbg);
info("Wait for the original file (xsource.js) to get selected");
await waitForSelectedSource(dbg, "xsource.js");
const originalSource = findSource(dbg, "xsource.js");
assertPausedAtSourceAndLine(dbg, originalSource.id, 3);
});

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

@ -36,6 +36,7 @@ add_task(async function() {
);
info("Expand the page folder and assert that the bundle appears");
await clickElement(dbg, "sourceDirectoryLabel", 3);
await clickElement(dbg, "sourceDirectoryLabel", 4);
await waitForSourcesInSourceTree(
dbg,
["entry.js", "output.js", "times2.js", "opts.js", "bundle.js"],

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

@ -10,5 +10,6 @@
<body>
<script src="sourcemaps/bundle.js"></script>
<script src="sourcemaps-with-sections/xbundle.js"></script>
</body>
</html>

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

@ -0,0 +1,7 @@
"use strict";
setInterval(function () {
console.log("about to throw");
throw new Error('error');
}, 1000);
//# sourceMappingURL=xbundle.js.map

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

@ -0,0 +1,25 @@
{
"version": 3,
"file": "xbundle.js",
"sections": [
{
"offset": {
"line": 0,
"column": 0
},
"map": {
"version": 3,
"sources": [
"xsource.js"
],
"names": [],
"mappings": ";;AAAA,WAAW,CAAC,YAAK;AAChB,QAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC9B,OAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;CACzB,EAAE,IAAI,CAAC,CAAC",
"file": "xbundle.js",
"sourceRoot": "src",
"sourcesContent": [
"setInterval(() =>{\n\tconsole.log(\"about to throw\");\n\tthrow new Error('error');\n}, 1000);\n"
]
}
}
]
}