Bug 1569859 - [devtools] Always return sync content when using SourcesManager.urlContents with partial=true. r=nchevobbe

With popup debugging (next patches), we trigger a race condition in this code
where `SourcesManager.urlContents` is called *after* `devtools-html-content` is fired.
i.e. after the HTML document is parsed.
This lead to return an async promise instead of an immediate value.
This confuses `SourceActor._getStartLineColumnDisplacement` which no longer apply breakpoints right away.
We miss early breakpoint support for popups.

This isn't easy to reproduce beyond popup debugging,
in next changeset, browser_dbg-breakpoints-popup.js's testPausedByBreakpoint covers this.

Differential Revision: https://phabricator.services.mozilla.com/D135144
This commit is contained in:
Alexandre Poirot 2022-01-14 12:02:25 +00:00
Родитель 8f7f623182
Коммит b42e2fdedc
2 изменённых файлов: 7 добавлений и 1 удалений

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

@ -8,6 +8,7 @@
add_task(async function() {
const dbg = await initDebugger("doc-inline-script-offset.html");
await selectSource(dbg, "doc-inline-script-offset.html");
await addBreakpoint(dbg, "doc-inline-script-offset.html", 6, 66);
await reload(dbg);
await waitForPaused(dbg);

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

@ -408,7 +408,12 @@ class SourcesManager extends EventEmitter {
contentType: data.contentType,
};
}
if (partial) {
return {
content: "",
contentType: "",
};
}
return this._fetchURLContents(url, partial, canUseCache);
}