Title: [158952] branches/safari-537.73-branch/Source/WebKit2

Diff

Modified: branches/safari-537.73-branch/Source/WebKit2/ChangeLog (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/ChangeLog	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/ChangeLog	2013-11-08 21:55:33 UTC (rev 158952)
@@ -1,3 +1,73 @@
+2013-11-08  Lucas Forschler  <[email protected]>
+
+        Merge r157137
+
+    2013-10-08  Anders Carlsson  <[email protected]>
+
+            WebProcess crash on SAP WebCycle web app
+            https://bugs.webkit.org/show_bug.cgi?id=122520
+            <rdar://problem/15030605>
+
+            Reviewed by Darin Adler.
+
+            Stop trying to use RunLoop to manage the top-level run loop and just have the child process and their
+            delegate subclasses start and stop the run loops. This fixes a bug with showModalDialog where we would
+            unintentionally call -[NSApp stop] when closing a modal dialog.
+
+            This also lets us move all knowledge of NSApplication from RunLoop. (Both the web process and plug-in process
+            need to use -[NSApp run] and -[NSApp stop:]).
+
+            * PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm:
+            (WebKit::PluginProcessMainDelegate::doPreInitializationWork):
+            Remove call to RunLoop::setUseApplicationRunLoopOnMainRunLoop. Add a startRunLoop override that calls
+            -[NSApp run].
+
+            * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
+            (PluginServiceInitializer):
+            Remove call to RunLoop::setUseApplicationRunLoopOnMainRunLoop.
+
+            * PluginProcess/PluginProcess.h:
+            Add stopRunLoop() override on Mac.
+
+            * PluginProcess/mac/PluginProcessMac.mm:
+            (WebKit::PluginProcess::stopRunLoop):
+            Call -[NSApp stop:] and tickle the event system.
+
+            * Shared/ChildProcess.cpp:
+            (WebKit::ChildProcess::stopRunLoop):
+            Add default implementation that just calls RunLoop::main()->stop().
+
+            (WebKit::ChildProcess::terminate):
+            Call stopRunLoop().
+
+            * Shared/ChildProcess.h:
+            * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h:
+            Add startRunLoop member function and call it instead of RunLoop::run().
+
+            * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.mm:
+            (WebKit::ChildProcessMainDelegate::startRunLoop):
+            Call RunLoop::run().
+
+            * WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm:
+            (WebKit::WebContentProcessMainDelegate::doPreInitializationWork):
+            Remove call to RunLoop::setUseApplicationRunLoopOnMainRunLoop.
+            Add startRunLoop override that calls -[NSApp run].
+
+            * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
+            (WebContentServiceInitializer):
+            Remove call to RunLoop::setUseApplicationRunLoopOnMainRunLoop.
+
+            * WebProcess/WebProcess.cpp:
+            (WebKit::WebProcess::didClose):
+            Call stopRunLoop().
+
+            * WebProcess/WebProcess.h:
+            Add stopRunLoop override.
+
+            * WebProcess/mac/WebProcessMac.mm:
+            (WebKit::WebProcess::stopRunLoop):
+            Call -[NSApp stop:] and tickle the event system.
+
 2013-11-06  Lucas Forschler  <[email protected]>
 
         Merge r154763

Modified: branches/safari-537.73-branch/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -58,8 +58,6 @@
         EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib");
 
 #if USE(APPKIT)
-        RunLoop::setUseApplicationRunLoopOnMainRunLoop();
-
         // Initialize AppKit.
         [NSApplication sharedApplication];
 
@@ -94,6 +92,12 @@
         return true;
     }
 
+    virtual void startRunLoop() OVERRIDE
+    {
+        ASSERT(NSApp);
+        [NSApp run];
+    }
+
     virtual void doPostRunWork()
     {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080

Modified: branches/safari-537.73-branch/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -73,7 +73,6 @@
     // Remove the PluginProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes
     // spawned by the PluginProcess don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib");
-    RunLoop::setUseApplicationRunLoopOnMainRunLoop();
 
     XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(connection, initializerMessage);
 }

Modified: branches/safari-537.73-branch/Source/WebKit2/PluginProcess/PluginProcess.h (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/PluginProcess/PluginProcess.h	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/PluginProcess/PluginProcess.h	2013-11-08 21:55:33 UTC (rev 158952)
@@ -74,6 +74,10 @@
     virtual bool shouldTerminate() OVERRIDE;
     void platformInitializeProcess(const ChildProcessInitializationParameters&);
 
+#if PLATFORM(MAC)
+    virtual void stopRunLoop() OVERRIDE;
+#endif
+
     // CoreIPC::Connection::Client
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
     virtual void didClose(CoreIPC::Connection*) OVERRIDE;

Modified: branches/safari-537.73-branch/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -493,6 +493,12 @@
     ChildProcess::initializeSandbox(parameters, sandboxParameters);
 }
 
+
+void PluginProcess::stopRunLoop()
+{
+    ChildProcess::stopNSAppRunLoop();
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)

Modified: branches/safari-537.73-branch/Source/WebKit2/Shared/ChildProcess.cpp (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/Shared/ChildProcess.cpp	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/Shared/ChildProcess.cpp	2013-11-08 21:55:33 UTC (rev 158952)
@@ -152,11 +152,16 @@
     terminate();
 }
 
