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