Title: [225615] trunk/Source
Revision
225615
Author
[email protected]
Date
2017-12-06 19:30:08 -0800 (Wed, 06 Dec 2017)

Log Message

[Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
https://bugs.webkit.org/show_bug.cgi?id=180368
rdar://problem/34748067

Patch by David Quesada <[email protected]> on 2017-12-06
Reviewed by Geoffrey Garen.

Source/WebCore:

Support applying a manifest to a top-level browsing context by adding a manifest
property on PageConfiguration to be stored on MainFrame instances created from the
configuration.

No new tests, no change in behavior.

* page/MainFrame.cpp:
(WebCore::MainFrame::MainFrame):
* page/MainFrame.h:
* page/PageConfiguration.h:

Source/WebKit:

Add a new property WKWebViewConfiguration._applicationManifest to specify manifest
to apply to application contexts (aka. top-level browsing contexts, i.e. web views).
The manifest is ultimately stored on the MainFrame of the Pages created from the
web view configuration.

No new tests, no change in behavior.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
(API::PageConfiguration::applicationManifest const):
(API::PageConfiguration::setApplicationManifest):
* UIProcess/API/APIPageConfiguration.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _applicationManifest]):
(-[WKWebViewConfiguration _setApplicationManifest:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/API/Cocoa/_WKApplicationManifestInternal.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_cpuLimit):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225614 => 225615)


