JQuery 2.1.x not recommended for Lift

35 views
Skip to first unread message

j...@joescii.com

unread,
Mar 29, 2018, 11:37:41 AM3/29/18
to Lift
Hello fellow Lifters! 

TL;DR
Upgrade to JQuery 2.2.x if you are using 2.1.x and you rely on Lift's comet feature.


Full version
One of my clients noticed that whenever someone put their MacBook to sleep, comet would not resume after waking the Mac. Sleeping the Mac for as little as one moment was enough to cause the issue.

After investigation, I learned that the browser (Chrome is what I used to investigate, but Safari behaved similarly) cancels the ajax request made for comet. After instrumenting code, I noticed that Lift's cometFailureFunc JS function was not getting called immediately after waking the laptop. This was NOT what I observed in my test projects. There I would see our error function called moments after waking the laptop.

For those unfamiliar with Lift's comet implementation details: Comet works by the client initiating an ajax request back to the server. Lift then uses jquery to handle the ajax call (unless of course you have configured your Lift app differently). Hence if jquery is broken, Lift isn't going to behave well.

So I went down the path of investigating what JQuery version was in play. If you find yourself investigating this, execute "jQuery.fn.jquery" in the browser console to echo the exact version that is active in your app (thanks Stack Overflow). That's how I tracked down that the version they were using (2.1.1) was broken, the latest 2.1.x (2.1.4 at this time) had the same behavior, but the latest 2.x (2.2.4 at this time) does NOT have this issue of calling the error handler in a timely fashion.

I hope this helps someone else!

Joe
 

Matt Farmer

unread,
Mar 29, 2018, 12:50:48 PM3/29/18
to Lift
Good catch Joe! Thanks for the heads up!

Should we put something in the README on lift/framework about this?


Matt Farmer Blog | Twitter
GPG: CD57 2E26 F60C 0A61 E6D8  FC72 4493 8917 D667 4D07

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Donald McLean

unread,
Mar 29, 2018, 12:56:37 PM3/29/18
to liftweb
What about newer versions of JQuery?

I'm using 3.1.1, but I see that 3.3.1 is the current version.
>> email to liftweb+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to liftweb+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Antonio Salazar Cardozo

unread,
Mar 29, 2018, 2:48:26 PM3/29/18
to Lift
What is the actual issue in jquery? Might there be a workaround that we can let people know about?

Nice find!
Thanks,
Antonio

Tim Nelson

unread,
Mar 30, 2018, 7:55:32 AM3/30/18
to Lift
FYI, there is a vulnerability in jQuery <3.0.0 [1], so you should upgrade above that if you can. I just upgraded our codebase and with the help of their migration library, I didn't have to make many changes, so it's not too bad.

Antonio Salazar Cardozo

unread,
Mar 30, 2018, 3:45:16 PM3/30/18
to Lift
Yipes. Yeah, maybe not worth supporting that version then.

Joe Barnes

unread,
Apr 3, 2018, 4:38:42 PM4/3/18
to lif...@googlegroups.com
Following up on some questions...

What about newer versions of JQuery?

I only tested the versions I mentioned. This particular project has a LOT of front end code and the task of trying later versions of JQuery is on someone else's plate. I've followed up and I'm letting folks here know about the security vulnerability Tim pointed out. I'll reply back with any findings.

What is the actual issue in jquery? Might there be a workaround that we can let people know about?

I didn't bother to track it down tbh. Once I saw that our error function wasn't getting called, I started kicking JQuery versions until it worked again :) 

Should we put something in the README on lift/framework about this?

Most definitely in light of the issue Tim shared with us! We probably need to update our template projects and so forth to, don't y'all think? 

Joe



/**
 * Joe Barnes
 * Owner/Principal Consultant, joescii, llc
 */


--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages