Ticket #9087 (closed Bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

Javascript Resource Registries fail to merge scripts

Reported by: ned14 Owned by: mj
Priority: minor Milestone: 3.3
Component: Javascript Keywords: resource registries, portal_javascripts
Cc: s_plone@…

Description

Spent the last few hours finding the cause of this problem: portal_javascripts stops merging or compressing registered javascript files and leaves out all scripts except the first one in any given merge segment. I discovered this when trying to replace the jquery v1.2.6 built into Plone v3.1.7 with jquery v1.3.2 as the latter has IE8 fixes + is much faster.

Steps to reproduce:

  1. Download jquery v1.3.2 from jquery website onto your computer. I was running Windows XP - this may make a difference due to CR/LF considerations.
  2. Customise /portal_skins/plone_3rdParty/jquery.js. This creates a new file in /portal_skins/custom/jquery.js. Hit the Choose File button and upload the jquery v1.3.2 from your file system.
  3. Go to /portal_javascripts, wait for the page to finish loading (or you'll lose entries) and hit save. This refreshes the merge cache.
  4. Hit Ctrl-F5 on your Plone website with Javascript debugging turned on. You'll get lots of errors about 'jq not defined'. This is because jquery-integration.js is no longer in the merged script file.
  5. In /portal_javascripts, choose the "Merged JS Composition" tab and open the file keycache file. Note that only jquery.js is in there and none of the other merged files. Note also that if you return to the first tab and turn on compression, the keycache file contents still don't compress.

To workaround:

  1. Delete jquery.js from custom and create a new jquery.js file, but this time DO NOT upload the replacement jquery script. Create it empty.
  2. Open the empty jquery.js file in the ZMI. You'll have a textarea. Now open the replacement jquery locally and copy & paste into the textarea.
  3. Go back to /portal_javascripts and hit Save. Now Javascript composition is suddenly working again.

Diagnosis: Something very odd is happening if you do a direct file upload. I tried converting the script to LF only before upload and no difference. I tried converting to UTF-8 but got an identical file (I run my Zope in UTF-8 default).

Maybe it was something to do with how Firefox v3 uploads files, or maybe it is the "varnish" v2 reverse proxy I have running in front of Zope. However, if you search Google you will find other people with this exact problem and the hitherto solution has been to permanently disable merging and compression.

I hope that the above workaround helps folks stuck with this problem.

Niall

Change History

comment:1 Changed 3 years ago by dunlapm

  • Status changed from new to closed
  • Resolution set to worksforme

I could not replicate this bug by following your instructions. It may very well be your reverse proxy in front of zope. Try your steps again but accessing Zope directly this time.

comment:2 Changed 3 years ago by hannosch

  • Milestone changed from 3.x to 3.3
Note: See TracTickets for help on using tickets.