Changeset 42351 in webkit


Ignore:
Timestamp:
Apr 9, 2009 3:40:30 AM (15 years ago)
Author:
eric@webkit.org
Message:

Reviewed by Oliver Hunt.

Fix document.implementation.createDocument(null, "a:b") not to crash!
https://bugs.webkit.org/show_bug.cgi?id=25096

Test: fast/dom/DOMImplementation/createDocument-namespace-err.html

  • dom/ContainerNode.cpp: (WebCore::ContainerNode::addChild): add ASSERT() to give a better crash next time
  • dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocument): check the exception code before using the result
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r42347 r42351  
     12009-04-09  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Test cases for document.implementation.createDocument
     6        https://bugs.webkit.org/show_bug.cgi?id=25096
     7
     8        We fail some of these tests (as does Mozilla)
     9        I didn't want to add a behavior change to this crash fix, so I filed
     10        https://bugs.webkit.org/show_bug.cgi?id=25111 as a follow-up bug.
     11
     12        * fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt: Added.
     13        * fast/dom/DOMImplementation/createDocument-namespace-err.html: Added.
     14        * fast/dom/DOMImplementation/resources/createDocument-namespace-err.js: Copied from fast/dom/Document/resources/createElementNS-namespace-err.js
     15
    1162009-04-08  Oliver Hunt  <oliver@apple.com>
    217
  • trunk/WebCore/ChangeLog

    r42350 r42351  
     12009-04-09  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Fix document.implementation.createDocument(null, "a:b") not to crash!
     6        https://bugs.webkit.org/show_bug.cgi?id=25096
     7
     8        Test: fast/dom/DOMImplementation/createDocument-namespace-err.html
     9
     10        * dom/ContainerNode.cpp:
     11        (WebCore::ContainerNode::addChild): add ASSERT() to give a better crash next time
     12        * dom/DOMImplementation.cpp:
     13        (WebCore::DOMImplementation::createDocument): check the exception code before using the result
     14
    1152009-04-08  Adam Roben  <aroben@apple.com>
    216
  • trunk/WebCore/dom/ContainerNode.cpp

    r42261 r42351  
    503503ContainerNode* ContainerNode::addChild(PassRefPtr<Node> newChild)
    504504{
     505    ASSERT(newChild);
    505506    // This function is only used during parsing.
    506507    // It does not send any DOM mutation events.
  • trunk/WebCore/dom/DOMImplementation.cpp

    r42324 r42351  
    251251
    252252    if (!qualifiedName.isEmpty()) {
    253         doc->addChild(doc->createElementNS(namespaceURI, qualifiedName, ec));
    254         if (ec != 0)
     253        RefPtr<Node> documentElement = doc->createElementNS(namespaceURI, qualifiedName, ec);
     254        if (ec)
    255255            return 0;
     256        doc->addChild(documentElement.release());
    256257    }
    257258
Note: See TracChangeset for help on using the changeset viewer.