Bug 1962681 - r=Standard8 a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D250488
This commit is contained in:
committed by
dmeehan@mozilla.com
parent
b6ec1ebbe2
commit
f3267d9d24
@@ -527,25 +527,12 @@ class SearchAdImpression {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid extracting or fixing up Javascript URLs.
|
let url = URL.parse(href, origin);
|
||||||
if (href.startsWith("javascript")) {
|
if (!url || (url.protocol !== "https:" && url.protocol !== "http:")) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hrefs can be relative.
|
return url.href;
|
||||||
if (!href.startsWith("https://") && !href.startsWith("http://")) {
|
|
||||||
href = origin + href;
|
|
||||||
}
|
|
||||||
// Per Bug 376844, apostrophes in query params are escaped, and thus, are
|
|
||||||
// percent-encoded by the time they are observed in the network. Even
|
|
||||||
// though it's more comprehensive, we avoid using newURI because its more
|
|
||||||
// expensive and conversions should be the exception.
|
|
||||||
// e.g. /path'?q=Mozilla's -> /path'?q=Mozilla%27s
|
|
||||||
let arr = href.split("?");
|
|
||||||
if (arr.length == 2 && arr[1].includes("'")) {
|
|
||||||
href = arr[0] + "?" + arr[1].replaceAll("'", "%27");
|
|
||||||
}
|
|
||||||
return href;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user