--- trunk/Source/WebCore/ChangeLog	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebCore/ChangeLog	2017-12-07 03:30:08 UTC (rev 225615)
@@ -1,3 +1,22 @@
+2017-12-06  David Quesada  <[email protected]>
+
+        [Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
+        https://bugs.webkit.org/show_bug.cgi?id=180368
+        rdar://problem/34748067
+
+        Reviewed by Geoffrey Garen.
+
+        Support applying a manifest to a top-level browsing context by adding a manifest
+        property on PageConfiguration to be stored on MainFrame instances created from the
+        configuration.
+
+        No new tests, no change in behavior.
+
+        * page/MainFrame.cpp:
+        (WebCore::MainFrame::MainFrame):
+        * page/MainFrame.h:
+        * page/PageConfiguration.h:
+
 2017-12-06  Zalan Bujtas  <[email protected]>
 
         Remove nodes from AXObjectCache when the associated subframe document is getting destroyed.

Modified: trunk/Source/WebCore/page/MainFrame.cpp (225614 => 225615)


--- trunk/Source/WebCore/page/MainFrame.cpp	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebCore/page/MainFrame.cpp	2017-12-07 03:30:08 UTC (rev 225615)
@@ -51,6 +51,9 @@
 #if ENABLE(APPLE_PAY)
     , m_paymentCoordinator(std::make_unique<PaymentCoordinator>(*configuration.paymentCoordinatorClient))
 #endif
+#if ENABLE(APPLICATION_MANIFEST)
+    , m_applicationManifest(configuration.applicationManifest)
+#endif
     , m_performanceLogging(std::make_unique<PerformanceLogging>(*this))
 {
 }

Modified: trunk/Source/WebCore/page/MainFrame.h (225614 => 225615)


--- trunk/Source/WebCore/page/MainFrame.h	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebCore/page/MainFrame.h	2017-12-07 03:30:08 UTC (rev 225615)
@@ -26,8 +26,13 @@
 #pragma once
 
 #include "Frame.h"
+#include <wtf/Optional.h>
 #include <wtf/Vector.h>
 
+#if ENABLE(APPLICATION_MANIFEST)
+#include "ApplicationManifest.h"
+#endif
+
 namespace WebCore {
 
 class PageConfiguration;
@@ -67,6 +72,10 @@
     WEBCORE_EXPORT void setPaymentCoordinator(std::unique_ptr<PaymentCoordinator>&&);
 #endif
 
+#if ENABLE(APPLICATION_MANIFEST)
+    const std::optional<ApplicationManifest>& applicationManifest() const { return m_applicationManifest; }
+#endif
+
     PerformanceLogging& performanceLogging() const { return *m_performanceLogging; }
 
     void didCompleteLoad();
@@ -92,6 +101,10 @@
     std::unique_ptr<PaymentCoordinator> m_paymentCoordinator;
 #endif
 
+#if ENABLE(APPLICATION_MANIFEST)
+    std::optional<ApplicationManifest> m_applicationManifest;
+#endif
+
     std::unique_ptr<PerformanceLogging> m_performanceLogging;
 
     unsigned m_navigationDisableCount { 0 };

Modified: trunk/Source/WebCore/page/PageConfiguration.h (225614 => 225615)


--- trunk/Source/WebCore/page/PageConfiguration.h	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebCore/page/PageConfiguration.h	2017-12-07 03:30:08 UTC (rev 225615)
@@ -26,9 +26,14 @@
 #pragma once
 
 #include <wtf/Noncopyable.h>
+#include <wtf/Optional.h>
 #include <wtf/RefPtr.h>
 #include <wtf/UniqueRef.h>
 
+#if ENABLE(APPLICATION_MANIFEST)
+#include "ApplicationManifest.h"
+#endif
+
 namespace WebCore {
 
 class AlternativeTextClient;
@@ -75,6 +80,10 @@
     PaymentCoordinatorClient* paymentCoordinatorClient { nullptr };
 #endif
 
+#if ENABLE(APPLICATION_MANIFEST)
+    std::optional<ApplicationManifest> applicationManifest;
+#endif
+
     UniqueRef<LibWebRTCProvider> libWebRTCProvider;
 
     PlugInClient* plugInClient { nullptr };

Modified: trunk/Source/WebKit/ChangeLog (225614 => 225615)


--- trunk/Source/WebKit/ChangeLog	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/ChangeLog	2017-12-07 03:30:08 UTC (rev 225615)
@@ -1,3 +1,40 @@
+2017-12-06  David Quesada  <[email protected]>
+
+        [Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
+        https://bugs.webkit.org/show_bug.cgi?id=180368
+        rdar://problem/34748067
+
+        Reviewed by Geoffrey Garen.
+
+        Add a new property WKWebViewConfiguration._applicationManifest to specify manifest
+        to apply to application contexts (aka. top-level browsing contexts, i.e. web views).
+        The manifest is ultimately stored on the MainFrame of the Pages created from the
+        web view configuration.
+
+        No new tests, no change in behavior.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/API/APIPageConfiguration.cpp:
+        (API::PageConfiguration::copy const):
+        (API::PageConfiguration::applicationManifest const):
+        (API::PageConfiguration::setApplicationManifest):
+        * UIProcess/API/APIPageConfiguration.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration copyWithZone:]):
+        (-[WKWebViewConfiguration _applicationManifest]):
+        (-[WKWebViewConfiguration _setApplicationManifest:]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+        * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_cpuLimit):
+
 2017-12-06  Jeff Miller  <[email protected]>
 
         -[WKWebViewConfiguration copyWithZone] doesn't copy _groupIdentifier

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (225614 => 225615)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2017-12-07 03:30:08 UTC (rev 225615)
@@ -96,6 +96,9 @@
     encoder << overrideContentSecurityPolicy;
     encoder << cpuLimit;
     encoder << urlSchemeHandlers;
+#if ENABLE(APPLICATION_MANIFEST)
+    encoder << applicationManifest;
+#endif
     encoder << iceCandidateFilteringEnabled;
     encoder << enumeratingAllNetworkInterfacesEnabled;
     encoder << userContentWorlds;
@@ -257,6 +260,14 @@
     if (!decoder.decode(parameters.urlSchemeHandlers))
         return std::nullopt;
 
+#if ENABLE(APPLICATION_MANIFEST)
+    std::optional<std::optional<WebCore::ApplicationManifest>> applicationManifest;
+    decoder >> applicationManifest;
+    if (!applicationManifest)
+        return std::nullopt;
+    parameters.applicationManifest = WTFMove(*applicationManifest);
+#endif
+
     if (!decoder.decode(parameters.iceCandidateFilteringEnabled))
         return std::nullopt;
 

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (225614 => 225615)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2017-12-07 03:30:08 UTC (rev 225615)
@@ -50,6 +50,10 @@
 #include "ColorSpaceData.h"
 #endif
 
+#if ENABLE(APPLICATION_MANIFEST)
+#include <WebCore/ApplicationManifest.h>
+#endif
+
 namespace IPC {
 class Decoder;
 class Encoder;
@@ -152,6 +156,10 @@
 
     HashMap<String, uint64_t> urlSchemeHandlers;
 
+#if ENABLE(APPLICATION_MANIFEST)
+    std::optional<WebCore::ApplicationManifest> applicationManifest;
+#endif
+
     // WebRTC members.
     bool iceCandidateFilteringEnabled { true };
     bool enumeratingAllNetworkInterfacesEnabled { false };

Modified: trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h	2017-12-07 03:30:08 UTC (rev 225615)
@@ -25,12 +25,13 @@
 
 #pragma once
 
+#if ENABLE(APPLICATION_MANIFEST)
+
 #include "APIObject.h"
 #include <WebCore/ApplicationManifest.h>
 
 namespace API {
 
-#if ENABLE(APPLICATION_MANIFEST)
 class ApplicationManifest final : public ObjectImpl<Object::Type::ApplicationManifest> {
 public:
     static Ref<ApplicationManifest> create(const WebCore::ApplicationManifest& applicationManifest)
@@ -48,7 +49,7 @@
 private:
     WebCore::ApplicationManifest m_applicationManifest;
 };
-#endif
 
 } // namespace API
 
+#endif // ENABLE(APPLICATION_MANIFEST)

Modified: trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp	2017-12-07 03:30:08 UTC (rev 225615)
@@ -33,6 +33,10 @@
 #include "WebProcessPool.h"
 #include "WebUserContentControllerProxy.h"
 
+#if ENABLE(APPLICATION_MANIFEST)
+#include "APIApplicationManifest.h"
+#endif
+
 using namespace WebCore;
 using namespace WebKit;
 
@@ -72,6 +76,9 @@
     copy->m_cpuLimit = this->m_cpuLimit;
     copy->m_controlledByAutomation = this->m_controlledByAutomation;
     copy->m_overrideContentSecurityPolicy = this->m_overrideContentSecurityPolicy;
+#if ENABLE(APPLICATION_MANIFEST)
+    copy->m_applicationManifest = this->m_applicationManifest;
+#endif
 
     return copy;
 }
@@ -165,4 +172,16 @@
     m_sessionID = sessionID;
 }
 
+#if ENABLE(APPLICATION_MANIFEST)
+const ApplicationManifest* PageConfiguration::applicationManifest() const
+{
+    return m_applicationManifest.get();
+}
+
+void PageConfiguration::setApplicationManifest(ApplicationManifest* applicationManifest)
+{
+    m_applicationManifest = applicationManifest;
+}
+#endif
+
 } // namespace API

