奇怪的浏览器/ajax错误:firefox中的javascript文件末尾出现额外的垃圾

发布于 2024-07-30 09:12:28 字数 802 浏览 1 评论 0原文

这是一个奇怪的现象。

我们正在使用 Yahoo YUI 和 jQuery 编写一个具有丰富 javascript UI 的 Django 应用程序。

我们的主页模板现在包含相当数量的 js 文件。 我们开始在 Firefox(3 和 3.5)中看到一个奇怪的错误。 有时 JavaScript 会崩溃。 在 Firebug 中检查,我们发现其中一个 YUI .js 文件中发生了语法错误。 当我们查看 Firebug 中的这一行时,我们发现它实际上是原始文件中不存在的一行,但似乎是附加了一些垃圾 javascript。

例如,被删除的 yahoo-dom-event.js 的最后一部分是

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

根据 Firebug,现在似乎在末尾附加了该文件的近似副本,从

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

也许这是一些早期代码溢出了缓冲某处。

那么,还有其他人经历过类似的事情吗? 或者知道这是我们堆栈组件之一中的错误:

  • Django
  • lighttpd
  • Firefox
  • Firebug
  • YUI
  • jQuery(也在页面上)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愿与i 2024-08-06 09:12:28

您应该阅读 YUI 如何处理其库的导入。 它可以配置为动态导入库,在这种情况下,它会导入压缩的库(就像您在最后看到的代码一样)。无论如何,它都不是“在某处溢出缓冲区”的代码。

错误很可能不在 YUI 或任何其他框架中; 错误在于你如何使用它。 由于您没有提供相关信息,因此在您提供之前我无法帮助您。

无论如何,请查看 YUI 文档

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文