<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Add support for Trac instances that host multiple projects."
href="https://bugs.webkit.org/show_bug.cgi?id=167524#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Add support for Trac instances that host multiple projects."
href="https://bugs.webkit.org/show_bug.cgi?id=167524">bug 167524</a>
from <span class="vcard"><a class="email" href="mailto:kocsen_chung@apple.com" title="Kocsen Chung <kocsen_chung@apple.com>"> <span class="fn">Kocsen Chung</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=167524#c2">comment #2</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=299953&action=diff" name="attach_299953" title="Patch">attachment 299953</a> <a href="attachment.cgi?id=299953&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=299953&action=review">https://bugs.webkit.org/attachment.cgi?id=299953&action=review</a>
>
> > Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:120
> > - console.assert(fromDate <= toDate);
> > + if (fromDate > toDate)
> > + throw RangeError("Parameter fromDate should be before or on toDate.");
>
> Why this change? This is logically an assertion, so it's cleaner to express
> it as such.
>
> Just like in C/C++, adding a unit test that violates an assertion is not
> worth it.</span >
It seemed too lenient to allow a range violation of this kind get away with an assertion. Additionally, it would allow for testing this code path. The way I interpret it, an assertion is an error and should be treated as such; especially in production code.
However, I do see your point that it may not be worth it to test this assert violation. Moreover I concur that it would be cleaner to express it as such. I will revert this change.
<span class="quote">>
> > Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:131
> > + "&from=" + encodeURIComponent(toDay.toISOString().slice(0, 10)) +
> > + "&daysback=" + encodeURIComponent((toDay - fromDay) / 1000 / 60 / 60 / 24);
>
> Why add encodeURIComponent here if it's not needed?</span >
Mostly as a security mechanism to not trust date input and as a result avoid unexpected or erroneous requests to the server. In my performance profiling, this had minimal effect and can provide security benefits.
Thanks for the review, Alexey.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>