Diff
Modified: trunk/LayoutTests/ChangeLog (217885 => 217886)
--- trunk/LayoutTests/ChangeLog 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/LayoutTests/ChangeLog 2017-06-07 16:51:24 UTC (rev 217886)
@@ -1,3 +1,15 @@
+2017-06-07 Per Arne Vollan <[email protected]>
+
+ Support removal of authentication data through the Website data store API.
+ https://bugs.webkit.org/show_bug.cgi?id=171217
+
+ Reviewed by Brady Eidson.
+
+ * TestExpectations:
+ * http/tests/loading/basic-auth-remove-credentials-expected.txt: Added.
+ * http/tests/loading/basic-auth-remove-credentials.html: Added.
+ * platform/mac-wk2/TestExpectations:
+
2017-06-07 Antoine Quint <[email protected]>
Rebaseline and enable media/modern-media-controls/background-tint
Modified: trunk/LayoutTests/TestExpectations (217885 => 217886)
--- trunk/LayoutTests/TestExpectations 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/LayoutTests/TestExpectations 2017-06-07 16:51:24 UTC (rev 217886)
@@ -96,6 +96,7 @@
fast/media/mq-inverted-colors-live-update-in-subframes.html [ Skip ]
fast/media/mq-monochrome-live-update.html [ Skip ]
fast/media/mq-prefers-reduced-motion-live-update.html [ Skip ]
+http/tests/loading/basic-auth-remove-credentials.html [ Skip ]
# ApplePay is only available on iOS (greater than iOS 10) and macOS (greater than macOS 10.12) and only for WebKit2.
http/tests/ssl/applepay/ [ Skip ]
Added: trunk/LayoutTests/http/tests/loading/basic-auth-remove-credentials-expected.txt (0 => 217886)
--- trunk/LayoutTests/http/tests/loading/basic-auth-remove-credentials-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/loading/basic-auth-remove-credentials-expected.txt 2017-06-07 16:51:24 UTC (rev 217886)
@@ -0,0 +1,34 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+127.0.0.1:8000 - didReceiveAuthenticationChallenge - Responding with first:first-pw
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didStartProvisionalLoadForFrame
+127.0.0.1:8000 - didReceiveAuthenticationChallenge - Responding with second:second-pw
+frame "<!--framePath //<!--frame1-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame1-->-->" - didFinishLoadForFrame
+This test verifies that we are able to remove credentials, by checking that we get an authenticaton.
+challenge for a path we normally would not get a challenge for, after having removed all credentials.
+The first frame's path is /loading/resources/protected-resource.php, and we should get a challenge for it.
+It will be authorized with first/first-pw.
+The second frame's path is identical to the first frame, and we should get a challenge for it, because credentials have been deleted.
+It will be authorized with second/second-pw.
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+Authenticated as user: first password: first-pw
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+Authenticated as user: second password: second-pw
Added: trunk/LayoutTests/http/tests/loading/basic-auth-remove-credentials.html (0 => 217886)
--- trunk/LayoutTests/http/tests/loading/basic-auth-remove-credentials.html (rev 0)
+++ trunk/LayoutTests/http/tests/loading/basic-auth-remove-credentials.html 2017-06-07 16:51:24 UTC (rev 217886)
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpChildFramesAsText();
+ testRunner.setHandlesAuthenticationChallenges(true);
+ testRunner.setAuthenticationUsername("first");
+ testRunner.setAuthenticationPassword("first-pw");
+ testRunner.waitUntilDone();
+}
+
+function firstFrameLoaded()
+{
+ if (window.testRunner) {
+ testRunner.setAuthenticationUsername("second");
+ testRunner.setAuthenticationPassword("second-pw");
+ testRunner.removeAllSessionCredentials(removedCredentialsCallback);
+ }
+}
+
+function removedCredentialsCallback()
+{
+ var frame = document.createElement("iframe");
+ frame.setAttribute("src", "http://127.0.0.1:8000/loading/resources/protected-resource.php");
+ frame.setAttribute("onload", "secondFrameLoaded()");
+ document.body.appendChild(frame);
+}
+
+function secondFrameLoaded()
+{
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+</script>
+</head>
+<body>
+This test verifies that we are able to remove credentials, by checking that we get an authenticaton.<br>
+challenge for a path we normally would not get a challenge for, after having removed all credentials.<br>
+The first frame's path is /loading/resources/protected-resource.php, and we should get a challenge for it.<br>
+It will be authorized with first/first-pw.<br>
+The second frame's path is identical to the first frame, and we should get a challenge for it, because credentials have been deleted.<br>
+It will be authorized with second/second-pw.<br>
+<iframe src="" _onload_="firstFrameLoaded();"></iframe>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (217885 => 217886)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2017-06-07 16:51:24 UTC (rev 217886)
@@ -29,6 +29,8 @@
fast/visual-viewport/rubberbanding-viewport-rects.html [ Pass ]
fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html [ Pass ]
+http/tests/loading/basic-auth-remove-credentials.html [ Pass ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
#//////////////////////////////////////////////////////////////////////////////////////////
Modified: trunk/Source/WebCore/ChangeLog (217885 => 217886)
--- trunk/Source/WebCore/ChangeLog 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebCore/ChangeLog 2017-06-07 16:51:24 UTC (rev 217886)
@@ -1,5 +1,19 @@
2017-06-07 Per Arne Vollan <[email protected]>
+ Support removal of authentication data through the Website data store API.
+ https://bugs.webkit.org/show_bug.cgi?id=171217
+
+ Reviewed by Brady Eidson.
+
+ Add support to remove and fetch credential data through the Website data store API.
+
+ Test: http/tests/loading/basic-auth-remove-credentials.html
+
+ * platform/network/CredentialStorage.h:
+ (WebCore::CredentialStorage::originsWithCredentials):
+
+2017-06-07 Per Arne Vollan <[email protected]>
+
AudioSourceProviderAVFObjC::m_tap member access is not thread safe.
https://bugs.webkit.org/show_bug.cgi?id=172263
Modified: trunk/Source/WebCore/platform/network/CredentialStorage.h (217885 => 217886)
--- trunk/Source/WebCore/platform/network/CredentialStorage.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebCore/platform/network/CredentialStorage.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -57,6 +57,8 @@
WEBCORE_EXPORT bool set(const String&, const Credential&, const URL&); // Returns true if the URL corresponds to a known protection space, so credentials could be updated.
WEBCORE_EXPORT Credential get(const String&, const URL&);
+ const HashSet<String>& originsWithCredentials() const { return m_originsWithCredentials; }
+
private:
HashMap<std::pair<String /* partitionName */, ProtectionSpace>, Credential> m_protectionSpaceToCredentialMap;
HashSet<String> m_originsWithCredentials;
Modified: trunk/Source/WebKit2/ChangeLog (217885 => 217886)
--- trunk/Source/WebKit2/ChangeLog 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-07 16:51:24 UTC (rev 217886)
@@ -1,3 +1,40 @@
+2017-06-07 Per Arne Vollan <[email protected]>
+
+ Support removal of authentication data through the Website data store API.
+ https://bugs.webkit.org/show_bug.cgi?id=171217
+ <rdar://problem/29522573>
+
+ Reviewed by Brady Eidson.
+
+ Add support to remove and fetch credential data through the Website data store API.
+ Credential data is removed and fetched from both the network process and web process.
+ Authentication data stored in the keychain will not be cleared.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::fetchWebsiteData):
+ (WebKit::NetworkProcess::deleteWebsiteData):
+ * Shared/WebsiteData/WebsiteData.cpp:
+ (WebKit::WebsiteData::encode):
+ (WebKit::WebsiteData::decode):
+ * Shared/WebsiteData/WebsiteData.h:
+ * Shared/WebsiteData/WebsiteDataType.h:
+ * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
+ * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
+ (dataTypesToString):
+ * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
+ (WebKit::toWebsiteDataType):
+ (WebKit::toWKWebsiteDataTypes):
+ * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+ (+[WKWebsiteDataStore allWebsiteDataTypes]):
+ * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
+ (WebKit::WebsiteDataRecord::addOriginWithCredential):
+ * UIProcess/WebsiteData/WebsiteDataRecord.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::fetchData):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::fetchWebsiteData):
+ (WebKit::WebProcess::deleteWebsiteData):
+
2017-06-06 Dan Bernstein <[email protected]>
Fixed building with the macOS 10.13 Apple Internal SDK when targeting macOS 10.12.
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (217885 => 217886)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -390,6 +390,11 @@
getHostnamesWithCookies(*networkStorageSession, callbackAggregator->m_websiteData.hostNamesWithCookies);
}
+ if (websiteDataTypes.contains(WebsiteDataType::Credentials)) {
+ if (NetworkStorageSession::storageSession(sessionID))
+ callbackAggregator->m_websiteData.originsWithCredentials = NetworkStorageSession::storageSession(sessionID)->credentialStorage().originsWithCredentials();
+ }
+
if (websiteDataTypes.contains(WebsiteDataType::DiskCache)) {
fetchDiskCacheEntries(sessionID, fetchOptions, [callbackAggregator = WTFMove(callbackAggregator)](auto entries) mutable {
callbackAggregator->m_websiteData.entries.appendVector(entries);
@@ -411,6 +416,11 @@
deleteAllCookiesModifiedSince(*networkStorageSession, modifiedSince);
}
+ if (websiteDataTypes.contains(WebsiteDataType::Credentials)) {
+ if (NetworkStorageSession::storageSession(sessionID))
+ NetworkStorageSession::storageSession(sessionID)->credentialStorage().clearCredentials();
+ }
+
auto completionHandler = [this, callbackID] {
parentProcessConnection()->send(Messages::NetworkProcessProxy::DidDeleteWebsiteData(callbackID), 0);
};
Modified: trunk/Source/WebKit2/Shared/WebsiteData/WebsiteData.cpp (217885 => 217886)
--- trunk/Source/WebKit2/Shared/WebsiteData/WebsiteData.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/Shared/WebsiteData/WebsiteData.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -62,6 +62,7 @@
#if ENABLE(NETSCAPE_PLUGIN_API)
encoder << hostNamesWithPluginData;
#endif
+ encoder << originsWithCredentials;
}
bool WebsiteData::decode(IPC::Decoder& decoder, WebsiteData& result)
@@ -74,7 +75,8 @@
if (!decoder.decode(result.hostNamesWithPluginData))
return false;
#endif
-
+ if (!decoder.decode(result.originsWithCredentials))
+ return false;
return true;
}
Modified: trunk/Source/WebKit2/Shared/WebsiteData/WebsiteData.h (217885 => 217886)
--- trunk/Source/WebKit2/Shared/WebsiteData/WebsiteData.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/Shared/WebsiteData/WebsiteData.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -56,6 +56,8 @@
HashSet<String> hostNamesWithPluginData;
#endif
+ HashSet<String> originsWithCredentials;
+
void encode(IPC::Encoder&) const;
static bool decode(IPC::Decoder&, WebsiteData&);
};
Modified: trunk/Source/WebKit2/Shared/WebsiteData/WebsiteDataType.h (217885 => 217886)
--- trunk/Source/WebKit2/Shared/WebsiteData/WebsiteDataType.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/Shared/WebsiteData/WebsiteDataType.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -47,6 +47,7 @@
MediaDeviceIdentifier = 1 << 12,
#endif
WebsiteDataTypeResourceLoadStatistics = 1 << 13,
+ Credentials = 1 << 14,
};
};
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm (217885 => 217886)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm 2017-06-07 16:51:24 UTC (rev 217886)
@@ -45,6 +45,7 @@
NSString * const _WKWebsiteDataTypeHSTSCache = @"_WKWebsiteDataTypeHSTSCache";
NSString * const _WKWebsiteDataTypeSearchFieldRecentSearches = @"_WKWebsiteDataTypeSearchFieldRecentSearches";
NSString * const _WKWebsiteDataTypeResourceLoadStatistics = @"_WKWebsiteDataTypeResourceLoadStatistics";
+NSString * const _WKWebsiteDataTypeCredentials = @"_WKWebsiteDataTypeCredentials";
#if PLATFORM(MAC)
NSString * const _WKWebsiteDataTypePlugInData = @"_WKWebsiteDataTypePlugInData";
@@ -91,6 +92,8 @@
#endif
if ([dataTypes containsObject:_WKWebsiteDataTypeResourceLoadStatistics])
[array addObject:@"Resource Load Statistics"];
+ if ([dataTypes containsObject:_WKWebsiteDataTypeCredentials])
+ [array addObject:@"Credentials"];
return [array componentsJoinedByString:@", "];
}
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h (217885 => 217886)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -70,7 +70,8 @@
#endif
if ([websiteDataType isEqualToString:_WKWebsiteDataTypeResourceLoadStatistics])
return WebsiteDataType::WebsiteDataTypeResourceLoadStatistics;
-
+ if ([websiteDataType isEqualToString:_WKWebsiteDataTypeCredentials])
+ return WebsiteDataType::Credentials;
return std::nullopt;
}
@@ -118,6 +119,8 @@
#endif
if (websiteDataTypes.contains(WebsiteDataType::WebsiteDataTypeResourceLoadStatistics))
[wkWebsiteDataTypes addObject:_WKWebsiteDataTypeResourceLoadStatistics];
+ if (websiteDataTypes.contains(WebsiteDataType::Credentials))
+ [wkWebsiteDataTypes addObject:_WKWebsiteDataTypeCredentials];
return wkWebsiteDataTypes;
}
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h (217885 => 217886)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -35,6 +35,7 @@
WK_EXTERN NSString * const _WKWebsiteDataTypeMediaKeys WK_API_AVAILABLE(macosx(10.11), ios(9.0));
WK_EXTERN NSString * const _WKWebsiteDataTypeSearchFieldRecentSearches WK_API_AVAILABLE(macosx(10.12), ios(10.0));
WK_EXTERN NSString * const _WKWebsiteDataTypeResourceLoadStatistics WK_API_AVAILABLE(macosx(10.12), ios(10.0));
+WK_EXTERN NSString * const _WKWebsiteDataTypeCredentials WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
#if !TARGET_OS_IPHONE
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp (217885 => 217886)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -155,5 +155,12 @@
return emptyString();
}
-
+
+void WebsiteDataRecord::addOriginWithCredential(const String& origin)
+{
+ types |= WebsiteDataType::Credentials;
+
+ originsWithCredentials.add(origin);
}
+
+}
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h (217885 => 217886)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -53,6 +53,7 @@
#if ENABLE(NETSCAPE_PLUGIN_API)
void addPluginDataHostName(const String& hostName);
#endif
+ void addOriginWithCredential(const String&);
String displayName;
OptionSet<WebsiteDataType> types;
@@ -68,7 +69,8 @@
#if ENABLE(NETSCAPE_PLUGIN_API)
HashSet<String> pluginDataHostNames;
#endif
-
+ HashSet<String> originsWithCredentials;
+
bool matchesTopPrivatelyControlledDomain(const String&) const;
String topPrivatelyControlledDomain();
};
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (217885 => 217886)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -252,6 +252,12 @@
}
#endif
+ for (auto& origin : websiteData.originsWithCredentials) {
+ auto& record = m_websiteDataRecords.add(origin, WebsiteDataRecord { }).iterator->value;
+
+ record.addOriginWithCredential(origin);
+ }
+
callIfNeeded();
}
@@ -550,6 +556,9 @@
if (dataTypes.contains(WebsiteDataType::HSTSCache))
processAccessType = std::max(processAccessType, ProcessAccessType::Launch);
+ if (dataTypes.contains(WebsiteDataType::Credentials))
+ processAccessType = std::max(processAccessType, ProcessAccessType::Launch);
+
return processAccessType;
}
@@ -562,6 +571,9 @@
if (dataTypes.contains(WebsiteDataType::MemoryCache))
processAccessType = std::max(processAccessType, ProcessAccessType::OnlyIfLaunched);
+ if (dataTypes.contains(WebsiteDataType::Credentials))
+ processAccessType = std::max(processAccessType, ProcessAccessType::OnlyIfLaunched);
+
return processAccessType;
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (217885 => 217886)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -1244,6 +1244,11 @@
for (auto& origin : MemoryCache::singleton().originsWithCache(sessionID))
websiteData.entries.append(WebsiteData::Entry { SecurityOriginData::fromSecurityOrigin(*origin), WebsiteDataType::MemoryCache, 0 });
}
+
+ if (websiteDataTypes.contains(WebsiteDataType::Credentials)) {
+ if (NetworkStorageSession::storageSession(sessionID))
+ websiteData.originsWithCredentials = NetworkStorageSession::storageSession(sessionID)->credentialStorage().originsWithCredentials();
+ }
}
void WebProcess::deleteWebsiteData(SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince)
@@ -1256,6 +1261,11 @@
CrossOriginPreflightResultCache::singleton().empty();
}
+
+ if (websiteDataTypes.contains(WebsiteDataType::Credentials)) {
+ if (WebCore::NetworkStorageSession::storageSession(sessionID))
+ NetworkStorageSession::storageSession(sessionID)->credentialStorage().clearCredentials();
+ }
}
void WebProcess::deleteWebsiteDataForOrigins(WebCore::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<WebCore::SecurityOriginData>& originDatas)
Modified: trunk/Tools/ChangeLog (217885 => 217886)
--- trunk/Tools/ChangeLog 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/ChangeLog 2017-06-07 16:51:24 UTC (rev 217886)
@@ -1,3 +1,25 @@
+2017-06-07 Per Arne Vollan <[email protected]>
+
+ Support removal of authentication data through the Website data store API.
+ https://bugs.webkit.org/show_bug.cgi?id=171217
+
+ Reviewed by Brady Eidson.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::removeAllSessionCredentials):
+ (WTR::TestRunner::callDidRemoveAllSessionCredentialsCallback):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+ (WTR::TestInvocation::didRemoveAllSessionCredentials):
+ * WebKitTestRunner/TestInvocation.h:
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::TestController::removeAllSessionCredentials):
+
2017-06-07 Charlie Turner <[email protected]>
Add Charlie Turner as contributor
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2017-06-07 16:51:24 UTC (rev 217886)
@@ -280,4 +280,6 @@
void setWebRTCLegacyAPIEnabled(boolean value);
void terminateNetworkProcess();
+
+ void removeAllSessionCredentials(object callback);
};
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -240,6 +240,11 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "CallDidRemoveAllSessionCredentialsCallback")) {
+ m_testRunner->callDidRemoveAllSessionCredentialsCallback();
+ return;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "NotifyDownloadDone")) {
m_testRunner->notifyDone();
return;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -643,6 +643,7 @@
DidRemoveSwipeSnapshotCallbackID,
StatisticsDidModifyDataRecordsCallbackID,
StatisticsDidScanDataRecordsCallbackID,
+ DidRemoveAllSessionCredentialsCallbackID,
FirstUIScriptCallbackID = 100
};
@@ -1638,4 +1639,19 @@
WKBundlePagePostMessage(page, messageName.get(), fileURLs.get());
}
+void TestRunner::removeAllSessionCredentials(JSValueRef callback)
+{
+ cacheTestRunnerCallback(DidRemoveAllSessionCredentialsCallbackID, callback);
+
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("RemoveAllSessionCredentials"));
+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(true));
+
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
+void TestRunner::callDidRemoveAllSessionCredentialsCallback()
+{
+ callTestRunnerCallback(DidRemoveAllSessionCredentialsCallbackID);
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -378,6 +378,9 @@
void terminateNetworkProcess();
+ void removeAllSessionCredentials(JSValueRef);
+ void callDidRemoveAllSessionCredentialsCallback();
+
private:
TestRunner();
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -2331,6 +2331,10 @@
return 0;
}
+void TestController::removeAllSessionCredentials()
+{
+}
+
#endif
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestController.h (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/TestController.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -175,7 +175,9 @@
void setOpenPanelFileURLs(WKArrayRef fileURLs) { m_openPanelFileURLs = fileURLs; }
void terminateNetworkProcess();
-
+
+ void removeAllSessionCredentials();
+
private:
WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef);
WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration() const;
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2017-06-07 16:51:24 UTC (rev 217886)
@@ -1101,6 +1101,11 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "RemoveAllSessionCredentials")) {
+ TestController::singleton().removeAllSessionCredentials();
+ return nullptr;
+ }
+
ASSERT_NOT_REACHED();
return nullptr;
}
@@ -1175,4 +1180,10 @@
WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
}
+void TestInvocation::didRemoveAllSessionCredentials()
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidRemoveAllSessionCredentialsCallback"));
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2017-06-07 16:51:24 UTC (rev 217886)
@@ -71,6 +71,8 @@
void notifyDownloadDone();
+ void didRemoveAllSessionCredentials();
+
private:
void dumpResults();
static void dump(const char* textToStdout, const char* textToStderr = 0, bool seenError = false);
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (217885 => 217886)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2017-06-07 16:04:37 UTC (rev 217885)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2017-06-07 16:51:24 UTC (rev 217886)
@@ -41,6 +41,7 @@
#import <WebKit/WKWebViewConfiguration.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/WKWebsiteDataRecordPrivate.h>
#import <WebKit/WKWebsiteDataStoreRef.h>
#import <WebKit/_WKProcessPoolConfiguration.h>
#import <WebKit/_WKUserContentExtensionStore.h>
@@ -200,4 +201,14 @@
return imagesArray.count;
}
+void TestController::removeAllSessionCredentials()
+{
+#if WK_API_ENABLED
+ auto types = adoptNS([[NSSet alloc] initWithObjects:_WKWebsiteDataTypeCredentials, nil]);
+ [globalWebViewConfiguration.websiteDataStore removeDataOfTypes:types.get() modifiedSince:[NSDate distantPast] completionHandler:^() {
+ m_currentInvocation->didRemoveAllSessionCredentials();
+ }];
+#endif
+}
+
} // namespace WTR