privacycg / storage-access

The Storage Access API
https://privacycg.github.io/storage-access/
199 stars 26 forks source link

Use InvalidStateError instead of SecurityError for fully active checks #112

Closed johannhof closed 1 year ago

johannhof commented 1 year ago

@mreichhoff I noticed that InvalidStateError seems to be the most common error state for non-fully active checks, is there any particular reason we picked a SecurityError in Chromium for this?


Preview | Diff

mreichhoff commented 1 year ago

I used SecurityError because I happened to be linked to the history go API, which also uses SecurityError, and I viewed both APIs as sensitive. https://html.spec.whatwg.org/#dom-history-go

the relevant line:

If document is not fully active, then throw a "SecurityError" DOMException.

I certainly don't have a strong opinion, however. If InvalidStateError is more common, that seems like a better approach.

johannhof commented 1 year ago

Yeah, I filed https://github.com/w3ctag/design-principles/issues/395 for having some guidance on which errors are to be used in this case. I wasn't aware of the usage in the History API, so now I understand why we originally chose SecurityError. However, it looks like the majority of APIs (including the proposed history API successor) use InvalidStateError now, so I'll go ahead and merge this.

Thanks!