ASSERTION FAILED: extractedStyle in WebCore::ApplyStyleCommand::removeInlineStyleFrom...
authorreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Aug 2013 10:14:02 +0000 (10:14 +0000)
committerreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Aug 2013 10:14:02 +0000 (10:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119672

Reviewed by Darin Adler.

Source/WebCore:

The last extractedStyle parameter of removeInlineStyleFromElement() is not mandatory and it's set
to default 0. This way we have to check its existence before the usage.

Test: editing/execCommand/extracted_style_assert.html

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::removeInlineStyleFromElement):

LayoutTests:

Test with NULL extractedStyle.

* editing/execCommand/extracted_style_assert-expected.txt: Added.
* editing/execCommand/extracted_style_assert.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/editing/execCommand/extracted_style_assert-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/extracted_style_assert.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/ApplyStyleCommand.cpp

index f3fa727..97c359e 100644 (file)
@@ -1,3 +1,15 @@
+2013-08-22  Renata Hodovan  <reni@webkit.org>
+
+        ASSERTION FAILED: extractedStyle in WebCore::ApplyStyleCommand::removeInlineStyleFromElement
+        https://bugs.webkit.org/show_bug.cgi?id=119672
+
+        Reviewed by Darin Adler.
+
+        Test with NULL extractedStyle.
+
+        * editing/execCommand/extracted_style_assert-expected.txt: Added.
+        * editing/execCommand/extracted_style_assert.html: Added.
+
 2013-08-08  Sergio Villar Senin  <svillar@igalia.com>
 
         [CSS Grid Layout] Refactor testing code
diff --git a/LayoutTests/editing/execCommand/extracted_style_assert-expected.txt b/LayoutTests/editing/execCommand/extracted_style_assert-expected.txt
new file mode 100644 (file)
index 0000000..2afa0bf
--- /dev/null
@@ -0,0 +1 @@
+PASS. WebKit didn't crash.
diff --git a/LayoutTests/editing/execCommand/extracted_style_assert.html b/LayoutTests/editing/execCommand/extracted_style_assert.html
new file mode 100644 (file)
index 0000000..d82a14a
--- /dev/null
@@ -0,0 +1,19 @@
+<html>
+    <body>
+        <table>
+            <td>
+                <a></a>                      
+            </td>
+        </table>
+        <script>
+            if (window.testRunner)
+                testRunner.dumpAsText();
+
+            document.designMode = "on"; 
+            document.execCommand("SelectAll"); 
+            document.execCommand("CreateLink", 0, 'foo');
+
+            document.body.innerHTML = "PASS. WebKit didn't crash.";
+        </script>
+   </body>
+</html>
index aaff8fa..1477e92 100644 (file)
@@ -1,3 +1,18 @@
+2013-08-22  Renata Hodovan  <reni@webkit.org>
+
+        ASSERTION FAILED: extractedStyle in WebCore::ApplyStyleCommand::removeInlineStyleFromElement
+        https://bugs.webkit.org/show_bug.cgi?id=119672
+
+        Reviewed by Darin Adler.
+
+        The last extractedStyle parameter of removeInlineStyleFromElement() is not mandatory and it's set
+        to default 0. This way we have to check its existence before the usage.
+
+        Test: editing/execCommand/extracted_style_assert.html
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
+
 2013-08-21  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r154416.
index e938070..f947ab6 100644 (file)
@@ -887,8 +887,8 @@ bool ApplyStyleCommand::removeInlineStyleFromElement(EditingStyle* style, PassRe
     if (isStyledInlineElementToRemove(element.get())) {
         if (mode == RemoveNone)
             return true;
-        ASSERT(extractedStyle);
-        extractedStyle->mergeInlineStyleOfElement(element.get(), EditingStyle::OverrideValues);
+        if (extractedStyle)
+            extractedStyle->mergeInlineStyleOfElement(element.get(), EditingStyle::OverrideValues);
         removeNodePreservingChildren(element);
         return true;
     }