tags 887709 + patch upstream forwarded 887709 https://bugs.freedesktop.org/show_bug.cgi?id=105838 thanks
I just attached a patch to fix this, and also filed an upstream bug report about it.
>From 5c9dc4f8309905e557b898d1ec5c5adfdc5c322e Mon Sep 17 00:00:00 2001 From: Dwayne Litzenberger <dl...@dlitz.net> Date: Sat, 31 Mar 2018 19:24:58 -0700 Subject: [PATCH] Perl detection: Don't match ECMAScript "use strict" syntax https://bugs.freedesktop.org/show_bug.cgi?id=105838 --- freedesktop.org.xml.in | 5 ++++- tests/js-use-strict.html | 20 ++++++++++++++++++++ tests/js-use-strict.js | 9 +++++++++ tests/list | 6 ++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/js-use-strict.html create mode 100644 tests/js-use-strict.js diff --git a/freedesktop.org.xml.in b/freedesktop.org.xml.in index 72c41d6..9c53352 100644 --- a/freedesktop.org.xml.in +++ b/freedesktop.org.xml.in @@ -3287,7 +3287,10 @@ command to generate the output files. <match type="string" value='eval \"exec /usr/local/bin/perl' offset="0"/> <match type="string" value="/bin/perl" offset="2:16"/> <match type="string" value="/bin/env perl" offset="2:16"/> - <match type="string" value="use strict" offset="0:256"/> + <!-- Note: don't match ECMAScript's strict-mode syntax, which is + "use strict"; or 'use strict'; (including quotes and semicolon) --> + <match type="string" value="use strict;" offset="0:256"/> + <match type="string" value="use strict " offset="0:256"/> <match type="string" value="use warnings" offset="0:256"/> <match type="string" value="use diagnostics" offset="0:256"/> <match type="string" value="use Test::" offset="0:256"/> diff --git a/tests/js-use-strict.html b/tests/js-use-strict.html new file mode 100644 index 0000000..648a508 --- /dev/null +++ b/tests/js-use-strict.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8"> + <script type="text/javascript"> + function f() { + "use strict"; + return true; + } + function g() { + 'use strict'; + return true; + } + </script> + <title>Test</title> + </head> + <body> + <p>Test</p> + </body> +</html> diff --git a/tests/js-use-strict.js b/tests/js-use-strict.js new file mode 100644 index 0000000..1c14f94 --- /dev/null +++ b/tests/js-use-strict.js @@ -0,0 +1,9 @@ + +function f() { + "use strict"; + return true; +} +function g() { + 'use strict'; + return true; +} diff --git a/tests/list b/tests/list index 269c50a..7497588 100644 --- a/tests/list +++ b/tests/list @@ -337,6 +337,12 @@ pyside.py text/x-python test.pl application/x-perl test.pm application/x-perl test.t application/x-perl +# Not Perl +# https://bugs.freedesktop.org/show_bug.cgi?id=63612 +js-use-strict.html application/x-perl xxx +js-use-strict.html text/html +js-use-strict.js application/x-perl xxx +js-use-strict.js application/javascript ox # Copied from http://en.wikipedia.org/wiki/Turtle_%28syntax%29#Example test.ttl text/turtle ox # Twig template -- 2.16.3