[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00

darin at apple.com darin at apple.com
Wed Mar 17 18:28:59 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 9a903164c8840f805aa89918ba4412de713206b8
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 9 01:14:55 2010 +0000

    WebCore: Added a test for crash when you quit inside an unload handler.
    rdar://problem/6958347
    
    Reviewed by Dan Bernstein.
    
    * manual-tests/quit-inside-unload.html: Added.
    
    WebKit/mac: Fix crash when you quit inside an unload handler.
    rdar://problem/6958347
    
    Reviewed by Dan Bernstein.
    
    Test: manual-tests/quit-inside-unload.html
    
    * WebView/WebView.mm:
    (-[WebView _closeWithFastTeardown]): Removed code to set
    _private->closed since _close now does this earlier, before
    calling this method.
    (-[WebView _close]): Moved code to set _private->closed to the
    top of this method.
    (-[WebView setHostWindow:]): Rewrote the code that forbade
    setting the host window after closing so that it only forbids
    non-nil host windows. That way, the code to clear away the host
    window can run safely after setting _private->closed, yet client
    code cannot set a new host window after closing.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55701 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7f5ddd6..4effbb6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,14 @@
 2010-03-08  Darin Adler  <darin at apple.com>
 
+        Reviewed by Dan Bernstein.
+
+        Added a test for crash when you quit inside an unload handler.
+        rdar://problem/6958347
+
+        * manual-tests/quit-inside-unload.html: Added.
+
+2010-03-08  Darin Adler  <darin at apple.com>
+
         Reviewed by Jon Honeycutt.
 
         Don't auto-play <audio> and <video> elements loaded in background tabs
diff --git a/WebCore/manual-tests/quit-inside-unload.html b/WebCore/manual-tests/quit-inside-unload.html
new file mode 100644
index 0000000..23ae71d
--- /dev/null
+++ b/WebCore/manual-tests/quit-inside-unload.html
@@ -0,0 +1,14 @@
+<script>
+    var showedAlert = false;
+    function handleUnload()
+    {
+        if (showedAlert)
+            return;
+
+        showedAlert = true;
+        alert("Now Quit Safari. Do not dismiss this alert first.");
+    }
+</script>
+<body onunload="handleUnload()">
+    Close this window
+</body>
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index bbed317..ad8a7cd 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,5 +1,26 @@
 2010-03-08  Darin Adler  <darin at apple.com>
 
+        Reviewed by Dan Bernstein.
+
+        Fix crash when you quit inside an unload handler.
+        rdar://problem/6958347
+
+        Test: manual-tests/quit-inside-unload.html
+
+        * WebView/WebView.mm:
+        (-[WebView _closeWithFastTeardown]): Removed code to set
+        _private->closed since _close now does this earlier, before
+        calling this method.
+        (-[WebView _close]): Moved code to set _private->closed to the
+        top of this method.
+        (-[WebView setHostWindow:]): Rewrote the code that forbade
+        setting the host window after closing so that it only forbids
+        non-nil host windows. That way, the code to clear away the host
+        window can run safely after setting _private->closed, yet client
+        code cannot set a new host window after closing.
+
+2010-03-08  Darin Adler  <darin at apple.com>
+
         Roll out a file I checked in by accident.
 
         * WebView/WebView.mm: Back to previous version.
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 1700742..d3d7334 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -975,8 +975,6 @@ static bool shouldEnableLoadDeferring()
     WTF::RefCountedLeakCounter::suppressMessages("At least one WebView was closed with fast teardown.");
 #endif
 
-    _private->closed = YES;
-    
     [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
@@ -1009,6 +1007,8 @@ static bool fastDocumentTeardownEnabled()
     if (!_private || _private->closed)
         return;
 
+    _private->closed = YES;
+
     [self _closingEventHandling];
 
 #ifndef NDEBUG
@@ -1042,9 +1042,6 @@ static bool fastDocumentTeardownEnabled()
 
     [_private->inspector webViewClosed];
 
-    // setHostWindow:nil must be called before this value is set (see 5408186)
-    _private->closed = YES;
-
     // To avoid leaks, call removeDragCaret in case it wasn't called after moveDragCaretToPoint.
     [self removeDragCaret];
 
@@ -3339,7 +3336,7 @@ static bool needsWebViewInitThreadWorkaround()
 
 - (void)setHostWindow:(NSWindow *)hostWindow
 {
-    if (_private->closed)
+    if (_private->closed && hostWindow)
         return;
     if (hostWindow == _private->hostWindow)
         return;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list