+void ChildProcess::stopRunLoop()
+{
+    RunLoop::main()->stop();
+}
+
 void ChildProcess::terminate()
 {
     m_connection->invalidate();
 
-    RunLoop::main()->stop();
+    stopRunLoop();
 }
 
 #if !PLATFORM(MAC)

Modified: branches/safari-537.73-branch/Source/WebKit2/Shared/ChildProcess.h (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/Shared/ChildProcess.h	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/Shared/ChildProcess.h	2013-11-08 21:55:33 UTC (rev 158952)
@@ -91,6 +91,12 @@
     virtual bool shouldTerminate() = 0;
     virtual void terminate();
 
+    virtual void stopRunLoop();
+
+#if PLATFORM(MAC)
+    static void stopNSAppRunLoop();
+#endif
+
 private:
     // CoreIPC::MessageSender
     virtual CoreIPC::Connection* messageSenderConnection() OVERRIDE;

Modified: branches/safari-537.73-branch/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h	2013-11-08 21:55:33 UTC (rev 158952)
@@ -52,6 +52,7 @@
     virtual bool getClientProcessName(String& clientProcessName);
     virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData);
 
+    virtual void startRunLoop();
     virtual void doPostRunWork();
 
 protected:
@@ -95,7 +96,7 @@
         ChildProcessType::shared().initialize(parameters);
     }
 
-    WebCore::RunLoop::run();
+    delegate.startRunLoop();
 
     @autoreleasepool {
         delegate.doPostRunWork();

Modified: branches/safari-537.73-branch/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -34,6 +34,8 @@
 
 #define SHOW_CRASH_REPORTER 1
 
+using namespace WebCore;
+
 namespace WebKit {
 
 ChildProcessMainDelegate::~ChildProcessMainDelegate()
@@ -93,6 +95,11 @@
     return true;
 }
 
+void ChildProcessMainDelegate::startRunLoop()
+{
+    RunLoop::run();
+}
+
 void ChildProcessMainDelegate::doPostRunWork()
 {
 }

Modified: branches/safari-537.73-branch/Source/WebKit2/Shared/mac/ChildProcessMac.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/Shared/mac/ChildProcessMac.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/Shared/mac/ChildProcessMac.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -252,4 +252,13 @@
     }
 }
 
+void ChildProcess::stopNSAppRunLoop()
+{
+    ASSERT([NSApp isRunning]);
+    [NSApp stop:nil];
+
+    NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0.0 windowNumber:0 context:nil subtype:0 data1:0 data2:0];
+    [NSApp postEvent:event atStart:true];
 }
+
+} // namespace WebKit

Modified: branches/safari-537.73-branch/Source/WebKit2/WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -66,8 +66,6 @@
         EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib");
     
 #if USE(APPKIT)
-        RunLoop::setUseApplicationRunLoopOnMainRunLoop();
-
         // Initialize AppKit.
         [NSApplication sharedApplication];
 
@@ -166,6 +164,12 @@
             return false;
         return true;
     }
+
+    virtual void startRunLoop() OVERRIDE
+    {
+        ASSERT(NSApp);
+        [NSApp run];
+    }
 };
 
 } // namespace WebKit

Modified: branches/safari-537.73-branch/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -44,8 +44,6 @@
     // the this process don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib");
 
-    RunLoop::setUseApplicationRunLoopOnMainRunLoop();
-
     XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(connection, initializerMessage);
 }
 

Modified: branches/safari-537.73-branch/Source/WebKit2/WebProcess/WebProcess.cpp (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/WebProcess/WebProcess.cpp	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/WebProcess/WebProcess.cpp	2013-11-08 21:55:33 UTC (rev 158952)
@@ -672,7 +672,7 @@
 #endif    
 
     // The UI process closed this connection, shut down.
-    RunLoop::main()->stop();
+    stopRunLoop();
 }
 
 void WebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference)

Modified: branches/safari-537.73-branch/Source/WebKit2/WebProcess/WebProcess.h (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/WebProcess/WebProcess.h	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/WebProcess/WebProcess.h	2013-11-08 21:55:33 UTC (rev 158952)
@@ -246,6 +246,10 @@
     virtual bool shouldTerminate() OVERRIDE;
     virtual void terminate() OVERRIDE;
 
+#if PLATFORM(MAC)
+    virtual void stopRunLoop() OVERRIDE;
+#endif
+
     void platformInitializeProcess(const ChildProcessInitializationParameters&);
 
     // CoreIPC::Connection::Client

Modified: branches/safari-537.73-branch/Source/WebKit2/WebProcess/mac/WebProcessMac.mm (158951 => 158952)


--- branches/safari-537.73-branch/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2013-11-08 21:50:43 UTC (rev 158951)
+++ branches/safari-537.73-branch/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2013-11-08 21:55:33 UTC (rev 158952)
@@ -208,6 +208,11 @@
 #endif
 }
 
+void WebProcess::stopRunLoop()
+{
+    ChildProcess::stopNSAppRunLoop();
+}
+
 void WebProcess::platformTerminate()
 {
     if (m_clearResourceCachesDispatchGroup) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to