Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting "Application error. Destination unavailable" error #7

Closed
johnreitano opened this issue Jul 10, 2012 · 3 comments
Closed

getting "Application error. Destination unavailable" error #7

johnreitano opened this issue Jul 10, 2012 · 3 comments

Comments

@johnreitano
Copy link

I have a parent window that dynamically adds an iframe to its body. I'm (intermittently) getting a "Application error. Destination unavailable" when calling a method in the parent window from the iframe.

Here is the code in the parent window:

    pmrpc.register( {
      publicProcedureName: "getProjectInfo",
      procedure: function() {
        console.log( 'received Rpc call getProjectInfo' );
        return "here's the info";
      }
    });

and here is the code in the iframe:

pmrpc.call({
  destination: parent,
  publicProcedureName : "getProjectInfo",
  retries: 40,
  timeout: 40000,
  onSuccess : function(returnObj) { 
    var projectInfo = returnObj.returnValue; 
    console.log("success returned from pmrpc.getProjectInfo with value " + JSON.stringify( projectInfo ) ); 
  },
  onError : function(statusObj) {
    console.log("error received after calling pmrpc.getProjectInfo: " + statusObj.message );
  }
});

As you can see, I get this problem even with very high timeout and retries. I noticed in one of your closed issues that someone had tried changing -1 to -2 in this part of the pmrpc code:

} else if (callObj.retries <= -2) {
  processJSONRpcResponse(...

And that does indeed "fix" the problem, but I'm wondering if there is a better fix, ie, one that would not turn off timeouts.

Thanks!
John

@izuzak
Copy link
Owner

izuzak commented Jul 10, 2012

Hi John, thanks for reporting this. I'll have a better look tomorrow, but in the meantime - can you have a look at these two HTML files which I put together to try to reproduce the issue: https://dl.dropbox.com/u/1657316/parent.html and https://dl.dropbox.com/u/1657316/child.html ? Anyway, this example works for me without errors -- an iframe child is added after 5 seconds in the parent, the code in the iframe calls a procedure in the parent and gets a non-error result. Let me know if I missed anything important, it will help me reproduce the issue and hopefully fix it. Also, can you try wrapping your pmrpc.call invocation in the child within a setTimeout(..., 0) and see if that fixes the issue? Also, is your code live on the Web somewhere, perhaps?

Anyway, I'd love to get to the bottom of this and fix the issue once and for all. It seems that there is something strange happening in some specific cases.

@izuzak
Copy link
Owner

izuzak commented Dec 9, 2012

@johnreitano -- not sure if this still interests you, but I hope I fixed the issue with commit eca09ff (with the help of @jbadeau). cheers!

@izuzak izuzak closed this as completed Dec 9, 2012
@johnreitano
Copy link
Author

Yes, I am still interested. Thank you so much for putting in the fix. I will check it out and see if it solves our problem.

Thanks,
John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants