[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aroben at apple.com aroben at apple.com
Wed Dec 22 13:12:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 43803ddb9ded6f58300217249474ea307edeeab3
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 8 21:27:10 2010 +0000

    Add a way to cause the web process to crash at a random time
    
    Setting the WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY environment variable
    will cause the web process to crash at a random point up to 3 minutes
    after launching.
    
    Fixes <http://webkit.org/b/43058> <rdar://problem/8240150>
    
    Reviewed by Darin Adler.
    
    * WebProcess/WebProcess.cpp:
    (WebKit::sleep): Added an implementation of this function for Windows.
    It just calls through to ::Sleep.
    (WebKit::randomCrashThread): Added. Sleeps for a random amount of time
    up to 3 minutes, then crashes.
    (WebKit::startRandomCrashThreadIfRequested): Added. Starts the crash
    thread if the WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY environment variable
    is set.
    (WebKit::WebProcess::initialize): Added a call to
    startRandomCrashThreadIfRequested.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67016 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index b280b92..23d3eed 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,28 @@
 2010-09-08  Adam Roben  <aroben at apple.com>
 
+        Add a way to cause the web process to crash at a random time
+
+        Setting the WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY environment variable
+        will cause the web process to crash at a random point up to 3 minutes
+        after launching.
+
+        Fixes <http://webkit.org/b/43058> <rdar://problem/8240150>
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::sleep): Added an implementation of this function for Windows.
+        It just calls through to ::Sleep.
+        (WebKit::randomCrashThread): Added. Sleeps for a random amount of time
+        up to 3 minutes, then crashes.
+        (WebKit::startRandomCrashThreadIfRequested): Added. Starts the crash
+        thread if the WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY environment variable
+        is set.
+        (WebKit::WebProcess::initialize): Added a call to
+        startRandomCrashThreadIfRequested.
+
+2010-09-08  Adam Roben  <aroben at apple.com>
+
         Fix potential ref-counting issues with WorkItemWin
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index 097f88c..2c93ffd 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -41,6 +41,7 @@
 #include <WebCore/SchemeRegistry.h>
 #include <WebCore/Settings.h>
 #include <wtf/PassRefPtr.h>
+#include <wtf/RandomNumber.h>
 
 #if PLATFORM(MAC)
 #include "MachPort.h"
@@ -55,6 +56,32 @@ using namespace WebCore;
 
 namespace WebKit {
 
+#if OS(WINDOWS)
+static void sleep(unsigned seconds)
+{
+    ::Sleep(seconds * 1000);
+}
+#endif
+
+static void* randomCrashThread(void*)
+{
+    // This delay was chosen semi-arbitrarily. We want the crash to happen somewhat quickly to
+    // enable useful stress testing, but not so quickly that the web process will always crash soon
+    // after launch.
+    static const unsigned maximumRandomCrashDelay = 180;
+
+    sleep(randomNumber() * maximumRandomCrashDelay);
+    CRASH();
+    return 0;
+}
+
+static void startRandomCrashThreadIfRequested()
+{
+    if (!getenv("WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY"))
+        return;
+    createThread(randomCrashThread, 0, "WebKit2: Random Crash Thread");
+}
+
 WebProcess& WebProcess::shared()
 {
     static WebProcess& process = *new WebProcess;
@@ -81,6 +108,8 @@ void WebProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, Ru
     m_connection->open();
 
     m_runLoop = runLoop;
+
+    startRandomCrashThreadIfRequested();
 }
 
 #if ENABLE(WEB_PROCESS_SANDBOX)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list