<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[168003] releases/WebKitGTK/webkit-2.2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/168003">168003</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-04-30 03:13:23 -0700 (Wed, 30 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/165821">r165821</a> - Mutating rules returned by getMatchedCSSRules can result in crash
https://bugs.webkit.org/show_bug.cgi?id=130209

Source/WebCore:

Reviewed by Andreas Kling.

The non-standard getMatchedCSSRules API returns CSSStyleRule objects that don't
have parent stylesheet pointer (as we don't know which sheet the rule originated from).
Mutating the rule via such wrapper can lead to crashes later as we fail to invalidate
the underlying stylesheet.

Fix by disallowing mutation of style rules that don't have parent sheet pointer. CSSStyleRule
has two mutable properties selectorText and style. The latter gives back CSSStyleDeclaration.
This patch disallows mutations in both cases for CSSStyleRules that don't have parent stylesheet
pointer.

While it is technically possible to have CSSRules that are legitimately disconnected
from stylesheet (by removing rule from sheet while holding a reference to it) it never
makes sense to mutate such rule as there is no way to do anything with it afterwards.

Tests: fast/css/getMatchedCSSProperties-rule-mutation.html
       fast/css/getMatchedCSSRules-crash.html

* css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::setSelectorText):

    Bail out if parent stylesheet is null.

* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::setCssText):
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::removeProperty):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):

    Allow StyleRuleCSSStyleDeclaration subclass cancel the mutation via
    boolean return value from willMutate.

(WebCore::StyleRuleCSSStyleDeclaration::willMutate):

    Disallow mutation if the owning CSSStyleRule is null or has null stylesheet.

(WebCore::StyleRuleCSSStyleDeclaration::didMutate):

    We never get here with null rule or stylesheet anymore.

* css/PropertySetCSSStyleDeclaration.h:
(WebCore::PropertySetCSSStyleDeclaration::willMutate):

LayoutTests:

Reviewed by Andreas Kling.

