Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #3314, Avoid infinite selection loop by checking minimum size
Browse files Browse the repository at this point in the history
Source code files on dxr.mozilla.org are rendered as floats inside a
non-clearfixed parent element, which has a calculated height of 0. This
condition isn't handled in the current loop logic, leading to an infinite
while loop that locks up the UI.
  • Loading branch information
jaredhirsch committed Oct 13, 2017
1 parent a20e48e commit 7c0be97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions addon/webextension/selector/uicontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ this.uicontrol = (function() {
rect = lastRect;
break;
}
if (rect.width < MIN_DETECT_WIDTH || rect.height < MIN_DETECT_HEIGHT) {
// Avoid infinite loop for elements with zero or nearly zero height,
// like non-clearfixed float parents with or without borders.
break;
}
if (rect.width > MAX_DETECT_WIDTH || rect.height > MAX_DETECT_HEIGHT) {
// Then the last rectangle is better
rect = lastRect;
Expand Down

0 comments on commit 7c0be97

Please # to comment.