mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 15:55:16 +00:00
Bug 1346936 - support SourceMap header in addition to X-SourceMap; r=Ehsan
According to the source map spec, the X-SourceMap header is deprecated in favor of SourceMap. This adds support for the newer name. The test case is a copy of the X-SourceMap test with the obvious change. MozReview-Commit-ID: 8J6YN8xMIfb --HG-- extra : rebase_source : 76673c096f5571065527073575b6e8c033ae68be
This commit is contained in:
parent
0214e13efe
commit
088509bb80
@ -61,6 +61,7 @@ support-files = ../file_bug357450.js
|
||||
[test_bug1063837.xul]
|
||||
[test_bug1139964.xul]
|
||||
[test_bug1209621.xul]
|
||||
[test_bug1346936.html]
|
||||
[test_cpows.xul]
|
||||
[test_registerElement_content.xul]
|
||||
[test_registerElement_ep.xul]
|
||||
|
3
dom/base/test/chrome/nochrome_bug1346936.html
Normal file
3
dom/base/test/chrome/nochrome_bug1346936.html
Normal file
@ -0,0 +1,3 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
</html>
|
4
dom/base/test/chrome/nochrome_bug1346936.js
Normal file
4
dom/base/test/chrome/nochrome_bug1346936.js
Normal file
@ -0,0 +1,4 @@
|
||||
//# sourceMappingURL=bar.js.map
|
||||
|
||||
// Define a single function to prevent script source from being gc'd
|
||||
function foo() {}
|
1
dom/base/test/chrome/nochrome_bug1346936.js^headers^
Normal file
1
dom/base/test/chrome/nochrome_bug1346936.js^headers^
Normal file
@ -0,0 +1 @@
|
||||
SourceMap: foo.js.map
|
61
dom/base/test/chrome/test_bug1346936.html
Normal file
61
dom/base/test/chrome/test_bug1346936.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1346936
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1346936</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1346936">Mozilla Bug 1346936</a>
|
||||
<style type="text/css">
|
||||
#link1 a { -moz-user-select:none; }
|
||||
</style>
|
||||
<div id="link1"><a href="http://www.mozilla.org/">link1</a></div>
|
||||
<div id="link2"><a href="http://www.mozilla.org/">link2</a></div>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1346936 **/
|
||||
|
||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug1346936.html";
|
||||
iframe.onload = function () {
|
||||
var script = iframe.contentWindow.document.createElement("script");
|
||||
script.src = "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug1346936.js";
|
||||
script.onload = function () {
|
||||
var dbg = new Debugger(iframe.contentWindow);
|
||||
ok(dbg, "Should be able to create debugger");
|
||||
|
||||
var scripts = dbg.findScripts({
|
||||
url: "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug1346936.js"
|
||||
});
|
||||
ok(scripts.length > 0, "Should be able to find script");
|
||||
|
||||
is(scripts[0].source.sourceMapURL, "foo.js.map");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
iframe.contentWindow.document.body.appendChild(script);
|
||||
};
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
};
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -31,6 +31,9 @@ TEST_DIRS += [
|
||||
TEST_HARNESS_FILES.testing.mochitest.tests.dom.base.test.chrome += [
|
||||
'chrome/bug421622-referer.sjs',
|
||||
'chrome/bug884693.sjs',
|
||||
'chrome/nochrome_bug1346936.html',
|
||||
'chrome/nochrome_bug1346936.js',
|
||||
'chrome/nochrome_bug1346936.js^headers^',
|
||||
'chrome/nochrome_bug765993.html',
|
||||
'chrome/nochrome_bug765993.js',
|
||||
'chrome/nochrome_bug765993.js^headers^',
|
||||
|
@ -2736,7 +2736,10 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
|
||||
}
|
||||
|
||||
nsAutoCString sourceMapURL;
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), sourceMapURL);
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("SourceMap"), sourceMapURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), sourceMapURL);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aRequest->mHasSourceMapURL = true;
|
||||
aRequest->mSourceMapURL = NS_ConvertUTF8toUTF16(sourceMapURL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user