dcsimg
www.webdeveloper.com
Results 1 to 10 of 10

Thread: Error: Callee Disappeared

  1. #1
    Join Date
    Jan 2003
    Posts
    5

    Error: Callee Disappeared

    What is this error message trying to say?

    Error: The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call did not execute.

    What is the cause of this error?

    I have a JavaScript code that displays the contents of an array variable in a popup window. The user can edit or add some contents into this array variable.

    The original browser window has the page with the following JavaScript code:

    <script type="text/javascript">
    <!--

    // The public array variable.
    // Actually, this variable is an array of arrays;
    // the main index to this array is a string representing
    // a custom property's name.

    var ArrayValues = new Array();

    ...

    // The following function is used for debugging purposes
    // only. It displays the contents of ArrayValues in an
    // alert() dialog box.

    function exposeArray()
    {
    content = '';
    for(var property in ArrayValues)
    {
    var index = ArrayValues[property].index;
    var val = ArrayValues[property].value;

    content += property + '[' + index + '] = ' + val + '\n';

    }

    alert(content);
    }

    // The following function is the handler to the onClick
    // event of the Edit button, the button that launches
    // a popup window.

    function showItems(property)
    {
    // Debug: display contents of ArrayValues

    exposeArray();

    // Display the popup window

    var itemsWindow =
    window.open('http://www.mysite.com/cgi-bin/view.cgi?property=' + property);
    }

    //-->
    </script>

    The popup window contains code that adds an item to the ArrayValues array variable. The updating occurs in the popup window's onUnload handler:

    // Variable "property" is a global variable.
    var property;

    ...

    function unload()
    {
    var parentWindow = window.opener;

    if(parentWindow.ArrayValues[property] == null)
    parentWindow.ArrayValues[property] = new Array();

    parentWindow.ArrayValues.index =
    document.itemsForm.indexField.value;

    }


    The first time the Edit button is clicked, the viewer pops up successfully. But after I made some changes in the ArrayValues array by using the popup window, the second time I clicked the Edit button, the "callee has disappeared" error message popped up. The error pointed to the line "var index = ArrayValues[property].index;" in the exposeArray() function.

  2. #2
    Join Date
    Jan 2003
    Posts
    5
    I've committed a mistake in typing the unload() function in this forum. I'm sorry. It should be this:

    // The onUnload handler. Defined in the popup window.
    // Variable 'property' is a global variable.

    function unload()
    {
    var parentWindow = window.opener;

    if(parentWindow.ArrayValues[property] == null)
    parentWindow.ArrayValues[property] = new Array();

    parentWindow.ArrayValues[property].index =
    document.itemsForm.indexField.value;

    parentWindow.ArrayValues[property].value =
    document.itemsForm.valueField.value;

    }


    The array ArrayValues is defined in the opener window, and is not defined in the popup window.

    ArrayValues is an array of arrays, but its indexes are strings. It is defined in the opener window like this:

    // Global variable ArrayValues
    var ArrayValues = new Array();


    The index to an element of this array is a string representing some custom properties. The array elements themselves are again arrays. And these latter arrays again have string indexes, but the only string values allowed are "index" and "value". In code,

    /*-----


    var property = "linkList"; // Sample property
    var indexValue = "Yahoo!"; // Sample index
    var valValue = "http://www.yahoo.com"; // Sample value

    ArrayValues[property] = new Array();

    // I can do it like this:

    // ArrayValues[property]["index"] = indexValue;
    // ArrayValues[property]["value"] = valValue;

    // But I did this:

    ArrayValues[property].index = indexValue;
    ArrayValues[property].value = valValue;


    -------*/

    The updating is done in the unload() function.

    In what circumstances does the "callee has disappeared" error generally occur?

  3. #3
    Join Date
    Jan 2003
    Posts
    5
    Okay. I've created a very simplified version of my program that produces the same "callee has disappeared" message.

    The codes for the main window and the popup window are shown below. To produce the error message, do the following steps:

    1. Run the main window.
    2. Click on the "Display array elements" button to view the current contents of the array MainArray.
    3. Click on the "Launch Add Array Elements popup window".
    4. On the popup window, fill the form with whatever you want. Click on the "Save and add another" button to save your data iinto the MainArray array.
    5. Close the popup window.
    6. On the main window, click on "Display array elements" button to view the updated array.

    After the last step, the error message will pop up.

    The code below is for the main window. Its file name is "main.htm".

    <html>
    <head>
    <title>Main Window</title>
    <script type="text/javascript">
    <!--
    var MainArray = new Array();

    function init()
    {
    // Initialize this array with sample values.

    MainArray['persons'] = new Array();

    MainArray['persons'][0] = new Array();
    MainArray['persons'][0].index = 'mother';
    MainArray['persons'][0].value = 'Mama Smith';

    MainArray['persons'][1] = new Array();
    MainArray['persons'][1].index = 'father';
    MainArray['persons'][1].value = 'Papa Smith';


    MainArray['linkList'] = new Array();

    MainArray['linkList'][0] = new Array();
    MainArray['linkList'][0].index = 'Yahoo!';
    MainArray['linkList'][0].value = 'http://www.yahoo.com';

    MainArray['linkList'][1] = new Array();
    MainArray['linkList'][1].index = 'Lycos';
    MainArray['linkList'][1].value = 'http://www.lycos.com';

    }

    function display()
    {
    var content = '';

    for(property in MainArray)
    {
    content += property + ':\n';
    for(i in MainArray[property])
    {
    content += ' '
    + MainArray[property][i].index + ' => '
    + MainArray[property][i].value + '\n';
    }

    content += '\n\n';
    }

    alert(content);
    }

    function addElems()
    {
    var popupWin = window.open('popup.htm', null, 'resizable=no,width=550,height=400,status=no,scrollbars=yes');
    }

    //-->
    </script>
    </head>
    <body onload="javascript:init()">
    <form name="mainForm">
    <input type="button" value="Display array elements" onclick="javascript:display();"><br>
    <input type="button" value="Launch Add Array Elements popup window" onclick="javascript:addElems();">
    </form>
    </body>
    </html>


    The code below is now for the popup window. Its file name is "popup.htm".

    <html>
    <head>
    <title>Add Array Elements</title>
    <script type="text/javascript">
    <!--
    var parentWindow;
    var pform;

    function init()
    {
    parentWindow = window.opener;
    pform = document.popupForm;
    }

    function saveItems()
    {
    var property = pform.propertyField.value;
    var indexValue = pform.indexField.value;
    var valValue = pform.valueField.value;

    if(parentWindow.MainArray[property] == null)
    {
    parentWindow.MainArray[property] = new Array();
    }

    var itemArray = new Array();

    itemArray.index = indexValue;
    itemArray.value = valValue;

    parentWindow.MainArray[property].push(itemArray);

    pform.indexField.value = '';
    pform.valueField.value = '';

    parentWindow.display();

    alert('Done.');

    }
    //-->
    </script>
    </head>
    <body onload="javascript:init()">
    <form name="popupForm">
    Property: <input type="text" name="propertyField" size=30><br>
    Index: <input type="text" name="indexField" size=30><br>
    Value: <input type="text" name="valueField" size=30><br>
    <br>
    <input type="button" value="Save and add another" onclick="javascript:saveItems()">
    </form>
    </body>
    </html>

  4. #4
    Join Date
    Jan 2003
    Posts
    5
    I've also attached my source code (Opalblue.zip).
    Attached Files Attached Files

  5. #5
    Join Date
    Jan 2003
    Posts
    5
    You're right. This line is in the main window:

    var index = ArrayValues[property].index;

    And this line is in the popup window:

    parentWindow.ArrayValues[property] = new Array();

    Now I realized that the new Array() object is not created in the main window.

  6. #6
    Join Date
    Aug 2005
    Posts
    2
    hi,
    i'm also facing a similar problem, if you would have got any solution to it please let me know.


    Thanks,

    wannalearn.

  7. #7
    Join Date
    Jan 2006
    Location
    Warwickshire, England
    Posts
    1

    Smile

    I've got a similar problem with an application I'm working on in C# (.NET 2002)

    I'm getting this JavaScript error message:

    "The callee (server [not server application]) is not available and
    disappeared; all connections are invalid. The call did not execute."

    This is the situation:

    The homepage has several usercontrols. The important ones are
    1. A User control that provides a menu bar.
    This menu bar contains 4 links - 2 are to external websites, the other 2 are links to open internal modeless popup windows.
    2. A user control that provides a link to a pdf document, which is opened using acrobat in IE.

    Scenario1: When I go into the homepage, and click the link, everything's fine - the pdf is displayed.

    Scenario2: Click the menu control for one of the external sites. This opens in new window. Return focus to the homepage of my site and click the pdf link. Everything's fine - the pdf is displayed.

    Scenario3: Click this menu control to open one of the popups. The popup is displayed correctly as a modeless dialog window. Return focus to the homepage and click the pdf link.
    In this scenario, the page will not open. In the development environment the code breaks with the above message. This happens regardless of whether the popup window is still open, or has ben closed.

    The user control for the pdf link looks like this:
    <%@ Control Language="c#" AutoEventWireup="false" Codebehind="PdfLinkUserControl.ascx.cs" Inherits="MyCompany.Web.UI.UserControls.HomePage.PdfLinkUserControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>

    <a style="FONT-WEIGHT: bold; COLOR: #000000" href="JavaScriptopupWindow('Document/PDF/MyDocument.pdf')">
    <img src="Images/Icons/icon_download_r_24.gif" border="0">&nbsp;Click Here&nbsp; </a>

    The function is in a separate .js file in the solution
    function popupWindow(sUrl)
    {
    window.open(sUrl);
    }

    Any help on this would be greatly appreciated, thanks for taking the time to read it all

    By the way, I've seen a lot of sites suggest that this has to do with popup blockers, but I don't have any, so I know its not that in this case.

    Thanks again

  8. #8
    Join Date
    Apr 2007
    Posts
    1

    Smile

    Well, I have fixed the source from opalblue and it is working now without showing the 'callee' error.

    Here is what I found out and fixed -
    There is problem if Array object is passed between base and popup window. So, instead of passing array object from popup to base window, I passed simple parameters to base window function and let that function handle the array manipultation. And it worked.

    I am uploading the fixed version of the source code. Thanks to opalblue for giving easy way to recreate the issue.
    Attached Files Attached Files

  9. #9
    Join Date
    Apr 2009
    Posts
    1

    JavaScript (not Java) Discussion and technical support, including AJAX and frameworks

    The same error happened to me also but not like the one as the previous threads but possibility of these kind of errors happening is more .
    Code with error
    ************
    function dca_displayDetails_open() {

    wx = 870;
    wy = 500;
    x = (screen.width - wx) / 2;
    y = (screen.height - wy) / 2;

    dca_displayDetails_open = window.open(open_url,"dca_displayDetails_open","left="+x+",
    top="+y+",width="+wx+",height="+wy+",resizable=yes,scrollbars=yes");
    dca_displayDetails_open.focus();

    }


    if you see the above code i have used the same name for the function name and the window name. this is the problem and the same was rectified by using a different code as below

    Recified code
    **********
    function dca_displayDetails_open() {

    wx = 870;
    wy = 500;
    x = (screen.width - wx) / 2;
    y = (screen.height - wy) / 2;

    dca_displayDetails = window.open(open_url,"dca_displayDetails","left="+x+",
    top="+y+",width="+wx+",height="+wy+",resizable=yes,scrollbars=yes");
    dca_displayDetails.focus();

    }

  10. #10
    Join Date
    Oct 2010
    Posts
    1
    Thanks all. This thread was helpful as I was doing the same thing -- passing an array from a child window to the parent, closing the child and then getting this error when I tried to access the array again.

    The odd part is that neither Google Chrome nor Firefox gave me an error but IE did.

    My solution was simply to copy the array instead of assign it. This article was very useful in understanding why that was needed: http://my.opera.com/GreyWyvern/blog/show.dml/1725165

    Basically the array I passed from the child window was destroyed along with the child window so accessing it was no longer valid. So instead of doing:
    myarray = newarray;
    I simply changed it to:
    myarray = newarray.slice(0);
    Where slice copies the array from element 0 on rather than passes it by reference.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles