This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The media type sniffing algorithm always returns the specified type. Regardless of what sub-algorithms it calls, the last thing it does is always "the actual media type is the specified media type".
I haven't quite figured out the logistics of the cascade yet, but "abort these steps" is intended to refer to the "media type sniffing algorithm", not the individual sub-algorithms, as they are all actually part of the same algorithm. (They are "private" methods, if you will.) In the case of algorithms that can be called directly ("public"), I use "return" to indicate their outcome. If there's a better way of indicating this, let me know.
"Abort the algorithm that invoked this one", maybe. Or return a value and let the caller abort if a useful value was returned. Or have the parent call this one and immediately abort. Or have the parent call this one, and have all subsequent steps in the parent algorithm start with "Otherwise" so they don't get invoked if this one did. Or some such. But why make them private? The HTML spec invokes some of them directly, which seems like the simple way to keep this understandable.
(In reply to comment #2) > "Abort the algorithm that invoked this one", maybe. Or return a value and > let the caller abort if a useful value was returned. Or have the parent call > this one and immediately abort. Or have the parent call this one, and have > all subsequent steps in the parent algorithm start with "Otherwise" so they > don't get invoked if this one did. Or some such. > > But why make them private? The HTML spec invokes some of them directly, > which seems like the simple way to keep this understandable. Well, IMO, it's much easier to maintain a single table for each section and then have the sub-algorithms that need multiple tables call the sub-algorithms. This reduces data duplication and lowers the risk of making a mistake. But all the sub-algorithms are intended to be part of the main sniffing algorithm. The fact that you cannot call them directly is a feature, not a bug. That's why I introduced the concept of flags in the main algorithm—so that you can get the same functionality when you are forced to call the main algorithm.
Having common tables is fine, but I think it's wrong to view this as one algorithm. It's obviously not one algorithm if the only thing that algorithm does is decide which actual algorithm to use, and the only common part is some minor text about how to buffer incoming data...
I've separated the match tables into a separate section so that they can be called from both the main sniffing algorithm and the individual sniffing algorithms. As a result, I've been able to rearrange the main sniffing algorithm so that it aborts before the last step if it has determined a sniffed media type. So I think this is fixed.