Importing modules from chrome jar in installed/stored xpi fails

RESOLVED WONTFIX

Status

()

Toolkit
Add-ons Manager
RESOLVED WONTFIX
7 years ago
6 years ago

People

(Reporter: Matthew Imakyure, Unassigned)

Tracking

({dev-doc-complete})

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

7 years ago
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?

Comment 2

7 years ago
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
Last Resolved: 7 years ago
Keywords: dev-doc-needed
Resolution: --- → WONTFIX

Comment 3

7 years ago
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?

Comment 4

7 years ago
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

Comment 5

7 years ago
s/w\//w\/in/

Comment 6

7 years ago
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.

Comment 7

7 years ago
(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.
Added a note here: https://developer.mozilla.org/en/JavaScript_code_modules/Using#Packaging_notes
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.