Static instance of javascript class is not retained in IE7 on ppr

Discussion in 'Internet Explorer' started by Shakeb, Mar 17, 2009.

  1. Shakeb

    Shakeb Guest

    I have created an application which works with below client-side javascript.

    function RtcProvider()
    {
    this._rtcComponents = new Object();
    }

    // The static instance that will hold the singleton instance. This should
    not be
    // acquired directly. It needs to be acquired via the getInstance() method.
    RtcProvider.INSTANCE = null;


    /**
    * Static method to acquire a fully initialized RtcProvider instance.
    */
    RtcProvider.getInstance = function()
    {
    if(RtcProvider.INSTANCE==null)
    {
    RtcProvider.INSTANCE = new RtcProvider();
    }
    return RtcProvider.INSTANCE;
    }

    RtcProvider.prototype.registerComponent = function(component)
    {
    //add component to this._rtcComponent
    }

    RtcProvider.prototype.updateData = function(data)
    {
    //get components from this._rtcComponents and update them
    }

    The jspx page has some components which when rendered call

    "RtcProvider.getInstance().registerComponent()" - 1

    method to register themselves on partial/full page refresh. Along with this
    the back-end sends a javascript to the page using AJAX. The javascript
    content says

    "RtcProvider.getInstance().updateData(data)" - 2

    The updateData method will update the components registered with the
    RtcProvider instance. Since RtcProvider.INSTANCE is a static variable both
    these javascript calls should work on the same RtcProvider instance. When the
    page is rendered afresh the update happens as expected. However on a partial
    page refresh, the static instance of RtcProvider is lost during call 1. This
    is seen intermittently in IE7. In short call 1 and call 2 work on separate
    RtcProvider instance instead of the same static instance. However this is not
    reproducible in IE8 or any other browsers like Firefox, safari etc. Is this a
    known issue? Is there a hotfix available for this problem for IE7?
     
    Shakeb, Mar 17, 2009
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.