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