Bug 802895 - Parser changes to support srcdoc attributes for iframes (Part 8)

This commit is contained in:
Matt A. Tobin
2014-11-09 15:30:23 -05:00
parent 358984381c
commit 5b548e2b9b
13 changed files with 527 additions and 425 deletions
+19
View File
@@ -26,6 +26,7 @@
#include "nsINestedURI.h"
#include "nsCharsetSource.h"
#include "nsIWyciwygChannel.h"
#include "nsIInputStreamChannel.h"
#include "mozilla/dom/EncodingUtils.h"
@@ -877,6 +878,7 @@ nsHtml5StreamParser::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
bool scriptingEnabled = mMode == LOAD_AS_DATA ?
false : mExecutor->IsScriptEnabled();
mOwner->StartTokenizer(scriptingEnabled);
mTreeBuilder->setIsSrcdocDocument(IsSrcdocDocument());
mTreeBuilder->setScriptingEnabled(scriptingEnabled);
mTreeBuilder->SetPreventScriptExecution(!((mMode == NORMAL) &&
scriptingEnabled));
@@ -1616,3 +1618,20 @@ nsHtml5StreamParser::MarkAsBroken(nsresult aRv)
NS_WARNING("failed to dispatch executor flush event");
}
}
bool
nsHtml5StreamParser::IsSrcdocDocument()
{
nsresult rv;
bool isSrcdoc = false;
nsCOMPtr<nsIChannel> channel;
rv = GetChannel(getter_AddRefs(channel));
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIInputStreamChannel> isr = do_QueryInterface(channel);
if (isr) {
isr->GetIsSrcdocChannel(&isSrcdoc);
}
}
return isSrcdoc;
}