Fix IE 11 regression in documents without a `<base>` element.
`Document#uri` and `Document#getMetadata` returned the base URI rather than the document's real URL as the document location if the protocol of the base URI and true document location were different. The reason for this was to support the use case where the document is an iframe loaded from a `blob:` URL, which Readium does for example. This broke in IE 11 if the document did not have a `<base>` element because the fallback `Node.baseURI` and `Document.documentURI` properties used by `document-base-uri` do not exist in that browser. This commit re-works the behavior of `_getDocumentHref` to be more conservative and return the base URI only if a) the document location does not have a whitelisted scheme and b) the base URI is defined and does have a whitelisted scheme. Additionally, the tests have been re-worked to test the public `uri` method instead of the private `_getDocumentHref` method and use test seams instead of proxyquire.
Showing
Please register or sign in to comment