I finally managed to reproduce this pb outside of gwt. It seems to be
due to the fact the js is loaded inside an iframe (which is the case
of the js generated by gwt).

Here is a simple example to reproduce it.

######## main.html ########
<html>
<head>
<script type="text/javascript">
function MyObject(){
  throw "String thrown";
};

//This function is the workaround to the pb explained in my previous
post
function wrappingMyObjectConstructor(){
    try{
        new MyObject();
    }
    catch(e){
        throw(e);
    }
}
</script>
</head>
<body>
<iframe src="iframe.html" width="500px" height="200px"></iframe>
</body>
</html>


######## iframe.html ########
<html>
<head>
<script type="text/javascript">
function buggy(){
    try{
        new parent.window.MyObject();
    }
    catch(e){
        alert(e);
    }
}

function notBuggy(){
    try{
        parent.window.wrappingMyObjectConstructor();
    }
    catch(e){
        alert(e);
    }
}
</script>
</head>
<body>
<a href="javascript:buggy();">buggy : constructor called directly</
a><br/>
<a href="javascript:notBuggy();">not buggy : constructor called via
wrapping function</a>
</body>
</html>



On 5 jan, 18:08, "Ian Petersen" <ispet...@gmail.com> wrote:
> On Mon, Jan 5, 2009 at 9:02 AM, blissteria <blisste...@hotmail.com> wrote:
> > There is another solution that works but I do not trully understand
> > why. I wrap the call of "new MyObject()" in a function defined in the
> > foo.js file :
> > function wrappingMyObjectConstructor() {
> >  try {
> >    return new MyObject();
> >  } catch (e) {
> >    throw e;
> >  }
> > }
>
> > and calling wrappingMyObjectConstructor in JSNI works fine in IE. This
> > is a hack, it works, but does anyone know how to avoid this or can
> > explain this?
>
> You may have found a bug in GWT.  If GWT can catch thrown strings in
> the second case but not in the first case, then I think there's a
> problem with the exception mapping between the languages.  You might
> want to file a bug and, if you do, try to include a really good repro
> case.
>
> Ian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to