Closed Bug 1020846 Opened 10 years ago Closed 10 years ago

Unexpected Error messages: "[...] is being assigned a //# sourceMappingURL, but already has one"

Categories

(Core :: DOM: Core & HTML, defect)

29 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33
Tracking Status
firefox30 --- wontfix
firefox31 --- wontfix
firefox32 --- fixed
firefox33 --- fixed

People

(Reporter: max.limper, Assigned: mccr8)

References

Details

Attachments

(4 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36 Steps to reproduce: I'm using TypeScript. All "transpiled" foo.js files are placed right next to the corresponding foo.ts files, and along with a foo.js.map file for each of them. My IDE (WebStorm 8.0.2) generates the .js and .js.map files automatically. Each .js file contains exactly one time a line like the following: //# sourceMappingURL=foo.js.map Actual results: For each js file in my project, Firefox (29.0.1) outputs an error message like the following to the console: Error: http://localhost:8000/foo.js is being assigned a //# sourceMappingURL, but already has one Expected results: As, to the best of my knowledge, the sourceMappingURL is defined only once, there shouldn't be any error message. Chrome (35.0.1916.114 m) does not output any errors.
I don't see any warnings or errors when loading the attached test.html in Firefox 29... Do you see the issue in a clean profile with no addons?
Flags: needinfo?(max.limper)
Flags: needinfo?(max.limper)
Yes, I just uploaded a screenshot. I have re-installed Firefox to make sure, with the latest version, and without any plugins installed, I still get the error.
Hmm. I'm loading the test.html file via file://, not http://. Does that make a difference?
Indeed, it does. If I load it via "file://", the Error message does not pop up.
Ah, I see what's going on here. The patch for bug 765993 did this: nsAutoCString sourceMapURL; httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), sourceMapURL); aRequest->mHasSourceMapURL = true; aRequest->mSourceMapURL = NS_ConvertUTF8toUTF16(sourceMapURL); which means it will then always pass an empty string for the source map URL via compile options. Eddy, is there a reason we're not setting mHasSourceMapURL to whether GetResponseHeader() succeeded or something?
Blocks: 765993
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
Flags: needinfo?(ejpbruel)
FWIW, this error also happens while running Mochitest chrome on content/base/test/chrome/test_bug765993.html. I don't know if that is expected or not.
Oh and I think we leak when we hit that condition. See bug 1022954.
(In reply to Boris Zbarsky [:bz] from comment #6) > Ah, I see what's going on here. The patch for bug 765993 did this: > > nsAutoCString sourceMapURL; > httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), > sourceMapURL); > aRequest->mHasSourceMapURL = true; > aRequest->mSourceMapURL = NS_ConvertUTF8toUTF16(sourceMapURL); > > which means it will then always pass an empty string for the source map URL > via compile options. > > Eddy, is there a reason we're not setting mHasSourceMapURL to whether > GetResponseHeader() succeeded or something? My memory is vague on this, but I seem to recall that (In reply to Boris Zbarsky [:bz] from comment #6) > Ah, I see what's going on here. The patch for bug 765993 did this: > > nsAutoCString sourceMapURL; > httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), > sourceMapURL); > aRequest->mHasSourceMapURL = true; > aRequest->mSourceMapURL = NS_ConvertUTF8toUTF16(sourceMapURL); > > which means it will then always pass an empty string for the source map URL > via compile options. > > Eddy, is there a reason we're not setting mHasSourceMapURL to whether > GetResponseHeader() succeeded or something? Looks like a bug to me. I didn't consider the possibility that GetResponseHeader might fail.
Flags: needinfo?(ejpbruel)
I ran into this in Firefox 29 and now also Firefox 30. I have exactly one source mapping defined (I checked and double-checked my output) and firefox throws this as an error on every page hit. For what it is worth: I'm using brunch (http://brunch.io/) to compile, concatenate and minify my files, so this is all automated. Doesn't look like there's any way for devs to fix this on our ends, so I'm left with a decision between errors or no source maps. (Also: Shouldn't this kind of thing lead to a warning at most and not an error?)
For what it's worth this _is_ a warning. The text contains "Error:" because the JS engine is being dumb, but the message category is warning, and you will only see it in your console if you have filters set there to show warnings.
Assignee: nobody → ejpbruel
Without a fix for this, it looks like fixing the leaks causes various tests to time out, presumably because some exception gets thrown in a way that messes up the test. The tests that break are: browser/devtools/debugger/test/browser_dbg_blackboxing-01.js browser/devtools/debugger/test/browser_dbg_blackboxing-05.js browser/devtools/debugger/test/browser_dbg_pretty-print-09.js browser/devtools/debugger/test/browser_dbg_source-maps-01.js browser/devtools/debugger/test/browser_dbg_source-maps-02.js browser/devtools/debugger/test/browser_dbg_source-maps-03.js
Blocks: 1022954
This seemed to be what bz was suggesting, not that I entirely understand this code.
Pretty much (though we should also CopyUTF8toUTF16 while we're here and avoid the extra string object.
Eddy, is this on your radar? It's pretty annoying when working with TypeScript projects with lots of files, such as Shumway.
Flags: needinfo?(ejpbruel)
(In reply to Till Schneidereit [:till] from comment #15) > Eddy, is this on your radar? It's pretty annoying when working with > TypeScript projects with lots of files, such as Shumway. Hey Till. It's still on my radar, but wasn't very high priority until now. I'll put it on top of my todo list for next week, since you're the one that asked.
Flags: needinfo?(ejpbruel)
Very kind, good sir! Please don't let it get in the way of your process, though: I have lived with this for a while now, and will be able to do so for a little while longer.
FWIW, this won't be reported in the console as an "error" despit being a warning anymore: bug 1027157
Comment on attachment 8440009 [details] [diff] [review] Don't say we have a url if GetResponseHeaderFails. I'm trying to push this along because this bug appears to be causing Selenium tests to freeze Firefox at random.
Attachment #8440009 - Flags: review?(hsivonen)
When I try to run Selenium tests, Firefox will freeze at random (no particular test causes Firefox to freeze, but it always freezes _somewhere_). I attached GDB to the frozen process and obtained the following backtrace, which led me to this bug report.
Comment on attachment 8440009 [details] [diff] [review] Don't say we have a url if GetResponseHeaderFails. Review of attachment 8440009 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/base/src/nsScriptLoader.cpp @@ +1480,5 @@ > > nsAutoCString sourceMapURL; > + rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), sourceMapURL); > + if (NS_FAILED(rv)) { > + aRequest->mHasSourceMapURL = false; mHasSourceMapURL is always initialized to false, AFAICT. Unless there's a reason that I'm missing to assign false here, I suggest not having this |if| branch and make the whole |if| read: if (NS_SUCCEEDED(rv)) { aRequest->mHasSourceMapURL = true; aRequest->mSourceMapURL = NS_ConvertUTF8toUTF16(sourceMapURL); } r+ with that.
Attachment #8440009 - Flags: review?(hsivonen) → review+
(In reply to Alex Henrie from comment #19) > Comment on attachment 8440009 [details] [diff] [review] > Don't say we have a url if GetResponseHeaderFails. > > I'm trying to push this along because this bug appears to be causing > Selenium tests to freeze Firefox at random. Thank you for taking this off my plate. I had intended to write a patch last week in response to Till's comment but I got preoccupied by other stuff and it slipped of my radar again. Till, sorry for not living up to my promise on this one!
Assignee: ejpbruel → continuation
(In reply to Henri Sivonen (:hsivonen) from comment #21) > mHasSourceMapURL is always initialized to false, AFAICT. I think you're right. Good point.
Attachment #8440009 - Attachment is obsolete: true
Attachment #8453942 - Flags: review+
Requesting checkin of attachment 8453942 [details] [diff] [review] Henri Sivonen approved this patch in comment #21.
Keywords: checkin-needed
This still needs a try run, and I want to look it over again. I'll do that today.
Keywords: checkin-needed
try run: https://tbpl.mozilla.org/?tree=Try&rev=04bde7a2f313 (the M3 failure is unrelated) Thanks for moving this along, Alex. Once it lands, I'll try to get it on Aurora so the fix will be released a little sooner. (We're too late for Beta at this point, as it is going to be released very soon.)
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Comment on attachment 8453942 [details] [diff] [review] Don't say we have a url if GetResponseHeaderFails. Approval Request Comment [Feature/regressing bug #]: bug 765993 [User impact if declined]: annoying errors for webdevs, some kind of freezing in Selenium testing (see comment 20) [Describe test coverage new/current, TBPL]: there's existing code that runs this on TBPL [Risks and why]: low risk, just does a minor change to one odd case [String/UUID change made/needed]: none
Attachment #8453942 - Flags: approval-mozilla-aurora?
Comment on attachment 8453942 [details] [diff] [review] Don't say we have a url if GetResponseHeaderFails. Let's take this small fix to improve the lives of web devs. Aurora+
Attachment #8453942 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: