mirror of https://github.com/gorhill/uBlock.git
Limit recursion when parsing URL in document-blocked page
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1649
This commit is contained in:
parent
a7184a7874
commit
b75921c2fd
|
@ -144,7 +144,9 @@ uDom.nodeFromId('why').textContent = details.fs;
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderParams = function(parentNode, rawURL) {
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/1649
|
||||||
|
// Limit recursion.
|
||||||
|
const renderParams = function(parentNode, rawURL, depth = 0) {
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = rawURL;
|
a.href = rawURL;
|
||||||
if ( a.search.length === 0 ) { return false; }
|
if ( a.search.length === 0 ) { return false; }
|
||||||
|
@ -165,9 +167,9 @@ uDom.nodeFromId('why').textContent = details.fs;
|
||||||
const name = safeDecodeURIComponent(param.slice(0, pos));
|
const name = safeDecodeURIComponent(param.slice(0, pos));
|
||||||
const value = safeDecodeURIComponent(param.slice(pos + 1));
|
const value = safeDecodeURIComponent(param.slice(pos + 1));
|
||||||
const li = liFromParam(name, value);
|
const li = liFromParam(name, value);
|
||||||
if ( reURL.test(value) ) {
|
if ( depth < 2 && reURL.test(value) ) {
|
||||||
const ul = document.createElement('ul');
|
const ul = document.createElement('ul');
|
||||||
renderParams(ul, value);
|
renderParams(ul, value, depth + 1);
|
||||||
li.appendChild(ul);
|
li.appendChild(ul);
|
||||||
}
|
}
|
||||||
parentNode.appendChild(li);
|
parentNode.appendChild(li);
|
||||||
|
|
Loading…
Reference in New Issue