Title: [208340] trunk
Revision
208340
Author
[email protected]
Date
2016-11-03 12:31:07 -0700 (Thu, 03 Nov 2016)

Log Message

WKWebView’s _observedRenderingProgressEvents not restored after web process crash
https://bugs.webkit.org/show_bug.cgi?id=164368
<rdar://problem/29091954>

Reviewed by Anders Carlsson.

Source/WebKit2:

Test: TestWebKitAPI/Tests/WebKit2Cocoa/ObservedRenderingProgressEventsAfterCrash.mm.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode): Encode new observedLayoutMilestones member.
(WebKit::WebPageCreationParameters::decode): Decode it.
* Shared/WebPageCreationParameters.h: Declared new observedLayoutMilestones member variable.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy): Removed initializer for
  m_wantsSessionRestorationRenderTreeSizeThresholdEvent.
(WebKit::WebPageProxy::listenForLayoutMilestones): Update new m_observedLayoutMilestones
  member variable. Don’t update m_wantsSessionRestorationRenderTreeSizeThresholdEvent.
(WebKit::WebPageProxy::creationParameters): Set the observedLayoutMilestones member in the
  creation parameters.

* UIProcess/WebPageProxy.h: Declared new member variable, deleted
  m_wantsSessionRestorationRenderTreeSizeThresholdEvent declaration.

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didCommitLayerTree): Rather than using
  m_wantsSessionRestorationRenderTreeSizeThresholdEvent, use m_observedLayoutMilestones.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Add the observed layout milestones from the creation parameters.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/ObservedRenderingProgressEventsAfterCrash.mm: Added.
(TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (208339 => 208340)


--- trunk/Source/WebKit2/ChangeLog	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-03 19:31:07 UTC (rev 208340)
@@ -1,3 +1,36 @@
+2016-11-03  Dan Bernstein  <[email protected]>
+
+        WKWebView’s _observedRenderingProgressEvents not restored after web process crash
+        https://bugs.webkit.org/show_bug.cgi?id=164368
+        <rdar://problem/29091954>
+
+        Reviewed by Anders Carlsson.
+
+        Test: TestWebKitAPI/Tests/WebKit2Cocoa/ObservedRenderingProgressEventsAfterCrash.mm.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode): Encode new observedLayoutMilestones member.
+        (WebKit::WebPageCreationParameters::decode): Decode it.
+        * Shared/WebPageCreationParameters.h: Declared new observedLayoutMilestones member variable.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy): Removed initializer for
+          m_wantsSessionRestorationRenderTreeSizeThresholdEvent.
+        (WebKit::WebPageProxy::listenForLayoutMilestones): Update new m_observedLayoutMilestones
+          member variable. Don’t update m_wantsSessionRestorationRenderTreeSizeThresholdEvent.
+        (WebKit::WebPageProxy::creationParameters): Set the observedLayoutMilestones member in the
+          creation parameters.
+
+        * UIProcess/WebPageProxy.h: Declared new member variable, deleted
+          m_wantsSessionRestorationRenderTreeSizeThresholdEvent declaration.
+
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::didCommitLayerTree): Rather than using
+          m_wantsSessionRestorationRenderTreeSizeThresholdEvent, use m_observedLayoutMilestones.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Add the observed layout milestones from the creation parameters.
+
 2016-11-02  Alex Christensen  <[email protected]>
 
         Reduce PassRefPtr use in WebKit2

Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp (208339 => 208340)


--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp	2016-11-03 19:31:07 UTC (rev 208340)
@@ -88,6 +88,7 @@
     encoder << appleMailPaginationQuirkEnabled;
     encoder << shouldScaleViewToFitDocument;
     encoder.encodeEnum(userInterfaceLayoutDirection);
+    encoder.encodeEnum(observedLayoutMilestones);
 }
 
 bool WebPageCreationParameters::decode(IPC::Decoder& decoder, WebPageCreationParameters& parameters)
@@ -200,6 +201,8 @@
 
     if (!decoder.decodeEnum(parameters.userInterfaceLayoutDirection))
         return false;
