jscoverage and js data structures

Questions, problems, suggestions, bug reports, and so on.
Post Reply
Guillaume Lung

jscoverage and js data structures

Post by Guillaume Lung »

Hi,

First, congratulation for jscoverage, according to me it is a very well designed tool - the proxy server is a really smart solution.

Btw, I experienced some difficulities and I had to surrender.

I had difficultes because the fwk I'm using is quite ... different. I use something like that :
myObj.prototype = {
data : {
Type: "mydata.Data"
},

init : function(){
// my initialization
},
}

Then, the're is an extern initialization that "post-build" the object:
data is evaled again with : "data = new mydata.Data();". (Something like that.)

So I can't use jscoverage.... because the data declaration is wrapped (and then can't be find in the prototype).

I'm just wondering why jscoverage wrap the code :
data : {
Type: "mydata.Data"
},
... and not only functions declaration ?


Because, in this case, it would work really fine.
(And I understand this is not an usual way to work with JS - it's ok ;) )

Guillaume
Ed
Posts: 120
Joined: 2008-10-11 6:52 pm

Re: jscoverage and js data structures

Post by Ed »

Hello, Guillaume,

I'm having trouble understanding your code - could you attach a .js file (or files) containing a minimal working example that I can run using JSCoverage and see what's going on?
Guillaulme

Re: jscoverage and js data structures

Post by Guillaulme »

Ed,

I understand your trubble... Forgot my previous message, I spoke too fast (this message was only garbage...).



Actually, I have a JS code working but when I use thejscoverage proxy there is an error when calling the native eval function. I use a try cath and the error is the following :

"EvalError: function eval must be called directly, and not by way of a function of another name"


Do you have any idea ?
Guillaume

Re: jscoverage and js data structures

Post by Guillaume »

I found the error.

In my source code I've got :

Code: Select all

new(eval(type))()
;

After going throw the jscoverage proxy, it became :

Code: Select all

new eval(type)();
... which doens not work (at lead on FF3).

Now, I use this, workaround and this is ok :

Code: Select all

var Class = eval(type);
this[item] = new (Class)();

Btw, i've got an another issue, on some request throw the proxy, my server trigger a 400 error : "Could not parse request headers" ... maybe i'll start an other topic tomorrow.
Ed
Posts: 120
Joined: 2008-10-11 6:52 pm

Re: jscoverage and js data structures

Post by Ed »

Guillaume wrote:I found the error.

In my source code I've got :

Code: Select all

new(eval(type))()
;

After going throw the jscoverage proxy, it became :

Code: Select all

new eval(type)();
Thanks, I think I have this fixed now in the Subversion repository.
Guillaume wrote:Btw, i've got an another issue, on some request throw the proxy, my server trigger a 400 error : "Could not parse request headers" ... maybe i'll start an other topic tomorrow.
What web browser are you using? Is this still FF 3?
Guest

Re: jscoverage and js data structures

Post by Guest »

Ed wrote: Thanks, I think I have this fixed now in the Subversion repository.
Great!
Ed wrote:
Guillaume wrote:Btw, i've got an another issue, on some request throw the proxy, my server trigger a 400 error : "Could not parse request headers" ... maybe i'll start an other topic tomorrow.
What web browser are you using? Is this still FF 3?
Yes.

Actually, this the jscoverage proxy server which fails on this type of parameters :

Code: Select all

http://www.test.com/?foo=bar[0]
but

Code: Select all

http://www.test.com/?foo=bar
works.

Do you confirm the issue ?
Guest

Re: jscoverage and js data structures

Post by Guest »

I don't know if it can help but

Code: Select all

http://www.test.com/?foo=bar%5D0%5B
works fine.


I guess that the browser do not escape characters before sending it to the proxy ...
Ed
Posts: 120
Joined: 2008-10-11 6:52 pm

Re: jscoverage and js data structures

Post by Ed »

Thanks, I see the problem now. I have modified the URL parser in jscoverage-server to accept more characters; "[" and "]" should work now, even if not %-escaped.
Guillaume Lung
Posts: 4
Joined: 2009-09-08 11:41 am

Re: jscoverage and js data structures

Post by Guillaume Lung »

Great !


Do have an idea about the next release date ?
Ed
Posts: 120
Joined: 2008-10-11 6:52 pm

Re: jscoverage and js data structures

Post by Ed »

Probably the next release will be in a month or two.
Guillaume Lung
Posts: 4
Joined: 2009-09-08 11:41 am

Re: jscoverage and js data structures

Post by Guillaume Lung »

Ok. Thank you for your fix.
I tested it and it works fine.
Post Reply