haikuwebkit/LayoutTests/contact-picker/contacts-select-requires-us...

12 lines
285 B
Plaintext
Raw Permalink Normal View History

[Contact Picker API] Add skeleton implementation of ContactsManager.select() https://bugs.webkit.org/show_bug.cgi?id=218050 <rdar://problem/69862186> Reviewed by Devin Rousso. Source/WebCore: ContactsManager.select() is the interface that allows clients to present a contact picker. The method should immediately reject when called from a subframe, when called outside user-interaction and when called while a contact picker is already being displayed. Furthermore, the promise is rejected when the supplied properties are empty or invalid. After the conditions necessary for the UI to be presented are verified, ContactsManager.select() calls into the page's Chrome to display the picker. The UI implementation on macOS and iOS will be done in forthcoming patches. See https://wicg.github.io/contact-api/spec/#contacts-manager-select for more information. Tests: contact-picker/contacts-select-invalid-properties-and-options.html contact-picker/contacts-select-requires-user-gesture.html contact-picker/contacts-select-subframe.html * Headers.cmake: * Modules/contact-picker/ContactInfo.h: Added encoder and decoder for IPC. (WebCore::ContactInfo::encode const): (WebCore::ContactInfo::decode): * Modules/contact-picker/ContactInfo.idl: * Modules/contact-picker/ContactProperty.h: * Modules/contact-picker/ContactsManager.cpp: (WebCore::ContactsManager::frame const): (WebCore::ContactsManager::select): * Modules/contact-picker/ContactsManager.h: * Modules/contact-picker/ContactsRequestData.h: Added. ContactsRequestData encapsulates the information required to display a picker UI. This includes the requested properties, the URL of the presenting site, and whether multiple contact selection should be allowed. (WebCore::ContactsRequestData::encode const): (WebCore::ContactsRequestData::decode): * WebCore.xcodeproj/project.pbxproj: * page/Chrome.cpp: (WebCore::Chrome::showContactPicker): * page/Chrome.h: * page/ChromeClient.h: (WebCore::ChromeClient::showContactPicker): Source/WebKit: Added the necessary plumbing in order for the UIProcess to display a contact picker after a call to ContactsManager.select() is made. * UIProcess/PageClient.h: (WebKit::PageClient::showContactPicker): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContactPicker): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::showContactPicker): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::showContactPicker): * WebProcess/WebPage/WebPage.h: LayoutTests: Added tests for failure cases of the API. Note that success cases are untested since no platforms currently display a picker UI, and the specification states that the promise should fail in this case. The success test cases will be added once the UI is implemented for iOS. * contact-picker/contacts-select-invalid-properties-and-options-expected.txt: Added. * contact-picker/contacts-select-invalid-properties-and-options.html: Added. * contact-picker/contacts-select-requires-user-gesture-expected.txt: Added. * contact-picker/contacts-select-requires-user-gesture.html: Added. * contact-picker/contacts-select-subframe-expected.txt: Added. * contact-picker/contacts-select-subframe.html: Added. Canonical link: https://commits.webkit.org/230819@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 01:32:09 +00:00
This test verifies that navigator.contacts.select requires a user gesture.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Did not present contact picker.
PASS exception.name is "SecurityError"
PASS successfullyParsed is true
TEST COMPLETE