Modified: trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h	2017-12-07 03:30:08 UTC (rev 225615)
@@ -43,6 +43,7 @@
 
 namespace API {
 
+class ApplicationManifest;
 class WebsiteDataStore;
 
 class PageConfiguration : public ObjectImpl<Object::Type::PageConfiguration> {
@@ -106,6 +107,11 @@
     const WTF::String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; }
     void setOverrideContentSecurityPolicy(const WTF::String& overrideContentSecurityPolicy) { m_overrideContentSecurityPolicy = overrideContentSecurityPolicy; }
 
+#if ENABLE(APPLICATION_MANIFEST)
+    const ApplicationManifest* applicationManifest() const;
+    void setApplicationManifest(ApplicationManifest*);
+#endif
+
 private:
 
     RefPtr<WebKit::WebProcessPool> m_processPool;
@@ -131,6 +137,10 @@
     std::optional<double> m_cpuLimit;
 
     WTF::String m_overrideContentSecurityPolicy;
+
+#if ENABLE(APPLICATION_MANIFEST)
+    RefPtr<ApplicationManifest> m_applicationManifest;
+#endif
 };
 
 } // namespace API

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-12-07 03:30:08 UTC (rev 225615)
@@ -537,6 +537,10 @@
     pageConfiguration->setWaitsForPaintAfterViewDidMoveToWindow([_configuration _waitsForPaintAfterViewDidMoveToWindow]);
     pageConfiguration->setControlledByAutomation([_configuration _isControlledByAutomation]);
 
+#if ENABLE(APPLICATION_MANIFEST)
+    pageConfiguration->setApplicationManifest([_configuration _applicationManifest] ? [configuration _applicationManifest]->_applicationManifest.get() : nullptr);
+#endif
+
 #if PLATFORM(MAC)
     if (auto cpuLimit = [_configuration _cpuLimit])
         pageConfiguration->setCPULimit(cpuLimit);

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2017-12-07 03:30:08 UTC (rev 225615)
@@ -146,6 +146,10 @@
     BOOL _waitsForPaintAfterViewDidMoveToWindow;
     BOOL _controlledByAutomation;
 
