ASSERTION FAILED: isHTMLTitleElement(m_titleElement.get()) in WebCore::Document:...
authorreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Nov 2013 19:16:38 +0000 (19:16 +0000)
committerreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Nov 2013 19:16:38 +0000 (19:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122092

Reviewed by Darin Adler.

Source/WebCore:

Remove a bogus assert in Document::setTitle().
m_titleElement can be either of HTMLTitleElement or SVGTitleElement. The assertion was wrong.

Backported from Blink:
https://src.chromium.org/viewvc/blink?revision=158620&view=revision

Test: svg/custom/title-assertion.html

* dom/Document.cpp:
(WebCore::Document::setTitle):
* svg/SVGTitleElement.cpp:
(WebCore::SVGTitleElement::insertedInto):

LayoutTests:

* svg/custom/title-assertion-expected.txt: Added.
* svg/custom/title-assertion.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158682 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/svg/custom/title-assertion-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/title-assertion.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/svg/SVGTitleElement.cpp

index b71908e..5ca6196 100644 (file)
@@ -1,3 +1,13 @@
+2013-11-05  Renata Hodovan  <reni@webkit.org>
+
+        ASSERTION FAILED: isHTMLTitleElement(m_titleElement.get()) in WebCore::Document::setTitle
+        https://bugs.webkit.org/show_bug.cgi?id=122092
+
+        Reviewed by Darin Adler.
+
+        * svg/custom/title-assertion-expected.txt: Added.
+        * svg/custom/title-assertion.html: Added.
+
 2013-11-05  Martin Robinson  <mrobinson@igalia.com>
 
         [MathML] Poor spacing around delimiters in MathML Torture Test 14
diff --git a/LayoutTests/svg/custom/title-assertion-expected.txt b/LayoutTests/svg/custom/title-assertion-expected.txt
new file mode 100644 (file)
index 0000000..5dff2e9
--- /dev/null
@@ -0,0 +1,10 @@
+We had a bug that updating document.title caused an assertion failure.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS if any assertion does not fail.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/custom/title-assertion.html b/LayoutTests/svg/custom/title-assertion.html
new file mode 100644 (file)
index 0000000..dfd6ad1
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+       <script src="../../resources/js-test-pre.js"></script>
+       <svg>
+               <title>title</title>
+       </svg>
+
+       <script>
+               document.title = 'New title';
+               description('We had a bug that updating document.title caused an assertion failure.');
+               testPassed('if any assertion does not fail.');
+       </script>
+       
+       <script src="../../resources/js-test-post.js"></script>
+</html>
\ No newline at end of file
index 8f3fa7a..ef0f1c6 100644 (file)
@@ -1,3 +1,23 @@
+2013-11-05  Renata Hodovan  <reni@webkit.org>
+
+        ASSERTION FAILED: isHTMLTitleElement(m_titleElement.get()) in WebCore::Document::setTitle
+        https://bugs.webkit.org/show_bug.cgi?id=122092
+
+        Reviewed by Darin Adler.
+
+        Remove a bogus assert in Document::setTitle().
+        m_titleElement can be either of HTMLTitleElement or SVGTitleElement. The assertion was wrong.
+        
+        Backported from Blink:
+        https://src.chromium.org/viewvc/blink?revision=158620&view=revision
+
+        Test: svg/custom/title-assertion.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::setTitle):
+        * svg/SVGTitleElement.cpp:
+        (WebCore::SVGTitleElement::insertedInto):
+
 2013-11-05  Martin Robinson  <mrobinson@igalia.com>
 
         [MathML] Poor spacing around delimiters in MathML Torture Test 14
index ed6a1df..20b9f1f 100644 (file)
@@ -1477,11 +1477,8 @@ void Document::setTitle(const String& title)
     // The DOM API has no method of specifying direction, so assume LTR.
     updateTitle(StringWithDirection(title, LTR));
 
-    if (m_titleElement) {
-        ASSERT(isHTMLTitleElement(m_titleElement.get()));
-        if (isHTMLTitleElement(m_titleElement.get()))
-            toHTMLTitleElement(m_titleElement.get())->setText(title);
-    }
+    if (m_titleElement && isHTMLTitleElement(m_titleElement.get()))
+        toHTMLTitleElement(m_titleElement.get())->setText(title);
 }
 
 void Document::setTitleElement(const StringWithDirection& title, Element* titleElement)
index 62c6349..d805b85 100644 (file)
@@ -43,6 +43,7 @@ Node::InsertionNotificationRequest SVGTitleElement::insertedInto(ContainerNode&
     SVGElement::insertedInto(rootParent);
     if (!rootParent.inDocument())
         return InsertionDone;
+    // FIXME: It's possible to register SVGTitleElement to an HTMLDocument.
     if (firstChild())
         // FIXME: does SVG have a title text direction?
         document().setTitleElement(StringWithDirection(textContent(), LTR), this);