简体   繁体   中英

Siesta : “Can't execute code from a freed script”

I have a testing scenario where I need to access the preloaded file from the window object after signing in and signing out of the page.

The Harness configuration is :

var Harness = Siesta.Harness.Browser.ExtJS;
    Harness.configure({
        preload : [
            'vuxtest.js' 
        ],
        hostPageUrl : '../vux/',
        performSetup : false
    });

The test object is :

 {  
    url : 'Test.js',
    separateContext : true
 }

The preloaded file vuxtest.js sets the window.vuxtest object.

The skeleton of Test.js includes :

startTest(function(test) {

   var vuxtestObj = test.global.vuxtest; ...

    vuxtestObj.run(test, 'Icons', function() { 

       test.it('Sign out - Sign in - Test Grid '+ row, function(t) {

           t.chain(
                   //sign out
                   {
                       ...
                   },
                   //sign back in
                   {
                       ...
                   },
                   //call function from vuxtestObj
                   {
                        vuxtestObj.funcA();
                   }
           );
         });
    });
});

This code works in Chrome but not in IE as it breaks on vuxtestObj.funcA() with the error : cannot execute code from a freed script. Any idea what can I do to fix this ?

It appears that the callback got unloaded from the object where it is defined after some delay in executing a request. You usually see this message when it happens in IE but other browsers just simply ignore.

Try to wrap the callback in a try-catch block:

try {
   t.chain(
   //sign out
   {
       ...
   },

   //sign back in
   {
       ...
   },

   //call function from vuxtestObj
   {
      vuxtestObj.funcA();
   }
   );
}
catch(err) {

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM