]> git.ipfire.org Git - thirdparty/tvheadend.git/commit
lovcombo-all.js: Fix autorec create/edit TypeError with Firefox 134 (#1786)
authorMichael Marley <michael@michaelmarley.com>
Tue, 13 May 2025 05:41:47 +0000 (01:41 -0400)
committerGitHub <noreply@github.com>
Tue, 13 May 2025 05:41:47 +0000 (09:41 +0400)
commitcc07e3471e314469dca3086f134bf3384e06fc83
tree6a63a246c7e188e3afece41129f5c1967462727a
parentab81dce3ebfef30626a8ddf3f9a68b6bdd4f47ba
lovcombo-all.js: Fix autorec create/edit TypeError with Firefox 134 (#1786)

Firefox 134 added the RegExp.escape() method
(https://tc39.es/proposal-regex-escaping/#sec-regexp.escape) with a
standards-compliant implementation that throws TypeError if
any value other than a String is passed in.  This differs from the
existing polyfill that simply returns the argument unmodified if it
isn't a String.  In TVHeadend, the day-of-the-week selector (as
used in the Autorec and Timer configuration) uses Integers as keys
for options, causing an Integer to get passed to RegExp.escape() on
line 300 of lovcombo-all.js.  Because of the non-standards-
compliant permissive behavior of the polyfill, this previously
didn't cause an issue.  However, with Firefox 134 (and an upcoming
version of Safari), the added standards-compliant method causes a
TypeError to be thrown on every attempt to create or edit a timer
or autorec, causing the edit window to not be shown.  To solve the
issue, pass the response from r.get(this.valueField) through the
String() constructor to ensure anything that gets passed in is a
String.  This has been tested with Firefox and Chrome with both
Integer and String keys.
src/webui/static/lovcombo/lovcombo-all.js