1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #7197 from prakashpalanisamy/remove-combineurl-test

Remove `combineUrl` and replace it with `new URL`. Issue #7183, for reference.
This commit is contained in:
Tim van der Meij 2016-04-15 22:44:07 +02:00
commit 4a601ffc28
5 changed files with 7 additions and 78 deletions

View file

@ -45,7 +45,6 @@ var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
var UnknownErrorException = sharedUtil.UnknownErrorException;
var Util = sharedUtil.Util;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var combineUrl = sharedUtil.combineUrl;
var error = sharedUtil.error;
var deprecated = sharedUtil.deprecated;
var getVerbosityLevel = sharedUtil.getVerbosityLevel;
@ -186,7 +185,7 @@ function getDocument(src, pdfDataRangeTransport,
for (var key in source) {
if (key === 'url' && typeof window !== 'undefined') {
// The full path is required in the 'url' field.
params[key] = combineUrl(window.location.href, source[key]);
params[key] = new URL(source[key], window.location).href;
continue;
} else if (key === 'range') {
rangeTransport = source[key];
@ -1121,7 +1120,7 @@ var PDFWorker = (function PDFWorkerClosure() {
// // to the same origin.
// if (!isSameOrigin(window.location.href, workerSrc)) {
// workerSrc = createCDNWrapper(
// combineUrl(window.location.href, workerSrc));
// new URL(workerSrc, window.location).href);
// }
//#endif
// Some versions of FF can't create a worker on localhost, see:

View file

@ -295,15 +295,6 @@ var UNSUPPORTED_FEATURES = {
font: 'font'
};
// Combines two URLs. The baseUrl shall be absolute URL. If the url is an
// absolute URL, it will be returned as is.
function combineUrl(baseUrl, url) {
if (!url) {
return baseUrl;
}
return new URL(url, baseUrl).href;
}
// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
function isSameOrigin(baseUrl, otherUrl) {
try {
@ -2338,7 +2329,6 @@ exports.arrayByteLength = arrayByteLength;
exports.arraysToBytes = arraysToBytes;
exports.assert = assert;
exports.bytesToString = bytesToString;
exports.combineUrl = combineUrl;
exports.createBlob = createBlob;
exports.createPromiseCapability = createPromiseCapability;
exports.createObjectURL = createObjectURL;