Diff
Modified: trunk/LayoutTests/ChangeLog (249674 => 249675)
--- trunk/LayoutTests/ChangeLog 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/LayoutTests/ChangeLog 2019-09-09 23:35:12 UTC (rev 249675)
@@ -1,5 +1,21 @@
2019-09-09 Chris Dumez <[email protected]>
+ Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html
+ https://bugs.webkit.org/show_bug.cgi?id=201596
+
+ Reviewed by Alex Christensen.
+
+ Update layout test to use testRunner.setShouldSwapToEphemeralSessionOnNextNavigation() &
+ testRunner.setShouldSwapToDefaultSessionOnNextNavigation() instead of the legacy
+ testRunner.setPrivateBrowsingEnabled_DEPRECATED(). The test needed some extra steps to
+ navigate whenever we switch session but it is a lot more realistic and is really switching
+ session on WebKit2. The testRunner.setPrivateBrowsingEnabled_DEPRECATED() was not truly
+ switching session, just making the document think it did.
+
+ * http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html:
+
+2019-09-09 Chris Dumez <[email protected]>
+
Resync service workers WPT tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=201589
Modified: trunk/LayoutTests/http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html (249674 => 249675)
--- trunk/LayoutTests/http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/LayoutTests/http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html 2019-09-09 23:35:12 UTC (rev 249675)
@@ -45,7 +45,6 @@
function appendConversionDataIframeAndFinish() {
testRunner.dumpAdClickAttribution();
document.body.removeChild(document.getElementById("targetLink"));
- document.body.removeChild(document.getElementById("pixel"));
appendIframe("http://127.0.0.1:8000/adClickAttribution/resources/getConversionData.php?timeout_ms=1000&nonce=" + nonce, function() {
tearDownAndFinish();
@@ -55,14 +54,19 @@
function runTest() {
if (window.testRunner) {
if (window.location.search === "?stepTwo") {
- testRunner.setPrivateBrowsingEnabled_DEPRECATED(true);
+ testRunner.setShouldSwapToEphemeralSessionOnNextNavigation(true);
+ window.location = "http://localhost:8000/adClickAttribution/conversion-disabled-in-ephemeral-session.html?stepThree";
+ } else if (window.location.search === "?stepThree") {
let imageElement = document.createElement("img");
imageElement.src = "" + nonce;
imageElement.id = "pixel";
imageElement._onerror_ = function() {
- appendConversionDataIframeAndFinish();
+ testRunner.setShouldSwapToDefaultSessionOnNextNavigation(true);
+ window.location = "http://localhost:8000/adClickAttribution/conversion-disabled-in-ephemeral-session.html?stepFour";
};
document.body.appendChild(imageElement);
+ } else if (window.location.search === "?stepFour") {
+ appendConversionDataIframeAndFinish();
} else {
document.cookie = "cookieSetAsFirstParty=1; path=/";
activateElement("targetLink");
Modified: trunk/Source/WebKit/ChangeLog (249674 => 249675)
--- trunk/Source/WebKit/ChangeLog 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Source/WebKit/ChangeLog 2019-09-09 23:35:12 UTC (rev 249675)
@@ -1,3 +1,17 @@
+2019-09-09 Chris Dumez <[email protected]>
+
+ Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html
+ https://bugs.webkit.org/show_bug.cgi?id=201596
+
+ Reviewed by Alex Christensen.
+
+ Allow WKFramePolicyListenerUseWithPolicies() C API to switch to a persistent non-default session.
+ This is important since WebKitTestRunner is not using the default session anymore and I need to
+ be able to switch it back to its normal session after going to an ephemeral one.
+
+ * UIProcess/API/C/WKFramePolicyListener.cpp:
+ (useWithPolicies):
+
2019-09-09 Alex Christensen <[email protected]>
Deprecate unused SPI to preconnect to a server
Modified: trunk/Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp (249674 => 249675)
--- trunk/Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp 2019-09-09 23:35:12 UTC (rev 249675)
@@ -53,11 +53,6 @@
static void useWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePolicies, ProcessSwapRequestedByClient processSwapRequestedByClient)
{
- if (auto* websiteDataStore = toImpl(websitePolicies)->websiteDataStore()) {
- auto sessionID = websiteDataStore->websiteDataStore().sessionID();
- RELEASE_ASSERT_WITH_MESSAGE(sessionID.isEphemeral() || sessionID == PAL::SessionID::defaultSessionID(), "If WebsitePolicies specifies a WebsiteDataStore, the data store's session must be default or non-persistent.");
- }
-
toImpl(policyListenerRef)->use(toImpl(websitePolicies), processSwapRequestedByClient);
}
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (249674 => 249675)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2019-09-09 23:35:12 UTC (rev 249675)
@@ -594,9 +594,6 @@
if (apiWebsitePolicies) {
if (auto* websiteDataStore = apiWebsitePolicies->websiteDataStore()) {
- auto sessionID = websiteDataStore->websiteDataStore().sessionID();
- if (!sessionID.isEphemeral() && sessionID != PAL::SessionID::defaultSessionID())
- [NSException raise:NSInvalidArgumentException format:@"WKWebpagePreferences._websiteDataStore must be nil, default, or non-persistent."];
if (subframeNavigation)
[NSException raise:NSInvalidArgumentException format:@"WKWebpagePreferences._websiteDataStore must be nil for subframe navigations."];
}
Modified: trunk/Tools/ChangeLog (249674 => 249675)
--- trunk/Tools/ChangeLog 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/ChangeLog 2019-09-09 23:35:12 UTC (rev 249675)
@@ -1,3 +1,38 @@
+2019-09-09 Chris Dumez <[email protected]>
+
+ Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html
+ https://bugs.webkit.org/show_bug.cgi?id=201596
+
+ Reviewed by Alex Christensen.
+
+ Add new testRunner.setShouldSwapToEphemeralSessionOnNextNavigation() / testRunner.setShouldSwapToDefaultSessionOnNextNavigation()
+ test functions to support dynamic switching between ephemeral and default/persistent session in layout tests. The new methods
+ do the right thing for WebKit2 and truly switch session, unlike setPrivateBrowsingEnabled_DEPRECATED() which was merely making
+ the WebCore::Document think it changed session.
+
+ * DumpRenderTree/TestRunner.cpp:
+ (setShouldSwapToEphemeralSessionOnNextNavigationCallback):
+ (setShouldSwapToDefaultSessionOnNextNavigationCallback):
+ (TestRunner::staticFunctions):
+ (TestRunner::willNavigate):
+ * DumpRenderTree/TestRunner.h:
+ (TestRunner::setShouldSwapToEphemeralSessionOnNextNavigation):
+ (TestRunner::setShouldSwapToDefaultSessionOnNextNavigation):
+ * DumpRenderTree/mac/FrameLoadDelegate.mm:
+ (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]):
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setShouldSwapToEphemeralSessionOnNextNavigation):
+ (WTR::TestRunner::setShouldSwapToDefaultSessionOnNextNavigation):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::decidePolicyForNavigationAction):
+ * WebKitTestRunner/TestController.h:
+ (WTR::TestController::setShouldSwapToEphemeralSessionOnNextNavigation):
+ (WTR::TestController::setShouldSwapToDefaultSessionOnNextNavigation):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
2019-09-09 Aakash Jain <[email protected]>
EWS testtube emoji doesn't exist on macOS Mojave
Deleted: trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.m (249674 => 249675)
--- trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.m 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.m 2019-09-09 23:35:12 UTC (rev 249675)
@@ -1,34 +0,0 @@
-//
-// DefaultPolicyDelegate.m
-// DumpRenderTree
-//
-// Created by Anders Carlsson on 7/9/13.
-//
-//
-
-#import "DefaultPolicyDelegate.h"
-
-#import <WebKit/WebPolicyDelegatePrivate.h>
-#import <WebKit/WebViewPrivate.h>
-
-@implementation DefaultPolicyDelegate
-
-- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener
-{
- if ([WebView _canHandleRequest:request]) {
- [listener use];
- return;
- }
-
- WebNavigationType navType = (WebNavigationType)[[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
- if (navType == WebNavigationTypePlugInRequest) {
- [listener use];
- return;
- }
-
- // The default WebKit policy delegate passes the URL along to -[NSWorkspace openURL:] here,
- // but we don't want to do that so we just ignore the navigation completely.
- [listener ignore];
-}
-
-@end
Copied: trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.mm (from rev 249672, trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.m) (0 => 249675)
--- trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.mm (rev 0)
+++ trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.mm 2019-09-09 23:35:12 UTC (rev 249675)
@@ -0,0 +1,41 @@
+//
+// DefaultPolicyDelegate.m
+// DumpRenderTree
+//
+// Created by Anders Carlsson on 7/9/13.
+//
+//
+
+#import "config.h"
+#import "DefaultPolicyDelegate.h"
+
+#import "DumpRenderTree.h"
+#import "TestRunner.h"
+#import <WebKit/WebPolicyDelegatePrivate.h>
+#import <WebKit/WebViewPrivate.h>
+
+@implementation DefaultPolicyDelegate
+
+- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener
+{
+ if ([WebView _canHandleRequest:request]) {
+ if (![frame frameElement])
+ gTestRunner->willNavigate();
+ [listener use];
+ return;
+ }
+
+ WebNavigationType navType = (WebNavigationType)[[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
+ if (static_cast<unsigned>(navType) == static_cast<unsigned>(WebNavigationTypePlugInRequest)) {
+ if (![frame frameElement])
+ gTestRunner->willNavigate();
+ [listener use];
+ return;
+ }
+
+ // The default WebKit policy delegate passes the URL along to -[NSWorkspace openURL:] here,
+ // but we don't want to do that so we just ignore the navigation completely.
+ [listener ignore];
+}
+
+@end
Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (249674 => 249675)
--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2019-09-09 23:35:12 UTC (rev 249675)
@@ -66,7 +66,7 @@
1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A215A8011F2609C008AD0F5 /* PluginTest.h */; };
1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */; };
1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */; };
- 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */; };
+ 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.mm */; };
1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A31EB3713466AC100017372 /* ConvertPoint.cpp */; };
1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */; };
1A4CCD4F171375A300981040 /* ToStringAndValueOfObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */; };
@@ -268,7 +268,7 @@
1A215A8011F2609C008AD0F5 /* PluginTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginTest.h; sourceTree = "<group>"; };
1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeObjectFromDestroyedPlugin.cpp; sourceTree = "<group>"; };
1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DefaultPolicyDelegate.h; sourceTree = "<group>"; };
- 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DefaultPolicyDelegate.m; sourceTree = "<group>"; };
+ 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DefaultPolicyDelegate.mm; sourceTree = "<group>"; };
1A31EB3713466AC100017372 /* ConvertPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConvertPoint.cpp; sourceTree = "<group>"; };
1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURLDestroyingPlugin.cpp; sourceTree = "<group>"; };
1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToStringAndValueOfObject.cpp; sourceTree = "<group>"; };
@@ -482,7 +482,7 @@
A1158D6A18927CE10088C17B /* ios */,
A134E53418905E6C00901D06 /* config.h */,
1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */,
- 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */,
+ 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.mm */,
9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */,
32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */,
1422A2750AF6F4BD00E1A883 /* Delegates */,
@@ -1162,7 +1162,7 @@
BCA18B390C9B021900114369 /* AppleScriptController.m in Sources */,
F44A531D21B89A4D00DBB99C /* ClassMethodSwizzler.mm in Sources */,
53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */,
- 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */,
+ 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.mm in Sources */,
BCA18C470C9B5B9400114369 /* DumpRenderTree.mm in Sources */,
A1158D581892740C0088C17B /* DumpRenderTreeBrowserView.mm in Sources */,
9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */,
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (249674 => 249675)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2019-09-09 23:35:12 UTC (rev 249675)
@@ -1128,6 +1128,30 @@
return JSValueMakeUndefined(context);
}
+static JSValueRef setShouldSwapToEphemeralSessionOnNextNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac & windows implementation
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+ controller->setShouldSwapToEphemeralSessionOnNextNavigation(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
+static JSValueRef setShouldSwapToDefaultSessionOnNextNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac & windows implementation
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+ controller->setShouldSwapToDefaultSessionOnNextNavigation(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setJavaScriptCanAccessClipboardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
@@ -2220,6 +2244,8 @@
{ "setPluginsEnabled", setPluginsEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPrinting", setPrintingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPrivateBrowsingEnabled_DEPRECATED", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setShouldSwapToEphemeralSessionOnNextNavigation", setShouldSwapToEphemeralSessionOnNextNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setShouldSwapToDefaultSessionOnNextNavigation", setShouldSwapToDefaultSessionOnNextNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setSerializeHTTPLoads", setSerializeHTTPLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setSpatialNavigationEnabled", setSpatialNavigationEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -2535,3 +2561,11 @@
{
clearTestRunnerCallbacks();
}
+
+void TestRunner::willNavigate()
+{
+ if (m_shouldSwapToEphemeralSessionOnNextNavigation || m_shouldSwapToDefaultSessionOnNextNavigation) {
+ ASSERT(m_shouldSwapToEphemeralSessionOnNextNavigation != m_shouldSwapToDefaultSessionOnNextNavigation);
+ setPrivateBrowsingEnabled(m_shouldSwapToEphemeralSessionOnNextNavigation);
+ }
+}
Modified: trunk/Tools/DumpRenderTree/TestRunner.h (249674 => 249675)
--- trunk/Tools/DumpRenderTree/TestRunner.h 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/DumpRenderTree/TestRunner.h 2019-09-09 23:35:12 UTC (rev 249675)
@@ -116,6 +116,11 @@
void setPluginsEnabled(bool);
void setPopupBlockingEnabled(bool);
void setPrivateBrowsingEnabled(bool);
+
+ void willNavigate();
+ void setShouldSwapToEphemeralSessionOnNextNavigation(bool shouldSwap) { m_shouldSwapToEphemeralSessionOnNextNavigation = shouldSwap; }
+ void setShouldSwapToDefaultSessionOnNextNavigation(bool shouldSwap) { m_shouldSwapToDefaultSessionOnNextNavigation = shouldSwap; }
+
void setTabKeyCyclesThroughElements(bool);
void setUserStyleSheetEnabled(bool flag);
void setUserStyleSheetLocation(JSStringRef path);
@@ -458,6 +463,8 @@
bool m_hasPendingWebNotificationClick { false };
bool m_dumpJSConsoleLogInStdErr { false };
bool m_didCancelClientRedirect { false };
+ bool m_shouldSwapToEphemeralSessionOnNextNavigation { false };
+ bool m_shouldSwapToDefaultSessionOnNextNavigation { false };
double m_databaseDefaultQuota { -1 };
double m_databaseMaxQuota { -1 };
Modified: trunk/Tools/DumpRenderTree/mac/PolicyDelegate.mm (249674 => 249675)
--- trunk/Tools/DumpRenderTree/mac/PolicyDelegate.mm 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/DumpRenderTree/mac/PolicyDelegate.mm 2019-09-09 23:35:12 UTC (rev 249675)
@@ -85,9 +85,11 @@
printf("%s\n", [message UTF8String]);
- if (permissiveDelegate)
+ if (permissiveDelegate) {
+ if (![frame frameElement])
+ gTestRunner->willNavigate();
[listener use];
- else
+ } else
[listener ignore];
if (controllerToNotifyDone) {
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (249674 => 249675)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-09-09 23:35:12 UTC (rev 249675)
@@ -105,7 +105,8 @@
void setIgnoresViewportScaleLimits(boolean value);
void setShouldDownloadUndisplayableMIMETypes(boolean value);
- // DEPRECATED: Use <!-- webkit-test-runner [ useEphemeralSession=true ] --> instead.
+ // DEPRECATED: Use <!-- webkit-test-runner [ useEphemeralSession=true ] --> instead, or
+ // testRunner.setShouldSwapToEphemeralSessionOnNextNavigation() / testRunner.setShouldSwapToDefaultSessionOnNextNavigation().
void setPrivateBrowsingEnabled_DEPRECATED(boolean value);
// Special DOM functions.
@@ -253,6 +254,9 @@
void setAllowsAnySSLCertificate(boolean value);
+ void setShouldSwapToEphemeralSessionOnNextNavigation(boolean value);
+ void setShouldSwapToDefaultSessionOnNextNavigation(boolean value);
+
// Secure text input mode (Mac only)
readonly attribute boolean secureEventInputIsEnabled;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (249674 => 249675)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-09-09 23:35:12 UTC (rev 249675)
@@ -500,6 +500,24 @@
WKBundlePagePostSynchronousMessageForTesting(injectedBundle.page()->page(), messageName.get(), messageBody.get(), nullptr);
}
+void TestRunner::setShouldSwapToEphemeralSessionOnNextNavigation(bool shouldSwap)
+{
+ auto& injectedBundle = InjectedBundle::singleton();
+
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetShouldSwapToEphemeralSessionOnNextNavigation"));
+ WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(shouldSwap));
+ WKBundlePagePostSynchronousMessageForTesting(injectedBundle.page()->page(), messageName.get(), messageBody.get(), nullptr);
+}
+
+void TestRunner::setShouldSwapToDefaultSessionOnNextNavigation(bool shouldSwap)
+{
+ auto& injectedBundle = InjectedBundle::singleton();
+
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetShouldSwapToDefaultSessionOnNextNavigation"));
+ WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(shouldSwap));
+ WKBundlePagePostSynchronousMessageForTesting(injectedBundle.page()->page(), messageName.get(), messageBody.get(), nullptr);
+}
+
void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled)
{
auto& injectedBundle = InjectedBundle::singleton();
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (249674 => 249675)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-09-09 23:35:12 UTC (rev 249675)
@@ -127,6 +127,8 @@
void setCacheModel(int);
void setAsynchronousSpellCheckingEnabled(bool);
void setAllowsAnySSLCertificate(bool);
+ void setShouldSwapToEphemeralSessionOnNextNavigation(bool);
+ void setShouldSwapToDefaultSessionOnNextNavigation(bool);
void setEncryptedMediaAPIEnabled(bool);
void setMediaDevicesEnabled(bool);
void setWebRTCMDNSICECandidatesEnabled(bool);
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (249674 => 249675)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2019-09-09 23:35:12 UTC (rev 249675)
@@ -68,6 +68,7 @@
#include <WebKit/WKUserMediaPermissionCheck.h>
#include <WebKit/WKWebsiteDataStoreConfigurationRef.h>
#include <WebKit/WKWebsiteDataStoreRef.h>
+#include <WebKit/WKWebsitePolicies.h>
#include <algorithm>
#include <cstdio>
#include <ctype.h>
@@ -2811,14 +2812,26 @@
WKRetainPtr<WKFramePolicyListenerRef> retainedListener { listener };
WKRetainPtr<WKNavigationActionRef> retainedNavigationAction { navigationAction };
const bool shouldIgnore { m_policyDelegateEnabled && !m_policyDelegatePermissive };
- auto decisionFunction = [shouldIgnore, retainedListener, retainedNavigationAction]() {
+ auto decisionFunction = [shouldIgnore, retainedListener, retainedNavigationAction, shouldSwapToEphemeralSessionOnNextNavigation = m_shouldSwapToEphemeralSessionOnNextNavigation, shouldSwapToDefaultSessionOnNextNavigation = m_shouldSwapToDefaultSessionOnNextNavigation]() {
if (shouldIgnore)
WKFramePolicyListenerIgnore(retainedListener.get());
else if (WKNavigationActionShouldPerformDownload(retainedNavigationAction.get()))
WKFramePolicyListenerDownload(retainedListener.get());
- else
- WKFramePolicyListenerUse(retainedListener.get());
+ else {
+ if (shouldSwapToEphemeralSessionOnNextNavigation || shouldSwapToDefaultSessionOnNextNavigation) {
+ ASSERT(shouldSwapToEphemeralSessionOnNextNavigation != shouldSwapToDefaultSessionOnNextNavigation);
+ auto policies = adoptWK(WKWebsitePoliciesCreate());
+ WKRetainPtr<WKWebsiteDataStoreRef> newSession = TestController::websiteDataStore();
+ if (shouldSwapToEphemeralSessionOnNextNavigation)
+ newSession = adoptWK(WKWebsiteDataStoreCreateNonPersistentDataStore());
+ WKWebsitePoliciesSetDataStore(policies.get(), newSession.get());
+ WKFramePolicyListenerUseWithPolicies(retainedListener.get(), policies.get());
+ } else
+ WKFramePolicyListenerUse(retainedListener.get());
+ }
};
+ m_shouldSwapToEphemeralSessionOnNextNavigation = false;
+ m_shouldSwapToDefaultSessionOnNextNavigation = false;
if (m_shouldDecideNavigationPolicyAfterDelay)
RunLoop::main().dispatch(WTFMove(decisionFunction));
Modified: trunk/Tools/WebKitTestRunner/TestController.h (249674 => 249675)
--- trunk/Tools/WebKitTestRunner/TestController.h 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2019-09-09 23:35:12 UTC (rev 249675)
@@ -186,6 +186,8 @@
void setAuthenticationUsername(String username) { m_authenticationUsername = username; }
void setAuthenticationPassword(String password) { m_authenticationPassword = password; }
void setAllowsAnySSLCertificate(bool);
+ void setShouldSwapToEphemeralSessionOnNextNavigation(bool value) { m_shouldSwapToEphemeralSessionOnNextNavigation = value; }
+ void setShouldSwapToDefaultSessionOnNextNavigation(bool value) { m_shouldSwapToDefaultSessionOnNextNavigation = value; }
void setBlockAllPlugins(bool shouldBlock);
void setPluginSupportedMode(const String&);
@@ -593,6 +595,8 @@
uint64_t m_serverTrustEvaluationCallbackCallsCount { 0 };
bool m_shouldDismissJavaScriptAlertsAsynchronously { false };
bool m_allowsAnySSLCertificate { true };
+ bool m_shouldSwapToEphemeralSessionOnNextNavigation { false };
+ bool m_shouldSwapToDefaultSessionOnNextNavigation { false };
};
struct TestCommand {
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (249674 => 249675)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-09-09 23:23:54 UTC (rev 249674)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-09-09 23:35:12 UTC (rev 249675)
@@ -925,6 +925,16 @@
TestController::singleton().setAllowsAnySSLCertificate(WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody)));
return nullptr;
}
+
+ if (WKStringIsEqualToUTF8CString(messageName, "SetShouldSwapToEphemeralSessionOnNextNavigation")) {
+ TestController::singleton().setShouldSwapToEphemeralSessionOnNextNavigation(WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody)));
+ return nullptr;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "SetShouldSwapToDefaultSessionOnNextNavigation")) {
+ TestController::singleton().setShouldSwapToDefaultSessionOnNextNavigation(WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody)));
+ return nullptr;
+ }
if (WKStringIsEqualToUTF8CString(messageName, "ImageCountInGeneralPasteboard")) {
unsigned count = TestController::singleton().imageCountInGeneralPasteboard();