<!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>[226251] 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/226251">226251</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2017-12-21 17:10:32 -0800 (Thu, 21 Dec 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename NoEventDispatchAssertion to ScriptDisallowedScope
https://bugs.webkit.org/show_bug.cgi?id=181102

Reviewed by Zalan Bujtas.

Renamed the class.

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::canExecuteScripts):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
(WebCore::ContainerNode::removeNodeWithScriptAssertion):
(WebCore::executeNodeInsertionWithScriptAssertion):
(WebCore::ContainerNode::removeDetachedChildren):
(WebCore::ContainerNode::insertBeforeCommon):
(WebCore::ContainerNode::appendChildCommon):
(WebCore::ContainerNode::removeBetween):
(WebCore::dispatchChildInsertionEvents):
(WebCore::dispatchChildRemovalEvents):
* dom/ContainerNodeAlgorithms.cpp:
(WebCore::notifyChildNodeInserted):
(WebCore::notifyChildNodeRemoved):
* dom/Document.cpp:
(WebCore::Document::resolveStyle):
(WebCore::isSafeToUpdateStyleOrLayout):
(WebCore::Document::updateStyleIfNeeded):
(WebCore::Document::nodeChildrenWillBeRemoved):
(WebCore::Document::nodeWillBeRemoved):
(WebCore::Document::dispatchWindowEvent):
(WebCore::Document::dispatchWindowLoadEvent):
(WebCore::Document::applyPendingXSLTransformsTimerFired):
* dom/Element.cpp:
(WebCore::Element::addShadowRoot):
(WebCore::Element::attachAttributeNodeIfNeeded):
(WebCore::Element::setAttributeNode):
(WebCore::Element::setAttributeNodeNS):
(WebCore::Element::dispatchFocusInEvent):
(WebCore::Element::dispatchFocusOutEvent):
* dom/ElementIteratorAssertions.h:
(WebCore::ElementIteratorAssertions::ElementIteratorAssertions):
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent):
* dom/EventTarget.cpp:
(WebCore::EventTarget::fireEventListeners):
* dom/NoEventDispatchAssertion.h: Removed.
* dom/Node.cpp:
(WebCore::Node::dispatchSubtreeModifiedEvent):
(WebCore::Node::dispatchDOMActivateEvent):
* dom/ScriptDisallowedScope.h: Copied from Source/WebCore/dom/NoEventDispatchAssertion.h.
(WebCore::ScriptDisallowedScope::ScriptDisallowedScope):
(WebCore::ScriptDisallowedScope::~ScriptDisallowedScope):
(WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree):
(WebCore::ScriptDisallowedScope::InMainThread::isScriptAllowed):
(WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Deleted.
(WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Deleted.
(WebCore::NoEventDispatchAssertion::isEventAllowedInMainThread): Deleted.
(WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Deleted.
(WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Deleted.
(WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): Deleted.
(WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed): Deleted.
(WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Deleted.
(WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Deleted.
(WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Deleted.
(WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Deleted.
(WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::DisableAssertionsInScope): Deleted.
(WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::~DisableAssertionsInScope): Deleted.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeClassicScript):
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
(WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
(WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
(WebCore::ScriptExecutionContext::stopActiveDOMObjects):
* history/CachedPage.cpp:
(WebCore::CachedPage::restore):
* history/PageCache.cpp:
(WebCore::PageCache::addIfCacheable):
* html/HTMLElement.cpp:
(WebCore::textToFragment):
(WebCore::HTMLElement::setInnerText):
* html/HTMLMediaElement.cpp:
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setInnerTextValue):
* html/track/VTTCue.cpp:
(WebCore::VTTCue::createCueRenderingTree):
(WebCore::VTTCue::updateDisplayTree):
(WebCore::VTTCue::removeDisplayTree):
* loader/FormSubmission.cpp:
* loader/cache/CachedSVGFont.cpp:
(WebCore::CachedSVGFont::ensureCustomFontData):
* page/LayoutContext.cpp:
(WebCore::LayoutContext::layout):
* rendering/RenderFrameBase.cpp:
(WebCore::RenderFrameBase::performLayoutWithFlattening):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::updateReferencedText):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::clearShadowTree):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw):</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="#trunkSourceWebCorebindingsjsScriptControllercpp">trunk/Source/WebCore/bindings/js/ScriptController.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</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="#trunkSourceWebCoredomScriptElementcpp">trunk/Source/WebCore/dom/ScriptElement.cpp</a></li>
<li><a href="#trunkSourceWebCoredomScriptExecutionContextcpp">trunk/Source/WebCore/dom/ScriptExecutionContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryCachedPagecpp">trunk/Source/WebCore/history/CachedPage.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryPageCachecpp">trunk/Source/WebCore/history/PageCache.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementcpp">trunk/Source/WebCore/html/HTMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextFormControlElementcpp">trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackVTTCuecpp">trunk/Source/WebCore/html/track/VTTCue.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFormSubmissioncpp">trunk/Source/WebCore/loader/FormSubmission.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedSVGFontcpp">trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp</a></li>
<li><a href="#trunkSourceWebCorepageLayoutContextcpp">trunk/Source/WebCore/page/LayoutContext.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFrameBasecpp">trunk/Source/WebCore/rendering/RenderFrameBase.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGTRefElementcpp">trunk/Source/WebCore/svg/SVGTRefElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGUseElementcpp">trunk/Source/WebCore/svg/SVGUseElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsSVGImagecpp">trunk/Source/WebCore/svg/graphics/SVGImage.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomScriptDisallowedScopeh">trunk/Source/WebCore/dom/ScriptDisallowedScope.h</a></li>
</ul>

<h3>Removed 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 (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/ChangeLog      2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -1,3 +1,109 @@
</span><ins>+2017-12-21  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Rename NoEventDispatchAssertion to ScriptDisallowedScope
+        https://bugs.webkit.org/show_bug.cgi?id=181102
+
+        Reviewed by Zalan Bujtas.
+
+        Renamed the class.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::canExecuteScripts):
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
+        (WebCore::ContainerNode::removeNodeWithScriptAssertion):
+        (WebCore::executeNodeInsertionWithScriptAssertion):
+        (WebCore::ContainerNode::removeDetachedChildren):
+        (WebCore::ContainerNode::insertBeforeCommon):
+        (WebCore::ContainerNode::appendChildCommon):
+        (WebCore::ContainerNode::removeBetween):
+        (WebCore::dispatchChildInsertionEvents):
+        (WebCore::dispatchChildRemovalEvents):
+        * dom/ContainerNodeAlgorithms.cpp:
+        (WebCore::notifyChildNodeInserted):
+        (WebCore::notifyChildNodeRemoved):
+        * dom/Document.cpp:
+        (WebCore::Document::resolveStyle):
+        (WebCore::isSafeToUpdateStyleOrLayout):
+        (WebCore::Document::updateStyleIfNeeded):
+        (WebCore::Document::nodeChildrenWillBeRemoved):
+        (WebCore::Document::nodeWillBeRemoved):
+        (WebCore::Document::dispatchWindowEvent):
+        (WebCore::Document::dispatchWindowLoadEvent):
+        (WebCore::Document::applyPendingXSLTransformsTimerFired):
+        * dom/Element.cpp:
+        (WebCore::Element::addShadowRoot):
+        (WebCore::Element::attachAttributeNodeIfNeeded):
+        (WebCore::Element::setAttributeNode):
+        (WebCore::Element::setAttributeNodeNS):
+        (WebCore::Element::dispatchFocusInEvent):
+        (WebCore::Element::dispatchFocusOutEvent):
+        * dom/ElementIteratorAssertions.h:
+        (WebCore::ElementIteratorAssertions::ElementIteratorAssertions):
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::dispatchEvent):
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::fireEventListeners):
+        * dom/NoEventDispatchAssertion.h: Removed.
+        * dom/Node.cpp:
+        (WebCore::Node::dispatchSubtreeModifiedEvent):
+        (WebCore::Node::dispatchDOMActivateEvent):
+        * dom/ScriptDisallowedScope.h: Copied from Source/WebCore/dom/NoEventDispatchAssertion.h.
+        (WebCore::ScriptDisallowedScope::ScriptDisallowedScope):
+        (WebCore::ScriptDisallowedScope::~ScriptDisallowedScope):
+        (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree):
+        (WebCore::ScriptDisallowedScope::InMainThread::isScriptAllowed):
+        (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Deleted.
+        (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Deleted.
+        (WebCore::NoEventDispatchAssertion::isEventAllowedInMainThread): Deleted.
+        (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Deleted.
+        (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Deleted.
+        (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): Deleted.
+        (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed): Deleted.
+        (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Deleted.
+        (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Deleted.
+        (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Deleted.
+        (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Deleted.
+        (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::DisableAssertionsInScope): Deleted.
+        (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::~DisableAssertionsInScope): Deleted.
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::executeClassicScript):
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
+        (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
+        (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
+        (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
+        * history/CachedPage.cpp:
+        (WebCore::CachedPage::restore):
+        * history/PageCache.cpp:
+        (WebCore::PageCache::addIfCacheable):
+        * html/HTMLElement.cpp:
+        (WebCore::textToFragment):
+        (WebCore::HTMLElement::setInnerText):
+        * html/HTMLMediaElement.cpp:
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::setInnerTextValue):
+        * html/track/VTTCue.cpp:
+        (WebCore::VTTCue::createCueRenderingTree):
+        (WebCore::VTTCue::updateDisplayTree):
+        (WebCore::VTTCue::removeDisplayTree):
+        * loader/FormSubmission.cpp:
+        * loader/cache/CachedSVGFont.cpp:
+        (WebCore::CachedSVGFont::ensureCustomFontData):
+        * page/LayoutContext.cpp:
+        (WebCore::LayoutContext::layout):
+        * rendering/RenderFrameBase.cpp:
+        (WebCore::RenderFrameBase::performLayoutWithFlattening):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollRectToVisible):
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::updateReferencedText):
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::clearShadowTree):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::draw):
+
</ins><span class="cx"> 2017-12-21  Maciej Stachowiak  <mjs@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Update Service Workers status to Supported in Preview
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -4558,7 +4558,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><del>-               E46B41F91CB24E70008F11DE /* NoEventDispatchAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                E46B41F91CB24E70008F11DE /* ScriptDisallowedScope.h in Headers */ = {isa = PBXBuildFile; fileRef = E46B41F81CB24E70008F11DE /* ScriptDisallowedScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">           E46C794B1F13E82B00F371E1 /* StyleInvalidationFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A1822F1F13BE5800FEF698 /* StyleInvalidationFunctions.h */; };
</span><span class="cx">          E47127CB163438AE00ED6F5A /* StyleInvalidator.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidator.h */; };
</span><span class="cx">          E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4778B7E115A581A00B5D372 /* JSCustomEvent.h */; };
</span><span class="lines">@@ -13878,7 +13878,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><del>-               E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoEventDispatchAssertion.h; sourceTree = "<group>"; };
</del><ins>+                E46B41F81CB24E70008F11DE /* ScriptDisallowedScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDisallowedScope.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">@@ -25454,7 +25454,6 @@
</span><span class="cx">                          E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */,
</span><span class="cx">                          E43105BA16750F1600DB2FB8 /* NodeTraversal.h */,
</span><span class="cx">                          9382AAB10D8C386100F357A6 /* NodeWithIndex.h */,
</span><del>-                               E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */,
</del><span class="cx">                           8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */,
</span><span class="cx">                          7C6752BA1B06E82000C279CB /* NonElementParentNode.idl */,
</span><span class="cx">                          1A0D57340A5C77FE007EDD4C /* OverflowEvent.cpp */,
</span><span class="lines">@@ -25510,6 +25509,7 @@
</span><span class="cx">                          A84D82BF11D3474800972990 /* ScriptableDocumentParser.h */,
</span><span class="cx">                          4998AECF13FB224D0090B1AA /* ScriptedAnimationController.cpp */,
</span><span class="cx">                          4998AED013FB224D0090B1AA /* ScriptedAnimationController.h */,
</span><ins>+                               E46B41F81CB24E70008F11DE /* ScriptDisallowedScope.h */,
</ins><span class="cx">                           08A484750E5272C500C3FE76 /* ScriptElement.cpp */,
</span><span class="cx">                          08A484760E5272C500C3FE76 /* ScriptElement.h */,
</span><span class="cx">                          E3E4E2A51E3B16FC0023BB8A /* ScriptElementCachedScriptFetcher.cpp */,
</span><span class="lines">@@ -28480,7 +28480,7 @@
</span><span class="cx">                          63D7B32D0E78CD3F00F7617C /* NodeRenderStyle.h in Headers */,
</span><span class="cx">                          E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */,
</span><span class="cx">                          9382AAB40D8C386100F357A6 /* NodeWithIndex.h in Headers */,
</span><del>-                               E46B41F91CB24E70008F11DE /* NoEventDispatchAssertion.h in Headers */,
</del><ins>+                                E46B41F91CB24E70008F11DE /* ScriptDisallowedScope.h in Headers */,
</ins><span class="cx">                           312C0C41146DC6CC0016C911 /* Notification.h in Headers */,
</span><span class="cx">                          33503C9A10179A74003B47E1 /* NotificationClient.h in Headers */,
</span><span class="cx">                          3128CA6B147331630074C72A /* NotificationController.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.cpp    2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp       2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -43,12 +43,12 @@
</span><span class="cx"> #include "ModuleFetchFailureKind.h"
</span><span class="cx"> #include "ModuleFetchParameters.h"
</span><span class="cx"> #include "NP_jsobject.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PageConsoleClient.h"
</span><span class="cx"> #include "PageGroup.h"
</span><span class="cx"> #include "PluginViewBase.h"
</span><span class="cx"> #include "RuntimeApplicationChecks.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ScriptSourceCode.h"
</span><span class="cx"> #include "ScriptableDocumentParser.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="lines">@@ -669,7 +669,7 @@
</span><span class="cx"> bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reason)
</span><span class="cx"> {
</span><span class="cx">     if (reason == AboutToExecuteScript)
</span><del>-        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed() || !isInWebProcess());
</del><ins>+        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed() || !isInWebProcess());
</ins><span class="cx"> 
</span><span class="cx">     if (m_frame.document() && m_frame.document()->isSandboxed(SandboxScripts)) {
</span><span class="cx">         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp       2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp  2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -44,7 +44,6 @@
</span><span class="cx"> #include "LabelsNodeList.h"
</span><span class="cx"> #include "MutationEvent.h"
</span><span class="cx"> #include "NameNodeList.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "NodeRareData.h"
</span><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "RadioNodeList.h"
</span><span class="lines">@@ -58,6 +57,7 @@
</span><span class="cx"> #include "SVGElement.h"
</span><span class="cx"> #include "SVGNames.h"
</span><span class="cx"> #include "SVGUseElement.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "SelectorQuery.h"
</span><span class="cx"> #include "TemplateContentDocumentFragment.h"
</span><span class="cx"> #include <algorithm>
</span><span class="lines">@@ -70,9 +70,9 @@
</span><span class="cx"> 
</span><span class="cx"> ChildNodesLazySnapshot* ChildNodesLazySnapshot::latestSnapshot;
</span><span class="cx"> 
</span><del>-unsigned NoEventDispatchAssertion::s_count = 0;
</del><ins>+unsigned ScriptDisallowedScope::s_count = 0;
</ins><span class="cx"> #if !ASSERT_DISABLED
</span><del>-NoEventDispatchAssertion::EventAllowedScope* NoEventDispatchAssertion::EventAllowedScope::s_currentScope = nullptr;
</del><ins>+ScriptDisallowedScope::EventAllowedScope* ScriptDisallowedScope::EventAllowedScope::s_currentScope = nullptr;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE NodeVector ContainerNode::removeAllChildrenWithScriptAssertion(ChildChangeSource source, DeferChildrenChanged deferChildrenChanged)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         ASSERT(source == ContainerNode::ChildChangeSource::Parser);
</span><del>-        NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         if (UNLIKELY(document().hasMutationObserversOfType(MutationObserver::ChildList))) {
</span><span class="cx">             ChildListMutationScope mutation(*this);
</span><span class="cx">             for (auto& child : children)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">     disconnectSubframesIfNeeded(*this, DescendantsOnly);
</span><span class="cx"> 
</span><span class="cx">     WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">     document().nodeChildrenWillBeRemoved(*this);
</span><span class="cx"> 
</span><span class="lines">@@ -119,11 +119,11 @@
</span><span class="cx">     Ref<Node> protectedChildToRemove(childToRemove);
</span><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(childToRemove.parentNode() == this);
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         ChildListMutationScope(*this).willRemoveChild(childToRemove);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(childToRemove));
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(childToRemove));
</ins><span class="cx">     if (source == ContainerNode::ChildChangeSource::API) {
</span><span class="cx">         childToRemove.notifyMutationObserversNodeWillDetach();
</span><span class="cx">         dispatchChildRemovalEvents(protectedChildToRemove);
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx">     ChildChange change;
</span><span class="cx">     {
</span><span class="cx">         WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
</span><del>-        NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">         document().nodeWillBeRemoved(childToRemove);
</span><span class="cx"> 
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx">         change.source = source;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // FIXME: Move childrenChanged into NoEventDispatchAssertion block.
</del><ins>+    // FIXME: Move childrenChanged into ScriptDisallowedScope block.
</ins><span class="cx">     childrenChanged(change);
</span><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="lines">@@ -177,13 +177,13 @@
</span><span class="cx"> {
</span><span class="cx">     NodeVector postInsertionNotificationTargets;
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         doNodeInsertion();
</span><span class="cx">         ChildListMutationScope(containerNode).childAdded(child);
</span><span class="cx">         postInsertionNotificationTargets = notifyChildNodeInserted(containerNode, child);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // FIXME: Move childrenChanged into NoEventDispatchAssertion block.
</del><ins>+    // FIXME: Move childrenChanged into ScriptDisallowedScope block.
</ins><span class="cx">     if (replacedAllChildren == ReplacedAllChildren::Yes)
</span><span class="cx">         containerNode.childrenChanged(ContainerNode::ChildChange { ContainerNode::AllChildrenReplaced, nullptr, nullptr, source });
</span><span class="cx">     else {
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ASSERT(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(child));
</del><ins>+    ASSERT(ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(child));
</ins><span class="cx">     for (auto& target : postInsertionNotificationTargets)
</span><span class="cx">         target->didFinishInsertingNode();
</span><span class="cx"> 
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx">             child->updateAncestorConnectedSubframeCountForRemoval();
</span><span class="cx">     }
</span><span class="cx">     // FIXME: We should be able to ASSERT(!attached()) here: https://bugs.webkit.org/show_bug.cgi?id=107801
</span><del>-    NoEventDispatchAssertion::InMainThread noEventDispatchAssertion;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">     removeDetachedChildrenInContainer(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -403,7 +403,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ContainerNode::insertBeforeCommon(Node& nextChild, Node& newChild)
</span><span class="cx"> {
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(!newChild.parentNode()); // Use insertBefore if you need to handle reparenting (and want DOM mutation events).
</span><span class="cx">     ASSERT(!newChild.nextSibling());
</span><span class="lines">@@ -428,7 +428,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ContainerNode::appendChildCommon(Node& child)
</span><span class="cx"> {
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">     child.setParentNode(this);
</span><span class="cx"> 
</span><span class="lines">@@ -567,7 +567,7 @@
</span><span class="cx"> {
</span><span class="cx">     InspectorInstrumentation::didRemoveDOMNode(oldChild.document(), oldChild);
</span><span class="cx"> 
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(oldChild.parentNode() == this);
</span><span class="cx"> 
</span><span class="lines">@@ -766,7 +766,7 @@
</span><span class="cx">     if (child.isInShadowTree())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(child));
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(child));
</ins><span class="cx"> 
</span><span class="cx">     RefPtr<Node> c = &child;
</span><span class="cx">     Ref<Document> document(child.document());
</span><span class="lines">@@ -783,7 +783,7 @@
</span><span class="cx"> 
</span><span class="cx"> static void dispatchChildRemovalEvents(Ref<Node>& child)
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(child));
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(child));
</ins><span class="cx">     InspectorInstrumentation::willRemoveDOMNode(child->document(), child.get());
</span><span class="cx"> 
</span><span class="cx">     if (child->isInShadowTree())
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeAlgorithmscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp     2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp        2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include "HTMLFrameOwnerElement.h"
</span><span class="cx"> #include "HTMLTextAreaElement.h"
</span><span class="cx"> #include "InspectorInstrumentation.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ShadowRoot.h"
</span><span class="cx"> #include "TypedElementDescendantIterator.h"
</span><span class="cx"> 
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx"> 
</span><span class="cx"> NodeVector notifyChildNodeInserted(ContainerNode& parentOfInsertedTree, Node& node)
</span><span class="cx"> {
</span><del>-    ASSERT(!NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT(!ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx"> 
</span><span class="cx">     InspectorInstrumentation::didInsertDOMNode(node.document(), node);
</span><span class="cx"> 
</span><span class="lines">@@ -151,8 +151,8 @@
</span><span class="cx"> 
</span><span class="cx"> void notifyChildNodeRemoved(ContainerNode& oldParentOfRemovedTree, Node& child)
</span><span class="cx"> {
</span><del>-    // Assert that the caller of this function has an instance of NoEventDispatchAssertion.
-    ASSERT(!isMainThread() || !NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    // Assert that the caller of this function has an instance of ScriptDisallowedScope.
+    ASSERT(!isMainThread() || !ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx">     ContainerChildRemovalScope removalScope(oldParentOfRemovedTree, child);
</span><span class="cx"> 
</span><span class="cx">     // Tree scope has changed if the container node from which "node" is removed is in a document or a shadow root.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp    2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/Document.cpp       2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -125,7 +125,7 @@
</span><span class="cx"> #include "NavigationDisabler.h"
</span><span class="cx"> #include "NavigationScheduler.h"
</span><span class="cx"> #include "NestingLevelIncrementer.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><ins>+
</ins><span class="cx"> #include "NodeIterator.h"
</span><span class="cx"> #include "NodeRareData.h"
</span><span class="cx"> #include "NodeWithIndex.h"
</span><span class="lines">@@ -166,6 +166,7 @@
</span><span class="cx"> #include "SchemeRegistry.h"
</span><span class="cx"> #include "ScopedEventQueue.h"
</span><span class="cx"> #include "ScriptController.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ScriptModuleLoader.h"
</span><span class="cx"> #include "ScriptRunner.h"
</span><span class="cx"> #include "ScriptSourceCode.h"
</span><span class="lines">@@ -1806,7 +1807,7 @@
</span><span class="cx">     // hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::InMainThread noEventDispatchAssertion;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         styleScope().flushPendingUpdate();
</span><span class="cx">         frameView.willRecalcStyle();
</span><span class="cx">     }
</span><span class="lines">@@ -1817,7 +1818,7 @@
</span><span class="cx">     {
</span><span class="cx">         Style::PostResolutionCallbackDisabler disabler(*this);
</span><span class="cx">         WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
</span><del>-        NoEventDispatchAssertion::InMainThread noEventDispatchAssertion;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">         m_inStyleRecalc = true;
</span><span class="cx"> 
</span><span class="lines">@@ -1936,7 +1937,7 @@
</span><span class="cx"> 
</span><span class="cx"> inline bool static isSafeToUpdateStyleOrLayout(FrameView* frameView)
</span><span class="cx"> {
</span><del>-    bool isSafeToExecuteScript = NoEventDispatchAssertion::InMainThread::isEventAllowed();
</del><ins>+    bool isSafeToExecuteScript = ScriptDisallowedScope::InMainThread::isScriptAllowed();
</ins><span class="cx">     bool isInFrameFlattening = frameView && frameView->isInChildFrameWithFrameFlattening();
</span><span class="cx">     return isSafeToExecuteScript || isInFrameFlattening || !isInWebProcess();
</span><span class="cx"> }
</span><span class="lines">@@ -1945,7 +1946,7 @@
</span><span class="cx"> {
</span><span class="cx">     RefPtr<FrameView> frameView = view();
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::InMainThread noEventDispatchAssertion;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         ASSERT(isMainThread());
</span><span class="cx">         ASSERT(!frameView || !frameView->isPainting());
</span><span class="cx"> 
</span><span class="lines">@@ -4121,7 +4122,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Document::nodeChildrenWillBeRemoved(ContainerNode& container)
</span><span class="cx"> {
</span><del>-    ASSERT(!NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT(!ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx"> 
</span><span class="cx">     removeFocusedNodeOfSubtree(container, true /* amongChildrenOnly */);
</span><span class="cx">     removeFocusNavigationNodeOfSubtree(container, true /* amongChildrenOnly */);
</span><span class="lines">@@ -4154,7 +4155,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Document::nodeWillBeRemoved(Node& node)
</span><span class="cx"> {
</span><del>-    ASSERT(!NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT(!ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx"> 
</span><span class="cx">     removeFocusedNodeOfSubtree(node);
</span><span class="cx">     removeFocusNavigationNodeOfSubtree(node);
</span><span class="lines">@@ -4298,7 +4299,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Document::dispatchWindowEvent(Event& event, EventTarget* target)
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx">     if (!m_domWindow)
</span><span class="cx">         return;
</span><span class="cx">     m_domWindow->dispatchEvent(event, target);
</span><span class="lines">@@ -4306,7 +4307,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Document::dispatchWindowLoadEvent()
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx">     if (!m_domWindow)
</span><span class="cx">         return;
</span><span class="cx">     m_domWindow->dispatchLoadEvent();
</span><span class="lines">@@ -5141,7 +5142,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_hasPendingXSLTransforms = false;
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx">     for (auto& processingInstruction : styleScope().collectXSLTransforms()) {
</span><span class="cx">         ASSERT(processingInstruction->isXSL());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp     2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/Element.cpp        2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -75,7 +75,6 @@
</span><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "MutationObserverInterestGroup.h"
</span><span class="cx"> #include "MutationRecord.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "PlatformWheelEvent.h"
</span><span class="cx"> #include "PointerLockController.h"
</span><span class="lines">@@ -91,6 +90,7 @@
</span><span class="cx"> #include "SVGElement.h"
</span><span class="cx"> #include "SVGNames.h"
</span><span class="cx"> #include "SVGSVGElement.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ScrollLatchingState.h"
</span><span class="cx"> #include "SelectorQuery.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="lines">@@ -1774,7 +1774,7 @@
</span><span class="cx"> 
</span><span class="cx">     ShadowRoot& shadowRoot = newShadowRoot;
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::InMainThread noEventDispatchAssertion;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         if (renderer())
</span><span class="cx">             RenderTreeUpdater::tearDownRenderers(*this);
</span><span class="cx"> 
</span><span class="lines">@@ -2149,7 +2149,7 @@
</span><span class="cx">     if (attrNode.ownerElement() == this)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">     attrNode.attachToElement(*this);
</span><span class="cx">     ensureAttrNodeListForElement(*this).append(&attrNode);
</span><span class="lines">@@ -2167,7 +2167,7 @@
</span><span class="cx">         return Exception { InUseAttributeError };
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         synchronizeAllAttributes();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -2218,7 +2218,7 @@
</span><span class="cx">     auto attrNodeValue = attrNode.value();
</span><span class="cx">     unsigned index = 0;
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         synchronizeAllAttributes();
</span><span class="cx">         auto& elementData = ensureUniqueElementData();
</span><span class="cx"> 
</span><span class="lines">@@ -2475,7 +2475,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Element::dispatchFocusInEvent(const AtomicString& eventType, RefPtr<Element>&& oldFocusedElement)
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx">     ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent);
</span><span class="cx">     dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().defaultView(), 0, WTFMove(oldFocusedElement)));
</span><span class="cx"> }
</span><span class="lines">@@ -2482,7 +2482,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Element::dispatchFocusOutEvent(const AtomicString& eventType, RefPtr<Element>&& newFocusedElement)
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx">     ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent);
</span><span class="cx">     dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().defaultView(), 0, WTFMove(newFocusedElement)));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementIteratorAssertionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ElementIteratorAssertions.h (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ElementIteratorAssertions.h     2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/ElementIteratorAssertions.h        2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#include "NoEventDispatchAssertion.h"
</del><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> private:
</span><span class="cx">     const Document* m_document;
</span><span class="cx">     uint64_t m_initialDOMTreeVersion;
</span><del>-    std::optional<NoEventDispatchAssertion> m_eventDispatchAssertion;
</del><ins>+    std::optional<ScriptDisallowedScope> m_eventDispatchAssertion;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // FIXME: No real point in doing these as inlines; they are for debugging and we usually turn off inlining in debug builds.
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">     , m_initialDOMTreeVersion(first ? m_document->domTreeVersion() : 0)
</span><span class="cx"> {
</span><span class="cx">     if (first)
</span><del>-        m_eventDispatchAssertion = NoEventDispatchAssertion();
</del><ins>+        m_eventDispatchAssertion = ScriptDisallowedScope();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline bool ElementIteratorAssertions::domTreeHasMutated() const
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventDispatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventDispatcher.cpp     2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp        2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -37,8 +37,8 @@
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "MouseEvent.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "ScopedEventQueue.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ShadowRoot.h"
</span><span class="cx"> #include "TextEvent.h"
</span><span class="cx"> #include "TouchEvent.h"
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx"> 
</span><span class="cx"> void EventDispatcher::dispatchEvent(Node& node, Event& event)
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(node));
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(node));
</ins><span class="cx">     
</span><span class="cx">     LOG(Events, "EventDispatcher::dispatchEvent %s on node %s", event.type().string().utf8().data(), node.nodeName().utf8().data());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventTargetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventTarget.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventTarget.cpp 2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/EventTarget.cpp    2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -37,8 +37,8 @@
</span><span class="cx"> #include "HTMLBodyElement.h"
</span><span class="cx"> #include "InspectorInstrumentation.h"
</span><span class="cx"> #include "JSEventListener.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "ScriptController.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "WebKitAnimationEvent.h"
</span><span class="cx"> #include "WebKitTransitionEvent.h"
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx"> 
</span><span class="cx"> void EventTarget::fireEventListeners(Event& event)
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::isEventAllowedInMainThread());
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::isEventAllowedInMainThread());
</ins><span class="cx">     ASSERT(event.isInitialized());
</span><span class="cx"> 
</span><span class="cx">     auto* data = eventTargetData();
</span></span></pre></div>
<a id="trunkSourceWebCoredomNoEventDispatchAssertionh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/NoEventDispatchAssertion.h (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NoEventDispatchAssertion.h      2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/NoEventDispatchAssertion.h 2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -1,154 +0,0 @@
</span><del>-/*
- * 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.
- *
- */
-
-#pragma once
-
-#include "ContainerNode.h"
-#include <wtf/MainThread.h>
-
-namespace WebCore {
-
-class NoEventDispatchAssertion {
-public:
-    // This variant is expensive. Use NoEventDispatchAssertion::InMainThread whenever possible.
-    NoEventDispatchAssertion()
-    {
-        if (!isMainThread())
-            return;
-        ++s_count;
-    }
-
-    NoEventDispatchAssertion(const NoEventDispatchAssertion&)
-        : NoEventDispatchAssertion()
-    {
-    }
-
-    ~NoEventDispatchAssertion()
-    {
-        if (!isMainThread())
-            return;
-        ASSERT(s_count);
-        s_count--;
-    }
-
-    static bool isEventAllowedInMainThread()
-    {
-        return !isMainThread() || !s_count;
-    }
-
-    class InMainThread {
-    public:
-        InMainThread()
-        {
-            ASSERT(isMainThread());
-            ++s_count;
-        }
-
-        ~InMainThread()
-        {
-            ASSERT(isMainThread());
-            ASSERT(s_count);
-            --s_count;
-        }
-
-        // Don't enable this assertion in release since it's O(n).
-        // Release asserts in canExecuteScript should be sufficient for security defense purposes.
-        static bool isEventDispatchAllowedInSubtree(Node& node)
-        {
-#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
-            return isEventAllowed() || EventAllowedScope::isAllowedNode(node);
-#else
-            UNUSED_PARAM(node);
-            return true;
-#endif
-        }
-
-        static bool isEventAllowed()
-        {
-            ASSERT(isMainThread());
-            return !s_count;
-        }
-    };
-    
-#if !ASSERT_DISABLED
-    class EventAllowedScope {
-    public:
-        explicit EventAllowedScope(ContainerNode& userAgentContentRoot)
-            : m_eventAllowedTreeRoot(userAgentContentRoot)
-            , m_previousScope(s_currentScope)
-        {
-            s_currentScope = this;
-        }
-
-        ~EventAllowedScope()
-        {
-            s_currentScope = m_previousScope;
-        }
-
-        static bool isAllowedNode(Node& node)
-        {
-            return s_currentScope && s_currentScope->isAllowedNodeInternal(node);
-        }
-
-    private:
-        bool isAllowedNodeInternal(Node& node)
-        {
-            return m_eventAllowedTreeRoot->contains(&node) || (m_previousScope && m_previousScope->isAllowedNodeInternal(node));
-        }
-
-        Ref<ContainerNode> m_eventAllowedTreeRoot;
-
-        EventAllowedScope* m_previousScope;
-        static EventAllowedScope* s_currentScope;
-    };
-#else
-    class EventAllowedScope {
-    public:
-        explicit EventAllowedScope(ContainerNode&) { }
-        static bool isAllowedNode(Node&) { return true; }
-    };
-#endif
-
-    // FIXME: Remove this class once the sync layout inside SVGImage::draw is removed
-    // and refactored the code in RenderFrameBase::performLayoutWithFlattening.
-    class DisableAssertionsInScope {
-    public:
-        DisableAssertionsInScope()
-        {
-            ASSERT(isMainThread());
-            std::swap(s_count, m_originalCount);
-        }
-
-        ~DisableAssertionsInScope()
-        {
-            s_count = m_originalCount;
-        }
-    private:
-        unsigned m_originalCount { 0 };
-    };
-
-private:
-    WEBCORE_EXPORT static unsigned s_count;
-};
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/Node.cpp   2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -52,7 +52,6 @@
</span><span class="cx"> #include "KeyboardEvent.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MutationEvent.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "ProcessingInstruction.h"
</span><span class="cx"> #include "ProgressEvent.h"
</span><span class="lines">@@ -62,6 +61,7 @@
</span><span class="cx"> #include "RenderTextControl.h"
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "ScopedEventQueue.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "StorageEvent.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><span class="cx"> #include "StyleSheetContents.h"
</span><span class="lines">@@ -2335,7 +2335,7 @@
</span><span class="cx">     if (isInShadowTree())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(*this));
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(*this));
</ins><span class="cx"> 
</span><span class="cx">     if (!document().hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER))
</span><span class="cx">         return;
</span><span class="lines">@@ -2348,7 +2348,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Node::dispatchDOMActivateEvent(Event& underlyingClickEvent)
</span><span class="cx"> {
</span><del>-    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
</del><ins>+    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
</ins><span class="cx">     int detail = is<UIEvent>(underlyingClickEvent) ? downcast<UIEvent>(underlyingClickEvent).detail() : 0;
</span><span class="cx">     auto event = UIEvent::create(eventNames().DOMActivateEvent, true, true, document().defaultView(), detail);
</span><span class="cx">     event->setUnderlyingEvent(&underlyingClickEvent);
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptDisallowedScopehfromrev226250trunkSourceWebCoredomNoEventDispatchAssertionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/ScriptDisallowedScope.h (from rev 226250, trunk/Source/WebCore/dom/NoEventDispatchAssertion.h) (0 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptDisallowedScope.h                         (rev 0)
+++ trunk/Source/WebCore/dom/ScriptDisallowedScope.h    2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -0,0 +1,154 @@
</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.
+ *
+ */
+
+#pragma once
+
+#include "ContainerNode.h"
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+class ScriptDisallowedScope {
+public:
+    // This variant is expensive. Use ScriptDisallowedScope::InMainThread whenever possible.
+    ScriptDisallowedScope()
+    {
+        if (!isMainThread())
+            return;
+        ++s_count;
+    }
+
+    ScriptDisallowedScope(const ScriptDisallowedScope&)
+        : ScriptDisallowedScope()
+    {
+    }
+
+    ~ScriptDisallowedScope()
+    {
+        if (!isMainThread())
+            return;
+        ASSERT(s_count);
+        s_count--;
+    }
+
+    static bool isEventAllowedInMainThread()
+    {
+        return !isMainThread() || !s_count;
+    }
+
+    class InMainThread {
+    public:
+        InMainThread()
+        {
+            ASSERT(isMainThread());
+            ++s_count;
+        }
+
+        ~InMainThread()
+        {
+            ASSERT(isMainThread());
+            ASSERT(s_count);
+            --s_count;
+        }
+
+        // Don't enable this assertion in release since it's O(n).
+        // Release asserts in canExecuteScript should be sufficient for security defense purposes.
+        static bool isEventDispatchAllowedInSubtree(Node& node)
+        {
+#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
+            return isScriptAllowed() || EventAllowedScope::isAllowedNode(node);
+#else
+            UNUSED_PARAM(node);
+            return true;
+#endif
+        }
+
+        static bool isScriptAllowed()
+        {
+            ASSERT(isMainThread());
+            return !s_count;
+        }
+    };
+    
+#if !ASSERT_DISABLED
+    class EventAllowedScope {
+    public:
+        explicit EventAllowedScope(ContainerNode& userAgentContentRoot)
+            : m_eventAllowedTreeRoot(userAgentContentRoot)
+            , m_previousScope(s_currentScope)
+        {
+            s_currentScope = this;
+        }
+
+        ~EventAllowedScope()
+        {
+            s_currentScope = m_previousScope;
+        }
+
+        static bool isAllowedNode(Node& node)
+        {
+            return s_currentScope && s_currentScope->isAllowedNodeInternal(node);
+        }
+
+    private:
+        bool isAllowedNodeInternal(Node& node)
+        {
+            return m_eventAllowedTreeRoot->contains(&node) || (m_previousScope && m_previousScope->isAllowedNodeInternal(node));
+        }
+
+        Ref<ContainerNode> m_eventAllowedTreeRoot;
+
+        EventAllowedScope* m_previousScope;
+        static EventAllowedScope* s_currentScope;
+    };
+#else
+    class EventAllowedScope {
+    public:
+        explicit EventAllowedScope(ContainerNode&) { }
+        static bool isAllowedNode(Node&) { return true; }
+    };
+#endif
+
+    // FIXME: Remove this class once the sync layout inside SVGImage::draw is removed
+    // and refactored the code in RenderFrameBase::performLayoutWithFlattening.
+    class DisableAssertionsInScope {
+    public:
+        DisableAssertionsInScope()
+        {
+            ASSERT(isMainThread());
+            std::swap(s_count, m_originalCount);
+        }
+
+        ~DisableAssertionsInScope()
+        {
+            s_count = m_originalCount;
+        }
+    private:
+        unsigned m_originalCount { 0 };
+    };
+
+private:
+    WEBCORE_EXPORT static unsigned s_count;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoredomScriptElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptElement.cpp       2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp  2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -41,11 +41,11 @@
</span><span class="cx"> #include "LoadableClassicScript.h"
</span><span class="cx"> #include "LoadableModuleScript.h"
</span><span class="cx"> #include "MIMETypeRegistry.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "PendingScript.h"
</span><span class="cx"> #include "RuntimeApplicationChecks.h"
</span><span class="cx"> #include "SVGScriptElement.h"
</span><span class="cx"> #include "ScriptController.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ScriptRunner.h"
</span><span class="cx"> #include "ScriptSourceCode.h"
</span><span class="cx"> #include "ScriptableDocumentParser.h"
</span><span class="lines">@@ -362,7 +362,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ScriptElement::executeClassicScript(const ScriptSourceCode& sourceCode)
</span><span class="cx"> {
</span><del>-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed() || !isInWebProcess());
</del><ins>+    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed() || !isInWebProcess());
</ins><span class="cx">     ASSERT(m_alreadyStarted);
</span><span class="cx"> 
</span><span class="cx">     if (sourceCode.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptExecutionContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp      2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> #include "JSDOMWindow.h"
</span><span class="cx"> #include "MessagePort.h"
</span><span class="cx"> #include "Navigator.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "PublicURLManager.h"
</span><span class="cx"> #include "RejectedPromiseTracker.h"
</span><span class="cx"> #include "ResourceRequest.h"
</span><span class="lines">@@ -46,6 +45,7 @@
</span><span class="cx"> #include "SWClientConnection.h"
</span><span class="cx"> #include "SWContextManager.h"
</span><span class="cx"> #include "SchemeRegistry.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ScriptState.h"
</span><span class="cx"> #include "ServiceWorker.h"
</span><span class="cx"> #include "ServiceWorkerGlobalScope.h"
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx">     // functions should not add new active DOM objects, nor execute arbitrary JavaScript.
</span><span class="cx">     // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code
</span><span class="cx">     // canSuspend functions so it will not happen!
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">     for (auto* activeDOMObject : m_activeDOMObjects) {
</span><span class="cx">         if (!activeDOMObject->canSuspendForDocumentSuspension()) {
</span><span class="cx">             canSuspend = false;
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx">     // functions should not add new active DOM objects, nor execute arbitrary JavaScript.
</span><span class="cx">     // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code
</span><span class="cx">     // suspend functions so it will not happen!
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">     for (auto* activeDOMObject : m_activeDOMObjects)
</span><span class="cx">         activeDOMObject->suspend(why);
</span><span class="cx"> 
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx">     // functions should not add new active DOM objects, nor execute arbitrary JavaScript.
</span><span class="cx">     // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code
</span><span class="cx">     // resume functions so it will not happen!
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">     for (auto* activeDOMObject : m_activeDOMObjects)
</span><span class="cx">         activeDOMObject->resume();
</span><span class="cx"> 
</span><span class="lines">@@ -294,7 +294,7 @@
</span><span class="cx">     // stop functions should not add new active DOM objects, nor execute arbitrary JavaScript.
</span><span class="cx">     // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code stop functions
</span><span class="cx">     // so it will not happen!
</span><del>-    NoEventDispatchAssertion assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope scriptDisallowedScope;
</ins><span class="cx">     for (auto* activeDOMObject : possibleActiveDOMObjects) {
</span><span class="cx">         // Check if this object was deleted already. If so, just skip it.
</span><span class="cx">         // Calling contains on a possibly-already-deleted object is OK because we guarantee
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryCachedPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/CachedPage.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/CachedPage.cpp      2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/history/CachedPage.cpp 2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -34,10 +34,10 @@
</span><span class="cx"> #include "HistoryController.h"
</span><span class="cx"> #include "HistoryItem.h"
</span><span class="cx"> #include "MainFrame.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "Node.h"
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PageTransitionEvent.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "VisitedLinkState.h"
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">     {
</span><span class="cx">         // Do not dispatch DOM events as their JavaScript listeners could cause the page to be put
</span><span class="cx">         // into the page cache before we have finished restoring it from the page cache.
</span><del>-        NoEventDispatchAssertion::InMainThread noEventDispatchAssertion;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">         m_cachedMainFrame->open();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryPageCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/PageCache.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/PageCache.cpp       2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/history/PageCache.cpp  2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -44,8 +44,8 @@
</span><span class="cx"> #include "IgnoreOpensDuringUnloadCountIncrementer.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MainFrame.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "Page.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "SubframeLoader.h"
</span><span class="cx"> #include <wtf/MemoryPressureHandler.h>
</span><span class="lines">@@ -423,7 +423,7 @@
</span><span class="cx">     setPageCacheState(*page, Document::InPageCache);
</span><span class="cx"> 
</span><span class="cx">     // Make sure we no longer fire any JS events past this point.
</span><del>-    NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">     item.m_cachedPage = std::make_unique<CachedPage>(*page);
</span><span class="cx">     item.m_pruningReason = PruningReason::None;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/html/HTMLElement.cpp   2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -443,7 +443,7 @@
</span><span class="cx">     auto fragment = DocumentFragment::create(document);
</span><span class="cx"> 
</span><span class="cx">     // It's safe to dispatch events on the new fragment since author scripts have no access to it yet.
</span><del>-    NoEventDispatchAssertion::EventAllowedScope allowedScope(fragment);
</del><ins>+    ScriptDisallowedScope::EventAllowedScope allowedScope(fragment);
</ins><span class="cx"> 
</span><span class="cx">     for (unsigned start = 0, length = text.length(); start < length; ) {
</span><span class="cx">         // Find next line break.
</span><span class="lines">@@ -533,7 +533,7 @@
</span><span class="cx">     auto fragment = textToFragment(document(), text);
</span><span class="cx">     // FIXME: This should use replaceAllChildren() once it accepts DocumentFragments as input.
</span><span class="cx">     // It's safe to dispatch events on the new fragment since author scripts have no access to it yet.
</span><del>-    NoEventDispatchAssertion::EventAllowedScope allowedScope(fragment.get());
</del><ins>+    ScriptDisallowedScope::EventAllowedScope allowedScope(fragment.get());
</ins><span class="cx">     return replaceChildrenWithFragment(*this, WTFMove(fragment));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp   2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp      2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -68,7 +68,6 @@
</span><span class="cx"> #include "MediaQueryEvaluator.h"
</span><span class="cx"> #include "MediaResourceLoader.h"
</span><span class="cx"> #include "NetworkingContext.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PageGroup.h"
</span><span class="cx"> #include "PlatformMediaSessionManager.h"
</span><span class="lines">@@ -79,6 +78,7 @@
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "ResourceLoadInfo.h"
</span><span class="cx"> #include "ScriptController.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ScriptSourceCode.h"
</span><span class="cx"> #include "SecurityOriginData.h"
</span><span class="cx"> #include "SecurityPolicy.h"
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextFormControlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp    2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -41,11 +41,11 @@
</span><span class="cx"> #include "HTMLParserIdioms.h"
</span><span class="cx"> #include "LayoutDisallowedScope.h"
</span><span class="cx"> #include "Logging.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "NodeTraversal.h"
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "RenderTextControlSingleLine.h"
</span><span class="cx"> #include "RenderTheme.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ShadowRoot.h"
</span><span class="cx"> #include "Text.h"
</span><span class="cx"> #include "TextControlInnerElements.h"
</span><span class="lines">@@ -572,7 +572,7 @@
</span><span class="cx"> 
</span><span class="cx">         {
</span><span class="cx">             // Events dispatched on the inner text element cannot execute arbitrary author scripts.
</span><del>-            NoEventDispatchAssertion::EventAllowedScope allowedScope(*userAgentShadowRoot());
</del><ins>+            ScriptDisallowedScope::EventAllowedScope allowedScope(*userAgentShadowRoot());
</ins><span class="cx"> 
</span><span class="cx">             innerText->setInnerText(value);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackVTTCuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/VTTCue.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/VTTCue.cpp       2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/html/track/VTTCue.cpp  2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -41,9 +41,9 @@
</span><span class="cx"> #include "HTMLDivElement.h"
</span><span class="cx"> #include "HTMLSpanElement.h"
</span><span class="cx"> #include "Logging.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "NodeTraversal.h"
</span><span class="cx"> #include "RenderVTTCue.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "Text.h"
</span><span class="cx"> #include "TextTrack.h"
</span><span class="cx"> #include "TextTrackCueList.h"
</span><span class="lines">@@ -530,7 +530,7 @@
</span><span class="cx">     auto clonedFragment = DocumentFragment::create(ownerDocument());
</span><span class="cx"> 
</span><span class="cx">     // The cloned fragment is never exposed to author scripts so it's safe to dispatch events here.
</span><del>-    NoEventDispatchAssertion::EventAllowedScope noEventDispatchAssertionDisabledForScope(clonedFragment);
</del><ins>+    ScriptDisallowedScope::EventAllowedScope allowedScope(clonedFragment);
</ins><span class="cx"> 
</span><span class="cx">     m_webVTTNodeTree->cloneChildNodes(clonedFragment);
</span><span class="cx">     return WTFMove(clonedFragment);
</span><span class="lines">@@ -788,7 +788,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Mutating the VTT contents is safe because it's never exposed to author scripts.
</span><del>-    NoEventDispatchAssertion::EventAllowedScope allowedScopeForCueHighlightBox(*m_cueHighlightBox);
</del><ins>+    ScriptDisallowedScope::EventAllowedScope allowedScopeForCueHighlightBox(*m_cueHighlightBox);
</ins><span class="cx"> 
</span><span class="cx">     // Clear the contents of the set.
</span><span class="cx">     m_cueHighlightBox->removeChildren();
</span><span class="lines">@@ -798,7 +798,7 @@
</span><span class="cx">     if (!referenceTree)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    NoEventDispatchAssertion::EventAllowedScope allowedScopeForReferenceTree(*referenceTree);
</del><ins>+    ScriptDisallowedScope::EventAllowedScope allowedScopeForReferenceTree(*referenceTree);
</ins><span class="cx"> 
</span><span class="cx">     markFutureAndPastNodes(referenceTree.get(), startMediaTime(), movieTime);
</span><span class="cx">     m_cueHighlightBox->appendChild(*referenceTree);
</span><span class="lines">@@ -861,7 +861,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // The display tree is never exposed to author scripts so it's safe to dispatch events here.
</span><del>-    NoEventDispatchAssertion::EventAllowedScope allowedScope(displayTreeInternal());
</del><ins>+    ScriptDisallowedScope::EventAllowedScope allowedScope(displayTreeInternal());
</ins><span class="cx">     displayTreeInternal().remove();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFormSubmissioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FormSubmission.cpp   2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp      2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> #include "HTMLInputElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLParserIdioms.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "TextEncoding.h"
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedSVGFontcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp      2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -31,10 +31,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include "FontDescription.h"
</span><span class="cx"> #include "FontPlatformData.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "SVGDocument.h"
</span><span class="cx"> #include "SVGFontElement.h"
</span><span class="cx"> #include "SVGFontFaceElement.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "SharedBuffer.h"
</span><span class="cx"> #include "TextResourceDecoder.h"
</span><span class="cx"> #include "TypedElementDescendantIterator.h"
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">             m_externalSVGDocument = SVGDocument::create(nullptr, URL());
</span><span class="cx">             auto decoder = TextResourceDecoder::create("application/xml");
</span><span class="cx"> 
</span><del>-            NoEventDispatchAssertion::EventAllowedScope allowedScope(*m_externalSVGDocument);
</del><ins>+            ScriptDisallowedScope::EventAllowedScope allowedScope(*m_externalSVGDocument);
</ins><span class="cx"> 
</span><span class="cx">             m_externalSVGDocument->setContent(decoder->decodeAndFlush(m_data->data(), m_data->size()));
</span><span class="cx">             sawError = decoder->sawError();
</span></span></pre></div>
<a id="trunkSourceWebCorepageLayoutContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/LayoutContext.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/LayoutContext.cpp      2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/page/LayoutContext.cpp 2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -33,9 +33,9 @@
</span><span class="cx"> #include "InspectorInstrumentation.h"
</span><span class="cx"> #include "LayoutState.h"
</span><span class="cx"> #include "Logging.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "RenderView.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "Settings.h"
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/SetForScope.h>
</span><span class="lines">@@ -175,7 +175,7 @@
</span><span class="cx">     }
</span><span class="cx">     {
</span><span class="cx">         SetForScope<LayoutPhase> layoutPhase(m_layoutPhase, LayoutPhase::InRenderTreeLayout);
</span><del>-        NoEventDispatchAssertion::InMainThread noEventDispatchAssertion;
</del><ins>+        ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx">         SubtreeLayoutStateMaintainer subtreeLayoutStateMaintainer(subtreeLayoutRoot());
</span><span class="cx">         RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView());
</span><span class="cx"> #ifndef NDEBUG
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFrameBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFrameBase.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFrameBase.cpp       2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/rendering/RenderFrameBase.cpp  2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -29,8 +29,8 @@
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameView.h"
</span><span class="cx"> #include "HTMLFrameElementBase.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "RenderView.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include <wtf/IsoMallocInlines.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> void RenderFrameBase::performLayoutWithFlattening(bool hasFixedWidth, bool hasFixedHeight)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Refactor frame flattening code so that we don't need to disable assertions here.
</span><del>-    NoEventDispatchAssertion::DisableAssertionsInScope scope;
</del><ins>+    ScriptDisallowedScope::DisableAssertionsInScope scope;
</ins><span class="cx">     if (!childRenderView())
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp   2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp      2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -82,7 +82,6 @@
</span><span class="cx"> #include "HitTestingTransformState.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MainFrame.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "OverflowEvent.h"
</span><span class="cx"> #include "OverlapTestRequestClient.h"
</span><span class="cx"> #include "Page.h"
</span><span class="lines">@@ -111,6 +110,7 @@
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "SVGNames.h"
</span><span class="cx"> #include "ScaleTransformOperation.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ScrollAnimator.h"
</span><span class="cx"> #include "Scrollbar.h"
</span><span class="cx"> #include "ScrollbarTheme.h"
</span><span class="lines">@@ -2587,7 +2587,7 @@
</span><span class="cx"> 
</span><span class="cx">             if (frameElementAndViewPermitScroll(frameElementBase, frameView)) {
</span><span class="cx">                 // If this assertion fires we need to protect the ownerElement from being destroyed.
</span><del>-                NoEventDispatchAssertion::InMainThread assertNoEventDispatch;
</del><ins>+                ScriptDisallowedScope::InMainThread scriptDisallowedScope;
</ins><span class="cx"> 
</span><span class="cx">                 LayoutRect viewRect = frameView.visibleContentRect(LegacyIOSDocumentVisibleRect);
</span><span class="cx">                 LayoutRect exposeRect = getRectToExpose(viewRect, absoluteRect, insideFixed, alignX, alignY);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGTRefElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGTRefElement.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGTRefElement.cpp      2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/svg/SVGTRefElement.cpp 2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -25,7 +25,6 @@
</span><span class="cx"> #include "EventListener.h"
</span><span class="cx"> #include "EventNames.h"
</span><span class="cx"> #include "MutationEvent.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "RenderSVGInline.h"
</span><span class="cx"> #include "RenderSVGInlineText.h"
</span><span class="cx"> #include "RenderSVGResource.h"
</span><span class="lines">@@ -33,6 +32,7 @@
</span><span class="cx"> #include "SVGDocument.h"
</span><span class="cx"> #include "SVGDocumentExtensions.h"
</span><span class="cx"> #include "SVGNames.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "StyleInheritedData.h"
</span><span class="cx"> #include "Text.h"
</span><span class="cx"> #include "XLinkNames.h"
</span><span class="lines">@@ -146,7 +146,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto root = userAgentShadowRoot();
</span><span class="cx">     ASSERT(root);
</span><del>-    NoEventDispatchAssertion::EventAllowedScope allowedScope(*root);
</del><ins>+    ScriptDisallowedScope::EventAllowedScope allowedScope(*root);
</ins><span class="cx">     if (!root->firstChild())
</span><span class="cx">         root->appendChild(Text::create(document(), textContent));
</span><span class="cx">     else {
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGUseElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGUseElement.cpp       2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp  2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "ElementIterator.h"
</span><span class="cx"> #include "Event.h"
</span><span class="cx"> #include "EventNames.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "RenderSVGResource.h"
</span><span class="cx"> #include "RenderSVGTransformableContainer.h"
</span><span class="cx"> #include "SVGDocumentExtensions.h"
</span><span class="lines">@@ -38,6 +37,7 @@
</span><span class="cx"> #include "SVGGElement.h"
</span><span class="cx"> #include "SVGSVGElement.h"
</span><span class="cx"> #include "SVGSymbolElement.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "ShadowRoot.h"
</span><span class="cx"> #include "XLinkNames.h"
</span><span class="cx"> 
</span><span class="lines">@@ -219,7 +219,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (auto root = userAgentShadowRoot()) {
</span><span class="cx">         // Safe because SVG use element's shadow tree is never used to fire synchronous events during layout or DOM mutations.
</span><del>-        NoEventDispatchAssertion::EventAllowedScope scope(*root);
</del><ins>+        ScriptDisallowedScope::EventAllowedScope scope(*root);
</ins><span class="cx">         root->removeChildren();
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsSVGImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (226250 => 226251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp   2017-12-22 01:03:57 UTC (rev 226250)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp      2017-12-22 01:10:32 UTC (rev 226251)
</span><span class="lines">@@ -43,7 +43,6 @@
</span><span class="cx"> #include "JSDOMWindowBase.h"
</span><span class="cx"> #include "LibWebRTCProvider.h"
</span><span class="cx"> #include "MainFrame.h"
</span><del>-#include "NoEventDispatchAssertion.h"
</del><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PageConfiguration.h"
</span><span class="cx"> #include "RenderSVGRoot.h"
</span><span class="lines">@@ -54,6 +53,7 @@
</span><span class="cx"> #include "SVGImageClients.h"
</span><span class="cx"> #include "SVGImageElement.h"
</span><span class="cx"> #include "SVGSVGElement.h"
</span><ins>+#include "ScriptDisallowedScope.h"
</ins><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "SocketProvider.h"
</span><span class="cx"> #include <runtime/JSCInlines.h>
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx">     view->resize(containerSize());
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        NoEventDispatchAssertion::DisableAssertionsInScope disabledScope;
</del><ins>+        ScriptDisallowedScope::DisableAssertionsInScope disabledScope;
</ins><span class="cx">         if (view->needsLayout())
</span><span class="cx">             view->layoutContext().layout();
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>