зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1759146 - [devtools] Avoid unexpected GC while running testSourceTextContent. r=bomsy
This test assert that the debugger doesn't get unexpected request while debugging a page. But for that, we should open the page while the debugger is opened. Otherwise the page resources might be GC-ed, forcing the debugger to fetch some content again. Differential Revision: https://phabricator.services.mozilla.com/D141078
This commit is contained in:
Родитель
7c6e931b8d
Коммит
d2bd129d14
|
@ -55,26 +55,13 @@ httpServer.registerPathHandler("/http-error-script.js", (request, response) => {
|
||||||
response.write(`console.log("http error")`);
|
response.write(`console.log("http error")`);
|
||||||
});
|
});
|
||||||
add_task(async function testSourceTextContent() {
|
add_task(async function testSourceTextContent() {
|
||||||
const tab = await addTab(BASE_URL + "index.html");
|
const dbg = await initDebuggerWithAbsoluteURL("about:blank");
|
||||||
|
|
||||||
is(
|
// Load the document *once* the debugger is opened
|
||||||
loadCounts["/index.html"],
|
// in order to avoid having any source being GC-ed.
|
||||||
1,
|
await navigateToAbsoluteURL(
|
||||||
"index.html is loaded once before opening devtools"
|
|
||||||
);
|
|
||||||
|
|
||||||
// For some reason external to the debugger, we issue two requests to scripts having http error codes.
|
|
||||||
// These two requests are done before opening the debugger.
|
|
||||||
is(
|
|
||||||
loadCounts["/http-error-script.js"],
|
|
||||||
2,
|
|
||||||
"We loaded http-error-script.js twice."
|
|
||||||
);
|
|
||||||
|
|
||||||
const toolbox = await openToolboxForTab(tab, "jsdebugger");
|
|
||||||
const dbg = createDebuggerContext(toolbox);
|
|
||||||
await waitForSources(
|
|
||||||
dbg,
|
dbg,
|
||||||
|
BASE_URL + "index.html",
|
||||||
"index.html",
|
"index.html",
|
||||||
"normal-script.js",
|
"normal-script.js",
|
||||||
"slow-loading-script.js"
|
"slow-loading-script.js"
|
||||||
|
@ -94,9 +81,9 @@ add_task(async function testSourceTextContent() {
|
||||||
"scripts with HTTP error code do not appear in the source list"
|
"scripts with HTTP error code do not appear in the source list"
|
||||||
);
|
);
|
||||||
|
|
||||||
// The HTML page is fetched a second time because it was loaded before opening DevTools
|
// As we are loading the page while the debugger is already opened,
|
||||||
// and Spidermonkey doesn't store HTML page in any cache
|
// none of the resources are loaded twice.
|
||||||
is(loadCounts["/index.html"], 2, "We loaded index.html twice");
|
is(loadCounts["/index.html"], 1, "We loaded index.html only once");
|
||||||
is(
|
is(
|
||||||
loadCounts["/normal-script.js"],
|
loadCounts["/normal-script.js"],
|
||||||
1,
|
1,
|
||||||
|
@ -107,6 +94,8 @@ add_task(async function testSourceTextContent() {
|
||||||
1,
|
1,
|
||||||
"We loaded slow-loading-script.js only once"
|
"We loaded slow-loading-script.js only once"
|
||||||
);
|
);
|
||||||
|
// For some reason external to the debugger, we issue two requests to scripts having http error codes.
|
||||||
|
// These two requests are done before opening the debugger.
|
||||||
is(
|
is(
|
||||||
loadCounts["/http-error-script.js"],
|
loadCounts["/http-error-script.js"],
|
||||||
2,
|
2,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче