Bug 16836 - JS navigation to host-less HTTP URL (http:/path/to/file) generates error
Summary: JS navigation to host-less HTTP URL (http:/path/to/file) generates error
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-01-10 23:09 PST by Liam Elbourne
Modified: 2008-01-11 01:02 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Liam Elbourne 2008-01-10 23:09:45 PST
When the "General Inquests" link is selected within the url:


"http://www.lawlink.nsw.gov.au/lawlink/coroners_court/ll_coroners.nsf/pages/coroners_information"

 the script called by this link (OpenAttachmentWithFullPath) generates:

"http://lawlink/Coroners_Court/ll_coroners.nsf/vwFiles/InquestFAQs.doc/$file/InquestFAQs.doc"

which should be:

"http://www.lawlink.nsw.gov.au/lawlink/Coroners_Court/ll_coroners.nsf/vwFiles/InquestFAQs.doc/$file/InquestFAQs.doc"

ie the results, if any, of the script are not included.
Comment 1 Mark Rowe (bdash) 2008-01-11 00:59:26 PST
I think the URL is being generated correctly.  The target of the link is:
javascript:OpenAttachmentWithFullPath('/lawlink/Coroners_Court/ll_coroners.nsf/vwFiles/InquestFAQs.doc/$file/InquestFAQs.doc')

The function is defined as follows:
function OpenAttachmentWithFullPath ( filePath ) {
   window.open ( "http:" + filePath ); 
} // end of function 

This results in http:/lawlink/Coroners_Court/ll_coroners.nsf/vwFiles/InquestFAQs.doc/$file/InquestFAQs.doc being loaded.

Another method of reproducing this bug is to go to http://webkit.org/blog/ and enter:
javascript:window.location = 'http:/'

in the address bar and press enter.  In Safari this generates an error saying:
Safari can’t open the page “http:/” because it’s an invalid address.

In Firefox this loads http://webkit.org/.  What is interesting is that Firefox gives a similar error to Safari if you enter "http:/" in the address bar.

I wonder what specifies the behaviour of a http:/path/to/file URL?
Comment 2 Mark Rowe (bdash) 2008-01-11 01:00:24 PST
I can reproduce this with Safari 3.0.4 on Mac OS X 10.5.x.
Comment 3 Mark Rowe (bdash) 2008-01-11 01:01:23 PST
A simple workaround for the website is to change OpenAttachmentWithFullPath to omit the leading http:.  I've never seen http:/path/to/file-style URLs used in the wild before.
Comment 4 Mark Rowe (bdash) 2008-01-11 01:02:40 PST
<rdar://problem/5683164>