+#if ENABLE(APPLICATION_MANIFEST)
+    RetainPtr<_WKApplicationManifest> _applicationManifest;
+#endif
+
 #if ENABLE(APPLE_PAY)
     BOOL _applePayEnabled;
 #endif
@@ -353,6 +357,9 @@
 #if ENABLE(APPLE_PAY)
     configuration->_applePayEnabled = self->_applePayEnabled;
 #endif
+#if ENABLE(APPLICATION_MANIFEST)
+    configuration->_applicationManifest = self->_applicationManifest;
+#endif
     configuration->_needsStorageAccessFromFileURLsQuirk = self->_needsStorageAccessFromFileURLsQuirk;
     configuration->_overrideContentSecurityPolicy = adoptNS([self->_overrideContentSecurityPolicy copyWithZone:zone]);
 
@@ -746,6 +753,22 @@
     _controlledByAutomation = controlledByAutomation;
 }
 
+- (_WKApplicationManifest *)_applicationManifest
+{
+#if ENABLE(APPLICATION_MANIFEST)
+    return _applicationManifest.get();
+#else
+    return nil;
+#endif
+}
+
+- (void)_setApplicationManifest:(_WKApplicationManifest *)applicationManifest
+{
+#if ENABLE(APPLICATION_MANIFEST)
+    _applicationManifest = applicationManifest;
+#endif
+}
+
 #if PLATFORM(MAC)
 - (BOOL)_showsURLsInToolTips
 {

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	2017-12-07 03:30:08 UTC (rev 225615)
@@ -36,6 +36,7 @@
 #endif
 
 @class WKWebView;
+@class _WKApplicationManifest;
 @class _WKVisitedLinkStore;
 @class _WKWebsiteDataStore;
 
@@ -66,6 +67,7 @@
 @property (nonatomic, setter=_setApplePayEnabled:) BOOL _applePayEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 @property (nonatomic, setter=_setWaitsForPaintAfterViewDidMoveToWindow:) BOOL _waitsForPaintAfterViewDidMoveToWindow WK_API_AVAILABLE(macosx(10.12.3), ios(10.3));
 @property (nonatomic, setter=_setControlledByAutomation:, getter=_isControlledByAutomation) BOOL _controlledByAutomation WK_API_AVAILABLE(macosx(10.12.3), ios(10.3));
+@property (nonatomic, setter=_setApplicationManifest:) _WKApplicationManifest *_applicationManifest WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 #if TARGET_OS_IPHONE
 @property (nonatomic, setter=_setAlwaysRunsAtForegroundPriority:) BOOL _alwaysRunsAtForegroundPriority WK_API_AVAILABLE(ios(9_0));

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h	2017-12-07 03:30:08 UTC (rev 225615)
@@ -33,10 +33,6 @@
 #import "_WKApplicationManifest.h"
 #import <WebCore/ApplicationManifest.h>
 
-namespace WebCore {
-struct ApplicationManifest;
-}
-
 #if ENABLE(APPLICATION_MANIFEST)
 namespace API {
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (225614 => 225615)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-12-07 03:30:08 UTC (rev 225615)
@@ -144,6 +144,10 @@
 #include <wtf/SystemTracing.h>
 #include <wtf/text/StringView.h>
 
+#if ENABLE(APPLICATION_MANIFEST)
+#include "APIApplicationManifest.h"
+#endif
+
 #if ENABLE(ASYNC_SCROLLING)
 #include "RemoteScrollingCoordinatorProxy.h"
 #endif
@@ -5812,6 +5816,10 @@
 #endif
 #endif
 
+#if ENABLE(APPLICATION_MANIFEST)
+    parameters.applicationManifest = m_configuration->applicationManifest() ? std::optional<WebCore::ApplicationManifest>(m_configuration->applicationManifest()->applicationManifest()) : std::nullopt;
+#endif
+
     m_process->addWebUserContentControllerProxy(m_userContentController, parameters);
 
     return parameters;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (225614 => 225615)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2017-12-07 03:23:51 UTC (rev 225614)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2017-12-07 03:30:08 UTC (rev 225615)
@@ -419,6 +419,10 @@
     pageConfiguration.paymentCoordinatorClient = new WebPaymentCoordinator(*this);
 #endif
 
+#if ENABLE(APPLICATION_MANIFEST)
+    pageConfiguration.applicationManifest = parameters.applicationManifest;
+#endif
+
     m_page = std::make_unique<Page>(WTFMove(pageConfiguration));
     updatePreferences(parameters.store);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to