Open Bug 209176 Opened 21 years ago Updated 2 years ago

xpcshell and JS shell should share their code

Categories

(Core :: XPConnect, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: dbradley, Unassigned)

References

(Depends on 1 open bug)

Details

90% of the code is the same, I think. I think XPCShell could include a common
file shared with js. This wouldn't require adding any static libs or anything
and would be simple and light weight to implement. I'm thinking that the shared
file would allow call a shell specific function supplied by each respectively.
I'm thinking an initialize function and a parameter processing function, to
handle any shell specific parameters.
Assignee: dbradley → nobody
QA Contact: pschwartau → xpconnect
You'd need to learn a bit about XPCOM and the JSAPI, but I think this is a doable first bug (if perhaps a slightly ambitious one).
Whiteboard: [good first bug]
A bit more ambitious approach might be to put some hooks into JS Shell that would allow extending it. Then just add in an XPConnect extension. No more two shell apps. This would allow other extensions and more wide spread use of JS Shell.

This might not be nothing more than passing the extension the global object so that the extension could add in its functionality.

Not sure how difficult this would be to do in a cross platform manner.
It would be really great to extend this to cover ipc/testshell/XPCShellEnvironment.cpp as well, since it's yet another environment with very similar blocks of code.
I'd like to tackle this bug but would love some assistance in figuring out the architecture before getting started.

It seems that there are two solutions presented so far:
1. Have a common file that is shared by XPCShell and JSShell containing the common code, with wrappers in each version to access the common functions.
2. Add hooks into JSShell and implement XPCShell as an extension using the hooks.

I can probably figure out how to do (1) by myself but will likely need help with (2). 

The question is, which approach is better for Mozilla? Are there any other approaches that haven't been listed yet?
(2) sounds like the way to go.
Assignee: nobody → szu.han.chang
Depends on: 687122
I'd like to propose that the goal of this bug will be to implement XPC shell using the JS shell API developed for the resolution of bug 687122.
No longer depends on: 687122
Depends on: 687122
Given how we're classifying bug types these days, this isn't good first bug fodder.
Assignee: szu.han.chang → nobody
Whiteboard: [good first bug]
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.