Closed Bug 82187 Opened 23 years ago Closed 7 years ago

subscript loader can't load from a jar

Categories

(Core :: XPConnect, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE
mozilla1.0.1

People

(Reporter: rginda, Unassigned)

References

Details

Attachments

(1 file)

The contentLength attribute of nsIChannel returns a failure code when the
channel represents a file:// url that is part of a jar.  This keeps users from
loading subscripts stored in a jar, which makes the loader kind-of useless.

Mitch, do you know why we can't get the content length of a file in a jar?

The code that's failing is
http://lxr.mozilla.org/mozilla/source/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp#275
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
Rob, this might be a bug with GetContentLength because GetContentType seems to
work fine from a jar'd file.

char *type;
chan->GetContentType(&type);
printf("content type %s\n\n", type);

prints out:

content type application/x-javascript

--pete
dunno...you should be able to get the content length. Maybe recent Necko changes
messed this up. How do I reproduce this?
To reproduce, take the js code in attachment 35791 [details] and paste it into
navigator.xul in place of:

<script type="application/x-javascript"
src="chrome://navigator/content/navigator.js"/>

zip it up into a jar and run mozilla.

You should see this error when you load it up.

Note: verifyreflow is disabled
Note: styleverifytree is disabled
Note: frameverifytree is disabled
JavaScript error:
 line 0: uncaught exception: ContentLength not available (not a local URL?)


--pete
 
If i dereference nsIURI from non jar'd package i produce this output:

js url=chrome://rubbertree/content/js/globals.js
uri->GetSpec=file:///usr/src/MOZILLA/mozilla/dist/bin/chrome/rubbertree/content/js/globals.js
uri->GetPath=/usr/src/MOZILLA/mozilla/dist/bin/chrome/rubbertree/content/js/globals.js
uri->Resolve=file:///usr/src/MOZILLA/mozilla/dist/bin/chrome/rubbertree/content/js/globals.js
uri->GetPrePath=file://
chan->GetContentType=application/x-javascript

From jar'd package my output is this:

js url=chrome://rubbertree/content/js/globals.js
uri->GetSpec=jar:resource:///chrome/rubbertree.jar!/content/js/globals.js
uri->GetPath=
uri->Resolve=jar:resource:///chrome/rubbertree.jar!/content/js/
uri->GetPrePath=jar:
chan->GetContentType=application/x-javascript

globals.js is the first js file i'm loading in this test case.

--pete





Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Depends on: 307686
QA Contact: pschwartau → xpconnect
Assignee: rginda → nobody
Status: ASSIGNED → NEW
Is there any plans regarding fixing this bug ??

Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: