Skip to content

[Privacy] Time limit on retaining beacons for bfcache'd pages #3

Open

Description

@caraitto

My understanding is that with the Declarative Beacon API, if a page is kept in the bfcache for an extended period of time, it's still eligible to send the beacon once the page is evicted from the bfcache, which might be a long time after the user has navigated away from the page.

Would it be possible to instead send the beacon for bfcache'd pages after they've been in the bfcache for a minute or so? I think the page would want to check when waking from the bfcache to see if the beacon was already sent or not (by checking the state field of the beacon from the explainer) -- if it's already sent, the page may want to create a new beacon (at its choice).

Activity

  1. caraitto commented on Jun 27, 2022

    @caraitto
    ContributorAuthor

    Hi, friendly ping?

  2. clelland commented on Jun 27, 2022

    @clelland
    Collaborator

    I think that this is what the pageHideTimeout setting is for -- pageHide is emitted when the page enters the bfcache, and that should start a timer for any beacons with pageHideTimeout set. If they aren't restored from cache by the time that timer expires, they will be sent at that time (rather than waiting until eviction)

  3. caraitto commented on Jun 27, 2022

    @caraitto
    ContributorAuthor

    The explainer says:

    For frozen pages that are never unfrozen, this should happen either when the frozen page is removed from memory (BFCache eviction), or after a developer-specified timeout (using the 'pageHideTimeout' described below).

    I think the idea is the beacon is sent for whichever event happens first of the two? But, if the site doesn't set pageHideTimeout, what is the behavior? Also, can pageHideTimeout be arbitrarily large?

    The pageHideTimeout behavior sounds like the behavior we want, but I think the explainer and spec should be updated to give default and maximum pageHideTimeout values to prevent sending beacons at bfcache eviction at some point long after the user has left the page.

  4. mingyc commented on Jun 28, 2022

    @mingyc
    Collaborator

    I think the idea is the beacon is sent for whichever event happens first of the two?

    Yes

    But, if the site doesn't set pageHideTimeout, what is the behavior?

    The default behavior is specified in the pageHideTimeout section, i.e. If this is null when the page is hidden, the beacon will be sent on document discard (including eviction from the BFCache)

    Also, can pageHideTimeout be arbitrarily large?

    It is possible as there is currently no maximum.

    maximum pageHideTimeout values to prevent sending beacons at bfcache eviction at some point long after the user has left the page.

    I think users should specify pageHideTimeout if they don't want to wait too long.

  5. caraitto commented on Jun 28, 2022

    @caraitto
    ContributorAuthor

    I think users should specify pageHideTimeout if they don't want to wait too long.

    I agree, but for privacy, I think there should be a limit (imposed by the browser) on how long this duration can be that the web content cannot override. I think the spec and explainer should require such limits.

  6. clelland commented on Jun 28, 2022

    @clelland
    Collaborator

    That sounds like a second issue, @caraitto (but correct me if I'm wrong)

    The first issue I see is one of developer ergonomics. In order to have beacons sent in a timely manner, there should be a way to ensure that they are sent a short time after entering the bfcache. We have that, and it's pageHideTimeout. My understanding is that if that is set, and a page enters the cache, then one of three things can happen: (Whichever happens first wins)

    • If the page is restored from the cache, the beacon is cancelled.
    • If the page is evicted from the cache (which browsers will do after a short timeout; the cache is fairly short-lived in current imlementations), then the beacon is sent.
    • If the page is still in the cache after pageHideTimeout ms, then the beacon will be sent (and will be in a 'sent' state if the page is subsequently restored)

    The second issue you raise is a privacy concern, which I think is motivated by a "what if browser's didn't do that" question around the second point above. Currently there is a time limit set by browsers, which web content can't override (Chrome, for instance, has a 3 minute timer). But what if future browsers keep pages in the bfcache for an arbitrarily long time, and also developers don't choose to set a timeout on their own. Should we protect developers from that situation?

    I feel that there could be an implementation note, certainly, that there should be some reasonable limit, if the user agent is capable of retaining cache entries indefinitely, and it warrants a section in the privacy section of the spec. I don't know if there's sufficient alignment between cache implementations to specify yet exactly what a hard limit needs to be.

  7. added a commit that references this issue on Jun 29, 2022
    a1184ae
  8. caraitto commented on Jun 29, 2022

    @caraitto
    ContributorAuthor

    I feel that there could be an implementation note, certainly, that there should be some reasonable limit, if the user agent is capable of retaining cache entries indefinitely, and it warrants a section in the privacy section of the spec.

    Yep, I think that's basically what I'd like to see -- I'll go ahead and send a PR (#5). I think 3 minutes might be OK, but I'd be less comfortable if it was over 10 minutes.

  9. added
    api
    on Jul 6, 2022
  10. added a commit that references this issue on Jul 12, 2022
    7471182
  11. reopened this on Aug 1, 2022
  12. mingyc commented on Aug 1, 2022

    @mingyc
    Collaborator

    This was re-discussed in #16 (comment):

    • @philipwalton suggests that there are use cases longer than 10 minutes timeout
    • @fergald mentions Mozilla's bfcache timeout is 45 minutes.

    Maybe we should re-consider how long timeout limit should be.

  13. added a commit that references this issue on Oct 11, 2022
  14. 79 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions