Bug 207755 - bugzilla code-review.js: RangeError: too many arguments provided for a function call
Summary: bugzilla code-review.js: RangeError: too many arguments provided for a functi...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-14 04:29 PST by Carlos Alberto Lopez Perez
Modified: 2020-02-14 06:50 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Alberto Lopez Perez 2020-02-14 04:29:04 PST
While trying to use the code review tool on https://bugs.webkit.org/attachment.cgi?id=390714&action=review there is a fatal JS error:

RangeError: too many arguments provided for a function call jquery-1.4.2.min.js:87:93
    jQuery 6
        z
        k
        k
        find
        init
        c
    crawlDiff https://bugs.webkit.org/code-review.js?version=48:604
    handleDocumentReady https://bugs.webkit.org/code-review.js?version=48:1100
    jQuery 2
        ready
        L


It seems this line "$('.Line').each(idify).each(hoverify);" at  line 604 of https://bugs.webkit.org/code-review.js?version=48 causes the issue.
Source here: https://trac.webkit.org/browser/webkit/trunk/Websites/bugs.webkit.org/code-review.js?rev=256519#L604
Comment 1 Carlos Alberto Lopez Perez 2020-02-14 04:35:06 PST
That traceback above was from Firefox, Chrome shows it like:

Uncaught RangeError: Maximum call stack size exceeded
    at z (jquery-1.4.2.min.js:87)
    at k (jquery-1.4.2.min.js:73)
    at Function.k [as find] (jquery-1.4.2.min.js:91)
    at init.find (jquery-1.4.2.min.js:95)
    at new init (jquery-1.4.2.min.js:23)
    at c (jquery-1.4.2.min.js:20)
    at crawlDiff (VM2067 code-review.js:604)
    at HTMLDocument.handleDocumentReady (VM2067 code-review.js:1100)
    at Function.ready (jquery-1.4.2.min.js:26)
    at HTMLDocument.L (jquery-1.4.2.min.js:33)
Comment 2 Carlos Alberto Lopez Perez 2020-02-14 05:12:29 PST
it is caused by the jquery selector for Line


> $('.Line')
jquery-1.4.2.min.js:87 Uncaught RangeError: Maximum call stack size exceeded
    at z (jquery-1.4.2.min.js:87)
    at k (jquery-1.4.2.min.js:73)
    at Function.k [as find] (jquery-1.4.2.min.js:91)
    at init.find (jquery-1.4.2.min.js:95)
    at new init (jquery-1.4.2.min.js:23)
    at c (jquery-1.4.2.min.js:20)
    at <anonymous>:1:1


However this works:
> document.getElementsByClassName('Line').length
616466
Comment 3 Carlos Alberto Lopez Perez 2020-02-14 06:50:12 PST
something like this seems to workaround the RangeError issue


- $('.Line').each(idify).each(hoverify);
+  var line_elements = document.getElementsByClassName('Line');
+   for (var i = 0; i < line_elements.length; i++)
+     jQuery(line_elements[i]).each(idify).each(hoverify);


But chrome ends crashing anyway :\

Didn't tried with other browser because its much harder to edit/test JS live.