Categories: Mozilla Development

MathML mfenced whitespaces broke my patch?

Bug 537916 would easily be one of the easiest bugs to fix in the entire code base (typos aside) – the problem in question being that white space is not being stripped out of the <mfenced>’s “separators” attribute. It was exciting (for an XPCOM-string newbie I guess) combing through the string functions to find the right tool for this very crucial bug blocking the next version of Firefox ;).

It wasn’t too long before I stumbled upon FindChar(). Unfortunately, in my rather foolish quest to get some code written as soon as possible, I stopped looking through the function list and put together a possible solution (that I even considered a marvel of beauty for just but a second).

The grin of janitorial success had hardly faded from my face when Frédéric Wang pointed out the rather obvious StripWhitespace() method! I guess it’s always a good idea to look through the whole function list! Alright, so it still remains one of the easiest fixes even in light of the fact that someone else had to point out the most obvious solution.

Next, Roc wants a test for this! How on earth do you create a text file with the right spaces, i.e. one containing a portion where each blank is a whitespace sequence “U+0020 U+0009 U+000a U+000d”? I came up with sudo apt-get install hexedit; hexedit layout/reftests/mathml/mfenced-1.xhtml but my guess is that there is a better way to do this (like vi)?

Minor as this bug is, I would rank it is as one of the more interesting ones I have worked based on how much it freaked me out – I’ll be the first to confess that the resultant patch blew my mind. It “looked” wrong and I could have sworn it was broken/invalid because I hadn’t encountered newlines as data in unified context diff patches before. I guess you do learn something new each day – even about newlines after having used computers for over 15 years of your life. Thankfully, I now also know how Hg determines which the binary files are.

Article info



Leave a Reply

Your email address will not be published. Required fields are marked *