Bug 971432 - parser changes needed after moving baseURI to nsILoadInfo. r=hsivonen

This commit is contained in:
James Kitchener 2014-10-24 20:39:00 +02:00
parent 564ada5f05
commit 5614b975f1

View File

@ -29,6 +29,7 @@
#include "nsIScriptContext.h"
#include "mozilla/Preferences.h"
#include "nsIHTMLDocument.h"
#include "nsILoadInfo.h"
using namespace mozilla;
@ -797,12 +798,15 @@ nsHtml5TreeOpExecutor::GetViewSourceBaseURI()
// We query the channel for the baseURI because in certain situations it
// cannot otherwise be determined. If this process fails, fall back to the
// standard method.
nsCOMPtr<nsIViewSourceChannel> vsc;
vsc = do_QueryInterface(mDocument->GetChannel());
if (vsc) {
nsresult rv = vsc->GetBaseURI(getter_AddRefs(mViewSourceBaseURI));
if (NS_SUCCEEDED(rv) && mViewSourceBaseURI) {
return mViewSourceBaseURI;
nsCOMPtr<nsIChannel> channel = mDocument->GetChannel();
if (channel) {
nsCOMPtr<nsILoadInfo> loadInfo;
nsresult rv = channel->GetLoadInfo(getter_AddRefs(loadInfo));
if (NS_SUCCEEDED(rv) && loadInfo) {
rv = loadInfo->GetBaseURI(getter_AddRefs(mViewSourceBaseURI));
if (NS_SUCCEEDED(rv) && mViewSourceBaseURI) {
return mViewSourceBaseURI;
}
}
}