[horde] Google Closure Compiler [SOLVED]

Arjen de Korte arjen+horde at de-korte.org
Tue Feb 23 19:44:48 UTC 2016


Citeren Jan Schneider <jan at horde.org>:

> Zitat von Arjen de Korte <arjen+horde at de-korte.org>:
>
>> Citeren Jan Schneider <jan at horde.org>:
>>
>>> Zitat von Arjen de Korte <arjen+horde at de-korte.org>:
>>>
>>>> Citeren Jan Schneider <jan at horde.org>:
>>>>
>>>>> Zitat von Arjen de Korte <arjen+horde at de-korte.org>:
>>>>>
>>>>>> Citeren Jan Schneider <jan at horde.org>:
>>>>>>
>>>>>>> Zitat von Arjen de Korte <arjen+horde at de-korte.org>:
>>>>>>>
>>>>>>>> Citeren Jan Schneider <jan at horde.org>:
>>>>>>>>
>>>>>>>>> Zitat von Arjen de Korte <arjen+horde at de-korte.org>:
>>>>>>>>>
>>>>>>>>>> I'm trying to use the Google Closure Compiler for  
>>>>>>>>>> Javascript Caching. This doesn't seem to work, as in the  
>>>>>>>>>> /static directories *.js files show up with the following  
>>>>>>>>>> content:
>>>>>>>>>>
>>>>>>>>>> //# sourceMappingURL=/horde/static/bf3d64e5bc07fd51.js.map
>>>>>>>>>> // @source: https://example.org/horde/js/hordecore.js
>>>>>>>>>> // @source: https://example.org/horde/js/keynavlist.js
>>>>>>>>>> // @source: https://example.org/horde/js/scriptaculous/effects.js
>>>>>>>>>> // @source: https://example.org/horde/js/autocomplete.js
>>>>>>>>>> // @source: https://example.org/horde/js/liquidmetal.js
>>>>>>>>>> // @source: https://example.org/horde/js/prettyautocomplete.js
>>>>>>>>>> // @source: https://example.org/horde/js/imple.js
>>>>>>>>>> // @source: https://example.org/horde/js/map/map.js
>>>>>>>>>> // @source: https://example.org/horde/js/popup.js
>>>>>>>>>> // @source: https://example.org/horde/js/date/nl-NL.js
>>>>>>>>>> // @source: https://example.org/horde/js/date/date.js
>>>>>>>>>> // @source: https://example.org/horde/js/topbar.js
>>>>>>>>>> // @source: https://example.org/horde/kronolith/js/dragdrop2.js
>>>>>>>>>> // @source: https://example.org/horde/js/redbox.js
>>>>>>>>>> // @source: https://example.org/horde/js/tooltips.js
>>>>>>>>>> // @source: https://example.org/horde/js/colorpicker.js
>>>>>>>>>> // @source: https://example.org/horde/kronolith/js/kronolith.js
>>>>>>>>>> // @source: https://example.org/horde/js/calendar.js
>>>>>>>>>> // @source: https://example.org/horde/js/sidebar.js
>>>>>>>>>> // @source: https://example.org/horde/js/growler.js
>>>>>>>>>> // @source: https://example.org/horde/js/scriptaculous/sound.js
>>>>>>>>>> // @source: https://example.org/horde/js/form_ghost.js
>>>>>>>>>>
>>>>>>>>>> This doesn't look right. Relevant versions of Java & PHP
>>>>>>>>>>
>>>>>>>>>> # java -version
>>>>>>>>>> openjdk version "1.8.0_72"
>>>>>>>>>> OpenJDK Runtime Environment (build 1.8.0_72-b15)
>>>>>>>>>> OpenJDK 64-Bit Server VM (build 25.72-b15, mixed mode)
>>>>>>>>>>
>>>>>>>>>> # php --version
>>>>>>>>>> PHP 5.5.14 (cli)
>>>>>>>>>> Copyright (c) 1997-2014 The PHP Group
>>>>>>>>>> Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
>>>>>>>>>> with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by  
>>>>>>>>>> Zend Technologies
>>>>>>>>>>
>>>>>>>>>> What am I missing here?
>>>>>>>>>
>>>>>>>>> http://github.com/horde/horde/commit/654cd04d433dada267386fd06c1a254621a74ee2
>>>>>>>>
>>>>>>>> The contents of the *.js files look a bit better. However,  
>>>>>>>> the compressed JavaScript doesn't work anymore (at least not  
>>>>>>>> for the login screen). Not even with --compilation_level  
>>>>>>>> WHITESPACE_ONLY. It doesn't look like a caching issue, I  
>>>>>>>> tried with Chrome, Firefox and Konquerer and neither of them  
>>>>>>>> were able to use it.
>>>>>>>
>>>>>>> Works fine here. Do you get any errors in the browser console,  
>>>>>>> that you don't get with compression disabled?
>>>>>>>
>>>>>> I get the following in the Firebug console (login.php):
>>>>>>
>>>>>> TypeError: Element.addMethods is not a function
>>>>>>
>>>>>>
>>>>>> Element.addMethods({setText:function(a,b){var  
>>>>>> d=0;$A(a.childNodes).each(function...
>>>>>>
>>>>>>
>>>>>> f872153...3d71.js (line 5, col 1)
>>>>>> TypeError: HordeLogin is undefined
>>>>>>
>>>>>>
>>>>>> HordeLogin.submit=HordeLogin.submit.wrap(function(a){var  
>>>>>> b=$("imp_server_key");b...
>>>>>>
>>>>>>
>>>>>> c7c2ba3...d8f1.js (line 5, col 1)
>>>>>> TypeError: HordeLogin is undefined
>>>>>>
>>>>>>
>>>>>> HordeLogin.user_error="Geef een geldige gebruikersnaam,  
>>>>>> a.u.b.";HordeLogin.pass_...
>>>>>>
>>>>>>
>>>>>> login.p...eason=4 (line 111, col 1)
>>>>>
>>>>> There must be at least two cached js files. These error should  
>>>>> come from the 2nd file, the 1st actually contains  
>>>>> Element.addMethods and HordeLogin from prototype.js and  
>>>>> horde.js. If the 2nd file cannot find these, then either the 1st  
>>>>> file is missing, empty, or doesn't parse. The latter should get  
>>>>> you an earlier error message in the logs.
>>>>
>>>> There are indeed two cached .js files (and two .js.map files). If  
>>>> you want to take a look, I've made them available for download  
>>>> from https://de-korte.org/~arjen/closure.tar.gz
>>>
>>> For some reason the files are added in the incorrect order to the  
>>> cache file. The larger file contains horde.js and prototype.js in  
>>> that order. It has to be reverse.
>>
>> Is there any way I can influence the order in which these files are  
>> added? Could it be due to a difference in the java or closure  
>> compiler versions? The weird thing is, if I enable the build-in  
>> compression and keep the two cached files, they won't be  
>> overwritten and it seems to work (more or less). This will of  
>> course be fragile as any changes will cause new (and probably  
>> incorrect too) cache files to be generated.
>
> We already add them in the correct order, that's why I'm confused  
> that you have them reverse. The files are indeed only created if  
> they don't exist only. So if you test a new version of the  
> compressor or a different compressing backend, you need to remove  
> the cached js files to get a reliable result.

I found the culprit - the Google Closure Compiler. I checked the  
following versions:

compiler-20150920.tar.gz - OK
compiler-20151015.tar.gz - OK
compiler-20151216.tar.gz - OK
compiler-20160208.tar.gz - not OK

So it looks like the compiler itself is to blame. :-(



More information about the horde mailing list