Commit ac869297 authored by weinig@apple.com's avatar weinig@apple.com

WebCore:

2009-04-14  Sam Weinig  <sam@webkit.org>

        Reviewed by Darin Adler.

        Part of <rdar://problem/6150868>
        Fix incorrect handling of content that needs to go into the head element
        once the head element has been removed.

        Test: fast/parser/head-content-after-head-removal.html

        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::HTMLParser): Remove unneeded initializer of m_head.
        (WebCore::HTMLParser::handleError): Update since m_head is now a RefPtr.
        (WebCore::HTMLParser::createHead): Ditto.
        * html/HTMLParser.h: Make m_head a RefPtr.

LayoutTests:

2009-04-14  Sam Weinig  <sam@webkit.org>

        Reviewed by Darin Adler.

        Part of <rdar://problem/6150868>
        Test for incorrect handling of content that needs to go into the head element
        once the head element has been removed.

        * fast/parser/head-content-after-head-removal-expected.txt: Added.
        * fast/parser/head-content-after-head-removal.html: Added.



git-svn-id: svn://svn.chromium.org/blink/trunk@42532 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e85d1560
2009-04-14 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Part of <rdar://problem/6150868>
Test for incorrect handling of content that needs to go into the head element
once the head element has been removed.
* fast/parser/head-content-after-head-removal-expected.txt: Added.
* fast/parser/head-content-after-head-removal.html: Added.
2009-04-14 Adam Roben <aroben@apple.com>
Skip another test that sometimes times out on Windows
......
If you can see this text without crashing, the test passed. Note: The title element did not end up in the document.
<head></head>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
// Blow away the <head> element above in a way that doesn't create a JavaScript wrapper.
document.documentElement.innerHTML = "";
</script>
<title>
This element gets put into the head by the parser, but we deleted the head!
</title>
<body>
If you can see this text without crashing, the test passed.
<script>
if (document.getElementsByTagName("title").length)
document.write(" Note: The title element did end up in the document.");
else
document.write(" Note: The title element did not end up in the document.");
</script>
</body>
2009-04-14 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Part of <rdar://problem/6150868>
Fix incorrect handling of content that needs to go into the head element
once the head element has been removed.
Test: fast/parser/head-content-after-head-removal.html
* html/HTMLParser.cpp:
(WebCore::HTMLParser::HTMLParser): Remove unneeded initializer of m_head.
(WebCore::HTMLParser::handleError): Update since m_head is now a RefPtr.
(WebCore::HTMLParser::createHead): Ditto.
* html/HTMLParser.h: Make m_head a RefPtr.
2009-04-14 Geoffrey Garen <ggaren@apple.com>
Used svn merge -r42529:42528 to roll out my last patch because it broke
......@@ -126,7 +126,6 @@ HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors)
, m_blockStack(0)
, m_blocksInStack(0)
, m_hasPElementInScope(NotInScope)
, m_head(0)
, m_inBody(false)
, m_haveContent(false)
, m_haveFrameSet(false)
......@@ -144,7 +143,6 @@ HTMLParser::HTMLParser(DocumentFragment* frag)
, m_blockStack(0)
, m_blocksInStack(0)
, m_hasPElementInScope(NotInScope)
, m_head(0)
, m_inBody(true)
, m_haveContent(false)
, m_haveFrameSet(false)
......@@ -506,8 +504,7 @@ bool HTMLParser::handleError(Node* n, bool flat, const AtomicString& localName,
elt->hasLocalName(baseTag))) {
if (!m_head) {
m_head = new HTMLHeadElement(headTag, m_document);
e = m_head;
insertNode(e);
insertNode(m_head.get());
handled = true;
}
} else {
......@@ -1516,14 +1513,14 @@ void HTMLParser::createHead()
m_head = new HTMLHeadElement(headTag, m_document);
HTMLElement* body = m_document->body();
ExceptionCode ec = 0;
m_document->documentElement()->insertBefore(m_head, body, ec);
m_document->documentElement()->insertBefore(m_head.get(), body, ec);
if (ec)
m_head = 0;
// If the body does not exist yet, then the <head> should be pushed as the current block.
if (m_head && !body) {
pushBlock(m_head->localName(), m_head->tagPriority());
setCurrent(m_head);
setCurrent(m_head.get());
}
}
......
......@@ -169,7 +169,7 @@ private:
RefPtr<HTMLFormElement> m_currentFormElement; // currently active form
RefPtr<HTMLMapElement> m_currentMapElement; // current map
HTMLHeadElement* m_head; // head element; needed for HTML which defines <base> after </head>
RefPtr<HTMLHeadElement> m_head; // head element; needed for HTML which defines <base> after </head>
RefPtr<Node> m_isindexElement; // a possible <isindex> element in the head
bool m_inBody;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment