views:

111

answers:

1

This is a weird one.

We're writing a Django application with some rich javascript UI, using both Yahoo YUI and jQuery.

Our main page template now includes a fair number of js files. And we're starting to see a strange error in Firefox (3 and 3.5) . Sometimes the javascript crashes. And inspecting in Firebug we see that a syntax error occurred in one of the YUI .js files. When we look at the line in Firebug, we see that it's actually a line that doesn't exist in the original file, but seems to be some junk javascript that's got appended.

For example, the last part of a despaceed yahoo-dom-event.js is

YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.7.0", build: "1799"});

According to Firebug, this now seems to have a near copy of this file appended on the end, starting with

return M;},_getCacheIndex:function(Q,R,P){for(var O=0,N=I.length;O<N;O=O+1){var M=I[O]...

Perhaps this is some of the earlier code that's overflowed a buffer somewhere.

So, has anyone else experienced anything like this? Or knows this as a bug in one of the components of our stack :

  • Django
  • lighttpd
  • Firefox
  • Firebug
  • YUI
  • jQuery (also on the page)
+1  A: 

You should read up on how YUI handles importing of its libraries. It may be configured to import libraries dynamically, in which case it imports them compressed (like the code you're seeing at the end is.) In any case, it isn't code "that's overflowed a buffer somewhere."

Most likely the error isn't in YUI or any of the other frameworks; the error lies in how you use it. Since you have provided no information about that I can't help you until you do.

Anyways, have a look at the YUI documentation.

Blixt
Thanks. So, if I understand you correctly, you're saying that this extra, which I emphasize *isn't* in the source file on the server, could be a deliberately dynamically loaded compressed version of some other code?
interstar
Yeah, depending on how YUI is configured, it might try to get the compressed code from the YUI server. See this page: http://developer.yahoo.com/yui/articles/hosting/ Note the difference between selecting "Loading Script and CSS Directly" and "Dynamic Loading with YUI Loader"
Blixt