Closed Bug 626059 Opened 14 years ago Closed 13 years ago

add classID property to package.json to support XUL (non-bootstrapped) extensions in Mozilla2, use the same logic for generating JID, harness GUID, and harness contract ID in 'cfx run' and 'cfx test' when an id is present in package.json.

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: asqueella, Assigned: asqueella)

References

Details

Attachments

(1 file)

With the switch to chrome.manifest-based registration of XPCOM components in Mozilla 2, the dynamic generation of classIDs <https://github.com/mozilla/addon-sdk/blame/master/python-lib/cuddlefish/__init__.py#LID534> for the harness component became problematic for non-bootstrapped (XUL) extensions: if your bootstrap.js isn't invoked, you have to register the harness component via chrome.manifest, which requires hardcoding a classID there.

As a workaround for this problem I added support for hardcoding the CID in package.json.

While doing that I elmiminated the unnecessary difference between 'cfx test' and 'cfx run' WRT harness_guid, jid, and harness contractID they use. As I understood, the idea was to allow 'cfx test' to work without an id in package.json. I made it so that the hardcoded GUID/harness ID is only used when the id isn't present in package.json.

The packages/development-mode/lib/bootstrap.js change is fixing XPCOM unregistration to work in the case of randomly generated GUID for each run: it should unregister using the classID of the previous run, not the classID of the current run.

The examples/reading-data/tests/test-main.js change is needed because the tests now use the JID (and the resource:// prefix is generated from the JID) from package.json, when its provided, as is the case with the reading-data package.
Attachment #504124 - Flags: review? → review?(warner-bugzilla)
Assignee: nobody → asqueella
Status: NEW → ASSIGNED
Comment on attachment 504124 [details]
pointer to the pull request

looks good to me! It also changes the behavior of 'cfx test' (when used on a module that *does* have an ID in its package.json) to use the same JID as 'cfx run' or 'cfx xpi', which is probably a good thing.
Attachment #504124 - Flags: review?(warner-bugzilla) → review+
> It also changes the behavior of 'cfx test'

Yes, I mentioned that in comment 0 and it's intentional. Before I had to check two contract IDs when trying to get the harness service from a XUL extension. Tests also passed with this change.

Thanks for the review! I assume this has to wait until the thaw to get landed?
Blocks: 627209
Brian, now when the tree is open could you land it for me? I updated the pull request today and it doesn't fail any new tests (compared to the addon-sdk tip).
landed, in https://github.com/mozilla/addon-sdk/commit/d1dc326f420c9c1a897cfe94531532a47e7d6b1b
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Thanks, Brian!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: