Ensure MediaContentType is always valid

RESOLVED FIXED in Firefox 53

Status

()

defect
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: gerald, Assigned: gerald)

Tracking

(Blocks 1 bug)

49 Branch
mozilla53
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox53 fixed)

Details

Attachments

(1 attachment)

Currently, MediaContentType can be constructed from any string, so sometimes the object could be in an invalid state that could be inferred by seeing that the GetMIMEType() string was empty.
It's a bit unintuitive, cumbersome, and most importantly the validity of MediaContentType objects would probably need to be tested anywhere they would be used!

To help with that and lots of upcoming changes from bug 1263836, we can design MediaContentType to *always* be valid.
Construction will be done through a MakeMediaContentType() function that returns a Maybe<MediaContentType>.

To see the proposed patch in context:
https://hg.mozilla.org/try/pushloghtml?changeset=2743aefd9eede9f207238ba71a48ccb5382af848
Blocks: 1329568
Comment on attachment 8824865 [details]
Bug 1329561 - MediaContentType is always valid -

https://reviewboard.mozilla.org/r/103172/#review103866
Attachment #8824865 - Flags: review?(jyavenard) → review+
Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c01ee23545a0
MediaContentType is always valid - r=jya
https://hg.mozilla.org/mozilla-central/rev/c01ee23545a0
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.