How to collect Javascript Code Coverage for multiple domain?

Javascript Code Coverage for multiple domains can be achieved by following the below procedure.

For example:

While execution of the Sahi script, the browser is navigating to two different domain, first from Start URL (http://domain 1) and second from the script( http://domain2)

If we need to collect Javascript Code Coverage for all the domains which we are navigating while execution of the script, then we need to pass the new domain into _addToSession() API.

The _addToSession() is required because Sahi keeps session id for first URL only. To collect Javascript Code Coverage for other URL's, we need to track the session id of other URLs as well.

This requirement can be achieved as follows.
    //Start URL is domain 1
    
    _navigateTo("domain 2");
    //navigating to different domain
    
    _addToSession("domain 2");
    //tracking seassion id for domain 2
    
    _navigateTo("domain 2", true);
    //navigating to same domain but no need to track seassion id
    
    _navigateTo("domain 3");
    //navigating to different domain
    
    _addToSession("domain 3");
    //tracking seassion id