Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Errors
- This test gets skipped with pattern: asan
- This test failed 2 times in the preceding 30 days. quicksearch this test
- Manifest: devtools/client/debugger/test/mochitest/browser_kz.toml
/* 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
// Test the redirects on the sourceMappingURL are blocked and not followed.
"use strict";
const httpServer = createTestHTTPServer();
httpServer.registerContentType("html", "text/html");
httpServer.registerContentType("js", "application/javascript");
httpServer.registerPathHandler("/index.html", (request, response) => {
response.setStatusLine(request.httpVersion, 200, "OK");
response.write(`<!doctype html>
<html>
<head>
<script>
const foo = 2;
console.log(foo);
//# sourceMappingURL=${BASE_URL}/redirect
</script>
</head>
</html>
`);
});
httpServer.registerPathHandler("/redirect", (request, response) => {
response.setStatusLine(request.httpVersion, 301, "Moved Permanently");
response.setHeader("Location", `${BASE_URL}/evil`);
});
httpServer.registerPathHandler("/evil", (request, response) => {
response.setStatusLine(request.httpVersion, 200, "OK");
response.write(
`{"version":3,"sources":["evil.original.js"],"names":[], "mappings": ""}`
);
});
add_task(async function () {
const dbg = await initDebuggerWithAbsoluteURL(`${BASE_URL}/index.html`);
await getDebuggerSplitConsole(dbg);
await hasConsoleMessage(dbg, "Source map error");
const { value } = await findConsoleMessage(dbg, "Source map error");
is(
value,
`Source map error: NetworkError when attempting to fetch resource.\nResource URL: ${BASE_URL}/index.html\nSource Map URL: ${BASE_URL}/redirect[Learn More]`,
"A source map error message is logged indicating the redirect failed"
);
});