loading resources with Cu.import during xpcom registration fails

NEW
Unassigned

Status

()

Core
XPConnect
9 years ago
5 years ago

People

(Reporter: Shane Caraveo, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

9 years ago
I've created an extension, which has resources (js modules) and javascript xpcom components that load them using Components.utils.import.  

During xpcom registration, the first js xpcom component that is registered will fail to load the extensions resources, but subsequent components getting registered can load them.  This is not an issue with loading gre modules (eg. XPCOMUtils.jsm).

I've tracked this down to nsIResProtocolHandler::GetSubstitution not having the resource mapping (from chrome.manifest for the extension) for new installed extensions.  

I also am able to work around this by having a bogus component load first and fail so the real components can load the resource and register properly.  You can see further comments in the file:

http://svn.openkomodo.com/openkomodo/view/addons/sdconnector/components/anErrorLoading.js

I'm relying on the files to get registered during xpcom registration in alphabetical order (they do so on OSX) for the workaround to work.
Using components to register the module is a really ugly workaround to my mind. I'd like to see this soon, I can imagine this causes headaches for extension developers that first have to do with modules.
Flags: wanted1.9.1?
(Reporter)

Comment 2

9 years ago
similar or same bug 459107 which has a different workaround.  I don't think that is the right fix, since it means any extension needing to have modules will need to replicate that code.  This should be handled on extension load, since the module directory is specified in chrome.manifest.
Flags: wanted1.9.1?
You need to log in before you can comment on or make changes to this bug.