• Robert Knight's avatar
    Fix IE 11 regression in documents without a `<base>` element. · dad6ef61
    Robert Knight authored
    `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.
    dad6ef61
Name
Last commit
Last update
.github Loading commit data...
docs Loading commit data...
images Loading commit data...
scripts Loading commit data...
src Loading commit data...
.babelrc Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.travis.yml Loading commit data...
CHANGELOG.md Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
gulpfile.js Loading commit data...
package-lock.json Loading commit data...
package.json Loading commit data...
requirements-dev.in Loading commit data...
yarn.lock Loading commit data...