[webkit-changes] [295357] trunk/Source

2022-06-07 Thread nham
Title: [295357] trunk/Source








Revision 295357
Author n...@apple.com
Date 2022-06-07 10:48:03 -0700 (Tue, 07 Jun 2022)


Log Message
Some trustd network requests are not attributed to the UIProcess
https://bugs.webkit.org/show_bug.cgi?id=241352

Reviewed by Kate Cheney.

Some of the calls to SecTrustEvaluate (in particular the one in ResourceResponseCocoa) are not made
with a corresponding call to SecTrustSetClientAuditToken. As a result, if trustd ends up making a
network request to fulfill that API request (e.g. for OCSP verification), the corresponding network
request is attributed to NetworkProcess rather than the UIProcess. This causes us to receive spurious
network usage regression bugs from the power team claiming that NetworkProcess (rather than UIProcess)
is making extra network requests if we happen to make a request that triggers OCSP verification.

To fix this, we added a call SecTrustSetClientAuditToken in ResourceResponse::platformCertificateInfo.

* Source/WTF/wtf/PlatformHave.h:
* Source/WTF/wtf/spi/cocoa/SecuritySPI.h:
* Source/WebCore/platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::includeCertificateInfo const):
* Source/WebCore/platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::includeCertificateInfo):
(WebCore::ResourceResponseBase::platformCertificateInfo const):
* Source/WebCore/platform/network/cf/ResourceResponse.h:
* Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::platformCertificateInfo const):
* Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformCertificateInfo const):
* Source/WebCore/platform/network/soup/ResourceResponse.h:
* Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::platformCertificateInfo const):
* Source/WebKit/NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::notifyDidReceiveResponse):
* Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(NetworkSessionCocoa::setClientAuditToken):

Canonical link: https://commits.webkit.org/251366@main

Modified Paths

trunk/Source/WTF/wtf/PlatformHave.h
trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h
trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp
trunk/Source/WebCore/platform/network/ResourceResponseBase.h
trunk/Source/WebCore/platform/network/cf/ResourceResponse.h
trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp
trunk/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm
trunk/Source/WebCore/platform/network/soup/ResourceResponse.h
trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp
trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm




Diff

Modified: trunk/Source/WTF/wtf/PlatformHave.h (295356 => 295357)

--- trunk/Source/WTF/wtf/PlatformHave.h	2022-06-07 17:22:16 UTC (rev 295356)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2022-06-07 17:48:03 UTC (rev 295357)
@@ -361,6 +361,11 @@
 #define HAVE_SEC_TRUST_SERIALIZATION 1
 #endif
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 12) \
+|| (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 15)
+#define HAVE_SEC_TRUST_SET_CLIENT_AUDIT_TOKEN 1
+#endif
+
 #if PLATFORM(MAC)
 #define HAVE_TOUCH_BAR 1
 #endif


Modified: trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h (295356 => 295357)

--- trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h	2022-06-07 17:22:16 UTC (rev 295356)
+++ trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h	2022-06-07 17:48:03 UTC (rev 295357)
@@ -99,7 +99,10 @@
 #endif
 
 CF_RETURNS_RETAINED CFDictionaryRef SecTrustCopyInfo(SecTrustRef);
+
+#if HAVE(SEC_TRUST_SET_CLIENT_AUDIT_TOKEN)
 OSStatus SecTrustSetClientAuditToken(SecTrustRef, CFDataRef);
+#endif
 
 extern const CFStringRef kSecTrustInfoExtendedValidationKey;
 extern const CFStringRef kSecTrustInfoCompanyNameKey;


Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (295356 => 295357)

--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp	2022-06-07 17:22:16 UTC (rev 295356)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp	2022-06-07 17:48:03 UTC (rev 295357)
@@ -290,11 +290,11 @@
 m_type = type;
 }
 
-void ResourceResponseBase::includeCertificateInfo() const
+void ResourceResponseBase::includeCertificateInfo(Span auditToken) const
 {
 if (m_certificateInfo)
 return;
-m_certificateInfo = static_cast(this)->platformCertificateInfo();
+m_certificateInfo = static_cast(this)->platformCertificateInfo(auditToken);
 }
 
 String ResourceResponseBase::suggestedFilename() const


Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (295356 => 295357)

--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2022-06-07 17:22:16 UTC (rev 295356)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2022-06-07 17:48:03 UTC (rev 295357)
@@ -34,6 +34,7 @@
 #include 
 #include 
 

[webkit-changes] [295131] trunk

2022-06-02 Thread nham
Title: [295131] trunk








Revision 295131
Author n...@apple.com
Date 2022-06-02 10:41:13 -0700 (Thu, 02 Jun 2022)


Log Message
Reset WebKitTestRunner notification policies as part of test cleanup
https://bugs.webkit.org/show_bug.cgi?id=239300

Reviewed by Geoffrey Garen.

Some notification layout tests that check permissions (e.g. http/tests/push-api/subscribe) seem to
be flaky. I can't reproduce this flakiness locally, but from code inspection, this flakiness is
possible if a prewarmed or cached WebContent process is used for one of these tests.

The reason for this is that when a test finishes, `WebNotificationProvider` (in WebKitTestRunner)
tries to reset the notification permissions. However, it doesn't tell cached WebContent processes
about this reset via `WKNotificationManagerProviderDidRemoveNotificationPolicies`. To fix this, make
`WebNotificationProvider::reset` call that function.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::deletePushAndNotificationRegistration):
* Tools/WebKitTestRunner/WebNotificationProvider.cpp:
(WTR::securityOriginsFromStrings):
(WTR::WebNotificationProvider::reset):

Canonical link: https://commits.webkit.org/251222@main

Modified Paths

trunk/LayoutTests/platform/mac-wk2/TestExpectations
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp
trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp




Diff

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (295130 => 295131)

--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2022-06-02 17:20:15 UTC (rev 295130)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2022-06-02 17:41:13 UTC (rev 295131)
@@ -1631,10 +1631,6 @@
 
 webkit.org/b/239308 media/media-source/media-source-webm-vorbis-partial.html [ Failure ]
 
-webkit.org/b/239300 http/tests/push-api/subscribe-default-permissions-iframe-same-origin.html [ Pass Failure ]
-webkit.org/b/239300 http/tests/push-api/subscribe-default-permissions.html [ Pass Failure ]
-webkit.org/b/239300 http/tests/push-api/subscribe-deny-permissions-on-prompt.html [ Pass Failure ]
-
 webkit.org/b/239257 fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-choose-value-from-picker.html [ Pass Failure ]
 
 webkit.org/b/239304 http/tests/cache-storage/cache-origins.https.html [ Pass Failure ]


Modified: trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp (295130 => 295131)

--- trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp	2022-06-02 17:20:15 UTC (rev 295130)
+++ trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp	2022-06-02 17:41:13 UTC (rev 295131)
@@ -65,6 +65,11 @@
 
 void NetworkNotificationManager::deletePushAndNotificationRegistration(const SecurityOriginData& origin, CompletionHandler&& completionHandler)
 {
+if (!m_connection) {
+completionHandler("No connection to push daemon"_s);
+return;
+}
+
 sendMessageWithReply(WTFMove(completionHandler), origin.toString());
 }
 


Modified: trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp (295130 => 295131)

--- trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp	2022-06-02 17:20:15 UTC (rev 295130)
+++ trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp	2022-06-02 17:41:13 UTC (rev 295131)
@@ -189,6 +189,17 @@
 }
 #endif
 
+WKRetainPtr securityOriginsFromStrings(WKArrayRef originStrings)
+{
+auto origins = adoptWK(WKMutableArrayCreate());
+for (size_t i = 0; i < WKArrayGetSize(originStrings); i++) {
+auto originString = static_cast(WKArrayGetItemAtIndex(originStrings, i));
+auto origin = adoptWK(WKSecurityOriginCreateFromString(originString));
+WKArrayAppendItem(origins.get(), static_cast(origin.get()));
+}
+return origins;
+}
+
 void WebNotificationProvider::reset()
 {
 for (auto iterator : m_owningManager) {
@@ -199,6 +210,12 @@
 
 m_knownPersistentNotifications.clear();
 m_owningManager.clear();
+
+auto originStrings = adoptWK(WKDictionaryCopyKeys(static_cast(m_permissions.get(;
+auto origins = securityOriginsFromStrings(originStrings.get());
+for (auto manager : m_knownManagers)
+WKNotificationManagerProviderDidRemoveNotificationPolicies(manager.get(), origins.get());
+
 m_permissions = adoptWK(WKMutableDictionaryCreate());
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294726] trunk

2022-05-23 Thread nham
Title: [294726] trunk








Revision 294726
Author n...@apple.com
Date 2022-05-23 21:00:18 -0700 (Mon, 23 May 2022)


Log Message
Fix webpushd crash when removing notification permissions
https://bugs.webkit.org/show_bug.cgi?id=240737

Reviewed by Chris Dumez and Geoffrey Garen.

When removing notification permissions for an origin, webpushd crashes because of a RELEASE_ASSERT
that fires in AppBundleRequest::start when INSTALL_COORDINATION_BUNDLES isn't enabled and mock
bundles aren't enabled.

Fix this by removing the calls into AppBundleRequest when INSTALL_COORDINATION_BUNDLES isn't enabled.
Those requests are only meant to run when that feature is enabled.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm: Only run the permission management test
  when INSTALL_COORDINATION_BUNDLES is enabled (e.g. on iOS); that is the only time it makes sense
  to test that codepath.
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::Daemon::deletePushRegistration):
(WebPushD::Daemon::deletePushAndNotificationRegistration):

Canonical link: https://commits.webkit.org/250904@main

Modified Paths

trunk/Source/WebKit/webpushd/WebPushDaemon.h
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm




Diff

Modified: trunk/Source/WebKit/webpushd/WebPushDaemon.h (294725 => 294726)

--- trunk/Source/WebKit/webpushd/WebPushDaemon.h	2022-05-24 03:53:32 UTC (rev 294725)
+++ trunk/Source/WebKit/webpushd/WebPushDaemon.h	2022-05-24 04:00:18 UTC (rev 294726)
@@ -74,6 +74,7 @@
 void echoTwice(ClientConnection*, const String&, CompletionHandler&& replySender);
 void requestSystemNotificationPermission(ClientConnection*, const String&, CompletionHandler&& replySender);
 void getOriginsWithPushAndNotificationPermissions(ClientConnection*, CompletionHandler&)>&& replySender);
+void deletePushRegistration(const String&, const String&, CompletionHandler&&);
 void deletePushAndNotificationRegistration(ClientConnection*, const String& originString, CompletionHandler&& replySender);
 void setDebugModeIsEnabled(ClientConnection*, bool);
 void updateConnectionConfiguration(ClientConnection*, const WebPushDaemonConnectionConfiguration&);


Modified: trunk/Source/WebKit/webpushd/WebPushDaemon.mm (294725 => 294726)

--- trunk/Source/WebKit/webpushd/WebPushDaemon.mm	2022-05-24 03:53:32 UTC (rev 294725)
+++ trunk/Source/WebKit/webpushd/WebPushDaemon.mm	2022-05-24 04:00:18 UTC (rev 294726)
@@ -505,6 +505,20 @@
 #endif
 }
 
+void Daemon::deletePushRegistration(const String& bundleIdentifier, const String& originString, CompletionHandler&& callback)
+{
+runAfterStartingPushService([this, bundleIdentifier, originString, callback = WTFMove(callback)]() mutable {
+if (!m_pushService) {
+callback();
+return;
+}
+
+m_pushService->removeRecordsForBundleIdentifierAndOrigin(bundleIdentifier, originString, [callback = WTFMove(callback)](auto&&) mutable {
+callback();
+});
+});
+}
+
 void Daemon::deletePushAndNotificationRegistration(ClientConnection* connection, const String& originString, CompletionHandler&& replySender)
 {
 if (!canRegisterForNotifications(*connection)) {
@@ -512,18 +526,17 @@
 return;
 }
 
+#if ENABLE(INSTALL_COORDINATION_BUNDLES)
 connection->enqueueAppBundleRequest(makeUnique(*connection, originString, [this, originString = String { originString }, replySender = WTFMove(replySender), bundleIdentifier = connection->hostAppCodeSigningIdentifier()](auto result) mutable {
-runAfterStartingPushService([this, bundleIdentifier = WTFMove(bundleIdentifier), originString = WTFMove(originString), replySender = WTFMove(replySender), result]() mutable {
-if (!m_pushService) {
-replySender(result);
-return;
-}
-
-m_pushService->removeRecordsForBundleIdentifierAndOrigin(bundleIdentifier, originString, [replySender = WTFMove(replySender), result](auto&&) mutable {
-replySender(result);
-});
+deletePushRegistration(bundleIdentifier, originString, [replySender = WTFMove(replySender), result]() mutable {
+replySender(result);
 });
 }));
+#else
+deletePushRegistration(connection->hostAppCodeSigningIdentifier(), originString, [replySender = WTFMove(replySender)]() mutable {
+replySender(emptyString());
+});
+#endif
 }
 
 void Daemon::setDebugModeIsEnabled(ClientConnection* clientConnection, bool enabled)


Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (294725 => 294726)

--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-05-24 03:53:32 UTC (rev 294725)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-05-24 04:00:18 UTC (rev 294726)
@@ -322,67 +322,6 @@
 cleanUpTestWebPushD(tempDir);
 }
 
-TEST(WebPushD, 

[webkit-changes] [294181] trunk/Source/WTF

2022-05-13 Thread nham
Title: [294181] trunk/Source/WTF








Revision 294181
Author n...@apple.com
Date 2022-05-13 15:56:17 -0700 (Fri, 13 May 2022)


Log Message
Enforce foreground WebContent memory limit on macOS
https://bugs.webkit.org/show_bug.cgi?id=240397

Reviewed by Chris Dumez.

We removed the foreground memory limit for WebContent on macOS in r272046. But based on some
bug reports that we've seen, it seems like we need to restore some limit to prevent bad user
outcomes when a misbehaving process has runaway memory usage.

This patch adds a foreground memory limit of 8GB or 16GB depending on RAM size. This matches
the limits set by other browsers for their content process.

* wtf/MemoryPressureHandler.cpp:
(WTF::thresholdForMemoryKillOfActiveProcess):
(WTF::MemoryPressureHandler::thresholdForMemoryKill):

Canonical link: https://commits.webkit.org/250548@main

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/MemoryPressureHandler.cpp




Diff

Modified: trunk/Source/WTF/ChangeLog (294180 => 294181)

--- trunk/Source/WTF/ChangeLog	2022-05-13 22:28:16 UTC (rev 294180)
+++ trunk/Source/WTF/ChangeLog	2022-05-13 22:56:17 UTC (rev 294181)
@@ -53,6 +53,24 @@
 
 * wtf/cocoa/RuntimeApplicationChecksCocoa.h:
 
+2022-05-13  Ben Nham  
+
+Enforce foreground WebContent memory limit on macOS
+https://bugs.webkit.org/show_bug.cgi?id=240397
+
+Reviewed by Chris Dumez.
+
+We removed the foreground memory limit for WebContent on macOS in r272046. But based on some
+bug reports that we've seen, it seems like we need to restore some limit to prevent bad user
+outcomes when a misbehaving process has runaway memory usage.
+
+This patch adds a foreground memory limit of 8GB or 16GB depending on RAM size. This matches
+the limits set by other browsers for their content process.
+
+* wtf/MemoryPressureHandler.cpp:
+(WTF::thresholdForMemoryKillOfActiveProcess):
+(WTF::MemoryPressureHandler::thresholdForMemoryKill):
+
 2022-05-10  Brent Fulgham  
 
 Remove abandoned CSSDeferredParser implementation and feature flag


Modified: trunk/Source/WTF/wtf/MemoryPressureHandler.cpp (294180 => 294181)

--- trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2022-05-13 22:28:16 UTC (rev 294180)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2022-05-13 22:56:17 UTC (rev 294181)
@@ -95,6 +95,12 @@
 }
 #endif
 
+static size_t thresholdForMemoryKillOfActiveProcess(unsigned tabCount)
+{
+size_t baseThreshold = ramSize() > 16 * GB ? 15 * GB : 7 * GB;
+return baseThreshold + tabCount * GB;
+}
+
 static size_t thresholdForMemoryKillOfInactiveProcess(unsigned tabCount)
 {
 #if CPU(X86_64) || CPU(ARM64)
@@ -121,7 +127,7 @@
 case WebsamProcessState::Inactive:
 return thresholdForMemoryKillOfInactiveProcess(m_pageCount);
 case WebsamProcessState::Active:
-break;
+return thresholdForMemoryKillOfActiveProcess(m_pageCount);
 }
 return std::nullopt;
 }






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294084] trunk

2022-05-11 Thread nham
Title: [294084] trunk








Revision 294084
Author n...@apple.com
Date 2022-05-11 17:56:46 -0700 (Wed, 11 May 2022)


Log Message
Re-send connection configuration if webpushd dies
https://bugs.webkit.org/show_bug.cgi?id=240286

Reviewed by Geoffrey Garen.

If webpushd dies, all future communication with it from NetworkProcess fails because we
don't re-send the connection configuration to the daemon after the connection is
interrupted. This manifests itself as an "invalid sender" AbortError from various
PushManager methods because webpushd doesn't know the bundle identifier of the UIProcess it
is working on behalf of.

To fix this, I moved the responsibility for sending the configuration from
NetworkNotificationManager to WebPushD::Connection, and WebPushD::Connection re-sends the
configuration every time a new XPC connection is created.

Covered by a new API test.

Source/WebKit:

* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::webPushDaemonUsesMockBundlesForTesting const): Deleted.
* NetworkProcess/Notifications/Cocoa/WebPushDaemonConnectionCocoa.mm:
(WebKit::WebPushD::Connection::newConnectionWasInitialized const):
* NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::NetworkNotificationManager):
(WebKit::NetworkNotificationManager::sendMessage const):
(WebKit::NetworkNotificationManager::sendMessageWithReply const):
(WebKit::NetworkNotificationManager::maybeSendConnectionConfiguration const): Deleted.
* NetworkProcess/Notifications/NetworkNotificationManager.h:
* NetworkProcess/Notifications/WebPushDaemonConnection.cpp:
(WebKit::WebPushD::Connection::Connection):
* NetworkProcess/Notifications/WebPushDaemonConnection.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
(TestWebKitAPI::testWebPushDaemonPList):
(TestWebKitAPI::setUpTestWebPushD):
(TestWebKitAPI::restartTestWebPushD):
(TestWebKitAPI::WebPushDTest::WebPushDTest):
* TestWebKitAPI/cocoa/DaemonTestUtilities.h:
* TestWebKitAPI/cocoa/DaemonTestUtilities.mm:
(TestWebKitAPI::restartService):

Canonical link: https://commits.webkit.org/250475@main

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
trunk/Source/WebKit/NetworkProcess/NetworkSession.h
trunk/Source/WebKit/NetworkProcess/Notifications/Cocoa/WebPushDaemonConnectionCocoa.mm
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h
trunk/Source/WebKit/NetworkProcess/Notifications/WebPushDaemonConnection.cpp
trunk/Source/WebKit/NetworkProcess/Notifications/WebPushDaemonConnection.h
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm
trunk/Tools/TestWebKitAPI/cocoa/DaemonTestUtilities.h
trunk/Tools/TestWebKitAPI/cocoa/DaemonTestUtilities.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (294083 => 294084)

--- trunk/Source/WebKit/ChangeLog	2022-05-12 00:54:25 UTC (rev 294083)
+++ trunk/Source/WebKit/ChangeLog	2022-05-12 00:56:46 UTC (rev 294084)
@@ -1,3 +1,41 @@
+2022-05-10  Ben Nham  
+
+Re-send connection configuration if webpushd dies
+https://bugs.webkit.org/show_bug.cgi?id=240286
+
+Reviewed by Geoffrey Garen.
+
+If webpushd dies, all future communication with it from NetworkProcess fails because we
+don't re-send the connection configuration to the daemon after the connection is
+interrupted. This manifests itself as an "invalid sender" AbortError from various
+PushManager methods because webpushd doesn't know the bundle identifier of the UIProcess it
+is working on behalf of.
+
+To fix this, I moved the responsibility for sending the configuration from
+NetworkNotificationManager to WebPushD::Connection, and WebPushD::Connection re-sends the
+configuration every time a new XPC connection is created.
+
+Covered by a new API test.
+
+* NetworkProcess/NetworkSession.cpp:
+(WebKit::NetworkSession::NetworkSession):
+* NetworkProcess/NetworkSession.h:
+(WebKit::NetworkSession::webPushDaemonUsesMockBundlesForTesting const): Deleted.
+* NetworkProcess/Notifications/Cocoa/WebPushDaemonConnectionCocoa.mm:
+(WebKit::WebPushD::Connection::newConnectionWasInitialized const):
+* NetworkProcess/Notifications/NetworkNotificationManager.cpp:
+(WebKit::NetworkNotificationManager::NetworkNotificationManager):
+(WebKit::NetworkNotificationManager::sendMessage const):
+(WebKit::NetworkNotificationManager::sen

[webkit-changes] [294061] trunk/LayoutTests

2022-05-11 Thread nham
Title: [294061] trunk/LayoutTests








Revision 294061
Author n...@apple.com
Date 2022-05-11 10:58:17 -0700 (Wed, 11 May 2022)


Log Message
Rebaseline WK1 notifications test expectations after r293921
https://bugs.webkit.org/show_bug.cgi?id=240153

Unreviewed test gardening.

* platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any-expected.txt:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any-expected.txt




Diff

Modified: trunk/LayoutTests/ChangeLog (294060 => 294061)

--- trunk/LayoutTests/ChangeLog	2022-05-11 17:51:04 UTC (rev 294060)
+++ trunk/LayoutTests/ChangeLog	2022-05-11 17:58:17 UTC (rev 294061)
@@ -1,3 +1,12 @@
+2022-05-11  Ben Nham  
+
+Rebaseline WK1 notifications test expectations after r293921
+https://bugs.webkit.org/show_bug.cgi?id=240153
+
+Unreviewed test gardening.
+
+* platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any-expected.txt:
+
 2022-05-11  Karl Rackler  
 
 [Gardening][ macOS Debug wk2 ] fast/css/variables/test-suite/168.html is a flaky image failure


Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any-expected.txt (294060 => 294061)

--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any-expected.txt	2022-05-11 17:51:04 UTC (rev 294060)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any-expected.txt	2022-05-11 17:58:17 UTC (rev 294061)
@@ -32,7 +32,7 @@
 FAIL Notification interface: attribute renotify assert_true: The prototype object must have a property "renotify" expected true got false
 FAIL Notification interface: attribute silent assert_true: The prototype object must have a property "silent" expected true got false
 FAIL Notification interface: attribute requireInteraction assert_true: The prototype object must have a property "requireInteraction" expected true got false
-FAIL Notification interface: attribute data assert_true: The prototype object must have a property "data" expected true got false
+PASS Notification interface: attribute data
 FAIL Notification interface: attribute actions assert_true: The prototype object must have a property "actions" expected true got false
 PASS Notification interface: operation close()
 PASS Notification must be primary interface of notification
@@ -58,7 +58,7 @@
 FAIL Notification interface: notification must inherit property "renotify" with the proper type assert_inherits: property "renotify" not found in prototype chain
 FAIL Notification interface: notification must inherit property "silent" with the proper type assert_inherits: property "silent" not found in prototype chain
 FAIL Notification interface: notification must inherit property "requireInteraction" with the proper type assert_inherits: property "requireInteraction" not found in prototype chain
-FAIL Notification interface: notification must inherit property "data" with the proper type assert_inherits: property "data" not found in prototype chain
+PASS Notification interface: notification must inherit property "data" with the proper type
 FAIL Notification interface: notification must inherit property "actions" with the proper type assert_inherits: property "actions" not found in prototype chain
 PASS Notification interface: notification must inherit property "close()" with the proper type
 PASS NotificationEvent interface: existence and properties of interface object






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [293988] trunk/Source/WebKit

2022-05-09 Thread nham
Title: [293988] trunk/Source/WebKit








Revision 293988
Author n...@apple.com
Date 2022-05-09 13:43:28 -0700 (Mon, 09 May 2022)


Log Message
Allow log streaming from webpushd
https://bugs.webkit.org/show_bug.cgi?id=240238

Reviewed by Per Arne Vollan.

`log stream` outputs nothing from webpushd because we blocked the diagnosticd service in its
sandbox. We should allow that and also block awdd since it's unlikely that webpushd needs
access to the wireless diagnostics daemon.

* webpushd/mac/com.apple.WebKit.webpushd.sb.in:

Canonical link: https://commits.webkit.org/250425@main

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in




Diff

Modified: trunk/Source/WebKit/ChangeLog (293987 => 293988)

--- trunk/Source/WebKit/ChangeLog	2022-05-09 20:37:15 UTC (rev 293987)
+++ trunk/Source/WebKit/ChangeLog	2022-05-09 20:43:28 UTC (rev 293988)
@@ -1,3 +1,16 @@
+2022-05-09  Ben Nham  
+
+Allow log streaming from webpushd
+https://bugs.webkit.org/show_bug.cgi?id=240238
+
+Reviewed by Per Arne Vollan.
+
+`log stream` outputs nothing from webpushd because we blocked the diagnosticd service in its
+sandbox. We should allow that and also block awdd since it's unlikely that webpushd needs
+access to the wireless diagnostics daemon.
+
+* webpushd/mac/com.apple.WebKit.webpushd.sb.in:
+
 2022-05-09  Yusuke Suzuki  
 
 Unreviewed, build fix for Internal iOS build


Modified: trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in (293987 => 293988)

--- trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in	2022-05-09 20:37:15 UTC (rev 293987)
+++ trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in	2022-05-09 20:43:28 UTC (rev 293988)
@@ -234,8 +234,9 @@
 
 ;; Analytics.
 (with-filter (system-attribute apple-internal)
-(allow mach-lookup (global-name "com.apple.analyticsd"))
-(allow mach-lookup (global-name "com.apple.awdd")))
+(allow mach-lookup
+(global-name "com.apple.analyticsd")
+(global-name "com.apple.diagnosticd")))
 
 ;; Daemon prefs.
 (allow user-preference-read user-preference-write






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [293921] trunk

2022-05-06 Thread nham
-data.html




Diff

Modified: trunk/LayoutTests/ChangeLog (293920 => 293921)

--- trunk/LayoutTests/ChangeLog	2022-05-06 19:55:27 UTC (rev 293920)
+++ trunk/LayoutTests/ChangeLog	2022-05-06 20:26:03 UTC (rev 293921)
@@ -1,3 +1,35 @@
+2022-05-05  Ben Nham  
+
+Add support for Notification objects with custom data
+https://bugs.webkit.org/show_bug.cgi?id=240153
+
+Reviewed by Chris Dumez.
+
+Test that Notification objects with custom data can be created and shown by both documents
+and service workers.
+
+* http/tests/notifications/notification-expected.txt:
+* http/tests/notifications/notification.html:
+* http/tests/workers/service/getnotifications-expected.txt:
+* http/tests/workers/service/getnotifications-stop-expected.txt:
+* http/tests/workers/service/getnotifications-stop.html:
+* http/tests/workers/service/getnotifications.html:
+* http/tests/workers/service/openwindow-from-notification-click.html:
+* http/tests/workers/service/resources/shownotification-openwindow-worker.js:
+(async tryShow):
+(async getNotes):
+* http/tests/workers/service/resources/shownotification-worker.js:
+(async event):
+(async tryShow):
+(async tryShowInvalidData.try.data):
+(async tryShowInvalidData):
+(async getNotes):
+* http/tests/workers/service/shownotification-allowed-document-expected.txt:
+* http/tests/workers/service/shownotification-allowed-document.html:
+* http/tests/workers/service/shownotification-allowed.html:
+* http/tests/workers/service/shownotification-invalid-data-expected.txt: Added.
+* http/tests/workers/service/shownotification-invalid-data.html: Added.
+
 2022-05-06  Brent Fulgham  
 
 Remove the viewportFitEnabled WKPreference now that it is always on 


Modified: trunk/LayoutTests/http/tests/notifications/notification-expected.txt (293920 => 293921)

--- trunk/LayoutTests/http/tests/notifications/notification-expected.txt	2022-05-06 19:55:27 UTC (rev 293920)
+++ trunk/LayoutTests/http/tests/notifications/notification-expected.txt	2022-05-06 20:26:03 UTC (rev 293921)
@@ -2,5 +2,7 @@
 PASS The Notification constructor requires at least one argument.
 PASS The Notification object initializes its properties to their default values from the NotificationOptions dictionary if it is not provided.
 PASS The Notification object initializes its properties to the values from NotificationOptions dictionary if it is provided.
+PASS The Notification constructor should throw if it is passed a non-cloneable data option.
 PASS The NotificationOptions dictionary only accepts valid NotificationDirection values.
+PASS The Notification data property returns the same object after GC.
 


Modified: trunk/LayoutTests/http/tests/notifications/notification.html (293920 => 293921)

--- trunk/LayoutTests/http/tests/notifications/notification.html	2022-05-06 19:55:27 UTC (rev 293920)
+++ trunk/LayoutTests/http/tests/notifications/notification.html	2022-05-06 20:26:03 UTC (rev 293921)
@@ -2,6 +2,7 @@
 
 
 
+<span class="cx"> <script src=""
</span><span class="cx"> <script src=""
</span><span class="cx"> </head>
</span><span class="lines">@@ -24,6 +25,7 @@
</span><span class="cx"> assert_equals(notification.body, "");
</span><span class="cx"> assert_equals(notification.tag, "");
</span><span class="cx"> assert_equals(notification.icon, "");
</span><ins>+assert_equals(notification.data, null);
</ins><span class="cx"> }, "The Notification object initializes its properties to their default values from the NotificationOptions dictionary if it is not provided.");
</span><span class="cx"> 
</span><span class="cx"> test(function() {
</span><span class="lines">@@ -32,7 +34,8 @@
</span><span class="cx"> lang: "en",
</span><span class="cx"> body: "test body",
</span><span class="cx"> tag: "test tag",
</span><del>-icon: "foo.png"
</del><ins>+icon: "foo.png",
+data: {foo: 'bar'}
</ins><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> assert_equals(notification.title, "test title");
</span><span class="lines">@@ -41,9 +44,14 @@
</span><span class="cx"> assert_equals(notification.body, "test body");
</span><span class=&quo

[webkit-changes] [293920] trunk/Source/WebKit

2022-05-06 Thread nham
Title: [293920] trunk/Source/WebKit








Revision 293920
Author n...@apple.com
Date 2022-05-06 12:55:27 -0700 (Fri, 06 May 2022)


Log Message
Improve Mac webpushd sandbox
https://bugs.webkit.org/show_bug.cgi?id=240110

Reviewed by Per Arne Vollan.

This tightens the webpushd sandbox to only allow essential operations.

The first ~280 lines or so are similar to the other WebKit sandboxes, although I removed
many of the lines in this prelude as most of the services listed in the other profiles
have no use in webpushd.

The last ~50 lines of the profile (starting with the comment about SQLite) allows the
operations necessary for functioning of the daemon:

 - Communicating with the push service daemon
 - Waking up processes in response to a push
 - Persisting subscriptions to the PushDatabase

I've also switched webpushd to read CF preferences directly like the other daemons, since our
sandbox profiles expect this.

* webpushd/WebPushDaemonMain.mm:
* webpushd/mac/com.apple.WebKit.webpushd.sb.in:

Canonical link: https://commits.webkit.org/250367@main

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm
trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in




Diff

Modified: trunk/Source/WebKit/ChangeLog (293919 => 293920)

--- trunk/Source/WebKit/ChangeLog	2022-05-06 19:41:55 UTC (rev 293919)
+++ trunk/Source/WebKit/ChangeLog	2022-05-06 19:55:27 UTC (rev 293920)
@@ -1,3 +1,26 @@
+2022-05-04  Ben Nham  
+
+Improve Mac webpushd sandbox
+https://bugs.webkit.org/show_bug.cgi?id=240110
+
+Reviewed by Per Arne Vollan.
+
+This tightens the webpushd sandbox to only allow essential operations.
+
+The first ~280 lines or so are similar to the other WebKit sandboxes, although I removed
+many of the lines in this prelude as most of the services listed in the other profiles
+have no use in webpushd.
+
+The last ~50 lines of the profile (starting with the comment about SQLite) allows the
+operations necessary for functioning of the daemon:
+
+ - Communicating with the push service daemon
+ - Waking up processes in response to a push
+ - Persisting subscriptions to the PushDatabase
+
+* webpushd/WebPushDaemonMain.mm:
+* webpushd/mac/com.apple.WebKit.webpushd.sb.in:
+
 2022-05-06  Brent Fulgham  
 
 Remove internal WKPreference for non-iTunesAVOutput now that all platform support it 


Modified: trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm (293919 => 293920)

--- trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm	2022-05-06 19:41:55 UTC (rev 293919)
+++ trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm	2022-05-06 19:55:27 UTC (rev 293920)
@@ -36,6 +36,7 @@
 #import 
 #import 
 #import 
+#import 
 #import 
 #import 
 #import 
@@ -86,6 +87,9 @@
 @autoreleasepool {
 WTF::initializeMainThread();
 
+#if ENABLE(CFPREFS_DIRECT_MODE)
+_CFPrefsSetDirectModeEnabled(YES);
+#endif
 applySandbox();
 
 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED


Modified: trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in (293919 => 293920)

--- trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in	2022-05-06 19:41:55 UTC (rev 293919)
+++ trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in	2022-05-06 19:55:27 UTC (rev 293920)
@@ -22,8 +22,266 @@
 ; THE POSSIBILITY OF SUCH DAMAGE.
 
 (version 1)
-(allow (with report) default)
+(deny default (with partial-symbolication))
+(deny nvram*)
+(allow system-audit file-read-metadata)
 
-;; We can remove the catch once we no longer need to support older macOS
-(catch (lambda)
-(import "dyld-support.sb"))
+;; Silence spurious logging due to rdar://20117923 and rdar://72366475
+(deny system-privilege (privilege-id PRIV_GLOBAL_PROC_INFO) (with no-report))
+
+#include "Shared/Sandbox/preferences.sb"
+
+#if ENABLE(SYSTEM_CONTENT_PATH_SANDBOX_RULES)
+#include 
+#endif
+
+;;; Allow registration of per-pid services.
+(allow mach-register (local-name-prefix ""))
+
+;;; Allow read access to standard system paths.
+(allow file-read*
+(require-all (file-mode #o0004)
+(require-any (subpath "/Library/Filesystems/NetFSPlugins")
+(subpath "/Library/Apple/System")
+(subpath "/Library/Preferences/Logging")  ; Logging Rethink
+(subpath "/System")
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 11
+(subpath "/private/var/db/dyld")
+#endif
+(subpath "/private/var/db/timezone")
+(subpath "/usr/lib")
+(subpath "/usr/share"
+
+;;; Allow reading internal profiles on development builds
+(allow file-read*
+(require-all (file-mode #o0004)
+(subpath "/AppleInternal/Library/Preferences/Logging")
+(system-attribute apple-internal)))
+
+;;; Allow mapping of system frameworks + dylibs
+(allow file-map-executable
+   

[webkit-changes] [293782] trunk/Source/WebKit

2022-05-04 Thread nham
Title: [293782] trunk/Source/WebKit








Revision 293782
Author n...@apple.com
Date 2022-05-04 12:03:42 -0700 (Wed, 04 May 2022)


Log Message
Add push service result logging
https://bugs.webkit.org/show_bug.cgi?id=240035

Reviewed by Geoffrey Garen.

This adds logging to make it easier to debug certain errors we have seen internally (e.g.
unexpectedly missing subscriptions and service workers that aren't spawning to service push
events):

1. In some cases, it appears that a push event is coming in, but the service worker to
   handle the event never spawns. This can happen if we think an origin doesn't have
   permission to show a notification in UIProcess and we bail out early. Currently we don't
   have logging for this case.

   To fix this, I removed the early bail-out in NetworkProcessProxy::processPushMessage
   entirely. Instead, we always IPC the message to NetworkProcess::processPushMessage.

   This will trigger existing logging around whether a service worker spawns to handle the
   push event on the NetworkProcess side. The optimization to not spawn NetworkProcess in
   the permission-denied case will not be used in the long run, because we plan to move the
   subscription to the ignore list in this case (see the FIXME in
   NetworkProcess::processPushMessage), which requires spawning NetworkProcess to message
   webpushd anyway.

2. For push service requests that produce a result, we additionally log whether or not the
   result exists (e.g. to know if a push subscription exists or not).

3. Add logging for the cases where WebKit explicitly asks webpushd to bulk-remove
   subscriptions.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::processPushMessage):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::processPushMessage):
* webpushd/PushService.mm:
(WebPushD::PushServiceRequestImpl::fulfill):
(WebPushD::PushService::removeRecordsForBundleIdentifier):
(WebPushD::PushService::removeRecordsForBundleIdentifierAndOrigin):

Canonical link: https://commits.webkit.org/250261@main

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
trunk/Source/WebKit/webpushd/PushService.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (293781 => 293782)

--- trunk/Source/WebKit/ChangeLog	2022-05-04 18:14:22 UTC (rev 293781)
+++ trunk/Source/WebKit/ChangeLog	2022-05-04 19:03:42 UTC (rev 293782)
@@ -1,3 +1,44 @@
+2022-05-03  Ben Nham  
+
+Add push service result logging
+https://bugs.webkit.org/show_bug.cgi?id=240035
+
+Reviewed by Geoffrey Garen.
+
+This adds logging to make it easier to debug certain errors we have seen internally (e.g.
+unexpectedly missing subscriptions and service workers that aren't spawning to service push
+events):
+
+1. In some cases, it appears that a push event is coming in, but the service worker to
+   handle the event never spawns. This can happen if we think an origin doesn't have
+   permission to show a notification in UIProcess and we bail out early. Currently we don't
+   have logging for this case.
+
+   To fix this, I removed the early bail-out in NetworkProcessProxy::processPushMessage
+   entirely. Instead, we always IPC the message to NetworkProcess::processPushMessage.
+
+   This will trigger existing logging around whether a service worker spawns to handle the
+   push event on the NetworkProcess side. The optimization to not spawn NetworkProcess in
+   the permission-denied case will not be used in the long run, because we plan to move the
+   subscription to the ignore list in this case (see the FIXME in
+   NetworkProcess::processPushMessage), which requires spawning NetworkProcess to message
+   webpushd anyway.
+
+2. For push service requests that produce a result, we additionally log whether or not the
+   result exists (e.g. to know if a push subscription exists or not).
+
+3. Add logging for the cases where WebKit explicitly asks webpushd to bulk-remove
+   subscriptions.
+
+* NetworkProcess/NetworkProcess.cpp:
+(WebKit::NetworkProcess::processPushMessage):
+* UIProcess/Network/NetworkProcessProxy.cpp:
+(WebKit::NetworkProcessProxy::processPushMessage):
+* webpushd/PushService.mm:
+(WebPushD::PushServiceRequestImpl::fulfill):
+(WebPushD::PushService::removeRecordsForBundleIdentifier):
+(WebPushD::PushService::removeRecordsForBundleIdentifierAndOrigin):
+
 2022-05-04  Kimmo Kinnunen  
 
 DisplayList::Recorder has redundant, unused flushContext


Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (293781 => 293782)

--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2022-05-04 18:14:22 UTC (rev 293781)
+++ trunk/Source/WebKit/NetworkP

[webkit-changes] [293778] trunk/metadata/contributors.json

2022-05-04 Thread nham
Title: [293778] trunk/metadata/contributors.json








Revision 293778
Author n...@apple.com
Date 2022-05-04 10:21:04 -0700 (Wed, 04 May 2022)


Log Message
Unreviewed, add my GitHub account name to contributors.json

* metadata/contributors.json:

Modified Paths

trunk/metadata/contributors.json




Diff

Modified: trunk/metadata/contributors.json (293777 => 293778)

--- trunk/metadata/contributors.json	2022-05-04 17:11:00 UTC (rev 293777)
+++ trunk/metadata/contributors.json	2022-05-04 17:21:04 UTC (rev 293778)
@@ -1038,6 +1038,7 @@
   "emails" : [
  "n...@apple.com"
   ],
+  "github" : "bnham",
   "name" : "Ben Nham",
   "nicks" : [
  "nham"






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [293060] trunk

2022-04-19 Thread nham
Title: [293060] trunk








Revision 293060
Author n...@apple.com
Date 2022-04-19 22:11:55 -0700 (Tue, 19 Apr 2022)


Log Message
Handle public token updates in webpushd
https://bugs.webkit.org/show_bug.cgi?id=239042

Reviewed by Brady Eidson.

Source/WebCore:

When the public token associated with our push service changes, we have to invalidate all
push subscriptions, since they all derive from the public token. This is only expected to
happen in very rare cases, e.g. keychain corruption.

To implement this, we now listen for public token updates from our push service, and pass
that on to PushDatabase. PushDatabase persists the token and deletes all subscriptions on
token change if necessary.

I had to change the schema to allow for this. openAndMigrateDatabaseImpl now migrates
existing data on schema change rather than nuking the whole database so users won't lose
their existing subscriptions.

* Modules/push-api/PushDatabase.cpp:
(WebCore::openAndMigrateDatabaseImpl):
(WebCore::PushDatabase::updatePublicToken):
(WebCore::PushDatabase::getPublicToken):

Source/WebKit:

When the public token associated with our push service changes, we have to invalidate all
push subscriptions, since they all derive from the public token. This is only expected to
happen in very rare cases, e.g. keychain corruption.

To implement this, we now listen for public token updates from our push service, and pass
that on to PushDatabase. PushDatabase persists the token and deletes all subscriptions on
token change if necessary.

* Shared/WebPushDaemonConstants.h:
(WebKit::WebPushD::messageTypeSendsReply):
* webpushd/ApplePushServiceConnection.mm:
(-[_WKAPSConnectionDelegate connection:didReceivePublicToken:]):
(-[_WKAPSConnectionDelegate connection:didReceiveIncomingMessage:]):
* webpushd/MockPushServiceConnection.mm:
(WebPushD::MockPushServiceConnection::MockPushServiceConnection):
(WebPushD::MockPushServiceConnection::setPublicTokenForTesting):
* webpushd/PushService.mm:
(WebPushD::PushService::PushService):
(WebPushD::PushService::setPublicTokenForTesting):
(WebPushD::PushService::didReceivePublicToken):
* webpushd/PushServiceConnection.mm:
(WebPushD::PushServiceConnection::startListeningForPublicToken):
(WebPushD::PushServiceConnection::didReceivePublicToken):
(WebPushD::PushServiceConnection::setPublicTokenForTesting):
* webpushd/WebPushDaemon.mm:
(WebPushD::Daemon::decodeAndHandleMessage):
(WebPushD::Daemon::setPublicTokenForTesting):

Tools:

 - Test that public token updates are handled properly at the PushDatabase and WebPushDaemon levels
 - Test schema migration in PushDatabase

* TestWebKitAPI/Tests/WebCore/PushDatabase.cpp:
(TestWebKitAPI::createDatabaseSync):
(TestWebKitAPI::getPublicTokenSync):
(TestWebKitAPI::updatePublicTokenSync):
(TestWebKitAPI::getRecordByBundleIdentifierAndScopeSync):
(TestWebKitAPI::getRowIdentifiersSync):
(TestWebKitAPI::PushDatabaseTest::getPublicToken):
(TestWebKitAPI::PushDatabaseTest::updatePublicToken):
(TestWebKitAPI::PushDatabaseTest::getRecordByBundleIdentifierAndScope):
(TestWebKitAPI::PushDatabaseTest::getRowIdentifiers):
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::TEST):
(TestWebKitAPI::createDatabaseFromStatements):
* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/push-api/PushDatabase.cpp
trunk/Source/WebCore/Modules/push-api/PushDatabase.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Shared/WebPushDaemonConstants.h
trunk/Source/WebKit/webpushd/ApplePushServiceConnection.mm
trunk/Source/WebKit/webpushd/MockPushServiceConnection.h
trunk/Source/WebKit/webpushd/MockPushServiceConnection.mm
trunk/Source/WebKit/webpushd/PushService.h
trunk/Source/WebKit/webpushd/PushService.mm
trunk/Source/WebKit/webpushd/PushServiceConnection.h
trunk/Source/WebKit/webpushd/PushServiceConnection.mm
trunk/Source/WebKit/webpushd/WebPushDaemon.h
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm




Diff

Modified: trunk/Source/WebCore/ChangeLog (293059 => 293060)

--- trunk/Source/WebCore/ChangeLog	2022-04-20 03:05:47 UTC (rev 293059)
+++ trunk/Source/WebCore/ChangeLog	2022-04-20 05:11:55 UTC (rev 293060)
@@ -1,3 +1,27 @@
+2022-04-19  Ben Nham  
+
+Handle public token updates in webpushd
+https://bugs.webkit.org/show_bug.cgi?id=239042
+
+Reviewed by Brady Eidson.
+
+When the public token associated with our push service changes, we have to invalidate all
+push subscriptions, since they all derive from the public token. This is only expected to
+happen in very rare cases, e.g. keychain corruption.
+
+To implement this, we now listen for public token updates from our push service, and pass
+that on to PushDatabase. PushDatabase persists the token and deletes all subscriptions on
+token change if necessary.
+
+  

[webkit-changes] [292232] trunk

2022-04-01 Thread nham
Title: [292232] trunk








Revision 292232
Author n...@apple.com
Date 2022-04-01 13:47:45 -0700 (Fri, 01 Apr 2022)


Log Message
Add more push-related logging
https://bugs.webkit.org/show_bug.cgi?id=238591

Reviewed by Youenn Fablet.

Source/WebCore:

Add logging to help diagnose Push API errors. We currently log very little, which is making
it hard for us to diagnose bug reports.

 - Log if PushManager.subscribe fails the user gesture check. We log this to both syslog and
   the developer console. We do the latter to inform developers, and we already log an
   identical message from Notification.requestPermission when that fails in this manner.
 - Log if we can't fire a push event because the service worker registration went away.

* Modules/push-api/PushManager.cpp:
(WebCore::PushManager::subscribe):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::processPushMessage):

Source/WebKit:

Add logging to help diagnose Push API errors. We currently log very little, which is making
it hard for us to diagnose bug reports.

 - Log when we try to fetch or process push messages in NetworkProcess.
 - Log when we enqueue, start, and finish a PushServiceRequest. This helps catch issues such
   as a queued request never running because the OS push daemon never completing a request.
 - Log if we failed trying to wake up the browser to process a push message.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::processPushMessage):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _getPendingPushMessages:]):
(-[WKWebsiteDataStore _processPushMessage:completionHandler:]):
* webpushd/PushService.mm:
(WebPushD::PushService::create):
(WebPushD::PushServiceRequestImpl::fulfill):
(WebPushD::PushServiceRequestImpl::reject):
(WebPushD::SubscribeRequest::startImpl):
(WebPushD::UnsubscribeRequest::startInternal):
(WebPushD::PushService::enqueuePushServiceRequest):
(WebPushD::PushService::incrementSilentPushCount):
(WebPushD::PushService::removeRecordsImpl):
(WebPushD::makeRawPushMessage):
(WebPushD::PushService::didReceivePushMessage):
* webpushd/WebPushDaemon.mm:
(WebPushD::Daemon::injectEncryptedPushMessageForTesting):
(WebPushD::Daemon::notifyClientPushMessageIsAvailable):
(WebPushD::Daemon::getPendingPushMessages):

LayoutTests:

Modify test cases to check for user gesture error console message.

* http/tests/push-api/subscribe-default-permissions-expected.txt:
* http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt:
* http/tests/push-api/subscribe-deny-permissions-on-prompt-expected.txt:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-deny-permissions-on-prompt-expected.txt
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/push-api/PushManager.cpp
trunk/Source/WebCore/workers/service/server/SWServer.cpp
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
trunk/Source/WebKit/webpushd/PushService.mm
trunk/Source/WebKit/webpushd/WebPushDaemon.mm




Diff

Modified: trunk/LayoutTests/ChangeLog (292231 => 292232)

--- trunk/LayoutTests/ChangeLog	2022-04-01 19:53:44 UTC (rev 292231)
+++ trunk/LayoutTests/ChangeLog	2022-04-01 20:47:45 UTC (rev 292232)
@@ -1,3 +1,16 @@
+2022-04-01  Ben Nham  
+
+Add more push-related logging
+https://bugs.webkit.org/show_bug.cgi?id=238591
+
+Reviewed by Youenn Fablet.
+
+Modify test cases to check for user gesture error console message.
+
+* http/tests/push-api/subscribe-default-permissions-expected.txt:
+* http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt:
+* http/tests/push-api/subscribe-deny-permissions-on-prompt-expected.txt:
+
 2022-04-01  Matteo Flores  
 
 REGRESSION(r292072): [ wk1 ] fast/text/install-font-style-recalc.html is a constant text failure


Modified: trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-expected.txt (292231 => 292232)

--- trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-expected.txt	2022-04-01 19:53:44 UTC (rev 292231)
+++ trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-expected.txt	2022-04-01 20:47:45 UTC (rev 292232)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Push notification prompting can only be done from a user gesture.
 PASS: service worker permissionState was prompt
 PASS: document permissionState was prompt
 PASS: service worker subscribe was error: NotAllowedError


Modified: trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt (292231 => 292232)

--- trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt	2022-04-01 19:53:44

[webkit-changes] [292158] trunk

2022-03-31 Thread nham
Title: [292158] trunk








Revision 292158
Author n...@apple.com
Date 2022-03-31 08:08:16 -0700 (Thu, 31 Mar 2022)


Log Message
Remove push subscriptions when permissions are reset
https://bugs.webkit.org/show_bug.cgi?id=238068

Reviewed by Youenn Fablet.

Source/WebKit:

When the notification permission for an origin is reset (i.e. is in the prompt state), we
should delete any push subscriptions associated with that origin. We do this by having the
providerDidRemoveNotificationPolicies API call deletePushAndNotificationRegistration in
webpushd.

We also do this when processing a push message, since it's possible for the state to get out
of sync due to the number of processes involved. For instance, removing the policy from
System Preferences rather than the browser's notification preference pane can result in the
providerDidRemoveNotificationPolicies call in the browser to be delayed or dropped.

Note that we don't delete the subscription if the permission is simply toggled off (i.e. the
permission is in the Denied state). In that case, the user can easily toggle the permission
back on. We want the subscription object to stay the same after the preference is toggled
back on so that the server can still send pushes to that push endpoint. In a future patch
we'll add subscriptions in this state to the ignored topics list in webpushd, which will
prevent pushes for those subscriptions from being delivered to the device without actually
unsubscribing.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::processPushMessage):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::processPushMessage):
* UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::removePushSubscriptionsForOrigins):
(WebKit::WebNotificationManagerProxy::providerDidRemoveNotificationPolicies):
* webpushd/WebPushDaemon.mm:
(WebPushD::Daemon::deletePushAndNotificationRegistration):

Tools:

Add a test to make sure push subscriptions are removed when the notification policy for a
website is reset.

Also fixed an issue with a PushAPI test that didn't properly register for notification permissions.

* TestWebKitAPI/TestNotificationProvider.cpp:
(TestWebKitAPI::TestNotificationProvider::TestNotificationProvider):
(TestWebKitAPI::TestNotificationProvider::notificationPermissions const):
(TestWebKitAPI::TestNotificationProvider::setPermission):
(TestWebKitAPI::TestNotificationProvider::resetPermission):
* TestWebKitAPI/TestNotificationProvider.h:
* TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm:
* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

LayoutTests:

Fix an issue with a layout test that didn't register for notification permissions.

* http/wpt/service-workers/service-worker-spinning-push.https.html:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-push.https.html
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/TestNotificationProvider.cpp
trunk/Tools/TestWebKitAPI/TestNotificationProvider.h
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm




Diff

Modified: trunk/LayoutTests/ChangeLog (292157 => 292158)

--- trunk/LayoutTests/ChangeLog	2022-03-31 13:56:29 UTC (rev 292157)
+++ trunk/LayoutTests/ChangeLog	2022-03-31 15:08:16 UTC (rev 292158)
@@ -1,3 +1,14 @@
+2022-03-31  Ben Nham  
+
+Remove push subscriptions when permissions are reset
+https://bugs.webkit.org/show_bug.cgi?id=238068
+
+Reviewed by Youenn Fablet.
+
+Fix an issue with a layout test that didn't register for notification permissions.
+
+* http/wpt/service-workers/service-worker-spinning-push.https.html:
+
 2022-03-31  Alan Bujtas  
 
 [CSS contain] Containment disables the special handling of the HTML body element for overflow viewport propagation [part2]


Modified: trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-push.https.html (292157 => 292158)

--- trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-push.https.html	2022-03-31 13:56:29 UTC (rev 292157)
+++ trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-push.https.html	2022-03-31 15:08:16 UTC (rev 292158)
@@ -7,6 +7,9 @@
 
 
 
</span><ins>+if (window.testRunner)
+testRunner.grantWebNotificationPermission(window.origin);
+
</ins><span class="cx"> promise_test(async (test) => {
</span><span class="cx"> const registration 

[webkit-changes] [292152] trunk/Source/WebKit

2022-03-31 Thread nham
Title: [292152] trunk/Source/WebKit








Revision 292152
Author n...@apple.com
Date 2022-03-31 04:17:14 -0700 (Thu, 31 Mar 2022)


Log Message
Fix null string crashes in PushService
https://bugs.webkit.org/show_bug.cgi?id=238585

Reviewed by Darin Adler.

We've seen a few webpushd crashes due to some PushService routines being passed null string
arguments. Guard against this with isEmpty checks.

This also shouldn't be possible--we shouldn't be sending these requests to webpushd in the
first place. Add some logs to help us catch what's going on.

* webpushd/PushService.mm:
(WebPushD::PushService::getSubscription):
(WebPushD::PushService::subscribe):
(WebPushD::PushService::unsubscribe):
(WebPushD::PushService::incrementSilentPushCount):
(WebPushD::PushService::removeRecordsImpl):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/webpushd/PushService.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (292151 => 292152)

--- trunk/Source/WebKit/ChangeLog	2022-03-31 10:36:53 UTC (rev 292151)
+++ trunk/Source/WebKit/ChangeLog	2022-03-31 11:17:14 UTC (rev 292152)
@@ -1,3 +1,23 @@
+2022-03-31  Ben Nham  
+
+Fix null string crashes in PushService
+https://bugs.webkit.org/show_bug.cgi?id=238585
+
+Reviewed by Darin Adler.
+
+We've seen a few webpushd crashes due to some PushService routines being passed null string
+arguments. Guard against this with isEmpty checks.
+
+This also shouldn't be possible--we shouldn't be sending these requests to webpushd in the
+first place. Add some logs to help us catch what's going on.
+
+* webpushd/PushService.mm:
+(WebPushD::PushService::getSubscription):
+(WebPushD::PushService::subscribe):
+(WebPushD::PushService::unsubscribe):
+(WebPushD::PushService::incrementSilentPushCount):
+(WebPushD::PushService::removeRecordsImpl):
+
 2022-03-31  Diego Pino Garcia  
 
 [WPE] Unreviewed, fix non-unified build after r290343


Modified: trunk/Source/WebKit/webpushd/PushService.mm (292151 => 292152)

--- trunk/Source/WebKit/webpushd/PushService.mm	2022-03-31 10:36:53 UTC (rev 292151)
+++ trunk/Source/WebKit/webpushd/PushService.mm	2022-03-31 11:17:14 UTC (rev 292152)
@@ -438,6 +438,12 @@
 
 void PushService::getSubscription(const String& bundleIdentifier, const String& scope, CompletionHandler, WebCore::ExceptionData>&)>&& completionHandler)
 {
+if (bundleIdentifier.isEmpty() || scope.isEmpty()) {
+RELEASE_LOG_ERROR(Push, "Ignoring getSubscription request with bundleIdentifier (empty = %d) and scope (empty = %d)", bundleIdentifier.isEmpty(), scope.isEmpty());
+completionHandler(makeUnexpected(WebCore::ExceptionData { WebCore::AbortError, "Invalid sender"_s }));
+return;
+}
+
 enqueuePushServiceRequest(m_getSubscriptionRequests, makeUnique(*this, bundleIdentifier, scope, WTFMove(completionHandler)));
 }
 
@@ -448,6 +454,12 @@
 
 void PushService::subscribe(const String& bundleIdentifier, const String& scope, const Vector& vapidPublicKey, CompletionHandler&)>&& completionHandler)
 {
+if (bundleIdentifier.isEmpty() || scope.isEmpty()) {
+RELEASE_LOG_ERROR(Push, "Ignoring subscribe request with bundleIdentifier (empty = %d) and scope (empty = %d)", bundleIdentifier.isEmpty(), scope.isEmpty());
+completionHandler(makeUnexpected(WebCore::ExceptionData { WebCore::AbortError, "Invalid sender"_s }));
+return;
+}
+
 enqueuePushServiceRequest(m_subscribeRequests, makeUnique(*this, bundleIdentifier, scope, vapidPublicKey, WTFMove(completionHandler)));
 }
 
@@ -458,6 +470,12 @@
 
 void PushService::unsubscribe(const String& bundleIdentifier, const String& scope, std::optional subscriptionIdentifier, CompletionHandler&)>&& completionHandler)
 {
+if (bundleIdentifier.isEmpty() || scope.isEmpty()) {
+RELEASE_LOG_ERROR(Push, "Ignoring unsubscribe request with bundleIdentifier (empty = %d) and scope (empty = %d)", bundleIdentifier.isEmpty(), scope.isEmpty());
+completionHandler(makeUnexpected(WebCore::ExceptionData { WebCore::AbortError, "Invalid sender"_s }));
+return;
+}
+
 enqueuePushServiceRequest(m_unsubscribeRequests, makeUnique(*this, bundleIdentifier, scope, subscriptionIdentifier, WTFMove(completionHandler)));
 }
 
@@ -468,6 +486,12 @@
 
 void PushService::incrementSilentPushCount(const String& bundleIdentifier, const String& securityOrigin, CompletionHandler&& handler)
 {
+if (bundleIdentifier.isEmpty() || securityOrigin.isEmpty()) {
+RELEASE_LOG_ERROR(Push, "Ignoring removeRecordsImpl request with bundleIdentifier (empty = %d) and securityOrigin (empty = %d)", bundleIdentifier.isEmpty(), securityOrigin.isEmpty());
+handler(0);
+return;
+}
+
 m_dat

[webkit-changes] [291802] trunk

2022-03-24 Thread nham
Title: [291802] trunk








Revision 291802
Author n...@apple.com
Date 2022-03-24 10:20:31 -0700 (Thu, 24 Mar 2022)


Log Message
PushAPI.firePushEventWithNoPagesTimeout fails in debug builds
https://bugs.webkit.org/show_bug.cgi?id=238309

Reviewed by Youenn Fablet.

Source/WebCore:

Export RegistrationDatabase::schemaVersion for tests to use.

* workers/service/server/RegistrationDatabase.cpp:
(WebCore::databaseFilename):
(WebCore::cleanOldDatabases):
* workers/service/server/RegistrationDatabase.h:

Tools:

This test was dying on an assertion in debug builds because we were calling
terminateNetworkProcessWhileRegistrationIsStored with a brand new WKWebsiteDataStore, which
wasn't associated with an active NetworkProcess connection since it was a brand new object.
Fix this by using the existing data store object instead.

Additionally, terminateNetworkProcessWhileRegistrationIsStored was waiting on the wrong
filename, so I changed the test to reference the correct filename.

* TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp
trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm




Diff

Modified: trunk/Source/WebCore/ChangeLog (291801 => 291802)

--- trunk/Source/WebCore/ChangeLog	2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Source/WebCore/ChangeLog	2022-03-24 17:20:31 UTC (rev 291802)
@@ -1,3 +1,17 @@
+2022-03-24  Ben Nham  
+
+PushAPI.firePushEventWithNoPagesTimeout fails in debug builds
+https://bugs.webkit.org/show_bug.cgi?id=238309
+
+Reviewed by Youenn Fablet.
+
+Export RegistrationDatabase::schemaVersion for tests to use.
+
+* workers/service/server/RegistrationDatabase.cpp:
+(WebCore::databaseFilename):
+(WebCore::cleanOldDatabases):
+* workers/service/server/RegistrationDatabase.h:
+
 2022-03-24  Chris Dumez  
 
 String's find() / reverseFind() / replace() should take in a StringView instead of a String


Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp (291801 => 291802)

--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2022-03-24 17:20:31 UTC (rev 291802)
@@ -50,8 +50,6 @@
 
 namespace WebCore {
 
-static const uint64_t schemaVersion = 8;
-
 #define RECORDS_TABLE_SCHEMA_PREFIX "CREATE TABLE "
 #define RECORDS_TABLE_SCHEMA_SUFFIX "(" \
 "key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE" \
@@ -88,7 +86,7 @@
 static const String& databaseFilename()
 {
 ASSERT(isMainThread());
-static NeverDestroyed filename = databaseFilenameFromVersion(schemaVersion);
+static NeverDestroyed filename = databaseFilenameFromVersion(RegistrationDatabase::schemaVersion);
 return filename;
 }
 
@@ -99,7 +97,7 @@
 
 static inline void cleanOldDatabases(const String& databaseDirectory)
 {
-for (uint64_t version = 1; version < schemaVersion; ++version)
+for (uint64_t version = 1; version < RegistrationDatabase::schemaVersion; ++version)
 SQLiteFileSystem::deleteDatabaseFile(FileSystem::pathByAppendingComponent(databaseDirectory, databaseFilenameFromVersion(version)));
 }
 


Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h (291801 => 291802)

--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h	2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h	2022-03-24 17:20:31 UTC (rev 291802)
@@ -46,6 +46,8 @@
 class RegistrationDatabase : public ThreadSafeRefCounted {
 WTF_MAKE_FAST_ALLOCATED;
 public:
+static constexpr uint64_t schemaVersion = 8;
+
 static Ref create(RegistrationStore& store, String&& databaseDirectory)
 {
 return adoptRef(*new RegistrationDatabase(store, WTFMove(databaseDirectory)));


Modified: trunk/Tools/ChangeLog (291801 => 291802)

--- trunk/Tools/ChangeLog	2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Tools/ChangeLog	2022-03-24 17:20:31 UTC (rev 291802)
@@ -1,3 +1,20 @@
+2022-03-24  Ben Nham  
+
+PushAPI.firePushEventWithNoPagesTimeout fails in debug builds
+https://bugs.webkit.org/show_bug.cgi?id=238309
+
+Reviewed by Youenn Fablet.
+
+This test was dying on an assertion in debug builds because we were calling
+terminateNetworkProcessWhileRegistrationIsStored with a brand new WKWebsiteDataStore, which
+wasn't associated with an active NetworkProcess connection since it was a brand new object.
+Fix this by using the existing data store object instead.
+
+Additionally, terminateNetworkProcessWhileRegistrationIsStored was waiting on the wrong
+filename, so I changed th

[webkit-changes] [291737] trunk

2022-03-23 Thread nham
Title: [291737] trunk








Revision 291737
Author n...@apple.com
Date 2022-03-22 23:47:41 -0700 (Tue, 22 Mar 2022)


Log Message
Only show notification permission prompt on transient activation
https://bugs.webkit.org/show_bug.cgi?id=238188

Reviewed by Youenn Fablet.

Source/WebCore:

In r291427, we changed Notification.requestPermission and PushManager.subscribe to only show
a permission prompt when processing a user gesture. This ended up being too restrictive and
causes compatibility problems with some large sites.

Instead, match Chrome and Firefox by allowing these prompts after a transient activiation,
i.e. a user gesture within the past second.

Per Maciej's suggestion, we also consume the activation to help combat prompt spam.

Covered by new and existing layout tests.

* Modules/notifications/Notification.cpp:
(WebCore::Notification::requestPermission):
* Modules/push-api/PushManager.cpp:
(WebCore::PushManager::subscribe):

Tools:

Add an internal API denyWebNotificationPermissionOnPrompt to WebKitTestRunner that allows a
notification permission prompt to first be displayed and then rejected. This differs from
the existing denyNotificationPermission call, which denied notification permissions before
prompting.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::denyWebNotificationPermission):
(WTR::TestRunner::denyWebNotificationPermissionOnPrompt):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::originUserVisibleName):
(WTR::TestController::denyNotificationPermissionOnPrompt):
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::decidePolicyForNotificationPermissionRequest):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

Add test cases to make sure that showing a permission prompt consumes a user gesture.

* http/tests/notifications/notification-request-permission-no-callback.html:
* http/tests/notifications/notification-request-permission.html:
* http/tests/notifications/request-consumes-activation-expected.txt: Added.
* http/tests/notifications/request-consumes-activation.html: Added.
* http/tests/push-api/resources/subscribe-tests.js:
(async testDocumentSubscribeWithUserGesture):
(async testDocumentSubscribeWithoutUserGesture):
(async testDocumentSubscribeImpl):
* http/tests/push-api/subscribe-deny-permissions-expected.txt:
* http/tests/push-api/subscribe-deny-permissions-on-prompt-expected.txt:
* http/tests/push-api/subscribe-deny-permissions-on-prompt.html: Added.
* http/tests/push-api/subscribe-deny-permissions.html:
* platform/gtk/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/http/tests/notifications/notification-request-permission-no-callback.html
trunk/LayoutTests/http/tests/notifications/notification-request-permission.html
trunk/LayoutTests/http/tests/push-api/resources/subscribe-tests.js
trunk/LayoutTests/http/tests/push-api/subscribe-deny-permissions-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-deny-permissions.html
trunk/LayoutTests/platform/gtk/TestExpectations
trunk/LayoutTests/platform/mac-wk1/TestExpectations
trunk/LayoutTests/platform/win/TestExpectations
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/notifications/Notification.cpp
trunk/Source/WebCore/Modules/push-api/PushManager.cpp
trunk/Tools/ChangeLog
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
trunk/Tools/WebKitTestRunner/TestController.cpp
trunk/Tools/WebKitTestRunner/TestController.h
trunk/Tools/WebKitTestRunner/TestInvocation.cpp


Added Paths

trunk/LayoutTests/http/tests/notifications/request-consumes-activation-expected.txt
trunk/LayoutTests/http/tests/notifications/request-consumes-activation.html
trunk/LayoutTests/http/tests/push-api/subscribe-deny-permissions-on-prompt-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-deny-permissions-on-prompt.html




Diff

Modified: trunk/LayoutTests/ChangeLog (291736 => 291737)

--- trunk/LayoutTests/ChangeLog	2022-03-23 06:45:52 UTC (rev 291736)
+++ trunk/LayoutTests/ChangeLog	2022-03-23 06:47:41 UTC (rev 291737)
@@ -1,3 +1,28 @@
+2022-03-22  Ben Nham  
+
+Only show notification permission prompt on transient activation
+https://bugs.webkit.org/show_bug.cgi?id=238188
+
+Reviewed by Youenn Fablet.
+
+Add test cases to make sure that showing a permission prompt consumes a user gesture.
+
+* http/tests/notifications/notification-request-permission-no-callback.html:
+* http/tests/notifications/notification-request-permission.html:
+* http/tests/notifications/request-consumes-activat

[webkit-changes] [291492] trunk

2022-03-18 Thread nham
Title: [291492] trunk








Revision 291492
Author n...@apple.com
Date 2022-03-18 12:19:35 -0700 (Fri, 18 Mar 2022)


Log Message
Remove push subscriptions when associated service worker registrations are removed
https://bugs.webkit.org/show_bug.cgi?id=237983

Reviewed by Youenn Fablet.

Source/WebKit:

When a ServiceWorkerRegistration is removed, we also need to remove its associated
PushSubscription. This can occur when:

  1. The application calls ServiceWorkerRegistration.unregister. This is implemented by
 having resolveUnregistrationJobInClient call unsubscribeFromPushService in webpushd.
 The identifier passed to unsubscribeFromPushService is now optional; if the identifier
 is not present, then we delete whatever PushSubscription is associated with the given
 scope URL.

  2. The user clears website data for a particular origin. This is implemented by having
 deleteWebsiteDataForOrigins invoke removePushSubscriptionsForOrigin in webpushd.

  3. The user clears all website data. This is implemented by having deleteWebsiteData
 invoke removeAllPushSubscriptions in webpushd.

Covered by new API tests.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
(WebKit::NetworkProcess::hasPushSubscriptionForTesting):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::unsubscribeFromPushService):
(WebKit::NetworkNotificationManager::removeAllPushSubscriptions):
(WebKit::NetworkNotificationManager::removePushSubscriptionsForOrigin):
* NetworkProcess/Notifications/NetworkNotificationManager.h:
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
* Shared/WebPushDaemonConstants.h:
(WebKit::WebPushD::messageTypeSendsReply):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _scopeURL:hasPushSubscriptionForTesting:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::hasPushSubscriptionForTesting):
* UIProcess/Network/NetworkProcessProxy.h:
* webpushd/PushService.h:
* webpushd/PushService.mm:
(WebPushD::UnsubscribeRequest::UnsubscribeRequest):
(WebPushD::UnsubscribeRequest::startInternal):
(WebPushD::PushService::unsubscribe):
(WebPushD::PushService::incrementSilentPushCount):
(WebPushD::PushService::removeRecordsForBundleIdentifier):
(WebPushD::PushService::removeRecordsForBundleIdentifierAndOrigin):
(WebPushD::PushService::removeRecordsImpl):
* webpushd/WebPushDaemon.h:
* webpushd/WebPushDaemon.mm:
(WebPushD::MessageInfo::removeAllPushSubscriptions::encodeReply):
(WebPushD::MessageInfo::removePushSubscriptionsForOrigin::encodeReply):
(WebPushD::Daemon::decodeAndHandleMessage):
(WebPushD::Daemon::unsubscribeFromPushService):
(WebPushD::Daemon::removeAllPushSubscriptions):
(WebPushD::Daemon::removePushSubscriptionsForOrigin):

Tools:

Add new tests to make sure that we delete push subscriptions when unregistering a service
worker or deleting website data.

* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
trunk/Source/WebKit/Shared/WebPushDaemonConstants.h
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
trunk/Source/WebKit/webpushd/PushService.h
trunk/Source/WebKit/webpushd/PushService.mm
trunk/Source/WebKit/webpushd/WebPushDaemon.h
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (291491 => 291492)

--- trunk/Source/WebKit/ChangeLog	2022-03-18 19:11:11 UTC (rev 291491)
+++ trunk/Source/WebKit/ChangeLog	2022-03-18 19:19:35 UTC (rev 291492)
@@ -1,3 +1,67 @@
+2022-03-18  Ben Nham  
+
+Remove push subscriptions when associated service worker registrations are removed
+https://bugs.webkit.org/show_bug.cgi?id=237983
+
+Reviewed by Youenn Fablet.
+
+When a ServiceWorkerRegistration is removed, we also need to remove its associated
+PushSubscription. This can occur when:
+
+  1. The application ca

[webkit-changes] [291427] trunk/Tools

2022-03-17 Thread nham
Title: [291427] trunk/Tools








Revision 291427
Author n...@apple.com
Date 2022-03-17 12:04:53 -0700 (Thu, 17 Mar 2022)


Log Message
Only show notification permission prompt on user gesture
https://bugs.webkit.org/show_bug.cgi?id=237946

Unreviewed build fix for r291414.

* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

Modified Paths

trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm




Diff

Modified: trunk/Tools/ChangeLog (291426 => 291427)

--- trunk/Tools/ChangeLog	2022-03-17 19:02:47 UTC (rev 291426)
+++ trunk/Tools/ChangeLog	2022-03-17 19:04:53 UTC (rev 291427)
@@ -3,6 +3,15 @@
 Only show notification permission prompt on user gesture
 https://bugs.webkit.org/show_bug.cgi?id=237946
 
+Unreviewed build fix for r291414.
+
+* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
+
+2022-03-17  Ben Nham  
+
+Only show notification permission prompt on user gesture
+https://bugs.webkit.org/show_bug.cgi?id=237946
+
 Reviewed by Geoffrey Garen.
 
 Change existing permission tests to use evaluateJavaScript since that executes in the


Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (291426 => 291427)

--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-03-17 19:02:47 UTC (rev 291426)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-03-17 19:04:53 UTC (rev 291427)
@@ -742,6 +742,12 @@
 
 }
 
+static const char* mainBytes = R"WEBPUSHRESOURCE(
+
+Notification.requestPermission().then(() => { alert("done") })
+
+)WEBPUSHRESOURCE";
+
 TEST(WebPushD, InstallCoordinationBundles)
 {
 NSURL *tempDirectory = setUpTestWebPushD();






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [291414] trunk

2022-03-17 Thread nham
Title: [291414] trunk








Revision 291414
Author n...@apple.com
Date 2022-03-17 09:52:04 -0700 (Thu, 17 Mar 2022)


Log Message
Only show notification permission prompt on user gesture
https://bugs.webkit.org/show_bug.cgi?id=237946

Reviewed by Geoffrey Garen.

Source/WebCore:

We want to make Notification.requestPermission and PushManager.subscribe only prompt the
user for permission in response to a user gesture. This matches existing behavior in other
browsers.

We use the error string "Push notification prompting can only be done from a user gesture"
since that string was already used by safari.pushNotification.requestPermission.

* Modules/notifications/Notification.cpp:
(WebCore::Notification::requestPermission):
* Modules/push-api/PushManager.cpp:
(WebCore::PushManager::subscribe):

Tools:

Change existing permission tests to use evaluateJavaScript since that executes in the
context of a user gesture.

* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

LayoutTests:

Add test cases to make sure that prompting for notification permissions fails when not
handling a user gesture and succeeds when handling a user gesture.

* http/tests/notifications/notification-request-permission-no-callback.html:
* http/tests/notifications/notification-request-permission.html:
* http/tests/notifications/request-expected.txt:
* http/tests/notifications/request-with-promise-expected.txt:
* http/tests/notifications/request-with-promise.html:
* http/tests/notifications/request.html:
* http/tests/push-api/resources/subscribe-iframe-cross-origin.html:
* http/tests/push-api/resources/subscribe-iframe-same-origin.html:
* http/tests/push-api/resources/subscribe-tests.js:
(async testDocumentSubscribeWithUserGesture): Added.
(async testDocumentSubscribeWithoutUserGesture): Added.
(async testDocumentSubscribeImpl): Added.
(async testDocumentSubscribe): Deleted.
* http/tests/push-api/subscribe-default-permissions-expected.txt:
* http/tests/push-api/subscribe-default-permissions-iframe-cross-origin-expected.txt:
* http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt:
* http/tests/push-api/subscribe-default-permissions.html:
* http/tests/push-api/subscribe-deny-permissions-expected.txt:
* http/tests/push-api/subscribe-deny-permissions.html:
* http/tests/push-api/subscribe-grant-permissions-expected.txt:
* http/tests/push-api/subscribe-grant-permissions.html:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/http/tests/notifications/notification-request-permission-no-callback.html
trunk/LayoutTests/http/tests/notifications/notification-request-permission.html
trunk/LayoutTests/http/tests/notifications/request-expected.txt
trunk/LayoutTests/http/tests/notifications/request-with-promise-expected.txt
trunk/LayoutTests/http/tests/notifications/request-with-promise.html
trunk/LayoutTests/http/tests/notifications/request.html
trunk/LayoutTests/http/tests/push-api/resources/subscribe-iframe-cross-origin.html
trunk/LayoutTests/http/tests/push-api/resources/subscribe-iframe-same-origin.html
trunk/LayoutTests/http/tests/push-api/resources/subscribe-tests.js
trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-iframe-cross-origin-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-default-permissions.html
trunk/LayoutTests/http/tests/push-api/subscribe-deny-permissions-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-deny-permissions.html
trunk/LayoutTests/http/tests/push-api/subscribe-grant-permissions-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-grant-permissions.html
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/notifications/Notification.cpp
trunk/Source/WebCore/Modules/push-api/PushManager.cpp
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm




Diff

Modified: trunk/LayoutTests/ChangeLog (291413 => 291414)

--- trunk/LayoutTests/ChangeLog	2022-03-17 16:45:37 UTC (rev 291413)
+++ trunk/LayoutTests/ChangeLog	2022-03-17 16:52:04 UTC (rev 291414)
@@ -1,3 +1,35 @@
+2022-03-17  Ben Nham  
+
+Only show notification permission prompt on user gesture
+https://bugs.webkit.org/show_bug.cgi?id=237946
+
+Reviewed by Geoffrey Garen.
+
+Add test cases to make sure that prompting for notification permissions fails when not
+handling a user gesture and succeeds when handling a user gesture.
+
+* http/tests/notifications/notification-request-permission-no-callback.html:
+* http/tests/notifications/notification-request-permission.html:
+* http/tests/notifications/request-expected.txt:
+* http/tests/notifications/request-with-promise

[webkit-changes] [291413] trunk

2022-03-17 Thread nham
Title: [291413] trunk








Revision 291413
Author n...@apple.com
Date 2022-03-17 09:45:37 -0700 (Thu, 17 Mar 2022)


Log Message
Allow push preference to be set programatically
https://bugs.webkit.org/show_bug.cgi?id=238003

Reviewed by Geoffrey Garen.

Source/WebKit:

This exposes the PushAPIEnabled experimental preference through WKPreferences so it can be
enabled programatically by API clients.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _pushAPIEnabled]):
(-[WKPreferences _setPushAPIEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

Make webpushd tests enable the push API via WKPreferences.

* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (291412 => 291413)

--- trunk/Source/WebKit/ChangeLog	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Source/WebKit/ChangeLog	2022-03-17 16:45:37 UTC (rev 291413)
@@ -1,3 +1,18 @@
+2022-03-17  Ben Nham  
+
+Allow push preference to be set programatically
+https://bugs.webkit.org/show_bug.cgi?id=238003
+
+Reviewed by Geoffrey Garen.
+
+This exposes the PushAPIEnabled experimental preference through WKPreferences so it can be
+enabled programatically by API clients.
+
+* UIProcess/API/Cocoa/WKPreferences.mm:
+(-[WKPreferences _pushAPIEnabled]):
+(-[WKPreferences _setPushAPIEnabled:]):
+* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
 2022-03-17  Kate Cheney  
 
 Calls to print can result in unresponsive print modal


Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm (291412 => 291413)

--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm	2022-03-17 16:45:37 UTC (rev 291413)
@@ -1570,6 +1570,16 @@
 return _preferences->notificationsEnabled();
 }
 
+- (BOOL)_pushAPIEnabled
+{
+return _preferences->pushAPIEnabled();
+}
+
+- (void)_setPushAPIEnabled:(BOOL)pushAPIEnabled
+{
+_preferences->setPushAPIEnabled(pushAPIEnabled);
+}
+
 - (void)_setModelDocumentEnabled:(BOOL)enabled
 {
 _preferences->setModelDocumentEnabled(enabled);


Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h (291412 => 291413)

--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2022-03-17 16:45:37 UTC (rev 291413)
@@ -178,6 +178,7 @@
 @property (nonatomic, setter=_setStorageAPIEnabled:) BOOL _storageAPIEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setAccessHandleEnabled:) BOOL _accessHandleEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setNotificationsEnabled:) BOOL _notificationsEnabled WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setPushAPIEnabled:) BOOL _pushAPIEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setModelDocumentEnabled:) BOOL _modelDocumentEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 #if !TARGET_OS_IPHONE


Modified: trunk/Tools/ChangeLog (291412 => 291413)

--- trunk/Tools/ChangeLog	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Tools/ChangeLog	2022-03-17 16:45:37 UTC (rev 291413)
@@ -1,3 +1,14 @@
+2022-03-17  Ben Nham  
+
+Allow push preference to be set programatically
+https://bugs.webkit.org/show_bug.cgi?id=238003
+
+Reviewed by Geoffrey Garen.
+
+Make webpushd tests enable the push API via WKPreferences.
+
+* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
+
 2022-03-17  Kate Cheney  
 
 Calls to print can result in unresponsive print modal


Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (291412 => 291413)

--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-03-17 16:45:37 UTC (rev 291413)
@@ -416,11 +416,10 @@
 clearWebsiteDataStore([m_configuration websiteDataStore]);
 
 [m_configuration.get().preferences _setNotificationsEnabled:YES];
+[m_configuration.get().preferences _setPushAPIEnabled:YES];
 for (_WKExperimentalFeature *feature in [WKPreferences _experimentalFeatures]) {
 if ([feature.key isEqualToString:@"BuiltInNotificationsEnabled"])
 [[m_configuration preferences] _setEnabled:YES forFeature:feature];
-else if ([feature.key isEqualToString:@"PushAPIEnabled"])
-   

[webkit-changes] [291175] trunk/Source/WebCore

2022-03-11 Thread nham
Title: [291175] trunk/Source/WebCore








Revision 291175
Author n...@apple.com
Date 2022-03-11 09:39:43 -0800 (Fri, 11 Mar 2022)


Log Message
Fix WebContent jetsam that occurs when selecting text in a large e-mail
https://bugs.webkit.org/show_bug.cgi?id=237698

Reviewed by Simon Fraser.

When selecting text in a large e-mail in MobileMail, we often jetsam. This is due to this
chain of events:

 1. If the selection extends enough to start causing the content to pan (which is easy
to do when zoomed in on the mail content), then AutoscrollController ends up changing
the scroll position of the FrameView to perform the pan.
 2. FrameView::requestScrollPositionUpdate tries to prepopulate tiles around the endpoint
of the pan by calling TileController::prepopulateRect with visibleContentRect's size.

The problem is that MobileMail resizes their web view (and therefore FrameView) to match
the size of the content. This causes FrameView's visibleContentRect to be very large (>100k
pts high for some emails). As a result, we end up prepopulating every single tile in the
email, causing a huge spike in IOSurface memory usage that leads to a jetsam.

To fix this, we make FrameView::requestScrollPositionUpdate act more like
RenderLayerCompositor::visibleRectForLayerFlushing. In particular, on iOS, we now use
exposedContentRect instead of visibleContentRect. Since exposedContentRect is derived from
contentOffset/contentSize of the scroll view in the UIProcess, it's more correct and is much
smaller than visibleContentRect in this case.

* page/FrameView.cpp:
(WebCore::FrameView::requestScrollPositionUpdate):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/page/FrameView.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (291174 => 291175)

--- trunk/Source/WebCore/ChangeLog	2022-03-11 17:38:17 UTC (rev 291174)
+++ trunk/Source/WebCore/ChangeLog	2022-03-11 17:39:43 UTC (rev 291175)
@@ -1,3 +1,33 @@
+2022-03-11  Ben Nham  
+
+Fix WebContent jetsam that occurs when selecting text in a large e-mail
+https://bugs.webkit.org/show_bug.cgi?id=237698
+
+Reviewed by Simon Fraser.
+
+When selecting text in a large e-mail in MobileMail, we often jetsam. This is due to this
+chain of events:
+
+ 1. If the selection extends enough to start causing the content to pan (which is easy
+to do when zoomed in on the mail content), then AutoscrollController ends up changing
+the scroll position of the FrameView to perform the pan.
+ 2. FrameView::requestScrollPositionUpdate tries to prepopulate tiles around the endpoint
+of the pan by calling TileController::prepopulateRect with visibleContentRect's size.
+
+The problem is that MobileMail resizes their web view (and therefore FrameView) to match
+the size of the content. This causes FrameView's visibleContentRect to be very large (>100k
+pts high for some emails). As a result, we end up prepopulating every single tile in the
+email, causing a huge spike in IOSurface memory usage that leads to a jetsam.
+
+To fix this, we make FrameView::requestScrollPositionUpdate act more like
+RenderLayerCompositor::visibleRectForLayerFlushing. In particular, on iOS, we now use
+exposedContentRect instead of visibleContentRect. Since exposedContentRect is derived from
+contentOffset/contentSize of the scroll view in the UIProcess, it's more correct and is much
+smaller than visibleContentRect in this case.
+
+* page/FrameView.cpp:
+(WebCore::FrameView::requestScrollPositionUpdate):
+
 2022-03-11  Brandon Stewart  
 
 Verify values before adding to hash map


Modified: trunk/Source/WebCore/page/FrameView.cpp (291174 => 291175)

--- trunk/Source/WebCore/page/FrameView.cpp	2022-03-11 17:38:17 UTC (rev 291174)
+++ trunk/Source/WebCore/page/FrameView.cpp	2022-03-11 17:39:43 UTC (rev 291175)
@@ -2722,9 +2722,15 @@
 LOG_WITH_STREAM(Scrolling, stream << "FrameView::requestScrollPositionUpdate " << position);
 
 #if ENABLE(ASYNC_SCROLLING)
-if (TiledBacking* tiledBacking = this->tiledBacking())
-tiledBacking->prepopulateRect(FloatRect(position, visibleContentRect().size()));
+if (TiledBacking* tiledBacking = this->tiledBacking()) {
+#if PLATFORM(IOS_FAMILY)
+auto contentSize = exposedContentRect().size();
+#else
+auto contentSize = visibleContentRect().size();
 #endif
+tiledBacking->prepopulateRect(FloatRect(position, contentSize));
+}
+#endif
 
 #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
 if (auto scrollingCoordinator = this->scrollingCoordinator())






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [290815] trunk

2022-03-03 Thread nham
/NetworkProcess/Notifications/NetworkNotificationManager.cpp
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h
trunk/Source/WebKit/Shared/WebPushDaemonConstants.h
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
trunk/Source/WebKit/webpushd/PushService.h
trunk/Source/WebKit/webpushd/PushService.mm
trunk/Source/WebKit/webpushd/WebPushDaemon.h
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Sources.txt
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
trunk/Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm
trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h
trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm


Added Paths

trunk/Tools/TestWebKitAPI/TestNotificationProvider.cpp
trunk/Tools/TestWebKitAPI/TestNotificationProvider.h




Diff

Modified: trunk/LayoutTests/ChangeLog (290814 => 290815)

--- trunk/LayoutTests/ChangeLog	2022-03-04 04:40:06 UTC (rev 290814)
+++ trunk/LayoutTests/ChangeLog	2022-03-04 05:28:22 UTC (rev 290815)
@@ -1,3 +1,17 @@
+2022-03-03  Ben Nham  
+
+Enforce silent push quota
+https://bugs.webkit.org/show_bug.cgi?id=236863
+
+Reviewed by Brady Eidson.
+
+Update PushEvent tests to check that notifications are displayed.
+
+* http/wpt/push-api/pushEvent.any.js:
+(promise_test.async const):
+(promise_test.async if):
+* http/wpt/push-api/pushEvent.any.serviceworker-expected.txt:
+
 2022-03-03  Simon Fraser  
 
 Element with position: sticky after sticking, starts to move incorrectly when scrolling


Modified: trunk/LayoutTests/http/wpt/push-api/pushEvent.any.js (290814 => 290815)

--- trunk/LayoutTests/http/wpt/push-api/pushEvent.any.js	2022-03-04 04:40:06 UTC (rev 290814)
+++ trunk/LayoutTests/http/wpt/push-api/pushEvent.any.js	2022-03-04 05:28:22 UTC (rev 290815)
@@ -60,12 +60,24 @@
 
 promise_test(async () => {
 const promise = self.internals.schedulePushEvent("test");
-const event = await new Promise(resolve => self._onpush_ = resolve);
+const event = await new Promise(resolve => self._onpush_ = (event) => {
+self.registration.showNotification("notification");
+resolve(event);
+});
 assert_equals(event.data.text(), "test");
 assert_true(await promise);
 }, "Simulating firing of a push event");
 
 promise_test(async () => {
+const promise = self.internals.schedulePushEvent("test");
+const event = await new Promise(resolve => self._onpush_ = (event) => {
+resolve(event);
+});
+assert_equals(event.data.text(), "test");
+assert_false(await promise);
+}, "Simulating firing of a push event without notification");
+
+promise_test(async () => {
 if (!self.internals)
 return;
 
@@ -77,6 +89,7 @@
 promise.then(() => isPushEventPromiseResolved = true);
 
 const event = await new Promise(resolve => self._onpush_ = (event) => {
+self.registration.showNotification("notification");
 event.waitUntil(waitUntilPromise);
 resolve(event);
 });
@@ -93,8 +106,33 @@
 if (!self.internals)
 return;
 
+let resolveWaitUntilPromise;
+const waitUntilPromise = new Promise(resolve => resolveWaitUntilPromise = resolve);
+
+let isPushEventPromiseResolved = false;
 const promise = internals.schedulePushEvent("test");
+promise.then(() => isPushEventPromiseResolved = true);
+
 const event = await new Promise(resolve => self._onpush_ = (event) => {
+event.waitUntil(waitUntilPromise);
+resolve(event);
+});
+assert_equals(event.data.text(), "test");
+
+await new Promise(resolve => self.setTimeout(resolve, 100));
+assert_false(isPushEventPromiseResolved);
+
+resolveWaitUntilPromise();
+assert_false(await promise);
+}, "Simulating firing of a push event - successful waitUntil without notification");
+
+promise_test(async () => {
+if (!self.internals)
+return;
+
+const promise = internals.schedulePushEvent("test");
+const event = await new Promise(resolve => self._onpush_ = (event) => {
+self.registration.showNotification("notification");
 event.waitUntil(Promise.resolve());
 event.waitUntil(Promise.reject('error'));
 resolve(event);


Modified: trunk/LayoutTests/http/wpt/push-api/pushEvent.any.serviceworker-expected.txt (290814 => 290815)

--- trunk/LayoutTests/http/wpt/push-api/pushEvent.any.serviceworker-expected.txt	2022-03-04 04:40:06 UTC (rev 290814)
+++ trunk/LayoutTests/http/wpt/push-api/pushEvent.any.serviceworker-expected.txt	2022-03-04 05:28:22 UTC (rev 290815)

[webkit-changes] [290814] trunk/Source/WebKit

2022-03-03 Thread nham
Title: [290814] trunk/Source/WebKit








Revision 290814
Author n...@apple.com
Date 2022-03-03 20:40:06 -0800 (Thu, 03 Mar 2022)


Log Message
Allow webpushd to launch browser in background
https://bugs.webkit.org/show_bug.cgi?id=237114

Reviewed by Brady Eidson.

Now that webpushd is sandboxed on Mac (r289566), the LaunchServices SPI call to launch
Safari is now failing, because LaunchServices goes down a different path when there is a
sandboxed caller. In particular, it fails to launch Safari because Safari doesn't register
for the webkit-app-launch scheme. Safari also doesn't want to list this scheme in its plist.

For now, to unblock our testing, we're giving ourselves an entitlement to restore the
pre-sandboxed behavior of being able to launch Safari even though it doesn't register for
the webkit-app-launch scheme. We are still in discussions with LaunchServices and Safari
about if there is a better and more restrictive way of granting ourselves this ability.

* Scripts/process-entitlements.sh:

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Scripts/process-entitlements.sh




Diff

Modified: trunk/Source/WebKit/ChangeLog (290813 => 290814)

--- trunk/Source/WebKit/ChangeLog	2022-03-04 04:08:26 UTC (rev 290813)
+++ trunk/Source/WebKit/ChangeLog	2022-03-04 04:40:06 UTC (rev 290814)
@@ -1,3 +1,22 @@
+2022-03-03  Ben Nham  
+
+Allow webpushd to launch browser in background
+https://bugs.webkit.org/show_bug.cgi?id=237114
+
+Reviewed by Brady Eidson.
+
+Now that webpushd is sandboxed on Mac (r289566), the LaunchServices SPI call to launch
+Safari is now failing, because LaunchServices goes down a different path when there is a
+sandboxed caller. In particular, it fails to launch Safari because Safari doesn't register
+for the webkit-app-launch scheme. Safari also doesn't want to list this scheme in its plist.
+
+For now, to unblock our testing, we're giving ourselves an entitlement to restore the
+pre-sandboxed behavior of being able to launch Safari even though it doesn't register for
+the webkit-app-launch scheme. We are still in discussions with LaunchServices and Safari
+about if there is a better and more restrictive way of granting ourselves this ability.
+
+* Scripts/process-entitlements.sh:
+
 2022-03-03  Devin Rousso  
 
 [GPU Process] dont load Apple Pay button/logo PDFs in the WebProcess


Modified: trunk/Source/WebKit/Scripts/process-entitlements.sh (290813 => 290814)

--- trunk/Source/WebKit/Scripts/process-entitlements.sh	2022-03-04 04:08:26 UTC (rev 290813)
+++ trunk/Source/WebKit/Scripts/process-entitlements.sh	2022-03-04 04:40:06 UTC (rev 290814)
@@ -222,9 +222,8 @@
 
 function mac_process_webpushd_entitlements()
 {
-# FIXME: Add a sandbox profile for webpushd.
-echo "webpushd sandbox has not been implemented yet"
 plistbuddy Add :com.apple.private.aps-connection-initiate bool YES
+plistbuddy Add :com.apple.private.launchservices.allowopenwithanyhandler bool YES
 }
 
 # 
@@ -513,6 +512,7 @@
 # FIXME: Add a sandbox profile for webpushd and add it to the seatbelt-profiles array.
 echo "webpushd sandbox has not been implemented yet"
 plistbuddy Add :aps-connection-initiate bool YES
+plistbuddy Add :com.apple.private.launchservices.allowopenwithanyhandler bool YES
 }
 
 function ios_family_process_network_entitlements()






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [290198] trunk

2022-02-18 Thread nham
/push-api/subscribe-grant-permissions-expected.txt
trunk/LayoutTests/http/tests/push-api/subscribe-grant-permissions.html




Diff

Modified: trunk/LayoutTests/ChangeLog (290197 => 290198)

--- trunk/LayoutTests/ChangeLog	2022-02-19 04:27:39 UTC (rev 290197)
+++ trunk/LayoutTests/ChangeLog	2022-02-19 05:26:41 UTC (rev 290198)
@@ -1,3 +1,43 @@
+2022-02-18  Ben Nham  
+
+Hook up PushManager to permission state
+https://bugs.webkit.org/show_bug.cgi?id=236739
+
+Reviewed by Brady Eidson.
+
+Added tests that make sure that PushManager.permissionState() and PushManager.subscribe()
+respect the notification permission level for the current origin.
+
+I made these regular tests rather than WPT tests because the WPT test harness calls
+grantWebNotificationPermission at the top of its setup script (in testharnessreport.js), and
+I didn't want to change that for this patch.
+
+* http/tests/push-api/resources/push-api-test-pre.js: Added.
+(finishPushAPITest):
+(waitForState):
+* http/tests/push-api/resources/subscribe-iframe-cross-origin.html: Added.
+* http/tests/push-api/resources/subscribe-iframe-same-origin.html: Added.
+* http/tests/push-api/resources/subscribe-tests.js: Added.
+(async testServiceWorkerPermissionState):
+(async testDocumentPermissionState):
+(async testServiceWorkerSubscribe):
+(async testDocumentSubscribe):
+* http/tests/push-api/resources/subscribe-worker.js: Added.
+(async event):
+* http/tests/push-api/subscribe-default-permissions-expected.txt: Added.
+* http/tests/push-api/subscribe-default-permissions-iframe-cross-origin-expected.txt: Added.
+* http/tests/push-api/subscribe-default-permissions-iframe-cross-origin.html: Added.
+* http/tests/push-api/subscribe-default-permissions-iframe-same-origin-expected.txt: Added.
+* http/tests/push-api/subscribe-default-permissions-iframe-same-origin.html: Added.
+* http/tests/push-api/subscribe-default-permissions.html: Added.
+* http/tests/push-api/subscribe-deny-permissions-expected.txt: Added.
+* http/tests/push-api/subscribe-deny-permissions.html: Added.
+* http/tests/push-api/subscribe-grant-permissions-expected.txt: Added.
+* http/tests/push-api/subscribe-grant-permissions.html: Added.
+* platform/gtk/TestExpectations:
+* platform/mac-wk1/TestExpectations:
+* platform/win/TestExpectations:
+
 2022-02-18  Ryan Haddad  
 
 http/wpt/push-api/onpush-disabled.html fails (incremental build issue?)


Added: trunk/LayoutTests/http/tests/push-api/resources/push-api-test-pre.js (0 => 290198)

--- trunk/LayoutTests/http/tests/push-api/resources/push-api-test-pre.js	(rev 0)
+++ trunk/LayoutTests/http/tests/push-api/resources/push-api-test-pre.js	2022-02-19 05:26:41 UTC (rev 290198)
@@ -0,0 +1,49 @@
+if (window.testRunner) {
+testRunner.dumpAsText();
+testRunner.waitUntilDone();
+}
+
+function finishPushAPITest()
+{
+if (typeof window !== 'undefined' && window.parent !== window) {
+window.parent.postMessage('finishPushAPITest', '*');
+return;
+}
+
+if (window.testRunner)
+testRunner.notifyDone();
+}
+
+function waitForState(worker, state)
+{
+if (!worker || worker.state == undefined)
+return Promise.reject(new Error('wait_for_state must be passed a ServiceWorker'));
+
+if (worker.state === state)
+return Promise.resolve(state);
+
+return new Promise(function(resolve) {
+  worker.addEventListener('statechange', function() {
+  if (worker.state === state)
+resolve(state);
+});
+});
+}
+
+function log(msg)
+{
+if (typeof window !== 'undefined' && window.parent !== window) {
+window.parent.postMessage(msg, '*');
+return;
+}
+
+let console = document.getElementById("console");
+if (!console) {
+console = document.createElement("div");
+console.id = "console";
+document.body.appendChild(console);
+}
+let span = document.createElement("span");
+span.innerHTML = msg + "";
+console.appendChild(span);
+}


Added: trunk/LayoutTests/http/tests/push-api/resources/subscribe-iframe-cross-origin.html (0 => 290198)

--- trunk/LayoutTests/http/tests/push-api/resources/subscribe-iframe-cross-origin.html	(rev 0)
+++ trunk/LayoutTests/http/tests/push-api/resources/subscribe-iframe-cross-origin.html	2022-02-19 05:26:41 UTC (rev 290198)
@@ -0,0 +1,18 @@
+
+navigator.serviceWorker.register("subscribe-worker.js", { }).then(async (registration) => {
+try {
+await waitForState(registration.installing, "activated");
+await testServiceWorkerPermissionState(registrat

[webkit-changes] [289566] trunk/Source/WebKit

2022-02-10 Thread nham
Title: [289566] trunk/Source/WebKit








Revision 289566
Author n...@apple.com
Date 2022-02-10 12:13:19 -0800 (Thu, 10 Feb 2022)


Log Message
Apply default sandbox to webpushd on Mac
https://bugs.webkit.org/show_bug.cgi?id=236342

Reviewed by Per Arne Vollan.

This applies a default sandbox profile that allows and logs all operations by webpushd on
the Mac. In future patches we'll tighten the sandbox based on the sandbox logs that we
receive.

To do this, I refactored the sandbox initialization logic in AuxiliaryProcess so that it can
be called without creating an AuxiliaryProcess instance. This probably should be refactored
further (e.g. since webpushd isn't an AuxiliaryProcess, but rather a system daemon). But I
wanted to keep the amount of refactoring low for now while we're still figuring things out.

We also do not currently support compiling and caching the sandbox profiles. We'll add that
support later.

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* PlatformMac.cmake:
* Shared/AuxiliaryProcess.cpp:
(WebKit::applySandboxProfileForDaemon):
* Shared/AuxiliaryProcess.h:
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::getUserDirectorySuffix):
(WebKit::populateSandboxInitializationParameters):
(WebKit::AuxiliaryProcess::initializeSandbox):
(WebKit::AuxiliaryProcess::applySandboxProfileForDaemon):
* WebKit.xcodeproj/project.pbxproj:
* webpushd/WebPushDaemonMain.mm:
(WebKit::applySandbox):
(WebKit::WebPushDaemonMain):
* webpushd/mac/com.apple.WebKit.webpushd.sb.in: Added.

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Configurations/WebKit.xcconfig
trunk/Source/WebKit/DerivedSources-input.xcfilelist
trunk/Source/WebKit/DerivedSources-output.xcfilelist
trunk/Source/WebKit/DerivedSources.make
trunk/Source/WebKit/PlatformMac.cmake
trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp
trunk/Source/WebKit/Shared/AuxiliaryProcess.h
trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm


Added Paths

trunk/Source/WebKit/webpushd/mac/
trunk/Source/WebKit/webpushd/mac/com.apple.WebKit.webpushd.sb.in




Diff

Modified: trunk/Source/WebKit/ChangeLog (289565 => 289566)

--- trunk/Source/WebKit/ChangeLog	2022-02-10 19:56:40 UTC (rev 289565)
+++ trunk/Source/WebKit/ChangeLog	2022-02-10 20:13:19 UTC (rev 289566)
@@ -1,3 +1,40 @@
+2022-02-10  Ben Nham  
+
+Apply default sandbox to webpushd on Mac
+https://bugs.webkit.org/show_bug.cgi?id=236342
+
+Reviewed by Per Arne Vollan.
+
+This applies a default sandbox profile that allows and logs all operations by webpushd on
+the Mac. In future patches we'll tighten the sandbox based on the sandbox logs that we
+receive.
+
+To do this, I refactored the sandbox initialization logic in AuxiliaryProcess so that it can
+be called without creating an AuxiliaryProcess instance. This probably should be refactored
+further (e.g. since webpushd isn't an AuxiliaryProcess, but rather a system daemon). But I
+wanted to keep the amount of refactoring low for now while we're still figuring things out.
+
+We also do not currently support compiling and caching the sandbox profiles. We'll add that
+support later.
+
+* DerivedSources-input.xcfilelist:
+* DerivedSources-output.xcfilelist:
+* DerivedSources.make:
+* PlatformMac.cmake:
+* Shared/AuxiliaryProcess.cpp:
+(WebKit::applySandboxProfileForDaemon):
+* Shared/AuxiliaryProcess.h:
+* Shared/mac/AuxiliaryProcessMac.mm:
+(WebKit::getUserDirectorySuffix):
+(WebKit::populateSandboxInitializationParameters):
+(WebKit::AuxiliaryProcess::initializeSandbox):
+(WebKit::AuxiliaryProcess::applySandboxProfileForDaemon):
+* WebKit.xcodeproj/project.pbxproj:
+* webpushd/WebPushDaemonMain.mm:
+(WebKit::applySandbox):
+(WebKit::WebPushDaemonMain):
+* webpushd/mac/com.apple.WebKit.webpushd.sb.in: Added.
+
 2022-02-10  Wenson Hsieh  
 
 Support `WebPageProxy::replaceSelectionWithPasteboardData()` on iOS


Modified: trunk/Source/WebKit/Configurations/WebKit.xcconfig (289565 => 289566)

--- trunk/Source/WebKit/Configurations/WebKit.xcconfig	2022-02-10 19:56:40 UTC (rev 289565)
+++ trunk/Source/WebKit/Configurations/WebKit.xcconfig	2022-02-10 20:13:19 UTC (rev 289566)
@@ -179,7 +179,7 @@
 EXCLUDED_IOS_RESOURCE_FILE_NAMES = Resources/ios/*;
 EXCLUDED_IOS_RESOURCE_FILE_NAMES[sdk=iphone*] = ;
 
-EXCLUDED_MACOS_PLUGIN_FILE_NAMES[sdk=iphone*] = SecItemShim.dylib WebProcessShim.dylib *.pdf Resources/mac/* com.apple.WebKit.NetworkProcess.sb com.apple.WebKit.GPUProcess.sb com.apple.WebKit.WebAuthnProcess.sb com.apple.WebProcess.sb;
+EXCLUDED_MACOS_PLUGIN_FILE_NAMES[sdk=iphone*] = SecItemShim.dylib WebProcessShim.dylib *.pdf Resourc

[webkit-changes] [289353] trunk

2022-02-07 Thread nham
::sendMessageToDaemonWaitingForReply):
(TestWebKitAPI::sendConfigurationWithAuditToken):
(TestWebKitAPI::TEST):
(TestWebKitAPI::function): Deleted.

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Shared/API/Cocoa/WKMain.h
trunk/Source/WebKit/Shared/API/Cocoa/WKMain.mm
trunk/Source/WebKit/Shared/Cocoa/WebPushMessageCocoa.mm
trunk/Source/WebKit/Shared/WebPushDaemonConstants.h
trunk/Source/WebKit/Shared/WebPushMessage.h
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
trunk/Source/WebKit/webpushd/MockPushServiceConnection.h
trunk/Source/WebKit/webpushd/MockPushServiceConnection.mm
trunk/Source/WebKit/webpushd/PushServiceConnection.h
trunk/Source/WebKit/webpushd/PushServiceConnection.mm
trunk/Source/WebKit/webpushd/WebPushDaemon.h
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
trunk/Source/WebKit/webpushd/WebPushDaemonMain.h
trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm
trunk/Source/WebKit/webpushd/com.apple.webkit.webpushd.mac.plist
trunk/Source/WebKit/webpushd/webpushd.cpp
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm


Added Paths

trunk/Source/WebKit/webpushd/PushService.h
trunk/Source/WebKit/webpushd/PushService.mm




Diff

Modified: trunk/Source/WTF/ChangeLog (289352 => 289353)

--- trunk/Source/WTF/ChangeLog	2022-02-08 02:58:20 UTC (rev 289352)
+++ trunk/Source/WTF/ChangeLog	2022-02-08 02:58:30 UTC (rev 289353)
@@ -1,3 +1,14 @@
+2022-02-07  Ben Nham  
+
+Add PushService
+https://bugs.webkit.org/show_bug.cgi?id=235857
+
+Reviewed by Brady Eidson.
+
+Add PushAPIEnabled to WebKitLegacy so we can enable it on in API tests via _WKExperimentalFeature.
+
+* Scripts/Preferences/WebPreferencesExperimental.yaml:
+
 2022-02-07  Elliott Williams  
 
 Replace "Copy WTF Headers" with native build phases


Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (289352 => 289353)

--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-08 02:58:20 UTC (rev 289352)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-08 02:58:30 UTC (rev 289353)
@@ -1122,6 +1122,8 @@
   defaultValue:
 WebCore:
   default: false
+WebKitLegacy:
+  default: false
 WebKit:
   default: false
 


Modified: trunk/Source/WebKit/ChangeLog (289352 => 289353)

--- trunk/Source/WebKit/ChangeLog	2022-02-08 02:58:20 UTC (rev 289352)
+++ trunk/Source/WebKit/ChangeLog	2022-02-08 02:58:30 UTC (rev 289353)
@@ -1,3 +1,101 @@
+2022-02-07  Ben Nham  
+
+Add PushService
+https://bugs.webkit.org/show_bug.cgi?id=235857
+
+Reviewed by Brady Eidson.
+
+This adds PushService to webpushd. It handles requests to create, remove, and get push
+subscriptions. It also decrypts incoming pushes and pass them back to the UI process via the
+existing machinery in WebPushDaemon.
+
+PushService primarily interacts with two objects:
+
+1. PushServiceConnection: this creates and removes push subscriptions from the push server.
+   It also receives incoming pushes from the push server.
+2. PushDatabase: this persists push subscriptions to disk.
+
+Several things are not yet implemented; for instance, we currently always grant a page the
+permission to receive pushes. This will be fixed in future patches.
+
+Covered by new API tests. The current tests use a MockPushServiceConnection that vends
+subscription with fixed data, but this can be improved in the future.
+
+* Shared/API/Cocoa/WKMain.h:
+* Shared/API/Cocoa/WKMain.mm:
+(WKWebPushDaemonMain):
+* Shared/Cocoa/WebPushMessageCocoa.mm: add ability to distinguish between an empty vs. null payload.
+(WebKit::WebPushMessage::fromDictionary):
+(WebKit::WebPushMessage::toDictionary const):
+* Shared/WebPushDaemonConstants.h:
+(WebKit::WebPushD::messageTypeSendsReply):
+* Shared/WebPushMessage.h:
+(WebKit::WebPushMessage::decode):
+* WebKit.xcodeproj/project.pbxproj:
+* webpushd/MockPushServiceConnection.h:
+* webpushd/MockPushServiceConnection.mm:
+(WebPushD::MockPushServiceConnection::generateClientKeys):
+(WebPushD::MockPushServiceConnection::subscribe):
+(WebPushD::MockPushServiceConnection::unsubscribe):
+* webpushd/PushService.h: Added.
+(WebPushD::PushService::connection):
+(WebPushD::PushService::database):
+(WebPushD::PushService::didReceivePushMessage):
+* webpushd/PushService.mm: Added.
+(WebPushD::updateTopicLists):
+(WebPushD::PushService::create):
+(WebPushD::PushService::createMockService):
+(WebPushD::PushService::PushService):
+(WebPushD::makePushSubscriptionFromRecord):
+(WebP

[webkit-changes] [289239] trunk

2022-02-07 Thread nham
::sendMessageToDaemonWaitingForReply):
(TestWebKitAPI::sendConfigurationWithAuditToken):
(TestWebKitAPI::TEST):
(TestWebKitAPI::function): Deleted.

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Shared/API/Cocoa/WKMain.h
trunk/Source/WebKit/Shared/API/Cocoa/WKMain.mm
trunk/Source/WebKit/Shared/Cocoa/WebPushMessageCocoa.mm
trunk/Source/WebKit/Shared/WebPushDaemonConstants.h
trunk/Source/WebKit/Shared/WebPushMessage.h
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
trunk/Source/WebKit/webpushd/MockPushServiceConnection.h
trunk/Source/WebKit/webpushd/MockPushServiceConnection.mm
trunk/Source/WebKit/webpushd/PushServiceConnection.h
trunk/Source/WebKit/webpushd/PushServiceConnection.mm
trunk/Source/WebKit/webpushd/WebPushDaemon.h
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
trunk/Source/WebKit/webpushd/WebPushDaemonMain.h
trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm
trunk/Source/WebKit/webpushd/com.apple.webkit.webpushd.mac.plist
trunk/Source/WebKit/webpushd/webpushd.cpp
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm


Added Paths

trunk/Source/WebKit/webpushd/PushService.h
trunk/Source/WebKit/webpushd/PushService.mm




Diff

Modified: trunk/Source/WTF/ChangeLog (289238 => 289239)

--- trunk/Source/WTF/ChangeLog	2022-02-07 21:19:31 UTC (rev 289238)
+++ trunk/Source/WTF/ChangeLog	2022-02-07 22:07:09 UTC (rev 289239)
@@ -1,3 +1,14 @@
+2022-02-07  Ben Nham  
+
+Add PushService
+https://bugs.webkit.org/show_bug.cgi?id=235857
+
+Reviewed by Brady Eidson.
+
+Add PushAPIEnabled to WebKitLegacy so we can enable it on in API tests via _WKExperimentalFeature.
+
+* Scripts/Preferences/WebPreferencesExperimental.yaml:
+
 2022-02-06  Yusuke Suzuki  
 
 [WTF] Make Bitmap constexpr friendly


Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (289238 => 289239)

--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-07 21:19:31 UTC (rev 289238)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-07 22:07:09 UTC (rev 289239)
@@ -1122,6 +1122,8 @@
   defaultValue:
 WebCore:
   default: false
+WebKitLegacy:
+  default: false
 WebKit:
   default: false
 


Modified: trunk/Source/WebKit/ChangeLog (289238 => 289239)

--- trunk/Source/WebKit/ChangeLog	2022-02-07 21:19:31 UTC (rev 289238)
+++ trunk/Source/WebKit/ChangeLog	2022-02-07 22:07:09 UTC (rev 289239)
@@ -1,3 +1,101 @@
+2022-02-07  Ben Nham  
+
+Add PushService
+https://bugs.webkit.org/show_bug.cgi?id=235857
+
+Reviewed by Brady Eidson.
+
+This adds PushService to webpushd. It handles requests to create, remove, and get push
+subscriptions. It also decrypts incoming pushes and pass them back to the UI process via the
+existing machinery in WebPushDaemon.
+
+PushService primarily interacts with two objects:
+
+1. PushServiceConnection: this creates and removes push subscriptions from the push server.
+   It also receives incoming pushes from the push server.
+2. PushDatabase: this persists push subscriptions to disk.
+
+Several things are not yet implemented; for instance, we currently always grant a page the
+permission to receive pushes. This will be fixed in future patches.
+
+Covered by new API tests. The current tests use a MockPushServiceConnection that vends
+subscription with fixed data, but this can be improved in the future.
+
+* Shared/API/Cocoa/WKMain.h:
+* Shared/API/Cocoa/WKMain.mm:
+(WKWebPushDaemonMain):
+* Shared/Cocoa/WebPushMessageCocoa.mm: add ability to distinguish between an empty vs. null payload.
+(WebKit::WebPushMessage::fromDictionary):
+(WebKit::WebPushMessage::toDictionary const):
+* Shared/WebPushDaemonConstants.h:
+(WebKit::WebPushD::messageTypeSendsReply):
+* Shared/WebPushMessage.h:
+(WebKit::WebPushMessage::decode):
+* WebKit.xcodeproj/project.pbxproj:
+* webpushd/MockPushServiceConnection.h:
+* webpushd/MockPushServiceConnection.mm:
+(WebPushD::MockPushServiceConnection::generateClientKeys):
+(WebPushD::MockPushServiceConnection::subscribe):
+(WebPushD::MockPushServiceConnection::unsubscribe):
+* webpushd/PushService.h: Added.
+(WebPushD::PushService::connection):
+(WebPushD::PushService::database):
+(WebPushD::PushService::didReceivePushMessage):
+* webpushd/PushService.mm: Added.
+(WebPushD::updateTopicLists):
+(WebPushD::PushService::create):
+(WebPushD::PushService::createMockService):
+(WebPushD::PushService::PushService):
+(WebPushD::makePushSubscriptionFromRecord):
+(WebPushD::makePushTopic):
+

[webkit-changes] [289139] trunk

2022-02-04 Thread nham
Title: [289139] trunk








Revision 289139
Author n...@apple.com
Date 2022-02-04 15:21:32 -0800 (Fri, 04 Feb 2022)


Log Message
Add PushDatabase
https://bugs.webkit.org/show_bug.cgi?id=234194

Reviewed by Brady Eidson.

Source/WebCore:

This adds a persistence layer for push subscriptions stored in webpushd. The operations
that we support for now are:

  - inserting a record (used when subscribing)
  - removing a record (used when unsubscribing)
  - retrieving a record (used when receiving a push)
  - enumerating all records by wake state (used to provide the push service the list of all
   topics that we are subscribed to by wake state)

There are two basic data types in this data model:

  - Subscriptions, which are uniquely identified by (bundleID, serviceWorkerScope). This
stores data that is unique to each subscription, e.g. encryption keys and the HTTP
endpoint used by the server to send pushes to this subscription.
  - SubscriptionSets, which encompass one or more Subscriptions, and are uniquely identified
by (bundleID, securityOrigin). This stores state this common to multiple subscriptions,
e.g. whether or not all pushes sent by a particular origin should be non-waking.

For instance, suppose webkit.org in Safari has two service worker registrations scoped to
webkit.org/foo and webkit.org/bar. Each registration has successfully registered for push.
This would result in three rows in the database:

  1. Subscription row identified by (bundleID=safari, scope=webkit.org/foo)
  2. Subscription row identified by (bundleID=safari, scope=webkit.org/bar)
  3. SubscriptionSet row identified by (bundleID=safari, securityOrigin=webkit.org)

Both subscriptions (1) and (2) are part of the subscription set (3).

Covered by new API tests.

* Headers.cmake:
* Modules/push-api/PushDatabase.cpp: Added.
(WebCore::PushRecord::isolatedCopy const):
(WebCore::PushRecord::isolatedCopy):
(WebCore::openAndMigrateDatabaseImpl):
(WebCore::openAndMigrateDatabase):
(WebCore::PushDatabase::create):
(WebCore::PushDatabase::PushDatabase):
(WebCore::PushDatabase::~PushDatabase):
(WebCore::PushDatabase::dispatchOnWorkQueue):
(WebCore::PushDatabase::cachedStatementOnQueue):
(WebCore::bindExpirationTime):
(WebCore::expirationTimeFromValue):
(WebCore::completeOnMainQueue):
(WebCore::PushDatabase::insertRecord):
(WebCore::PushDatabase::removeRecordByIdentifier):
(WebCore::makePushRecordFromRow):
(WebCore::PushDatabase::getRecordByTopic):
(WebCore::PushDatabase::getRecordByBundleIdentifierAndScope):
(WebCore::PushDatabase::getIdentifiers):
(WebCore::PushDatabase::getTopicsByWakeState):
* Modules/push-api/PushDatabase.h: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/Logging.h:
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::inMemoryPath):
(WebCore::SQLiteDatabase::open):
* platform/sql/SQLiteDatabase.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/PushDatabase.cpp: Added.
(TestWebKitAPI::getTopicsByWakeStateSync):
(TestWebKitAPI::PushDatabaseTest::insertRecord):
(TestWebKitAPI::PushDatabaseTest::removeRecordByRowIdentifier):
(TestWebKitAPI::PushDatabaseTest::getRecordByTopic):
(TestWebKitAPI::PushDatabaseTest::getRecordByBundleIdentifierAndScope):
(TestWebKitAPI::PushDatabaseTest::getRowIdentifiers):
(TestWebKitAPI::PushDatabaseTest::getTopicsByWakeState):
(TestWebKitAPI::operator==):
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::makeTemporaryDatabasePath):
(TestWebKitAPI::TEST):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/Sources.txt
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/platform/Logging.h
trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp
trunk/Source/WebCore/platform/sql/SQLiteDatabase.h
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj


Added Paths

trunk/Source/WebCore/Modules/push-api/PushDatabase.cpp
trunk/Source/WebCore/Modules/push-api/PushDatabase.h
trunk/Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (289138 => 289139)

--- trunk/Source/WebCore/ChangeLog	2022-02-04 22:49:24 UTC (rev 289138)
+++ trunk/Source/WebCore/ChangeLog	2022-02-04 23:21:32 UTC (rev 289139)
@@ -1,3 +1,70 @@
+2022-02-04  Ben Nham  
+
+Add PushDatabase
+https://bugs.webkit.org/show_bug.cgi?id=234194
+
+Reviewed by Brady Eidson.
+
+This adds a persistence layer for push subscriptions stored in webpushd. The operations
+that we support for now are:
+
+  - inserting a record (used when subscribing)
+  - removing a record (used when unsubscribing)
+  - retrieving a record (used when receiving a push)
+  - enumerating all records by wake state (used to provide the push service the list of all
+   topics that we are subscribed to by wake state)
+
+There are two basic data ty

[webkit-changes] [289114] trunk/Source/WebKit

2022-02-04 Thread nham
Title: [289114] trunk/Source/WebKit








Revision 289114
Author n...@apple.com
Date 2022-02-04 08:06:51 -0800 (Fri, 04 Feb 2022)


Log Message
Import APSConnection-related SPI
https://bugs.webkit.org/show_bug.cgi?id=235856

Reviewed Youenn Fablet.

This imports the SPI declarations necessary to build against ApplePushService in WebKit. It
also includes a PushServiceConnection interface that can sit in front of APSConnection, and
a fake interface that will be fleshed out for testing purposes.


* Platform/spi/Cocoa/ApplePushServiceSPI.h: Added.
* WebKit.xcodeproj/project.pbxproj:
* webpushd/ApplePushServiceConnection.h: Added.
* webpushd/ApplePushServiceConnection.mm: Added.
(-[_WKAPSConnectionDelegate initWithConnection:]):
(-[_WKAPSConnectionDelegate connection:didReceivePublicToken:]):
(-[_WKAPSConnectionDelegate connection:didReceiveIncomingMessage:]):
(WebPushD::ApplePushServiceConnection::ApplePushServiceConnection):
(WebPushD::makeTokenInfo):
(WebPushD::ApplePushServiceConnection::subscribe):
(WebPushD::ApplePushServiceConnection::unsubscribe):
(WebPushD::ApplePushServiceConnection::enabledTopics):
(WebPushD::ApplePushServiceConnection::ignoredTopics):
(WebPushD::ApplePushServiceConnection::opportunisticTopics):
(WebPushD::ApplePushServiceConnection::nonWakingTopics):
(WebPushD::ApplePushServiceConnection::setEnabledTopics):
(WebPushD::ApplePushServiceConnection::setIgnoredTopics):
(WebPushD::ApplePushServiceConnection::setOpportunisticTopics):
(WebPushD::ApplePushServiceConnection::setNonWakingTopics):
(WebPushD::ApplePushServiceConnection::setTopicLists):
* webpushd/MockPushServiceConnection.h: Added.
* webpushd/MockPushServiceConnection.mm: Added.
(WebPushD::MockPushServiceConnection::MockPushServiceConnection):
(WebPushD::MockPushServiceConnection::subscribe):
(WebPushD::MockPushServiceConnection::unsubscribe):
(WebPushD::MockPushServiceConnection::enabledTopics):
(WebPushD::MockPushServiceConnection::ignoredTopics):
(WebPushD::MockPushServiceConnection::opportunisticTopics):
(WebPushD::MockPushServiceConnection::nonWakingTopics):
(WebPushD::MockPushServiceConnection::setEnabledTopics):
(WebPushD::MockPushServiceConnection::setIgnoredTopics):
(WebPushD::MockPushServiceConnection::setOpportunisticTopics):
(WebPushD::MockPushServiceConnection::setNonWakingTopics):
(WebPushD::MockPushServiceConnection::setTopicLists):
* webpushd/PushServiceConnection.h: Added.
* webpushd/PushServiceConnection.mm: Added.
(WebPushD::PushServiceConnection::startListeningForPushMessages):
(WebPushD::PushServiceConnection::didReceivePushMessage):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj


Added Paths

trunk/Source/WebKit/Platform/spi/Cocoa/ApplePushServiceSPI.h
trunk/Source/WebKit/webpushd/ApplePushServiceConnection.h
trunk/Source/WebKit/webpushd/ApplePushServiceConnection.mm
trunk/Source/WebKit/webpushd/MockPushServiceConnection.h
trunk/Source/WebKit/webpushd/MockPushServiceConnection.mm
trunk/Source/WebKit/webpushd/PushServiceConnection.h
trunk/Source/WebKit/webpushd/PushServiceConnection.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (289113 => 289114)

--- trunk/Source/WebKit/ChangeLog	2022-02-04 16:05:26 UTC (rev 289113)
+++ trunk/Source/WebKit/ChangeLog	2022-02-04 16:06:51 UTC (rev 289114)
@@ -1,3 +1,53 @@
+2022-02-04  Ben Nham  
+
+Import APSConnection-related SPI
+https://bugs.webkit.org/show_bug.cgi?id=235856
+
+Reviewed Youenn Fablet.
+
+This imports the SPI declarations necessary to build against ApplePushService in WebKit. It
+also includes a PushServiceConnection interface that can sit in front of APSConnection, and
+a fake interface that will be fleshed out for testing purposes.
+
+* Platform/spi/Cocoa/ApplePushServiceSPI.h: Added.
+* WebKit.xcodeproj/project.pbxproj:
+* webpushd/ApplePushServiceConnection.h: Added.
+* webpushd/ApplePushServiceConnection.mm: Added.
+(-[_WKAPSConnectionDelegate initWithConnection:]):
+(-[_WKAPSConnectionDelegate connection:didReceivePublicToken:]):
+(-[_WKAPSConnectionDelegate connection:didReceiveIncomingMessage:]):
+(WebPushD::ApplePushServiceConnection::ApplePushServiceConnection):
+(WebPushD::makeTokenInfo):
+(WebPushD::ApplePushServiceConnection::subscribe):
+(WebPushD::ApplePushServiceConnection::unsubscribe):
+(WebPushD::ApplePushServiceConnection::enabledTopics):
+(WebPushD::ApplePushServiceConnection::ignoredTopics):
+(WebPushD::ApplePushServiceConnection::opportunisticTopics):
+(WebPushD::ApplePushServiceConnection::nonWakingTopics):
+(WebPushD::ApplePushServiceConnection::setEnabledTopics):
+(WebPushD::ApplePushServiceConnection::setIgnoredTopics):
+(WebPushD::ApplePushServiceConnection::setOpportunisticTopics):
+(WebPushD::ApplePushServiceConnection::setNonWakingTopics):
+(WebPu

[webkit-changes] [289078] trunk/Source/WebCore

2022-02-03 Thread nham
Title: [289078] trunk/Source/WebCore








Revision 289078
Author n...@apple.com
Date 2022-02-03 14:12:39 -0800 (Thu, 03 Feb 2022)


Log Message
LocalStorage values should be 8-bit strings in memory if possible
https://bugs.webkit.org/show_bug.cgi?id=235484

Reviewed by Chris Dumez.

LocalStorage values are stored into a SQLite column as 16-bit strings and are deserialized
back into memory as 16-bit strings. To save memory, this makes it so that we deserialize the
string into an 8-bit string in memory if possible.

Estimated win of ~3MB on Membuster5.

* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::columnBlobAsString):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (289077 => 289078)

--- trunk/Source/WebCore/ChangeLog	2022-02-03 21:47:06 UTC (rev 289077)
+++ trunk/Source/WebCore/ChangeLog	2022-02-03 22:12:39 UTC (rev 289078)
@@ -1,3 +1,19 @@
+2022-02-03  Ben Nham  
+
+LocalStorage values should be 8-bit strings in memory if possible
+https://bugs.webkit.org/show_bug.cgi?id=235484
+
+Reviewed by Chris Dumez.
+
+LocalStorage values are stored into a SQLite column as 16-bit strings and are deserialized
+back into memory as 16-bit strings. To save memory, this makes it so that we deserialize the
+string into an 8-bit string in memory if possible.
+
+Estimated win of ~3MB on Membuster5.
+
+* platform/sql/SQLiteStatement.cpp:
+(WebCore::SQLiteStatement::columnBlobAsString):
+
 2022-02-03  Ziran Sun  
 
 [Forms] Value doesn't change for stepUp()/stepDown() with out of range values


Modified: trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp (289077 => 289078)

--- trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp	2022-02-03 21:47:06 UTC (rev 289077)
+++ trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp	2022-02-03 22:12:39 UTC (rev 289078)
@@ -284,7 +284,7 @@
 return String();
 
 ASSERT(!(size % sizeof(UChar)));
-return String(static_cast(blob), size / sizeof(UChar));
+return StringImpl::create8BitIfPossible(static_cast(blob), size / sizeof(UChar));
 }
 
 Vector SQLiteStatement::columnBlob(int col)






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [288929] trunk

2022-02-01 Thread nham
Title: [288929] trunk








Revision 288929
Author n...@apple.com
Date 2022-02-01 16:47:27 -0800 (Tue, 01 Feb 2022)


Log Message
Forward messages from NetworkProcess to webpushd
https://bugs.webkit.org/show_bug.cgi?id=235855

Reviewed by Brent Fulgham.

Source/WebCore:

Make ExceptionData use modern encoding since the daemon IPC encoder doesn't support legacy
encoding.

* dom/ExceptionData.h:
(WebCore::ExceptionData::decode):

Source/WebKit:

This forwards PushManager and PushSubscription-related IPC from NetworkProcess to webpushd.
The implementations in webpushd are stubs in this patch, and as a result there are no new
tests. The implementations and tests will be filled out in a future patch.

* NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::subscribeToPushService):
(WebKit::NetworkNotificationManager::unsubscribeFromPushService):
(WebKit::NetworkNotificationManager::getPushSubscription):
(WebKit::NetworkNotificationManager::getPushPermissionState):
* NetworkProcess/Notifications/NetworkNotificationManager.h:
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::subscribeToPushService):
(WebKit::WebSWServerConnection::unsubscribeFromPushService):
(WebKit::WebSWServerConnection::getPushSubscription):
(WebKit::WebSWServerConnection::getPushPermissionState):
* Shared/WebPushDaemonConstants.h:
(WebKit::WebPushD::messageTypeSendsReply):
* webpushd/WebPushDaemon.h:
* webpushd/WebPushDaemon.mm:
(WebPushD::MessageInfo::subscribeToPushService::encodeReply):
(WebPushD::MessageInfo::unsubscribeFromPushService::encodeReply):
(WebPushD::MessageInfo::getPushSubscription::encodeReply):
(WebPushD::MessageInfo::getPushPermissionState::encodeReply):
(WebPushD::Daemon::decodeAndHandleMessage):
(WebPushD::Daemon::subscribeToPushService):
(WebPushD::Daemon::unsubscribeFromPushService):
(WebPushD::Daemon::getPushSubscription):
(WebPushD::Daemon::getPushPermissionState):

LayoutTests:

Update existing tests to test for AbortError, since that's the exception type specified in
the spec.

* http/wpt/push-api/pushManager.any.js:
(promise_test.async test):

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/http/wpt/push-api/pushManager.any.js
trunk/LayoutTests/platform/glib/http/wpt/push-api/pushManager.any-expected.txt
trunk/LayoutTests/platform/glib/http/wpt/push-api/pushManager.any.serviceworker-expected.txt
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/dom/ExceptionData.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
trunk/Source/WebKit/Shared/WebPushDaemonConstants.h
trunk/Source/WebKit/webpushd/WebPushDaemon.h
trunk/Source/WebKit/webpushd/WebPushDaemon.mm




Diff

Modified: trunk/LayoutTests/ChangeLog (288928 => 288929)

--- trunk/LayoutTests/ChangeLog	2022-02-02 00:46:32 UTC (rev 288928)
+++ trunk/LayoutTests/ChangeLog	2022-02-02 00:47:27 UTC (rev 288929)
@@ -1,3 +1,16 @@
+2022-02-01  Ben Nham  
+
+Forward messages from NetworkProcess to webpushd
+https://bugs.webkit.org/show_bug.cgi?id=235855
+
+Reviewed by Brent Fulgham.
+
+Update existing tests to test for AbortError, since that's the exception type specified in
+the spec.
+
+* http/wpt/push-api/pushManager.any.js:
+(promise_test.async test):
+
 2022-02-01  Alan Bujtas  
 
 [LFC][IFC] Using Fontcascade::spaceWidth to subtract the trailing space width may result in incorrect layout


Modified: trunk/LayoutTests/http/wpt/push-api/pushManager.any.js (288928 => 288929)

--- trunk/LayoutTests/http/wpt/push-api/pushManager.any.js	2022-02-02 00:46:32 UTC (rev 288928)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any.js	2022-02-02 00:47:27 UTC (rev 288929)
@@ -99,7 +99,7 @@
 
 promise_test(async (test) => {
 // TODO: change this to make sure that subscription is valid once we fully implement subscribe.
-return promise_rejects_dom(test, "NotAllowedError", pushManager.subscribe({
+return promise_rejects_dom(test, "AbortError", pushManager.subscribe({
 userVisibleOnly: true,
 applicationServerKey: VALID_SERVER_KEY
 }));
@@ -107,7 +107,7 @@
 
 promise_test(async (test) => {
 // TODO: change this to make sure that subscription is valid once we fully implement subscribe.
-return promise_rejects_dom(test, "NotAllowedError", pushManager.subscribe({
+return promise_rejects_dom(test, "AbortError", pushManager.subscribe({
 userVisibleOnly: true,
 applicationServerKey: VALID_BASE64_SERVER_KEY
 }));


Modified: trunk/LayoutTests/platform/glib/http/wpt/push-api/pushManager.any-expected.txt (288928 => 288929)

--- trunk/LayoutTests/platform/glib/http/wpt/push-api/pushManager.any-expe

[webkit-changes] [288902] trunk

2022-02-01 Thread nham
Title: [288902] trunk








Revision 288902
Author n...@apple.com
Date 2022-02-01 11:16:02 -0800 (Tue, 01 Feb 2022)


Log Message
Import APSConnection-related SPI
https://bugs.webkit.org/show_bug.cgi?id=235856

Reviewed Youenn Fablet.

Source/WebKit:

This imports the SPI declarations necessary to build against ApplePushService in WebKit. It
also includes a PushServiceConnection interface that can sit in front of APSConnection, and
a fake interface that will be fleshed out for testing purposes.


* Configurations/WebKit.xcconfig:
* Platform/spi/Cocoa/ApplePushServiceSPI.h: Added.
* WebKit.xcodeproj/project.pbxproj:
* webpushd/ApplePushServiceConnection.h: Added.
* webpushd/ApplePushServiceConnection.mm: Added.
(-[_WKAPSConnectionDelegate initWithConnection:]):
(-[_WKAPSConnectionDelegate connection:didReceivePublicToken:]):
(-[_WKAPSConnectionDelegate connection:didReceiveIncomingMessage:]):
(WebPushD::ApplePushServiceConnection::ApplePushServiceConnection):
(WebPushD::makeTokenInfo):
(WebPushD::ApplePushServiceConnection::subscribe):
(WebPushD::ApplePushServiceConnection::unsubscribe):
(WebPushD::ApplePushServiceConnection::enabledTopics):
(WebPushD::ApplePushServiceConnection::ignoredTopics):
(WebPushD::ApplePushServiceConnection::opportunisticTopics):
(WebPushD::ApplePushServiceConnection::nonWakingTopics):
(WebPushD::ApplePushServiceConnection::setEnabledTopics):
(WebPushD::ApplePushServiceConnection::setIgnoredTopics):
(WebPushD::ApplePushServiceConnection::setOpportunisticTopics):
(WebPushD::ApplePushServiceConnection::setNonWakingTopics):
(WebPushD::ApplePushServiceConnection::setTopicLists):
* webpushd/MockPushServiceConnection.h: Added.
* webpushd/MockPushServiceConnection.mm: Added.
(WebPushD::MockPushServiceConnection::MockPushServiceConnection):
(WebPushD::MockPushServiceConnection::subscribe):
(WebPushD::MockPushServiceConnection::unsubscribe):
(WebPushD::MockPushServiceConnection::enabledTopics):
(WebPushD::MockPushServiceConnection::ignoredTopics):
(WebPushD::MockPushServiceConnection::opportunisticTopics):
(WebPushD::MockPushServiceConnection::nonWakingTopics):
(WebPushD::MockPushServiceConnection::setEnabledTopics):
(WebPushD::MockPushServiceConnection::setIgnoredTopics):
(WebPushD::MockPushServiceConnection::setOpportunisticTopics):
(WebPushD::MockPushServiceConnection::setNonWakingTopics):
(WebPushD::MockPushServiceConnection::setTopicLists):
* webpushd/PushServiceConnection.h: Added.
* webpushd/PushServiceConnection.mm: Added.
(WebPushD::PushServiceConnection::startListeningForPushMessages):
(WebPushD::PushServiceConnection::didReceivePushMessage):

Source/WTF:

Add a HAVE macro to guard some of the newer SPI in APSConnection.


* wtf/PlatformHave.h:

WebKitLibraries:

Add an ApplePushService stub so we can build against it with public SDKs.


* WebKitPrivateFrameworkStubs/iOS/15/ApplePushService.framework/ApplePushService.tbd: Added.

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformHave.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Configurations/WebKit.xcconfig
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
trunk/WebKitLibraries/ChangeLog


Added Paths

trunk/Source/WebKit/Platform/spi/Cocoa/ApplePushServiceSPI.h
trunk/Source/WebKit/webpushd/ApplePushServiceConnection.h
trunk/Source/WebKit/webpushd/ApplePushServiceConnection.mm
trunk/Source/WebKit/webpushd/MockPushServiceConnection.h
trunk/Source/WebKit/webpushd/MockPushServiceConnection.mm
trunk/Source/WebKit/webpushd/PushServiceConnection.h
trunk/Source/WebKit/webpushd/PushServiceConnection.mm
trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/15/ApplePushService.framework/
trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/15/ApplePushService.framework/ApplePushService.tbd




Diff

Modified: trunk/Source/WTF/ChangeLog (288901 => 288902)

--- trunk/Source/WTF/ChangeLog	2022-02-01 19:14:02 UTC (rev 288901)
+++ trunk/Source/WTF/ChangeLog	2022-02-01 19:16:02 UTC (rev 288902)
@@ -1,3 +1,14 @@
+2022-02-01  Ben Nham  
+
+Import APSConnection-related SPI
+https://bugs.webkit.org/show_bug.cgi?id=235856
+
+Reviewed Youenn Fablet.
+
+Add a HAVE macro to guard some of the newer SPI in APSConnection.
+
+* wtf/PlatformHave.h:
+
 2022-02-01  Commit Queue  
 
 Unreviewed, reverting r288746.


Modified: trunk/Source/WTF/wtf/PlatformHave.h (288901 => 288902)

--- trunk/Source/WTF/wtf/PlatformHave.h	2022-02-01 19:14:02 UTC (rev 288901)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2022-02-01 19:16:02 UTC (rev 288902)
@@ -1167,3 +1167,8 @@
 #if ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400)
 #define HAVE_UIACTIVITYTYPE_SHAREPLAY 1
 #endif
+
+#if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 13) \
+|| (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 16))
+#define HAVE_APPLE_PUSH_SERVICE_URL_TOKEN_SUPPORT 1
+#endif


Modified: trunk/Source/WebKit/ChangeLog (288

[webkit-changes] [288796] trunk/Tools

2022-01-29 Thread nham
Title: [288796] trunk/Tools








Revision 288796
Author n...@apple.com
Date 2022-01-29 21:21:33 -0800 (Sat, 29 Jan 2022)


Log Message
Add web push message decryption routines
https://bugs.webkit.org/show_bug.cgi?id=233903

Reviewed by Brady Eidson.

Somehow the unit tests were left out of the original patch that was landed. Adding them back
in this patch.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/PushMessageCrypto.cpp: Added.
(TestWebKitAPI::mustBase64URLDecode):
(TestWebKitAPI::makeAES128GCMClientKeys):
(TestWebKitAPI::TEST):
(TestWebKitAPI::makeAESGCMClientKeys):

Modified Paths

trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj


Added Paths

trunk/Tools/TestWebKitAPI/Tests/WebCore/PushMessageCrypto.cpp




Diff

Modified: trunk/Tools/ChangeLog (288795 => 288796)

--- trunk/Tools/ChangeLog	2022-01-30 03:26:20 UTC (rev 288795)
+++ trunk/Tools/ChangeLog	2022-01-30 05:21:33 UTC (rev 288796)
@@ -1,3 +1,20 @@
+2022-01-29  Ben Nham  
+
+Add web push message decryption routines
+https://bugs.webkit.org/show_bug.cgi?id=233903
+
+Reviewed by Brady Eidson.
+
+Somehow the unit tests were left out of the original patch that was landed. Adding them back
+in this patch.
+
+* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+* TestWebKitAPI/Tests/WebCore/PushMessageCrypto.cpp: Added.
+(TestWebKitAPI::mustBase64URLDecode):
+(TestWebKitAPI::makeAES128GCMClientKeys):
+(TestWebKitAPI::TEST):
+(TestWebKitAPI::makeAESGCMClientKeys):
+
 2022-01-28  Fujii Hironori  
 
 [WinCairo] WebKitTestRunner should support pixel dump for accelerated compositing mode


Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (288795 => 288796)

--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-01-30 03:26:20 UTC (rev 288795)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-01-30 05:21:33 UTC (rev 288796)
@@ -1002,6 +1002,7 @@
 		E5AA42F2259128AE00410A3D /* UserInterfaceIdiomUpdate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5AA42F1259128AE00410A3D /* UserInterfaceIdiomUpdate.mm */; };
 		E5AA8D1D25151CC60051CC45 /* DateInputTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5AA8D1C25151CC60051CC45 /* DateInputTests.mm */; };
 		EB230D41245E813F00C66AD1 /* IDBCheckpointWAL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = EB230D3D245E722E00C66AD1 /* IDBCheckpointWAL.html */; };
+		EBA75C49275ED7C700D6D31C /* PushMessageCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBA75C48275ED7BE00D6D31C /* PushMessageCrypto.cpp */; };
 		ECA680CE1E68CC0900731D20 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = ECA680CD1E68CC0900731D20 /* StringUtilities.mm */; };
 		F4010B8024DA24AC00A876E2 /* NavigationSwipeTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4010B7F24DA24AC00A876E2 /* NavigationSwipeTests.mm */; };
 		F4010B8324DA267F00A876E2 /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4010B8124DA267F00A876E2 /* PoseAsClass.mm */; };
@@ -2958,6 +2959,7 @@
 		E5AA8D1C25151CC60051CC45 /* DateInputTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DateInputTests.mm; sourceTree = ""; };
 		EB230D3D245E722E00C66AD1 /* IDBCheckpointWAL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = IDBCheckpointWAL.html; sourceTree = ""; };
 		EB230D3E245E726300C66AD1 /* IDBCheckpointWAL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IDBCheckpointWAL.mm; sourceTree = ""; };
+		EBA75C48275ED7BE00D6D31C /* PushMessageCrypto.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PushMessageCrypto.cpp; sourceTree = ""; };
 		EC79F168BE454E579E417B05 /* Markable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Markable.cpp; sourceTree = ""; };
 		ECA680CD1E68CC0900731D20 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = ""; };
 		F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -3768,6 +3770,7 @@
 AA96CAB421C7DB4200FD2F97 /* ParsedContentType.cpp */,
 6B0A07F621FA9C2B00D57391 /* PrivateClickMeasurement.cpp */,
 041A1E33216FFDBC00789E0A /* PublicSuffix.cpp */,
+EBA75C48275ED7BE00D6D31C /* PushMessageCrypto.cpp */,
 6B4E861B2220A5520022F389 /* RegistrableDomain.cpp */,
 F418BE141F71B7DC001970E6 /* RoundedRectTests.cpp */,
 4181C62C255A891100AEB0FF /* RTCRtpSFrameTransformerTests.cpp */,
@@ -5683,6 +5686,7 @@
 

[webkit-changes] [288453] trunk/Source/WebCore

2022-01-24 Thread nham
Title: [288453] trunk/Source/WebCore








Revision 288453
Author n...@apple.com
Date 2022-01-24 11:01:42 -0800 (Mon, 24 Jan 2022)


Log Message
Fix macOS build after r288442

Unreviewed build fix.

* DerivedSources-output.xcfilelist: Add the new IDL file to derived sources.

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/DerivedSources-output.xcfilelist




Diff

Modified: trunk/Source/WebCore/ChangeLog (288452 => 288453)

--- trunk/Source/WebCore/ChangeLog	2022-01-24 18:41:11 UTC (rev 288452)
+++ trunk/Source/WebCore/ChangeLog	2022-01-24 19:01:42 UTC (rev 288453)
@@ -1,3 +1,11 @@
+2022-01-24  Ben Nham  
+
+Fix macOS build after r288442
+
+Unreviewed build fix.
+
+* DerivedSources-output.xcfilelist: Add the new IDL file to derived sources.
+
 2022-01-24  Antoine Quint  
 
 Pass the Document through bindings to KeyframeEffect::setKeyframes()


Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (288452 => 288453)

--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2022-01-24 18:41:11 UTC (rev 288452)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2022-01-24 19:01:42 UTC (rev 288453)
@@ -2943,6 +2943,7 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/ServiceWorkerGlobalScopeConstructors.idl
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/Settings.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/Settings.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/ShadowRealmGlobalScopeConstructors.idl
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/StreamInternalsBuiltins.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/StyleBuilderGenerated.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/StylePropertyShorthandFunctions.cpp






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [288416] trunk/Source

2022-01-22 Thread nham
Title: [288416] trunk/Source








Revision 288416
Author n...@apple.com
Date 2022-01-22 21:20:57 -0800 (Sat, 22 Jan 2022)


Log Message
Add PushSubscriptionIdentifier
https://bugs.webkit.org/show_bug.cgi?id=234797

Reviewed by Darin Adler.

Source/WebCore:

This adds a PushSubscriptionIdentifier to each PushSubscription. Implementation-wise, it
will be the rowid if the subscription in the subscription database. We need this so that
PushSubscription.unsubscribe only unsubscribes from the given subscription. Currently it
unsubscribes from any active subscription associated with the subscription's service worker
scope.

No new tests. I plan on adding a test for this case in an API test which will work with real
PushSubscription objects when I submit the patch that implements the subscription business
logic in webpushd. The current layout tests only work with fake PushSubscription objects
that aren't connected to webpushd.

* Headers.cmake:
* Modules/push-api/PushSubscription.cpp:
(WebCore::PushSubscription::unsubscribe):
* Modules/push-api/PushSubscriptionData.cpp:
(WebCore::PushSubscriptionData::isolatedCopy const):
* Modules/push-api/PushSubscriptionData.h:
(WebCore::PushSubscriptionData::encode const):
(WebCore::PushSubscriptionData::decode):
webpushd only supports modern decoding and we need to send this object to it, so use modern decoding.

* Modules/push-api/PushSubscriptionIdentifier.h:
* WebCore.xcodeproj/project.pbxproj:
* testing/Internals.cpp:
(WebCore::Internals::createPushSubscription):
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::createPushSubscription):
* workers/service/SWClientConnection.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::unsubscribeFromPushService):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::unsubscribeFromPushService):
* workers/service/ServiceWorkerRegistration.h:
* workers/service/WorkerSWClientConnection.cpp:
(WebCore::WorkerSWClientConnection::unsubscribeFromPushService):
* workers/service/WorkerSWClientConnection.h:

Source/WebKit:

Pass the subscription identifier in the PushSubscription.unsubscribe call to guarantee that
we only unsubscribe from the given subscription.

* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::unsubscribeFromPushService):
* NetworkProcess/ServiceWorker/WebSWServerConnection.h:
* NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::unsubscribeFromPushService):
* WebProcess/Storage/WebSWClientConnection.h:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/Modules/push-api/PushSubscription.cpp
trunk/Source/WebCore/Modules/push-api/PushSubscriptionData.cpp
trunk/Source/WebCore/Modules/push-api/PushSubscriptionData.h
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/testing/Internals.cpp
trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp
trunk/Source/WebCore/workers/service/SWClientConnection.h
trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp
trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h
trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp
trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in
trunk/Source/WebKit/Scripts/webkit/messages.py
trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h


Added Paths

trunk/Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (288415 => 288416)

--- trunk/Source/WebCore/ChangeLog	2022-01-23 05:01:37 UTC (rev 288415)
+++ trunk/Source/WebCore/ChangeLog	2022-01-23 05:20:57 UTC (rev 288416)
@@ -1,3 +1,48 @@
+2022-01-22  Ben Nham  
+
+Add PushSubscriptionIdentifier
+https://bugs.webkit.org/show_bug.cgi?id=234797
+
+Reviewed by Darin Adler.
+
+This adds a PushSubscriptionIdentifier to each PushSubscription. Implementation-wise, it
+will be the rowid if the subscription in the subscription database. We need this so that
+PushSubscription.unsubscribe only unsubscribes from the given subscription. Currently it
+unsubscribes from any active subscription associated with the subscription's service worker
+scope.
+
+No new tests

[webkit-changes] [288340] trunk/Source/bmalloc

2022-01-20 Thread nham
Title: [288340] trunk/Source/bmalloc








Revision 288340
Author n...@apple.com
Date 2022-01-20 18:11:43 -0800 (Thu, 20 Jan 2022)


Log Message
Make bmalloc work better with various MallocStackLogging modes
https://bugs.webkit.org/show_bug.cgi?id=235425

Reviewed by Yusuke Suzuki.

This conditionalizes the way system malloc is used depending on the exact value of the
MallocStackLogging environment variable:

- If the mode is "vm" or "vmlite", then we don't need to use system malloc at all, since
  those logging modes only intercept syscalls.
- If the mode is "lite", then we should use the default malloc zone (rather than our custom
  "WebKit Using System Malloc" zone), since the lite mode only intercepts allocations from
  the default zone.

Before this change, the lite mode didn't capture bmalloc/FastMalloc callstacks, which made
it less useful than it should have been.

* bmalloc/DebugHeap.cpp:
(bmalloc::shouldUseDefaultMallocZone):
(bmalloc::DebugHeap::DebugHeap):
* bmalloc/Environment.cpp:
(bmalloc::isMallocEnvironmentVariableImplyingSystemMallocSet):
(bmalloc::Environment::computeIsDebugHeapEnabled):

Modified Paths

trunk/Source/bmalloc/ChangeLog
trunk/Source/bmalloc/bmalloc/DebugHeap.cpp
trunk/Source/bmalloc/bmalloc/Environment.cpp




Diff

Modified: trunk/Source/bmalloc/ChangeLog (288339 => 288340)

--- trunk/Source/bmalloc/ChangeLog	2022-01-21 01:36:40 UTC (rev 288339)
+++ trunk/Source/bmalloc/ChangeLog	2022-01-21 02:11:43 UTC (rev 288340)
@@ -1,3 +1,29 @@
+2022-01-20  Ben Nham  
+
+Make bmalloc work better with various MallocStackLogging modes
+https://bugs.webkit.org/show_bug.cgi?id=235425
+
+Reviewed by Yusuke Suzuki.
+
+This conditionalizes the way system malloc is used depending on the exact value of the
+MallocStackLogging environment variable:
+
+- If the mode is "vm" or "vmlite", then we don't need to use system malloc at all, since
+  those logging modes only intercept syscalls.
+- If the mode is "lite", then we should use the default malloc zone (rather than our custom
+  "WebKit Using System Malloc" zone), since the lite mode only intercepts allocations from
+  the default zone.
+
+Before this change, the lite mode didn't capture bmalloc/FastMalloc callstacks, which made
+it less useful than it should have been.
+
+* bmalloc/DebugHeap.cpp:
+(bmalloc::shouldUseDefaultMallocZone):
+(bmalloc::DebugHeap::DebugHeap):
+* bmalloc/Environment.cpp:
+(bmalloc::isMallocEnvironmentVariableImplyingSystemMallocSet):
+(bmalloc::Environment::computeIsDebugHeapEnabled):
+
 2022-01-20  Yusuke Suzuki  
 
 [libpas] Ensure pas_allocation_callback and pas_deallocation_callback are initialized as NULL


Modified: trunk/Source/bmalloc/bmalloc/DebugHeap.cpp (288339 => 288340)

--- trunk/Source/bmalloc/bmalloc/DebugHeap.cpp	2022-01-21 01:36:40 UTC (rev 288339)
+++ trunk/Source/bmalloc/bmalloc/DebugHeap.cpp	2022-01-21 02:11:43 UTC (rev 288340)
@@ -44,11 +44,27 @@
 
 #if BOS(DARWIN)
 
+static bool shouldUseDefaultMallocZone()
+{
+if (getenv("DEBUG_HEAP_USE_DEFAULT_ZONE"))
+return true;
+
+// The lite logging mode only intercepts allocations from the default zone.
+const char* mallocStackLogging = getenv("MallocStackLogging");
+if (mallocStackLogging && !strcmp(mallocStackLogging, "lite"))
+return true;
+
+return false;
+}
+
 DebugHeap::DebugHeap(const LockHolder&)
-: m_zone(malloc_create_zone(0, 0))
+: m_zone(malloc_default_zone())
 , m_pageSize(vmPageSize())
 {
-malloc_set_zone_name(m_zone, "WebKit Using System Malloc");
+if (!shouldUseDefaultMallocZone()) {
+m_zone = malloc_create_zone(0, 0);
+malloc_set_zone_name(m_zone, "WebKit Using System Malloc");
+}
 }
 
 void* DebugHeap::malloc(size_t size, FailureAction action)


Modified: trunk/Source/bmalloc/bmalloc/Environment.cpp (288339 => 288340)

--- trunk/Source/bmalloc/bmalloc/Environment.cpp	2022-01-21 01:36:40 UTC (rev 288339)
+++ trunk/Source/bmalloc/bmalloc/Environment.cpp	2022-01-21 02:11:43 UTC (rev 288340)
@@ -59,7 +59,7 @@
 
 namespace bmalloc {
 
-static bool isMallocEnvironmentVariableSet()
+static bool isMallocEnvironmentVariableImplyingSystemMallocSet()
 {
 const char* list[] = {
 "Malloc",
@@ -67,9 +67,7 @@
 "MallocGuardEdges",
 "MallocDoNotProtectPrelude",
 "MallocDoNotProtectPostlude",
-"MallocStackLogging",
 "MallocStackLoggingNoCompact",
-"MallocStackLoggingDirectory",
 "MallocScribble",
 "MallocCheckHeapStart",
 "MallocCheckHeapEach",
@@ -86,6 +84,12 @@
 return true;

[webkit-changes] [287015] trunk/Source/WebCore

2021-12-14 Thread nham
Title: [287015] trunk/Source/WebCore








Revision 287015
Author n...@apple.com
Date 2021-12-14 00:18:02 -0800 (Tue, 14 Dec 2021)


Log Message
Add web push message decryption routines
https://bugs.webkit.org/show_bug.cgi?id=233903

Reviewed by Brady Eidson.

Source/WebCore:

This adds routines to decrypt push payloads encoded with the aes128gcm and aesgcm schemes.
The crypto primitives that we depend are implemented in PushCrypto, while the logic to use
those primitives to decrypt message payloads is in PushMessageCrypto.

Test: TestWebKitAPI.PushMessageCrypto

* Headers.cmake:
* Modules/push-api/PushCrypto.cpp: Added.
(WebCore::PushCrypto::P256DHKeyPair::generate):
(WebCore::PushCrypto::validateP256DHPublicKey):
(WebCore::PushCrypto::computeP256DHSharedSecret):
(WebCore::PushCrypto::hmacSHA256):
(WebCore::PushCrypto::decryptAES128GCM):
* Modules/push-api/PushCrypto.h: Added.
* Modules/push-api/PushManager.cpp:
(WebCore::PushManager::subscribe):
* Modules/push-api/PushMessageCrypto.cpp: Added.
(WebCore::PushCrypto::ClientKeys::generate):
(WebCore::PushCrypto::areClientKeyLengthsValid):
(WebCore::PushCrypto::computeAES128GCMPaddingLength):
(WebCore::PushCrypto::decryptAES128GCMPayload):
(WebCore::PushCrypto::computeAESGCMPaddingLength):
(WebCore::PushCrypto::decryptAESGCMPayload):
* Modules/push-api/PushMessageCrypto.h: Added.
* Modules/push-api/cocoa/PushCryptoCocoa.cpp: Added.
(WebCore::PushCrypto::P256DHKeyPair::generate):
(WebCore::PushCrypto::validateP256DHPublicKey):
(WebCore::PushCrypto::computeP256DHSharedSecret):
(WebCore::PushCrypto::hmacSHA256):
(WebCore::PushCrypto::decryptAES128GCM):
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:

Source/WebCore/PAL:

* pal/spi/cocoa/CommonCryptoSPI.h: Add AES-GCM decryption SPI.

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/Modules/push-api/PushManager.cpp
trunk/Source/WebCore/PAL/ChangeLog
trunk/Source/WebCore/PAL/pal/spi/cocoa/CommonCryptoSPI.h
trunk/Source/WebCore/Sources.txt
trunk/Source/WebCore/SourcesCocoa.txt
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj


Added Paths

trunk/Source/WebCore/Modules/push-api/PushCrypto.cpp
trunk/Source/WebCore/Modules/push-api/PushCrypto.h
trunk/Source/WebCore/Modules/push-api/PushMessageCrypto.cpp
trunk/Source/WebCore/Modules/push-api/PushMessageCrypto.h
trunk/Source/WebCore/Modules/push-api/cocoa/
trunk/Source/WebCore/Modules/push-api/cocoa/PushCryptoCocoa.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (287014 => 287015)

--- trunk/Source/WebCore/ChangeLog	2021-12-14 08:12:55 UTC (rev 287014)
+++ trunk/Source/WebCore/ChangeLog	2021-12-14 08:18:02 UTC (rev 287015)
@@ -1,3 +1,44 @@
+2021-12-14  Ben Nham  
+
+Add web push message decryption routines
+https://bugs.webkit.org/show_bug.cgi?id=233903
+
+Reviewed by Brady Eidson.
+
+This adds routines to decrypt push payloads encoded with the aes128gcm and aesgcm schemes.
+The crypto primitives that we depend are implemented in PushCrypto, while the logic to use
+those primitives to decrypt message payloads is in PushMessageCrypto.
+
+Test: TestWebKitAPI.PushMessageCrypto
+
+* Headers.cmake:
+* Modules/push-api/PushCrypto.cpp: Added.
+(WebCore::PushCrypto::P256DHKeyPair::generate):
+(WebCore::PushCrypto::validateP256DHPublicKey):
+(WebCore::PushCrypto::computeP256DHSharedSecret):
+(WebCore::PushCrypto::hmacSHA256):
+(WebCore::PushCrypto::decryptAES128GCM):
+* Modules/push-api/PushCrypto.h: Added.
+* Modules/push-api/PushManager.cpp:
+(WebCore::PushManager::subscribe):
+* Modules/push-api/PushMessageCrypto.cpp: Added.
+(WebCore::PushCrypto::ClientKeys::generate):
+(WebCore::PushCrypto::areClientKeyLengthsValid):
+(WebCore::PushCrypto::computeAES128GCMPaddingLength):
+(WebCore::PushCrypto::decryptAES128GCMPayload):
+(WebCore::PushCrypto::computeAESGCMPaddingLength):
+(WebCore::PushCrypto::decryptAESGCMPayload):
+* Modules/push-api/PushMessageCrypto.h: Added.
+* Modules/push-api/cocoa/PushCryptoCocoa.cpp: Added.
+(WebCore::PushCrypto::P256DHKeyPair::generate):
+(WebCore::PushCrypto::validateP256DHPublicKey):
+(WebCore::PushCrypto::computeP256DHSharedSecret):
+(WebCore::PushCrypto::hmacSHA256):
+(WebCore::PushCrypto::decryptAES128GCM):
+* Sources.txt:
+* SourcesCocoa.txt:
+* WebCore.xcodeproj/project.pbxproj:
+
 2021-12-13  Carlos Garcia Campos  
 
 [GTK][a11y] Handle the Embedded method sent by AtkSocket from AccessibilityRootAtspi


Modified: trunk/Source/WebCore/Headers.cmake (287014 => 287015)

--- trunk/Source/WebCore/Headers.cmake	2021-12-14 08:12:55 UTC (rev 287014)
+++ trunk/Source/WebCore/Headers.cmake	2021-12-14 08:18:02 UTC (rev 287015)
@@ -290,6 +290,8 @@
 Modules/permi

[webkit-changes] [286624] trunk/Source/WebKit

2021-12-07 Thread nham
Title: [286624] trunk/Source/WebKit








Revision 286624
Author n...@apple.com
Date 2021-12-07 14:51:38 -0800 (Tue, 07 Dec 2021)


Log Message
webpushd should run with regular user permissions
https://bugs.webkit.org/show_bug.cgi?id=233844

Reviewed by Brady Eidson.

Currently webpushd runs as root, which is unneessary. This patch makes it so that we run
with regular user permissions. This is done by specifying a UserName in the launchd plist on
iOS and by installing the plist to /System/Library/LaunchAgents on Mac. Since the plists now
differ based on platform, I changed the "Copy Daemon Plists" build phase in the WebKit
target to copy the appropriate plist to either /S/L/LaunchDaemons or /S/L/LaunchAgents.

Additionally, webpushd needs the `aps-connection-initiate` or
`com.apple.private.aps-connection-initiate` to receive pushes from apsd on iOS and Mac
respectively, so I gave the daemon those entitlements.

Finally, webpushd now registers for the `com.apple.aps.webkit.webpushd.incoming-push` Mach
service so that it can be launched on demand in response to a push. Right now we just
`bootstrap_check_in` to the service at launch time, but eventually we'll remove that and
use APSConnection to check in to the service instead. Since the `bootstrap_check_in`
call is temporary, I chose not to make a header file in wtf/spi and declared the prototype
in the implementation file instead.

* Configurations/webpushd.xcconfig:
* Scripts/process-entitlements.sh:
* WebKit.xcodeproj/project.pbxproj:
* webpushd/WebPushDaemonMain.mm:
(WebKit::WebPushDaemonMain):
* webpushd/com.apple.webkit.webpushd.ios.plist: Added.
* webpushd/com.apple.webkit.webpushd.mac.plist: Added.
* webpushd/com.apple.webkit.webpushd.plist: Removed.

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Configurations/webpushd.xcconfig
trunk/Source/WebKit/Scripts/process-entitlements.sh
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
trunk/Source/WebKit/webpushd/WebPushDaemonMain.mm


Added Paths

trunk/Source/WebKit/webpushd/com.apple.webkit.webpushd.ios.plist
trunk/Source/WebKit/webpushd/com.apple.webkit.webpushd.mac.plist


Removed Paths

trunk/Source/WebKit/webpushd/com.apple.webkit.webpushd.plist




Diff

Modified: trunk/Source/WebKit/ChangeLog (286623 => 286624)

--- trunk/Source/WebKit/ChangeLog	2021-12-07 22:31:12 UTC (rev 286623)
+++ trunk/Source/WebKit/ChangeLog	2021-12-07 22:51:38 UTC (rev 286624)
@@ -1,3 +1,36 @@
+2021-12-07  Ben Nham  
+
+webpushd should run with regular user permissions
+https://bugs.webkit.org/show_bug.cgi?id=233844
+
+Reviewed by Brady Eidson.
+
+Currently webpushd runs as root, which is unneessary. This patch makes it so that we run
+with regular user permissions. This is done by specifying a UserName in the launchd plist on
+iOS and by installing the plist to /System/Library/LaunchAgents on Mac. Since the plists now
+differ based on platform, I changed the "Copy Daemon Plists" build phase in the WebKit
+target to copy the appropriate plist to either /S/L/LaunchDaemons or /S/L/LaunchAgents.
+
+Additionally, webpushd needs the `aps-connection-initiate` or
+`com.apple.private.aps-connection-initiate` to receive pushes from apsd on iOS and Mac
+respectively, so I gave the daemon those entitlements.
+
+Finally, webpushd now registers for the `com.apple.aps.webkit.webpushd.incoming-push` Mach
+service so that it can be launched on demand in response to a push. Right now we just
+`bootstrap_check_in` to the service at launch time, but eventually we'll remove that and
+use APSConnection to check in to the service instead. Since the `bootstrap_check_in`
+call is temporary, I chose not to make a header file in wtf/spi and declared the prototype
+in the implementation file instead.
+
+* Configurations/webpushd.xcconfig:
+* Scripts/process-entitlements.sh:
+* WebKit.xcodeproj/project.pbxproj:
+* webpushd/WebPushDaemonMain.mm:
+(WebKit::WebPushDaemonMain):
+* webpushd/com.apple.webkit.webpushd.ios.plist: Added.
+* webpushd/com.apple.webkit.webpushd.mac.plist: Added.
+* webpushd/com.apple.webkit.webpushd.plist: Removed.
+
 2021-12-07  Chris Dumez  
 
 ASSERTION FAILED: m_messagesBeingDispatched.isEmpty() on http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html


Modified: trunk/Source/WebKit/Configurations/webpushd.xcconfig (286623 => 286624)

--- trunk/Source/WebKit/Configurations/webpushd.xcconfig	2021-12-07 22:31:12 UTC (rev 286623)
+++ trunk/Source/WebKit/Configurations/webpushd.xcconfig	2021-12-07 22:51:38 UTC (rev 286624)
@@ -28,7 +28,16 @@
 OTHER_LDFLAGS = -framework WebKit;
 LIBRARY_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR);
 
+// We want this to always be NO for non-simulator builds. If set to YES, Xcode will invoke codesign with a

[webkit-changes] [286044] trunk

2021-11-18 Thread nham
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
trunk/Source/WebCore/dom/EventNames.h
trunk/Source/WebCore/testing/Internals.cpp
trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp
trunk/Source/WebCore/testing/ServiceWorkerInternals.h
trunk/Source/WebCore/testing/ServiceWorkerInternals.idl
trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h
trunk/Source/WebCore/workers/service/context/SWContextManager.cpp
trunk/Source/WebCore/workers/service/context/SWContextManager.h
trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h
trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp
trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h


Added Paths

trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-push.https-expected.txt
trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-push.https.html
trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-pushsubscriptionchange.https-expected.txt
trunk/LayoutTests/http/wpt/service-workers/service-worker-spinning-pushsubscriptionchange.https.html




Diff

Modified: trunk/LayoutTests/ChangeLog (286043 => 286044)

--- trunk/LayoutTests/ChangeLog	2021-11-19 03:12:56 UTC (rev 286043)
+++ trunk/LayoutTests/ChangeLog	2021-11-19 04:18:12 UTC (rev 286044)
@@ -1,3 +1,35 @@
+2021-11-18  Ben Nham  
+
+Add support for onpushsubscriptionchange event handler
+https://bugs.webkit.org/show_bug.cgi?id=233088
+
+Reviewed by Youenn Fablet.
+
+ - Modified the pushsubscriptionchange test to send a real event to the service worker.
+ - Modified the service worker spinning tests to test for guarding against infinite loops in
+   the push and pushsubscriptionchange event handlers.
+
+Note that the existing spinning tests are marked as flaky on ios-wk2. We do the same here
+since the test passes locally but is flaky in EWS.
+
+* http/wpt/push-api/pushSubscriptionChangeEvent.any.js:
+(promise_test):
+(assertSubscriptionsAreEqual):
+(test): Deleted.
+(promise_test.async newSubscription): Deleted.
+(promise_test.async return): Deleted.
+* http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker-expected.txt:
+* http/wpt/service-workers/resources/routines.js:
+(async sendSyncMessage):
+* http/wpt/service-workers/service-worker-spinning-push.https-expected.txt: Added.
+* http/wpt/service-workers/service-worker-spinning-push.https.html: Added.
+* http/wpt/service-workers/service-worker-spinning-pushsubscriptionchange.https-expected.txt: Added.
+* http/wpt/service-workers/service-worker-spinning-pushsubscriptionchange.https.html: Added.
+* http/wpt/service-workers/service-worker-spinning-worker.js:
+(respondToPendingEvent):
+(pushTest):
+* platform/ios-simulator-wk2/TestExpectations:
+
 2021-11-18  Wenson Hsieh  
 
 [macOS] [Live Text] Avoid analyzing images in editable content


Modified: trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.js (286043 => 286044)

--- trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.js	2021-11-19 03:12:56 UTC (rev 286043)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.js	2021-11-19 04:18:12 UTC (rev 286044)
@@ -2,27 +2,23 @@
 // META: global=serviceworker
 // META: script=constants.js
 
-test(() => {
-let event = new PushSubscriptionChangeEvent("pushsubscriptionchange");
-assert_equals(event.newSubscription, null, "new");
-assert_equals(event.oldSubscription, null, "old");
-}, "PushSubscriptionChangeEvent without data");
+let activatePromise = new Promise(resolve => self._onactivate_ = resolve);
+promise_test(() => {
+   return activatePromise;
+}, "wait for active service worker");
 
-test(() => {
-let event = new PushSubscriptionChangeEvent("pushsubscriptionchange", { newSubscription: null, oldSubscription: null });
-assert_equals(event.newSubscription, null, "new");
-assert_equals(event.oldSubscription, null, "old");
-}, "PushSubscriptionChangeEvent without subscriptions");
-
 let newSubscription = null;
 let oldSubscription = null;
 
-let activatePromise = new Promise(resolve => self._onactivate_ = resolve);
-promise_test(async () => {
-   return activatePromise;
-}, "wait for active service worker");
+function assertSubscriptionsAreEqual(a, b, reason)
+{
+if (!a || !b)
+assert_equals(a, b, reason);
+else
+assert_equals(JSON.stringify(a.toJSON()), JSON.stringify(b.toJSON()), reason);
+}
 
-promise_test(async() => {
+promise_test(() => {
 newSubscript

[webkit-changes] [285648] trunk/Source

2021-11-11 Thread nham
Title: [285648] trunk/Source








Revision 285648
Author n...@apple.com
Date 2021-11-11 12:40:58 -0800 (Thu, 11 Nov 2021)


Log Message
Log memory usage metadata when WebContent crosses critical or warning level memory thresholds
https://bugs.webkit.org/show_bug.cgi?id=232976

Reviewed by Darin Adler.

Source/WebCore:

WebCore::logMemoryStatistics was changed to:

 - Emit VM tag names as public strings to the log. There isn't anything privacy sensitive
   about our 256 fixed VM tags, and emitting them to the logs as as private string (as we
   were doing before) made those log lines useless.
 - Use WebCore::memoryUsageStatistics to gather memory metadata, since other WebCore
   callsites were already using that and it reduces code duplication.
 - Only log JS object type counts on internal OS builds. Previously we also logged those
   counts on public OS builds, but that was useless since all the class names were redacted
   in the log.

* page/MemoryRelease.cpp:
(WebCore::logMemoryStatistics):
(WebCore::logMemoryStatisticsReasonDescription):
(WebCore::pageCount): Deleted.
(WebCore::logMemoryStatisticsAtTimeOfDeath): Deleted.
* page/MemoryRelease.h:
* page/PerformanceLogging.cpp:
(WebCore::PerformanceLogging::memoryUsageStatistics):
(WebCore::PerformanceLogging::didReachPointOfInterest):
* page/PerformanceLogging.h:
* page/cocoa/PerformanceLoggingCocoa.mm:
(WebCore::PerformanceLogging::getPlatformMemoryUsageStatistics):

Source/WebKit:

Added callbacks to log memory usage metadata the first time a process hits these milestones:

 - exceeded inactive memory limit while active (on Mac)
 - exceeded warning process limit threshold (on other non-Mac Apple platforms)
 - exceeded critical process limit threshold (on other non-Mac Apple platforms)

The reason for this is we  receive a large number of out of memory reports with very little
info in the logs. We want to log more metadata about memory usage (similar to what we do on
Mac in `WebCore::logMemoryStatisticsAtTimeOfDeath`) to help us debug those reports.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/WebProcess.h:

Source/WTF:

Fixed several issues with memory usage tracking:

 - pagesPerVMTag now properly accounts for swapped-out pages in its footprint calculation,
   as footprint(1) already does.
 - displayNamePerVMTag now includes all of the most common VM tags associated with WebKit.
 - MemoryPressureHandler now knows the specific type of pressure event that occurred. This
   allows it to differentiate between the entire system being at a warning pressure level
   vs. just this process hitting its warning memory level limit.

* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setMemoryPressureStatus):
(WTF::MemoryPressureHandler::memoryPressureStatusChanged):
(WTF::MemoryPressureHandler::setUnderMemoryPressure): Deleted.
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
(WTF::MemoryPressureHandler::isUnderMemoryPressure const):
* wtf/ResourceUsage.h:
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
* wtf/cocoa/ResourceUsageCocoa.cpp:
(WTF::displayNameForVMTag):
(WTF::pagesPerVMTag):
* wtf/unix/MemoryPressureHandlerUnix.cpp:
(WTF::MemoryPressureHandler::triggerMemoryPressureEvent):
* wtf/win/MemoryPressureHandlerWin.cpp:
(WTF::MemoryPressureHandler::windowsMeasurementTimerFired):

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/MemoryPressureHandler.cpp
trunk/Source/WTF/wtf/MemoryPressureHandler.h
trunk/Source/WTF/wtf/ResourceUsage.h
trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm
trunk/Source/WTF/wtf/cocoa/ResourceUsageCocoa.cpp
trunk/Source/WTF/wtf/unix/MemoryPressureHandlerUnix.cpp
trunk/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/page/MemoryRelease.cpp
trunk/Source/WebCore/page/MemoryRelease.h
trunk/Source/WebCore/page/PerformanceLogging.cpp
trunk/Source/WebCore/page/PerformanceLogging.h
trunk/Source/WebCore/page/cocoa/PerformanceLoggingCocoa.mm
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/WebProcess.cpp
trunk/Source/WebKit/WebProcess/WebProcess.h




Diff

Modified: trunk/Source/WTF/ChangeLog (285647 => 285648)

--- trunk/Source/WTF/ChangeLog	2021-11-11 20:39:35 UTC (rev 285647)
+++ trunk/Source/WTF/ChangeLog	2021-11-11 20:40:58 UTC (rev 285648)
@@ -1,3 +1,37 @@
+2021-11-11  Ben Nham  
+
+Log memory usage metadata when WebContent crosses critical or warning level memory thresholds
+https://bugs.webkit.org/show_bug.cgi?id=232976
+
+Reviewed by Darin Adler.
+
+Fixed several issues with memory usage tracking:
+
+ - pagesPerVMTag now properly accounts for swapped-out pages in its footprint calculation,
+   as footprint(1) already does.
+ - displayNamePerVMTag now includes all of the most common VM tags associated with WebKit.
+ - MemoryPressureHandler 

[webkit-changes] [285564] trunk

2021-11-09 Thread nham
/project.pbxproj
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
trunk/Source/WebCore/dom/EventNames.in
trunk/Source/WebCore/testing/Internals.cpp
trunk/Source/WebCore/testing/Internals.h
trunk/Source/WebCore/testing/Internals.idl
trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp
trunk/Source/WebCore/testing/ServiceWorkerInternals.h
trunk/Source/WebCore/testing/ServiceWorkerInternals.idl
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl


Added Paths

trunk/LayoutTests/http/wpt/push-api/constants.js
trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker-expected.txt
trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker.html
trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.js
trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker-expected.txt
trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker.html
trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.cpp
trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.h
trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.idl
trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.h
trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.idl




Diff

Modified: trunk/LayoutTests/ChangeLog (285563 => 285564)

--- trunk/LayoutTests/ChangeLog	2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/LayoutTests/ChangeLog	2021-11-10 05:23:04 UTC (rev 285564)
@@ -1,3 +1,33 @@
+2021-11-09  Ben Nham  
+
+Add support for PushSubscriptionChangeEvent
+https://bugs.webkit.org/show_bug.cgi?id=232455
+
+Reviewed by Youenn Fablet.
+
+Added PushSubscriptionChangeEvent tests and made PushSubscription tests also run in the
+service worker context.
+
+* http/wpt/push-api/constants.js: Added.
+(bytesFrom):
+* http/wpt/push-api/pushManager.any.js:
+* http/wpt/push-api/pushSubscription.https.any-expected.txt:
+* http/wpt/push-api/pushSubscription.https.any.js:
+(GLOBAL.isWorker):
+(async promise_test):
+(bytesFrom): Deleted.
+(promise_test.async test): Deleted.
+(promise_test): Deleted.
+* http/wpt/push-api/pushSubscription.https.any.serviceworker-expected.txt: Added.
+* http/wpt/push-api/pushSubscription.https.any.serviceworker.html: Added.
+* http/wpt/push-api/pushSubscriptionChangeEvent.any.js: Added.
+(test):
+(promise_test.async newSubscription):
+(promise_test.async return):
+(promise_test):
+* http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker-expected.txt: Added.
+* http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker.html: Added.
+
 2021-11-09  Jean-Yves Avenard  
 
 Unreviewed test gardening, skip failing test.


Added: trunk/LayoutTests/http/wpt/push-api/constants.js (0 => 285564)

--- trunk/LayoutTests/http/wpt/push-api/constants.js	(rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/constants.js	2021-11-10 05:23:04 UTC (rev 285564)
@@ -0,0 +1,21 @@
+const ENDPOINT = 'https://www.webkit.org';
+const EXPIRATION_TIME = 163300;
+
+const CLIENT_BASE64_KEY_1 = 'BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs';
+const CLIENT_KEY_1 = new Uint8Array([4, 13, 71, 199, 60, 162, 213, 21, 12, 213, 190, 112, 143, 27, 39, 238, 113, 177, 2, 204, 240, 218, 238, 181, 155, 94, 184, 139, 115, 43, 0, 140, 71, 23, 166, 10, 230, 30, 18, 13, 136, 156, 249, 212, 110, 83, 244, 66, 60, 39, 192, 229, 170, 189, 162, 52, 176, 147, 150, 54, 18, 96, 165, 4, 251]).buffer;
+
+const CLIENT_BASE64_KEY_2 = 'BCVxsr7N_eNgVRqvHtD0zTZsEc6-VV-JvLexhqUzORcxaOzi6-AYWXvTBHm4bjyPjs7Vd8pZGH6SRpkNtoIAiw4';
+const CLIENT_KEY_2 = new Uint8Array([4, 37, 113, 178, 190, 205, 253, 227, 96, 85, 26, 175, 30, 208, 244, 205, 54, 108, 17, 206, 190, 85, 95, 137, 188, 183, 177, 134, 165, 51, 57, 23, 49, 104, 236, 226, 235, 224, 24, 89, 123, 211, 4, 121, 184, 110, 60, 143, 142, 206, 213, 119, 202, 89, 24, 126, 146, 70, 153, 13, 182, 130, 0, 139, 14]).buffer;
+
+const BASE64_AUTH = 'BTBZMqHH6r4Tts7J_aSIgg';
+const AUTH = new Uint8Array([5, 48, 89, 50, 161, 199, 234, 190, 19, 182, 206, 201, 253, 164, 136, 130]).buffer;
+
+const INVALID_SERVER_KEY = new Uint8Array(new Array(65).fill(4)).buffer;
+const INVALID_BASE64_SERVER_KEY = "BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ";
+
+const VALID_BASE64_SERVER_KEY = "BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs";
+const VALID_SERVER_KEY = new Uint8Array([4, 13, 71, 199, 60, 162, 213, 21, 12, 213, 190, 112, 143, 27, 39, 238, 113, 177, 2, 204, 240, 218, 238, 181, 155, 94, 184, 139, 115, 43, 0, 140, 71, 23, 166, 10, 230, 30, 18, 13, 136, 156, 249,

[webkit-changes] [284518] trunk

2021-10-19 Thread nham
ervice/ServiceWorkerContainer.cpp
trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl
trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp
trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in
trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h


Added Paths

trunk/LayoutTests/http/wpt/push-api/emptyWorker.js
trunk/Source/WebCore/Modules/push-api/PushSubscriptionData.cpp
trunk/Source/WebCore/Modules/push-api/PushSubscriptionData.h


Removed Paths

trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js




Diff

Modified: trunk/LayoutTests/ChangeLog (284517 => 284518)

--- trunk/LayoutTests/ChangeLog	2021-10-20 04:49:28 UTC (rev 284517)
+++ trunk/LayoutTests/ChangeLog	2021-10-20 05:16:30 UTC (rev 284518)
@@ -1,3 +1,21 @@
+2021-10-19  Ben Nham  
+
+Add NetworkProcess stubs for push subscriptions
+https://bugs.webkit.org/show_bug.cgi?id=231922
+
+Reviewed by Youenn Fablet.
+
+Modify PushSubscription tests to pass in a ServiceWorkerRegistration.
+
+* http/wpt/push-api/emptyWorker.js: Renamed from LayoutTests/http/wpt/push-api/pushManager-worker.js.
+* http/wpt/push-api/pushManager.any.js:
+(else.promise_test.async test):
+* http/wpt/push-api/pushSubscription.https.any-expected.txt:
+* http/wpt/push-api/pushSubscription.https.any.js:
+(promise_test.async test):
+(promise_test):
+(test): Deleted.
+
 2021-10-19  Chris Dumez  
 
 Resync COOP /COEP WPT tests from upstream WPT


Copied: trunk/LayoutTests/http/wpt/push-api/emptyWorker.js (from rev 284517, trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js) (0 => 284518)

--- trunk/LayoutTests/http/wpt/push-api/emptyWorker.js	(rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/emptyWorker.js	2021-10-20 05:16:30 UTC (rev 284518)
@@ -0,0 +1 @@
+// This service worker script is intentionally left blank.
\ No newline at end of file


Deleted: trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js (284517 => 284518)

--- trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js	2021-10-20 04:49:28 UTC (rev 284517)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js	2021-10-20 05:16:30 UTC (rev 284518)
@@ -1 +0,0 @@
-// This service worker script is intentionally left blank.
\ No newline at end of file


Modified: trunk/LayoutTests/http/wpt/push-api/pushManager.any.js (284517 => 284518)

--- trunk/LayoutTests/http/wpt/push-api/pushManager.any.js	2021-10-20 04:49:28 UTC (rev 284517)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any.js	2021-10-20 05:16:30 UTC (rev 284518)
@@ -34,7 +34,7 @@
 if (registration) {
 await serviceWorkerRegistration.unregister();
 }
-registration = await navigator.serviceWorker.register("pushManager-worker.js");
+registration = await navigator.serviceWorker.register("emptyWorker.js");
 pushManager = registration.pushManager;
 
 let serviceWorker = registration.installing;


Modified: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt (284517 => 284518)

--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt	2021-10-20 04:49:28 UTC (rev 284517)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt	2021-10-20 05:16:30 UTC (rev 284518)
@@ -1,3 +1,5 @@
 
+PASS wait for active service worker
 PASS PushSubscription getters
+PASS unregister service worker
 


Modified: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js (284517 => 284518)

--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js	2021-10-20 04:49:28 UTC (rev 284517)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js	2021-10-20 05:16:30 UTC (rev 284518)
@@ -14,17 +14,37 @@
 return Array.from(new Uint8Array(buf));
 }
 
-test(() => {
+let registration = null;
+
+promise_test(async (test) => {
+registration = await navigator.serviceWorker.getRegistration();
+if (registration) {
+await serviceWorkerRegistration.unregister();
+}
+registration = await navigator.serviceWorker.register("emptyWorker.js");
+assert_true(!registration.active, "service worker should be installing");
+
+let serviceWorker = registration.installing || registration.waiting;
+assert_true(!!serviceWorker, "registration shou

[webkit-changes] [284511] trunk/Source/WebCore

2021-10-19 Thread nham
Title: [284511] trunk/Source/WebCore








Revision 284511
Author n...@apple.com
Date 2021-10-19 17:16:38 -0700 (Tue, 19 Oct 2021)


Log Message
Unreviewed build fix for non-unified build.

* Modules/webaudio/RealtimeAnalyser.h:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (284510 => 284511)

--- trunk/Source/WebCore/ChangeLog	2021-10-19 23:56:15 UTC (rev 284510)
+++ trunk/Source/WebCore/ChangeLog	2021-10-20 00:16:38 UTC (rev 284511)
@@ -1,3 +1,9 @@
+2021-10-19  Ben Nham  
+
+Unreviewed build fix for non-unified build.
+
+* Modules/webaudio/RealtimeAnalyser.h:
+
 2021-10-19  Alexey Proskuryakov  
 
 Eagerly resolve python3 path in Makefiles


Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h (284510 => 284511)

--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h	2021-10-19 23:56:15 UTC (rev 284510)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h	2021-10-20 00:16:38 UTC (rev 284511)
@@ -25,6 +25,7 @@
 #pragma once
 
 #include "AudioArray.h"
+#include "AudioBus.h"
 #include <_javascript_Core/Forward.h>
 #include 
 #include 
@@ -32,7 +33,6 @@
 
 namespace WebCore {
 
-class AudioBus;
 class FFTFrame;
 
 class RealtimeAnalyser {






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [283916] trunk

2021-10-11 Thread nham
Title: [283916] trunk








Revision 283916
Author n...@apple.com
Date 2021-10-11 11:38:26 -0700 (Mon, 11 Oct 2021)


Log Message
Add push registration stubs
https://bugs.webkit.org/show_bug.cgi?id=231064

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Update test results after importing PushManager-related IDL.

* web-platform-tests/push-api/idlharness.https.any-expected.txt:
* web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt:
* web-platform-tests/push-api/idlharness.https.any.worker-expected.txt:

Source/WebCore:

Import IDL related to PushManager and implement steps 1-7 of the subscribe method as
described in https://www.w3.org/TR/push-api/#pushmanager-interface. Further steps will be
implemented in future patches.

Tests: http/wpt/push-api/pushManager.any.html
   http/wpt/push-api/pushManager.any.serviceworker.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/push-api/PushManager.cpp: Added.
(WebCore::PushManager::PushManager):
(WebCore::PushManager::supportedContentEncodings):
(WebCore::PushManager::ref const):
(WebCore::PushManager::deref const):
(WebCore::PushManager::subscribe):
(WebCore::PushManager::getSubscription):
(WebCore::PushManager::permissionState):
* Modules/push-api/PushManager.h: Added.
* Modules/push-api/PushManager.idl: Added.
* Modules/push-api/PushPermissionState.h: Added.
* Modules/push-api/PushPermissionState.idl: Added.
* Modules/push-api/ServiceWorkerRegistration+PushAPI.idl: Added.
* Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp: Added.
(WebCore::ServiceWorkerRegistrationPushAPI::ServiceWorkerRegistrationPushAPI):
(WebCore::ServiceWorkerRegistrationPushAPI::pushManager):
(WebCore::ServiceWorkerRegistrationPushAPI::from):
(WebCore::ServiceWorkerRegistrationPushAPI::supplementName):
* Modules/push-api/ServiceWorkerRegistrationPushAPI.h: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* workers/service/ServiceWorkerRegistration.h:

LayoutTests:

Add basic tests for PushManager.subscribe in both the window and service worker contexts.

* http/wpt/push-api/pushManager-worker.js: Added.
* http/wpt/push-api/pushManager.any-expected.txt: Added.
* http/wpt/push-api/pushManager.any.html: Added.
* http/wpt/push-api/pushManager.any.js: Added.
(isServiceWorker.promise_test.async test):
(else.promise_test.async test):
(promise_test.async test):
* http/wpt/push-api/pushManager.any.serviceworker-expected.txt: Added.
* http/wpt/push-api/pushManager.any.serviceworker.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/imported/w3c/ChangeLog
trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any-expected.txt
trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt
trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt
trunk/Source/WebCore/CMakeLists.txt
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/DerivedSources-input.xcfilelist
trunk/Source/WebCore/DerivedSources-output.xcfilelist
trunk/Source/WebCore/DerivedSources.make
trunk/Source/WebCore/Sources.txt
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h


Added Paths

trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js
trunk/LayoutTests/http/wpt/push-api/pushManager.any-expected.txt
trunk/LayoutTests/http/wpt/push-api/pushManager.any.html
trunk/LayoutTests/http/wpt/push-api/pushManager.any.js
trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker-expected.txt
trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker.html
trunk/Source/WebCore/Modules/push-api/PushManager.cpp
trunk/Source/WebCore/Modules/push-api/PushManager.h
trunk/Source/WebCore/Modules/push-api/PushManager.idl
trunk/Source/WebCore/Modules/push-api/PushPermissionState.h
trunk/Source/WebCore/Modules/push-api/PushPermissionState.idl
trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl
trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp
trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.h




Diff

Modified: trunk/LayoutTests/ChangeLog (283915 => 283916)

--- trunk/LayoutTests/ChangeLog	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/LayoutTests/ChangeLog	2021-10-11 18:38:26 UTC (rev 283916)
@@ -1,3 +1,22 @@
+2021-10-11  Ben Nham  
+
+Add push registration stubs
+https://bugs.webkit.org/show_bug.cgi?id=231064
+
+Reviewed by Youenn Fablet.
+
+Add basic tests for PushManager.subscribe in both the window and service worker contexts.
+
+* http/wpt/push-api/pushManager-worker.js: Added.
+* http/wpt/push-api/pushManager.any-expected.txt: Added.
+* http/wpt/push-api/pushManager.any.html: Ad

[webkit-changes] [283846] trunk/Source/WebKit

2021-10-08 Thread nham
Title: [283846] trunk/Source/WebKit








Revision 283846
Author n...@apple.com
Date 2021-10-08 15:57:14 -0700 (Fri, 08 Oct 2021)


Log Message
Fix crash in NetworkProcess preconnect due to dereferencing deallocated session
https://bugs.webkit.org/show_bug.cgi?id=231456


Reviewed by Chris Dumez.

We capture a raw NetworkSession reference in the preconnect completion handler. This
reference could point to a deallocated object if the NetworkSession dies before the
preconnect finishes.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp




Diff

Modified: trunk/Source/WebKit/ChangeLog (283845 => 283846)

--- trunk/Source/WebKit/ChangeLog	2021-10-08 22:43:49 UTC (rev 283845)
+++ trunk/Source/WebKit/ChangeLog	2021-10-08 22:57:14 UTC (rev 283846)
@@ -1,3 +1,18 @@
+2021-10-08  Ben Nham  
+
+Fix crash in NetworkProcess preconnect due to dereferencing deallocated session
+https://bugs.webkit.org/show_bug.cgi?id=231456
+
+
+Reviewed by Chris Dumez.
+
+We capture a raw NetworkSession reference in the preconnect completion handler. This
+reference could point to a deallocated object if the NetworkSession dies before the
+preconnect finishes.
+
+* NetworkProcess/NetworkProcess.cpp:
+(WebKit::NetworkProcess::preconnectTo):
+
 2021-10-08  John Pascoe  
 
 Update getAllLocalAuthenticatorCredentials query according to internal needs


Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (283845 => 283846)

--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2021-10-08 22:43:49 UTC (rev 283845)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2021-10-08 22:57:14 UTC (rev 283846)
@@ -1388,8 +1388,9 @@
 parameters.shouldPreconnectOnly = PreconnectOnly::Yes;
 
 networkSession->networkLoadScheduler().startedPreconnectForMainResource(url, userAgent);
-auto task = new PreconnectTask(*networkSession, WTFMove(parameters), [networkSession, url, userAgent](const WebCore::ResourceError& error) {
-networkSession->networkLoadScheduler().finishedPreconnectForMainResource(url, userAgent, error);
+auto task = new PreconnectTask(*networkSession, WTFMove(parameters), [weakNetworkSession = makeWeakPtr(*networkSession), url, userAgent](const WebCore::ResourceError& error) {
+if (weakNetworkSession)
+weakNetworkSession->networkLoadScheduler().finishedPreconnectForMainResource(url, userAgent, error);
 });
 task->setTimeout(10_s);
 task->start();






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [283700] trunk

2021-10-06 Thread nham
Title: [283700] trunk








Revision 283700
Author n...@apple.com
Date 2021-10-06 21:15:05 -0700 (Wed, 06 Oct 2021)


Log Message
Add PushSubscription stubs
https://bugs.webkit.org/show_bug.cgi?id=231278

Reviewed Alex Christensen.

LayoutTests/imported/w3c:

Updated the WPT test results to reflect the newly implemented interfaces.


* web-platform-tests/push-api/idlharness.https.any-expected.txt:
* web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt:

Source/WebCore:

This adds PushSubscription-related IDL to WebCore. Currently the objects are just data
containers and PushSubscription.unsubscribe() does nothing.

Test: http/wpt/push-api/pushSubscription.https.any.html


* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/push-api/PushEncryptionKeyName.h: Added.
* Modules/push-api/PushEncryptionKeyName.idl: Added.
* Modules/push-api/PushSubscription.cpp: Added.
(WebCore::PushSubscription::create):
(WebCore::PushSubscription::PushSubscription):
(WebCore::PushSubscription::endpoint const):
(WebCore::PushSubscription::expirationTime const):
(WebCore::PushSubscription::options const):
(WebCore::PushSubscription::getKey const):
(WebCore::PushSubscription::unsubscribe):
(WebCore::PushSubscription::toJSON const):
* Modules/push-api/PushSubscription.h: Added.
* Modules/push-api/PushSubscription.idl: Added.
* Modules/push-api/PushSubscriptionJSON.h: Added.
* Modules/push-api/PushSubscriptionJSON.idl: Added.
* Modules/push-api/PushSubscriptionOptions.cpp: Added.
(WebCore::PushSubscriptionOptions::create):
(WebCore::PushSubscriptionOptions::PushSubscriptionOptions):
(WebCore::PushSubscriptionOptions::userVisibleOnly const):
(WebCore::PushSubscriptionOptions::serverVAPIDPublicKey const):
(WebCore::PushSubscriptionOptions::applicationServerKey const):
* Modules/push-api/PushSubscriptionOptions.h: Added.
* Modules/push-api/PushSubscriptionOptions.idl: Added.
* Modules/push-api/PushSubscriptionOptionsInit.h: Added.
* Modules/push-api/PushSubscriptionOptionsInit.idl: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* testing/Internals.cpp:
(WebCore::Internals::createPushSubscription):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Added a basic test for PushSubscription. Right now the test only runs in the window global
scope because it relies on a constructor called via window.internals. I'll add more test
cases and test it in the worker scope as well once we change the test to create a
subscription via a mocked PushManager.subscribe call instead.


* http/wpt/push-api/pushSubscription.https.any-expected.txt: Added.
* http/wpt/push-api/pushSubscription.https.any.html: Added.
* http/wpt/push-api/pushSubscription.https.any.js: Added.
(bytesFrom):
(test):

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/imported/w3c/ChangeLog
trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any-expected.txt
trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt
trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt
trunk/Source/WebCore/CMakeLists.txt
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/DerivedSources-input.xcfilelist
trunk/Source/WebCore/DerivedSources-output.xcfilelist
trunk/Source/WebCore/DerivedSources.make
trunk/Source/WebCore/Sources.txt
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
trunk/Source/WebCore/testing/Internals.cpp
trunk/Source/WebCore/testing/Internals.h
trunk/Source/WebCore/testing/Internals.idl


Added Paths

trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt
trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.html
trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js
trunk/Source/WebCore/Modules/push-api/PushEncryptionKeyName.h
trunk/Source/WebCore/Modules/push-api/PushEncryptionKeyName.idl
trunk/Source/WebCore/Modules/push-api/PushSubscription.cpp
trunk/Source/WebCore/Modules/push-api/PushSubscription.h
trunk/Source/WebCore/Modules/push-api/PushSubscription.idl
trunk/Source/WebCore/Modules/push-api/PushSubscriptionJSON.h
trunk/Source/WebCore/Modules/push-api/PushSubscriptionJSON.idl
trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.cpp
trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.h
trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.idl
trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptionsInit.h
trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptionsInit.idl




Diff

Modified: trunk/LayoutTests/ChangeLog (283699 => 283700)

--- trunk/LayoutTests/ChangeLog	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/LayoutTests/ChangeLog	2021-10-07 04:15:05 UTC (rev 283700)
@@ -1,3 +1,21 @@
+2021-10-06  Ben Nham  
+
+Add PushSubscription st

[webkit-changes] [283648] trunk/Source/WebCore

2021-10-06 Thread nham
Title: [283648] trunk/Source/WebCore








Revision 283648
Author n...@apple.com
Date 2021-10-06 13:05:50 -0700 (Wed, 06 Oct 2021)


Log Message
WaveShaperProcessor missing JSTypedArrays include

Unreviewed build fix.

The missing include can cause a build failure when adding a new file to Sources.txt.

* Modules/webaudio/WaveShaperProcessor.cpp:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (283647 => 283648)

--- trunk/Source/WebCore/ChangeLog	2021-10-06 19:52:49 UTC (rev 283647)
+++ trunk/Source/WebCore/ChangeLog	2021-10-06 20:05:50 UTC (rev 283648)
@@ -1,5 +1,15 @@
 2021-10-06  Ben Nham  
 
+WaveShaperProcessor missing JSTypedArrays include
+
+Unreviewed build fix.
+
+The missing include can cause a build failure when adding a new file to Sources.txt.
+
+* Modules/webaudio/WaveShaperProcessor.cpp:
+
+2021-10-06  Ben Nham  
+
 WaveShaperProcessor missing ArrayBuffer include
 
 Unreviewed build fix.


Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp (283647 => 283648)

--- trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp	2021-10-06 19:52:49 UTC (rev 283647)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp	2021-10-06 20:05:50 UTC (rev 283648)
@@ -29,7 +29,7 @@
 #include "WaveShaperProcessor.h"
 
 #include "WaveShaperDSPKernel.h"
-#include <_javascript_Core/ArrayBuffer.h>
+#include <_javascript_Core/JSTypedArrays.h>
 
 namespace WebCore {
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [283644] trunk/Source/WebCore

2021-10-06 Thread nham
Title: [283644] trunk/Source/WebCore








Revision 283644
Author n...@apple.com
Date 2021-10-06 12:04:03 -0700 (Wed, 06 Oct 2021)


Log Message
WaveShaperProcessor missing ArrayBuffer include

Unreviewed build fix.

The missing include can cause a build failure when adding a new file to Sources.txt.

* Modules/webaudio/WaveShaperProcessor.cpp:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (283643 => 283644)

--- trunk/Source/WebCore/ChangeLog	2021-10-06 18:58:05 UTC (rev 283643)
+++ trunk/Source/WebCore/ChangeLog	2021-10-06 19:04:03 UTC (rev 283644)
@@ -1,3 +1,13 @@
+2021-10-06  Ben Nham  
+
+WaveShaperProcessor missing ArrayBuffer include
+
+Unreviewed build fix.
+
+The missing include can cause a build failure when adding a new file to Sources.txt.
+
+* Modules/webaudio/WaveShaperProcessor.cpp:
+
 2021-10-06  Simon Fraser  
 
 Unreviewed build fix.


Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp (283643 => 283644)

--- trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp	2021-10-06 18:58:05 UTC (rev 283643)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp	2021-10-06 19:04:03 UTC (rev 283644)
@@ -29,6 +29,7 @@
 #include "WaveShaperProcessor.h"
 
 #include "WaveShaperDSPKernel.h"
+#include <_javascript_Core/ArrayBuffer.h>
 
 namespace WebCore {
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [283521] trunk/Source/WebCore

2021-10-04 Thread nham
Title: [283521] trunk/Source/WebCore








Revision 283521
Author n...@apple.com
Date 2021-10-04 16:04:33 -0700 (Mon, 04 Oct 2021)


Log Message
RemotePlayback missing forward declaration of Node
https://bugs.webkit.org/show_bug.cgi?id=231193

Unreviewed build fix.

The missing forward declaration was introduced in r279443 and can cause a
build failure when adding a new file to Sources.txt.


* Modules/remoteplayback/RemotePlayback.h:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (283520 => 283521)

--- trunk/Source/WebCore/ChangeLog	2021-10-04 22:50:19 UTC (rev 283520)
+++ trunk/Source/WebCore/ChangeLog	2021-10-04 23:04:33 UTC (rev 283521)
@@ -1,3 +1,15 @@
+2021-10-04  Ben Nham  
+
+RemotePlayback missing forward declaration of Node
+https://bugs.webkit.org/show_bug.cgi?id=231193
+
+Unreviewed build fix.
+
+The missing forward declaration was introduced in r279443 and can cause a
+build failure when adding a new file to Sources.txt.
+
+* Modules/remoteplayback/RemotePlayback.h:
+
 2021-10-04  John Pascoe  
 
 [WebAuthn] Prefer internal user verification if available over pin entry.


Modified: trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.h (283520 => 283521)

--- trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.h	2021-10-04 22:50:19 UTC (rev 283520)
+++ trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.h	2021-10-04 23:04:33 UTC (rev 283521)
@@ -38,6 +38,7 @@
 class DeferredPromise;
 class HTMLMediaElement;
 class MediaPlaybackTarget;
+class Node;
 class RemotePlaybackAvailabilityCallback;
 
 class RemotePlayback final : public RefCounted, public ActiveDOMObject, public EventTargetWithInlineData {






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [283081] trunk/Source/WebKit

2021-09-25 Thread nham
Title: [283081] trunk/Source/WebKit








Revision 283081
Author n...@apple.com
Date 2021-09-25 09:12:26 -0700 (Sat, 25 Sep 2021)


Log Message
Pending preconnect key should include User-Agent
https://bugs.webkit.org/show_bug.cgi?id=230565

Reviewed by Chris Dumez.

When using an HTTPS proxy, the HTTP connection cache key used for connection coalescing in
CFNetwork includes the User-Agent (). This means we should also
include it in the preconnect cache key. Otherwise, we might delay the main resource load on
preconnect unnecessarily in cases where the User-Agent mismatches and the preconnect gets
thrown away. This can happen if (for instance) a page is force-loaded into desktop or mobile
mode on iOS, which causes a UA change after the call to decidePolicyForNavigationAction.

* NetworkProcess/NetworkLoadScheduler.cpp:
(WebKit::mainResourceLoadKey):
(WebKit::NetworkLoadScheduler::scheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::unscheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::startedPreconnectForMainResource):
(WebKit::NetworkLoadScheduler::finishedPreconnectForMainResource):
* NetworkProcess/NetworkLoadScheduler.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkLoadScheduler.cpp
trunk/Source/WebKit/NetworkProcess/NetworkLoadScheduler.h
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp




Diff

Modified: trunk/Source/WebKit/ChangeLog (283080 => 283081)

--- trunk/Source/WebKit/ChangeLog	2021-09-25 15:47:55 UTC (rev 283080)
+++ trunk/Source/WebKit/ChangeLog	2021-09-25 16:12:26 UTC (rev 283081)
@@ -1,3 +1,27 @@
+2021-09-25  Ben Nham  
+
+Pending preconnect key should include User-Agent
+https://bugs.webkit.org/show_bug.cgi?id=230565
+
+Reviewed by Chris Dumez.
+
+When using an HTTPS proxy, the HTTP connection cache key used for connection coalescing in
+CFNetwork includes the User-Agent (). This means we should also
+include it in the preconnect cache key. Otherwise, we might delay the main resource load on
+preconnect unnecessarily in cases where the User-Agent mismatches and the preconnect gets
+thrown away. This can happen if (for instance) a page is force-loaded into desktop or mobile
+mode on iOS, which causes a UA change after the call to decidePolicyForNavigationAction.
+
+* NetworkProcess/NetworkLoadScheduler.cpp:
+(WebKit::mainResourceLoadKey):
+(WebKit::NetworkLoadScheduler::scheduleMainResourceLoad):
+(WebKit::NetworkLoadScheduler::unscheduleMainResourceLoad):
+(WebKit::NetworkLoadScheduler::startedPreconnectForMainResource):
+(WebKit::NetworkLoadScheduler::finishedPreconnectForMainResource):
+* NetworkProcess/NetworkLoadScheduler.h:
+* NetworkProcess/NetworkProcess.cpp:
+(WebKit::NetworkProcess::preconnectTo):
+
 2021-09-24  Lauro Moura  
 
 Non-unified partial build fixes late September edition


Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoadScheduler.cpp (283080 => 283081)

--- trunk/Source/WebKit/NetworkProcess/NetworkLoadScheduler.cpp	2021-09-25 15:47:55 UTC (rev 283080)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoadScheduler.cpp	2021-09-25 16:12:26 UTC (rev 283081)
@@ -153,6 +153,13 @@
 context->unschedule(load);
 }
 
+// We add User-Agent to the preconnect key since it part of the HTTP connection cache key used for
+// coalescing sockets in CFNetwork when using an HTTPS proxy ().
+static std::tuple mainResourceLoadKey(const String& protocolHostAndPort, const String& userAgent)
+{
+return std::make_tuple(protocolHostAndPort.isNull() ? emptyString() : protocolHostAndPort, userAgent.isNull() ? emptyString() : userAgent);
+}
+
 void NetworkLoadScheduler::scheduleMainResourceLoad(NetworkLoad& load)
 {
 String protocolHostAndPort = load.url().protocolHostAndPort();
@@ -161,7 +168,7 @@
 return;
 }
 
-auto iter = m_pendingMainResourcePreconnects.find(protocolHostAndPort);
+auto iter = m_pendingMainResourcePreconnects.find(mainResourceLoadKey(protocolHostAndPort, load.parameters().request.httpUserAgent()));
 if (iter == m_pendingMainResourcePreconnects.end()) {
 load.start();
 return;
@@ -185,7 +192,7 @@
 if (metrics)
 updateOriginProtocolInfo(protocolHostAndPort, metrics->protocol);
 
-auto iter = m_pendingMainResourcePreconnects.find(protocolHostAndPort);
+auto iter = m_pendingMainResourcePreconnects.find(mainResourceLoadKey(protocolHostAndPort, load.parameters().request.httpUserAgent()));
 if (iter == m_pendingMainResourcePreconnects.end())
 return;
 
@@ -194,9 +201,10 @@
 maybePrunePreconnectInfo(iter);
 }
 
-void NetworkLoadScheduler::startedPreconnectForMainResource(const URL& url)
+void NetworkLoadScheduler::startedPreconnectForMainResource(const URL&a

[webkit-changes] [282252] trunk/Source/WebKit

2021-09-09 Thread nham
Title: [282252] trunk/Source/WebKit








Revision 282252
Author n...@apple.com
Date 2021-09-09 17:28:37 -0700 (Thu, 09 Sep 2021)


Log Message
Preconnected socket is sometimes not used for initial request
https://bugs.webkit.org/show_bug.cgi?id=229686

Reviewed by Alex Christensen.

In the previous release, we preconnected to the main resource origin early in page load from
UIProcess to save ~10-15 ms per page load (https://bugs.webkit.org/show_bug.cgi?id=204992).
The savings comes from the fact that there's some latency in initiating the request in
WebProcess and waiting for the nav delegate reply in UIProcess. We hide that latency by
having the eventual main resource request reuse the early preconnected socket.

However, this optimization doesn't work for connections to known HTTP/1.1 origins due to
CFNetwork's in-memory cache of known HTTP/1.1 origins. If an origin is in this cache, and
a preconnect is still in flight, then the network stack will go wide immediately and issue
the main resource request on a new socket rather than trying to wait for the preconnect to
finish and reuse the preconnected socket. Thus the preconneted socket just goes to waste.
This can also cause issues with single-threaded web servers that serve only one request at
a time, as the main resource request can get head-of-line blocked by the preconnect that
is wasted.

To work around this, this patch tracks a small number of known HTTP/1.1 origins in memory.
If there is a pending preconnect to an HTTP/1.1 origin and a main resource request to that
origin comes in, then we block the request from going out until the preconnect finishes.
This allows the main resource request to utilize the preconnected socket.

This is worth ~1.25%-2.5% on PLT5 depending on device.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didCompleteWithError):
* NetworkProcess/NetworkLoadScheduler.cpp:
(WebKit::NetworkLoadScheduler::schedule):
(WebKit::NetworkLoadScheduler::unschedule):
(WebKit::NetworkLoadScheduler::scheduleLoad):
(WebKit::NetworkLoadScheduler::unscheduleLoad):
(WebKit::NetworkLoadScheduler::scheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::unscheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::startedPreconnectForMainResource):
(WebKit::NetworkLoadScheduler::finishedPreconnectForMainResource):
(WebKit::NetworkLoadScheduler::maybePrunePreconnectInfo):
(WebKit::NetworkLoadScheduler::isOriginHTTP1X):
(WebKit::NetworkLoadScheduler::updateOriginProtocolInfo):
* NetworkProcess/NetworkLoadScheduler.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
* NetworkProcess/PreconnectTask.cpp:
(WebKit::PreconnectTask::PreconnectTask):
(WebKit::PreconnectTask::setTimeout):
(WebKit::PreconnectTask::start):
* NetworkProcess/PreconnectTask.h:

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp
trunk/Source/WebKit/NetworkProcess/NetworkLoadScheduler.cpp
trunk/Source/WebKit/NetworkProcess/NetworkLoadScheduler.h
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
trunk/Source/WebKit/NetworkProcess/PreconnectTask.cpp
trunk/Source/WebKit/NetworkProcess/PreconnectTask.h




Diff

Modified: trunk/Source/WebKit/ChangeLog (282251 => 282252)

--- trunk/Source/WebKit/ChangeLog	2021-09-10 00:25:41 UTC (rev 282251)
+++ trunk/Source/WebKit/ChangeLog	2021-09-10 00:28:37 UTC (rev 282252)
@@ -1,3 +1,55 @@
+2021-09-09  Ben Nham  
+
+Preconnected socket is sometimes not used for initial request
+https://bugs.webkit.org/show_bug.cgi?id=229686
+
+Reviewed by Alex Christensen.
+
+In the previous release, we preconnected to the main resource origin early in page load from
+UIProcess to save ~10-15 ms per page load (https://bugs.webkit.org/show_bug.cgi?id=204992).
+The savings comes from the fact that there's some latency in initiating the request in
+WebProcess and waiting for the nav delegate reply in UIProcess. We hide that latency by
+having the eventual main resource request reuse the early preconnected socket.
+
+However, this optimization doesn't work for connections to known HTTP/1.1 origins due to
+CFNetwork's in-memory cache of known HTTP/1.1 origins. If an origin is in this cache, and
+a preconnect is still in flight, then the network stack will go wide immediately and issue
+the main resource request on a new socket rather than trying to wait for the preconnect to
+finish and reuse the preconnected socket. Thus the preconneted socket just goes to waste.
+This can also cause issues with single-threaded web servers that serve only one request at
+a time, as the main resource request can get head-of-line blocked by the preconnect that
+is wasted.
+
+To work around this, this patch tracks a small number of known HTTP/1.1 origins in memory.
+If there is a pending preconnect to an HTTP/1.1 origin and a main resource requ

[webkit-changes] [280859] trunk

2021-08-10 Thread nham
Title: [280859] trunk








Revision 280859
Author n...@apple.com
Date 2021-08-10 11:52:53 -0700 (Tue, 10 Aug 2021)


Log Message
Fix nested resource load tracepoints
https://bugs.webkit.org/show_bug.cgi?id=228242

Reviewed by Alex Christensen.

Source/WebCore:

The main resource and subresource load tracepoints aren't interpreted correctly if there are
multiple resource loads in flight at the same time. To fix this, we pass the pointer to the
FrameLoader or SubresourceLoader to ktrace so that the tracing tool can use that pointer to
properly nest overlapping resource loading trace intervals.

One additional change I made is to move the SubresourceLoadWillStart tracepoint to after the
call to willSendRequestInternal. The reason for this is because I wanted to log the resource
ID associated with the subresource request, but we only generate that ID after the call to
willSendRequestInternal.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::provisionalLoadStarted):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::SubresourceLoader::didFinishLoading):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::didCancel):

Tools:

Use page and resource ids to properly handle nested main resource and subresource load
tracepoint intervals.

* Tracing/SystemTracePoints.plist:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/loader/FrameLoader.cpp
trunk/Source/WebCore/loader/SubresourceLoader.cpp
trunk/Tools/ChangeLog
trunk/Tools/Tracing/SystemTracePoints.plist




Diff

Modified: trunk/Source/WebCore/ChangeLog (280858 => 280859)

--- trunk/Source/WebCore/ChangeLog	2021-08-10 18:17:15 UTC (rev 280858)
+++ trunk/Source/WebCore/ChangeLog	2021-08-10 18:52:53 UTC (rev 280859)
@@ -1,3 +1,29 @@
+2021-08-10  Ben Nham  
+
+Fix nested resource load tracepoints
+https://bugs.webkit.org/show_bug.cgi?id=228242
+
+Reviewed by Alex Christensen.
+
+The main resource and subresource load tracepoints aren't interpreted correctly if there are
+multiple resource loads in flight at the same time. To fix this, we pass the pointer to the
+FrameLoader or SubresourceLoader to ktrace so that the tracing tool can use that pointer to
+properly nest overlapping resource loading trace intervals.
+
+One additional change I made is to move the SubresourceLoadWillStart tracepoint to after the
+call to willSendRequestInternal. The reason for this is because I wanted to log the resource
+ID associated with the subresource request, but we only generate that ID after the call to
+willSendRequestInternal.
+
+* loader/FrameLoader.cpp:
+(WebCore::FrameLoader::provisionalLoadStarted):
+(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+* loader/SubresourceLoader.cpp:
+(WebCore::SubresourceLoader::willSendRequestInternal):
+(WebCore::SubresourceLoader::didFinishLoading):
+(WebCore::SubresourceLoader::didFail):
+(WebCore::SubresourceLoader::didCancel):
+
 2021-08-10  Chris Dumez  
 
 Document.baseURI is inaccurate for iframe srcdoc documents


Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (280858 => 280859)

--- trunk/Source/WebCore/loader/FrameLoader.cpp	2021-08-10 18:17:15 UTC (rev 280858)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2021-08-10 18:52:53 UTC (rev 280859)
@@ -1063,7 +1063,7 @@
 m_client->provisionalLoadStarted();
 
 if (m_frame.isMainFrame()) {
-tracePoint(MainResourceLoadDidStartProvisional);
+tracePoint(MainResourceLoadDidStartProvisional, PAGE_ID);
 
 if (auto* page = m_frame.page())
 page->didStartProvisionalLoad();
@@ -2570,7 +2570,7 @@
 Page* page = m_frame.page();
 if (page) {
 if (m_frame.isMainFrame()) {
-tracePoint(MainResourceLoadDidEnd);
+tracePoint(MainResourceLoadDidEnd, PAGE_ID);
 page->didFinishLoad();
 }
 }


Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (280858 => 280859)

--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2021-08-10 18:17:15 UTC (rev 280858)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2021-08-10 18:52:53 UTC (rev 280859)
@@ -196,7 +196,6 @@
 }
 
 if (newRequest.requester() != ResourceRequestBase::Requester::Main) {
-tracePoint(SubresourceLoadWillStart);
 ResourceLoadObserver::shared().logSubresourceLoading(m_frame.get(), newRequest, redirectResponse,
 (isScriptLikeDestination(options().destination) ? ResourceLoadObserver::FetchDestinationIsScriptLike::Yes : ResourceLoadObserver::FetchDestinationIsScriptLike::No));
 }
@@ -211,6 +210,8 @@
 }
 
 ResourceLoader::willSendRequestInternal(WTFMove(newRequest), redirectResponse, [this, protectedThis = WTF

[webkit-changes] [279559] trunk/Tools

2021-07-04 Thread nham
Title: [279559] trunk/Tools








Revision 279559
Author n...@apple.com
Date 2021-07-04 14:06:12 -0700 (Sun, 04 Jul 2021)


Log Message
Add support for parsing Competitive PLT results to compare-results
https://bugs.webkit.org/show_bug.cgi?id=227470

Reviewed by Per Arne Vollan.

Modify the script to understand the competitive PLT JSON results produced by the perf bots.

* Scripts/compare-results:
(plt5Breakdown):
(competitivePLTBreakdown):
(PLT5Results):
(detectCompetitivePLT):
(CompetitivePLTResults):
(CompetitivePLTResults.calculate_time_for_run):
(detectBenchmark):
(biggerIsBetter):
(main):

Modified Paths

trunk/Tools/ChangeLog
trunk/Tools/Scripts/compare-results




Diff

Modified: trunk/Tools/ChangeLog (279558 => 279559)

--- trunk/Tools/ChangeLog	2021-07-04 19:18:38 UTC (rev 279558)
+++ trunk/Tools/ChangeLog	2021-07-04 21:06:12 UTC (rev 279559)
@@ -1,3 +1,23 @@
+2021-07-04  Ben Nham  
+
+Add support for parsing Competitive PLT results to compare-results
+https://bugs.webkit.org/show_bug.cgi?id=227470
+
+Reviewed by Per Arne Vollan.
+
+Modify the script to understand the competitive PLT JSON results produced by the perf bots.
+
+* Scripts/compare-results:
+(plt5Breakdown):
+(competitivePLTBreakdown):
+(PLT5Results):
+(detectCompetitivePLT):
+(CompetitivePLTResults):
+(CompetitivePLTResults.calculate_time_for_run):
+(detectBenchmark):
+(biggerIsBetter):
+(main):
+
 2021-07-02  Aakash Jain  
 
 Delete unused BuildSlaveSupport symlink


Modified: trunk/Tools/Scripts/compare-results (279558 => 279559)

--- trunk/Tools/Scripts/compare-results	2021-07-04 19:18:38 UTC (rev 279558)
+++ trunk/Tools/Scripts/compare-results	2021-07-04 21:06:12 UTC (rev 279559)
@@ -26,6 +26,7 @@
 # (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 collections
 import sys
 import argparse
 import json
@@ -55,6 +56,7 @@
 Speedometer2 = "Speedometer2"
 JetStream2 = "JetStream2"
 PLT5 = "PLT5"
+CompetitivePLT = "CompetitivePLT"
 PLUM3 = "PLUM3"
 MotionMark = "MotionMark"
 MotionMark1_1 = "MotionMark-1.1"
@@ -122,6 +124,30 @@
 
 return result
 
+def competitivePLTBreakdown(jsonObject):
+result = collections.defaultdict(list)
+result[unitMarker] = "sec"
+
+safari_results = jsonObject.get('Safari', {})
+
+cold_results = safari_results.get('cold', {})
+warm_results = safari_results.get('warm', {})
+
+cold_link_results = cold_results.get('add-and-click-link', {})
+warm_link_results = warm_results.get('add-and-click-link', {})
+
+for site_to_times in cold_link_results.values():
+for site, times in site_to_times.items():
+result["cold--fmp--" + site].append(times['first_meaningful_paint'])
+result["cold--load-end--" + site].append(times['load_end'])
+
+for site_to_times in warm_link_results.values():
+for site, times in site_to_times.items():
+result["warm--fmp--" + site].append(times['first_meaningful_paint'])
+result["warm--load-end--" + site].append(times['load_end'])
+
+return result
+
 def plum3Breakdown(jsonObject):
 breakdown = BenchmarkResults(jsonObject)
 result = {}
@@ -319,6 +345,29 @@
 results.append(obj["Geometric"])
 return results
 
+def detectCompetitivePLT(payload):
+return 'add-and-click-link' in payload.get('Safari', {}).get('cold', {})
+
+def CompetitivePLTResults(payload):
+def calculate_time_for_run(run):
+# We geomean all FMP and load_end times together to produce a result for the run.
+fmp_vals = [obj['first_meaningful_paint'] for obj in run.values()]
+load_end_vals = [obj['load_end'] for obj in run.values()]
+return stats.gmean(fmp_vals + load_end_vals)
+
+safari_results = payload.get('Safari', {})
+
+cold_results = safari_results.get('cold', {})
+warm_results = safari_results.get('warm', {})
+
+cold_link_results = cold_results.get('add-and-click-link', {})
+warm_link_results = warm_results.get('add-and-click-link', {})
+
+cold_times = [calculate_time_for_run(run) for run in cold_link_results.values()]
+warm_times = [calculate_time_for_run(run) for run in warm_link_results.values()]
+
+return [stats.gmean((cold_time, warm_time)) for cold_time, warm_time in zip(cold_times, warm_times)]
+
 def detectPLUM3(payload):
 return "PLUM3-PhysFootprint" in payload
 
@@ -362,6 +411,8 @@
 return Speedometer2
 if detectPLT5(payload):
 return PLT5
+if detectCompetitivePLT(payload):
+return CompetitivePLT
 if detectPLUM3(payload):
 return PLUM3
 if detectMotionMark(payload):
@@ -383,6 +434,8 @@
 return True

[webkit-changes] [279497] trunk/Source

2021-07-02 Thread nham
Title: [279497] trunk/Source








Revision 279497
Author n...@apple.com
Date 2021-07-01 23:01:51 -0700 (Thu, 01 Jul 2021)


Log Message
Unreviewed, reverting r279172.

Broke WebGL context construction on some devices.

Reverted changeset:

"rAF driven WebGL submits excessive amount of GPU work when frames are slow"
https://bugs.webkit.org/show_bug.cgi?id=227059
https://commits.webkit.org/r279172

Modified Paths

trunk/Source/ThirdParty/ANGLE/ChangeLog
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLEUtilities.h
trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h




Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (279496 => 279497)

--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-07-02 04:05:41 UTC (rev 279496)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-07-02 06:01:51 UTC (rev 279497)
@@ -1,3 +1,15 @@
+2021-07-01  Ben Nham  
+
+Unreviewed, reverting r279172.
+
+Broke WebGL context construction on some devices.
+
+Reverted changeset:
+
+"rAF driven WebGL submits excessive amount of GPU work when frames are slow"
+https://bugs.webkit.org/show_bug.cgi?id=227059
+https://commits.webkit.org/r279172
+
 2021-07-01  Kyle Piddington  
 
 BabylonJS Under water demo is slower than it should be on Intel


Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm (279496 => 279497)

--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm	2021-07-02 04:05:41 UTC (rev 279496)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm	2021-07-02 06:01:51 UTC (rev 279497)
@@ -884,9 +884,6 @@
 
 // GL_OES_EGL_sync
 mNativeExtensions.eglSyncOES = true;
-
-// GL_ARB_sync
-mNativeExtensions.glSyncARB = true;
 }
 }
 


Modified: trunk/Source/WebCore/ChangeLog (279496 => 279497)

--- trunk/Source/WebCore/ChangeLog	2021-07-02 04:05:41 UTC (rev 279496)
+++ trunk/Source/WebCore/ChangeLog	2021-07-02 06:01:51 UTC (rev 279497)
@@ -1,3 +1,15 @@
+2021-07-01  Ben Nham  
+
+Unreviewed, reverting r279172.
+
+Broke WebGL context construction on some devices.
+
+Reverted changeset:
+
+"rAF driven WebGL submits excessive amount of GPU work when frames are slow"
+https://bugs.webkit.org/show_bug.cgi?id=227059
+https://commits.webkit.org/r279172
+
 2021-07-01  Jean-Yves Avenard  
 
 [Cocoa] Last few seconds of 'audio/webm; codecs=vorbis' appended to a SampleBuffer are not played


Modified: trunk/Source/WebCore/Headers.cmake (279496 => 279497)

--- trunk/Source/WebCore/Headers.cmake	2021-07-02 04:05:41 UTC (rev 279496)
+++ trunk/Source/WebCore/Headers.cmake	2021-07-02 06:01:51 UTC (rev 279497)
@@ -1330,7 +1330,6 @@
 
 platform/graphics/angle/ANGLEHeaders.h
 platform/graphics/angle/ExtensionsGLANGLE.h
-platform/graphics/angle/GraphicsContextGLANGLEUtilities.h
 
 platform/graphics/displaylists/DisplayList.h
 platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h


Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (279496 => 279497)

--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-07-02 04:05:41 UTC (rev 279496)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-07-02 06:01:51 UTC (rev 279497)
@@ -715,7 +715,7 @@
 		26F756B51B3B68F20005DD79 /* ImmutableNFANodeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F756B41B3B68F20005DD79 /* ImmutableNFANodeBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */; };
 		26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		27E3C808257F5E6E00C986AB /* ANGLEHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 27E3C806257F5E6E00C986AB /* ANGLEHeaders.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		27E3C808257F5E6E00C986AB /* ANGLEHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 27E3C806257F5E6E00C986AB /* ANGLEHeaders.h */; };
 		2914E3081CAB5A440049966F /* AccessibilityAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */; };
 		2936BF5C21D69E4B004A8FC9 /* AccessibilityObjectInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2936BF5A21D6999E004A8FC9 /* AccessibilityObjectInte

[webkit-changes] [279007] trunk/Source

2021-06-17 Thread nham
Title: [279007] trunk/Source








Revision 279007
Author n...@apple.com
Date 2021-06-17 13:49:31 -0700 (Thu, 17 Jun 2021)


Log Message
Remove Mac-specific CPUTime functions
https://bugs.webkit.org/show_bug.cgi?id=227109

Reviewed by Yusuke Suzuki.

Source/WebKit:

Permit calling thread_selfusage, since it is used by clock_gettime(CLOCK_THREAD_CPUTIME_ID, tp).

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:

Source/WTF:

There's no reason for the Mac-specific CPU time functions to exist, since getrusage and
clock_gettime work fine on Mac. It's actually slightly more efficient to use the POSIX calls
since getrusage returns CPU time for both current and terminated threads in a single
syscall, while using task_info requires two syscalls to do the same thing.

* WTF.xcodeproj/project.pbxproj:
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformPlayStation.cmake:
* wtf/PlatformWPE.cmake:
* wtf/cocoa/CPUTimeCocoa.cpp: Removed.
* wtf/posix/CPUTimePOSIX.cpp: Renamed from Source/WTF/wtf/unix/CPUTimeUnix.cpp.

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
trunk/Source/WTF/wtf/PlatformGTK.cmake
trunk/Source/WTF/wtf/PlatformJSCOnly.cmake
trunk/Source/WTF/wtf/PlatformPlayStation.cmake
trunk/Source/WTF/wtf/PlatformWPE.cmake
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in
trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in


Added Paths

trunk/Source/WTF/wtf/posix/CPUTimePOSIX.cpp


Removed Paths

trunk/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp
trunk/Source/WTF/wtf/unix/CPUTimeUnix.cpp




Diff

Modified: trunk/Source/WTF/ChangeLog (279006 => 279007)

--- trunk/Source/WTF/ChangeLog	2021-06-17 20:48:44 UTC (rev 279006)
+++ trunk/Source/WTF/ChangeLog	2021-06-17 20:49:31 UTC (rev 279007)
@@ -1,3 +1,23 @@
+2021-06-17  Ben Nham  
+
+Remove Mac-specific CPUTime functions
+https://bugs.webkit.org/show_bug.cgi?id=227109
+
+Reviewed by Yusuke Suzuki.
+
+There's no reason for the Mac-specific CPU time functions to exist, since getrusage and
+clock_gettime work fine on Mac. It's actually slightly more efficient to use the POSIX calls
+since getrusage returns CPU time for both current and terminated threads in a single
+syscall, while using task_info requires two syscalls to do the same thing.
+
+* WTF.xcodeproj/project.pbxproj:
+* wtf/PlatformGTK.cmake:
+* wtf/PlatformJSCOnly.cmake:
+* wtf/PlatformPlayStation.cmake:
+* wtf/PlatformWPE.cmake:
+* wtf/cocoa/CPUTimeCocoa.cpp: Removed.
+* wtf/posix/CPUTimePOSIX.cpp: Renamed from Source/WTF/wtf/unix/CPUTimeUnix.cpp.
+
 2021-06-17  Tim Horton  
 
 Adopt WKHoverGestureRecognizer


Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (279006 => 279007)

--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2021-06-17 20:48:44 UTC (rev 279006)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2021-06-17 20:49:31 UTC (rev 279007)
@@ -174,7 +174,6 @@
 		E3149A39228BB43500BFA6C7 /* Vector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F95B63420CB53C100479635 /* Vector.cpp */; };
 		E3149A3B228BDCAC00BFA6C7 /* ConcurrentBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3149A3A228BDCAB00BFA6C7 /* ConcurrentBuffer.cpp */; };
 		E36F20C9095100E632BC /* WorkerPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E36D20C9095100E632BC /* WorkerPool.cpp */; };
-		E38C41251EB4E04C0042957D /* CPUTimeCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38C41241EB4E04C0042957D /* CPUTimeCocoa.cpp */; };
 		E38C41281EB4E0680042957D /* CPUTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38C41261EB4E0680042957D /* CPUTime.cpp */; };
 		E38D6E271F5522E300A75CC4 /* StringBuilderJSON.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38D6E261F5522E300A75CC4 /* StringBuilderJSON.cpp */; };
 		E392FA2722E92BFF00ECDC73 /* ResourceUsageCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E392FA2622E92BFF00ECDC73 /* ResourceUsageCocoa.cpp */; };
@@ -183,6 +182,7 @@
 		E3BE09A724A5854D009DF2B4 /* ICUHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3BE09A624A58545009DF2B4 /* ICUHelpers.cpp */; };
 		E4A0AD391A96245500536DF6 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD371A96245500536DF6 /* WorkQueue.cpp */; };
 		E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */; };
+		EB2C86D9267B275D0052CB9A /* CPUTimePOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB2C86D8267B275C0052CB9A /* CPUTimePOSIX.cpp */; };
 		EB61EDC72409CCC1001EFE36 /* SystemTracingCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB61EDC62409CCC0001EFE36 /* SystemTracingCocoa.cpp */; };
 		FE032AD22463E43B0012D7C7 /* WTFConfig.cpp in Sources */ 

[webkit-changes] [278717] trunk

2021-06-10 Thread nham
Title: [278717] trunk








Revision 278717
Author n...@apple.com
Date 2021-06-10 12:02:51 -0700 (Thu, 10 Jun 2021)


Log Message
Only cache GET requests in the memory cache
https://bugs.webkit.org/show_bug.cgi?id=226359

Reviewed by Geoff Garen.

Source/WebCore:

Test: http/tests/cache/memory-cache-only-caches-get.html

We only cache GET requests at the disk cache level, but we don't have that same restriction
at the memory cache level. We should make the policies match. In particular, in long-running
webpages, we're accumulating POSTs from XMLHttpRequests in our memory cache and should stop
doing that, since POST response caching is generally not used or expected.

I also changed InspectorInstrumentation::willSendRequest to take an optional CachedResource
parameter because it currently uses InspectorPageAgent::cachedResource to find the resource,
which in turn expects to find the resource in the memory cache. That doesn't work anymore
for these non-GET requests, so we now pass down the CachedResource explicitly in the cases
where that's necessary.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willSendRequestImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willSendRequest):
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::resourceTypeForCachedResource):
(WebCore::InspectorNetworkAgent::willSendRequest):
* inspector/agents/InspectorNetworkAgent.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::tryLoadingSubstituteData):
(WebCore::DocumentLoader::addSubresourceLoader):
(WebCore::DocumentLoader::loadMainResource):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::requestFromDelegate):
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::willSendRequest):
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
* loader/ResourceLoadNotifier.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequestInternal):
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::cachedResource const):
* loader/SubresourceLoader.cpp:
* loader/SubresourceLoader.h:
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::update):
(WebCore::ApplicationCacheGroup::startLoadingEntry):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::add):

LayoutTests:

Added tests to make sure only GETs end up in the memory cache.

Also fixed a flaky test that was depending on a POST response in an iframe to be in the
memory cache when doing a history navigation.

* http/tests/cache/memory-cache-only-caches-get-expected.txt: Added.
* http/tests/cache/memory-cache-only-caches-get.html: Added.
* http/tests/cache/resources/echo-cacheable.cgi: Added.
* http/tests/navigation/post-frames-goback1.html:
* platform/mac/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/http/tests/navigation/post-frames-goback1.html
trunk/LayoutTests/platform/mac/TestExpectations
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.h
trunk/Source/WebCore/loader/DocumentLoader.cpp
trunk/Source/WebCore/loader/FrameLoader.cpp
trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp
trunk/Source/WebCore/loader/ResourceLoadNotifier.h
trunk/Source/WebCore/loader/ResourceLoader.cpp
trunk/Source/WebCore/loader/ResourceLoader.h
trunk/Source/WebCore/loader/SubresourceLoader.cpp
trunk/Source/WebCore/loader/SubresourceLoader.h
trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
trunk/Source/WebCore/loader/cache/MemoryCache.cpp


Added Paths

trunk/LayoutTests/http/tests/cache/memory-cache-only-caches-get-expected.txt
trunk/LayoutTests/http/tests/cache/memory-cache-only-caches-get.html
trunk/LayoutTests/http/tests/cache/resources/echo-cacheable.cgi




Diff

Modified: trunk/LayoutTests/ChangeLog (278716 => 278717)

--- trunk/LayoutTests/ChangeLog	2021-06-10 18:54:31 UTC (rev 278716)
+++ trunk/LayoutTests/ChangeLog	2021-06-10 19:02:51 UTC (rev 278717)
@@ -1,3 +1,21 @@
+2021-06-10  Ben Nham  
+
+Only cache GET requests in the memory cache
+https://bugs.webkit.org/show_bug.cgi?id=226359
+
+Reviewed by Geoff Garen.
+
+Added tests to make sure only GETs end up in the memory cache.
+
+Also fixed a flaky test that was depending on a POST response in an iframe to be in the
+memory cache when doing a history navigation.
+
+* http/tests/cache/memory-cache-only-caches-get-expected.txt: Added.
+* http/tests/cache/memory-cache-only-caches-get.html: Added.
+* http/tests/cache/resources/echo-cacheable.cgi: Added.
+* http/tests/navigation/post-frames-goback1.html:
+* platform/mac/TestExpectations:
+
 2021-06-10  Truitt Savell  
 
 REGRESSION: (r278650 - r278655) service-workers/service-worker/credentials.https.h

[webkit-changes] [278641] trunk/Source/WTF

2021-06-08 Thread nham
Title: [278641] trunk/Source/WTF








Revision 278641
Author n...@apple.com
Date 2021-06-08 19:26:34 -0700 (Tue, 08 Jun 2021)


Log Message
Use access instead of stat in some filesystem functions
https://bugs.webkit.org/show_bug.cgi?id=226667

Reviewed by Chris Dumez.

We are spending a bit more time in WTF::FileSystemImpl functions after the move to
std::filesystem (https://bugs.webkit.org/show_bug.cgi?id=225255). In particular, several
std::filesystem functions (like the ones called by fileExists and makeAllDirectories) prefer
to use stat() over access() for file existence checks. Since our sandbox has a fast path for
access(path, F_OK) but not for stat, we ended up spending more time in sandbox evaluation in
the kernel after the move to std::filesystem.

Note that the two checks don't do exactly the same thing. access(path, F_OK) only checks for
path existence, while stat(path) additionally fetches metadata, which requires checking the
file-read-metadata permission. But in practice our code was written to be fine with just
checking for existence.

To work around this, I've re-introduced some of the old WTF::FileSystemImpl functions from
FileSystemPosix.cpp. They are the ones that are called by NetworkCache, which seems to be
the biggest consumer of these functions. The rest of the functions are still implemented
using std::filesystem.

* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::fileExists):
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::makeAllDirectories):
(WTF::FileSystemImpl::pathByAppendingComponent):
(WTF::FileSystemImpl::pathByAppendingComponents):
* wtf/PlatformEnableCocoa.h:
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::fileExists):
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::makeAllDirectories):
(WTF::FileSystemImpl::pathByAppendingComponent):
(WTF::FileSystemImpl::pathByAppendingComponents):

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/FileSystem.cpp
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp




Diff

Modified: trunk/Source/WTF/ChangeLog (278640 => 278641)

--- trunk/Source/WTF/ChangeLog	2021-06-09 02:23:59 UTC (rev 278640)
+++ trunk/Source/WTF/ChangeLog	2021-06-09 02:26:34 UTC (rev 278641)
@@ -1,3 +1,41 @@
+2021-06-08  Ben Nham  
+
+Use access instead of stat in some filesystem functions
+https://bugs.webkit.org/show_bug.cgi?id=226667
+
+Reviewed by Chris Dumez.
+
+We are spending a bit more time in WTF::FileSystemImpl functions after the move to
+std::filesystem (https://bugs.webkit.org/show_bug.cgi?id=225255). In particular, several
+std::filesystem functions (like the ones called by fileExists and makeAllDirectories) prefer
+to use stat() over access() for file existence checks. Since our sandbox has a fast path for
+access(path, F_OK) but not for stat, we ended up spending more time in sandbox evaluation in
+the kernel after the move to std::filesystem.
+
+Note that the two checks don't do exactly the same thing. access(path, F_OK) only checks for
+path existence, while stat(path) additionally fetches metadata, which requires checking the
+file-read-metadata permission. But in practice our code was written to be fine with just
+checking for existence.
+
+To work around this, I've re-introduced some of the old WTF::FileSystemImpl functions from
+FileSystemPosix.cpp. They are the ones that are called by NetworkCache, which seems to be
+the biggest consumer of these functions. The rest of the functions are still implemented
+using std::filesystem.
+
+* wtf/FileSystem.cpp:
+(WTF::FileSystemImpl::fileExists):
+(WTF::FileSystemImpl::deleteFile):
+(WTF::FileSystemImpl::makeAllDirectories):
+(WTF::FileSystemImpl::pathByAppendingComponent):
+(WTF::FileSystemImpl::pathByAppendingComponents):
+* wtf/PlatformEnableCocoa.h:
+* wtf/posix/FileSystemPOSIX.cpp:
+(WTF::FileSystemImpl::fileExists):
+(WTF::FileSystemImpl::deleteFile):
+(WTF::FileSystemImpl::makeAllDirectories):
+(WTF::FileSystemImpl::pathByAppendingComponent):
+(WTF::FileSystemImpl::pathByAppendingComponents):
+
 2021-06-08  Devin Rousso  
 
 [Payment Request] upstream new features


Modified: trunk/Source/WTF/wtf/FileSystem.cpp (278640 => 278641)

--- trunk/Source/WTF/wtf/FileSystem.cpp	2021-06-09 02:23:59 UTC (rev 278640)
+++ trunk/Source/WTF/wtf/FileSystem.cpp	2021-06-09 02:26:34 UTC (rev 278641)
@@ -522,26 +522,6 @@
 
 #if HAVE(STD_FILESYSTEM) || HAVE(STD_EXPERIMENTAL_FILESYSTEM)
 
-bool fileExists(const String& path)
-{
-std::error_code ec;
-// exists() returns false on error so no need to check ec.
-return std::filesystem::exists(toStdFileSystemPath(path), ec);
-}
-
-bool deleteFile(const String& path)
-{
-std::error_code ec;
-auto fsPath = toStdFileS

[webkit-changes] [277338] trunk/Source/WebKit

2021-05-11 Thread nham
Title: [277338] trunk/Source/WebKit








Revision 277338
Author n...@apple.com
Date 2021-05-11 13:45:18 -0700 (Tue, 11 May 2021)


Log Message
Failing sandbox check for media permissions should not generate a violation report
https://bugs.webkit.org/show_bug.cgi?id=225662

Reviewed by Geoffrey Garen.

We sandbox_check the UIProcess for camera and video permissions. But if the process doesn't
have those permissions, sandbox_check fails and generates an expensive violation report that
task_suspends the process. We need to suppress the reporting with SANDBOX_CHECK_NO_REPORT.

* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::checkSandboxRequirementForType):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (277337 => 277338)

--- trunk/Source/WebKit/ChangeLog	2021-05-11 19:48:21 UTC (rev 277337)
+++ trunk/Source/WebKit/ChangeLog	2021-05-11 20:45:18 UTC (rev 277338)
@@ -1,3 +1,17 @@
+2021-05-11  Ben Nham  
+
+Failing sandbox check for media permissions should not generate a violation report
+https://bugs.webkit.org/show_bug.cgi?id=225662
+
+Reviewed by Geoffrey Garen.
+
+We sandbox_check the UIProcess for camera and video permissions. But if the process doesn't
+have those permissions, sandbox_check fails and generates an expensive violation report that
+task_suspends the process. We need to suppress the reporting with SANDBOX_CHECK_NO_REPORT.
+
+* UIProcess/Cocoa/MediaPermissionUtilities.mm:
+(WebKit::checkSandboxRequirementForType):
+
 2021-05-11  Alex Christensen  
 
 Add SPI to restrict networking to a set of hosts


Modified: trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm (277337 => 277338)

--- trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm	2021-05-11 19:48:21 UTC (rev 277337)
+++ trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm	2021-05-11 20:45:18 UTC (rev 277338)
@@ -61,7 +61,7 @@
 if (!currentProcessIsSandboxed())
 return;
 
-int result = sandbox_check(getpid(), operation, SANDBOX_FILTER_NONE);
+int result = sandbox_check(getpid(), operation, static_cast(SANDBOX_CHECK_NO_REPORT | SANDBOX_FILTER_NONE));
 if (result == -1)
 WTFLogAlways("Error checking '%s' sandbox access, errno=%ld", operation, (long)errno);
 *entitled = !result;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [276788] trunk/Source

2021-04-29 Thread nham
Title: [276788] trunk/Source








Revision 276788
Author n...@apple.com
Date 2021-04-29 12:01:53 -0700 (Thu, 29 Apr 2021)


Log Message
Reduce memory footprint for background tabs
https://bugs.webkit.org/show_bug.cgi?id=225007

Reviewed by Chris Dumez.

Source/WebKit:

When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
we should attempt to reduce our memory footprint after some time interval to help relieve
system-wide memory pressure. This is enabled only on Mac because iOS already does something
similar just before WebContent suspends.

One exception to this is that we don't do this proactive slimming for processes that are in
the back/forward cache or in the WebProcess cache. This is because dropping the memory cache
in those types of processes leads to perf regressions in benchmarks that do certain types of
cross-origin navigations. We'll use a separate mechanism for controlling the memory usage of
those processes; our current logic keeps those processes around until we are at the warning
or critical memory pressure level.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::pageDidEnterWindow):
(WebKit::WebProcess::pageWillLeaveWindow):
(WebKit::WebProcess::nonVisibleProcessGraphicsCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessMemoryCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessCleanupTimerFired): Deleted.
* WebProcess/WebProcess.h:

Source/WTF:

Add an option to slim background tabs by proactively calling WebCore::releaseMemory on Macs.

* wtf/PlatformEnableCocoa.h:

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/WebProcess.cpp
trunk/Source/WebKit/WebProcess/WebProcess.h




Diff

Modified: trunk/Source/WTF/ChangeLog (276787 => 276788)

--- trunk/Source/WTF/ChangeLog	2021-04-29 18:59:03 UTC (rev 276787)
+++ trunk/Source/WTF/ChangeLog	2021-04-29 19:01:53 UTC (rev 276788)
@@ -1,3 +1,14 @@
+2021-04-29  Ben Nham  
+
+Reduce memory footprint for background tabs
+https://bugs.webkit.org/show_bug.cgi?id=225007
+
+Reviewed by Chris Dumez.
+
+Add an option to slim background tabs by proactively calling WebCore::releaseMemory on Macs.
+
+* wtf/PlatformEnableCocoa.h:
+
 2021-04-29  Darin Adler  
 
 Extend SortedArrayMap further to work on case-folded strings, use in MIMETypeRegistry


Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (276787 => 276788)

--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-04-29 18:59:03 UTC (rev 276787)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-04-29 19:01:53 UTC (rev 276788)
@@ -390,6 +390,10 @@
 #define ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE 1
 #endif
 
+#if !defined(ENABLE_NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER) && (PLATFORM(MAC) || PLATFORM(MACCATALYST))
+#define ENABLE_NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER 1
+#endif
+
 #if !defined(ENABLE_NOTIFICATIONS) && PLATFORM(MAC)
 #define ENABLE_NOTIFICATIONS 1
 #endif


Modified: trunk/Source/WebKit/ChangeLog (276787 => 276788)

--- trunk/Source/WebKit/ChangeLog	2021-04-29 18:59:03 UTC (rev 276787)
+++ trunk/Source/WebKit/ChangeLog	2021-04-29 19:01:53 UTC (rev 276788)
@@ -1,3 +1,30 @@
+2021-04-29  Ben Nham  
+
+Reduce memory footprint for background tabs
+https://bugs.webkit.org/show_bug.cgi?id=225007
+
+Reviewed by Chris Dumez.
+
+When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
+we should attempt to reduce our memory footprint after some time interval to help relieve
+system-wide memory pressure. This is enabled only on Mac because iOS already does something
+similar just before WebContent suspends.
+
+One exception to this is that we don't do this proactive slimming for processes that are in
+the back/forward cache or in the WebProcess cache. This is because dropping the memory cache
+in those types of processes leads to perf regressions in benchmarks that do certain types of
+cross-origin navigations. We'll use a separate mechanism for controlling the memory usage of
+those processes; our current logic keeps those processes around until we are at the warning
+or critical memory pressure level.
+
+* WebProcess/WebProcess.cpp:
+(WebKit::WebProcess::pageDidEnterWindow):
+(WebKit::WebProcess::pageWillLeaveWindow):
+(WebKit::WebProcess::nonVisibleProcessGraphicsCleanupTimerFired):
+(WebKit::WebProcess::nonVisibleProcessMemoryCleanupTimerFired):
+(WebKit::WebProcess::nonVisibleProcessCleanupTimerFired): Deleted.
+* WebProcess/WebProcess.h:
+
 2021-04-29  Brent Fulgham  
 
 [iOS] Reduce logging for uninteresting sandbox violations


Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (276787 => 276788)

--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	

[webkit-changes] [276779] trunk/Source

2021-04-29 Thread nham
Title: [276779] trunk/Source








Revision 276779
Author n...@apple.com
Date 2021-04-29 09:26:38 -0700 (Thu, 29 Apr 2021)


Log Message
Unreviewed, reverting r276619.

Source/WebKit:

Causes multiple regressions on perf bots, as multiple tests test hot page loads in
WebContent processes that are in the process cache. Dropping the memory cache in those
processes caused multiple benchmarks to regress.

Reverted changeset:

"Reduce memory footprint for background tabs"
https://bugs.webkit.org/show_bug.cgi?id=225007
https://commits.webkit.org/r276619

Source/WTF:

Causes multiple regressions on perf bots.

Reverted changeset:

"Reduce memory footprint for background tabs"
https://bugs.webkit.org/show_bug.cgi?id=225007
https://commits.webkit.org/r276619

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/WebProcess.cpp
trunk/Source/WebKit/WebProcess/WebProcess.h




Diff

Modified: trunk/Source/WTF/ChangeLog (276778 => 276779)

--- trunk/Source/WTF/ChangeLog	2021-04-29 16:17:49 UTC (rev 276778)
+++ trunk/Source/WTF/ChangeLog	2021-04-29 16:26:38 UTC (rev 276779)
@@ -1,3 +1,15 @@
+2021-04-29  Ben Nham  
+
+Unreviewed, reverting r276619.
+
+Causes multiple regressions on perf bots.
+
+Reverted changeset:
+
+"Reduce memory footprint for background tabs"
+https://bugs.webkit.org/show_bug.cgi?id=225007
+https://commits.webkit.org/r276619
+
 2021-04-28  Devin Rousso  
 
 experiment with averaging sampling colors across the top of the page as the scroll area background


Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (276778 => 276779)

--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-04-29 16:17:49 UTC (rev 276778)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-04-29 16:26:38 UTC (rev 276779)
@@ -390,10 +390,6 @@
 #define ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE 1
 #endif
 
-#if !defined(ENABLE_NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER) && (PLATFORM(MAC) || PLATFORM(MACCATALYST))
-#define ENABLE_NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER 1
-#endif
-
 #if !defined(ENABLE_NOTIFICATIONS) && PLATFORM(MAC)
 #define ENABLE_NOTIFICATIONS 1
 #endif


Modified: trunk/Source/WebKit/ChangeLog (276778 => 276779)

--- trunk/Source/WebKit/ChangeLog	2021-04-29 16:17:49 UTC (rev 276778)
+++ trunk/Source/WebKit/ChangeLog	2021-04-29 16:26:38 UTC (rev 276779)
@@ -1,3 +1,17 @@
+2021-04-29  Ben Nham  
+
+Unreviewed, reverting r276619.
+
+Causes multiple regressions on perf bots, as multiple tests test hot page loads in
+WebContent processes that are in the process cache. Dropping the memory cache in those
+processes caused multiple benchmarks to regress.
+
+Reverted changeset:
+
+"Reduce memory footprint for background tabs"
+https://bugs.webkit.org/show_bug.cgi?id=225007
+https://commits.webkit.org/r276619
+
 2021-04-29  Chris Dumez  
 
 Improve local storage size estimation for quota limitation


Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (276778 => 276779)

--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-29 16:17:49 UTC (rev 276778)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-29 16:26:38 UTC (rev 276779)
@@ -230,14 +230,8 @@
 static const Seconds plugInAutoStartExpirationTimeUpdateThreshold { 29 * 24 * 60 * 60 };
 
 // This should be greater than tileRevalidationTimeout in TileController.
-static const Seconds nonVisibleProcessGraphicsCleanupDelay { 10_s };
+static const Seconds nonVisibleProcessCleanupDelay { 10_s };
 
-#if ENABLE(NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER)
-// This should be long enough to support a workload where a user is actively switching between multiple tabs,
-// since our memory cleanup routine could potentially delete a good amount of JIT code.
-static const Seconds nonVisibleProcessMemoryCleanupDelay { 120_s };
-#endif
-
 namespace WebKit {
 using namespace JSC;
 using namespace WebCore;
@@ -271,10 +265,7 @@
 #if ENABLE(NETSCAPE_PLUGIN_API)
 , m_pluginProcessConnectionManager(PluginProcessConnectionManager::create())
 #endif
-, m_nonVisibleProcessGraphicsCleanupTimer(*this, ::nonVisibleProcessGraphicsCleanupTimerFired)
-#if ENABLE(NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER)
-, m_nonVisibleProcessMemoryCleanupTimer(*this, ::nonVisibleProcessMemoryCleanupTimerFired)
-#endif
+, m_nonVisibleProcessCleanupTimer(*this, ::nonVisibleProcessCleanupTimerFired)
 #if PLATFORM(IOS_FAMILY)
 , m_webSQLiteDatabaseTracker([this](bool isHoldingLockedFiles) { parentProcessConnection()->send(Messages::WebProcessProxy::SetIsHoldingLockedFiles(isHoldingLockedFiles), 0); })
 #endif
@@ -1563,11 +1554,7 @@
 void WebProcess::pageDidEnterWindow(PageIdentifier pageID)
 {
 m_pagesInWindows.add(pageID);
-m_nonVisibleProcessGraphicsCleanup

[webkit-changes] [276682] trunk/Source/WTF

2021-04-27 Thread nham
Title: [276682] trunk/Source/WTF








Revision 276682
Author n...@apple.com
Date 2021-04-27 17:18:19 -0700 (Tue, 27 Apr 2021)


Log Message
Memory pressure events should be logged to com.apple.WebKit subsystem
https://bugs.webkit.org/show_bug.cgi?id=225112

Reviewed by Chris Dumez.

Currently memory pressure events are logged to the default os_log subsystem instead of the
com.apple.WebKit subsystem. This makes it hard to capture such events using common logging
prefs (e.g. a pref that persists all logs from the WebKit subsystem).

To fix this, call WTFInitializeLogChannelStatesFromString at init time. This associates the
WTFLogChannel with an os_log object that sends the messages to the WebKit subsystem.

* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::singleton):
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/MemoryPressureHandler.cpp
trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm




Diff

Modified: trunk/Source/WTF/ChangeLog (276681 => 276682)

--- trunk/Source/WTF/ChangeLog	2021-04-28 00:04:53 UTC (rev 276681)
+++ trunk/Source/WTF/ChangeLog	2021-04-28 00:18:19 UTC (rev 276682)
@@ -1,3 +1,22 @@
+2021-04-27  Ben Nham  
+
+Memory pressure events should be logged to com.apple.WebKit subsystem
+https://bugs.webkit.org/show_bug.cgi?id=225112
+
+Reviewed by Chris Dumez.
+
+Currently memory pressure events are logged to the default os_log subsystem instead of the
+com.apple.WebKit subsystem. This makes it hard to capture such events using common logging
+prefs (e.g. a pref that persists all logs from the WebKit subsystem).
+
+To fix this, call WTFInitializeLogChannelStatesFromString at init time. This associates the
+WTFLogChannel with an os_log object that sends the messages to the WebKit subsystem.
+
+* wtf/MemoryPressureHandler.cpp:
+(WTF::MemoryPressureHandler::singleton):
+* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
+(WTF::MemoryPressureHandler::install):
+
 2021-04-27  Alex Christensen  
 
 Unreviewed, reverting r275912.


Modified: trunk/Source/WTF/wtf/MemoryPressureHandler.cpp (276681 => 276682)

--- trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2021-04-28 00:04:53 UTC (rev 276681)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2021-04-28 00:18:19 UTC (rev 276682)
@@ -34,15 +34,7 @@
 
 namespace WTF {
 
-#if RELEASE_LOG_DISABLED
-WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error };
-#endif
-#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
-WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
-#endif
-#if USE(JOURNALD) && !RELEASE_LOG_DISABLED
-WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM };
-#endif
+DEFINE_LOG_CHANNEL(MemoryPressure, LOG_CHANNEL_WEBKIT_SUBSYSTEM);
 
 WTF_EXPORT_PRIVATE bool MemoryPressureHandler::ReliefLogger::s_loggingEnabled = false;
 
@@ -51,6 +43,9 @@
 static LazyNeverDestroyed memoryPressureHandler;
 static std::once_flag onceKey;
 std::call_once(onceKey, [&] {
+WTFLogChannel* channels[] = {  };
+WTFInitializeLogChannelStatesFromString(channels, 1, "");
+
 memoryPressureHandler.construct();
 });
 return memoryPressureHandler;


Modified: trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm (276681 => 276682)

--- trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm	2021-04-28 00:04:53 UTC (rev 276681)
+++ trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm	2021-04-28 00:18:19 UTC (rev 276682)
@@ -41,12 +41,6 @@
 
 namespace WTF {
 
-#if RELEASE_LOG_DISABLED
-WTFLogChannel LogPerformanceLogging = { WTFLogChannelState::On, "PerformanceLogging", WTFLogLevel::Error };
-#else
-WTFLogChannel LogPerformanceLogging = { WTFLogChannelState::On, "PerformanceLogging", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
-#endif
-
 void MemoryPressureHandler::platformReleaseMemory(Critical critical)
 {
 if (critical == Critical::Yes && (!isUnderMemoryPressure() || m_isSimulatingMemoryPressure)) {
@@ -104,7 +98,7 @@
 break;
 }
 if (m_shouldLogMemoryMemoryPressureEvents)
-RELEASE_LOG(PerformanceLogging, "Received memory pressure event %lu vm pressure %d", status, isUnderMemoryPressure());
+RELEASE_LOG(MemoryPressure, "Received memory pressure event %lu vm pressure %d", status, isUnderMemoryPressure());
 });
 dispatch_resume(memoryPressureEventSource);
 });






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [276619] trunk/Source

2021-04-26 Thread nham
Title: [276619] trunk/Source








Revision 276619
Author n...@apple.com
Date 2021-04-26 16:42:01 -0700 (Mon, 26 Apr 2021)


Log Message
Reduce memory footprint for background tabs
https://bugs.webkit.org/show_bug.cgi?id=225007

Reviewed by Chris Dumez.

When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
we should attempt to reduce our memory footprint after some time interval to help relieve
system-wide memory pressure. This is enabled only on Mac because iOS already does something
similar just before WebContent suspends.

Source/WebKit:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::pageDidEnterWindow):
(WebKit::WebProcess::pageWillLeaveWindow):
(WebKit::WebProcess::nonVisibleProcessGraphicsCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessMemoryCleanupTimerFired):
(WebKit::WebProcess::nonVisibleProcessCleanupTimerFired): Deleted.
* WebProcess/WebProcess.h:

Source/WTF:

* wtf/PlatformEnableCocoa.h:

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/WebProcess.cpp
trunk/Source/WebKit/WebProcess/WebProcess.h




Diff

Modified: trunk/Source/WTF/ChangeLog (276618 => 276619)

--- trunk/Source/WTF/ChangeLog	2021-04-26 23:04:15 UTC (rev 276618)
+++ trunk/Source/WTF/ChangeLog	2021-04-26 23:42:01 UTC (rev 276619)
@@ -1,3 +1,17 @@
+2021-04-26  Ben Nham  
+
+Reduce memory footprint for background tabs
+https://bugs.webkit.org/show_bug.cgi?id=225007
+
+Reviewed by Chris Dumez.
+
+When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
+we should attempt to reduce our memory footprint after some time interval to help relieve
+system-wide memory pressure. This is enabled only on Mac because iOS already does something
+similar just before WebContent suspends.
+
+* wtf/PlatformEnableCocoa.h:
+
 2021-04-26  Keith Miller  
 
 CodeBlock should do a better job accounting for extra memory it allocates.


Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (276618 => 276619)

--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-04-26 23:04:15 UTC (rev 276618)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-04-26 23:42:01 UTC (rev 276619)
@@ -390,6 +390,10 @@
 #define ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE 1
 #endif
 
+#if !defined(ENABLE_NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER) && (PLATFORM(MAC) || PLATFORM(MACCATALYST))
+#define ENABLE_NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER 1
+#endif
+
 #if !defined(ENABLE_NOTIFICATIONS) && PLATFORM(MAC)
 #define ENABLE_NOTIFICATIONS 1
 #endif


Modified: trunk/Source/WebKit/ChangeLog (276618 => 276619)

--- trunk/Source/WebKit/ChangeLog	2021-04-26 23:04:15 UTC (rev 276618)
+++ trunk/Source/WebKit/ChangeLog	2021-04-26 23:42:01 UTC (rev 276619)
@@ -1,5 +1,25 @@
 2021-04-26  Ben Nham  
 
+Reduce memory footprint for background tabs
+https://bugs.webkit.org/show_bug.cgi?id=225007
+
+Reviewed by Chris Dumez.
+
+When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
+we should attempt to reduce our memory footprint after some time interval to help relieve
+system-wide memory pressure. This is enabled only on Mac because iOS already does something
+similar just before WebContent suspends.
+
+* WebProcess/WebProcess.cpp:
+(WebKit::WebProcess::pageDidEnterWindow):
+(WebKit::WebProcess::pageWillLeaveWindow):
+(WebKit::WebProcess::nonVisibleProcessGraphicsCleanupTimerFired):
+(WebKit::WebProcess::nonVisibleProcessMemoryCleanupTimerFired):
+(WebKit::WebProcess::nonVisibleProcessCleanupTimerFired): Deleted.
+* WebProcess/WebProcess.h:
+
+2021-04-26  Ben Nham  
+
 Handle warning-level memory notifications more aggressively
 https://bugs.webkit.org/show_bug.cgi?id=225008
 


Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (276618 => 276619)

--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-26 23:04:15 UTC (rev 276618)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-26 23:42:01 UTC (rev 276619)
@@ -230,8 +230,14 @@
 static const Seconds plugInAutoStartExpirationTimeUpdateThreshold { 29 * 24 * 60 * 60 };
 
 // This should be greater than tileRevalidationTimeout in TileController.
-static const Seconds nonVisibleProcessCleanupDelay { 10_s };
+static const Seconds nonVisibleProcessGraphicsCleanupDelay { 10_s };
 
+#if ENABLE(NON_VISIBLE_WEBPROCESS_MEMORY_CLEANUP_TIMER)
+// This should be long enough to support a workload where a user is actively switching between multiple tabs,
+// since our memory cleanup routine could potentially delete a good amount of JIT code.
+static const Seconds nonVisibleProcessMemoryCleanupDelay { 120_s };
+#endif
+
 namespace WebKit {
 using namespace JSC;
 using namespace WebCore;
@@ -

[webkit-changes] [276618] trunk/Source/WebKit

2021-04-26 Thread nham
Title: [276618] trunk/Source/WebKit








Revision 276618
Author n...@apple.com
Date 2021-04-26 16:04:15 -0700 (Mon, 26 Apr 2021)


Log Message
Handle warning-level memory notifications more aggressively
https://bugs.webkit.org/show_bug.cgi?id=225008

Reviewed by Chris Dumez.

We've found that in some workloads, the critical-level memory pressure handler releases
significantly more memory than the warning-level memory pressure handler. On Macs, it is
likely that the memory pressure coincides with swapping. So when we get even a warning-level
notification from the OS, we should err on the side of releasing more memory to help relieve
the swapping state. To do this, treat warning level notifications the same as critical level
notifications on Mac if the WebProcess is in the background.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/WebProcess.cpp




Diff

Modified: trunk/Source/WebKit/ChangeLog (276617 => 276618)

--- trunk/Source/WebKit/ChangeLog	2021-04-26 22:37:48 UTC (rev 276617)
+++ trunk/Source/WebKit/ChangeLog	2021-04-26 23:04:15 UTC (rev 276618)
@@ -1,3 +1,20 @@
+2021-04-26  Ben Nham  
+
+Handle warning-level memory notifications more aggressively
+https://bugs.webkit.org/show_bug.cgi?id=225008
+
+Reviewed by Chris Dumez.
+
+We've found that in some workloads, the critical-level memory pressure handler releases
+significantly more memory than the warning-level memory pressure handler. On Macs, it is
+likely that the memory pressure coincides with swapping. So when we get even a warning-level
+notification from the OS, we should err on the side of releasing more memory to help relieve
+the swapping state. To do this, treat warning level notifications the same as critical level
+notifications on Mac if the WebProcess is in the background.
+
+* WebProcess/WebProcess.cpp:
+(WebKit::WebProcess::initializeWebProcess):
+
 2021-04-26  Alex Christensen  
 
 Update Mac-specific CMake files


Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (276617 => 276618)

--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-26 22:37:48 UTC (rev 276617)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-26 23:04:15 UTC (rev 276618)
@@ -385,6 +385,12 @@
 if (!m_suppressMemoryPressureHandler) {
 auto& memoryPressureHandler = MemoryPressureHandler::singleton();
 memoryPressureHandler.setLowMemoryHandler([this] (Critical critical, Synchronous synchronous) {
+// If this process contains only non-visible content (e.g. only contains background
+// tabs), then treat the memory warning as if it was a critical warning to maximize the
+// amount of memory released for foreground apps to use.
+if (m_pagesInWindows.isEmpty() && critical == Critical::No)
+critical = Critical::Yes;
+
 #if PLATFORM(MAC)
 // If this is a process we keep around for performance, kill it on memory pressure instead of trying to free up its memory.
 if (m_processType == ProcessType::CachedWebContent || m_processType == ProcessType::PrewarmedWebContent || areAllPagesSuspended()) {






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [276292] trunk/Source/JavaScriptCore

2021-04-20 Thread nham
Title: [276292] trunk/Source/_javascript_Core








Revision 276292
Author n...@apple.com
Date 2021-04-20 01:46:50 -0700 (Tue, 20 Apr 2021)


Log Message
LinkBuffer fails to build when MALLOC_HEAP_BREAKDOWN is enabled
https://bugs.webkit.org/show_bug.cgi?id=224722

Reviewed by Yusuke Suzuki.

When ENABLE_MALLOC_HEAP_BREAKDOWN is set, LinkBuffer causes a build failure at link time
since it never defines its debugHeap. Fix that.

* assembler/LinkBuffer.cpp:

Modified Paths

trunk/Source/_javascript_Core/ChangeLog
trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp




Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (276291 => 276292)

--- trunk/Source/_javascript_Core/ChangeLog	2021-04-20 07:44:07 UTC (rev 276291)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-04-20 08:46:50 UTC (rev 276292)
@@ -1,3 +1,15 @@
+2021-04-20  Ben Nham  
+
+LinkBuffer fails to build when MALLOC_HEAP_BREAKDOWN is enabled
+https://bugs.webkit.org/show_bug.cgi?id=224722
+
+Reviewed by Yusuke Suzuki.
+
+When ENABLE_MALLOC_HEAP_BREAKDOWN is set, LinkBuffer causes a build failure at link time
+since it never defines its debugHeap. Fix that.
+
+* assembler/LinkBuffer.cpp:
+
 2021-04-20  Yusuke Suzuki  
 
 [JSC] Use FixedVector for LLIntPrototypeLoadAdaptiveStructureWatchpoint vector


Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp (276291 => 276292)

--- trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp	2021-04-20 07:44:07 UTC (rev 276291)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp	2021-04-20 08:46:50 UTC (rev 276292)
@@ -138,6 +138,7 @@
 }
 
 DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(BranchCompactionLinkBuffer);
+DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(BranchCompactionLinkBuffer);
 
 class BranchCompactionLinkBuffer {
 WTF_MAKE_NONCOPYABLE(BranchCompactionLinkBuffer);






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [274180] trunk/Source/WebCore

2021-03-09 Thread nham
Title: [274180] trunk/Source/WebCore








Revision 274180
Author n...@apple.com
Date 2021-03-09 15:22:49 -0800 (Tue, 09 Mar 2021)


Log Message
REGRESSION: [BigSur] ASSERT NOT REACHED in WebCore::ResourceLoadPriority WebCore::toResourceLoadPriority
https://bugs.webkit.org/show_bug.cgi?id=222998

Unreviewed, fix the debug assert caused by r274161.

CFURLRequestGetRequestPriority can return -1 for requests with no priority set (e.g. some
requests from the media stack). We need to handle this case when transforming a
CFURLRequestPriority to a ResourceLoadPriority.

* platform/network/cf/ResourceRequestCFNet.h:
(WebCore::toResourceLoadPriority):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (274179 => 274180)

--- trunk/Source/WebCore/ChangeLog	2021-03-09 23:08:41 UTC (rev 274179)
+++ trunk/Source/WebCore/ChangeLog	2021-03-09 23:22:49 UTC (rev 274180)
@@ -1,3 +1,17 @@
+2021-03-09  Ben Nham  
+
+REGRESSION: [BigSur] ASSERT NOT REACHED in WebCore::ResourceLoadPriority WebCore::toResourceLoadPriority
+https://bugs.webkit.org/show_bug.cgi?id=222998
+
+Unreviewed, fix the debug assert caused by r274161.
+
+CFURLRequestGetRequestPriority can return -1 for requests with no priority set (e.g. some
+requests from the media stack). We need to handle this case when transforming a
+CFURLRequestPriority to a ResourceLoadPriority.
+
+* platform/network/cf/ResourceRequestCFNet.h:
+(WebCore::toResourceLoadPriority):
+
 2021-03-09  Eric Carlson  
 
 [GPU Process] MSE videos are unable to AirPlay


Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h (274179 => 274180)

--- trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h	2021-03-09 23:08:41 UTC (rev 274179)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h	2021-03-09 23:22:49 UTC (rev 274180)
@@ -48,6 +48,7 @@
 inline ResourceLoadPriority toResourceLoadPriority(CFURLRequestPriority priority)
 {
 switch (priority) {
+case -1:
 case 0:
 return ResourceLoadPriority::VeryLow;
 case 1:






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [274161] trunk/Source

2021-03-09 Thread nham
Title: [274161] trunk/Source








Revision 274161
Author n...@apple.com
Date 2021-03-09 11:08:33 -0800 (Tue, 09 Mar 2021)


Log Message
Adopt new NSURLSessionConfiguration SPI for connection cache configuration
https://bugs.webkit.org/show_bug.cgi?id=222934

Reviewed by Geoffrey Garen.

Source/WebCore:

This uses the NSURLSessionConfiguration connection cache limit SPI introduced in Big Sur to
properly set the parameters we want for HTTP/1.1 connections. Previously we tried to do this
using _CFNetworkHTTPConnectionCacheSetLimit in NetworkProcessCocoa, but this didn't work
because that SPI only applies to NSURLConnection rather than NSURLSession.

In particular, this meant that the number of priority levels wasn't set correctly, which we
had to work around by constraining the number of priority levels when mapping WebKit
resource priorities to CFNetwork priorities (https://bugs.webkit.org/show_bug.cgi?id=203423).
This patch adopts the SPI and removes that workaround.

* platform/network/cf/ResourceRequestCFNet.h:
(WebCore::toResourceLoadPriority):
(WebCore::toPlatformRequestPriority):

Source/WebCore/PAL:

Declare NSURLSessionConfiguration connection cache limit SPI when building using the public SDK.

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

This uses the NSURLSessionConfiguration connection cache limit SPI introduced in Big Sur to
properly set the parameters we want for HTTP/1.1 connections. Previously we tried to do this
using _CFNetworkHTTPConnectionCacheSetLimit in NetworkProcessCocoa, but this didn't work
because that SPI only applies to NSURLConnection rather than NSURLSession.

In particular, this meant that the number of priority levels wasn't set correctly, which we
had to work around by constraining the number of priority levels when mapping WebKit
resource priorities to CFNetwork priorities (https://bugs.webkit.org/show_bug.cgi?id=203423).
This patch adopts the SPI and removes that workaround.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForSessionID):

Source/WTF:

Add the HAVE_CFNETWORK_NSURLSESSION_CONNECTION_CACHE_LIMITS flag to control whether or not
to use the connection cache limit SPI on NSURLSessionConfiguration.

* wtf/PlatformHave.h:

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformHave.h
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/PAL/ChangeLog
trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm




Diff

Modified: trunk/Source/WTF/ChangeLog (274160 => 274161)

--- trunk/Source/WTF/ChangeLog	2021-03-09 18:58:53 UTC (rev 274160)
+++ trunk/Source/WTF/ChangeLog	2021-03-09 19:08:33 UTC (rev 274161)
@@ -1,3 +1,15 @@
+2021-03-09  Ben Nham  
+
+Adopt new NSURLSessionConfiguration SPI for connection cache configuration
+https://bugs.webkit.org/show_bug.cgi?id=222934
+
+Reviewed by Geoffrey Garen.
+
+Add the HAVE_CFNETWORK_NSURLSESSION_CONNECTION_CACHE_LIMITS flag to control whether or not
+to use the connection cache limit SPI on NSURLSessionConfiguration.
+
+* wtf/PlatformHave.h:
+
 2021-03-08  Sam Weinig  
 
 Remove quirks for the no longer supported iAd Producer


Modified: trunk/Source/WTF/wtf/PlatformHave.h (274160 => 274161)

--- trunk/Source/WTF/wtf/PlatformHave.h	2021-03-09 18:58:53 UTC (rev 274160)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-03-09 19:08:33 UTC (rev 274161)
@@ -416,6 +416,13 @@
 #define HAVE_CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE 1
 #endif
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 11) \
+|| (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 14) \
+|| (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 7) \
+|| (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 14)
+#define HAVE_CFNETWORK_NSURLSESSION_CONNECTION_CACHE_LIMITS 1
+#endif
+
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || PLATFORM(IOS_FAMILY)
 #define HAVE_CFNETWORK_NEGOTIATED_SSL_PROTOCOL_CIPHER 1
 #endif


Modified: trunk/Source/WebCore/ChangeLog (274160 => 274161)

--- trunk/Source/WebCore/ChangeLog	2021-03-09 18:58:53 UTC (rev 274160)
+++ trunk/Source/WebCore/ChangeLog	2021-03-09 19:08:33 UTC (rev 274161)
@@ -1,3 +1,24 @@
+2021-03-09  Ben Nham  
+
+Adopt new NSURLSessionConfiguration SPI for connection cache configuration
+https://bugs.webkit.org/show_bug.cgi?id=222934
+
+Reviewed by Geoffrey Garen.
+
+This uses the NSURLSessionConfiguration connection cache limit SPI introduced in Big Sur to
+properly set the parameters we want for HTTP/1.1 connections. Previously we tried to do this
+using _CFNetworkHTTPConnectionCacheSetLimit in NetworkProcessCocoa, but this didn't work
+because that SPI only applies to NSURLConnectio

[webkit-changes] [266958] trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp

2020-09-11 Thread nham
Title: [266958] trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp








Revision 266958
Author n...@apple.com
Date 2020-09-11 16:54:16 -0700 (Fri, 11 Sep 2020)


Log Message
Unreviewed build fix for r266771. An include is missing which causes the build to fail flakily depending on the position of the cpp in the unified source file.

* UIProcess/mac/DisplayLink.cpp:

Modified Paths

trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp




Diff

Modified: trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp (266957 => 266958)

--- trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp	2020-09-11 23:46:01 UTC (rev 266957)
+++ trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp	2020-09-11 23:54:16 UTC (rev 266958)
@@ -29,6 +29,7 @@
 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
 
 #include "EventDispatcherMessages.h"
+#include "WebProcessMessages.h"
 #include 
 
 namespace WebKit {






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [266932] trunk/Source

2020-09-11 Thread nham
Title: [266932] trunk/Source








Revision 266932
Author n...@apple.com
Date 2020-09-11 11:54:17 -0700 (Fri, 11 Sep 2020)


Log Message
Fix undeclared identifier issue due to clashes in soft link headers
https://bugs.webkit.org/show_bug.cgi?id=216412

Reviewed by Geoffrey Garen.

Source/WebCore/PAL:

r266898 broke builds on certain SDKs. The reason for this is that it includes
MediaToolbox/FigPhoto.h, which transitively includes CoreMedia/CMTimePrivate.h. The latter
header has a bunch of inline code in certain SDKs which conflicts with the
CoreMediaSoftLink.h header. For instance, CoreMediaSoftLink.h redefines CMTimeCompare to
softLink_CoreMedia_CMTimeCompare, which messes up the inline code in the CMTimePrivate.h
header that references CMTimeCompare.

For now, we just avoid including FigPhoto.h altogether and use a constant. We'll clean this
up once we start weak linking rather than soft linking CoreMedia and MediaToolbox (216388).

* pal/cocoa/MediaToolboxSoftLink.cpp:
* pal/cocoa/MediaToolboxSoftLink.h:
* pal/spi/cocoa/MediaToolboxSPI.h:

Source/WebKit:

Use the workaround constant kPALFigPhotoContainerFormat_JFIF instead of the enum value
kFigPhotoContainerFormat_JFIF.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

Modified Paths

trunk/Source/WebCore/PAL/ChangeLog
trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp
trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h
trunk/Source/WebCore/PAL/pal/spi/cocoa/MediaToolboxSPI.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm




Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (266931 => 266932)

--- trunk/Source/WebCore/PAL/ChangeLog	2020-09-11 18:53:24 UTC (rev 266931)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-09-11 18:54:17 UTC (rev 266932)
@@ -1,3 +1,24 @@
+2020-09-11  Ben Nham  
+
+Fix undeclared identifier issue due to clashes in soft link headers
+https://bugs.webkit.org/show_bug.cgi?id=216412
+
+Reviewed by Geoffrey Garen.
+
+r266898 broke builds on certain SDKs. The reason for this is that it includes
+MediaToolbox/FigPhoto.h, which transitively includes CoreMedia/CMTimePrivate.h. The latter
+header has a bunch of inline code in certain SDKs which conflicts with the
+CoreMediaSoftLink.h header. For instance, CoreMediaSoftLink.h redefines CMTimeCompare to
+softLink_CoreMedia_CMTimeCompare, which messes up the inline code in the CMTimePrivate.h
+header that references CMTimeCompare.
+
+For now, we just avoid including FigPhoto.h altogether and use a constant. We'll clean this
+up once we start weak linking rather than soft linking CoreMedia and MediaToolbox (216388).
+
+* pal/cocoa/MediaToolboxSoftLink.cpp:
+* pal/cocoa/MediaToolboxSoftLink.h:
+* pal/spi/cocoa/MediaToolboxSPI.h:
+
 2020-09-10  Ben Nham  
 
 Disable hardware JPEG decoding on x86 Mac


Modified: trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp (266931 => 266932)

--- trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp	2020-09-11 18:53:24 UTC (rev 266931)
+++ trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp	2020-09-11 18:54:17 UTC (rev 266932)
@@ -33,7 +33,7 @@
 
 SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, PAL_EXPORT)
 
-SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, FigPhotoDecompressionSetHardwareCutoff, void, (FigPhotoContainerFormat format, size_t numPixelsCutoff), (format, numPixelsCutoff), PAL_EXPORT)
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, FigPhotoDecompressionSetHardwareCutoff, void, (int format, size_t numPixelsCutoff), (format, numPixelsCutoff), PAL_EXPORT)
 
 SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, MTShouldPlayHDRVideo, Boolean, (CFArrayRef displayList), (displayList), PAL_EXPORT)
 SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, MTOverrideShouldPlayHDRVideo, void, (Boolean override, Boolean playHDRVideo), (override, playHDRVideo), PAL_EXPORT)


Modified: trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h (266931 => 266932)

--- trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h	2020-09-11 18:53:24 UTC (rev 266931)
+++ trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h	2020-09-11 18:54:17 UTC (rev 266932)
@@ -33,7 +33,7 @@
 
 SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, MediaToolbox)
 
-SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(PAL, MediaToolbox, FigPhotoDecompressionSetHardwareCutoff, void, (FigPhotoContainerFormat format, size_t numPixelsCutoff), (format, numPixelsCutoff))
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(PAL, MediaToolbox, FigPhotoDecompressionSetHardwareCutoff, void, (int, size_t numPixelsCutoff), (format, numPixelsCutoff))
 
 SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(PAL, MediaToolbox, MTShouldPlayHDRVideo, Boolean, (CFArrayRef displayList), (di

[webkit-changes] [266898] trunk/Source

2020-09-10 Thread nham
Title: [266898] trunk/Source








Revision 266898
Author n...@apple.com
Date 2020-09-10 16:52:11 -0700 (Thu, 10 Sep 2020)


Log Message
Disable hardware JPEG decoding on x86 Mac
https://bugs.webkit.org/show_bug.cgi?id=216377

Reviewed by Geoff Garen.

Source/WebCore/PAL:

Add wrappers for a new MediaToolbox SPI that allows us to disable HW JPEG decoding.

* PAL.xcodeproj/project.pbxproj:
* pal/PlatformMac.cmake:
* pal/cocoa/MediaToolboxSoftLink.cpp:
* pal/cocoa/MediaToolboxSoftLink.h:

Source/WebKit:

In Big Sur, ImageIO uses hardware JPEG decoding automatically for certain JPEGs. This caused
a small regression in our battery life benchmark since the one-time setup cost for the
decoder (~20-30 ms per process) was higher than the per-decode win we got from the HW decoder.

For now, we're reverting to the Catalina behavior of not using hardware JPEG on x86 Macs by
calling a MediaToolbox SPI. (The tradeoffs for Apple Silicon are different so we use
ImageIO's default heuristics on that architecture.) We plan to revisit this decision once we
move to a GPUProcess world.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

Source/WTF:

Add macros to disable HW JPEG decoding on x86 Macs and indicate the presence of a new MediaToolbox SPI.
(The latter is to prevent unnecessary dlopen/dlsym calls since we soft-link MediaToolbox.)

* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
trunk/Source/WTF/wtf/PlatformHave.h
trunk/Source/WebCore/PAL/ChangeLog
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
trunk/Source/WebCore/PAL/pal/PlatformMac.cmake
trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp
trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm


Added Paths

trunk/Source/WebCore/PAL/pal/spi/cocoa/MediaToolboxSPI.h




Diff

Modified: trunk/Source/WTF/ChangeLog (266897 => 266898)

--- trunk/Source/WTF/ChangeLog	2020-09-10 23:25:32 UTC (rev 266897)
+++ trunk/Source/WTF/ChangeLog	2020-09-10 23:52:11 UTC (rev 266898)
@@ -1,3 +1,16 @@
+2020-09-10  Ben Nham  
+
+Disable hardware JPEG decoding on x86 Mac
+https://bugs.webkit.org/show_bug.cgi?id=216377
+
+Reviewed by Geoff Garen.
+
+Add macros to disable HW JPEG decoding on x86 Macs and indicate the presence of a new MediaToolbox SPI.
+(The latter is to prevent unnecessary dlopen/dlsym calls since we soft-link MediaToolbox.)
+
+* wtf/PlatformEnableCocoa.h:
+* wtf/PlatformHave.h:
+
 2020-09-10  Devin Rousso  
 
 Web Inspector: modernize generated backend protocol code


Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (266897 => 266898)

--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2020-09-10 23:25:32 UTC (rev 266897)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2020-09-10 23:52:11 UTC (rev 266898)
@@ -232,6 +232,10 @@
 #define ENABLE_GPU_DRIVER_PREWARMING 1
 #endif
 
+#if !defined(ENABLE_HARDWARE_JPEG) && !(PLATFORM(MAC) && CPU(X86_64))
+#define ENABLE_HARDWARE_JPEG 1
+#endif
+
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 11
 #define ENABLE_UI_PROCESS_PDF_HUD 1
 #endif


Modified: trunk/Source/WTF/wtf/PlatformHave.h (266897 => 266898)

--- trunk/Source/WTF/wtf/PlatformHave.h	2020-09-10 23:25:32 UTC (rev 266897)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-09-10 23:52:11 UTC (rev 266898)
@@ -238,6 +238,10 @@
 #define HAVE_CELESTIAL 1
 #endif
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 11
+#define HAVE_FIG_PHOTO_DECOMPRESSION_SET_HARDWARE_CUTOFF 1
+#endif
+
 #if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
 #define HAVE_CORE_ANIMATION_RENDER_SERVER 1
 #endif


Modified: trunk/Source/WebCore/PAL/ChangeLog (266897 => 266898)

--- trunk/Source/WebCore/PAL/ChangeLog	2020-09-10 23:25:32 UTC (rev 266897)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-09-10 23:52:11 UTC (rev 266898)
@@ -1,3 +1,17 @@
+2020-09-10  Ben Nham  
+
+Disable hardware JPEG decoding on x86 Mac
+https://bugs.webkit.org/show_bug.cgi?id=216377
+
+Reviewed by Geoff Garen.
+
+Add wrappers for a new MediaToolbox SPI that allows us to disable HW JPEG decoding.
+
+* PAL.xcodeproj/project.pbxproj:
+* pal/PlatformMac.cmake:
+* pal/cocoa/MediaToolboxSoftLink.cpp:
+* pal/cocoa/MediaToolboxSoftLink.h:
+
 2020-09-10  Jer Noble  
 
 [Cocoa] PERF: Don't instantiate AVPlayer-based audio decoders or renderers if an element is initially muted.


Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (266897 => 266898)

--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2020-09-10 23:25:32 UTC (rev 266897)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2020-09-10 23:52:11 UTC (rev 266898)
@@ -183,6 +183,7 @@
 		CE5673872151A

[webkit-changes] [265418] trunk/Source

2020-08-09 Thread nham
Title: [265418] trunk/Source








Revision 265418
Author n...@apple.com
Date 2020-08-09 11:23:44 -0700 (Sun, 09 Aug 2020)


Log Message
Preload graphics drivers in Mac WebProcess
https://bugs.webkit.org/show_bug.cgi?id=215183

Reviewed by Darin Adler.

Source/WebCore:

In newer versions of Mac OS, graphics drivers are no longer part of the shared cache due to
size restrictions. This can cause first render to be blocked by ~10 ms when we dlopen those
drivers. To work around this, we preload the drivers when prewarming the WebProcess.

* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):

Source/WTF:

Enable GPU driver preheating in versions of the OS that might not have the drivers in the dyld
shared cache due to size restrictions.

* wtf/PlatformEnableCocoa.h:

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/page/ProcessWarming.cpp




Diff

Modified: trunk/Source/WTF/ChangeLog (265417 => 265418)

--- trunk/Source/WTF/ChangeLog	2020-08-09 15:34:01 UTC (rev 265417)
+++ trunk/Source/WTF/ChangeLog	2020-08-09 18:23:44 UTC (rev 265418)
@@ -1,3 +1,15 @@
+2020-08-09  Ben Nham  
+
+Preload graphics drivers in Mac WebProcess
+https://bugs.webkit.org/show_bug.cgi?id=215183
+
+Reviewed by Darin Adler.
+
+Enable GPU driver preheating in versions of the OS that might not have the drivers in the dyld
+shared cache due to size restrictions.
+
+* wtf/PlatformEnableCocoa.h:
+
 2020-08-09  Commit Queue  
 
 Unreviewed, reverting r263195, r263252, and r265394.


Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (265417 => 265418)

--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2020-08-09 15:34:01 UTC (rev 265417)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2020-08-09 18:23:44 UTC (rev 265418)
@@ -224,6 +224,10 @@
 #define ENABLE_GPU_PROCESS 1
 #endif
 
+#if !defined(ENABLE_GPU_DRIVER_PREWARMING) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600
+#define ENABLE_GPU_DRIVER_PREWARMING 1
+#endif
+
 #if !defined(ENABLE_INDEXED_DATABASE)
 #define ENABLE_INDEXED_DATABASE 1
 #endif


Modified: trunk/Source/WebCore/ChangeLog (265417 => 265418)

--- trunk/Source/WebCore/ChangeLog	2020-08-09 15:34:01 UTC (rev 265417)
+++ trunk/Source/WebCore/ChangeLog	2020-08-09 18:23:44 UTC (rev 265418)
@@ -1,3 +1,17 @@
+2020-08-09  Ben Nham  
+
+Preload graphics drivers in Mac WebProcess
+https://bugs.webkit.org/show_bug.cgi?id=215183
+
+Reviewed by Darin Adler.
+
+In newer versions of Mac OS, graphics drivers are no longer part of the shared cache due to
+size restrictions. This can cause first render to be blocked by ~10 ms when we dlopen those
+drivers. To work around this, we preload the drivers when prewarming the WebProcess.
+
+* page/ProcessWarming.cpp:
+(WebCore::ProcessWarming::prewarmGlobally):
+
 2020-08-09  Youenn Fablet  
 
 Always resolve ReadableStream's tee()'s cancel promise after the stream closes or errors


Modified: trunk/Source/WebCore/page/ProcessWarming.cpp (265417 => 265418)

--- trunk/Source/WebCore/page/ProcessWarming.cpp	2020-08-09 15:34:01 UTC (rev 265417)
+++ trunk/Source/WebCore/page/ProcessWarming.cpp	2020-08-09 18:23:44 UTC (rev 265418)
@@ -43,6 +43,11 @@
 #include "XMLNSNames.h"
 #include "XMLNames.h"
 
+#if ENABLE(GPU_DRIVER_PREWARMING)
+#include "GPUDevice.h"
+#include "GPURequestAdapterOptions.h"
+#endif
+
 namespace WebCore {
 
 void ProcessWarming::initializeNames()
@@ -78,6 +83,10 @@
 #if ENABLE(TELEPHONE_NUMBER_DETECTION)
 TelephoneNumberDetector::isSupported();
 #endif
+
+#if ENABLE(GPU_DRIVER_PREWARMING)
+GPUDevice::tryCreate(WTF::nullopt);
+#endif
 }
 
 WebCore::PrewarmInformation ProcessWarming::collectPrewarmInformation()






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [261533] trunk

2020-05-11 Thread nham
Title: [261533] trunk








Revision 261533
Author n...@apple.com
Date 2020-05-11 17:38:17 -0700 (Mon, 11 May 2020)


Log Message
Improve accuracy of IndexedDB estimated write size computation
https://bugs.webkit.org/show_bug.cgi?id=211360

Reviewed by Brady Eidson.

Source/WebCore:

We currently estimate the size of a put in IndexedDB for quota check purposes with something
like:

  estimatedWriteSize = (1 + numIndices) * (keySize + valueSize)

However, this can lead to large overestimates of write sizes. This is because secondary
indices only store a mapping of secondary index key => primary key; they do not store the
entire value. In the example site attached to 202137 (another DB quota-related bug), the
the heuristic estimates that one of the put operations would use more than 800 MB when it
actually uses 220 MB. This inaccuracy leads to spurious disk quota permission modals being
presented in Safari.

This patch improves the write size computation by generating the secondary index keys before
estimating the write size. The performance should be about the same since we save the
generated index keys for later usage when we actually add the record to the DB.

* Headers.cmake:
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::MemoryIDBBackingStore):
(WebCore::IDBServer::MemoryIDBBackingStore::addRecord):
(WebCore::IDBServer::MemoryIDBBackingStore::serializationContext):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::addRecord):
(WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord):
* Modules/indexeddb/server/MemoryObjectStore.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::serializationContext):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::estimateSize):
(WebCore::IDBServer::UniqueIDBDatabase::putOrAdd):
* Modules/indexeddb/shared/IndexKey.h:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::generateIndexKeyMapForValue):
* bindings/js/IDBBindingUtilities.h:

LayoutTests:

Added a layout test to check that the size estimate associated with adding an object to a
store with many indices is reasonable.

* platform/mac-wk1/TestExpectations: Skip test on Mac WK1 since it doesn't implement quota checks.
* platform/win/TestExpectations: Skip test on Windows since it doesn't implement quota checks.
* storage/indexeddb/resources/storage-limit-with-indices.js: Added.
* storage/indexeddb/storage-limit-with-indices-expected.txt: Added.
* storage/indexeddb/storage-limit-with-indices.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/mac-wk1/TestExpectations
trunk/LayoutTests/platform/win/TestExpectations
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
trunk/Source/WebCore/Modules/indexeddb/shared/IndexKey.h
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h


Added Paths

trunk/LayoutTests/storage/indexeddb/resources/storage-limit-with-indices.js
trunk/LayoutTests/storage/indexeddb/storage-limit-with-indices-expected.txt
trunk/LayoutTests/storage/indexeddb/storage-limit-with-indices.html




Diff

Modified: trunk/LayoutTests/ChangeLog (261532 => 261533)

--- trunk/LayoutTests/ChangeLog	2020-05-12 00:34:35 UTC (rev 261532)
+++ trunk/LayoutTests/ChangeLog	2020-05-12 00:38:17 UTC (rev 261533)
@@ -1,3 +1,19 @@
+2020-05-11  Ben Nham  
+
+Improve accuracy of IndexedDB estimated write size computation
+https://bugs.webkit.org/show_bug.cgi?id=211360
+
+Reviewed by Brady Eidson.
+
+Added a layout test to check that the size estimate associated with adding an object to a
+store with many indices is reasonable.
+
+* platform/mac-wk1/TestExpectations: Skip test on Mac WK1 since it doesn't implement quota checks.
+* platform/win/TestExpectations: Skip test on Windows since it doesn't implement quota checks.
+* storage/indexeddb/resources/storage-limit-with-indi

[webkit-changes] [261141] trunk

2020-05-04 Thread nham
ore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
trunk/Source/WebCore/Sources.txt
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp
trunk/Source/WebCore/platform/sql/SQLiteDatabase.h
trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp
trunk/Tools/ChangeLog
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj


Added Paths

trunk/Source/WebCore/platform/sql/SQLiteStatementAutoResetScope.cpp
trunk/Source/WebCore/platform/sql/SQLiteStatementAutoResetScope.h
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IDBCheckpointWAL.html
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IDBCheckpointWAL.mm




Diff

Modified: trunk/Source/WebCore/ChangeLog (261140 => 261141)

--- trunk/Source/WebCore/ChangeLog	2020-05-05 03:19:23 UTC (rev 261140)
+++ trunk/Source/WebCore/ChangeLog	2020-05-05 03:19:56 UTC (rev 261141)
@@ -1,3 +1,82 @@
+2020-05-04  Ben Nham  
+
+IndexedDB WAL file keeps growing while app is in use
+https://bugs.webkit.org/show_bug.cgi?id=202137
+
+Reviewed by Brady Eidson.
+
+It's easy to get into a situation where the WAL file associated with a SQLite-backed
+IndexedDB grows indefinitely while a site is in use for two reasons:
+
+1. We don't promptly reset cached prepared statements in SQLiteIDBBackingStore. Many
+statements are left hanging in the SQLITE_ROW state without being reset or fully stepped to
+the SQLITE_DONE state. These hanging statements keep their associated transactions open and
+prevent the WAL checkpointer from progressing past those active transactions.
+
+To fix this, I added SQLiteStatementAutoResetScope. This is a scope guard that
+SQLiteIDBBackingStore uses to ensure that cached statements are reset in a timely manner.
+
+While going through the reset code I also noticed we aren't clearing bindings after
+resetting statements. We should be doing this because sqlite3_reset does not clear bindings
+(and their associated copies of blobs/strings); sqlite3_clear_bindings does that.
+
+2. The default WAL hook for auto-checkpointing in upstream SQLite uses the
+SQLITE_CHECKPOINT_PASSIVE mode, which doesn't truncate the WAL until the next write
+transaction occurs. (It actually doesn't truncate at all when compiled with default
+settings, but macOS's SQLite sets SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT, which causes the
+truncation to occur on the next write.)
+
+We want the WAL to be truncated more promptly, because otherwise the quota check that
+happens on each mutation won't be as accurate. To do this, I installed a WAL hook that
+truncates the WAL with SQLITE_CHECKPOINT_TRUNCATE after the default threshold of 1000 WAL
+pages. I didn't enable this for all SQLiteDatabases because this checkpoint call can block
+on the busy handler. This isn't a problem for IDB since we don't use busy handlers in IDB.
+
+* Headers.cmake:
+* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
+(WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
+(WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore):
+(WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
+(WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
+(WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
+(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord):
+(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
+(WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
+(WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
+(WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore):
+(WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords):
+(WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
+(WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
+(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
+(WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord):
+(WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
+(WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords):
+(WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
+(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
+(WebCore::IDBServer::SQLiteIDBBackingStore::getCount):
+(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue):
+(WebCore::IDBServer::SQLiteIDBBackin

[webkit-changes] [260158] trunk/Source/WebKit

2020-04-15 Thread nham
Title: [260158] trunk/Source/WebKit








Revision 260158
Author n...@apple.com
Date 2020-04-15 16:17:58 -0700 (Wed, 15 Apr 2020)


Log Message
DidFirstLayerFlush IPC can be head-of-line-blocked and delay first paint by 200+ ms on process swap
https://bugs.webkit.org/show_bug.cgi?id=210571

Reviewed by Geoffrey Garen.

When we process swap, the layer swap/unhiding for the new hosted layer is gated by the
DidFirstLayerFlush IPC. But actually sending this IPC can be head-of-line blocked for an
arbitrarily long time because we append it to the queue of messages for the main run loop to
process. In some cases, e.g. for the NYT PLT content, this blocks first paint by 200 ms
while the WebProcess main thread is busy doing other things (like executing deferred
scripts).

To fix this, use a CATransaction commit handler to send the IPC right after we commit.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm




Diff

Modified: trunk/Source/WebKit/ChangeLog (260157 => 260158)

--- trunk/Source/WebKit/ChangeLog	2020-04-15 23:12:42 UTC (rev 260157)
+++ trunk/Source/WebKit/ChangeLog	2020-04-15 23:17:58 UTC (rev 260158)
@@ -1,3 +1,22 @@
+2020-04-15  Ben Nham  
+
+DidFirstLayerFlush IPC can be head-of-line-blocked and delay first paint by 200+ ms on process swap
+https://bugs.webkit.org/show_bug.cgi?id=210571
+
+Reviewed by Geoffrey Garen.
+
+When we process swap, the layer swap/unhiding for the new hosted layer is gated by the
+DidFirstLayerFlush IPC. But actually sending this IPC can be head-of-line blocked for an
+arbitrarily long time because we append it to the queue of messages for the main run loop to
+process. In some cases, e.g. for the NYT PLT content, this blocks first paint by 200 ms
+while the WebProcess main thread is busy doing other things (like executing deferred
+scripts).
+
+To fix this, use a CATransaction commit handler to send the IPC right after we commit.
+
+* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+(WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded):
+
 2020-04-15  Wenson Hsieh  
 
 Unreviewed, fix the watchOS and tvOS builds after r260146


Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (260157 => 260158)

--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2020-04-15 23:12:42 UTC (rev 260157)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2020-04-15 23:17:58 UTC (rev 260158)
@@ -110,13 +110,13 @@
 m_needsSendDidFirstLayerFlush = false;
 
 // Let the first commit complete before sending.
-RunLoop::main().dispatch([this, weakThis = makeWeakPtr(*this)] {
+[CATransaction addCommitHandler:[this, weakThis = makeWeakPtr(*this)] {
 if (!weakThis)
 return;
 LayerTreeContext layerTreeContext;
 layerTreeContext.contextID = m_layerHostingContext->contextID();
 send(Messages::DrawingAreaProxy::DidFirstLayerFlush(0, layerTreeContext));
-});
+} forPhase:kCATransactionPhasePostCommit];
 }
 
 void TiledCoreAnimationDrawingArea::sendEnterAcceleratedCompositingModeIfNeeded()






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [257955] trunk/Source/WebCore

2020-03-05 Thread nham
Title: [257955] trunk/Source/WebCore








Revision 257955
Author n...@apple.com
Date 2020-03-05 16:02:48 -0800 (Thu, 05 Mar 2020)


Log Message
Add signposts for top-level execution of script elements
https://bugs.webkit.org/show_bug.cgi?id=208548

Reviewed by Alex Christensen.

This adds signposts for initial global scope code evaluation of script elements. This makes
it easier to understand what code is executing and blocking initial HTML parsing from
completing.

In the long run, it would be nice to extend this to all top-level entry points back into JS
(e.g. we should emit an interval if we re-enter a script via setTimeout). However, such
probes have been removed in the past for being too noisy or slow (like in
https://bugs.webkit.org/show_bug.cgi?id=187196), so let's just start with this for now.

Note that we do emit the script URL in the signpost, but the signpost is gated behind both
an environment variable and an Apple-internal check to prevent accidentally leaking
sensitive info.

* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeClassicScript):
(WebCore::ScriptElement::executeModuleScript):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/dom/ScriptElement.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (257954 => 257955)

--- trunk/Source/WebCore/ChangeLog	2020-03-05 23:58:10 UTC (rev 257954)
+++ trunk/Source/WebCore/ChangeLog	2020-03-06 00:02:48 UTC (rev 257955)
@@ -1,3 +1,27 @@
+2020-03-05  Ben Nham  
+
+Add signposts for top-level execution of script elements
+https://bugs.webkit.org/show_bug.cgi?id=208548
+
+Reviewed by Alex Christensen.
+
+This adds signposts for initial global scope code evaluation of script elements. This makes
+it easier to understand what code is executing and blocking initial HTML parsing from
+completing.
+
+In the long run, it would be nice to extend this to all top-level entry points back into JS
+(e.g. we should emit an interval if we re-enter a script via setTimeout). However, such
+probes have been removed in the past for being too noisy or slow (like in
+https://bugs.webkit.org/show_bug.cgi?id=187196), so let's just start with this for now.
+
+Note that we do emit the script URL in the signpost, but the signpost is gated behind both
+an environment variable and an Apple-internal check to prevent accidentally leaking
+sensitive info.
+
+* dom/ScriptElement.cpp:
+(WebCore::ScriptElement::executeClassicScript):
+(WebCore::ScriptElement::executeModuleScript):
+
 2020-03-05  Zalan Bujtas  
 
 [First paint] Fixed sized SVG content should taken into account when computing VNE status


Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (257954 => 257955)

--- trunk/Source/WebCore/dom/ScriptElement.cpp	2020-03-05 23:58:10 UTC (rev 257954)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp	2020-03-06 00:02:48 UTC (rev 257955)
@@ -52,6 +52,7 @@
 #include "Settings.h"
 #include "TextNodeTraversal.h"
 #include 
+#include 
 #include 
 #include 
 
@@ -392,7 +393,9 @@
 IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ?  : nullptr);
 CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
 
+WTFBeginSignpost(this, "Execute Script Element", "executing classic script from URL: %{public}s async: %d defer: %d", m_isExternalScript ? sourceCode.url().string().utf8().data() : "inline", hasAsyncAttribute(), hasDeferAttribute());
 frame->script().evaluateIgnoringException(sourceCode);
+WTFEndSignpost(this, "Execute Script Element");
 }
 
 void ScriptElement::executeModuleScript(LoadableModuleScript& loadableModuleScript)
@@ -409,7 +412,9 @@
 IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer();
 CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
 
+WTFBeginSignpost(this, "Execute Script Element", "executing module script");
 frame->script().linkAndEvaluateModuleScript(loadableModuleScript);
+WTFEndSignpost(this, "Execute Script Element", "executing module script");
 }
 
 void ScriptElement::dispatchLoadEventRespectingUserGestureIndicator()






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [257941] trunk/LayoutTests

2020-03-05 Thread nham
Title: [257941] trunk/LayoutTests








Revision 257941
Author n...@apple.com
Date 2020-03-05 13:14:43 -0800 (Thu, 05 Mar 2020)


Log Message
REGRESSION (r257862): imported/w3c/web-platform-tests/svg/import/struct-dom-06-b-manual.svg is failing

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/ios/TestExpectations




Diff

Modified: trunk/LayoutTests/ChangeLog (257940 => 257941)

--- trunk/LayoutTests/ChangeLog	2020-03-05 21:01:38 UTC (rev 257940)
+++ trunk/LayoutTests/ChangeLog	2020-03-05 21:14:43 UTC (rev 257941)
@@ -1,3 +1,15 @@
+2020-03-05  Ben Nham  
+
+REGRESSION (r257862): imported/w3c/web-platform-tests/svg/import/struct-dom-06-b-manual.svg is failing
+https://bugs.webkit.org/show_bug.cgi?id=208653
+
+Unreviewed test gardening.
+
+Mark this test as flaky on iOS. It was already flaky on Mac with the same diff. Using 204312
+to track flakiness on both platforms.
+
+* platform/ios/TestExpectations:
+
 2020-03-05  Jason Lawrence  
 
 [ iOS wk2 ] http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star.html  is flaky failing.


Modified: trunk/LayoutTests/platform/ios/TestExpectations (257940 => 257941)

--- trunk/LayoutTests/platform/ios/TestExpectations	2020-03-05 21:01:38 UTC (rev 257940)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-03-05 21:14:43 UTC (rev 257941)
@@ -3540,3 +3540,5 @@
 
 webkit.org/b/208053 imported/w3c/web-platform-tests/intersection-observer/v2/cross-origin-effects.sub.html [ Skip ]
 webkit.org/b/208053 imported/w3c/web-platform-tests/intersection-observer/v2/cross-origin-occlusion.sub.html [ Skip ]
+
+webkit.org/b/204312 imported/w3c/web-platform-tests/svg/import/struct-dom-06-b-manual.svg [ Failure Pass ]






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [257862] trunk/Source

2020-03-04 Thread nham
Title: [257862] trunk/Source








Revision 257862
Author n...@apple.com
Date 2020-03-04 11:04:57 -0800 (Wed, 04 Mar 2020)


Log Message
Remove initial layout throttler
https://bugs.webkit.org/show_bug.cgi?id=208285

Reviewed by Antti Koivisto.

Source/WebCore:

This removes a throttle that can prevent us from laying out during the first 250 ms of page
load. This throttle is generally not effective (many pages have JS that force a sync layout
before the first 250 ms of loading) and is also extremely outdated (the comment says the
interval is too high for dual G5s). We already have too many throttles in too many places,
so let's remove this one.

* dom/Document.cpp:
(WebCore::Document::implicitClose):
(WebCore::Document::shouldScheduleLayout const):
(WebCore::Document::isLayoutTimerActive const):
(WebCore::Document::shouldScheduleLayout): Deleted.
(WebCore::Document::isLayoutTimerActive): Deleted.
(WebCore::Document::minimumLayoutDelay): Deleted.
(WebCore::Document::timeSinceDocumentCreation const): Deleted.
* dom/Document.h:
(WebCore::Document::parsing const):
(WebCore::Document::timeSinceDocumentCreation const):
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::layout):
(WebCore::FrameViewLayoutContext::reset):
(WebCore::FrameViewLayoutContext::scheduleLayout):
(WebCore::FrameViewLayoutContext::unscheduleLayout):
(WebCore::FrameViewLayoutContext::scheduleSubtreeLayout):
* page/FrameViewLayoutContext.h:
* page/SettingsBase.cpp:
(WebCore::SettingsBase::SettingsBase):
(WebCore::SettingsBase::setLayoutInterval): Deleted.
* page/SettingsBase.h:
(WebCore::SettingsBase::layoutInterval const): Deleted.

Source/WebKit:

* Shared/WebPreferences.yaml:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WebKitLegacy/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences _setLayoutInterval:]): Deleted.
(-[WebPreferences _layoutInterval]): Deleted.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/dom/Document.cpp
trunk/Source/WebCore/dom/Document.h
trunk/Source/WebCore/page/FrameViewLayoutContext.cpp
trunk/Source/WebCore/page/FrameViewLayoutContext.h
trunk/Source/WebCore/page/SettingsBase.cpp
trunk/Source/WebCore/page/SettingsBase.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Shared/WebPreferences.yaml
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
trunk/Source/WebKitLegacy/mac/ChangeLog
trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm




Diff

Modified: trunk/Source/WebCore/ChangeLog (257861 => 257862)

--- trunk/Source/WebCore/ChangeLog	2020-03-04 18:55:49 UTC (rev 257861)
+++ trunk/Source/WebCore/ChangeLog	2020-03-04 19:04:57 UTC (rev 257862)
@@ -1,3 +1,40 @@
+2020-03-04  Ben Nham  
+
+Remove initial layout throttler
+https://bugs.webkit.org/show_bug.cgi?id=208285
+
+Reviewed by Antti Koivisto.
+
+This removes a throttle that can prevent us from laying out during the first 250 ms of page
+load. This throttle is generally not effective (many pages have JS that force a sync layout
+before the first 250 ms of loading) and is also extremely outdated (the comment says the
+interval is too high for dual G5s). We already have too many throttles in too many places,
+so let's remove this one.
+
+* dom/Document.cpp:
+(WebCore::Document::implicitClose):
+(WebCore::Document::shouldScheduleLayout const):
+(WebCore::Document::isLayoutTimerActive const):
+(WebCore::Document::shouldScheduleLayout): Deleted.
+(WebCore::Document::isLayoutTimerActive): Deleted.
+(WebCore::Document::minimumLayoutDelay): Deleted.
+(WebCore::Document::timeSinceDocumentCreation const): Deleted.
+* dom/Document.h:
+(WebCore::Document::parsing const):
+(WebCore::Document::timeSinceDocumentCreation const):
+* page/FrameViewLayoutContext.cpp:
+(WebCore::FrameViewLayoutContext::layout):
+(WebCore::FrameViewLayoutContext::reset):
+(WebCore::FrameViewLayoutContext::scheduleLayout):
+(WebCore::FrameViewLayoutContext::unscheduleLayout):
+(WebCore::FrameViewLayoutContext::scheduleSubtreeLayout):
+* page/FrameViewLayoutContext.h:
+* page/SettingsBase.cpp:
+(WebCore::SettingsBase::SettingsBase):
+(WebCore::SettingsBase::setLayoutInterval): Deleted.
+* page/SettingsBase.h:
+(WebCore::SettingsBase::layoutInterval const): Deleted.
+
 2020-03-04  Antti Koivisto  
 
 Avoid full style resolution on Element::focus()


Modified: trunk/Source/WebCore/dom/Document.cpp (257861 => 257862)

--- trunk/Source/WebCore/dom/Document.cpp	2020-03

[webkit-changes] [257763] trunk

2020-03-02 Thread nham
Title: [257763] trunk








Revision 257763
Author n...@apple.com
Date 2020-03-02 21:18:04 -0800 (Mon, 02 Mar 2020)


Log Message
Add performance probes for HTML parsing
https://bugs.webkit.org/show_bug.cgi?id=208271

Reviewed by Daniel Bates.

This adds probes that show which lines of HTML are have been parsed.

Source/WebCore:

* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::pumpTokenizer):
* html/parser/HTMLDocumentParser.h:

Source/WTF:

* wtf/SystemTracing.h:

Tools:

* Tracing/SystemTracePoints.plist:

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/SystemTracing.h
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
trunk/Tools/ChangeLog
trunk/Tools/Tracing/SystemTracePoints.plist




Diff

Modified: trunk/Source/WTF/ChangeLog (257762 => 257763)

--- trunk/Source/WTF/ChangeLog	2020-03-03 05:14:21 UTC (rev 257762)
+++ trunk/Source/WTF/ChangeLog	2020-03-03 05:18:04 UTC (rev 257763)
@@ -1,5 +1,16 @@
 2020-03-02  Ben Nham  
 
+Add performance probes for HTML parsing
+https://bugs.webkit.org/show_bug.cgi?id=208271
+
+Reviewed by Daniel Bates.
+
+This adds probes that show which lines of HTML are have been parsed.
+
+* wtf/SystemTracing.h:
+
+2020-03-02  Ben Nham  
+
 [WTF] Add signpost API
 https://bugs.webkit.org/show_bug.cgi?id=208395
 


Modified: trunk/Source/WTF/wtf/SystemTracing.h (257762 => 257763)

--- trunk/Source/WTF/wtf/SystemTracing.h	2020-03-03 05:14:21 UTC (rev 257762)
+++ trunk/Source/WTF/wtf/SystemTracing.h	2020-03-03 05:18:04 UTC (rev 257763)
@@ -86,6 +86,8 @@
 CompositingUpdateEnd,
 DispatchTouchEventsStart,
 DispatchTouchEventsEnd,
+ParseHTMLStart,
+ParseHTMLEnd,
 
 WebKitRange = 1,
 WebHTMLViewPaintStart,


Modified: trunk/Source/WebCore/ChangeLog (257762 => 257763)

--- trunk/Source/WebCore/ChangeLog	2020-03-03 05:14:21 UTC (rev 257762)
+++ trunk/Source/WebCore/ChangeLog	2020-03-03 05:18:04 UTC (rev 257763)
@@ -1,3 +1,16 @@
+2020-03-02  Ben Nham  
+
+Add performance probes for HTML parsing
+https://bugs.webkit.org/show_bug.cgi?id=208271
+
+Reviewed by Daniel Bates.
+
+This adds probes that show which lines of HTML are have been parsed.
+
+* html/parser/HTMLDocumentParser.cpp:
+(WebCore::HTMLDocumentParser::pumpTokenizer):
+* html/parser/HTMLDocumentParser.h:
+
 2020-03-02  Andres Gonzalez  
 
 REGRESSION (257739) [ Mac wk2 Release ] multiple tests crashing in WebCore::postUserInfoForChanges


Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (257762 => 257763)

--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2020-03-03 05:14:21 UTC (rev 257762)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2020-03-03 05:18:04 UTC (rev 257763)
@@ -45,6 +45,8 @@
 #include "ScriptElement.h"
 #include "ThrowOnDynamicMarkupInsertionCountIncrementer.h"
 
+#include 
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -51,6 +53,11 @@
 
 DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HTMLDocumentParser);
 
+static bool isMainDocumentLoadingFromHTTP(const Document& document)
+{
+return !document.ownerElement() && document.url().protocolIsInHTTPFamily();
+}
+
 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document)
 : ScriptableDocumentParser(document)
 , m_options(document)
@@ -60,6 +67,7 @@
 , m_parserScheduler(makeUnique(*this))
 , m_xssAuditorDelegate(document)
 , m_preloader(makeUnique(document))
+, m_shouldEmitTracePoints(isMainDocumentLoadingFromHTTP(document))
 {
 }
 
@@ -74,6 +82,7 @@
 , m_tokenizer(m_options)
 , m_treeBuilder(makeUnique(*this, fragment, contextElement, parserContentPolicy(), m_options))
 , m_xssAuditorDelegate(fragment.document())
+, m_shouldEmitTracePoints(false) // Avoid emitting trace points when parsing fragments like outerHTML.
 {
 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-html-fragments
 if (contextElement.isHTMLElement())
@@ -302,7 +311,17 @@
 
 m_xssAuditor.init(document(), _xssAuditorDelegate);
 
+auto emitTracePoint = [this](TracePointCode code) {
+if (!m_shouldEmitTracePoints)
+return;
+
+auto position = textPosition();
+tracePoint(code, position.m_line.oneBasedInt(), position.m_column.oneBasedInt());
+};
+
+emitTracePoint(ParseHTMLStart);
 bool shouldResume = pumpTokenizerLoop(mode, isParsingFragment(), session);
+emitTracePoint(ParseHTMLEnd);
 
 // Ensure we haven't been totally deref'ed after pumping. Any caller of this
 // function should be holding a RefPtr to this to ensure we weren't deleted.


Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.h (257762 => 257763)

--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.h	2020-03-03 05:14:21 UT

[webkit-changes] [257762] trunk/Source

2020-03-02 Thread nham
Title: [257762] trunk/Source








Revision 257762
Author n...@apple.com
Date 2020-03-02 21:14:21 -0800 (Mon, 02 Mar 2020)


Log Message
[WTF] Add signpost API
https://bugs.webkit.org/show_bug.cgi?id=208395

Reviewed by Alex Christensen.

We want to start using os_signpost instead of kdebug_trace when emitting performance events,
because it is usually cheaper (doesn't require a system call unless the log buffer is full)
and allows for richer tracepoints (allows for logging strings as well as integers).

To facilitate this, this moves the os_signpost wrappers in NetworkDataTaskCocoa to
WTF. Since signposts can contain sensitive strings (like URLs), currently we only enable
them on Apple-internal devices when an environment variable is set.

Source/WebCore/PAL:

* PAL.xcodeproj/project.pbxproj:
* pal/PlatformMac.cmake:
* spi/darwin/OSVariantSPI.h: Renamed to wtf/spi/darwin/OSVariantSPI.h.

Source/WebKit:

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(WebKit::NetworkDataTaskCocoa::didSendData):
(WebKit::NetworkDataTaskCocoa::didReceiveChallenge):
(WebKit::NetworkDataTaskCocoa::didCompleteWithError):
(WebKit::NetworkDataTaskCocoa::didReceiveData):
(WebKit::NetworkDataTaskCocoa::didReceiveResponse):
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
(WebKit::NetworkDataTaskCocoa::cancel):
(WebKit::NetworkDataTaskCocoa::resume):
(signpostLogHandle): Deleted.
(signpostsEnabled): Deleted.

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/PlatformMac.cmake:
* wtf/SystemTracing.h:
* wtf/cocoa/SystemTracingCocoa.cpp: Added.
(WTFSignpostsEnabled):
(WTFSignpostLogHandle):
* wtf/spi/darwin/OSVariantSPI.h: Renamed from Source/WebCore/PAL/pal/spi/cocoa/OSVariantSPI.h.

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
trunk/Source/WTF/wtf/PlatformMac.cmake
trunk/Source/WTF/wtf/SystemTracing.h
trunk/Source/WebCore/PAL/ChangeLog
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
trunk/Source/WebCore/PAL/pal/PlatformMac.cmake
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm


Added Paths

trunk/Source/WTF/wtf/cocoa/SystemTracingCocoa.cpp
trunk/Source/WTF/wtf/spi/darwin/OSVariantSPI.h


Removed Paths

trunk/Source/WebCore/PAL/pal/spi/cocoa/OSVariantSPI.h




Diff

Modified: trunk/Source/WTF/ChangeLog (257761 => 257762)

--- trunk/Source/WTF/ChangeLog	2020-03-03 04:57:34 UTC (rev 257761)
+++ trunk/Source/WTF/ChangeLog	2020-03-03 05:14:21 UTC (rev 257762)
@@ -1,3 +1,26 @@
+2020-03-02  Ben Nham  
+
+[WTF] Add signpost API
+https://bugs.webkit.org/show_bug.cgi?id=208395
+
+Reviewed by Alex Christensen.
+
+We want to start using os_signpost instead of kdebug_trace when emitting performance events,
+because it is usually cheaper (doesn't require a system call unless the log buffer is full)
+and allows for richer tracepoints (allows for logging strings as well as integers).
+
+To facilitate this, this moves the os_signpost wrappers in NetworkDataTaskCocoa to
+WTF. Since signposts can contain sensitive strings (like URLs), currently we only enable
+them on Apple-internal devices when an environment variable is set.
+
+* WTF.xcodeproj/project.pbxproj:
+* wtf/PlatformMac.cmake:
+* wtf/SystemTracing.h:
+* wtf/cocoa/SystemTracingCocoa.cpp: Added.
+(WTFSignpostsEnabled):
+(WTFSignpostLogHandle):
+* wtf/spi/darwin/OSVariantSPI.h: Renamed from Source/WebCore/PAL/pal/spi/cocoa/OSVariantSPI.h.
+
 2020-03-02  Alan Coon  
 
 Add new Mac target numbers


Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (257761 => 257762)

--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-03-03 04:57:34 UTC (rev 257761)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-03-03 05:14:21 UTC (rev 257762)
@@ -181,6 +181,7 @@
 		E3A32BC41FC830E2007D7E76 /* JSValueMalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3A32BC21FC830E2007D7E76 /* JSValueMalloc.cpp */; };
 		E4A0AD391A96245500536DF6 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD371A96245500536DF6 /* WorkQueue.cpp */; };
 		E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */; };
+		EB61EDC72409CCC1001EFE36 /* SystemTracingCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB61EDC62409CCC0001EFE36 /* SystemTracingCocoa.cpp */; };
 		FE05FAFF1FE5007500093230 /* WTFAssertions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE05FAFE1FE5007500093230 /* WTFAssertions.cpp */; };
 		FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1E2C392240C05400F6B729 /* PtrTag.cpp */; };
 		FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1E2C41224187C600F6B729 /* PlatformRegisters.cpp */; };
@@ 

[webkit-changes] [257608] trunk/LayoutTests

2020-02-27 Thread nham
Title: [257608] trunk/LayoutTests








Revision 257608
Author n...@apple.com
Date 2020-02-27 17:46:28 -0800 (Thu, 27 Feb 2020)


Log Message
REGRESSION (r257391-257396): [ iOS ] imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order.html is failing
https://bugs.webkit.org/show_bug.cgi?id=208323

Unreviewed test gardening.

scroll-restoration-order.html has always failed on iOS. Before r257394, we didn't properly
restore the scroll position before the hashchange event. After r257394, we now properly
restore the scroll position, but do it too early (it's restored before popstate, rather than
between popstate and hashchange). If anything, the new state seems less broken than before,
so this just updates the expected results to reflect the current status of our tests.


* platform/ios-wk2/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order-expected.txt:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order-expected.txt




Diff

Modified: trunk/LayoutTests/ChangeLog (257607 => 257608)

--- trunk/LayoutTests/ChangeLog	2020-02-28 01:42:12 UTC (rev 257607)
+++ trunk/LayoutTests/ChangeLog	2020-02-28 01:46:28 UTC (rev 257608)
@@ -1,3 +1,18 @@
+2020-02-27  Ben Nham  
+
+REGRESSION (r257391-257396): [ iOS ] imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order.html is failing
+https://bugs.webkit.org/show_bug.cgi?id=208323
+
+Unreviewed test gardening.
+
+scroll-restoration-order.html has always failed on iOS. Before r257394, we didn't properly
+restore the scroll position before the hashchange event. After r257394, we now properly
+restore the scroll position, but do it too early (it's restored before popstate, rather than
+between popstate and hashchange). If anything, the new state seems less broken than before,
+so this just updates the expected results to reflect the current status of our tests.
+
+* platform/ios-wk2/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order-expected.txt:
+
 2020-02-27  Lauro Moura  
 
 [GTK] Layout test gardening


Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order-expected.txt (257607 => 257608)

--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order-expected.txt	2020-02-28 01:42:12 UTC (rev 257607)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/scroll-restoration-order-expected.txt	2020-02-28 01:46:28 UTC (rev 257608)
@@ -1,3 +1,3 @@
 
-FAIL Traversing history should restore scroll position after dispatching popstate and before dispatching hashchange assert_array_approx_equals: scroll is restored before hashchange for #2 property 0, expected 100 +/- 1, expected 100 but got 555
+FAIL Traversing history should restore scroll position after dispatching popstate and before dispatching hashchange assert_not_equals: scroll is restored before popstate for #2 got disallowed value 100
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [257585] trunk/LayoutTests

2020-02-27 Thread nham
Title: [257585] trunk/LayoutTests








Revision 257585
Author n...@apple.com
Date 2020-02-27 14:08:29 -0800 (Thu, 27 Feb 2020)


Log Message
Fix flaky enter/exit PIP test
https://bugs.webkit.org/show_bug.cgi?id=208272

Unreviewed test gardening.

This test sometimes fails because it presses the PIP control before the video starts
playing. Fix this by waiting for the playing event before pressing the control.

* media/modern-media-controls/pip-support/pip-support-click.html:
* platform/mac-wk2/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html
trunk/LayoutTests/platform/mac-wk2/TestExpectations




Diff

Modified: trunk/LayoutTests/ChangeLog (257584 => 257585)

--- trunk/LayoutTests/ChangeLog	2020-02-27 21:53:16 UTC (rev 257584)
+++ trunk/LayoutTests/ChangeLog	2020-02-27 22:08:29 UTC (rev 257585)
@@ -1,3 +1,16 @@
+2020-02-27  Ben Nham  
+
+Fix flaky enter/exit PIP test
+https://bugs.webkit.org/show_bug.cgi?id=208272
+
+Unreviewed test gardening.
+
+This test sometimes fails because it presses the PIP control before the video starts
+playing. Fix this by waiting for the playing event before pressing the control.
+
+* media/modern-media-controls/pip-support/pip-support-click.html:
+* platform/mac-wk2/TestExpectations:
+
 2020-02-27  Ryan Haddad  
 
 [ iOS wk2 Release ] fast/text-autosizing/ios/idempotentmode/viewport-change-relayout.html is flaky failing.


Modified: trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html (257584 => 257585)

--- trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html	2020-02-27 21:53:16 UTC (rev 257584)
+++ trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html	2020-02-27 22:08:29 UTC (rev 257585)
@@ -13,7 +13,7 @@
 }
 
 
-
+
 
 
</span><span class="cx"> 
</span><span class="lines">@@ -36,11 +36,16 @@
</span><span class="cx"> finishMediaControlsTest();
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-shouldBecomeDifferent("mediaController.controls.pipButton.element.getBoundingClientRect().width", "0", () => {
-media.pause();
-pressOnElement(mediaController.controls.pipButton.element);
</del><ins>+media.addEventListener("playing", () => {
+shouldBecomeDifferent("mediaController.controls.pipButton.element.getBoundingClientRect().width", "0", () => {
+media.pause();
+pressOnElement(mediaController.controls.pipButton.element);
+});
</ins><span class="cx"> });
</span><span class="cx"> 
</span><ins>+media.src = ""
+media.play();
+
</ins><span class="cx"> 
 

[webkit-changes] [257584] trunk/Tools/Scripts/webkitpy/common/config/contributors.json

2020-02-27 Thread nham
Title: [257584] trunk/Tools/Scripts/webkitpy/common/config/contributors.json








Revision 257584
Author n...@apple.com
Date 2020-02-27 13:53:16 -0800 (Thu, 27 Feb 2020)


Log Message
Adding myself to contributors.json

Unreviewed

* Scripts/webkitpy/common/config/contributors.json:

Modified Paths

trunk/Tools/Scripts/webkitpy/common/config/contributors.json




Diff

Modified: trunk/Tools/Scripts/webkitpy/common/config/contributors.json (257583 => 257584)

--- trunk/Tools/Scripts/webkitpy/common/config/contributors.json	2020-02-27 21:50:43 UTC (rev 257583)
+++ trunk/Tools/Scripts/webkitpy/common/config/contributors.json	2020-02-27 21:53:16 UTC (rev 257584)
@@ -847,6 +847,15 @@
  "benm"
   ]
    },
+   "Ben Nham" : {
+  "emails" : [
+ "n...@apple.com"
+  ],
+  "nicks" : [
+ "nham"
+  ],
+  "status" : "committer"
+   },
"Ben Wells" : {
   "emails" : [
  "benwe...@chromium.org"






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes