Last Comment Bug 597571 - Importing modules from chrome jar in installed/stored xpi fails
: Importing modules from chrome jar in installed/stored xpi fails
Status: RESOLVED WONTFIX
: dev-doc-complete
Product: Toolkit
Classification: Components
Component: Add-ons Manager (show other bugs)
: unspecified
: x86 Windows 7
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
: Andy McKay [:andym]
Mentors:
https://arantius.com/misc/gm-nightly/
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-17 15:34 PDT by Matthew Imakyure
Modified: 2011-03-15 11:52 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Matthew Imakyure 2010-09-17 15:34:01 PDT
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
Comment 1 Dave Townsend [:mossop] 2010-09-17 15:44:25 PDT
Michael, do we support jars within jars in this way?
Comment 2 Michael Wu [:mwu] 2010-09-17 16:01:02 PDT
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.
Comment 3 Erik Vold 2010-09-19 01:38:04 PDT
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 Erik Vold 2010-09-19 01:45:18 PDT
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 Erik Vold 2010-09-19 01:45:56 PDT
s/w\//w\/in/
Comment 6 Michael Wu [:mwu] 2010-09-19 02:38:16 PDT
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 Erik Vold 2010-09-19 03:16:55 PDT
(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.
Comment 8 Eric Shepherd [:sheppy] 2011-03-15 11:52:33 PDT
Added a note here: https://developer.mozilla.org/en/JavaScript_code_modules/Using#Packaging_notes

Note You need to log in before you can comment on or make changes to this bug.