Export to GitHub

fbug - issue #7097

Support for dynamically evaluated scripts


Posted on Jan 6, 2014 by Massive Wombat

One of the last (completely) missing features in JSD2 enabled Firebug is support for dynamically evaluated scripts

  • evals()
  • events (DOM handlers)

This is also the reason why the UI is broken. See the attached screenshot.

Effort on this feature is blocked by: Bug 911721 - Get type & originator for Debugger.Script object

... but I'd like to already start on this to at least identify potential other blockers.

Simple STR: 1) Load https://getfirebug.com/tests/head/script/debuggerKeyword/testPage.html 2) Click "debugger in XHR" 3) Debugger breaks, but the source is wrong

Of course, there are many other various test cases.

Honza

Attachments

Comment #1

Posted on Jan 6, 2014 by Massive Wombat

(No comment was entered for this change.)

Comment #2

Posted on Jan 6, 2014 by Massive Wombat

The full list of script types could be (in the end):

  • "eval"
  • "Function"
  • "Worker"
  • "importScripts"
  • "handler" (DOM)

Honza

Comment #3

Posted on Jan 8, 2014 by Massive Wombat

Initial commit: https://github.com/firebug/firebug/commit/42f7ea3dbd05d8afc60da7a742a4cade7dac8117

  • the test case from comment #0 works
  • breakpoints don't work

Honza

Comment #4

Posted on Jan 8, 2014 by Happy Dog

Could you provide your test case for this? :

  • breakpoints don't work

Florent

Comment #5

Posted on Jan 9, 2014 by Massive Wombat

Test case for a breakpoint in dynamically evaluated script:

1) Load test: script/debuggerKeyword/testPage.html (the one from jsd2 branch) 2) Click "debugger in XHR" button 3) New script is created and the debugger halts at a debugger; keyword in it (line 14) 4) Resume the debugger and create a breakpoint at line 7 (within foo() function) 5) Click the "foo()" button (to execute the foo() function) 6) The breakpoint doesn't hit -> BUG

Honza

Comment #6

Posted on Jan 14, 2014 by Massive Wombat

(No comment was entered for this change.)

Comment #7

Posted on Jan 15, 2014 by Massive Wombat

Here is a test case that shows how evaluated scripts overlaps existing lines of the parent (introduction) script that executed the eval(). The first line of the evaluated script corresponds to the line where eval() is located.

Test case online at: https://getfirebug.com/tests/manual/issues/7097/issue7097-1.html (updated description will be online shortly)

The test shows accidental hit of a breakpoint in dynamically evaluated script

Related platform bug: https://bugzilla.mozilla.org/show_bug.cgi?id=957798#c1

Honza

Comment #8

Posted on Jan 15, 2014 by Massive Wombat

Another commit related to breakpoints in dynamically created scripts (WIP) https://github.com/firebug/firebug/commit/8332c3d7f5f3383624b258763fac85fe896e962a

  • It's possible to create a breakpoint in dynamic script
  • It's possible to break on the breakpoint (and step as usual)
  • The breakpoint can't be deleted (you need to reset all options)

Test case: https://getfirebug.com/tests/manual/issues/7097/issue7097-2.html

Honza

Comment #9

Posted on Feb 7, 2014 by Helpful Wombat
  • The breakpoint can't be deleted (you need to reset all options) You can delete it within the Breakpoints side panel. It's just not working when clicking on the Breakpoint Column. Do they have different logic?

Sebastian

Comment #10

Posted on Feb 21, 2014 by Helpful Wombat

Will this issue also cover naming dynamically evaluated scripts via //@ sourceURL or should I create a new one for that?

Sebastian

Comment #11

Posted on Feb 21, 2014 by Massive Wombat

Will this issue also cover naming dynamically evaluated scripts via //@ sourceURL or should I create a new one for that? New issue please, thanks Honza

Comment #12

Posted on Feb 23, 2014 by Helpful Wombat

(No comment was entered for this change.)

Comment #13

Posted on Feb 24, 2014 by Helpful Wombat

Dynamically evaluated scripts obviously require some special treating (especially in regard of issue 7201), so I believe we should put the related code into a separate module.

Sebastian

Comment #14

Posted on Feb 24, 2014 by Massive Wombat

The code related to this issue is already nicely wrapped inside "firebug/debugger/script/sourceTool" module (sourceTool == remotable object responsible for script source fetching). Further, it's wrapped in DynamicScriptCollector object (inside the module, not visible outside). DynamicScriptCollector object will be removed as soon as dynamic scripts are supported by RDP.

I see that you have done the same comment in the 7201 issue, so let's see what kind of new module could appear when implementing that one.

Or let me know if you have some specific suggestions. I like having independent features in independent modules!

Honza

Comment #15

Posted on Feb 24, 2014 by Massive Wombat

Related platform issue: Bug 935203 - [jsdbg2] Implement Debugger.Source.prototype.introductionType

Honza

Comment #16

Posted on Feb 26, 2014 by Helpful Wombat

Honza, you said that scripts created via tag would already be recognized, though in the 'issue7097' branch they are not yet listed in the location menu. Is that only missing on our side or do we need help from Jim on this?

Sebastian

Comment #17

Posted on Feb 26, 2014 by Helpful Wombat

Further investigation related to issue 7201 showed that there's no 'introductionType' property for them yet, so I posted a comment[1] at the Bugzilla bug.

And while event handlers also don't have an 'introductionType' yet, we could already recognize them via their 'elementAttributeName' property.

Sebastian

[1] https://bugzil.la/935203#c48

Comment #18

Posted on Feb 26, 2014 by Massive Wombat

so I posted a comment[1] at the Bugzilla bug. Perfect

And while event handlers also don't have an 'introductionType' yet They do already. You just need to build from (if you want to test): http://hg.mozilla.org/integration/mozilla-inbound (not in Nightly yet)

Honza

Comment #19

Posted on Mar 6, 2014 by Massive Wombat

Another related patch: https://github.com/firebug/firebug/commit/dc8760ae22f20b77cd04d4b8451ec42686f99216

  • initial support for dynamic URLs (tested with event handlers)
  • Breakpoints in eventHandler scripts should work (not conditional bps yet)

You can use this test page: - https://getfirebug.com/tests/manual/issues/7097/issue7097-4.html

1) Click the 'eval' button 2) Select: https://getfirebug.com/tests/manual/issues/7097/issue7097-4.html evalButton > eventHandler URL 3) and create a breakpoint in an eventHandler 'onclick'!

There is plenty of missing things yet, WIP

Honza

Comment #20

Posted on Mar 12, 2014 by Massive Wombat

Merged into jsd2 at

Honza

Comment #21

Posted on Mar 12, 2014 by Helpful Wombat

Merged into jsd2 at

At where? :-)

Sebastian

Comment #22

Posted on Mar 12, 2014 by Massive Wombat

https://github.com/firebug/firebug/commit/a48078210c76eff15e493322bf2339def2c47160

Honza

Comment #23

Posted on Mar 12, 2014 by Happy Dog

Eh, this merge is for jsd2 -> Issue7097, not for issue7097 -> jsd2.

Florent

Comment #24

Posted on Mar 26, 2014 by Massive Wombat

This issue has been fixed in Firebug 2.0 https://getfirebug.com/releases/firebug/2.0/firebug-2.0a1.xpi

Please let us know how it works for you

Thanks for the help!

Honza

Status: Fixed

Labels:
Type-Defect jsd2 script debugger blocks-2.0 fixed-2.0-a1