define the behavior for consecutive |getAvailability| #335

Closed
schien opened this Issue Aug 30, 2016 · 2 comments

Comments

Projects
None yet
4 participants
Contributor

schien commented Aug 30, 2016

Three unclear behavior found while implementing the |getAvailability| algorithm:

  1. In step 6, the same availability object is returned if an existed (A, presentationUrls) tuple is found. However, we can only return the same object if the requester is in the same DOM window.
  2. in step 9, we should run the device monitoring algorithm in parallel so that we can resolve the promise as early as possible.
  3. For consecutive |getAvailability| on the same PresentationRequest object, we should guarantee the resolve order in the algorithm. For example,
request.getAvailability().then(function() {console.log(1)});
request.getAvailability().then(function() {console.log(2)});

should always print "12" in console for all browsers.

anssiko added the v1 label Sep 7, 2016

Contributor

tidoust commented Sep 26, 2016

See discussion at TPAC

PROPOSED RESOLUTION: For #335, check algorithms around availability objects and make sure they all refer to "script object" or "internal object". For bullet 2, add "in parallel" in step 9. For bullet 3, make sure getAvailability returns the same Promise object.

Contributor

mfoltzgoogle commented Sep 30, 2016

Section 6.4 will need a bit of cleanup to make it consistent with reasonable behavior. Here is what I am thinking.

  • Annotate getAvailability() with SameObject.
  • Define a presentation availability internal object for use in the algorithms. There is exactly one of these for a given list of URLs regardless of the script context.
  • Define a presentation availability promise which is created at most once per presentation availability.
  • Make sure that only one PresentationAvailability is created per script context per presentation availability. (This is an optimization, may not be strictly required.)
  • Update conditions when an entry can be removed from the set of availability objects.

Can start after the PR for Issue #342 lands (which tweaks some text in this same section).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment