Discussion:
Issue 140923 in chromium: Can't Debug Dynamically Loaded <script>
c***@googlecode.com
2012-08-07 02:33:51 UTC
Permalink
Updates:
Status: Assigned
Owner: ***@chromium.org
Labels: checkedk

Comment #1 on issue 140923 by ***@google.com: Can't Debug Dynamically
Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

(No comment was entered for this change.)
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
c***@googlecode.com
2012-08-07 05:42:34 UTC
Permalink
Updates:
Owner: ***@chromium.org
Cc: ***@chromium.org
Labels: -Area-Undefined Area-WebKit Feature-DevTools

Comment #2 on issue 140923 by ***@chromium.org: Can't Debug
Dynamically Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

(No comment was entered for this change.)
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
c***@googlecode.com
2012-08-07 12:24:04 UTC
Permalink
Comment #3 on issue 140923 by ***@google.com: Can't Debug Dynamically
Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

This may be because the scripts get collected by V8 VM if nothing holds
them.
What theoretically can be done about this (it this is a root problem), the
script DOM element can hold a hard reference to its script (inlined or
linked). This way the script will remain visible as long as the
corresponding script element is still in DOM tree. (We cannot hold scripts
forever, because there application may load them in cycle, for example by
updating innerHTML of a div).
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
c***@googlecode.com
2012-08-07 20:28:04 UTC
Permalink
Comment #4 on issue 140923 by ***@gmail.com: Can't Debug Dynamically
Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

"We cannot hold scripts forever, because there application may load them in
cycle, for example by updating innerHTML of a div."

This is exactly what I've been doing to test - loading HTML from an AJAX
request in a div's innerHTML. It does make sense to do clean up, otherwise
if the user were to reload a given "pane" too often, a bunch of unused
copies of the same script would begin to pile up.

The thing is - the javascript isn't IN the <script> tag. It's actually in
a JS file referenced by the tag. <script src="02.js"></script>. I noticed
that <link>'d CSS files properly appear in the Sources tab when dynamically
loaded. Is it feasible to try and get the same sort of behavior from
scripts?
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
c***@googlecode.com
2012-08-07 20:26:04 UTC
Permalink
Comment #5 on issue 140923 by ***@gmail.com: Can't Debug Dynamically
Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

"We cannot hold scripts forever, because there application may load them in
cycle, for example by updating innerHTML of a div."

This is exactly what I've been doing to test - loading HTML from an AJAX
request in a div's innerHTML. It does make sense to do clean up, otherwise
if the user were to reload a given "pane" too often, a bunch of unused
copies of the same script would begin to pile up.

The thing is - the javascript isn't IN the <script> tag. It's actually in
a JS file referenced by the tag. <script src="02.js"></script>. I noticed
that <link>'d CSS files properly appear in the Sources tab when dynamically
loaded. Is it feasible to try and get the same sort of behavior from
scripts?
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
c***@googlecode.com
2012-10-12 20:16:25 UTC
Permalink
Comment #7 on issue 140923 by ***@gmail.com: Can't Debug Dynamically
Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

I tested in the environment I first noticed the issue in, and it does not
appear to be fixed. I see the scripts being loaded in the Network
Resources panel, and I can click to view them. However, the Sources panel
does not display them. Putting together a simple test package to
demonstrate.
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
c***@googlecode.com
2012-10-12 21:51:27 UTC
Permalink
Comment #8 on issue 140923 by ***@gmail.com: Can't Debug Dynamically
Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

Attached example. The dynamically loaded script "Content.js" does not
appear in the Sources panel. It does appear in the Network Resources
panel, and the response contents can be viewed.

Placing a "debugger;" statement in the dynamically loaded file will cause a
breakpoint to trigger in Sources panel, but, it's a mystery script! You
can step through the file, but you can't place additional breakpoints and
if you close the "(program)" Source tab that it opens, it's gone until it
hits another debugger statement.

Attachments:
Example.zip 1.4 KB
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
c***@googlecode.com
2012-10-25 10:48:48 UTC
Permalink
Comment #9 on issue 140923 by ***@chromium.org: Can't Debug Dynamically
Loaded <script>
http://code.google.com/p/chromium/issues/detail?id=140923

In this case the script content is loaded with XMLHttpRequest and then
eval'ed by jquery. You will need to add a "//@ sourceURL=" comment to your
file to make it appear in sources panel. See
http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
--
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/a/chromium.org/group/chromium-bugs
Continue reading on narkive:
Loading...