+    if (!decoder.decodeEnum(parameters.observedLayoutMilestones))
+        return false;
 
     return true;
 }

Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.h (208339 => 208340)


--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.h	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.h	2016-11-03 19:31:07 UTC (rev 208340)
@@ -36,6 +36,7 @@
 #include <WebCore/Color.h>
 #include <WebCore/FloatSize.h>
 #include <WebCore/IntSize.h>
+#include <WebCore/LayoutMilestones.h>
 #include <WebCore/MediaProducer.h>
 #include <WebCore/Pagination.h>
 #include <WebCore/ScrollTypes.h>
@@ -138,6 +139,7 @@
     bool shouldScaleViewToFitDocument;
 
     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection;
+    WebCore::LayoutMilestones observedLayoutMilestones;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (208339 => 208340)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-03 19:31:07 UTC (rev 208340)
@@ -443,7 +443,6 @@
     , m_pageCount(0)
     , m_renderTreeSize(0)
     , m_sessionRestorationRenderTreeSize(0)
-    , m_wantsSessionRestorationRenderTreeSizeThresholdEvent(false)
     , m_hitRenderTreeSizeThreshold(false)
     , m_suppressVisibilityUpdates(false)
     , m_autoSizingShouldExpandToViewHeight(false)
@@ -2615,8 +2614,10 @@
     if (!isValid())
         return;
     
-    m_wantsSessionRestorationRenderTreeSizeThresholdEvent = milestones & WebCore::ReachedSessionRestorationRenderTreeSizeThreshold;
+    if (milestones == m_observedLayoutMilestones)
+        return;
 
+    m_observedLayoutMilestones = milestones;
     m_process->send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID);
 }
 
@@ -5529,6 +5530,7 @@
 #endif
     parameters.shouldScaleViewToFitDocument = m_shouldScaleViewToFitDocument;
     parameters.userInterfaceLayoutDirection = m_pageClient.userInterfaceLayoutDirection();
+    parameters.observedLayoutMilestones = m_observedLayoutMilestones;
 
     return parameters;
 }

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (208339 => 208340)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-03 19:31:07 UTC (rev 208340)
@@ -1697,6 +1697,8 @@
     bool m_useFixedLayout;
     WebCore::IntSize m_fixedLayoutSize;
 
+    WebCore::LayoutMilestones m_observedLayoutMilestones { 0 };
+
     bool m_suppressScrollbarAnimations;
 
     WebCore::Pagination::Mode m_paginationMode;
@@ -1849,7 +1851,6 @@
 
     uint64_t m_renderTreeSize;
     uint64_t m_sessionRestorationRenderTreeSize;
-    bool m_wantsSessionRestorationRenderTreeSizeThresholdEvent;
     bool m_hitRenderTreeSizeThreshold;
 
     bool m_suppressVisibilityUpdates;

Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (208339 => 208340)


--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2016-11-03 19:31:07 UTC (rev 208340)
@@ -361,7 +361,7 @@
     m_pageClient.didCommitLayerTree(layerTreeTransaction);
 
     // FIXME: Remove this special mechanism and fold it into the transaction's layout milestones.
