Skip to content

Commit

Permalink
fix: remove es6 class from url-shim
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Jan 5, 2017
1 parent 6fb07ea commit 156c70e
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions lighthouse-core/lib/url-shim.js
Expand Up @@ -31,32 +31,30 @@ URL.INVALID_URL_DEBUG_STRING =
'Lighthouse was unable to determine the URL of some script executions. ' +
'It\'s possible a Chrome extension or other eval\'d code is the source.';

class LighthouseURL extends URL {
/**
* @param {string} url
* @return {boolean}
*/
static isValid(url) {
try {
new URL(url);
return true;
} catch (e) {
return false;
}
/**
* @param {string} url
* @return {boolean}
*/
URL.isValid = function isValid(url) {
try {
new URL(url);
return true;
} catch (e) {
return false;
}
};

/**
* @param {string} urlA
* @param {string} urlB
* @return {boolean}
*/
static hostsMatch(urlA, urlB) {
try {
return new URL(urlA).host === new URL(urlB).host;
} catch (e) {
return false;
}
/**
* @param {string} urlA
* @param {string} urlB
* @return {boolean}
*/
URL.hostsMatch = function hostsMatch(urlA, urlB) {
try {
return new URL(urlA).host === new URL(urlB).host;
} catch (e) {
return false;
}
}
};

module.exports = LighthouseURL;
module.exports = URL;

0 comments on commit 156c70e

Please sign in to comment.