WebKit Bugzilla
Attachment 362573 Details for
Bug 194845
: Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194845-20190220170255.patch (text/plain), 30.12 KB, created by
Tim Horton
on 2019-02-20 17:02:56 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2019-02-20 17:02:56 PST
Size:
30.12 KB
patch
obsolete
>Subversion Revision: 241789 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 05648c595cecd326d58fd43629ca20f5e29c7e5b..16c6f93a62f550992435db3ac53b8375062d314b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,61 @@ >+2019-02-19 Tim Horton <timothy_horton@apple.com> >+ >+ Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process >+ https://bugs.webkit.org/show_bug.cgi?id=194845 >+ <rdar://problem/47944579> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ New test: ProcessSwap.PageOverlayLayerPersistence >+ >+ * page/Page.cpp: >+ (WebCore::Page::installedPageOverlaysChanged): Deleted. >+ * page/Page.h: >+ (WebCore::Page::pageOverlayController): >+ Move this to PageOverlayController, like r240940 intended. >+ >+ * page/PageOverlay.cpp: >+ (WebCore::PageOverlay::willReattachToPage): >+ * page/PageOverlay.h: >+ Add a PageOverlay::Client method to inform clients when the overlay's >+ page is reattached. Importantly, this means "destroy any outstanding owned GraphicsLayers". >+ >+ * page/PageOverlayController.cpp: >+ (WebCore::PageOverlayController::attachViewOverlayLayers): >+ (WebCore::PageOverlayController::detachViewOverlayLayers): >+ These are now only called internally, and only manipulate the root layer >+ for view-relative overlays, like the name says. >+ >+ (WebCore::PageOverlayController::installedPageOverlaysChanged): >+ Moved from Page. Stop checking isInWindow; because the root layers are >+ installed by the DrawingArea and RenderLayerCompositor, we can just install >+ unconditionally and don't need to worry about in-window state. >+ Also, fold updateForceSynchronousScrollLayerPositionUpdates in here. >+ >+ (WebCore::PageOverlayController::installLayerForOverlay): >+ Factor overlay layer creation out into its own function. >+ >+ (WebCore::PageOverlayController::installPageOverlay): >+ Adopt installLayerForOverlay and the local installedPageOverlaysChanged. >+ >+ (WebCore::PageOverlayController::uninstallPageOverlay): >+ Adopt the local installedPageOverlaysChanged. >+ >+ (WebCore::PageOverlayController::recreatePageOverlayLayers): >+ Tear down all page overlay related GraphicsLayers, first by removing >+ the directly-owned layers for each overlay, then by informing the overlay >+ client that we're going to reattach (see above), then by destroying the root >+ layers. Then, re-create all of the individual overlay layers and call >+ installedPageOverlaysChanged() to re-create and re-attach the root layers. >+ >+ (WebCore::PageOverlayController::destroyRootLayers): >+ (WebCore::PageOverlayController::willDetachRootLayer): Deleted. >+ * page/PageOverlayController.h: >+ * page/mac/ServicesOverlayController.h: >+ * page/mac/ServicesOverlayController.mm: >+ (WebCore::ServicesOverlayController::willReattachToPage): >+ Invalidate old highlights, which will unparent and toss their GraphicsLayers. >+ > 2019-02-19 Simon Fraser <simon.fraser@apple.com> > > REGRESSION (r238090): Toggling visibility on the <html> element can result in a blank web view >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 91019bbd17aae0420b71784a6108119c31f7091c..5bd97d71b5f01996cd8ab8910b6346b3ddeba7ed 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,38 @@ >+2019-02-19 Tim Horton <timothy_horton@apple.com> >+ >+ Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process >+ https://bugs.webkit.org/show_bug.cgi?id=194845 >+ <rdar://problem/47944579> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When re-attaching to an old Web Content process, we re-create the DrawingArea. >+ If that process kept PlatformCALayerRemote instances alive, we can end up >+ with layers from an old RemoteLayerTreeContext in the new layer tree. >+ For normal page layers, this does not happen because RenderLayerCompositor >+ is also torn down during the swap, but Page Overlays create and maintain >+ layers outside of the normal flow. >+ >+ Also, since we accumulate layer births from the PlatformCALayerRemote >+ constructor, if we keep layers around and then try to switch *back* to >+ the process, the UI process will have deleted them, and will not get >+ a new creation notification. This results in a crash when looking up >+ the layer. Avoid the crash with a null check. >+ >+ In order to actually make Page Overlays installed before the swap continue >+ working, introduce a variety of mechanisms to make them re-create their >+ GraphicsLayers when we swap DrawingArea (and RemoteLayerTreeContext). >+ See the WebCore ChangeLog for details. >+ >+ * WebProcess/WebCoreSupport/WebInspectorClient.cpp: >+ (WebKit::WebInspectorClient::willReattachToPage): >+ * WebProcess/WebCoreSupport/WebInspectorClient.h: >+ Unparent and toss GraphicsLayers for old repaint highlights. >+ >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::reinitializeWebPage): >+ Rebuild all page overlay GraphicsLayers when re-creating the DrawingArea. >+ > 2019-02-19 Antti Koivisto <antti@apple.com> > > Pass rootContentsLayer to Mac remote layer tree >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index b02688a4a847d56e0074099177b4da503d754288..c9e87a2c200851cbe64cb2d594657bed0e63bed6 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -2641,19 +2641,6 @@ void Page::appearanceDidChange() > } > } > >-void Page::installedPageOverlaysChanged() >-{ >- if (isInWindow()) { >- if (pageOverlayController().hasViewOverlays()) >- chrome().client().attachViewOverlayGraphicsLayer(&pageOverlayController().layerWithViewOverlays()); >- else >- chrome().client().attachViewOverlayGraphicsLayer(nullptr); >- } >- >- if (auto* frameView = mainFrame().view()) >- frameView->setNeedsCompositingConfigurationUpdate(); >-} >- > void Page::setUnobscuredSafeAreaInsets(const FloatBoxExtent& insets) > { > if (m_unobscuredSafeAreaInsets == insets) >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index 9464a8ddaf07a543f0b868ab083649caff7204b7..29d28c8f2c0b3b38731f53951e02c6a8be3d1f22 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -413,8 +413,6 @@ public: > > WheelEventDeltaFilter* wheelEventDeltaFilter() { return m_recentWheelEventDeltaFilter.get(); } > PageOverlayController& pageOverlayController() { return *m_pageOverlayController; } >- >- void installedPageOverlaysChanged(); > > #if PLATFORM(MAC) > #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION) >diff --git a/Source/WebCore/page/PageOverlay.cpp b/Source/WebCore/page/PageOverlay.cpp >index e2f97cc65f25ad4eeb4a9e74ab86a68120c0faaa..a002db20b8774f76f2f5b4fb66d52158a7ada33d 100644 >--- a/Source/WebCore/page/PageOverlay.cpp >+++ b/Source/WebCore/page/PageOverlay.cpp >@@ -146,6 +146,9 @@ void PageOverlay::setBackgroundColor(const Color& backgroundColor) > > void PageOverlay::setPage(Page* page) > { >+ if (page == m_page) >+ return; >+ > m_client.willMoveToPage(*this, page); > m_page = page; > m_client.didMoveToPage(*this, page); >@@ -153,6 +156,12 @@ void PageOverlay::setPage(Page* page) > m_fadeAnimationTimer.stop(); > } > >+void PageOverlay::willReattachToPage(Page* page) >+{ >+ ASSERT(m_page == page); >+ m_client.willReattachToPage(*this, page); >+} >+ > void PageOverlay::setNeedsDisplay(const IntRect& dirtyRect) > { > if (auto pageOverlayController = controller()) { >diff --git a/Source/WebCore/page/PageOverlay.h b/Source/WebCore/page/PageOverlay.h >index 6633037b2eb25b9c350ef79df6c91e8267327358..0eb0d21fff56209477edd8d209f28e7d9c881536 100644 >--- a/Source/WebCore/page/PageOverlay.h >+++ b/Source/WebCore/page/PageOverlay.h >@@ -53,6 +53,7 @@ public: > public: > virtual void willMoveToPage(PageOverlay&, Page*) = 0; > virtual void didMoveToPage(PageOverlay&, Page*) = 0; >+ virtual void willReattachToPage(PageOverlay&, Page*) { } > virtual void drawRect(PageOverlay&, GraphicsContext&, const IntRect& dirtyRect) = 0; > virtual bool mouseEvent(PageOverlay&, const PlatformMouseEvent&) = 0; > virtual void didScrollFrame(PageOverlay&, Frame&) { } >@@ -76,6 +77,7 @@ public: > virtual PageOverlayID pageOverlayID() const { return m_pageOverlayID; } > > void setPage(Page*); >+ void willReattachToPage(Page*); > Page* page() const { return m_page; } > WEBCORE_EXPORT void setNeedsDisplay(const IntRect& dirtyRect); > WEBCORE_EXPORT void setNeedsDisplay(); >diff --git a/Source/WebCore/page/PageOverlayController.cpp b/Source/WebCore/page/PageOverlayController.cpp >index 86a68529581683223cf02cedf865930e7661f5c3..cc7ffe003f9527c4e687804bd14b031a96d0b16a 100644 >--- a/Source/WebCore/page/PageOverlayController.cpp >+++ b/Source/WebCore/page/PageOverlayController.cpp >@@ -85,14 +85,26 @@ bool PageOverlayController::hasViewOverlays() const > > void PageOverlayController::attachViewOverlayLayers() > { >- if (hasViewOverlays()) >- m_page.chrome().client().attachViewOverlayGraphicsLayer(&layerWithViewOverlays()); >+ ASSERT(hasViewOverlays()); >+ m_page.chrome().client().attachViewOverlayGraphicsLayer(&layerWithViewOverlays()); > } > > void PageOverlayController::detachViewOverlayLayers() > { > m_page.chrome().client().attachViewOverlayGraphicsLayer(nullptr); >- willDetachRootLayer(); >+} >+ >+void PageOverlayController::installedPageOverlaysChanged() >+{ >+ if (hasViewOverlays()) >+ attachViewOverlayLayers(); >+ else >+ detachViewOverlayLayers(); >+ >+ if (auto* frameView = m_page.mainFrame().view()) >+ frameView->setNeedsCompositingConfigurationUpdate(); >+ >+ updateForceSynchronousScrollLayerPositionUpdates(); > } > > GraphicsLayer* PageOverlayController::documentOverlayRootLayer() const >@@ -164,15 +176,10 @@ GraphicsLayer& PageOverlayController::layerWithViewOverlays() > return *m_viewOverlayRootLayer; > } > >-void PageOverlayController::installPageOverlay(PageOverlay& overlay, PageOverlay::FadeMode fadeMode) >+void PageOverlayController::installLayerForOverlay(PageOverlay& overlay) > { > createRootLayersIfNeeded(); > >- if (m_pageOverlays.contains(&overlay)) >- return; >- >- m_pageOverlays.append(&overlay); >- > auto layer = GraphicsLayer::create(m_page.chrome().client().graphicsLayerFactory(), *this); > layer->setAnchorPoint({ }); > layer->setBackgroundColor(overlay.backgroundColor()); >@@ -192,19 +199,29 @@ void PageOverlayController::installPageOverlay(PageOverlay& overlay, PageOverlay > auto& rawLayer = layer.get(); > m_overlayGraphicsLayers.set(&overlay, WTFMove(layer)); > >- updateForceSynchronousScrollLayerPositionUpdates(); >- > overlay.setPage(&m_page); > > if (FrameView* frameView = m_page.mainFrame().view()) > frameView->enterCompositingMode(); > > updateOverlayGeometry(overlay, rawLayer); >+} >+ >+void PageOverlayController::installPageOverlay(PageOverlay& overlay, PageOverlay::FadeMode fadeMode) >+{ >+ createRootLayersIfNeeded(); >+ >+ if (m_pageOverlays.contains(&overlay)) >+ return; >+ >+ m_pageOverlays.append(&overlay); >+ >+ installLayerForOverlay(overlay); > > if (fadeMode == PageOverlay::FadeMode::Fade) > overlay.startFadeInAnimation(); > >- m_page.installedPageOverlaysChanged(); >+ installedPageOverlaysChanged(); > } > > void PageOverlayController::uninstallPageOverlay(PageOverlay& overlay, PageOverlay::FadeMode fadeMode) >@@ -222,8 +239,26 @@ void PageOverlayController::uninstallPageOverlay(PageOverlay& overlay, PageOverl > bool removed = m_pageOverlays.removeFirst(&overlay); > ASSERT_UNUSED(removed, removed); > >- updateForceSynchronousScrollLayerPositionUpdates(); >- m_page.installedPageOverlaysChanged(); >+ installedPageOverlaysChanged(); >+} >+ >+void PageOverlayController::recreatePageOverlayLayers() >+{ >+ Vector<RefPtr<PageOverlay>> allOverlays = m_pageOverlays; >+ >+ for (auto& overlay : m_pageOverlays) { >+ if (auto optionalLayer = m_overlayGraphicsLayers.take(overlay.get())) >+ optionalLayer.value()->removeFromParent(); >+ >+ overlay->willReattachToPage(&m_page); >+ } >+ >+ destroyRootLayers(); >+ >+ for (auto& overlay : m_pageOverlays) >+ installLayerForOverlay(*overlay); >+ >+ installedPageOverlaysChanged(); > } > > void PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates() >@@ -272,8 +307,10 @@ GraphicsLayer& PageOverlayController::layerForOverlay(PageOverlay& overlay) cons > return *m_overlayGraphicsLayers.get(&overlay); > } > >-void PageOverlayController::willDetachRootLayer() >+void PageOverlayController::destroyRootLayers() > { >+ detachViewOverlayLayers(); >+ > GraphicsLayer::unparentAndClear(m_documentOverlayRootLayer); > GraphicsLayer::unparentAndClear(m_viewOverlayRootLayer); > >diff --git a/Source/WebCore/page/PageOverlayController.h b/Source/WebCore/page/PageOverlayController.h >index e61482bbd8a9caaadb75cacc13c7b000fe7e3df3..959df61381633b4e676218448d364974601ba25b 100644 >--- a/Source/WebCore/page/PageOverlayController.h >+++ b/Source/WebCore/page/PageOverlayController.h >@@ -47,9 +47,6 @@ public: > bool hasDocumentOverlays() const; > bool hasViewOverlays() const; > >- void attachViewOverlayLayers(); >- void detachViewOverlayLayers(); >- > GraphicsLayer& layerWithDocumentOverlays(); > GraphicsLayer& layerWithViewOverlays(); > >@@ -81,14 +78,24 @@ public: > WEBCORE_EXPORT bool copyAccessibilityAttributeBoolValueForPoint(String attribute, FloatPoint, bool& value); > WEBCORE_EXPORT Vector<String> copyAccessibilityAttributesNames(bool parameterizedNames); > >+ WEBCORE_EXPORT void recreatePageOverlayLayers(); >+ > private: > void createRootLayersIfNeeded(); > > WEBCORE_EXPORT GraphicsLayer* documentOverlayRootLayer() const; > WEBCORE_EXPORT GraphicsLayer* viewOverlayRootLayer() const; > >+ void attachViewOverlayLayers(); >+ void detachViewOverlayLayers(); >+ >+ void destroyRootLayers(); >+ >+ void installedPageOverlaysChanged(); >+ > void willDetachRootLayer(); > >+ void installLayerForOverlay(PageOverlay&); > void updateSettingsForLayer(GraphicsLayer&); > void updateForceSynchronousScrollLayerPositionUpdates(); > >diff --git a/Source/WebCore/page/mac/ServicesOverlayController.h b/Source/WebCore/page/mac/ServicesOverlayController.h >index 8f8a5fb443eb23e4a3c7f9a8abe7a2a0f45f1893..4cb005e336b82e468d592d39c12090fd396951db 100644 >--- a/Source/WebCore/page/mac/ServicesOverlayController.h >+++ b/Source/WebCore/page/mac/ServicesOverlayController.h >@@ -97,6 +97,7 @@ private: > // PageOverlay::Client > void willMoveToPage(PageOverlay&, Page*) override; > void didMoveToPage(PageOverlay&, Page*) override; >+ void willReattachToPage(PageOverlay&, Page*) override; > void drawRect(PageOverlay&, GraphicsContext&, const IntRect& dirtyRect) override; > bool mouseEvent(PageOverlay&, const PlatformMouseEvent&) override; > void didScrollFrame(PageOverlay&, Frame&) override; >diff --git a/Source/WebCore/page/mac/ServicesOverlayController.mm b/Source/WebCore/page/mac/ServicesOverlayController.mm >index c96bed10869f675dbf5145f9f3e0f4123f02fbe7..d2d7c65e96078879b4d446adbb86dd466c5a1f10 100644 >--- a/Source/WebCore/page/mac/ServicesOverlayController.mm >+++ b/Source/WebCore/page/mac/ServicesOverlayController.mm >@@ -226,6 +226,13 @@ void ServicesOverlayController::didMoveToPage(PageOverlay&, Page*) > { > } > >+void ServicesOverlayController::willReattachToPage(PageOverlay&, Page*) >+{ >+ for (auto& highlight : m_highlights) >+ highlight->invalidate(); >+ m_highlights.clear(); >+} >+ > static const uint8_t AlignmentNone = 0; > static const uint8_t AlignmentLeft = 1 << 0; > static const uint8_t AlignmentRight = 1 << 1; >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm >index 0d7387151e3718fd8e5a39d17c916849bc6f9fa4..989295b4310341a2563ac08f2fa856b4975df7a7 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm >@@ -101,6 +101,8 @@ bool RemoteLayerTreeHost::updateLayerTree(const RemoteLayerTreeTransaction& tran > > auto* node = nodeForID(layerID); > ASSERT(node); >+ if (!node) >+ continue; > > if (properties.changedProperties.contains(RemoteLayerTreeTransaction::ClonedContentsChanged) && properties.clonedLayerID) > clonesToUpdate.append({ layerID, properties.clonedLayerID }); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >index 2966c3d5e4f4e8a8256a8a3c1cda1110a3e6a383..d7567ea84f4819d9bee05b39e61787bf7f807791 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >@@ -225,6 +225,14 @@ void WebInspectorClient::didMoveToPage(PageOverlay&, Page*) > { > } > >+void WebInspectorClient::willReattachToPage(PageOverlay&, Page*) >+{ >+ for (auto& layer : m_paintRectLayers) >+ layer->removeFromParent(); >+ >+ m_paintRectLayers.clear(); >+} >+ > void WebInspectorClient::drawRect(PageOverlay&, WebCore::GraphicsContext& context, const WebCore::IntRect& /*dirtyRect*/) > { > m_page->corePage()->inspectorController().drawHighlight(context); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >index d5dabf160e2ad98d989961deb0a62fe71a44d09a..15d4a3353ee52840bb9a1a7d617658a1758d15ff 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >@@ -74,6 +74,7 @@ private: > // PageOverlay::Client > void willMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override; > void didMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override; >+ void willReattachToPage(WebCore::PageOverlay&, WebCore::Page*) override; > void drawRect(WebCore::PageOverlay&, WebCore::GraphicsContext&, const WebCore::IntRect&) override; > bool mouseEvent(WebCore::PageOverlay&, const WebCore::PlatformMouseEvent&) override; > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 085d82a8e64d97ab6219948000ab9fc7a9b78fb0..1e5bb49f4eac94c3c76b9a6e6bfc6ec8f0b5ac79 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -186,6 +186,7 @@ > #include <WebCore/Page.h> > #include <WebCore/PageCache.h> > #include <WebCore/PageConfiguration.h> >+#include <WebCore/PageOverlayController.h> > #include <WebCore/PingLoader.h> > #include <WebCore/PlatformKeyboardEvent.h> > #include <WebCore/PlatformMediaSessionManager.h> >@@ -696,7 +697,7 @@ void WebPage::reinitializeWebPage(WebPageCreationParameters&& parameters) > > if (m_shouldResetDrawingAreaAfterSuspend) { > // Make sure we destroy the previous drawing area before constructing the new one as DrawingArea registers / unregisters >- // itself as an IPC::MesssageReceiver in its constructor / destructor. >+ // itself as an IPC::MessageReceiver in its constructor / destructor. > m_drawingArea = nullptr; > m_shouldResetDrawingAreaAfterSuspend = false; > >@@ -706,6 +707,8 @@ void WebPage::reinitializeWebPage(WebPageCreationParameters&& parameters) > m_drawingArea->updatePreferences(parameters.store); > m_drawingArea->setPaintingEnabled(true); > unfreezeLayerTree(LayerTreeFreezeReason::PageSuspended); >+ >+ m_page->pageOverlayController().recreatePageOverlayLayers(); > } > > setViewLayoutSize(parameters.viewLayoutSize); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index cd6b717d98e8c30234d78b37bfa9cde280afc00c..6d1eec3819b84aa85270fb75de1718d47508cc1d 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-20 Tim Horton <timothy_horton@apple.com> >+ >+ Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process >+ https://bugs.webkit.org/show_bug.cgi?id=194845 >+ <rdar://problem/47944579> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: >+ > 2019-02-19 Keith Rollin <krollin@apple.com> > > Add timing information to build output >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 00a5fdb98e567c662b6c7b1c85725486b5518d6f..6bd195a4bcda7e9e6579614d9576291a07df8bb6 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -92,6 +92,7 @@ > 2D1646E21D1862CD00015A1A /* DeferredViewInWindowStateChange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1646E11D1862CD00015A1A /* DeferredViewInWindowStateChange.mm */; }; > 2D1C04A71D76298B000A6816 /* TestNavigationDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1C04A61D76298B000A6816 /* TestNavigationDelegate.mm */; }; > 2D21FE591F04642900B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */; }; >+ 2D3CA3A8221DF4B40088E803 /* PageOverlayPlugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */; }; > 2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */; }; > 2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */; }; > 2D70059621EDA0C6003463CB /* TabOutOfWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D70059521EDA0C6003463CB /* TabOutOfWebView.mm */; }; >@@ -1427,6 +1428,7 @@ > 2D1C04A61D76298B000A6816 /* TestNavigationDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestNavigationDelegate.mm; path = cocoa/TestNavigationDelegate.mm; sourceTree = "<group>"; }; > 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FixedLayoutSize.mm; sourceTree = "<group>"; }; > 2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFViewStablePresentationUpdateCallback.mm; sourceTree = "<group>"; }; >+ 2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageOverlayPlugin.mm; sourceTree = "<group>"; }; > 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKThumbnailView.mm; path = WebKit/WKThumbnailView.mm; sourceTree = "<group>"; }; > 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLVideoElementWrapper.mm; sourceTree = "<group>"; }; > 2D61EC3021B0B75C00A7D1CB /* PencilKitTestSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PencilKitTestSPI.h; sourceTree = "<group>"; }; >@@ -2557,6 +2559,7 @@ > 37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */, > CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */, > CEBCA12E1E3A660100C73293 /* OverrideContentSecurityPolicy.mm */, >+ 2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */, > F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */, > F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */, > F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */, >@@ -4419,6 +4422,7 @@ > 5CB5B3C21FFC55CF00C27BB0 /* FrameHandleSerialization.mm in Sources */, > 0E404A8C2166DE0A008271BA /* InjectedBundleNodeHandleIsSelectElement.mm in Sources */, > 79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */, >+ 2D3CA3A8221DF4B40088E803 /* PageOverlayPlugin.mm in Sources */, > F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */, > A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */, > 1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageOverlayPlugin.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageOverlayPlugin.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..57479dfb561c58874eda2ad066e7460557f61628 >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageOverlayPlugin.mm >@@ -0,0 +1,70 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#import "config.h" >+ >+#if WK_API_ENABLED >+ >+#import "PlatformUtilities.h" >+#import <WebKit/WKBundlePage.h> >+#import <WebKit/WKBundlePageOverlay.h> >+#import <WebKit/WKWebProcessPlugIn.h> >+#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h> >+#import <WebKit/WKWebProcessPlugInFrame.h> >+#import <WebKit/WKWebProcessPlugInLoadDelegate.h> >+#import <wtf/RetainPtr.h> >+ >+@interface PageOverlayPlugIn : NSObject <WKWebProcessPlugIn> >+@end >+ >+@implementation PageOverlayPlugIn >+ >+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController >+{ >+ WKBundlePageOverlayClientV1 overlayClient = { >+ { 1, 0 }, >+ 0, >+ 0, >+ 0, >+ 0, >+ 0, >+ 0, >+ 0, >+ 0, >+ 0, >+ 0, >+ 0, >+ }; >+ >+ >+ WKBundlePageRef page = browserContextController._bundlePageRef; >+ >+ WKBundlePageOverlayRef pageOverlay = WKBundlePageOverlayCreate((WKBundlePageOverlayClientBase*)&overlayClient); >+ WKBundlePageInstallPageOverlay(page, pageOverlay); >+} >+ >+@end >+ >+#endif // WK_API_ENABLED >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >index 8c96bec03b3e70ffddaa349a562d72c55a41d5ef..9655d6beb02218d79d9188e7f27168a883f31841 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >@@ -4945,4 +4945,66 @@ TEST(ProcessSwap, GetUserMediaCaptureState) > EXPECT_FALSE(pid1 == pid2); > } > >+static void traverseLayerTree(CALayer *layer, void(^block)(CALayer *)) >+{ >+ for (CALayer *child in layer.sublayers) >+ traverseLayerTree(child, block); >+ block(layer); >+} >+ >+static bool hasOverlay(CALayer *layer) >+{ >+ __block bool hasViewOverlay = false; >+ traverseLayerTree(layer, ^(CALayer *layer) { >+ if ([layer.name isEqualToString:@"View overlay container"]) >+ hasViewOverlay = true; >+ }); >+ return hasViewOverlay; >+} >+ >+TEST(ProcessSwap, PageOverlayLayerPersistence) >+{ >+ auto processPoolConfiguration = psonProcessPoolConfiguration(); >+ [processPoolConfiguration setInjectedBundleURL:[[NSBundle mainBundle] URLForResource:@"TestWebKitAPI" withExtension:@"wkbundle"]]; >+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); >+ [processPool _setObject:@"PageOverlayPlugIn" forBundleParameter:TestWebKitAPI::Util::TestPlugInClassNameParameter]; >+ >+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ [webViewConfiguration setProcessPool:processPool.get()]; >+ >+ auto handler = adoptNS([[PSONScheme alloc] init]); >+ [handler addMappingFromURLString:@"pson://www.webkit.org/page-overlay" toData:""]; >+ [handler addMappingFromURLString:@"pson://www.apple.com/page-overlay" toData:""]; >+ [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; >+ >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); >+ >+ auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]); >+ [webView setNavigationDelegate:navigationDelegate.get()]; >+ >+ auto request = adoptNS([NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/page-overlay"]]); >+ [webView loadRequest:request.get()]; >+ >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ [webView waitForNextPresentationUpdate]; >+ >+ EXPECT_TRUE(hasOverlay([webView layer])); >+ >+ request = adoptNS([NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/page-overlay"]]); >+ [webView loadRequest:request.get()]; >+ >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ [webView waitForNextPresentationUpdate]; >+ >+ [webView goBack]; // Back to webkit.org. >+ >+ [webView waitForNextPresentationUpdate]; >+ >+ EXPECT_TRUE(hasOverlay([webView layer])); >+} >+ > #endif // WK_API_ENABLED
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194845
:
362461
|
362462
|
362469
|
362470
|
362474
|
362475
|
362476
|
362515
|
362573
|
362574
|
362578
|
362583