Closed Bug 923067 Opened 12 years ago Closed 12 years ago

Got "NS_ERROR_DOM_BAD_URI: Access to restricted URI denied" error when accessing missing file:/// with Ajax - shouldn't it be "file not found" instead?

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: sole, Unassigned)

Details

Attachments

(1 file)

Attached file test case
I am not sure about the reasoning behind throwing that error, but as a developer I'd find it more useful if the browser told me that the file wasn't there, rather than throwing a "restricted URL" exception :-) Attaching test case to be tried locally. I also uploaded it but as it's not local it works correctly: GET http://people.mozilla.org/~spenades/test_cases/local_restricted_url_404/a-file-that-doesnt-exist.txt http://people.mozilla.org/~spenades/test_cases/local_restricted_url_404/
This doesn't seem to be a web console bug. The web console simply displays errors that come from other parts in the browser. Maybe this is a Core bug?
Component: Developer Tools: Console → DOM
Product: Firefox → Core
Probably. I rely on your infinite wisdom to change components to the proper one, because I am very newbie at that--just did my best at guessing :-) Thanks for reassigning!
So we land in nsPrincipal::CheckMayLoad which calls NS_RelaxStrictFileOriginPolicy. This can't get the target file, so can't do basic security checks on it (e.g. whether it's a directory), so it returns false. Then CheckMayLoad returns NS_ERROR_DOM_BAD_URI, which is what the XMLHttpRequest implementation then has to work with... I don't think it's worth adding special-cases here to make this look like not a permissions check failure, especially because it _is_ a permissions check failure: linking to local files is only allowed if we know certain information about the file, and we can't get that information for nonexistent files.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: