« Return to Thread: Parameter marshalling between iframes + DWR

RE: Parameter marshalling between iframes + DWR

by mikewse :: Rate this Message:

Reply to Author | View in Thread

Ok, now I've checked in updated code for correctly detecting native types across frames.
 
To get this working across all browsers (available to me: IE6, IE7, FF2, Safari 2 & 3, Opera 9) I had to use the classic Object.prototype.toString.call() trick. This decreases type detection performance to 17usec from previous 11usec (using instanceof) on my mid-range PC.
 
In the great whole of serializing data this is probably not a big deal, but we could improve this performance by f ex caching the type detection on each native class's constructor function. That would bring type detection cost down to 8usec (ie better than before) but would mean adding a property (something like "$dwrclass" or similar) on each visited native class on the global object. Note that this wouldn't imply any property pollution on user objects as the property would be added to the constructor function and not to the prototype object.
Any comments or opinions about this?
 
Joe: I've only checked this in for the 2.x branch currently. Should I update HEAD as well or will you do it yourself?
 
Best regards
Mike


From: joseph.walker@... [mailto:joseph.walker@...] On Behalf Of Joe Walker
Sent: den 16 maj 2008 18:18
To: users@...
Subject: Re: [dwr-user] Parameter marshalling between iframes + DWR


Yes please, Mike.
Thanks,

Joe.

On Wed, May 14, 2008 at 4:58 PM, Mike Wilson <mikewse@...> wrote:
Hi matan,

[sorry about the delay, going through old mails...]

> I came upon an issue... not with DWR directly but with how
> the browsers
> (Firefox + IE at least) marshal object parameters between
> iframes which
> makes a nice mess.
>
> When you pass an object as a parameter between a window and
> an iframe the
> object is "cloned" i guess and the type information of the object is
> removed.  All the functionality of the object is copied
> though so you mostly
> won't notice.  For example:

Yes, instanceof and multiple frames usually means problems (but it
actually isn't about cloning, it's about different prototype
objects on types).

Joe: I think we decided to remove all use of instanceof some time
ago. Should I go in and fix engine.js for 2.0.4 ?

Best regards
Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


 « Return to Thread: Parameter marshalling between iframes + DWR