Closed Bug 597571 Opened 14 years ago Closed 14 years ago

Importing modules from chrome jar in installed/stored xpi fails

Categories

(Toolkit :: Add-ons Manager, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: m.imakyure, Unassigned)

References

()

Details

(Keywords: dev-doc-complete)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7pre) Gecko/20100916 Firefox/4.0b7pre
Build Identifier: 

In greasemonkey dev builds (see link), module is imported from chrome jar. This fails when trying to import from zip within a zip in nightly builds:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIXPCComponents_Utils.import]"  nsresult: "0x80004002 (NS_NOINTERFACE)"  location: "JS frame :: chrome://greasemonkey/content/addons4.xul :: anonymous :: line 8"  data: no]

chrome.manifest:
resource greasemonkey jar:chrome/greasemonkey.jar!/content/

addons4.xul, line 8:
Components.utils.import("resource://greasemonkey/addons4.jsm");  
 



Reproducible: Always
Michael, do we support jars within jars in this way?
We could, but it would be for no good reason. 3.6 and older don't support loading jsms from jars, and 4.0 extensions don't need or want jars within the xpis, so this case isn't really useful for anything.

We should probably have a note about this in the docs.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Keywords: dev-doc-needed
Resolution: --- → WONTFIX
Take Greasemonkey for example, they currently jar xul, js, css and support FF 3+, so in order to support FF4 I would image that they should compress the jar and add to the xpi uncompressed. This way a user using FF3 will have the xpi unpacked, and on their system will be a compressed jar, which is the best correct? and a FF4 user would be able to use the entire xpi packed, which is even better.

Also, Michael you seemed to say here: http://blog.mozilla.com/mwu/2010/09/10/extensions-now-installed-packed/ that what I describe above would be possible, am I right?
hmm I think I was slightly confused about the issue here, the issue here as I understand is that a jsm cannot be loaded from a jar, so a jsm w/ a jar is the issue, and not a jar w/ a xpi
s/w\//w\/in/
I'm not sure what you're talking about. We can load jsms from a jar/xpi now, but we can't load jsms from a jar within a jar (xpi). Firefox 3.6 and older do not support loading jsms from jars at all. Putting a jsm in a jar in a xpi serves only one case - when writing a Firefox 4.0 only extension which must be unpacked. Otherwise, putting jsms in a jar breaks Firefox 3.6 and older compatibility and is unnecessary on 4.0 due to not unpacking extension files.
(In reply to comment #6)
> I'm not sure what you're talking about. We can load jsms from a jar/xpi now,
> but we can't load jsms from a jar within a jar (xpi). Firefox 3.6 and older do
> not support loading jsms from jars at all. Putting a jsm in a jar in a xpi
> serves only one case - when writing a Firefox 4.0 only extension which must be
> unpacked. Otherwise, putting jsms in a jar breaks Firefox 3.6 and older
> compatibility and is unnecessary on 4.0 due to not unpacking extension files.

Thanks, this is crystal clear.
You need to log in before you can comment on or make changes to this bug.