-    if (m_wantsSessionRestorationRenderTreeSizeThresholdEvent && !m_hitRenderTreeSizeThreshold
+    if ((m_observedLayoutMilestones & WebCore::ReachedSessionRestorationRenderTreeSizeThreshold) && !m_hitRenderTreeSizeThreshold
         && exceedsRenderTreeSizeSizeThreshold(m_sessionRestorationRenderTreeSize, layerTreeTransaction.renderTreeSize())) {
         m_hitRenderTreeSizeThreshold = true;
         didReachLayoutMilestone(WebCore::ReachedSessionRestorationRenderTreeSizeThreshold);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (208339 => 208340)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-03 19:31:07 UTC (rev 208340)
@@ -560,6 +560,8 @@
     if (parameters.viewScaleFactor != 1)
         scaleView(parameters.viewScaleFactor);
 
+    m_page->addLayoutMilestones(parameters.observedLayoutMilestones);
+
 #if PLATFORM(COCOA)
     m_page->settings().setContentDispositionAttachmentSandboxEnabled(true);
 #endif

Modified: trunk/Tools/ChangeLog (208339 => 208340)


--- trunk/Tools/ChangeLog	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Tools/ChangeLog	2016-11-03 19:31:07 UTC (rev 208340)
@@ -1,3 +1,15 @@
+2016-11-03  Dan Bernstein  <[email protected]>
+
+        WKWebView’s _observedRenderingProgressEvents not restored after web process crash
+        https://bugs.webkit.org/show_bug.cgi?id=164368
+        <rdar://problem/29091954>
+
+        Reviewed by Anders Carlsson.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2Cocoa/ObservedRenderingProgressEventsAfterCrash.mm: Added.
+        (TEST):
+
 2016-11-03  Alex Christensen  <[email protected]>
 
         Purge PassRefPtr from Tools

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (208339 => 208340)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-11-03 19:09:42 UTC (rev 208339)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-11-03 19:31:07 UTC (rev 208340)
@@ -95,6 +95,7 @@
 		378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; };
 		378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
 		379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
+		37A22AA71DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */; };
 		37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */; };
 		37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */; };
 		37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; };
@@ -850,6 +851,7 @@
 		379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AcceptsFirstMouse.mm; sourceTree = "<group>"; };
 		379028B814FABE49007E6B43 /* acceptsFirstMouse.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = acceptsFirstMouse.html; sourceTree = "<group>"; };
 		3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = "<group>"; };
+		37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObservedRenderingProgressEventsAfterCrash.mm; sourceTree = "<group>"; };
 		37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SubresourceErrorCrash.mm; sourceTree = "<group>"; };
 		37B47E2E1D64E7CA005F4EFF /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; };
 		37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShouldOpenExternalURLsInNewWindowActions.mm; sourceTree = "<group>"; };
@@ -1414,6 +1416,7 @@
 				51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */,
 				1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
 				2ECFF5541D9B12F800B55394 /* NowPlayingControlsTests.mm */,
+				37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */,
 				CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
 				C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
 				5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */,
@@ -2388,6 +2391,7 @@
 				7CCE7EE91A411AE600447C4C /* DidAssociateFormControls.cpp in Sources */,
 				7CCE7EEA1A411AE600447C4C /* DidNotHandleKeyDown.cpp in Sources */,
 				7CCE7EEB1A411AE600447C4C /* DocumentStartUserScriptAlertCrash.cpp in Sources */,
+				37A22AA71DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm in Sources */,
 				7CCE7EBB1A411A7E00447C4C /* DOMHTMLTableCellCellAbove.mm in Sources */,
 				2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */,
 				7CCE7EBC1A411A7E00447C4C /* DOMNodeFromJSObject.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ObservedRenderingProgressEventsAfterCrash.mm (0 => 208340)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ObservedRenderingProgressEventsAfterCrash.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ObservedRenderingProgressEventsAfterCrash.mm	2016-11-03 19:31:07 UTC (rev 208340)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2016 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 "TestNavigationDelegate.h"
+#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if PLATFORM(MAC) && WK_API_ENABLED
+
+TEST(WebKit2, ObservedRenderingProgressEventsAfterCrash)
+{
+    __block bool done = false;
+    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration setSuppressesIncrementalRendering:YES];
+
+    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+
+    RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+    [window.get().contentView addSubview:webView.get()];
+
+    RetainPtr<TestNavigationDelegate> delegate = adoptNS([[TestNavigationDelegate alloc] init]);
+    [delegate setRenderingProgressDidChange:^(WKWebView *webView, _WKRenderingProgressEvents progressEvents) {
+        if (progressEvents & _WKRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering)
+            done = true;
+    }];
+
+    [webView setNavigationDelegate:delegate.get()];
+    [webView _setObservedRenderingProgressEvents:_WKRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering];
+    [webView _killWebContentProcessAndResetState];
+    [webView loadHTMLString:@"content" baseURL:nil];
+    TestWebKitAPI::Util::run(&done);
+}
+
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to