Title: [257694] trunk
Revision
257694
Author
[email protected]
Date
2020-03-01 15:36:03 -0800 (Sun, 01 Mar 2020)

Log Message

Unreviewed, rolling out r257618.

This allegedly causes Safari to crash when closing a window
(see rdar://problem/59922725).

Reverted changeset:

"UIProcess crash after using _prepareForMoveToWindow, then
deallocating the WKWebView before moving to the window"
https://bugs.webkit.org/show_bug.cgi?id=208365
https://trac.webkit.org/changeset/257618

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (257693 => 257694)


--- trunk/Source/WebKit/ChangeLog	2020-03-01 23:13:46 UTC (rev 257693)
+++ trunk/Source/WebKit/ChangeLog	2020-03-01 23:36:03 UTC (rev 257694)
@@ -1,5 +1,19 @@
 2020-03-01  Wenson Hsieh  <[email protected]>
 
+        Unreviewed, rolling out r257618.
+
+        This allegedly causes Safari to crash when closing a window
+        (see rdar://problem/59922725).
+
+        Reverted changeset:
+
+        "UIProcess crash after using _prepareForMoveToWindow, then
+        deallocating the WKWebView before moving to the window"
+        https://bugs.webkit.org/show_bug.cgi?id=208365
+        https://trac.webkit.org/changeset/257618
+
+2020-03-01  Wenson Hsieh  <[email protected]>
+
         Many tests in canvas and fast/canvas are asserting after r257677
         https://bugs.webkit.org/show_bug.cgi?id=208431
         <rdar://problem/59911910>

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (257693 => 257694)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-03-01 23:13:46 UTC (rev 257693)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-03-01 23:36:03 UTC (rev 257694)
@@ -201,7 +201,6 @@
     WebKit::WebViewImpl *_impl;
 
     BOOL _didRegisterForLookupPopoverCloseNotifications;
-    __weak NSWindow *_observingWindow;
 }
 
 - (instancetype)initWithView:(NSView *)view impl:(WebKit::WebViewImpl&)impl;
@@ -238,8 +237,6 @@
     NSNotificationCenter *workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
     [workspaceNotificationCenter removeObserver:self name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
 
-    [self setWindowToObserve:nil];
-
     [super dealloc];
 }
 
@@ -302,14 +299,6 @@
     [window removeObserver:self forKeyPath:@"titlebarAppearsTransparent" context:keyValueObservingContext];
 }
 
-- (void)setWindowToObserve:(NSWindow *)window
-{
-    if (_observingWindow)
-        [self stopObserving:_observingWindow];
-    _observingWindow = window;
-    [self startObserving:window];
-}
-
 - (void)startObservingFontPanel
 {
     [[NSFontPanel sharedFontPanel] addObserver:self forKeyPath:@"visible" options:0 context:keyValueObservingContext];
@@ -2220,7 +2209,9 @@
 
     clearAllEditCommands();
 
-    [m_windowVisibilityObserver setWindowToObserve:window];
+    NSWindow *stopObservingWindow = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : [m_view window];
+    [m_windowVisibilityObserver stopObserving:stopObservingWindow];
+    [m_windowVisibilityObserver startObserving:window];
 }
 
 void WebViewImpl::viewDidMoveToWindow()

Modified: trunk/Tools/ChangeLog (257693 => 257694)


--- trunk/Tools/ChangeLog	2020-03-01 23:13:46 UTC (rev 257693)
+++ trunk/Tools/ChangeLog	2020-03-01 23:36:03 UTC (rev 257694)
@@ -1,3 +1,17 @@
+2020-03-01  Wenson Hsieh  <[email protected]>
+
+        Unreviewed, rolling out r257618.
+
+        This allegedly causes Safari to crash when closing a window
+        (see rdar://problem/59922725).
+
+        Reverted changeset:
+
+        "UIProcess crash after using _prepareForMoveToWindow, then
+        deallocating the WKWebView before moving to the window"
+        https://bugs.webkit.org/show_bug.cgi?id=208365
+        https://trac.webkit.org/changeset/257618
+
 2020-02-29  Yusuke Suzuki  <[email protected]>
 
         Remove std::lock_guard

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PrepareForMoveToWindow.mm (257693 => 257694)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PrepareForMoveToWindow.mm	2020-03-01 23:13:46 UTC (rev 257693)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PrepareForMoveToWindow.mm	2020-03-01 23:36:03 UTC (rev 257694)
@@ -76,25 +76,4 @@
     TestWebKitAPI::Util::run(&isDone);
 }
 
-TEST(WKWebView, PrepareForMoveToWindowCrashAfterNotMovingToWindow)
-{
-    auto webView = adoptNS([[WKWebView alloc] init]);
-    RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
-
-    [webView _prepareForMoveToWindow:window.get() completionHandler:^{ }];
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [webView _prepareForMoveToWindow:window.get() completionHandler:^{ }];
-
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [window setFrame:NSMakeRect(0, 0, 10, 10) display:YES];
-            isDone = true;
-        });
-    });
-
-    webView = nil;
-
-    TestWebKitAPI::Util::run(&isDone);
-}
-
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to