Skip to content
Permalink
Browse files
Limit recursion when parsing URL in document-blocked page
Related issue:
- uBlockOrigin/uBlock-issues#1649

Co-authored-by: Raymond Hill <rhill@raymondhill.net>
  • Loading branch information
JustOff and gorhill committed Jul 20, 2021
1 parent 8c6cb7d commit 2e824c267bf7e14254770225db515ddd765cd8fb
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/js/document-blocked.js
@@ -203,7 +203,9 @@ uDom.nodeFromId('why').textContent = details.fs;
return s;
};

var renderParams = function(parentNode, rawURL) {
// https://github.com/uBlockOrigin/uBlock-issues/issues/1649
// Limit recursion.
var renderParams = function(parentNode, rawURL, depth = 0) {
var a = document.createElement('a');
a.href = rawURL;
if ( a.search.length === 0 ) {
@@ -228,9 +230,9 @@ uDom.nodeFromId('why').textContent = details.fs;
name = safeDecodeURIComponent(param.slice(0, pos));
value = safeDecodeURIComponent(param.slice(pos + 1));
li = liFromParam(name, value);
if ( reURL.test(value) ) {
if ( depth < 2 && reURL.test(value) ) {
ul = document.createElement('ul');
renderParams(ul, value);
renderParams(ul, value, depth + 1);
li.appendChild(ul);
}
parentNode.appendChild(li);

2 comments on commit 2e824c2

@JustOff
Copy link
Collaborator Author

@JustOff JustOff commented on 2e824c2 Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag #310.

@mistertheloaf
Copy link

@mistertheloaf mistertheloaf commented on 2e824c2 Nov 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work on this. Works fine on Palemoon. Much appreciated.

Please sign in to comment.