Closed Bug 1011760 Opened 10 years ago Closed 7 years ago

Debugging evalled content scripts

Categories

(DevTools :: Debugger, defect)

31 Branch
x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jmjacobs, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36

Steps to reproduce:

Use a PageMod in an addon. Use window.eval to add more scripts (containing //# sourceURL annotations) to the PageMod. Open the Addon Debugger.


Actual results:

Only the scripts that were initially included in the PageMod appear in the Addon Debugger.


Expected results:

The scripts dynamically added to the PageMod using window.eval should also appear in the Addon Debugger.

Note: I will gladly switch away from using window.eval if there is some other recommended method of dynamically adding scripts packaged with the addon to a PageMod.

Note: Issue 833744 is related, but I’m filing this issue separately because it’s specifically for addon content scripts injected on demand, a use case for which there are no known alternatives to window.eval. (My extension has a PageMod that begins as one small script file but, based on user behavior, can grow to include upwards of 50 script files.)
Component: Untriaged → Developer Tools: Debugger
jmjacobs: can you attach a reduced test case? Thanks!
See Also: → 833744
Attached file content_script_eval.zip (obsolete) —
Sure. Here’s a small toy extension that demonstrates the issue.
Comment on attachment 8437058 [details]
content_script_eval.zip

Whoops, I forgot to include the //# sourceURL annotations.
Attachment #8437058 - Attachment is obsolete: true
This version has the //# sourceURL annotations.

Note that button.js can be opened in the debugger, since it’s part of the initial PageMod declaration, but jquery.js and ui.js cannot because they are injected later using window.eval (after you click the button).
It seems to me as if this should be fixed automatically once bug 865313 lands.
Blocks: dbg-addon
Summary: Content scripts injected using eval should appear in the add-on debugger → Debugging evalled content scripts
Closing.  PageMod is no longer supported and bug 865313 has landed so this should be done.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: