From 488649a4f344dc105ccc4f0078e3b4711500aafe Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 19 Feb 2024 16:28:00 -0800 Subject: [PATCH] chore: export defs needed by Payment Request --- index.bs | 81 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/index.bs b/index.bs index a505955..826ed4f 100644 --- a/index.bs +++ b/index.bs @@ -18,8 +18,9 @@ text macro: JOINTWEBAPPS yes # Introduction # {#intro} @@ -137,10 +138,10 @@ parties. A picker model is enforced so that the user agent can offer a user expe it clear what information is going to be shared with the website and when. The following constraints are also enforced: -* The API is only available in a [=top-level browsing context=] which must also be a +* The API is only available in a [=navigable/top-level traversable=], which must also be a [=secure context=]. These restrictions help ensure that the provided contact information reaches its intended recipient. -* A user gesture is needed to initiate the API, to disallow programmatic requests to the user's +* [=Transient activation=] is needed to initiate the API, to disallow programmatic requests to the user's contacts. # Realms # {#realms} @@ -161,29 +162,29 @@ The contact picker task source is a [=task source=]. ## Physical address ## {#infrastructure-physical-address} -A physical address consists of: +A physical address consists of:
-* country, a {{DOMString}} representing the country of the address as an +* country, a {{DOMString}} representing the country of the address as an [[ISO3166-1]] alpha-2 code stored in its canonical uppercase form or the empty string. For example, "JP". -* address line, a [=list=] of {{DOMString}}s, containing the most specific part of the +* address line, a [=list=] of {{DOMString}}s, containing the most specific part of the address. It can include, for example, a street name, a house number, apartment number, a rural delivery route, descriptive instructions, or a post office box number. -* region, a {{DOMString}} representing the top level administrative subdivision of the +* region, a {{DOMString}} representing the top level administrative subdivision of the country. For example, this can be a state, a province, an oblast, or a prefecture. -* city, a {{DOMString}} representing the city/town portion of the address. -* dependent locality, a {{DOMString}} representing the dependent locality or sublocality +* city, a {{DOMString}} representing the city/town portion of the address. +* dependent locality, a {{DOMString}} representing the dependent locality or sublocality within a city. For example, neighborhoods, boroughs, districts, or UK dependent localities. -* postal code, a {{DOMString}} representing the postal code or ZIP code, also known as +* postal code, a {{DOMString}} representing the postal code or ZIP code, also known as PIN code in India. -* sorting code, a {{DOMString}} representing the sorting code system, such as the CEDEX +* sorting code, a {{DOMString}} representing the sorting code system, such as the CEDEX system used in France. -* organization, a {{DOMString}} representing the organization, firm, company, or +* organization, a {{DOMString}} representing the organization, firm, company, or institution at the address. -* recipient, a {{DOMString}} representing the name of the recipient or contact person at +* recipient, a {{DOMString}} representing the name of the recipient or contact person at the address. -* phone number, a {{DOMString}} representing the phone number of the recipient or contact +* phone number, a {{DOMString}} representing the phone number of the recipient or contact person at the address, optionally structured to adhere to [[E.164]].
@@ -193,15 +194,15 @@ A physical address consists of: A user contact consists of:
-* names, a [=list=] of {{DOMString}}s, each [=list/item=] representing a unique name +* names, a [=list=] of {{DOMString}}s, each [=list/item=] representing a unique name corresponding to the user. -* emails, a [=list=] of {{DOMString}}s, each [=list/item=] representing a unique - [=valid e-mail address=] of the user. -* numbers, a [=list=] of {{DOMString}}s, each [=list/item=] representing a unique phone +* emails, a [=list=] of {{DOMString}}s, each [=list/item=] representing a unique + [=valid email address=] of the user. +* numbers, a [=list=] of {{DOMString}}s, each [=list/item=] representing a unique phone number of the user. -* addresses, a [=list=] of {{ContactAddress}}es, each [=list/item=] representing a +* addresses, a [=list=] of {{ContactAddress}}es, each [=list/item=] representing a unique [=physical address=] of the user. -* icons, a [=list=] of {{Blob}}s, each [=list/item=] representing a unique image of the +* icons, a [=list=] of {{Blob}}s, each [=list/item=] representing a unique image of the user. NOTE: An icon {{Blob}}'s {{Blob/type}} is an [=image mime type=]. @@ -249,7 +250,7 @@ The contacts attribute's getter must return the [=this=]'s [=Navigator/contacts manager=].
-The [=browsing context=] has a contact picker is showing flag, initially unset. +The [=Window/navigable=] has a contact picker is showing flag, initially unset. ## {{ContactProperty}} ## {#contact-property} @@ -369,27 +370,29 @@ interface ContactsManager {
The select(|properties|, |options|) method, when invoked, runs these steps: - 1. Let |relevantBrowsingContext| be the [=this=]'s [=relevant settings object=]'s - [=environment settings object/responsible browsing context=]. - 1. If |relevantBrowsingContext| is not a [=top-level browsing context=], then return + 1. Let |global| be the [=this=]'s [=relevant global object=]. + 1. Let |navigable| be |global|'s [=Window/navigable=]. + 1. If |navigable| is not a [=navigable/top-level traversable=], then return [=a promise rejected with=] an {{InvalidStateError}} {{DOMException}}. - 1. If the algorithm is not [=triggered by user activation=] then return + 1. If |global| does not have [=transient activation=], then return [=a promise rejected with=] a {{SecurityError}} {{DOMException}}. - 1. If |relevantBrowsingContext|'s [=contact picker is showing flag=] is set then return + 1. Otherwise, [=consume user activation=] of the |global|. + 1. If |navigable|'s [=contact picker is showing flag=] is set then return [=a promise rejected with=] an {{InvalidStateError}} {{DOMException}}. 1. If |properties| is [=list/empty=], then return [=a promise rejected with=] a {{TypeError}}. 1. [=list/For each=] |property| of |properties|: 1. If [=contacts source=]'s [=contacts source/supported properties=] does not [=list/contain=] |property|, then return [=a promise rejected with=] a {{TypeError}}. - 1. Set |relevantBrowsingContext|'s [=contact picker is showing flag=]. + 1. Set |navigable|'s [=contact picker is showing flag=]. 1. Let |promise| be [=a new promise=]. 1. Run the following steps [=in parallel=]: 1. Let |selectedContacts| be be the result of [=launching a contact picker=] with |options|' `multiple` member and |properties|. If this fails, then: - 1. Return [=a promise rejected with=] an {{InvalidStateError}} {{DOMException}}. - 1. Unset |relevantBrowsingContext|'s [=contact picker is showing flag=]. - 1. Abort these steps. - 1. Unset |relevantBrowsingContext|'s [=contact picker is showing flag=]. + 1. [=Queue a contact picker task=] to run these steps: + 1. [=Reject=] |promise| an {{InvalidStateError}} {{DOMException}}. + 1. Unset |navigable|'s [=contact picker is showing flag=]. + 1. Abort these steps. + 1. Unset |navigable|'s [=contact picker is showing flag=]. 1. [=Queue a contact picker task=] to run these steps: 1. Let |contacts| be an empty [=list=]. 1. [=list/For each=] |selectedContact| in |selectedContacts|: @@ -422,13 +425,13 @@ interface ContactsManager { interface that follows these rules: * If presenting a user interface fails or accessing the [=contacts source=]'s - [=contacts source/available contacts=] fails, then return failure. - * The UI MUST prominently display the [=browsing context=]'s [=origin=]. + [=contacts source/available contacts=] fails, then return failure. + * The UI MUST prominently display the [=navigable/top-level traversable=]'s [=origin=]. * The UI MUST make it clear which `properties` of the contacts are requested. NOTE: This information is derived from |properties|. - - * The UI SHOULD provide a way for users to opt out of sharing certain contact information. + + * The UI SHOULD provide a way for users to opt out of sharing certain contact information. NOTE: If the user opts out, the appropriate [=user contact=] fields should be modified before returning the selected contacts. It should be indistinguishable from the returned @@ -444,7 +447,11 @@ interface ContactsManager { remove the UI and return a [=list=] of the selected contacts as [=user contacts=].
-# Acknowledgments +# Security Considerations # {#security-considerations} + +TBW + +# Acknowledgments # {#acknowledgments} There has been multiple earlier attempts to standardize a Contacts API for the web and this API strives to learn from this rich history. Earlier attempts include Mozilla's