lift / lift/framework

Invalid Javascript is sometimes not reported on console

Open
#1,618 2 comments 0 reactions 1 assignee Claimed by @Shadowfiend View on GitHub
Dominant language
Scala
Stars
1.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

From this [thread](https://groups.google.com/d/topic/liftweb/b9JLZvHhzoM/discussion)

> Nope, this is actually a much more pernicious problem that I've seen many times. It is indeed a bit of a pain, but it's also a bit
> hard to solve. When the JS hits the client, jQuery attempts to eval it as JavaScript. But, when it goes to do that, the JavaScript
> fails to parse, so nothing gets to run! This means that the JS sent down from the server never runs at all. However, the jQuery
> AJAX handler does invoke the comet failure function—which is designed to deal with connection errors, not JS parse errors.
> The reaction to a comet request's failure is to try again (I think in 10s?), so we try another comet request. However, it's the JS
> that comes from the server that lets us know what the latest update we've seen from the server is. Since the JS didn't run, our
> version didn't update, which means the comet sees that we're out of date and sends us the original update as well as anything
> else that has happened since then! Net-net, we get the bad JS again, and the cycle starts over.
>
> We may be able to update the failure handler to look for what error jQuery tells us it got—but the problem is that our AJAX stuff
> is designed to work with jQuery, YUI, and one or two other libraries, which means we'd have to make sure they all reported a JS
> parse error the same way, or that we implemented handling for all the different ways in the failure callback. Either way, things get
> pretty nasty.
>
> Hope that sheds some light onto why this is happening, despite not offering an immediate solution. Thanks for bringing it up; this
> has bit me before (though not since we switched to using events+JSON to send things down to the client as a matter of course),
> and it can be quite frustrating.
> Thanks,
> Antonio

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.