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 25347 - [MSE] 'nullable' arguments and type conversions and INVALID_ACCESS_ERR (vs. WebIDL)
Summary: [MSE] 'nullable' arguments and type conversions and INVALID_ACCESS_ERR (vs. W...
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: Media Source Extensions (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: CR
Assignee: Aaron Colwell
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-15 11:56 UTC by Fredrik S
Modified: 2014-04-29 21:13 UTC (History)
4 users (show)

See Also:


Attachments

Description Fredrik S 2014-04-15 11:56:17 UTC
Throughout this specification method arguments are marked as non-nullable (consistently in both the parameter table and the IDL-fragments), but the 'null' value is still assumed handled in the algorithm steps.

Example:

interface MediaSource : EventTarget {
    ...
    SourceBuffer   addSourceBuffer (DOMString type);
    void           removeSourceBuffer (SourceBuffer sourceBuffer);
    ...
};

"addSourceBuffer
...
When this method is invoked, the user agent must run the following steps:

1. If type is null or an empty string then throw an INVALID_ACCESS_ERR exception and abort these steps.
...
removeSourceBuffer
...
When this method is invoked, the user agent must run the following steps:

1. If sourceBuffer is null then throw an INVALID_ACCESS_ERR exception and abort these steps."

In both of these cases the algorithmic steps assumes null is a valid value and handles it.
However, assuming WebIDL semantics [1], these methods would never be invoked with null as the value. In the case of addSourceBuffer(null), null would be converted to the string 'null' [2], and for removeSourceBuffer(null) a TypeError exception would be thrown because the null value cannot be converted to an object of interface type "SourceBuffer" [3].

Similar issues exists for other methods in the specification.

[1] The spec does not reference WebIDL AFAICS, but seems to follow notational and other conventions from it.
[2] http://heycam.github.io/webidl/#es-DOMString
[3] http://heycam.github.io/webidl/#es-interface
Comment 1 Aaron Colwell 2014-04-15 15:08:05 UTC
Thanks for filing this. I've been meaning to fix this for a while, but never filed a bug for it. I'll also remove text around handling invalid enum values as part of this work as well since WebIDL also takes care of that.
Comment 2 Aaron Colwell 2014-04-29 21:13:49 UTC
Changes committed.
https://dvcs.w3.org/hg/html-media/rev/ba5233c6654d