Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

relative path in a jar in a xul doesn't work

4 views
Skip to first unread message

mooo...@gmail.com

unread,
Nov 8, 2006, 8:24:47 PM11/8/06
to
I'm having problems using relative paths in a jar file that is in a xul
browser element.

Here's a description of the problem. Following this will be example
code.

I have a jar URL that is the src location of a browser XUL element. In
the jar is an html page with javascript. The js calls
location.replace(myPath) with a relative path. In the error console a
security exception is shown with a url who's base is the URL to the XUL
file. Appended to that URL is the relative path element sI'm having
problems using relative paths in a jar file that is in a xul browser
element.

Here's a description of the problem. Following this will be example
code.

I have a jar URL that is the src location of a browser XUL element. In
the jar is an html page with javascript. The js calls
location.replace(myPath) with a relative path. In the error console a
security exception is shown with a url who's base is the URL to the XUL
file. Appended to that URL is the relative path element 'myPath'.

Shouldn't the resultant URL be relative to the jar NOT the containing
XUL page? If you view the jar URL directly into the browser bar you get
the correct behavior. Hopefully needless to say, if the pages are not
in a jar, you also get the correct behavior.

As an aside, Google Web Toolkit (GWT), and probably many other
javascript toolkits, rely on this behavior of location. But this is how
I ran into the problem.


** examp.xul
<window id="examp_win" title="jar in xul example"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- browser type="content" id="broken_location"
src="jar:http://localhost/buggy.jar!/start.html" flex="1" / -->
<browser type="content" id="broken_location"
src="jar:http://localhost/buggy.jar!/start.html" flex="1" />
</window>

** start.html
<html>
<head><script language="JavaScript">
function gotoEnd() {
location.replace("theend.html");
}
</script></head>
<body onload="gotoEnd();"><p>location bug example</p></body>
</html>

** theend.html
<html><body>the end</body></html>

Then jam start.html & theend.html into a jar.

Is this a bug? Is it a known bug?

TIA,
Sherman

0 new messages