Bug 531373 - Script between head and body is not executed by HTML5 parser. rs=sicking.

--HG--
extra : rebase_source : 074c8ea07bec9bcc0dfde3e2ad95cb0d8e49ea6f
This commit is contained in:
Henri Sivonen 2009-12-10 16:27:48 -08:00
Родитель 5d28b83605
Коммит 36a4d0a1db
2 изменённых файлов: 32 добавлений и 9 удалений

Просмотреть файл

@ -2699,10 +2699,10 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
continue;
}
case NS_HTML5TREE_BUILDER_TEXT: {
if (originalMode == NS_HTML5TREE_BUILDER_AFTER_HEAD) {
pop();
}
pop();
if (originalMode == NS_HTML5TREE_BUILDER_AFTER_HEAD) {
silentPop();
}
mode = originalMode;
goto endtagloop_end;
}
@ -3062,6 +3062,19 @@ nsHtml5TreeBuilder::push(nsHtml5StackNode* node)
elementPushed(node->ns, node->popName, node->node);
}
void
nsHtml5TreeBuilder::silentPush(nsHtml5StackNode* node)
{
currentPtr++;
if (currentPtr == stack.length) {
jArray<nsHtml5StackNode*,PRInt32> newStack = jArray<nsHtml5StackNode*,PRInt32>(stack.length + 64);
nsHtml5ArrayCopy::arraycopy(stack, newStack, stack.length);
stack.release();
stack = newStack;
}
stack[currentPtr] = node;
}
void
nsHtml5TreeBuilder::append(nsHtml5StackNode* node)
{
@ -3352,14 +3365,12 @@ nsHtml5TreeBuilder::addAttributesToHtml(nsHtml5HtmlAttributes* attributes)
void
nsHtml5TreeBuilder::pushHeadPointerOntoStack()
{
flushCharacters();
if (!headPointer) {
push(stack[currentPtr]);
} else {
push(new nsHtml5StackNode(kNameSpaceID_XHTML, nsHtml5ElementName::ELT_HEAD, headPointer));
}
silentPush(new nsHtml5StackNode(kNameSpaceID_XHTML, nsHtml5ElementName::ELT_HEAD, headPointer));
}
void
@ -3442,6 +3453,16 @@ nsHtml5TreeBuilder::pop()
node->release();
}
void
nsHtml5TreeBuilder::silentPop()
{
flushCharacters();
nsHtml5StackNode* node = stack[currentPtr];
currentPtr--;
node->release();
}
void
nsHtml5TreeBuilder::popOnEof()
{

Просмотреть файл

@ -131,6 +131,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
PRBool clearLastStackSlot();
PRBool clearLastListSlot();
void push(nsHtml5StackNode* node);
void silentPush(nsHtml5StackNode* node);
void append(nsHtml5StackNode* node);
inline void insertMarker()
{
@ -160,6 +161,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
void insertIntoFosterParent(nsIContent** child);
PRBool isInStack(nsHtml5StackNode* node);
void pop();
void silentPop();
void popOnEof();
void appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes);
void appendHtmlElementToDocumentAndPush();