Or, being Mozilla engineer for quite some time he had enough domain knowledge to do that.
Or he found a clever way to reuse good parts of Mozilla code with just enough changes to avoid copyright infringement lawsuit.
If he used code from free software he wouldn't be liable for copyright infringement, because that's the point of free software.