Diff
Modified: trunk/Source/WebKit2/ChangeLog (214018 => 214019)
--- trunk/Source/WebKit2/ChangeLog 2017-03-15 23:17:15 UTC (rev 214018)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-15 23:29:17 UTC (rev 214019)
@@ -1,3 +1,15 @@
+2017-03-15 Tim Horton <timothy_hor...@apple.com>
+
+ Null deref under callAfterNextPresentationUpdate
+ https://bugs.webkit.org/show_bug.cgi?id=169710
+ <rdar://problem/30987863>
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
+ Call the callback with an error if we don't have a web process or drawing area.
+
2017-03-15 Chris Dumez <cdu...@apple.com>
Document state (e.g. form data) is lost after a tab is terminated in the background for power reasons
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (214018 => 214019)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2017-03-15 23:17:15 UTC (rev 214018)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2017-03-15 23:29:17 UTC (rev 214019)
@@ -6734,6 +6734,11 @@
void WebPageProxy::callAfterNextPresentationUpdate(std::function<void (CallbackBase::Error)> callback)
{
+ if (!isValid() || !m_drawingArea) {
+ callback(CallbackBase::Error::OwnerWasInvalidated);
+ return;
+ }
+
m_drawingArea->dispatchAfterEnsuringDrawing(callback);
}
Modified: trunk/Tools/ChangeLog (214018 => 214019)
--- trunk/Tools/ChangeLog 2017-03-15 23:17:15 UTC (rev 214018)
+++ trunk/Tools/ChangeLog 2017-03-15 23:29:17 UTC (rev 214019)
@@ -1,3 +1,15 @@
+2017-03-15 Tim Horton <timothy_hor...@apple.com>
+
+ Null deref under callAfterNextPresentationUpdate
+ https://bugs.webkit.org/show_bug.cgi?id=169710
+ <rdar://problem/30987863>
+
+ Reviewed by Simon Fraser.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/DoAfterNextPresentationUpdateAfterCrash.mm: Added.
+ (TEST):
+
2017-03-15 Chris Dumez <cdu...@apple.com>
Document state (e.g. form data) is lost after a tab is terminated in the background for power reasons
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (214018 => 214019)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-03-15 23:17:15 UTC (rev 214018)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-03-15 23:29:17 UTC (rev 214019)
@@ -64,6 +64,7 @@
2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */; };
2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */; };
2DC4CF771D2D9DD800ECCC94 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */; };
+ 2DC60E231E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC60E221E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm */; };
2DD7D3AF178227B30026E1E3 /* lots-of-text-vertical-lr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */; };
2DE71AFE1D49C0BD00904094 /* AnimatedResize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DE71AFD1D49C0BD00904094 /* AnimatedResize.mm */; };
2DE71B001D49C3ED00904094 /* blinking-div.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DE71AFF1D49C2F000904094 /* blinking-div.html */; };
@@ -926,6 +927,7 @@
2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShrinkToFit.mm; sourceTree = "<group>"; };
2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InteractionDeadlockAfterCrash.mm; sourceTree = "<group>"; };
2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetection.mm; sourceTree = "<group>"; };
+ 2DC60E221E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DoAfterNextPresentationUpdateAfterCrash.mm; sourceTree = "<group>"; };
2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoLayoutIntegration.mm; sourceTree = "<group>"; };
2DD7D3A9178205D00026E1E3 /* ResizeReversePaginatedWebView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeReversePaginatedWebView.cpp; sourceTree = "<group>"; };
2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "lots-of-text-vertical-lr.html"; sourceTree = "<group>"; };
@@ -1611,6 +1613,7 @@
A14FC5891B89927100D107EB /* ContentFilteringPlugIn.mm */,
5C2936911D5BF63E00DEAB1E /* CookieAcceptPolicy.mm */,
2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */,
+ 2DC60E221E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm */,
A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
A15502281E05020B00A24C57 /* DuplicateCompletionHandlerCalls.mm */,
2D8104CB1BEC13E70020DA46 /* FindInPage.mm */,
@@ -2687,6 +2690,7 @@
7CCE7EB71A411A7E00447C4C /* CloseNewWindowInNavigationPolicyDelegate.mm in Sources */,
7CCE7EE51A411AE600447C4C /* CloseThenTerminate.cpp in Sources */,
7C83E0BA1D0A64FB00FEBCF3 /* Coding.mm in Sources */,
+ 2DC60E231E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm in Sources */,
F4FA91811E61849B007B8C1D /* WKWebViewSelectionTests.mm in Sources */,
7C3965061CDD74F90094DBB8 /* Color.cpp in Sources */,
7C3DB8E41D12129B00AE8CC3 /* CommandBackForward.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DoAfterNextPresentationUpdateAfterCrash.mm (0 => 214019)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DoAfterNextPresentationUpdateAfterCrash.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DoAfterNextPresentationUpdateAfterCrash.mm 2017-03-15 23:29:17 UTC (rev 214019)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if PLATFORM(IOS) && WK_API_ENABLED
+
+TEST(WebKit2, DoAfterNextPresentationUpdateAfterCrash)
+{
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]);
+
+ [webView loadHTMLString:@"test" baseURL:nil];
+ [webView _test_waitForDidFinishNavigation];
+
+ [webView _killWebContentProcessAndResetState];
+
+ __block bool gotCallback = false;
+ [webView _doAfterNextPresentationUpdate:^ {
+ gotCallback = true;
+ }];
+
+ [webView loadHTMLString:@"test" baseURL:nil];
+ [webView _test_waitForDidFinishNavigation];
+
+ TestWebKitAPI::Util::run(&gotCallback);
+}
+
+#endif