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.
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.
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → DUPLICATE
When the docshell receives an nsIHTTPEventSink::OnRedirect() noitification it needs to pass the correct URI on to the document...
Depends on: 27048
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.