Bug 516406 - Make document.write() parser and stream parser have distinct tokenizers in the HTML5 parser. r=bnewman.
This commit is contained in:
@@ -59,7 +59,9 @@
|
||||
#include "nsIDOMDocumentType.h"
|
||||
|
||||
nsHtml5TreeOperation::nsHtml5TreeOperation()
|
||||
: mOpCode(eTreeOpAppend)
|
||||
#ifdef DEBUG
|
||||
: mOpCode(eTreeOpUninitialized)
|
||||
#endif
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5TreeOperation);
|
||||
}
|
||||
@@ -67,6 +69,7 @@ nsHtml5TreeOperation::nsHtml5TreeOperation()
|
||||
nsHtml5TreeOperation::~nsHtml5TreeOperation()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5TreeOperation);
|
||||
NS_ASSERTION(mOpCode != eTreeOpUninitialized, "Uninitialized tree op.");
|
||||
switch(mOpCode) {
|
||||
case eTreeOpAddAttributes:
|
||||
delete mTwo.attributes;
|
||||
@@ -81,6 +84,13 @@ nsHtml5TreeOperation::~nsHtml5TreeOperation()
|
||||
case eTreeOpCreateComment:
|
||||
delete[] mTwo.unicharPtr;
|
||||
break;
|
||||
case eTreeOpSetDocumentCharset:
|
||||
case eTreeOpNeedsCharsetSwitchTo:
|
||||
delete[] mOne.charPtr;
|
||||
break;
|
||||
case eTreeOpRunScript:
|
||||
delete mTwo.state;
|
||||
break;
|
||||
default: // keep the compiler happy
|
||||
break;
|
||||
}
|
||||
@@ -313,6 +323,10 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder)
|
||||
}
|
||||
case eTreeOpRunScript: {
|
||||
nsIContent* node = *(mOne.node);
|
||||
nsAHtml5TreeBuilderState* snapshot = mTwo.state;
|
||||
if (snapshot) {
|
||||
aBuilder->InitializeDocWriteParserState(snapshot);
|
||||
}
|
||||
aBuilder->SetScriptElement(node);
|
||||
return rv;
|
||||
}
|
||||
@@ -326,6 +340,17 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder)
|
||||
node->DoneCreatingElement();
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpSetDocumentCharset: {
|
||||
char* str = mOne.charPtr;
|
||||
nsDependentCString dependentString(str);
|
||||
aBuilder->SetDocumentCharset(dependentString);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpNeedsCharsetSwitchTo: {
|
||||
char* str = mOne.charPtr;
|
||||
aBuilder->NeedsCharsetSwitchTo(str);
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpUpdateStyleSheet: {
|
||||
nsIContent* node = *(mOne.node);
|
||||
aBuilder->UpdateStyleSheet(node);
|
||||
@@ -355,6 +380,10 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder)
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpStreamEnded: {
|
||||
aBuilder->StreamEnded();
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpStartLayout: {
|
||||
aBuilder->StartLayout(); // this causes a flush anyway
|
||||
return rv;
|
||||
|
||||
Reference in New Issue
Block a user