QuotaManager needs a way to wipe origins based on protocol scheme in support of libdweb

NEW
Unassigned

Status

()

enhancement
P3
normal
10 months ago
10 months ago

People

(Reporter: asuth, Unassigned)

Tracking

(Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

libdweb (https://github.com/mozilla/libdweb) is an experimental WebExtensions API thing provides a means of registering custom protocols[1] whose loaded pages actually have the origin of the custom protocol.  (Compare with navigator.registerProtocolHandler[2] and the similar WebExtensions Firefox-only "protocol_handlers"[3] mechanism which use the origin of the triggering page/extension instead.)

We need a way to clean up after these custom protocols when they're uninstalled.  I don't believe OriginScope[4] supports this currently.  "Prefix" sounds like it should, but the naming there is misleading; prefix is just an origin match without checking the OriginAttributes suffix.

For safety reasons, it would likely make sense to add a new permutation to OriginScope that is explicitly about the protocol scheme rather than doing bare string prefix matching.  It would also make sense to expose this on nsIQuotaManagerService.  (Compare with the "pattern" clearing which is used to clear based on OriginAttributes that happens via the "clear-origin-attributes-data" observer subject.

1: https://github.com/mozilla/libdweb/blob/master/Readme.md#protocol-api
2: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
3: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/protocol_handlers
4: https://searchfox.org/mozilla-central/source/dom/quota/OriginScope.h
I filed https://github.com/mozilla/libdweb/issues/83 on libdweb for the need to clear storage on protocol uninstall, and it references back to this bug.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.