* fast/css/getMatchedCSSProperties-rule-mutation-expected.txt: Added.
* fast/css/getMatchedCSSProperties-rule-mutation.html: Added.
* fast/css/getMatchedCSSRules-crash-expected.txt: Added.
* fast/css/getMatchedCSSRules-crash.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit22LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.2/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCorecssCSSStyleRulecpp">releases/WebKitGTK/webkit-2.2/Source/WebCore/css/CSSStyleRule.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCorecssPropertySetCSSStyleDeclarationcpp">releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCorecssPropertySetCSSStyleDeclarationh">releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSPropertiesrulemutationexpectedtxt">releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSPropertiesrulemutationhtml">releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation.html</a></li>
<li><a href="#releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSRulescrashexpectedtxt">releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSRulescrashhtml">releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit22LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/LayoutTests/ChangeLog (168002 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/LayoutTests/ChangeLog        2014-04-30 09:48:43 UTC (rev 168002)
+++ releases/WebKitGTK/webkit-2.2/LayoutTests/ChangeLog        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-03-18  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Mutating rules returned by getMatchedCSSRules can result in crash
+        https://bugs.webkit.org/show_bug.cgi?id=130209
+
+        Reviewed by Andreas Kling.
+
+        * fast/css/getMatchedCSSProperties-rule-mutation-expected.txt: Added.
+        * fast/css/getMatchedCSSProperties-rule-mutation.html: Added.
+        * fast/css/getMatchedCSSRules-crash-expected.txt: Added.
+        * fast/css/getMatchedCSSRules-crash.html: Added.
+
</ins><span class="cx"> 2014-03-08  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         SerializedScriptValue may move Identifiers between worlds
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSPropertiesrulemutationexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation-expected.txt (0 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation-expected.txt        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+Test that CSSStyleRules returned by getMatchedCSSRules can't be mutated
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS rules.length is 2
+PASS rules[0].selectorText is originalText
+PASS rules[1].selectorText is originalText
+PASS rules[0].style.cssText is originalText
+PASS rules[1].style.cssText is originalText
+PASS rules[0].style.color is originalText
+PASS rules[1].style.color is originalText
+PASS rules[0].style.getPropertyValue('color') is originalText
+PASS rules[1].style.getPropertyValue('color') is originalText
+PASS rules[0].style.color is originalText
+PASS rules[1].style.color is originalText
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSPropertiesrulemutationhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation.html (0 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSProperties-rule-mutation.html        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+#test { color: blue; }
+@media all {
+    #test { color: blue; }
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=test&gt;
+&lt;/div&gt;
+&lt;script&gt;
+
+description(&quot;Test that CSSStyleRules returned by getMatchedCSSRules can't be mutated&quot;);
+
+var testDiv = document.getElementById('test');
+var rules = getMatchedCSSRules(testDiv);
+
+function tryMutateSelector(index) {
+    originalText = rules[index].selectorText;
+    rules[index].selectorText = &quot;#mutated&quot;;
+    shouldBe(&quot;rules[&quot;+index+&quot;].selectorText&quot;, &quot;originalText&quot;);
+}
+
+function tryMutateCSSText(index) {
+    originalText = rules[index].style.cssText;
+    rules[index].style.cssText = &quot;color: red&quot;;
+    shouldBe(&quot;rules[&quot;+index+&quot;].style.cssText&quot;, &quot;originalText&quot;);
+}
+
+function tryMutateProperty(index) {
+    originalText = rules[index].style.color;
+    rules[index].style.color = &quot;green&quot;;
+    shouldBe(&quot;rules[&quot;+index+&quot;].style.color&quot;, &quot;originalText&quot;);
+}
+
+function tryMutateProperty2(index) {
+    originalText = rules[index].style.getPropertyValue(&quot;color&quot;);
+    rules[index].style.setProperty(&quot;color&quot;, &quot;white&quot;);
+    shouldBe(&quot;rules[&quot;+index+&quot;].style.getPropertyValue('color')&quot;, &quot;originalText&quot;);
+}
+
+function tryRemoveProperty(index) {
+    originalText = rules[index].style.color;
+    rules[index].style.removeProperty(&quot;color&quot;);
+    shouldBe(&quot;rules[&quot;+index+&quot;].style.color&quot;, &quot;originalText&quot;);
+}
+
+shouldBe(&quot;rules.length&quot;, &quot;2&quot;);
+tryMutateSelector(0);
+tryMutateSelector(1);
+tryMutateCSSText(0);
+tryMutateCSSText(1);
+tryMutateProperty(0);
+tryMutateProperty(1);
+tryMutateProperty2(0);
+tryMutateProperty2(1);
+tryRemoveProperty(0);
+tryRemoveProperty(1);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSRulescrashexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash-expected.txt (0 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash-expected.txt        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This test passes if it doesn't crash. 
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit22LayoutTestsfastcssgetMatchedCSSRulescrashhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash.html (0 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.2/LayoutTests/fast/css/getMatchedCSSRules-crash.html        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;html&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+&lt;/script&gt;
+&lt;style&gt;html,tr,img, table,media,body, li, em:nth-child(5){
+    height: 500px
+}
+&lt;/style&gt;
+&lt;script&gt;
+function load() {
+    var cssRules = window.getMatchedCSSRules(document.documentElement);
+    cssRules[0].selectorText = 'a,td';
+}
+&lt;/script&gt;
+This test passes if it doesn't crash.
+&lt;iframe onload=load()&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog (168002 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog        2014-04-30 09:48:43 UTC (rev 168002)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2014-03-18  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Mutating rules returned by getMatchedCSSRules can result in crash
+        https://bugs.webkit.org/show_bug.cgi?id=130209
+
+        Reviewed by Andreas Kling.
+        
+        The non-standard getMatchedCSSRules API returns CSSStyleRule objects that don't
+        have parent stylesheet pointer (as we don't know which sheet the rule originated from).
+        Mutating the rule via such wrapper can lead to crashes later as we fail to invalidate
+        the underlying stylesheet.
+        
+        Fix by disallowing mutation of style rules that don't have parent sheet pointer. CSSStyleRule
+        has two mutable properties selectorText and style. The latter gives back CSSStyleDeclaration.
+        This patch disallows mutations in both cases for CSSStyleRules that don't have parent stylesheet
+        pointer.
+        
+        While it is technically possible to have CSSRules that are legitimately disconnected
+        from stylesheet (by removing rule from sheet while holding a reference to it) it never
+        makes sense to mutate such rule as there is no way to do anything with it afterwards.
+
+        Tests: fast/css/getMatchedCSSProperties-rule-mutation.html
+               fast/css/getMatchedCSSRules-crash.html
+
+        * css/CSSStyleRule.cpp:
+        (WebCore::CSSStyleRule::setSelectorText):
+
+            Bail out if parent stylesheet is null.
+
+        * css/PropertySetCSSStyleDeclaration.cpp:
+        (WebCore::PropertySetCSSStyleDeclaration::setCssText):
+        (WebCore::PropertySetCSSStyleDeclaration::setProperty):
+        (WebCore::PropertySetCSSStyleDeclaration::removeProperty):
+        (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
+        
+            Allow StyleRuleCSSStyleDeclaration subclass cancel the mutation via
+            boolean return value from willMutate.
+
+        (WebCore::StyleRuleCSSStyleDeclaration::willMutate):
+        
+            Disallow mutation if the owning CSSStyleRule is null or has null stylesheet.
+
+        (WebCore::StyleRuleCSSStyleDeclaration::didMutate):
+        
+            We never get here with null rule or stylesheet anymore.
+
+        * css/PropertySetCSSStyleDeclaration.h:
+        (WebCore::PropertySetCSSStyleDeclaration::willMutate):
+
</ins><span class="cx"> 2014-03-08  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         SerializedScriptValue may move Identifiers between worlds
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCorecssCSSStyleRulecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/css/CSSStyleRule.cpp (168002 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/css/CSSStyleRule.cpp        2014-04-30 09:48:43 UTC (rev 168002)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/css/CSSStyleRule.cpp        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -93,6 +93,11 @@
</span><span class="cx"> 
</span><span class="cx"> void CSSStyleRule::setSelectorText(const String&amp; selectorText)
</span><span class="cx"> {
</span><ins>+    // FIXME: getMatchedCSSRules can return CSSStyleRules that are missing parent stylesheet pointer while
+    // referencing StyleRules that are part of stylesheet. Disallow mutations in this case.
+    if (!parentStyleSheet())
+        return;
+
</ins><span class="cx">     CSSParser p(parserContext());
</span><span class="cx">     CSSSelectorList selectorList;
</span><span class="cx">     p.parseSelector(selectorText, selectorList);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCorecssPropertySetCSSStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (168002 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp        2014-04-30 09:48:43 UTC (rev 168002)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -150,7 +150,8 @@
</span><span class="cx"> void PropertySetCSSStyleDeclaration::setCssText(const String&amp; text, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     StyleAttributeMutationScope mutationScope(this);
</span><del>-    willMutate();
</del><ins>+    if (!willMutate())
+        return;
</ins><span class="cx"> 
</span><span class="cx">     ec = 0;
</span><span class="cx">     // FIXME: Detect syntax errors and set ec.
</span><span class="lines">@@ -208,10 +209,11 @@
</span><span class="cx">     if (!propertyID)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (!willMutate())
+        return;
+
</ins><span class="cx">     bool important = priority.find(&quot;important&quot;, 0, false) != notFound;
</span><span class="cx"> 
</span><del>-    willMutate();
-
</del><span class="cx">     ec = 0;
</span><span class="cx">     bool changed = m_propertySet-&gt;setProperty(propertyID, value, important, contextStyleSheet());
</span><span class="cx"> 
</span><span class="lines">@@ -231,7 +233,8 @@
</span><span class="cx">     if (!propertyID)
</span><span class="cx">         return String();
</span><span class="cx"> 
</span><del>-    willMutate();
</del><ins>+    if (!willMutate())
+        return String();
</ins><span class="cx"> 
</span><span class="cx">     ec = 0;
</span><span class="cx">     String result;
</span><span class="lines">@@ -257,7 +260,8 @@
</span><span class="cx"> void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String&amp; value, bool important, ExceptionCode&amp; ec)
</span><span class="cx"> { 
</span><span class="cx">     StyleAttributeMutationScope mutationScope(this);
</span><del>-    willMutate();
</del><ins>+    if (!willMutate())
+        return;
</ins><span class="cx"> 
</span><span class="cx">     ec = 0;
</span><span class="cx">     bool changed = m_propertySet-&gt;setProperty(propertyID, value, important, contextStyleSheet());
</span><span class="lines">@@ -320,20 +324,24 @@
</span><span class="cx">         delete this;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void StyleRuleCSSStyleDeclaration::willMutate()
</del><ins>+bool StyleRuleCSSStyleDeclaration::willMutate()
</ins><span class="cx"> {
</span><del>-    if (m_parentRule &amp;&amp; m_parentRule-&gt;parentStyleSheet())
-        m_parentRule-&gt;parentStyleSheet()-&gt;willMutateRules();
</del><ins>+    if (!m_parentRule || !m_parentRule-&gt;parentStyleSheet())
+        return false;
+    m_parentRule-&gt;parentStyleSheet()-&gt;willMutateRules();
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StyleRuleCSSStyleDeclaration::didMutate(MutationType type)
</span><span class="cx"> {
</span><ins>+    ASSERT(m_parentRule);
+    ASSERT(m_parentRule-&gt;parentStyleSheet());
+
</ins><span class="cx">     if (type == PropertyChanged)
</span><span class="cx">         m_cssomCSSValueClones.clear();
</span><span class="cx"> 
</span><span class="cx">     // Style sheet mutation needs to be signaled even if the change failed. willMutate*/didMutate* must pair.
</span><del>-    if (m_parentRule &amp;&amp; m_parentRule-&gt;parentStyleSheet())
-        m_parentRule-&gt;parentStyleSheet()-&gt;didMutateRuleFromCSSStyleDeclaration();
</del><ins>+    m_parentRule-&gt;parentStyleSheet()-&gt;didMutateRuleFromCSSStyleDeclaration();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> CSSStyleSheet* StyleRuleCSSStyleDeclaration::parentStyleSheet() const
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCorecssPropertySetCSSStyleDeclarationh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.h (168002 => 168003)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.h        2014-04-30 09:48:43 UTC (rev 168002)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/css/PropertySetCSSStyleDeclaration.h        2014-04-30 10:13:23 UTC (rev 168003)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">     
</span><span class="cx"> protected:
</span><span class="cx">     enum MutationType { NoChanges, PropertyChanged };
</span><del>-    virtual void willMutate() { }
</del><ins>+    virtual bool willMutate() WARN_UNUSED_RETURN { return true; }
</ins><span class="cx">     virtual void didMutate(MutationType) { }
</span><span class="cx"> 
</span><span class="cx">     MutableStylePropertySet* m_propertySet;
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule;  }
</span><span class="cx"> 
</span><del>-    virtual void willMutate() OVERRIDE;
</del><ins>+    virtual bool willMutate() OVERRIDE WARN_UNUSED_RETURN;
</ins><span class="cx">     virtual void didMutate(MutationType) OVERRIDE;
</span><span class="cx"> 
</span><span class="cx">     unsigned m_refCount;
</span></span></pre>
</div>
</div>

</body>
</html>