Skip to content

Commit

Permalink
Merge pull request #6928 from yurydelendik/url-check
Browse files Browse the repository at this point in the history
Fixes URL polyfill check for MS Edge.
  • Loading branch information
brendandahl committed Jan 27, 2016
2 parents 0558ffc + bc30c42 commit 1f2910b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1697,13 +1697,15 @@ function loadJpegStream(id, imageUrl, objs) {

// feature detect for URL constructor
var hasWorkingUrl = false;
if (typeof URL === 'function' && ('origin' in URL.prototype)) {
try {
try {
if (typeof URL === 'function' &&
typeof URL.prototype === 'object' &&
('origin' in URL.prototype)) {
var u = new URL('b', 'http://a');
u.pathname = 'c%20d';
hasWorkingUrl = u.href === 'http://a/c%20d';
} catch(e) {}
}
}
} catch(e) { }

if (hasWorkingUrl)
return;
Expand Down

0 comments on commit 1f2910b

Please sign in to comment.