Give your eval a name with //@ sourceURL

689 views
Skip to first unread message

John J Barton

unread,
Aug 12, 2009, 1:46:47 AM8/12/09
to Firebug
Ok Steve here is a start...
http://blog.getfirebug.com/2009/08/11/give-your-eval…with-sourceurl/

jjb

johnjbarton

unread,
Aug 12, 2009, 1:49:09 AM8/12/09
to Firebug
http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
guess the URL got chopped.

On Aug 11, 10:46 pm, John J Barton <johnjbar...@johnjbarton.com>
wrote:

Steven Roussey

unread,
Aug 12, 2009, 10:47:44 PM8/12/09
to Firebug
Ah, that's awesome! I'll have to actually use it now that I know how
to...

On Aug 11, 10:49 pm, johnjbarton <johnjbar...@johnjbarton.com> wrote:
> http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sour...

ptw

unread,
Aug 13, 2009, 8:20:00 AM8/13/09
to Firebug
Would be really cool if this worked in straight .js files too, for
people who 'compile' to javascript, the way #file and #line directives
work for C as an assembly language.

Don Dwiggins

unread,
Aug 13, 2009, 12:25:13 PM8/13/09
to fir...@googlegroups.com
Steven Roussey wrote:
> Ah, that's awesome! I'll have to actually use it now that I know how
> to...

For what release does this work? I have several files that I "import"
dynamically via XHR and eval(). I put the comment at the end of one of
them, but the name didn't "take" in the Script tab "files" menu (using
FB 1.4.2 on FF 3.0.13). Or am I completely misunderstanding this feature?

>
> On Aug 11, 10:49 pm, johnjbarton <johnjbar...@johnjbarton.com> wrote:
>> http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sour...
>> guess the URL got chopped.
>>
>> On Aug 11, 10:46 pm, John J Barton <johnjbar...@johnjbarton.com>
>> wrote:
>>
>>> Ok Steve here is a start...http://blog.getfirebug.com/2009/08/11/give-your-eval…with-sourceurl/
>>> jjb

--
Don Dwiggins
Advanced Publishing Technology

johnjbarton

unread,
Aug 13, 2009, 12:43:30 PM8/13/09
to Firebug


On Aug 13, 9:25 am, Don Dwiggins <ddwigg...@advpubtech.com> wrote:
> Steven Roussey wrote:
> > Ah, that's awesome! I'll have to actually use it now that I know how
> > to...
>
> For what release does this work?  I have several files that I "import"

This has been in since maybe Firebug 1.2.

> dynamically via XHR and eval().  I put the comment at the end of one of
> them, but the name didn't "take" in the Script tab "files" menu (using
> FB 1.4.2 on FF 3.0.13).  Or am I completely misunderstanding this feature?

Do you see the scripts as evals instead?

Here is an online example of the feature:
http://getfirebug.com/tests/script/CallDynLoadedFunction.html


jjb

Don Dwiggins

unread,
Aug 14, 2009, 1:36:07 PM8/14/09
to fir...@googlegroups.com
johnjbarton wrote:
>> dynamically via XHR and eval(). I put the comment at the end of one of
>> them, but the name didn't "take" in the Script tab "files" menu (using
>> FB 1.4.2 on FF 3.0.13). Or am I completely misunderstanding this feature?
>
> Do you see the scripts as evals instead?

Yes.

>
> Here is an online example of the feature:
> http://getfirebug.com/tests/script/CallDynLoadedFunction.html

And it works for me. A few difference I note from what I tried:

- The URL in the example is
res:/FireclipseTests/WebContent/payloadCatsAndDucks.js; I just used a
filename (which seems to match the regexp in the blog entry.)

- In the example, the sourceURL line occurs both at the top (2nd line)
and bottom of the file. I have it only at the bottom.

- My file has the extension .tpl (a Zend Framework template file) rather
than .js.

- I don't know if it's related, but in loading my file, only the first
line shows in the Script tab, although all lines show in the Response
tab of the request in Console and Net. I'd seen that occasionally in FB
1.3, but not in the few days after I upgraded to 1.4.2 -- until now.

- My file is loaded after a sequence of page loads and interactions.

johnjbarton

unread,
Aug 14, 2009, 1:57:19 PM8/14/09
to Firebug
Seems to me your case ought to work. You can either post a test case
to the issues list:
http://code.google.com/p/fbug/issues/list

Or you can install the tracing version of 1.4X.2 by following the
instructions:
http://groups.google.com/group/firebug/web/faq-about-firebug

If you trace with option SOURCEFILES we can see what happens to the
URL.

jjb

Don Dwiggins

unread,
Aug 14, 2009, 6:46:01 PM8/14/09
to fir...@googlegroups.com
johnjbarton wrote:
> Seems to me your case ought to work. You can either post a test case
> to the issues list:
> http://code.google.com/p/fbug/issues/list

On further investigation, it does work as expected. An error of mine
was masking it. Nice to have, thanks!

jerone

unread,
Aug 15, 2009, 7:16:26 AM8/15/09
to Firebug
And now with support for tabs:

const reURIinComment = /\/\/@[\s\t]*sourceURL[\s\t]*=[\s\t]*(\S*?)[\s
\t]*$/m;

johnjbarton

unread,
Aug 15, 2009, 11:12:55 AM8/15/09
to Firebug
? Aren't tabs whitespace?
jjb
Reply all
Reply to author
Forward
0 new messages