This should not be canonicalizing the path to lowercase. If you use `uri.QueryInterface(Components.interfaces.nsIURL).filePath` to get the path, it should also cut `?` and `#` off of it, and I think you should be able to skip this canonicalization entirely.