Diff
Modified: trunk/Source/WebKit/ChangeLog (273464 => 273465)
--- trunk/Source/WebKit/ChangeLog 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/ChangeLog 2021-02-25 01:45:50 UTC (rev 273465)
@@ -1,3 +1,46 @@
+2021-02-24 Kate Cheney <katherine_che...@apple.com>
+
+ App-bound request parameter should be passed to main resource requests not the main frame
+ https://bugs.webkit.org/show_bug.cgi?id=222241
+ <rdar://problem/74560966>
+
+ Reviewed by Chris Dumez.
+
+ Bug fix to set the isAppBound parameter on the resource request if it
+ is not on the main frame. Previously this only checked if the
+ resource was not a main resource before setting the parameter.
+
+ Otherwise mostly changes to add better testing.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::appBoundNavigationData):
+ (WebKit::NetworkProcess::clearAppBoundNavigationData):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * NetworkProcess/NetworkSession.h:
+ (WebKit::NetworkSession::appBoundNavigationTestingData):
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+ (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+ * Scripts/webkit/messages.py:
+ * Shared/NavigatingToAppBoundDomain.h:
+ (WebKit::AppBoundNavigationTestingData::clearAppBoundNavigationDataTesting):
+ (WebKit::AppBoundNavigationTestingData::updateAppBoundNavigationTestingData):
+ (WebKit::AppBoundNavigationTestingData::encode const):
+ (WebKit::AppBoundNavigationTestingData::decode):
+ Struct to return data for tests.
+
+ * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
+ * UIProcess/API/Cocoa/WKWebViewTesting.mm:
+ (-[WKWebView _appBoundNavigationData:]):
+ (-[WKWebView _clearAppBoundNavigationData:]):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::appBoundNavigationData):
+ (WebKit::WebPageProxy::clearAppBoundNavigationData):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/Network/WebLoaderStrategy.cpp:
+ (WebKit::WebLoaderStrategy::loadResource):
+ The fix.
+
2021-02-24 Peng Liu <peng.l...@apple.com>
[GPUP] Refactor RemoteImageDecoderAVF::createFrameImageAtIndex()
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (273464 => 273465)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-02-25 01:45:50 UTC (rev 273465)
@@ -2778,4 +2778,23 @@
m_extensionCORSDisablingPatterns.set(pageIdentifier, WTFMove(parsedPatterns));
}
+#if PLATFORM(COCOA)
+void NetworkProcess::appBoundNavigationData(PAL::SessionID sessionID, CompletionHandler<void(const AppBoundNavigationTestingData&)>&& completionHandler)
+{
+ if (auto* networkSession = this->networkSession(sessionID)) {
+ completionHandler(networkSession->appBoundNavigationTestingData());
+ return;
+ }
+ completionHandler({ });
+}
+
+void NetworkProcess::clearAppBoundNavigationData(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
+{
+ if (auto* networkSession = this->networkSession(sessionID))
+ networkSession->appBoundNavigationTestingData().clearAppBoundNavigationDataTesting();
+
+ completionHandler();
+}
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (273464 => 273465)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2021-02-25 01:45:50 UTC (rev 273465)
@@ -378,6 +378,11 @@
bool shouldDisableCORSForRequestTo(WebCore::PageIdentifier, const URL&) const;
void setCORSDisablingPatterns(WebCore::PageIdentifier, Vector<String>&&);
+#if PLATFORM(COCOA)
+ void appBoundNavigationData(PAL::SessionID, CompletionHandler<void(const AppBoundNavigationTestingData&)>&&);
+ void clearAppBoundNavigationData(PAL::SessionID, CompletionHandler<void()>&&);
+#endif
+
private:
void platformInitializeNetworkProcess(const NetworkProcessCreationParameters&);
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (273464 => 273465)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2021-02-25 01:45:50 UTC (rev 273465)
@@ -190,4 +190,9 @@
#endif
UpdateBundleIdentifier(String bundleIdentifier) -> () Async
ClearBundleIdentifier() -> () Async
+
+#if PLATFORM(COCOA)
+ AppBoundNavigationData(PAL::SessionID sessionID) -> (struct WebKit::AppBoundNavigationTestingData data) Async
+ ClearAppBoundNavigationData(PAL::SessionID sessionID) -> () Async
+#endif
}
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (273464 => 273465)
--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2021-02-25 01:45:50 UTC (rev 273465)
@@ -25,6 +25,7 @@
#pragma once
+#include "NavigatingToAppBoundDomain.h"
#include "PrefetchCache.h"
#include "SandboxExtension.h"
#include "ServiceWorkerSoftUpdateLoader.h"
@@ -157,6 +158,10 @@
NetworkLoadScheduler& networkLoadScheduler();
PrivateClickMeasurementManager& privateClickMeasurement() { return *m_privateClickMeasurement; }
+#if PLATFORM(COCOA)
+ AppBoundNavigationTestingData& appBoundNavigationTestingData() { return m_appBoundNavigationTestingData; }
+#endif
+
protected:
NetworkSession(NetworkProcess&, const NetworkSessionCreationParameters&);
@@ -201,6 +206,10 @@
#if ENABLE(SERVICE_WORKER)
HashSet<std::unique_ptr<ServiceWorkerSoftUpdateLoader>> m_softUpdateLoaders;
#endif
+
+#if PLATFORM(COCOA)
+ AppBoundNavigationTestingData m_appBoundNavigationTestingData;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (273464 => 273465)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2021-02-25 01:45:50 UTC (rev 273465)
@@ -339,6 +339,8 @@
NETWORK_DATA_TASK_COCOA_ADDITIONS
+ m_session->appBoundNavigationTestingData().updateAppBoundNavigationTestingData(request.isAppBound());
+
applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(nsRequest, shouldContentSniff == WebCore::ContentSniffingPolicy::SniffContent && !url.isLocalFile(), shouldContentEncodingSniff == WebCore::ContentEncodingSniffingPolicy::Sniff);
m_task = [m_sessionWrapper->session dataTaskWithRequest:nsRequest];
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (273464 => 273465)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2021-02-25 01:45:50 UTC (rev 273465)
@@ -744,8 +744,8 @@
'WebCore::WillContinueLoading': ['<WebCore/FrameLoaderTypes.h>'],
'WebCore::SelectionRect': ['"EditorState.h"'],
'WebKit::ActivityStateChangeID': ['"DrawingAreaInfo.h"'],
+ 'WebKit::AppBoundNavigationTestingData': ['"NavigatingToAppBoundDomain.h"'],
'WebKit::AllowOverwrite': ['"DownloadID.h"'],
- 'WebKit::LastNavigationWasAppBound': ['"NavigatingToAppBoundDomain.h"'],
'WebKit::BackForwardListItemState': ['"SessionState.h"'],
'WebKit::CallDownloadDidStart': ['"DownloadManager.h"'],
'WebKit::ContentWorldIdentifier': ['"ContentWorldShared.h"'],
@@ -754,6 +754,7 @@
'WebKit::GestureRecognizerState': ['"GestureTypes.h"'],
'WebKit::GestureType': ['"GestureTypes.h"'],
'WebKit::InspectorExtensionError': ['"InspectorExtensionTypes.h"'],
+ 'WebKit::LastNavigationWasAppBound': ['"NavigatingToAppBoundDomain.h"'],
'WebKit::LayerHostingContextID': ['"LayerHostingContext.h"'],
'WebKit::LayerHostingMode': ['"LayerTreeContext.h"'],
'WebKit::PageState': ['"SessionState.h"'],
Modified: trunk/Source/WebKit/Shared/NavigatingToAppBoundDomain.h (273464 => 273465)
--- trunk/Source/WebKit/Shared/NavigatingToAppBoundDomain.h 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/Shared/NavigatingToAppBoundDomain.h 2021-02-25 01:45:50 UTC (rev 273465)
@@ -25,10 +25,54 @@
#pragma once
+#include "ArgumentCoder.h"
+#include "Decoder.h"
+#include "Encoder.h"
+
namespace WebKit {
enum class NavigatingToAppBoundDomain : bool { No, Yes };
enum class LastNavigationWasAppBound : bool { No, Yes };
+#if PLATFORM(COCOA)
+struct AppBoundNavigationTestingData {
+
+ void clearAppBoundNavigationDataTesting()
+ {
+ hasLoadedAppBoundRequestTesting = false;
+ hasLoadedNonAppBoundRequestTesting = false;
+ }
+
+ void updateAppBoundNavigationTestingData(bool requestIsAppBound)
+ {
+ requestIsAppBound ? hasLoadedAppBoundRequestTesting = true : hasLoadedNonAppBoundRequestTesting = true;
+ }
+
+ void encode(IPC::Encoder& encoder) const
+ {
+ encoder << hasLoadedAppBoundRequestTesting;
+ encoder << hasLoadedNonAppBoundRequestTesting;
+ }
+
+ static Optional<AppBoundNavigationTestingData> decode(IPC::Decoder& decoder)
+ {
+ Optional<bool> hasLoadedAppBoundRequestTesting;
+ decoder >> hasLoadedAppBoundRequestTesting;
+ if (!hasLoadedAppBoundRequestTesting)
+ return WTF::nullopt;
+
+ Optional<bool> hasLoadedNonAppBoundRequestTesting;
+ decoder >> hasLoadedNonAppBoundRequestTesting;
+ if (!hasLoadedNonAppBoundRequestTesting)
+ return WTF::nullopt;
+
+ return {{ *hasLoadedAppBoundRequestTesting, *hasLoadedNonAppBoundRequestTesting }};
+ }
+
+ bool hasLoadedAppBoundRequestTesting { false };
+ bool hasLoadedNonAppBoundRequestTesting { false };
+};
+#endif
+
}
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h (273464 => 273465)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h 2021-02-25 01:45:50 UTC (rev 273465)
@@ -32,6 +32,11 @@
WKWebViewAudioRoutingArbitrationStatusActive,
} WKWebViewAudioRoutingArbitrationStatus;
+struct WKAppBoundNavigationTestingData {
+ BOOL hasLoadedAppBoundRequestTesting;
+ BOOL hasLoadedNonAppBoundRequestTesting;
+};
+
@interface WKWebView (WKTesting)
- (void)_setPageScale:(CGFloat)scale withOrigin:(CGPoint)origin;
@@ -88,5 +93,7 @@
- (void)_setPrivateClickMeasurementAttributionReportURLForTesting:(NSURL *)url completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_lastNavigationWasAppBound:(void(^)(BOOL))completionHandler;
+- (void)_appBoundNavigationData:(void(^)(struct WKAppBoundNavigationTestingData data))completionHandler;
+- (void)_clearAppBoundNavigationData:(void(^)(void))completionHandler;
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm (273464 => 273465)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm 2021-02-25 01:45:50 UTC (rev 273465)
@@ -333,4 +333,18 @@
});
}
+- (void)_appBoundNavigationData:(void(^)(struct WKAppBoundNavigationTestingData data))completionHandler
+{
+ _page->appBoundNavigationData([completionHandler = makeBlockPtr(completionHandler)] (auto&& appBoundData) {
+ completionHandler({ appBoundData.hasLoadedAppBoundRequestTesting, appBoundData.hasLoadedNonAppBoundRequestTesting });
+ });
+}
+
+- (void)_clearAppBoundNavigationData:(void(^)(void))completionHandler
+{
+ _page->clearAppBoundNavigationData([completionHandler = makeBlockPtr(completionHandler)] {
+ completionHandler();
+ });
+}
+
@end
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (273464 => 273465)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-02-25 01:45:50 UTC (rev 273465)
@@ -10399,6 +10399,18 @@
}
#endif
+#if PLATFORM(COCOA)
+void WebPageProxy::appBoundNavigationData(CompletionHandler<void(const AppBoundNavigationTestingData&)>&& completionHandler)
+{
+ websiteDataStore().networkProcess().sendWithAsyncReply(Messages::NetworkProcess::AppBoundNavigationData(m_websiteDataStore->sessionID()), WTFMove(completionHandler));
+}
+
+void WebPageProxy::clearAppBoundNavigationData(CompletionHandler<void()>&& completionHandler)
+{
+ websiteDataStore().networkProcess().sendWithAsyncReply(Messages::NetworkProcess::ClearAppBoundNavigationData(m_websiteDataStore->sessionID()), WTFMove(completionHandler));
+}
+#endif
+
} // namespace WebKit
#undef RELEASE_LOG_IF_ALLOWED
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (273464 => 273465)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-02-25 01:45:50 UTC (rev 273465)
@@ -311,6 +311,7 @@
#endif
namespace WebKit {
+struct AppBoundNavigationTestingData;
class AudioSessionRoutingArbitratorProxy;
class DrawingAreaProxy;
class GamepadData;
@@ -1868,6 +1869,8 @@
#if PLATFORM(COCOA)
void setLastNavigationWasAppBound(WebCore::ResourceRequest&);
void lastNavigationWasAppBound(CompletionHandler<void(bool)>&&);
+ void appBoundNavigationData(CompletionHandler<void(const AppBoundNavigationTestingData&)>&&);
+ void clearAppBoundNavigationData(CompletionHandler<void()>&&);
#endif
private:
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (273464 => 273465)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2021-02-25 01:45:50 UTC (rev 273465)
@@ -107,7 +107,7 @@
void WebLoaderStrategy::loadResource(Frame& frame, CachedResource& resource, ResourceRequest&& request, const ResourceLoaderOptions& options, CompletionHandler<void(RefPtr<SubresourceLoader>&&)>&& completionHandler)
{
- if (resource.type() != CachedResource::Type::MainResource) {
+ if (resource.type() != CachedResource::Type::MainResource || !frame.isMainFrame()) {
if (auto* document = frame.mainFrame().document()) {
if (document && document->loader())
request.setIsAppBound(document->loader()->lastNavigationWasAppBound());
Modified: trunk/Tools/ChangeLog (273464 => 273465)
--- trunk/Tools/ChangeLog 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Tools/ChangeLog 2021-02-25 01:45:50 UTC (rev 273465)
@@ -1,3 +1,25 @@
+2021-02-24 Kate Cheney <katherine_che...@apple.com>
+
+ App-bound request parameter should be passed to main resource requests not the main frame
+ https://bugs.webkit.org/show_bug.cgi?id=222241
+ <rdar://problem/74560966>
+
+ Reviewed by Chris Dumez.
+
+ Adds more robust testing to report when appBound/nonAppBound requests
+ load in the network process. This tests not only that the main frame’s
+ document loader is properly set, but also that all loads initiated from
+ app-bound requests are also app-bound to avoid regressions like this in the future.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+ Utilize some CSP test resources that have the exact setup needed to
+ test this fix.
+
+ * TestWebKitAPI/cocoa/TestWKWebView.h:
+ * TestWebKitAPI/cocoa/TestWKWebView.mm:
+ (-[WKWebView appBoundNavigationData:]):
+ (-[WKWebView clearAppBoundNavigationReports:]):
+
2021-02-24 Jonathan Bedard <jbed...@apple.com>
[webkitscmpy] Add flag for caller to opt out of identifier computation
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm (273464 => 273465)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm 2021-02-25 01:45:50 UTC (rev 273465)
@@ -37,6 +37,7 @@
#import <WebKit/WKPreferencesPrivate.h>
#import <WebKit/WKURLSchemeTaskPrivate.h>
#import <WebKit/WKUserContentControllerPrivate.h>
+#import <WebKit/WKWebViewPrivateForTesting.h>
#import <WebKit/WKWebsiteDataStorePrivate.h>
#import <WebKit/_WKUserContentWorld.h>
#import <WebKit/_WKUserStyleSheet.h>
@@ -1425,7 +1426,7 @@
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
NSString *url = ""
- static bool isDone = false;
+ __block bool isDone = false;
NSMutableURLRequest *nonAppBoundRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
APP_BOUND_REQUEST_ADDITIONS
@@ -1432,12 +1433,21 @@
[webView loadRequest:nonAppBoundRequest];
[webView _test_waitForDidFinishNavigation];
- [webView lastNavigationWasAppBound:^(BOOL isAppBound) {
+ [webView _lastNavigationWasAppBound:^(BOOL isAppBound) {
EXPECT_FALSE(isAppBound);
isDone = true;
}];
TestWebKitAPI::Util::run(&isDone);
+
+ isDone = false;
+ [webView _appBoundNavigationData:^(struct WKAppBoundNavigationTestingData data) {
+ EXPECT_FALSE(data.hasLoadedAppBoundRequestTesting);
+ EXPECT_TRUE(data.hasLoadedNonAppBoundRequestTesting);
+ isDone = true;
+ }];
+
+ TestWebKitAPI::Util::run(&isDone);
}
TEST(InAppBrowserPrivacy, AppBoundRequestWithNavigation)
@@ -1453,18 +1463,97 @@
[webView loadRequest:startingRequest];
[webView _test_waitForDidFinishNavigation];
- static bool isDone = false;
+ __block bool isDone = false;
+ [webView _lastNavigationWasAppBound:^(BOOL isAppBound) {
+ EXPECT_TRUE(isAppBound);
+ isDone = true;
+ }];
+
+ TestWebKitAPI::Util::run(&isDone);
+
+ isDone = false;
+ [webView _appBoundNavigationData:^(struct WKAppBoundNavigationTestingData data) {
+ EXPECT_TRUE(data.hasLoadedAppBoundRequestTesting);
+ EXPECT_FALSE(data.hasLoadedNonAppBoundRequestTesting);
+ isDone = true;
+ }];
+
+ TestWebKitAPI::Util::run(&isDone);
+
+ isDone = false;
NSMutableURLRequest *nonAppBoundRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:nonAppBoundURL]];
APP_BOUND_REQUEST_ADDITIONS
+
+ isDone = false;
+ [webView _clearAppBoundNavigationData:^{
+ isDone = true;
+ }];
+ TestWebKitAPI::Util::run(&isDone);
+
[webView loadRequest:nonAppBoundRequest];
[webView _test_waitForDidFinishNavigation];
- [webView lastNavigationWasAppBound:^(BOOL isAppBound) {
+ [webView _lastNavigationWasAppBound:^(BOOL isAppBound) {
EXPECT_FALSE(isAppBound);
isDone = true;
}];
TestWebKitAPI::Util::run(&isDone);
+
+ isDone = false;
+ [webView _appBoundNavigationData:^(struct WKAppBoundNavigationTestingData data) {
+ EXPECT_FALSE(data.hasLoadedAppBoundRequestTesting);
+ EXPECT_TRUE(data.hasLoadedNonAppBoundRequestTesting);
+ isDone = true;
+ }];
+
+ TestWebKitAPI::Util::run(&isDone);
}
+
+TEST(InAppBrowserPrivacy, AppBoundRequestWithSubFrame)
+{
+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [configuration _setOverrideContentSecurityPolicy:@"script-src 'nonce-b'"];
+
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ [webView loadTestPageNamed:@"page-with-csp"];
+
+ [webView waitForMessage:@"MainFrame: B"];
+ [webView waitForMessage:@"Subframe: B"];
+
+ __block bool isDone = false;
+ [webView _appBoundNavigationData:^(struct WKAppBoundNavigationTestingData data) {
+ EXPECT_TRUE(data.hasLoadedAppBoundRequestTesting);
+ EXPECT_FALSE(data.hasLoadedNonAppBoundRequestTesting);
+ isDone = true;
+ }];
+
+ TestWebKitAPI::Util::run(&isDone);
+};
+
+TEST(InAppBrowserPrivacy, NonAppBoundRequestWithSubFrame)
+{
+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [configuration _setOverrideContentSecurityPolicy:@"script-src 'nonce-b'"];
+
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ NSMutableURLRequest *nonAppBoundRequest = [NSMutableURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"page-with-csp" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ APP_BOUND_REQUEST_ADDITIONS
+
+ [webView loadRequest:nonAppBoundRequest];
+
+ [webView waitForMessage:@"MainFrame: B"];
+ [webView waitForMessage:@"Subframe: B"];
+
+ __block bool isDone = false;
+ [webView _appBoundNavigationData: ^(struct WKAppBoundNavigationTestingData data) {
+ EXPECT_FALSE(data.hasLoadedAppBoundRequestTesting);
+ EXPECT_TRUE(data.hasLoadedNonAppBoundRequestTesting);
+ isDone = true;
+ }];
+
+ TestWebKitAPI::Util::run(&isDone);
+};
+
#endif
Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h (273464 => 273465)
--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h 2021-02-25 01:45:50 UTC (rev 273465)
@@ -68,7 +68,6 @@
- (id)objectByEvaluatingJavaScript:(NSString *)script;
- (id)objectByCallingAsyncFunction:(NSString *)script withArguments:(NSDictionary *)arguments error:(NSError **)errorOut;
- (unsigned)waitUntilClientWidthIs:(unsigned)expectedClientWidth;
-- (void)lastNavigationWasAppBound:(void(^)(BOOL))completionHandler;
@end
@interface TestMessageHandler : NSObject <WKScriptMessageHandler>
Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (273464 => 273465)
--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm 2021-02-25 01:18:07 UTC (rev 273464)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm 2021-02-25 01:45:50 UTC (rev 273465)
@@ -251,10 +251,6 @@
return clientWidth;
}
-- (void)lastNavigationWasAppBound:(void(^)(BOOL))completionHandler
-{
- [self _lastNavigationWasAppBound:completionHandler];
-}
@end
@implementation TestMessageHandler {