Title: [118570] trunk
Revision
118570
Author
[email protected]
Date
2012-05-25 15:02:32 -0700 (Fri, 25 May 2012)

Log Message

createContextualFragment and insertAdjacentHTML should throw syntax error
https://bugs.webkit.org/show_bug.cgi?id=87454

Reviewed by Darin Adler.

Source/WebCore: 

Before this patch, createContextualFragment threw NOT_SUPPORTED_ERR and insertAdjacentHTML didn't throw any errors.
Make them throw SYNTAX_ERR to be consistent with the spec and Firefox:
http://html5.org/specs/dom-parsing.html#parsing
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-fragment-parsing-algorithm

Also reduced the code duplication.

Test: fast/dom/xhtml-fragment-parsing-exceptions.xhtml

* dom/Range.cpp:
(WebCore::Range::createContextualFragment):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::setInnerHTML): Explicitly pass AllowScriptingContent. 
* editing/markup.cpp:
(WebCore::createFragmentFromMarkup):
(WebCore::createFragmentForInnerOuterHTML): Takes ExceptionCode now.
(WebCore::createContextualFragment): Share code with createFragmentForInnerOuterHTML
and propagate the exception code.
* editing/markup.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setInnerHTML): Explicitly pass AllowScriptingContent.
(WebCore::HTMLElement::setOuterHTML): Ditto.
(WebCore::HTMLElement::insertAdjacentHTML): Ditto; also rename ignoredEc to ignoredEC
per Darin's comment on the bug 87339.

Source/WebKit/qt: 

Pass an ExceptionCode to createContextualFragment.

* Api/qwebelement.cpp:
(QWebElement::appendInside):
(QWebElement::prependInside):
(QWebElement::prependOutside):
(QWebElement::appendOutside):
(QWebElement::encloseContentsWith):
(QWebElement::encloseWith):

LayoutTests: 

Add a regression test, and rebaselined the existing tests since we throw
DOMException.SYNTAX_ERR instead of DOMException.INVALID_STATE_ERR.

* fast/dom/xhtml-fragment-parsing-exceptions-expected.txt: Added.
* fast/dom/xhtml-fragment-parsing-exceptions.xhtml: Added.
* fast/innerHTML/innerHTML-changing-document-properties-expected.txt:
* fast/parser/xhtml-innerhtml-null-byte-first.xhtml:
* fast/parser/xhtml-innerhtml-null-byte.xhtml:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118569 => 118570)


--- trunk/LayoutTests/ChangeLog	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/LayoutTests/ChangeLog	2012-05-25 22:02:32 UTC (rev 118570)
@@ -1,3 +1,19 @@
+2012-05-24  Ryosuke Niwa  <[email protected]>
+
+        createContextualFragment and insertAdjacentHTML should throw syntax error
+        https://bugs.webkit.org/show_bug.cgi?id=87454
+
+        Reviewed by Darin Adler.
+
+        Add a regression test, and rebaselined the existing tests since we throw
+        DOMException.SYNTAX_ERR instead of DOMException.INVALID_STATE_ERR.
+
+        * fast/dom/xhtml-fragment-parsing-exceptions-expected.txt: Added.
+        * fast/dom/xhtml-fragment-parsing-exceptions.xhtml: Added.
+        * fast/innerHTML/innerHTML-changing-document-properties-expected.txt:
+        * fast/parser/xhtml-innerhtml-null-byte-first.xhtml:
+        * fast/parser/xhtml-innerhtml-null-byte.xhtml:
+
 2012-05-25  John Knottenbelt  <[email protected]>
 
         Body scrollWidth() and scrollHeight() should be page scale-invariant

Added: trunk/LayoutTests/fast/dom/xhtml-fragment-parsing-exceptions-expected.txt (0 => 118570)


--- trunk/LayoutTests/fast/dom/xhtml-fragment-parsing-exceptions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/xhtml-fragment-parsing-exceptions-expected.txt	2012-05-25 22:02:32 UTC (rev 118570)
@@ -0,0 +1,11 @@
+This tests parsing invalid XHTML content in innerHTML. You should see PASS below:
+
+createContextualFragment: PASS - SYNTAX_ERR
+
+insertAdjacentHTML: PASS - SYNTAX_ERR
+
+innerHTML: PASS - SYNTAX_ERR
+
+outerHTML: PASS - SYNTAX_ERR
+
+

