Item13710: JQueryPlugin (6.13) version of jquery.foswiki.js fails in 1.1.9 installation. BuildContrib corrupts compressed javascript.

Priority: Urgent
Current State: Closed
Released In: 2.0.2
Target Release: patch
Applies To: Extension
Component: BuildContrib, JQueryPlugin
Branches: master
Reported By: LynnwoodBrown
Waiting For:
Last Change By: GeorgeClark
Upgrading JQueryPlugin to version 6.13 in an 1.1.9 installation resulted in general js failures that trace back to jquery.foswiki.js. The error given for that script is "syntaxError invalid range in character class". For some reason, this issue only shows up with minified version of the script. If the uncompressed version is used, the error disappears. This was confirmed by GeorgeClark using a fresh test installation of 1.1.9.

Googling this javascript error, I'm guessing that the issue has to do with the character lists in the definition of foswiki.RE (or else the use of that array subsequently in defining regexes). Perhaps also this issue only shows up in 1.1.9 because 2.0 installations use UTF-8 character encoding.

-- LynnwoodBrown - 16 Sep 2015

To complete a fine bug report it would help to know which browser you use and whether you've got an exact line/char position where that error occurs.

In the meantime I fixed a couple of jslint warnings, one of which was causing a fatal javascript error for Internet Explorers:

-- MichaelDaum - 17 Sep 2015

First, the good news: your new version of jquery.foswiki.js works fine.

Additional information on my error report: I was using using Firefox (~ver 40) on Windows 7. When using the distributed (minified) version of jquery.foswiki.js the console of course indicates the issue was on line 1. However, when I tried it in Chrome, the error still occurred but the error message specifically referred to a bad regex, so I believe it was associated with the regex defined in line 28 (of the uncompressed version) which combines the character strings defined previously.

-- LynnwoodBrown - 17 Sep 2015

It appears that the minified and compressed versions of jquery.foswiki.js and jquery.foswiki.js.gz included the JQueryPlugin download files (JQueryPlugin.tgz Version 55 and Version 63) are garbled. They both start with a string that looks like

var foswiki=foswiki||{preferences:{}};foswiki.RE={upper:"A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖ

The jquery.foswiki.js file in version 62 of appears to be intact and not garbled.

-- JaysonLoewen - 18 Sep 2015

I see the same errors on an installation of Foswiki 1.1.9. Like Lynwood, we resolved the error by installing the files that Michael uploaded to this topic. After re-reading Lynwood's comment above about UTF-8 encoding, what I saw as "garbled" files was a difference in character encoding. For example, compare the start of the definition of upper between the files:

jquery.foswiki.uncompressed.js from JQueryPlugin 6.13:
upper : "\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104
jquery.foswiki.js from JQueryPlugin 6.13:
jquery.foswiki.uncompressed.js from this topic:
upper : "A-Z\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104\u0106\u0108\u010A
jquery.foswiki.js from this topic:

Is it proper for the minified file to contain UTF-8 encoded characters or should they be escaped like in the uncompressed file and in Michael's minified file?

-- JaysonLoewen - 21 Sep 2015

Those \u escape sequences definitely need to stay intact. I don't know why they have been expanded int 6.13, but I suspect that this version of JQueryPlugin has not been build using uglify-js.

-- MichaelDaum - 21 Sep 2015

Michael, I just ran a full build of 2.0.2 using the exact same tools and procedures I did for the 2.0.1 release. Unfortunately I didn't keep the build log for 2.0 or 2.0.1. Here is what I get in a build:

Building with uglify-js 2.4.23
Building with node.js cssmin

uglifyjs /var/www/foswiki/distro/JQueryPlugin/pub/System/JQueryPlugin/plugins/foswiki/jquery.foswiki.uncompressed.js -o /var/www/foswiki/distro/JQueryPlugin/pub/System/JQueryPlugin/plugins/foswiki/jquery.foswiki.js --ascii
Generated /var/www/foswiki/distro/JQueryPlugin/pub/System/JQueryPlugin/plugins/foswiki/jquery.foswiki.js from /var/www/foswiki/distro/JQueryPlugin/pub/System/JQueryPlugin/plugins/foswiki/jquery.foswiki.uncompressed.js

So I confirm that I'm using uglify.js, but the bad news is I still end up with utf-8 inside of jquery.foswiki.js. Something is going wrong here and I have no idea what. I'm reopening this because I can't release until we figure out why it's having issues on my system. Could I be using a bad version of uglify? I've added additional debug print and I'm pretty sure it's using uglify.

-- GeorgeClark - 21 Sep 2015

Updated to uglify 2.4.24, the latest. Still is generating the utf-8 version.

-- GeorgeClark - 21 Sep 2015

Updated to uglify 2.4.24, the latest. Still is generating the utf-8 version. Found the issue. uglify.js has changed their options.

diff --git a/BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/ b/BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/
index 42ef601..8b5bc56 100644
--- a/BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/
+++ b/BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/
@@ -353,7 +353,7 @@ sub _uglifyjs {
         $cmd .= " -o $to";
-    $cmd .= ' --ascii';
+    $cmd .= ' -b beautify=false,ascii-only=true ';
     warn "$cmd\n";
     my $out = `$cmd`;

-- GeorgeClark - 21 Sep 2015

True. Attached files have alerady been built using these options.

-- MichaelDaum - 22 Sep 2015

ItemTemplate edit

Summary JQueryPlugin (6.13) version of jquery.foswiki.js fails in 1.1.9 installation. BuildContrib corrupts compressed javascript.
ReportedBy LynnwoodBrown
Codebase 2.0.1, 1.1.9
SVN Range
AppliesTo Extension
Component BuildContrib, JQueryPlugin
Priority Urgent
CurrentState Closed
Checkins distro:775498952344 distro:18ecebad2da7
TargetRelease patch
ReleasedIn 2.0.2
CheckinsOnBranches master
masterCheckins distro:775498952344 distro:18ecebad2da7
Topic attachments
I Attachment Action Size Date Who Comment
jquery.foswiki.jsjs jquery.foswiki.js manage 10 K 17 Sep 2015 - 07:01 MichaelDaum try this
jquery.foswiki.js.gzgz jquery.foswiki.js.gz manage 3 K 17 Sep 2015 - 07:02 MichaelDaum try this
jquery.foswiki.uncompressed.jsjs jquery.foswiki.uncompressed.js manage 14 K 17 Sep 2015 - 07:01 MichaelDaum try this
Topic revision: r10 - 10 Oct 2015, GeorgeClark - This page was cached on 17 Sep 2021 - 15:40.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy