Promises

In the last call I reported on some experience of implementing the API, all
of which I will write up soon, but for now I want to expand a point I made.

 

The usual pattern will probably be for script on a first party page , after
storing an exception,  to check the  tracking status
(confirmSiteSpecificTrackingException or confirmWebWideTrackingException, or
look at the doNotTrack property).

 

Even if the UA does not prompt the user but stores the exception
immediately, the status returned from the synchronous property or function
will not have been updated (unless the UA implementation includes an
implicit “yield”). Some construction like:

 

storeSiteSpecificTrackingException(propertyBag);

setTimeout(function(){

               var result  =
confirmSiteSpecificTrackingException(propertyBag);

               // take action on result

}, arbitraryDelay);

 

is necessary. If a UA implementation of the API only registers the grant
after confirming it with the user, then this code would have to be executed
continuously. The arbitraryDelay adds annoying latency when in many cases it
is unnecessary. Returning a Promise is a much better way to handle this but
that is not how the spec is currently. 

 

I have been looking at the draft Permissions API
http://www.w3.org/TR/permissions/ and I wonder if we could leverage this to
create an additional alternate for the synchronous confirm call we have now.

 

The Permissions interface has a function, query, that returns a Promise.  At
the moment the only PermissionNames defined are “geolocation”,
“notifications”, “push-notifications” and “midi-sysex”.

 

We could define a new Permission, with PermissionName “tracking”, with the
appropriate TPS propertyBag properties e.g. arrayOfDomainStrings defined in
the new Permission’s dictionary. We would then have an alternative way for
script to get the status using a method more in keeping with the
asynchronous style. We do not need to change the TPS, just create an
alternative path via a supplement to the Permissions API.

 

Can we talk about this next call?

 

Mike

 

 


Mike O'Neill

Technical Director

Baycloud Systems

Oxford Centre for Innovation 

New Road

Oxford

OX1 1BY

Tel. 01865 735619

Fax: 01865 261401



Email:  <mailto:michael.oneill@baycloud.com> michael.oneill@baycloud.com
 <http://www.linkedin.com/pub/11/894/925> Professional Profile

	

 <http://www.linkedin.com/e/wwk/41003309/> See who we know in common

 <http://www.linkedin.com/e/sig/41003309/> Want a signature like this?

 

 

Received on Monday, 28 September 2015 10:02:10 UTC