This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27283 - InvalidAccessError usage is questionable; use TypeError instead?
Summary: InvalidAccessError usage is questionable; use TypeError instead?
Status: RESOLVED MOVED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: Encrypted Media Extensions (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Adrian Bateman [MSFT]
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard: external_dependency
Keywords:
Depends on: 27284
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-08 19:25 UTC by Domenic Denicola
Modified: 2015-10-19 23:48 UTC (History)
4 users (show)

See Also:


Attachments

Description Domenic Denicola 2014-11-08 19:25:19 UTC
"If keySystem is an empty string, return a promise rejected with a new DOMException whose name is InvalidAccessError.

If supportedConfigurations was provided and is empty, return a promise rejected with a new DOMException whose name is InvalidAccessError."

In general TypeErrors are preferred for invalid arguments. I think in general the existence of InvalidAccessError is a mistake from the days before it was realized that IDL was not a language-agnostic layer. (I will file a WebIDL bug to discuss.)

No big deal though.
Comment 1 Jerry Smith 2014-11-19 02:36:49 UTC
I've not found any definitive guidance on using TypeError for invalid argument values; but have found examples in both Media Source Extensions and Web Crypto where invalid values return TypeError.  I recommend we adopt this practice for consistency with those specifications.
Comment 2 Domenic Denicola 2014-12-02 16:35:38 UTC
For the record, WebIDL bug filed at https://www.w3.org/Bugs/Public/show_bug.cgi?id=27284; no response as of yet.
Comment 3 Jerry Smith 2014-12-02 19:12:49 UTC
I've added a comment to https://www.w3.org/Bugs/Public/show_bug.cgi?id=27284 to indicate EME has a related bug.
Comment 4 David Dorwin 2014-12-08 17:53:03 UTC
We also use InvalidAccessError for invalid formats and invalid operations for the session type.

Would this change only apply to basic initial parameter checking (i.e. empty parameters)?
Comment 5 Domenic Denicola 2014-12-08 18:04:03 UTC
> We also use InvalidAccessError for invalid formats and invalid operations for the session type.

I did a review of all the places InvalidAccessError appears.

All of them seem related to invalid or unsanitizable objects appearing, and TypeError would fit, except

> If this object's session type is not "persistent", return a promise rejected with a new DOMException whose name is InvalidAccessError.

and

> Otherwise
>    Reject promise with a new DOMException whose name is InvalidAccessError.

(below 'If sessionType is "persistent"')

which seems like they should be RangeError.
Comment 6 David Dorwin 2015-10-19 23:48:09 UTC
Migrated to https://github.com/w3c/encrypted-media/issues/103.