<!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>[199003] trunk/Source/WebCore</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/199003">199003</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-04-04 05:56:33 -0700 (Mon, 04 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Enable assertions against DOM mutations in RenderTreeUpdater
https://bugs.webkit.org/show_bug.cgi?id=156156
Reviewed by Andreas Kling.
Ensure we don't mutate DOM or dispatch events during render tree updates.
* WebCore.xcodeproj/project.pbxproj:
* dom/ContainerNode.cpp:
* dom/ContainerNode.h:
(WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Deleted.
(WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Deleted.
(WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Deleted.
Move NoEventDispatchAssertion to a header of its own.
* dom/NoEventDispatchAssertion.h: Added.
(WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion):
(WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion):
(WebCore::NoEventDispatchAssertion::isEventDispatchForbidden):
(WebCore::NoEventDispatchAssertion::dropTemporarily):
(WebCore::NoEventDispatchAssertion::restoreDropped):
Add a way to disable event assertions temporarily.
* loader/cache/CachedSVGFont.cpp:
(WebCore::CachedSVGFont::ensureCustomFontData):
Temporary SVG font document may get constructed during render tree update. These can't run scripts or generally
affect anything outside the font document as it does not have a frame. Disable event assertions temporarily.
Tested by svg/W3C-SVG-1.1/fonts-elem-07-b.svg
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateRenderTree):
Enable assertions.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeh">trunk/Source/WebCore/dom/ContainerNode.h</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeAlgorithmscpp">trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementIteratorAssertionsh">trunk/Source/WebCore/dom/ElementIteratorAssertions.h</a></li>
<li><a href="#trunkSourceWebCoredomEventDispatchercpp">trunk/Source/WebCore/dom/EventDispatcher.cpp</a></li>
<li><a href="#trunkSourceWebCoredomEventTargetcpp">trunk/Source/WebCore/dom/EventTarget.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodecpp">trunk/Source/WebCore/dom/Node.cpp</a></li>
<li><a href="#trunkSourceWebCoredomScriptExecutionContextcpp">trunk/Source/WebCore/dom/ScriptExecutionContext.cpp</a></li>
<li><a href="#trunkSourceWebCoredomWebKitNamedFlowcpp">trunk/Source/WebCore/dom/WebKitNamedFlow.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryPageCachecpp">trunk/Source/WebCore/history/PageCache.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedSVGFontcpp">trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleRenderTreeUpdatercpp">trunk/Source/WebCore/style/RenderTreeUpdater.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomNoEventDispatchAssertionh">trunk/Source/WebCore/dom/NoEventDispatchAssertion.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/ChangeLog        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2016-04-04 Antti Koivisto <antti@apple.com>
+
+ Enable assertions against DOM mutations in RenderTreeUpdater
+ https://bugs.webkit.org/show_bug.cgi?id=156156
+
+ Reviewed by Andreas Kling.
+
+ Ensure we don't mutate DOM or dispatch events during render tree updates.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/ContainerNode.cpp:
+ * dom/ContainerNode.h:
+ (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Deleted.
+ (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Deleted.
+ (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Deleted.
+
+ Move NoEventDispatchAssertion to a header of its own.
+
+ * dom/NoEventDispatchAssertion.h: Added.
+ (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion):
+ (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion):
+ (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden):
+ (WebCore::NoEventDispatchAssertion::dropTemporarily):
+ (WebCore::NoEventDispatchAssertion::restoreDropped):
+
+ Add a way to disable event assertions temporarily.
+
+ * loader/cache/CachedSVGFont.cpp:
+ (WebCore::CachedSVGFont::ensureCustomFontData):
+
+ Temporary SVG font document may get constructed during render tree update. These can't run scripts or generally
+ affect anything outside the font document as it does not have a frame. Disable event assertions temporarily.
+
+ Tested by svg/W3C-SVG-1.1/fonts-elem-07-b.svg
+
+ * style/RenderTreeUpdater.cpp:
+ (WebCore::RenderTreeUpdater::updateRenderTree):
+
+ Enable assertions.
+
</ins><span class="cx"> 2016-04-04 Emanuele Aina <emanuele.aina@collabora.com>
</span><span class="cx">
</span><span class="cx"> [TexMap] Trim redundant guards
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -6625,6 +6625,7 @@
</span><span class="cx">                 E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E462A4A0113E71BE004A4220 /* IntPointHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                E46B41F91CB24E70008F11DE /* NoEventDispatchAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E47127CA163438A100ED6F5A /* StyleInvalidationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */; };
</span><span class="cx">                 E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */; };
</span><span class="cx">                 E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */; };
</span><span class="lines">@@ -14657,6 +14658,7 @@
</span><span class="cx">                 E462A4A0113E71BE004A4220 /* IntPointHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntPointHash.h; sourceTree = "<group>"; };
</span><span class="cx">                 E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedElementDescendantIterator.h; sourceTree = "<group>"; };
</span><span class="cx">                 E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementChildIterator.h; sourceTree = "<group>"; };
</span><ins>+                E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoEventDispatchAssertion.h; sourceTree = "<group>"; };
</ins><span class="cx">                 E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomEvent.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = "<group>"; };
</span><span class="cx">                 E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSharingResolver.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -24420,6 +24422,7 @@
</span><span class="cx">                                 E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */,
</span><span class="cx">                                 E43105BA16750F1600DB2FB8 /* NodeTraversal.h */,
</span><span class="cx">                                 9382AAB10D8C386100F357A6 /* NodeWithIndex.h */,
</span><ins>+                                E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */,
</ins><span class="cx">                                 8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */,
</span><span class="cx">                                 7C6752BA1B06E82000C279CB /* NonElementParentNode.idl */,
</span><span class="cx">                                 1A0D57340A5C77FE007EDD4C /* OverflowEvent.cpp */,
</span><span class="lines">@@ -26306,6 +26309,7 @@
</span><span class="cx">                                 5185FC991BB4C4E80012898F /* IDBKeyPath.h in Headers */,
</span><span class="cx">                                 5185FC9B1BB4C4E80012898F /* IDBKeyRange.h in Headers */,
</span><span class="cx">                                 5185FC9E1BB4C4E80012898F /* IDBKeyRangeData.h in Headers */,
</span><ins>+                                E46B41F91CB24E70008F11DE /* NoEventDispatchAssertion.h in Headers */,
</ins><span class="cx">                                 5185FCA01BB4C4E80012898F /* IDBObjectStore.h in Headers */,
</span><span class="cx">                                 5160712F1BD8307800DBC4F2 /* IDBObjectStoreInfo.h in Headers */,
</span><span class="cx">                                 5185FCA41BB4C4E80012898F /* IDBOpenDBRequest.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include "LabelsNodeList.h"
</span><span class="cx"> #include "MutationEvent.h"
</span><span class="cx"> #include "NameNodeList.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "NodeOrString.h"
</span><span class="cx"> #include "NodeRareData.h"
</span><span class="cx"> #include "NodeRenderStyle.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.h (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.h        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/ContainerNode.h        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -34,49 +34,6 @@
</span><span class="cx"> class RadioNodeList;
</span><span class="cx"> class RenderElement;
</span><span class="cx">
</span><del>-class NoEventDispatchAssertion {
-public:
- NoEventDispatchAssertion()
- {
-#if !ASSERT_DISABLED
- if (!isMainThread())
- return;
- ++s_count;
-#endif
- }
-
- NoEventDispatchAssertion(const NoEventDispatchAssertion&)
- : NoEventDispatchAssertion()
- {
- }
-
- ~NoEventDispatchAssertion()
- {
-#if !ASSERT_DISABLED
- if (!isMainThread())
- return;
- ASSERT(s_count);
- s_count--;
-#endif
- }
-
- static bool isEventDispatchForbidden()
- {
-#if ASSERT_DISABLED
- return false;
-#else
- return isMainThread() && s_count;
-#endif
- }
-
-#if !ASSERT_DISABLED
-
-private:
- WEBCORE_EXPORT static unsigned s_count;
-
-#endif
-};
-
</del><span class="cx"> class ContainerNode : public Node {
</span><span class="cx"> public:
</span><span class="cx"> virtual ~ContainerNode();
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeAlgorithmscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ContainerNodeAlgorithms.h"
</span><span class="cx">
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx"> #include "MutationEvent.h"
</span><span class="cx"> #include "NameNodeList.h"
</span><span class="cx"> #include "NestingLevelIncrementer.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "NodeIterator.h"
</span><span class="cx"> #include "NodeRareData.h"
</span><span class="cx"> #include "NodeWithIndex.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "MutationObserverInterestGroup.h"
</span><span class="cx"> #include "MutationRecord.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "PlatformWheelEvent.h"
</span><span class="cx"> #include "PointerLockController.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementIteratorAssertionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ElementIteratorAssertions.h (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ElementIteratorAssertions.h        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/ElementIteratorAssertions.h        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define ElementIteratorAssertions_h
</span><span class="cx">
</span><span class="cx"> #include "Element.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventDispatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventDispatcher.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "FrameView.h"
</span><span class="cx"> #include "HTMLInputElement.h"
</span><span class="cx"> #include "MouseEvent.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "PseudoElement.h"
</span><span class="cx"> #include "ScopedEventQueue.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventTargetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventTarget.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventTarget.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/EventTarget.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">
</span><span class="cx"> #include "ExceptionCode.h"
</span><span class="cx"> #include "InspectorInstrumentation.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "ScriptController.h"
</span><span class="cx"> #include "WebKitAnimationEvent.h"
</span><span class="cx"> #include "WebKitTransitionEvent.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomNoEventDispatchAssertionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/NoEventDispatchAssertion.h (0 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NoEventDispatchAssertion.h         (rev 0)
+++ trunk/Source/WebCore/dom/NoEventDispatchAssertion.h        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004-2016 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NoEventDispatchAssertion_h
+#define NoEventDispatchAssertion_h
+
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+class NoEventDispatchAssertion {
+public:
+ NoEventDispatchAssertion()
+ {
+#if !ASSERT_DISABLED
+ if (!isMainThread())
+ return;
+ ++s_count;
+#endif
+ }
+
+ NoEventDispatchAssertion(const NoEventDispatchAssertion&)
+ : NoEventDispatchAssertion()
+ {
+ }
+
+ ~NoEventDispatchAssertion()
+ {
+#if !ASSERT_DISABLED
+ if (!isMainThread())
+ return;
+ ASSERT(s_count);
+ s_count--;
+#endif
+ }
+
+ static bool isEventDispatchForbidden()
+ {
+#if ASSERT_DISABLED
+ return false;
+#else
+ return isMainThread() && s_count;
+#endif
+ }
+
+ static unsigned dropTemporarily()
+ {
+#if ASSERT_DISABLED
+ return 0;
+#else
+ unsigned count = s_count;
+ s_count = 0;
+ return count;
+#endif
+ }
+
+ static void restoreDropped(unsigned count)
+ {
+#if ASSERT_DISABLED
+ UNUSED_PARAM(count);
+#else
+ ASSERT(!s_count);
+ s_count = count;
+#endif
+ }
+
+#if !ASSERT_DISABLED
+private:
+ WEBCORE_EXPORT static unsigned s_count;
+#endif
+};
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/Node.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include "KeyboardEvent.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MutationEvent.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "NodeOrString.h"
</span><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "ProcessingInstruction.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptExecutionContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "ErrorEvent.h"
</span><span class="cx"> #include "MessagePort.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "PublicURLManager.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "WorkerGlobalScope.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomWebKitNamedFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/WebKitNamedFlow.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/WebKitNamedFlow.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/dom/WebKitNamedFlow.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "WebKitNamedFlow.h"
</span><span class="cx">
</span><span class="cx"> #include "NamedFlowCollection.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "RenderNamedFlowFragment.h"
</span><span class="cx"> #include "RenderNamedFlowThread.h"
</span><span class="cx"> #include "RenderRegion.h"
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryPageCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/PageCache.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/PageCache.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/history/PageCache.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "MemoryPressureHandler.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "SubframeLoader.h"
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> #include "MediaResourceLoader.h"
</span><span class="cx"> #include "MemoryPressureHandler.h"
</span><span class="cx"> #include "NetworkingContext.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "PageGroup.h"
</span><span class="cx"> #include "PageThrottler.h"
</span><span class="cx"> #include "PlatformMediaSessionManager.h"
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedSVGFontcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx">
</span><span class="cx"> #include "FontDescription.h"
</span><span class="cx"> #include "FontPlatformData.h"
</span><ins>+#include "NoEventDispatchAssertion.h"
</ins><span class="cx"> #include "SVGDocument.h"
</span><span class="cx"> #include "SVGFontElement.h"
</span><span class="cx"> #include "SVGFontFaceElement.h"
</span><span class="lines">@@ -64,9 +65,16 @@
</span><span class="cx"> bool CachedSVGFont::ensureCustomFontData(const AtomicString& remoteURI)
</span><span class="cx"> {
</span><span class="cx"> if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) {
</span><ins>+ // We may get here during render tree updates when events are forbidden.
+ // Frameless document can't run scripts or call back to the client so this is safe.
+ auto count = NoEventDispatchAssertion::dropTemporarily();
+
</ins><span class="cx"> m_externalSVGDocument = SVGDocument::create(nullptr, URL());
</span><span class="cx"> RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml");
</span><span class="cx"> m_externalSVGDocument->setContent(decoder->decodeAndFlush(m_data->data(), m_data->size()));
</span><ins>+
+ NoEventDispatchAssertion::restoreDropped(count);
+
</ins><span class="cx"> if (decoder->sawError())
</span><span class="cx"> m_externalSVGDocument = nullptr;
</span><span class="cx"> if (m_externalSVGDocument)
</span></span></pre></div>
<a id="trunkSourceWebCorestyleRenderTreeUpdatercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (199002 => 199003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp        2016-04-04 10:26:28 UTC (rev 199002)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp        2016-04-04 12:56:33 UTC (rev 199003)
</span><span class="lines">@@ -109,9 +109,6 @@
</span><span class="cx"> auto it = descendants.begin();
</span><span class="cx"> auto end = descendants.end();
</span><span class="cx">
</span><del>- // FIXME: SVG <use> element may cause tree mutations during style recalc.
- it.dropAssertions();
-
</del><span class="cx"> while (it != end) {
</span><span class="cx"> popParentsToDepth(it.depth());
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>