doc->GetDocumentURL() returns wrong URL when redirect occurs

VERIFIED DUPLICATE of bug 48200

Status

()

Core
Networking
P3
blocker
VERIFIED DUPLICATE of bug 48200
18 years ago
18 years ago

People

(Reporter: Stephen P. Morse, Assigned: Gagan)

Tracking

Trunk
x86
Windows NT
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

18 years ago
After fetching a page that is the result of a redirect and calling on 
doc->GetDocumentURL(), the url returned is the page prior to the redirect rather 
than the page that you were redirected to.

Don't know if this is a bug or if this is the way it was intended to work.  If 
the latter, then I need some other way to obtain the final url -- i.e., the URL 
which is being reported in the URL bar.  Does such a function exist?

This bug is blocking wallet code from working.  See bug 49547.
(Reporter)

Updated

18 years ago
Blocks: 49547
(Reporter)

Updated

18 years ago
Severity: normal → blocker
Keywords: nsbeta3
(Reporter)

Comment 1

18 years ago
An easy way to demonstrate this problem is to print out the current url from 
an OnEndDocumentLoad handler.  There is such a handler in 
extensions/wallet/src/nsWalletService.cpp.  That handler contains, in essense, 
the following code to obtain the url

  rv = docViewer->GetDocument(*getter_AddRefs(doc));
  docURL = doc->GetDocumentURL();
  (void)docURL->GetSpec(&spec);

So immediately after the above line add:

   printf("\n@@@ @@@ spec=%s\n", spec);

Now the url will be printed out after each page is finished loading.  From the 
generated output it will be seen that the url of the last page loaded is that of 
the initial request and not of the target of the redirect.
(Assignee)

Comment 2

18 years ago
dup of bug 48200

*** This bug has been marked as a duplicate of 48200 ***
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → DUPLICATE

Comment 3

18 years ago
When the docshell receives an nsIHTTPEventSink::OnRedirect() noitification it 
needs to pass the correct URI on to the document...
Depends on: 27048

Comment 4

18 years ago
Verified dupe of fixed bug 48200: "Incorrect base URL used on redirected pages"
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.