Open
Bug 750317
Opened 13 years ago
Updated 2 years ago
Debugger.Script.url isn't a simple path
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
NEW
People
(Reporter: gps, Unassigned)
References
(Blocks 1 open bug)
Details
When accessing Debugger.Script.url, I'm getting strings that look like mappings. e.g.
"/Users/gps/src/services-central/testing/xpcshell/main.js -> file:///Users/gps/src/services-central/testing/xpcshell/head.js"
I'm not sure if this is intentional or what. I would prefer that if there are multiple representations of the script path/url, that they would be exposed as different properties. i.e. I shouldn't need to parse strings.
My STR are essentially:
1) Create sandbox, s1, to execute code in.
2) Load a file via mozIJSSubScriptLoader.loadSubScript inside the sandbox
3) Create sandbox, s2, for the debugger
4) Load debugger in sandbox s2. Hook up debugger to execution sandbox, s1.
5) Register onEnterFrame, onStep which capture this.script.url inside onStep
6) Call eval on loaded code in execution sandbox, s1
In the example above, main.js is the file containing the code to instantiate and run the two sandboxes. head.js was a file loaded via loadSubScript() inside the execution sandbox, s1.
![]() |
||
Comment 1•13 years ago
|
||
From the JS engine's point of view, the .url is just an opaque string.
In this case, the consumer (some XPConnect code) is creating a script with the "url" set to the above string, because it needs certain behavior out of yet other code that does security checks via prefix match on the script url.
Reporter | ||
Comment 2•13 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #1)
> From the JS engine's point of view, the .url is just an opaque string.
>
> In this case, the consumer (some XPConnect code) is creating a script with
> the "url" set to the above string, because it needs certain behavior out of
> yet other code that does security checks via prefix match on the script url.
Interesting. But, I think this is unacceptable from an API consumer perspective. If I want to cross-reference the original source file, I shouldn't have to work through some XPConnect implementation detail.
![]() |
||
Comment 3•13 years ago
|
||
You have to anyway to some extent, if by "API consumer" you mean a consumer of the debugging API: XPConnect (or any JSAPI consumer) can always lie about the actual source location when it calls JS_CompileScript. Which is what it's doing right now anyway. So for example, it could have just passed the "/Users/gps/src/services-central/testing/xpcshell/main.js" part, since that's the part it really cares about itself.
That said, having some sort of API support for whatever XPConnect is doing here so the hack in XPConnect could be removed would be nice... jst, Blake, do you recall why we needed that?
Assignee | ||
Updated•11 years ago
|
Assignee: general → nobody
Updated•5 years ago
|
Blocks: js-debugger
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•