Added: trunk/LayoutTests/fast/dom/xhtml-fragment-parsing-exceptions.xhtml (0 => 118570)


--- trunk/LayoutTests/fast/dom/xhtml-fragment-parsing-exceptions.xhtml	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/xhtml-fragment-parsing-exceptions.xhtml	2012-05-25 22:02:32 UTC (rev 118570)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<body>
+<p>This tests parsing invalid XHTML content in innerHTML. You should see PASS below:</p>
+<p>createContextualFragment: <span id="createContextualFragment">FAIL</span></p>
+<p>insertAdjacentHTML: <span id="insertAdjacentHTML">FAIL</span></p>
+<p>innerHTML: <span id="innerHTML">FAIL</span></p>
+<p>outerHTML: <span id="outerHTML">FAIL</span></p>
+<script type="text/_javascript_">
+<![CDATA[
+
+var div = document.createElement('div');
+document.body.appendChild(div);
+
+var range = document.createRange();
+range.selectNode(div);
+try {
+    range.createContextualFragment('<b>a<');
+} catch (exception) {
+    document.getElementById('createContextualFragment').textContent = 'PASS - ' + exception.name;
+}
+
+try {
+    div.insertAdjacentHTML('afterBegin', '<b>a<')
+} catch (exception) {
+    document.getElementById('insertAdjacentHTML').textContent = 'PASS - ' + exception.name;
+}
+
+try {
+    div.innerHTML = '<b>a<';
+} catch (exception) {
+    document.getElementById('innerHTML').textContent = 'PASS - ' + exception.name;
+}
+
+try {
+    div.outerHTML = '<b>a<';
+} catch (exception) {
+    document.getElementById('outerHTML').textContent = 'PASS - ' + exception.name;
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+]]>
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/fast/innerHTML/innerHTML-changing-document-properties-expected.txt (118569 => 118570)


--- trunk/LayoutTests/fast/innerHTML/innerHTML-changing-document-properties-expected.txt	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/LayoutTests/fast/innerHTML/innerHTML-changing-document-properties-expected.txt	2012-05-25 22:02:32 UTC (rev 118570)
@@ -2,7 +2,7 @@
 document.xmlVersion : 1.0
 document.xmlStandalone : true
 document.readyState : loading
-div.innerHTML = threw exception: Error: INVALID_STATE_ERR: DOM Exception 11
+div.innerHTML = threw exception: Error: SYNTAX_ERR: DOM Exception 12
 document.xmlEncoding : UTF-8
 document.xmlVersion : 1.0
 document.xmlStandalone : true

Modified: trunk/LayoutTests/fast/parser/xhtml-innerhtml-null-byte-first.xhtml (118569 => 118570)


--- trunk/LayoutTests/fast/parser/xhtml-innerhtml-null-byte-first.xhtml	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/LayoutTests/fast/parser/xhtml-innerhtml-null-byte-first.xhtml	2012-05-25 22:02:32 UTC (rev 118570)
@@ -14,7 +14,7 @@
         document.getElementById("p0").innerHTML = "\x00FAIL: Nulls mishandled.";
       } catch(e) {
         document.getElementById("p0").innerHTML = "PASS: An exception was raised, no crashing.";
-        if (e.code != 11)
+        if (e.code != DOMException.SYNTAX_ERR)
           console.log("Unexpected error thrown: " + e.name + ": " + e.message);
       }
     ]]></script>

Modified: trunk/LayoutTests/fast/parser/xhtml-innerhtml-null-byte.xhtml (118569 => 118570)


--- trunk/LayoutTests/fast/parser/xhtml-innerhtml-null-byte.xhtml	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/LayoutTests/fast/parser/xhtml-innerhtml-null-byte.xhtml	2012-05-25 22:02:32 UTC (rev 118570)
@@ -14,7 +14,7 @@
         document.getElementById("p0").innerHTML = "FAIL: Nulls mishandled.\x00";
       } catch(e) {
         document.getElementById("p0").innerHTML = "PASS: An exception was raised, no crashing.";
-        if (e.code != 11)
+        if (e.code != DOMException.SYNTAX_ERR)
           console.log("Unexpected error thrown: " + e.name + ": " + e.message);
       }
     ]]></script>

