Closed
Bug 209717
Opened 23 years ago
Closed 23 years ago
Doc.load fails, when using relative path
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mgalli, Assigned: hjtoi-bugzilla)
Details
Attachments
(2 files)
|
3.54 KB,
application/octet-stream
|
Details | |
|
4.95 KB,
patch
|
caillon
:
review+
hjtoi-bugzilla
:
superreview+
|
Details | Diff | Splinter Review |
The exception File not Found is generated when you try to reuse the same Doc to
load a file that is specified using relative path.
I will attach the sample testcase which is basically:
1) Click Link -> Doc.load("dir/something.xml") -> alert box(loaded).
Click the link first time, it loads fine. Click the link again and note that
does not load the dir/something.xml. Instead, mozilla is trying to load
dir/dir/something.xml.
| Reporter | ||
Comment 1•23 years ago
|
||
Note this testcase has a file test1.html and dir/file.xml. I also included
dir/dir_rename_to_dir/file.xml. So you can rename and have dir/dir/file.xml and
will be able to see the dir/dir/file.xml loading on the second click.
Comment 3•23 years ago
|
||
Updated•23 years ago
|
Attachment #125977 -
Flags: superreview?(heikki)
Attachment #125977 -
Flags: review?(caillon)
Comment 4•23 years ago
|
||
Comment on attachment 125977 [details] [diff] [review]
Proposed fix, use the caller's base URI as the base URI in document.load().
>+ // Create a new URI
>+ rv = NS_NewURI(getter_AddRefs(uri), aUrl, charset.get(), baseURI);
>+ if (NS_FAILED(rv)) return rv;
Fix your if blocks...
>+
>+ // Get security manager, check to see if we're allowed to load this URI
>+ nsCOMPtr<nsIScriptSecurityManager> secMan =
>+ do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
>+ if (NS_FAILED(rv)) return rv;
...and then ...
>+ rv = secMan->CheckConnect(nsnull, uri, "XMLDocument", "load");
>+ if (NS_FAILED(rv)) {
>+ // We need to return success here so that JS will get a proper
>+ // exception thrown later. Native calls should always result in
>+ // CheckConnect() succeeding, but in case JS calls C++ which calls
>+ // this code the exception might be lost.
>+ return NS_OK;
>+ }
>+
>+ SetDocumentURL(uri);
>+ SetBaseURL(uri);
>+
>+ // Store script context, if any, in case we encounter redirect
>+ // (because we need it there)
>+
>+ mScriptContext = callingContext;
>
> // Find out if UniversalBrowserRead privileges are enabled - we will
> // need this in case of a redirect
> PRBool crossSiteAccessEnabled;
> rv = secMan->IsCapabilityEnabled("UniversalBrowserRead",
> &crossSiteAccessEnabled);
> if (NS_FAILED(rv)) return rv;
...I will be happy.
>
> mCrossSiteAccessEnabled = crossSiteAccessEnabled;
Attachment #125977 -
Flags: review?(caillon) → review+
| Assignee | ||
Updated•23 years ago
|
Attachment #125977 -
Flags: superreview?(heikki-bugzilla) → superreview+
Updated•13 years ago
|
Component: DOM: Other → DOM
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•