Change sourceMappingURL comment syntax to avoid IE JS conditional compilation issues

4601 views
Skip to first unread message

Michał Gołębiowski

unread,
Apr 14, 2013, 7:13:27 PM4/14/13
to
This is sth that came up a couple of times in jQuery, see:
http://bugs.jquery.com/ticket/13274
http://bugs.jquery.com/ticket/13776

Using syntax like:

/*
//@ sourceMappingURL=...
*/

is cumbersome. How about allowing:

/*@ sourceMappingURL=...*/

or choosing a different symbol than `@`, one that doesn't cause JS conditional compilation issues in IE?

dave.m...@gmail.com

unread,
Apr 14, 2013, 7:24:43 PM4/14/13
to
Agreed with Michal here, although the alternative /* */ syntax runs afoul of IE conditional JS as well. Really it needs to use a different character (sequence?) that doesn't have an existing meaning to IE or other established tools.

John Lenz

unread,
Apr 15, 2013, 11:02:19 AM4/15/13
to dave.m...@gmail.com, dev-js-s...@lists.mozilla.org
As the last line of a file it, do it really cause any problems with IE's
conditional code? Can you give an example where it does?

The format was chosen to match Firebug's "SourceURL" annotation for naming
eval'd code (which Chrome also supports).

What is the proposed alternative?
> _______________________________________________
> dev-js-sourcemap mailing list
> dev-js-s...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-js-sourcemap
>

Fitzgerald, Nick

unread,
Apr 15, 2013, 2:09:09 PM4/15/13
to dev-js-s...@lists.mozilla.org
On 4/14/13 4:13 PM, Michał Gołębiowski wrote:
> This is sth that came up a couple of times in jQuery, see:
> http://bugs.jquery.com/ticket/13274
> http://bugs.jquery.com/ticket/13776
>
> Using syntax like:
>
> /*
> //@ sourceMappingURL=...
> */
>
> is cumbersome.

Is this really that cumbersome? Doesn't seem like a huge deal to me.

Michał Gołębiowski

unread,
Apr 16, 2013, 9:12:16 AM4/16/13
to dev-js-s...@lists.mozilla.org, fit...@mozilla.com
On Monday, April 15, 2013 8:09:09 PM UTC+2, Fitzgerald, Nick wrote:
> Is this really that cumbersome? Doesn't seem like a huge deal to me.

The problem is this is not the first thing you think about, especially that the spec doesn't mention /* */ wrapping. Since most people don't test IE with code using conditional compilation, this approach leads to hard to discover bugs appearing in edge cases. jQuery is popular enough to catch it but it's not the same for most other libraries & code.

I think this approach is error-prone.
Message has been deleted

Michał Gołębiowski

unread,
Apr 19, 2013, 3:46:49 PM4/19/13
to
> As the last line of a file it, do it really cause any problems with IE's
>
> conditional code? Can you give an example where it does?

See this jQuery ticket: http://bugs.jquery.com/ticket/13274

It doesn't matter if conditional compilation was activated in the script we're talking about, it's enough it has been turned on before and it hasn't been turned off.

Michał Gołębiowski

unread,
May 9, 2013, 10:00:34 AM5/9/13
to
It seems Nick Fitzgerald is OK with the change of the `@` symbol to sth different, e.g. `#`. I'd like to ask to introduce such a change to the spec as soon as possible. The reason is the source maps topic is really gaining traction, more & more projects start supporting it and the later we change it the more compatibility baggage we'll have to deal with. Currently the spec is fresh enough it's easy to convince most tools authors to introduce changes to adhere to changes in the spec but it won't be the same further in the future (and I'm afraid at one point it may be so difficult that the no-change option wins here).

So, to reiterate - I'd like for the pragma to change really soon, timing is really important here.

dave.m...@gmail.com

unread,
May 9, 2013, 10:11:38 AM5/9/13
to
The sooner the better. The current sourcemap format cannot be adopted for the open web since `//@` conflicts with IE's @cc_on directives. If the goal is for this to be a cross-browser feature it needs to change, and soon.

Eddy Bruel

unread,
May 9, 2013, 10:24:15 AM5/9/13
to dev-js-s...@lists.mozilla.org
On 5/9/13 4:00 PM, Micha? Go?e;biowski wrote:
> It seems Nick Fitzgerald is OK with the change of the `@` symbol to sth different, e.g. `#`. I'd like to ask to introduce such a change to the spec as soon as possible. The reason is the source maps topic is really gaining traction, more & more projects start supporting it and the later we change it the more compatibility baggage we'll have to deal with. Currently the spec is fresh enough it's easy to convince most tools authors to introduce changes to adhere to changes in the spec but it won't be the same further in the future (and I'm afraid at one point it may be so difficult that the no-change option wins here).
>
> So, to reiterate - I'd like for the pragma to change really soon, timing is really important here.
> _______________________________________________
> dev-js-sourcemap mailing list
> dev-js-s...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-js-sourcemap
I just filed bug 870361
<https://bugzilla.mozilla.org/show_bug.cgi?id=870361> with a working
patch. All it needs is a review.

Peter van der Zee

unread,
May 9, 2013, 11:07:49 AM5/9/13
to Eddy Bruel, dev-js-s...@lists.mozilla.org
Eddy, can't the browser support both but issue an extra deprecation warning
for using the @ version? As mentioned before there are already many tools
and sources that rely on the @ version. No sense breaking them just like
that. The console warning should help devs migrate to the new spec.

Also, pushing that patch right now, without a new version of the spec at
all, effectively means killing any source maps for firefox :p

- peter


On Thu, May 9, 2013 at 4:24 PM, Eddy Bruel <ejpb...@mozilla.com> wrote:

> On 5/9/13 4:00 PM, Micha? Go?e;biowski wrote:
>
>> ______________________________**_________________
>> dev-js-sourcemap mailing list
>> dev-js-sourcemap@lists.**mozilla.org <dev-js-s...@lists.mozilla.org>
>> https://lists.mozilla.org/**listinfo/dev-js-sourcemap<https://lists.mozilla.org/listinfo/dev-js-sourcemap>
>>
> I just filed bug 870361 <https://bugzilla.mozilla.org/**
> show_bug.cgi?id=870361<https://bugzilla.mozilla.org/show_bug.cgi?id=870361>>
> with a working patch. All it needs is a review.
>
> ______________________________**_________________
> dev-js-sourcemap mailing list
> dev-js-sourcemap@lists.**mozilla.org <dev-js-s...@lists.mozilla.org>
> https://lists.mozilla.org/**listinfo/dev-js-sourcemap<https://lists.mozilla.org/listinfo/dev-js-sourcemap>
>

dave.m...@gmail.com

unread,
May 9, 2013, 11:26:21 AM5/9/13
to
On Thursday, May 9, 2013 11:07:49 AM UTC-4, Peter van der Zee wrote:
> Eddy, can't the browser support both but issue an extra deprecation warning
> for using the @ version? As mentioned before there are already many tools
> and sources that rely on the @ version. No sense breaking them just like
> that. The console warning should help devs migrate to the new spec.

Agreed on that. There are too many existing tools/users to make a breaking change immediately, but it would be good to have a warning so that the old syntax wouldn't be supported forever.

Eddy Bruel

unread,
May 9, 2013, 11:55:30 AM5/9/13
to dev-js-s...@lists.mozilla.org
> _______________________________________________
> dev-js-sourcemap mailing list
> dev-js-s...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-js-sourcemap
I've updated the patch accordingly. Thank you for the quick feedback.

Joseph Pecoraro

unread,
May 9, 2013, 1:54:15 PM5/9/13
to Eddy Bruel, dev-js-s...@lists.mozilla.org
As soon as the spec is updated, WebKit can make this change as well. The Safari Web Inspector in WebKit Nightlies supports SourceMaps.

- Joe

On May 9, 2013, at 8:55 AM, Eddy Bruel <ejpb...@mozilla.com> wrote:

> On 5/9/13 5:26 PM, dave.m...@gmail.com wrote:

Fitzgerald, Nick

unread,
May 9, 2013, 5:24:12 PM5/9/13
to dev-js-s...@lists.mozilla.org
On 5/9/13 10:54 AM, Joseph Pecoraro wrote:
> As soon as the spec is updated, WebKit can make this change as well. The Safari Web Inspector in WebKit Nightlies supports SourceMaps.
>

So we have agreement on the spec change from Safari and Firefox, so we
are just waiting on Chrome before the spec change can happen? John, want
to chime in?

Nick

paul....@gmail.com

unread,
May 11, 2013, 12:53:38 PM5/11/13
to
+1 from Chrome. Let's do it!

paul....@gmail.com

unread,
May 11, 2013, 1:02:56 PM5/11/13
to
I should point out the +1 was from Chtome DevTools.
I'd still like John Lenz to chime in, in case he disagrees.

paul...@google.com

unread,
May 13, 2013, 1:43:18 PM5/13/13
to
I expect we'll also make this syntax change for //@ sourceURL as well?

Michał, can you verify //# won't introduce any unexpected problems?

Michał Gołębiowski

unread,
May 13, 2013, 6:08:44 PM5/13/13
to
> Michał, can you verify //# won't introduce any unexpected problems?

Paul, the only problem in JavaScript I see are IE conditional comments so //# should be fine. I'm not sure how to verify it with certainty, though. :)

One thing I could think about is if sb knows any MS/IE insider that could confirm that @cc_on is the only issue; anything that would show up here would probably be an edge case, though.

Peter van der Zee

unread,
May 14, 2013, 3:33:24 AM5/14/13
to Michał Gołębiowski, dev-js-s...@lists.mozilla.org
Can't anyone persuade somebody from the IE team to join this list? Oh
actually, I will ping John-David to check on this.

- peter

John Lenz

unread,
May 16, 2013, 12:29:27 AM5/16/13
to Peter van der Zee, Michał Gołębiowski, dev-js-s...@lists.mozilla.org
Are we also changing the "sourceUrl" as well as the "sourceMapUrl". I
have no objection otherwise.


On Tue, May 14, 2013 at 12:33 AM, Peter van der Zee
<devjsso...@qfox.nl>wrote:

> Can't anyone persuade somebody from the IE team to join this list? Oh
> actually, I will ping John-David to check on this.
>
> - peter
>
>
> On Tue, May 14, 2013 at 12:08 AM, Michał Gołębiowski <m.g...@gmail.com
> >wrote:
>

John Lenz

unread,
May 16, 2013, 11:32:54 AM5/16/13
to Peter van der Zee, Michał Gołębiowski, dev-js-s...@lists.mozilla.org, John Barton
I've updated the spec for "//# sourceMapUrl", I'd like a confirmation that
"sourceUrl" will also be updated.


On Wed, May 15, 2013 at 9:29 PM, John Lenz <conca...@gmail.com> wrote:

> Are we also changing the "sourceUrl" as well as the "sourceMapUrl". I
> have no objection otherwise.
>
>
> On Tue, May 14, 2013 at 12:33 AM, Peter van der Zee <
> devjsso...@qfox.nl> wrote:
>
>> Can't anyone persuade somebody from the IE team to join this list? Oh
>> actually, I will ping John-David to check on this.
>>
>> - peter
>>
>>
>> On Tue, May 14, 2013 at 12:08 AM, Michał Gołębiowski <m.g...@gmail.com
>> >wrote:
>>

Michał Gołębiowski

unread,
May 16, 2013, 11:52:00 AM5/16/13
to John Lenz, Peter van der Zee, dev-js-s...@lists.mozilla.org, John Barton
It seems consistent, IMHO that's the only logical thing to do in this case.

Thanks for a spec change!


On Thu, May 16, 2013 at 5:32 PM, John Lenz <conca...@gmail.com> wrote:

> I've updated the spec for "//# sourceMapUrl", I'd like a confirmation that
> "sourceUrl" will also be updated.
>
>
> On Wed, May 15, 2013 at 9:29 PM, John Lenz <conca...@gmail.com> wrote:
>
>> Are we also changing the "sourceUrl" as well as the "sourceMapUrl". I
>> have no objection otherwise.
>>
>>
>> On Tue, May 14, 2013 at 12:33 AM, Peter van der Zee <
>> devjsso...@qfox.nl> wrote:
>>
>>> Can't anyone persuade somebody from the IE team to join this list? Oh
>>> actually, I will ping John-David to check on this.
>>>
>>> - peter
>>>
>>>
>>> On Tue, May 14, 2013 at 12:08 AM, Michał Gołębiowski <m.g...@gmail.com
>>> >wrote:
>>>
>>> > _______________________________________________
>>> > dev-js-sourcemap mailing list
>>> > dev-js-s...@lists.mozilla.org
>>> > https://lists.mozilla.org/listinfo/dev-js-sourcemap
>>> >
>>> _______________________________________________
>>> dev-js-sourcemap mailing list
>>> dev-js-s...@lists.mozilla.org
>>> https://lists.mozilla.org/listinfo/dev-js-sourcemap
>>>
>>
>>
>


--
Michał Z. Gołębiowski

Michał Gołębiowski

unread,
May 21, 2013, 11:08:12 AM5/21/13
to
Does anyone object to changing the //@ sourceUrl pragma, too? Current situation is inconsistent.

Joseph Pecoraro

unread,
May 21, 2013, 3:40:25 PM5/21/13
to John Lenz, Peter van der Zee, Michał Gołębiowski, dev-js-s...@lists.mozilla.org, John Barton
WebKit updated to allow //# (for both sourceMappingURL and sourceURL):
<http://webkit.org/b/116290> Web Inspector: Allow "//# sourceMappingURL" syntax alongside "//@"
<http://trac.webkit.org/changeset/150251>

- Joe

On May 16, 2013, at 8:32 AM, John Lenz <conca...@gmail.com> wrote:

> I've updated the spec for "//# sourceMapUrl", I'd like a confirmation that
> "sourceUrl" will also be updated.
>
>
> On Wed, May 15, 2013 at 9:29 PM, John Lenz <conca...@gmail.com> wrote:
>
>> Are we also changing the "sourceUrl" as well as the "sourceMapUrl". I
>> have no objection otherwise.
>>
>>
>> On Tue, May 14, 2013 at 12:33 AM, Peter van der Zee <
>> devjsso...@qfox.nl> wrote:
>>
>>> Can't anyone persuade somebody from the IE team to join this list? Oh
>>> actually, I will ping John-David to check on this.
>>>
>>> - peter
>>>
>>>
>>> On Tue, May 14, 2013 at 12:08 AM, Michał Gołębiowski <m.g...@gmail.com
>>>> wrote:
>>>

paul....@gmail.com

unread,
May 21, 2013, 6:44:11 PM5/21/13
to
Excellent. Chrome would like to see sourceURL to be updated in the spec as well. Thanks all.

John Lenz

unread,
May 22, 2013, 3:40:40 PM5/22/13
to paul....@gmail.com, dev-js-s...@lists.mozilla.org
Is there any spec for sourceUrl outside the source map spec.
On May 22, 2013 9:52 AM, <paul....@gmail.com> wrote:

> Excellent. Chrome would like to see sourceURL to be updated in the spec as
> well. Thanks all.

Rob Campbell

unread,
May 22, 2013, 4:50:04 PM5/22/13
to John Lenz, paul....@gmail.com, Jan Odvarko, dev-js-s...@lists.mozilla.org
I'm pretty sure (open to correction) that //@ sourceURL is a Firebuggism introduced to allow annotation of evals. The notation propagated because it's useful.

cc'ing Honza (aka Jan Odvarko) for confirmation.

Not sure how prevalent //@ is in the wild. Probably not very if IE chokes on it.

~ rob

On 2013-05-22, at 15:40 , John Lenz <conca...@gmail.com> wrote:

> Is there any spec for sourceUrl outside the source map spec.
> On May 22, 2013 9:52 AM, <paul....@gmail.com> wrote:
>
>> Excellent. Chrome would like to see sourceURL to be updated in the spec as
>> well. Thanks all.

Paul Irish

unread,
May 22, 2013, 4:32:34 PM5/22/13
to John Lenz, dev-js-s...@lists.mozilla.org
Nope. it's only defined in the souce map spec.


On Wed, May 22, 2013 at 12:40 PM, John Lenz <conca...@gmail.com> wrote:

> Is there any spec for sourceUrl outside the source map spec.
> On May 22, 2013 9:52 AM, <paul....@gmail.com> wrote:
>
>> Excellent. Chrome would like to see sourceURL to be updated in the spec
>> as well. Thanks all.

Joseph Pecoraro

unread,
May 22, 2013, 5:33:49 PM5/22/13
to Paul Irish, dev-js-s...@lists.mozilla.org, John Lenz
The top result for most search engines on "sourceURL" is this article from 2009:
http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/

I don't believe there is an official specification. I think it would be reasonable for the SourceMap specification to take ownership, especially given the similarities with soruceMappingURL. It would probably be just a paragraph of text instead of a note.

- Joe

On May 22, 2013, at 1:32 PM, Paul Irish <paul....@gmail.com> wrote:

> Nope. it's only defined in the souce map spec.
>
>
> On Wed, May 22, 2013 at 12:40 PM, John Lenz <conca...@gmail.com> wrote:
>
>> Is there any spec for sourceUrl outside the source map spec.
>> On May 22, 2013 9:52 AM, <paul....@gmail.com> wrote:
>>
>>> Excellent. Chrome would like to see sourceURL to be updated in the spec
>>> as well. Thanks all.

John Lenz

unread,
May 23, 2013, 6:47:42 PM5/23/13
to Joseph Pecoraro, Paul Irish, dev-js-s...@lists.mozilla.org
Ok, I've updated the source map spec to also prefer "//# sourceURL". Is
someone on the firebug team listening to be sure everyone aligns?


On Wed, May 22, 2013 at 2:33 PM, Joseph Pecoraro <peco...@apple.com> wrote:

> The top result for most search engines on "sourceURL" is this article from
> 2009:
> http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
>
> I don't believe there is an official specification. I think it would be
> reasonable for the SourceMap specification to take ownership, especially
> given the similarities with soruceMappingURL. It would probably be just a
> paragraph of text instead of a note.
>
> - Joe
>
> On May 22, 2013, at 1:32 PM, Paul Irish <paul....@gmail.com> wrote:
>
> Nope. it's only defined in the souce map spec.
>
>
> On Wed, May 22, 2013 at 12:40 PM, John Lenz <conca...@gmail.com> wrote:
>
> Is there any spec for sourceUrl outside the source map spec.
> On May 22, 2013 9:52 AM, <paul....@gmail.com> wrote:
>
> Excellent. Chrome would like to see sourceURL to be updated in the spec
> as well. Thanks all.

srou...@gmail.com

unread,
May 24, 2013, 4:02:52 PM5/24/13
to
Yeah, Paul pinged me. I'll get back with version numbers when changed. -steve

srou...@gmail.com

unread,
Jun 3, 2013, 3:09:18 PM6/3/13
to
I made the change last week, and Honza has posted a new blog entry:

http://www.softwareishard.com/blog/firebug/firebug-tip-label-dynamic-scripts-with-sourceurl-directive/

paul....@gmail.com

unread,
Jun 4, 2013, 2:00:31 PM6/4/13
to
Support has landed in Chrome DevTools for //#
https://codereview.chromium.org/15832007

We also added deprecation warnings, for example:
> /*@ sourceURL=" source URL declaration is deprecated, "/*# sourceURL=\ declaration should be used instead.

Paul Irish

unread,
Jun 7, 2013, 3:35:28 PM6/7/13
to dev-js-s...@lists.mozilla.org
To conclude this successful thread....

*Impetus*
//@ sourceMappingURL was found to have a conflict with IE whenever it was
found in the page after //@cc_on was interpreted to turn on conditional
compilation in the IE JScript engine. A legacy version of the HTML5 Shiv is
one particular offender here.

*Spec Change*
The //@ sourceMappingURL syntax is defined in the Sourcemap V3 spec:
https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.lmz475t4mvbx
It was changed there to use //# syntax instead.

*sourceURL*
//@ sourceURL is also defined in the spec and was made to match the //#
syntax for consistency. For details on what it does, see:
http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl

It's used by Ember's minispade, google's concatenate.js, and others.

*Implementation in Browser DevTools = done!*

- *Safari Inspector* now supports //# for sourceMappingURL and sourceURL
- *Firebug's* change has
landed<https://github.com/firebug/firebug/commit/f14828954c4f9e07e8b86f9317713e774c9ad5d5>for
sourceURL.
- *Firefox* is about to
land<https://bugzilla.mozilla.org/show_bug.cgi?id=870361>the change
for sourceMappingURL. sourceURL ticket
here <https://bugzilla.mozilla.org/show_bug.cgi?id=833744>.
- *Chrome* *DevTools* landed the
change<https://codereview.chromium.org/15832007>for sourceMappingURL
and sourceURL. It will also warn about use of the
deprecated //@ syntax.


\o/

John Lenz

unread,
Jun 7, 2013, 10:05:17 PM6/7/13
to Paul Irish, dev-js-s...@lists.mozilla.org
Thanks for the summary Paul!

Michał Gołębiowski

unread,
Jul 9, 2013, 12:28:39 PM7/9/13
to
On Monday, June 3, 2013 9:09:18 PM UTC+2, srou...@gmail.com wrote:
> I made the change last week, and Honza has posted a new blog entry:
> http://www.softwareishard.com/blog/firebug/firebug-tip-label-dynamic-scripts-with-sourceurl-directive/

Could you change `//@` to `//#` in examples in this blog post as well?
Reply all
Reply to author
Forward
0 new messages