Modified: trunk/Source/WebCore/ChangeLog (118569 => 118570)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 22:02:32 UTC (rev 118570)
@@ -1,3 +1,35 @@
+2012-05-24  Ryosuke Niwa  <[email protected]>
+
+        createContextualFragment and insertAdjacentHTML should throw syntax error
+        https://bugs.webkit.org/show_bug.cgi?id=87454
+
+        Reviewed by Darin Adler.
+
+        Before this patch, createContextualFragment threw NOT_SUPPORTED_ERR and insertAdjacentHTML didn't throw any errors.
+        Make them throw SYNTAX_ERR to be consistent with the spec and Firefox:
+        http://html5.org/specs/dom-parsing.html#parsing
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-fragment-parsing-algorithm
+
+        Also reduced the code duplication.
+
+        Test: fast/dom/xhtml-fragment-parsing-exceptions.xhtml
+
+        * dom/Range.cpp:
+        (WebCore::Range::createContextualFragment):
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::setInnerHTML): Explicitly pass AllowScriptingContent. 
+        * editing/markup.cpp:
+        (WebCore::createFragmentFromMarkup):
+        (WebCore::createFragmentForInnerOuterHTML): Takes ExceptionCode now.
+        (WebCore::createContextualFragment): Share code with createFragmentForInnerOuterHTML
+        and propagate the exception code.
+        * editing/markup.h:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::setInnerHTML): Explicitly pass AllowScriptingContent.
+        (WebCore::HTMLElement::setOuterHTML): Ditto.
+        (WebCore::HTMLElement::insertAdjacentHTML): Ditto; also rename ignoredEc to ignoredEC
+        per Darin's comment on the bug 87339.
+
 2012-05-25  John Knottenbelt  <[email protected]>
 
         Body scrollWidth() and scrollHeight() should be page scale-invariant

Modified: trunk/Source/WebCore/dom/Range.cpp (118569 => 118570)


--- trunk/Source/WebCore/dom/Range.cpp	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebCore/dom/Range.cpp	2012-05-25 22:02:32 UTC (rev 118570)
@@ -1124,12 +1124,9 @@
         return 0;
     }
 
-    RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup, toElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted);
-
-    if (!fragment) {
-        ec = NOT_SUPPORTED_ERR;
+    RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup, toHTMLElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted, ec);
+    if (!fragment)
         return 0;
-    }
 
     return fragment.release();
 }

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (118569 => 118570)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-05-25 22:02:32 UTC (rev 118570)
@@ -144,7 +144,7 @@
 
 void ShadowRoot::setInnerHTML(const String& markup, ExceptionCode& ec)
 {
-    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, host(), ec))
+    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, host(), AllowScriptingContent, ec))
         replaceChildrenWithFragment(this, fragment.release(), ec);
 }
 

Modified: trunk/Source/WebCore/editing/markup.cpp (118569 => 118570)


--- trunk/Source/WebCore/editing/markup.cpp	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebCore/editing/markup.cpp	2012-05-25 22:02:32 UTC (rev 118570)
@@ -665,7 +665,9 @@
 {
     // We use a fake body element here to trick the HTML parser to using the InBody insertion mode.
     RefPtr<HTMLBodyElement> fakeBody = HTMLBodyElement::create(document);
-    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, fakeBody.get(), scriptingPermission);
+    // Ignore exceptions here since this function is used to parse markup for pasting or for other editing purposes.
+    ExceptionCode ignoredEC;
+    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, fakeBody.get(), scriptingPermission, ignoredEC);
 
     if (fragment && !baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL())
         completeURLs(fragment.get(), baseURL);
@@ -992,19 +994,19 @@
     return markup.toString();
 }
 
-PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ExceptionCode& ec)
+PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, FragmentScriptingPermission scriptingPermission, ExceptionCode& ec)
 {
     Document* document = contextElement->document();
     RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
 
     if (document->isHTMLDocument()) {
-        fragment->parseHTML(markup, contextElement);
+        fragment->parseHTML(markup, contextElement, scriptingPermission);
         return fragment;
     }
 
-    bool wasValid = fragment->parseXML(markup, contextElement);
+    bool wasValid = fragment->parseXML(markup, contextElement, scriptingPermission);
     if (!wasValid) {
-        ec = INVALID_STATE_ERR;
+        ec = SYNTAX_ERR;
         return 0;
     }
     return fragment.release();
@@ -1050,25 +1052,24 @@
     ASSERT(!ignoredExceptionCode);
 }
 
-PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, Element* element,  FragmentScriptingPermission scriptingPermission)
+PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTMLElement* element, FragmentScriptingPermission scriptingPermission, ExceptionCode& ec)
 {
     ASSERT(element);
-    HTMLElement* htmlElement = toHTMLElement(element);
-    if (htmlElement->ieForbidsInsertHTML())
+    if (element->ieForbidsInsertHTML()) {
+        ec = NOT_SUPPORTED_ERR;
         return 0;
+    }
 
-    if (htmlElement->hasLocalName(colTag) || htmlElement->hasLocalName(colgroupTag) || htmlElement->hasLocalName(framesetTag)
-        || htmlElement->hasLocalName(headTag) || htmlElement->hasLocalName(styleTag) || htmlElement->hasLocalName(titleTag))
+    if (element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag)
+        || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) {
+        ec = NOT_SUPPORTED_ERR;
         return 0;
+    }
 
-    // FIXME: This code is almost identical to createFragmentForInnerOuterHTML except this code doesn't handle exceptions.
-    RefPtr<DocumentFragment> fragment = element->document()->createDocumentFragment();
+    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, scriptingPermission, ec);
+    if (!fragment)
+        return 0;
 
-    if (element->document()->isHTMLDocument())
-        fragment->parseHTML(markup, element, scriptingPermission);
-    else if (!fragment->parseXML(markup, element, scriptingPermission))
-        return 0; // FIXME: We should propagate a syntax error exception out here.
-
     // We need to pop <html> and <body> elements and remove <head> to
     // accommodate folks passing complete HTML documents to make the
     // child of an element.

Modified: trunk/Source/WebCore/editing/markup.h (118569 => 118570)


--- trunk/Source/WebCore/editing/markup.h	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebCore/editing/markup.h	2012-05-25 22:02:32 UTC (rev 118570)
@@ -37,6 +37,7 @@
     class Document;
     class DocumentFragment;
     class Element;
+    class HTMLElement;
     class KURL;
     class Node;
     class QualifiedName;
@@ -51,9 +52,9 @@
     PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, FragmentScriptingPermission = AllowScriptingContent);
     PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document*, const String& markup, unsigned fragmentStart, unsigned fragmentEnd, const String& baseURL, FragmentScriptingPermission);
     PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&);
-    PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, ExceptionCode&);
+    PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, FragmentScriptingPermission, ExceptionCode&);
     PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String&, const String& sourceMIMEType, Document* outputDoc);
-    PassRefPtr<DocumentFragment> createContextualFragment(const String&, Element*,  FragmentScriptingPermission);
+    PassRefPtr<DocumentFragment> createContextualFragment(const String&, HTMLElement*, FragmentScriptingPermission, ExceptionCode&);
 
     bool isPlainTextMarkup(Node *node);
 

Modified: trunk/Source/WebCore/html/HTMLElement.cpp (118569 => 118570)


--- trunk/Source/WebCore/html/HTMLElement.cpp	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebCore/html/HTMLElement.cpp	2012-05-25 22:02:32 UTC (rev 118570)
@@ -342,7 +342,7 @@
 
 void HTMLElement::setInnerHTML(const String& html, ExceptionCode& ec)
 {
-    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, ec))
+    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, ec))
         replaceChildrenWithFragment(this, fragment.release(), ec);
 }
 
@@ -373,7 +373,7 @@
     RefPtr<Node> prev = previousSibling();
     RefPtr<Node> next = nextSibling();
 
-    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), ec);
+    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, ec);
     if (ec)
         return;
       
@@ -578,9 +578,8 @@
     Element* contextElement = contextElementForInsertion(where, this, ec);
     if (!contextElement)
         return;
-    ExceptionCode ignoredEc = 0; // FIXME: We should propagate a syntax error exception out here.
-    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, this, ignoredEc);
-    if (ignoredEc)
+    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, this, AllowScriptingContent, ec);
+    if (!fragment)
         return;
     insertAdjacent(where, fragment.get(), ec);
 }

Modified: trunk/Source/WebKit/qt/Api/qwebelement.cpp (118569 => 118570)


--- trunk/Source/WebKit/qt/Api/qwebelement.cpp	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebKit/qt/Api/qwebelement.cpp	2012-05-25 22:02:32 UTC (rev 118570)
@@ -1011,9 +1011,9 @@
     if (!m_element->isHTMLElement())
         return;
 
-    RefPtr<DocumentFragment> fragment =  createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent);
-
     ExceptionCode exception = 0;
+    RefPtr<DocumentFragment> fragment =  createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent, exception);
+
     m_element->appendChild(fragment, exception);
 }
 
@@ -1056,9 +1056,8 @@
     if (!m_element->isHTMLElement())
         return;
 
-    RefPtr<DocumentFragment> fragment =  createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent);
-
     ExceptionCode exception = 0;
+    RefPtr<DocumentFragment> fragment =  createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent, exception);
 
     if (m_element->hasChildNodes())
         m_element->insertBefore(fragment, m_element->firstChild(), exception);
@@ -1108,9 +1107,9 @@
     if (!parent->isHTMLElement())
         return;
 
-    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent);
-
     ExceptionCode exception = 0;
+    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent, exception);
+
     parent->insertBefore(fragment, m_element, exception);
 }
 
@@ -1158,9 +1157,9 @@
     if (!parent->isHTMLElement())
         return;
 
-    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent);
-
     ExceptionCode exception = 0;
+    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent, exception);
+
     if (!m_element->nextSibling())
         parent->appendChild(fragment, exception);
     else
@@ -1304,7 +1303,8 @@
     if (!m_element->isHTMLElement())
         return;
 
-    RefPtr<DocumentFragment> fragment =  createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent);
+    ExceptionCode exception = 0;
+    RefPtr<DocumentFragment> fragment =  createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent, exception);
 
     if (!fragment || !fragment->firstChild())
         return;
@@ -1314,8 +1314,6 @@
     if (!insertionPoint)
         return;
 
-    ExceptionCode exception = 0;
-
     // reparent children
     for (RefPtr<Node> child = m_element->firstChild(); child;) {
         RefPtr<Node> next = child->nextSibling();
@@ -1379,7 +1377,8 @@
     if (!parent->isHTMLElement())
         return;
 
-    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent);
+    ExceptionCode exception = 0;
+    RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent, exception);
 
     if (!fragment || !fragment->firstChild())
         return;
@@ -1395,7 +1394,6 @@
     // we no longer have access to the nodes it contained.
     Node* siblingNode = m_element->nextSibling();
 
-    ExceptionCode exception = 0;
     insertionPoint->appendChild(m_element, exception);
 
     if (!siblingNode)

Modified: trunk/Source/WebKit/qt/ChangeLog (118569 => 118570)


--- trunk/Source/WebKit/qt/ChangeLog	2012-05-25 21:48:51 UTC (rev 118569)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-05-25 22:02:32 UTC (rev 118570)
@@ -1,3 +1,20 @@
+2012-05-24  Ryosuke Niwa  <[email protected]>
+
+        createContextualFragment and insertAdjacentHTML should throw syntax error
+        https://bugs.webkit.org/show_bug.cgi?id=87454
+
+        Reviewed by Darin Adler.
+
+        Pass an ExceptionCode to createContextualFragment.
+
+        * Api/qwebelement.cpp:
+        (QWebElement::appendInside):
+        (QWebElement::prependInside):
+        (QWebElement::prependOutside):
+        (QWebElement::appendOutside):
+        (QWebElement::encloseContentsWith):
+        (QWebElement::encloseWith):
+
 2012-05-25  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Buildfix for newer Qt5
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to