Closed
Bug 707237
Opened 14 years ago
Closed 3 years ago
jsdebugger.jsm can't debug chrome
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jorendorff, Unassigned)
Details
ttaubert stumbled into this. It took a while to debug it.
The first time jsdebugger.jsm is loaded, it creates the Debugger constructor in whatever compartment it's in. From then on, all Debuggers created using that constructor are created in the same compartment.
So if you run jsdebugger.jsm in the chrome compartment, all your Debuggers will be in the chrome compartment.
But suppose you want to debug chrome. You might create a new sandbox and run
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
in the sandbox. Unfortunately that will not help, because it reuses the existing module, already loaded, and you get a transparent wrapper of the Debugger constructor rather than a fresh Debugger constructor. This means that even though it will look like you're creating a new Debugger in the sandbox, the Debugger will actually be in the main chrome compartment and therefore unable to debug chrome.
Is this solely an artifact of how JSMs work?
In other words, could one work around this by using IJSDebugger directly?
| Reporter | ||
Comment 2•14 years ago
|
||
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #1)
> Is this solely an artifact of how JSMs work?
Yes.
> In other words, could one work around this by using IJSDebugger directly?
Yes. The workaround is to take the code from jsdebugger.jsm (it's just 2 lines) and paste it right into your code that wants to use Debugger.
Comment 3•14 years ago
|
||
Since the remote debugging protocol server loads jsdebugger.jsm in a sandbox, would it be correct to assume that if the sole user of jsdebugger.jsm was the remote protocol server, debugging chrome would work? Also, in that light, is bug 703718 something that we should do or not?
Comment 4•14 years ago
|
||
(In reply to Panos Astithas [:past] from comment #3)
> Since the remote debugging protocol server loads jsdebugger.jsm in a
> sandbox, would it be correct to assume that if the sole user of
> jsdebugger.jsm was the remote protocol server, debugging chrome would work?
No, the jsm would still create its own global which is in the chrome compartment.
| Assignee | ||
Updated•11 years ago
|
Assignee: general → nobody
Comment 5•3 years ago
|
||
Fixed by Bug 1515590 adding addSandboxedDebuggerToGlobal to the JSM which uses a sandbox at the appropriate place.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•