Title: [225772] trunk/Source/WebCore
Revision
225772
Author
[email protected]
Date
2017-12-11 22:30:34 -0800 (Mon, 11 Dec 2017)

Log Message

Disable NoEventDispatchAssertion release assertion in WebKit1
https://bugs.webkit.org/show_bug.cgi?id=180616

Reviewed by Zalan Bujtas.

Disabled the release assertion for NoEventDispatchAssertion in WebKit1 since there are many
delegate callbacks that happen at unsafe timing, and we don't have any hope of fixing them
in short term.

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::canExecuteScripts):
* dom/Document.cpp:
(WebCore::isSafeToUpdateStyleOrLayout):
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeClassicScript):
* platform/RuntimeApplicationChecks.h:
(WebCore::isInWebProcess):
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::isInWebProcess): Extracted from IOSApplication::isWebProcess.
(WebCore::IOSApplication::isWebProcess):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225771 => 225772)


--- trunk/Source/WebCore/ChangeLog	2017-12-12 05:47:18 UTC (rev 225771)
+++ trunk/Source/WebCore/ChangeLog	2017-12-12 06:30:34 UTC (rev 225772)
@@ -1,3 +1,26 @@
+2017-12-11  Ryosuke Niwa  <[email protected]>
+
+        Disable NoEventDispatchAssertion release assertion in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=180616
+
+        Reviewed by Zalan Bujtas.
+
+        Disabled the release assertion for NoEventDispatchAssertion in WebKit1 since there are many
+        delegate callbacks that happen at unsafe timing, and we don't have any hope of fixing them
+        in short term.
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::canExecuteScripts):
+        * dom/Document.cpp:
+        (WebCore::isSafeToUpdateStyleOrLayout):
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::executeClassicScript):
+        * platform/RuntimeApplicationChecks.h:
+        (WebCore::isInWebProcess):
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::isInWebProcess): Extracted from IOSApplication::isWebProcess.
+        (WebCore::IOSApplication::isWebProcess):
+
 2017-12-11  Darin Adler  <[email protected]>
 
         Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher

Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (225771 => 225772)


--- trunk/Source/WebCore/bindings/js/ScriptController.cpp	2017-12-12 05:47:18 UTC (rev 225771)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp	2017-12-12 06:30:34 UTC (rev 225772)
@@ -48,6 +48,7 @@
 #include "PageConsoleClient.h"
 #include "PageGroup.h"
 #include "PluginViewBase.h"
+#include "RuntimeApplicationChecks.h"
 #include "ScriptSourceCode.h"
 #include "ScriptableDocumentParser.h"
 #include "Settings.h"
@@ -668,7 +669,7 @@
 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reason)
 {
     if (reason == AboutToExecuteScript)
-        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
+        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed() || !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/Document.cpp (225771 => 225772)


--- trunk/Source/WebCore/dom/Document.cpp	2017-12-12 05:47:18 UTC (rev 225771)
+++ trunk/Source/WebCore/dom/Document.cpp	2017-12-12 06:30:34 UTC (rev 225772)
@@ -152,6 +152,7 @@
 #include "RenderWidget.h"
 #include "RequestAnimationFrameCallback.h"
 #include "ResourceLoadObserver.h"
+#include "RuntimeApplicationChecks.h"
 #include "RuntimeEnabledFeatures.h"
 #include "SVGDocumentExtensions.h"
 #include "SVGElement.h"
@@ -1924,15 +1925,9 @@
 
 inline bool static isSafeToUpdateStyleOrLayout(FrameView* frameView)
 {
-#if USE(WEB_THREAD)
-    // FIXME: Remove this code: <rdar://problem/35522719>
-    bool usingWebThread = WebThreadIsEnabled();
-#else
-    bool usingWebThread = false;
-#endif
     bool isSafeToExecuteScript = NoEventDispatchAssertion::InMainThread::isEventAllowed();
     bool isInFrameFlattening = frameView && frameView->isInChildFrameWithFrameFlattening();
-    return isSafeToExecuteScript || isInFrameFlattening || usingWebThread;
+    return isSafeToExecuteScript || isInFrameFlattening || !isInWebProcess();
 }
 
 bool Document::updateStyleIfNeeded()

Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (225771 => 225772)


--- trunk/Source/WebCore/dom/ScriptElement.cpp	2017-12-12 05:47:18 UTC (rev 225771)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp	2017-12-12 06:30:34 UTC (rev 225772)
@@ -43,6 +43,7 @@
 #include "MIMETypeRegistry.h"
 #include "NoEventDispatchAssertion.h"
 #include "PendingScript.h"
+#include "RuntimeApplicationChecks.h"
 #include "SVGScriptElement.h"
 #include "ScriptController.h"
 #include "ScriptRunner.h"
@@ -361,7 +362,7 @@
 
 void ScriptElement::executeClassicScript(const ScriptSourceCode& sourceCode)
 {
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed());
+    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventAllowed() || !isInWebProcess());
     ASSERT(m_alreadyStarted);
 
     if (sourceCode.isEmpty())

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (225771 => 225772)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2017-12-12 05:47:18 UTC (rev 225771)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2017-12-12 06:30:34 UTC (rev 225772)
@@ -32,8 +32,16 @@
 WEBCORE_EXPORT void setPresentingApplicationPID(int);
 WEBCORE_EXPORT int presentingApplicationPID();
 
+#if PLATFORM(WIN)
+inline bool isInWebProcess() { return false; }
+#elif !PLATFORM(COCOA)
+inline bool isInWebProcess() { return true; }
+#endif
+
 #if PLATFORM(COCOA)
 
+bool isInWebProcess();
+
 WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
 String applicationBundleIdentifier();
 

Modified: trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm (225771 => 225772)


--- trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2017-12-12 05:47:18 UTC (rev 225771)
+++ trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2017-12-12 06:30:34 UTC (rev 225772)
@@ -65,6 +65,14 @@
     applicationBundleIdentifierOverride() = bundleIdentifier;
 }
 
+bool isInWebProcess()
+{
+    static bool mainBundleIsWebProcess = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebKit.WebContent.Development"]
+        || [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebKit.WebContent"]
+        || [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebProcess"];
+    return mainBundleIsWebProcess;
+}
+
 static bool applicationBundleIsEqualTo(const String& bundleIdentifierString)
 {
     return applicationBundleIdentifier() == bundleIdentifierString;
@@ -207,10 +215,7 @@
 // FIXME: this needs to be changed when the WebProcess is changed to an XPC service.
 bool IOSApplication::isWebProcess()
 {
-    static bool isWebProcess = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebKit.WebContent.Development"]
-        || [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebKit.WebContent"]
-        || [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebProcess"];
-    return isWebProcess;
+    return isInWebProcess();
 }
 
 bool IOSApplication::isIBooks()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to