Title: [268144] trunk
Revision
268144
Author
akeer...@apple.com
Date
2020-10-07 13:10:38 -0700 (Wed, 07 Oct 2020)

Log Message

[Contact Picker API] Add support for ContactsManager.getProperties()
https://bugs.webkit.org/show_bug.cgi?id=217354
<rdar://problem/69862099>

Reviewed by Youenn Fablet.

Source/WebCore:

ContactsManager.getProperties() returns a list of properties supported
by the API. These currently include name, email and tel.

Test: contact-picker/contacts-manager-get-properties.html

* Modules/contact-picker/ContactsManager.cpp:
(WebCore::ContactsManager::getProperties):

LayoutTests:

Added a layout test to exercise the method.

* contact-picker/contacts-manager-get-properties-expected.txt: Added.
* contact-picker/contacts-manager-get-properties.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268143 => 268144)


--- trunk/LayoutTests/ChangeLog	2020-10-07 20:10:23 UTC (rev 268143)
+++ trunk/LayoutTests/ChangeLog	2020-10-07 20:10:38 UTC (rev 268144)
@@ -1,3 +1,16 @@
+2020-10-07  Aditya Keerthi  <akeer...@apple.com>
+
+        [Contact Picker API] Add support for ContactsManager.getProperties()
+        https://bugs.webkit.org/show_bug.cgi?id=217354
+        <rdar://problem/69862099>
+
+        Reviewed by Youenn Fablet.
+
+        Added a layout test to exercise the method.
+
+        * contact-picker/contacts-manager-get-properties-expected.txt: Added.
+        * contact-picker/contacts-manager-get-properties.html: Added.
+
 2020-10-07  Karl Rackler  <rack...@apple.com>
 
         REGRESSION (r268115?): [ iOS wk2 EWS ] fast/images/image-orientation-none-canvas.html is a constant failure

Added: trunk/LayoutTests/contact-picker/contacts-manager-get-properties-expected.txt (0 => 268144)


--- trunk/LayoutTests/contact-picker/contacts-manager-get-properties-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/contact-picker/contacts-manager-get-properties-expected.txt	2020-10-07 20:10:38 UTC (rev 268144)
@@ -0,0 +1,14 @@
+Test for ContactsManager.getProperties().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS properties is an instance of Array
+PASS properties.length is 3
+PASS properties.includes('email') is true
+PASS properties.includes('name') is true
+PASS properties.includes('tel') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/contact-picker/contacts-manager-get-properties.html (0 => 268144)


--- trunk/LayoutTests/contact-picker/contacts-manager-get-properties.html	                        (rev 0)
+++ trunk/LayoutTests/contact-picker/contacts-manager-get-properties.html	2020-10-07 20:10:38 UTC (rev 268144)
@@ -0,0 +1,24 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ experimental:ContactPickerAPIEnabled=true ] -->
+<html>
+    <head>
+        <script src=""
+    </head>
+    <script>
+        jsTestIsAsync = true;
+
+        async function runTest()
+        {
+            description("Test for ContactsManager.getProperties().");
+
+            properties = await navigator.contacts.getProperties();
+            shouldBeType("properties", "Array");
+            shouldBeEqualToNumber("properties.length", 3);
+            shouldBeTrue("properties.includes('email')");
+            shouldBeTrue("properties.includes('name')");
+            shouldBeTrue("properties.includes('tel')");
+
+            finishJSTest();
+        }
+    </script>
+    <body _onload_=runTest()></body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (268143 => 268144)


--- trunk/Source/WebCore/ChangeLog	2020-10-07 20:10:23 UTC (rev 268143)
+++ trunk/Source/WebCore/ChangeLog	2020-10-07 20:10:38 UTC (rev 268144)
@@ -1,3 +1,19 @@
+2020-10-07  Aditya Keerthi  <akeer...@apple.com>
+
+        [Contact Picker API] Add support for ContactsManager.getProperties()
+        https://bugs.webkit.org/show_bug.cgi?id=217354
+        <rdar://problem/69862099>
+
+        Reviewed by Youenn Fablet.
+
+        ContactsManager.getProperties() returns a list of properties supported
+        by the API. These currently include name, email and tel.
+
+        Test: contact-picker/contacts-manager-get-properties.html
+
+        * Modules/contact-picker/ContactsManager.cpp:
+        (WebCore::ContactsManager::getProperties):
+
 2020-10-07  Noam Rosenthal  <n...@webkit.org>
 
         clip-path: path() ignores page zooming (Command-+)

Modified: trunk/Source/WebCore/Modules/contact-picker/ContactsManager.cpp (268143 => 268144)


--- trunk/Source/WebCore/Modules/contact-picker/ContactsManager.cpp	2020-10-07 20:10:23 UTC (rev 268143)
+++ trunk/Source/WebCore/Modules/contact-picker/ContactsManager.cpp	2020-10-07 20:10:38 UTC (rev 268144)
@@ -56,7 +56,8 @@
 
 void ContactsManager::getProperties(Ref<DeferredPromise>&& promise)
 {
-    promise->reject(NotSupportedError);
+    Vector<ContactProperty> properties = { ContactProperty::Email, ContactProperty::Name, ContactProperty::Tel };
+    promise->resolve<IDLSequence<IDLEnumeration<ContactProperty>>>(properties);
 }
 
 void ContactsManager::select(const Vector<ContactProperty>& properties, const ContactsSelectOptions& options, Ref<DeferredPromise>&& promise)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to