⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 87863 in webkit


Ignore:
Timestamp:
Jun 1, 2011, 4:13:53 PM (15 years ago)
Author:
inferno@chromium.org
Message:

2011-06-01 Abhishek Arya <inferno@chromium.org>

Reviewed by Alexey Proskuryakov.

Fix setting of document.body
https://bugs.webkit.org/show_bug.cgi?id=60831

  1. Only allowing setting to an element if it has a body tag.
  2. If element is from another document, import it.

Test: fast/dom/document-set-body.html

  • dom/Document.cpp: (WebCore::Document::setBody):

2011-06-01 Abhishek Arya <inferno@chromium.org>

Reviewed by Alexey Proskuryakov.

Tests setting document.body to non body elements, elements in other
documents.
https://bugs.webkit.org/show_bug.cgi?id=60831

  • fast/dom/document-set-body-expected.txt: Added.
  • fast/dom/document-set-body.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87862 r87863  
     12011-06-01  Abhishek Arya  <inferno@chromium.org>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Tests setting document.body to non body elements, elements in other
     6        documents.
     7        https://bugs.webkit.org/show_bug.cgi?id=60831
     8
     9        * fast/dom/document-set-body-expected.txt: Added.
     10        * fast/dom/document-set-body.html: Added.
     11
    1122011-06-01  Adam Barth  <abarth@webkit.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r87856 r87863  
     12011-06-01  Abhishek Arya  <inferno@chromium.org>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Fix setting of document.body
     6        https://bugs.webkit.org/show_bug.cgi?id=60831
     7
     8        1. Only allowing setting to an element if it has a body tag.
     9        2. If element is from another document, import it.
     10
     11        Test: fast/dom/document-set-body.html
     12
     13        * dom/Document.cpp:
     14        (WebCore::Document::setBody):
     15
    1162011-06-01  Chris Fleizach  <cfleizach@apple.com>
    217
  • trunk/Source/WebCore/dom/Document.cpp

    r87844 r87863  
    20322032void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec)
    20332033{
    2034     if (!newBody || !documentElement()) {
     2034    ec = 0;
     2035
     2036    if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) {
    20352037        ec = HIERARCHY_REQUEST_ERR;
    20362038        return;
     2039    }
     2040
     2041    if (newBody->document() && newBody->document() != this) {
     2042        RefPtr<Node> node = importNode(newBody.get(), true, ec);
     2043        if (ec)
     2044            return;
     2045       
     2046        newBody = toHTMLElement(node.get());
    20372047    }
    20382048
Note: See TracChangeset for help on using the changeset viewer.