This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
In step 5 of the "Pattern matching algorithm": "5. If the number of bytes in mask is not equal to length, return false" .../length/ is equal to the number of bytes in /pattern/, which had better always be the same length as /mask/!
This was a built-in test to prevent against typos in the spec or in the implementation. I included it as a safety net, but if you think it'd be better without it, I can remove it.
It'll cause implementors to add code that has no effect. I recommend commenting it out at best. After all, if the patterns are ever wrong, then you don't want the implementations to skip them, you want them to tell you to fix them! What I sometimes do is add non-normative statements that work a bit like assertions, e.g. "At this point /length/ will also equal the number of bytes in mask".
(In reply to comment #2) > What I sometimes do is add non-normative statements that work a bit like > assertions, e.g. "At this point /length/ will also equal the number of bytes > in mask". I opted to modify step 4 to read: "Let length be the number of bytes in pattern, which is equal to the number of bytes in mask." https://github.com/whatwg/mimesniff/commit/5c0c4c9259c6837837ef575b512fb41d3ff3824a