mime: Implement weight-based extension globs.

When matching an extension glob (*.foo) with MimeType.fromName(), the
weights were not being taken into account. This caused extensions
matching multiple MIME types, such as .png (image/png and
image/x-apple-ios-png) to return the last one added to the list.