Project

General

Profile

Wt internal error; code: undefined, description: tr.size is not a function

Added by Emeric Poupon almost 8 years ago

Hello,

I am quite confused. I am using precompiled packages of wt on a freshly installed Debian Stretch (wt 3.3.6)

I get this error when clicking on a button using Firefox: "Wt internal error; code: undefined, description: tr.size is not a function"

Using Chromium, the message is a bit different: "Wt internal error; code undefined, description: url.indexOf is not a function"

The code using the button is here: https://github.com/epoupon/fileshelter/blob/master/src/ui/ShareEdit.cpp#L91

I suspect a bug with the 3.3.6 package, since it seems to work fine with a manual install of wt.

What do you think? How can I debug that?

Emeric


Replies (29)

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov almost 8 years ago

+1

I'm get: "Wt internal error; code undefined, description: url.indexOf is not a function"

when click on "Register" link on Wt::Auth::AuthWidget.

Environment: Debian stretch amd64 (wt 3.3.6)

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Emeric Poupon over 7 years ago

I sent a mail to the debian package maintener.

Unfortunately, I haven't got any answer so far.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

Konstantin Podsvirov wrote:

+1

I'm get: "Wt internal error; code undefined, description: url.indexOf is not a function"

when click on "Register" link on Wt::Auth::AuthWidget.

Environment: Debian stretch amd64 (wt 3.3.6)

I found more bugs.

Who wants to see it live?

Go to my site: https://dad.podsvirov.pro/house/installers

At the "Installers" section click on any "Details" button.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Roel Standaert over 7 years ago

It seems that is due to the fact that Debian does not use the version of jQuery bundled with Wt, and instead uses the latest one included in Debian. We deliberately use an old version of jQuery, because it's small and we don't use most of jQuery.

The issue with url.indexOf seems to come from our use of $(window).load() in StdGridLayoutImpl2.C, which was deprecated and then removed in later versions of jQuery. We can't really do anything to fix that, so you could report a bug with Debian. They could for example use $(window).on('load', ...) instead.

Regards,

Roel

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

I also sent a mail to the debian package maintener (Pau Garcia i Quiles).

Unfortunately, I haven't got any answer so far.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

I try debug it on my Chrome browser.

I get error:

Uncaught TypeError: url.indexOf is not a function

In Source I found:

jQuery.fn.load = function(url, params, callback) {
    var selector, type, response, self = this, off = url.indexOf(" ");
    ...

It seems to me that the url argument is not what was expected of him.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

On my server I found:

/usr/share/Wt/resources/jPlayer$ ls -la
drwxr-xr-x 2 root root   4096 Aug 16 22:08 .
drwxr-xr-x 4 root root   4096 Aug 16 22:08 ..
lrwxrwxrwx 1 root root     46 Jan 12  2017 Jplayer.swf -> ../../../javascript/jquery-jplayer/Jplayer.swf
-rw-r--r-- 1 root root 121204 Mar  9 22:33 jquery.jplayer.js
lrwxrwxrwx 1 root root     56 Jan 12  2017 jquery.jplayer.min.js -> ../../../javascript/jquery-jplayer/jquery.jplayer.min.js
-rw-r--r-- 1 root root  13714 Mar  9 22:33 jquery.jplayer.swf
lrwxrwxrwx 1 root root     40 Jan 12  2017 jquery.min.js -> ../../../javascript/jquery/jquery.min.js
lrwxrwxrwx 1 root root     52 Jan 12  2017 skin -> ../../../javascript/jquery-jplayer/skins/blue.monday

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

I conducted the experiment.

I copied the resources folder from the Wt repository (for tag 3.3.6) and put it in the DocumentRoot, but I get the same errors as before.

To wt_config.xml I also put:

<property name="resourcesURL">https://dad.podsvirov.pro/resources</property>

Then test content https://dad.podsvirov.pro/resources/jPlayer/jquery.min.js:

/*!
 * jQuery JavaScript Library v1.4b1pre
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://docs.jquery.com/License
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu Jan 7 14:26:06 2010 -0500
 */
...

The problem is still relevant. Are there any other ideas for correcting this problem?

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

Good news.

I received a response from the debian package maintener (Pau Garcia i Quiles).

He said: I am working on the issues with upstream.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Wim Dumon over 7 years ago

Hello Konstantin,

you cannot replace the jquery library built in in Wt by copying over the resources folder, since it is compiled in the binary. Use WApplication::requireJQuery() instead.

I have also contacted Pau regarding this issue. Based on his first response, it looks like we may have to resolve the compatibility issue with the jquery versions.

BR,

Wim.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

Wim, thanks for explaining how this works.

I gradually study the project and try to use it, and also help if it is within my power.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Emeric Poupon over 7 years ago

@Konstantin Podsvirov, any news on this issue from the maintainer?

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Wim Dumon over 7 years ago

Hey,

We fixed Wt so that Wt works with hopefully all versions of jquery, to avoid this problem in the future.

Best regards,

Wim.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Emeric Poupon over 7 years ago

Good news!

But I am afraid the Stretch packages of libwt are still unusable?

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Konstantin Podsvirov over 7 years ago

@Emeric Poupon, I have not received any feedback from the debian package maintener.

Debian is a very stable distributive - bugs in it live long :-)

