WICG / pending-beacon

A better beaconing API
Other
43 stars 8 forks source link

Migrated: Support for postMessage? #58

Closed clelland closed 1 year ago

clelland commented 1 year ago

From: https://github.com/clelland/page-unload-beacon/issues/4:

@jonathanmayer: This functionality could be valuable for communication between Window objects or WebExtensions contexts. When a frame unloads, there isn't a reliable cross-browser way of sending a message to another frame. Similarly, when a WebExtensions content script unloads, there isn't a reliable cross-browser way of sending a message to the background page/worker. (My research group has had a lot of trouble with that particular problem.) Providing support for postMessage-like messaging, in addition to HTTP requests, would enable those use cases.

@clelland: Curious how this would work -- would it just be for extensions? I'm not sure that it's feasible between windows: when a page unloads, all of its child frames are necessarily unloaded as well -- and currently in Chrome at least, if a page has a reference to another window (whether its opener, or another window which it has opened,) then it won't be eligible for the cache.

@jonathanmayer: I'm imagining a hypothetical use case where a child frame unloads (e.g., it's been removed from the DOM or is navigating to another URL), and there's a need to reliably notify another frame from a different origin. Emphasis on hypothetical—this isn't a use case that has come up in my own research, unlike the WebExtensions use case (which is a known problem with no good solutions yet).

mingyc commented 1 year ago

This looks like non-beacon specific API behavior.

Also providing it may go beyond the privacy scope that was discussed here https://github.com/WICG/pending-beacon/issues/30#issuecomment-1333869614