Fix jQuery 3.x issue in master.

Fix jQuery 3.x issue in wt4.

I'm also very interested when these changes appear in the Stretch?

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Roel Standaert over 7 years ago

It's not working in IE apparently, though. It should be indexOf(...)===0, not startsWith, I'm pushing that fix later.

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Rajveer Shringi over 7 years ago

@Wim Dumon

I am still facing the same error, on click event of "register" button in authWidget-

"Wt internal error; code undefined, description: url.indexOf is not a function" followed by-

"Wt internal error; code: undefined, description: tr.size is not a function"

Browsers tried - Chrome and Firefox.

Wt version I am using- 3.3.6

Could you please tell me for what versions of Wt is this fixed?

Thank you

RV

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Rajveer Shringi over 7 years ago

In addition could you please tell me what's the version of Jquery that Wt was initially compatible with before this issue came/was fixed.

Thanks

RV

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Roel Standaert over 7 years ago

Wt was compatible with jQuery 1.x, and possibly also 2.x before the fix, and after the fix it should also be compatible with 3.x.

It is fixed in Wt 4.0.0, and in the wt3 branch. However, the 3.3.8 release does not have this fix yet. We will likely still release Wt 3.3.9, though.

Wt 3.3.6 was released over a year ago, I only fixed this issue last month.

Regards,

Roel

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Rajveer Shringi over 7 years ago

@Roel Janssen

Thanks for your detailed reply, I appreciate it. :)

I was on Wt 3.3.6 since this was the version directly available from the "official package" for Ubuntu. I will upgrade and move to Wt 4.0 now(I think build from source is the only option for this release).

Also what I understand is the jQuery version is specific to an application. I already had a working application that was loosely based on widget gallery example and utilizes auth_widget for logging in functionality. Since I did not do any update on jQuery version in my application, how did it start to crash ?

What I am trying to figure out is where in my application code am I specifying the version of jQuery to be used.

Best,

RV

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Roel Standaert over 7 years ago

We bundle an old version of jQuery with Wt, because it's small, and supports pretty much all browsers, and we don't use all of jQuery's features anyway. However, Debian (and therefore also Ubuntu) repackages Wt so it includes the latest jQuery version (3.x). That's why it caused problems even if you didn't specify a specific version.

Regards,

Roel

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Rajveer Shringi over 7 years ago

@Roel Janssen

Thanks again for the quick and detailed response, it makes things much clear now. Earlier in comments Wim mentioned a possibility of workaround using - WApplication::requireJQuery(). Could you tell me how? Or maybe I misinterpreted it.

Currently I am trying to build Wt 4.0 from source to solve this issue, but if there's a workaround I would like use it.

Best,

RV

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Rajveer Shringi over 7 years ago

Update -

Using function WApplication::requireJQuery() and specifying the custom jquery that one wants to use(for example 1.12.24) solves this issue.

This saved me some time to build from source.

RoelWim Thank you for the support that you guys are providing, it really makes life easier.

Best,

RV

RE: Wt internal error; code: undefined, description: tr.size is not a function - Added by Emeric Poupon over 7 years ago

Since the issue is still present on strech and makes wt no use on this debian version, could you please tell me more practical details about the workaround using requireJQuery?

As far as I understand I have to ship a jquery 1.4.1 with my application and use requireJQuery to specify it?

(1-25/29)