B2G/gecko/testing/marionette/marionette-server.js
/**
   * Returns a chrome sandbox that can be used by the execute_foo functions.
   *
   * @param nsIDOMWindow aWindow
   *        Window in which we will execute code
   * @param Marionette marionette
   *        Marionette test instance
   * @param object args
   *        Client given args
   * @return Sandbox
   *        Returns the sandbox
   */
Returns a chrome sandbox that can be used by the execute_foo functions.
@param nsIDOMWindow aWindow
Window in which we will execute code
@param Marionette marionette
Marionette test instance
@param object args
Client given args
@return Sandbox
Returns the sandbox
Returns a chrome sandbox that can be used by the execute_foo functions . @param nsIDOMWindow aWindow Window in which we will execute code @param Marionette marionette Marionette test instance @param object args Client given args @return Sandbox Returns the sandbox
function MDA_createExecuteSandbox(aWindow, marionette, args, specialPowers, command_id) {
    try {
      args = this.curBrowser.elementManager.convertWrappedArguments(args, aWindow);
    }
    catch(e) {
      this.sendError(e.message, e.code, e.stack, command_id);
      return;
    }
    let _chromeSandbox = new Cu.Sandbox(aWindow,
       { sandboxPrototype: aWindow, wantXrays: false, sandboxName: ''});
    _chromeSandbox.__namedArgs = this.curBrowser.elementManager.applyNamedArgs(args);
    _chromeSandbox.__marionetteParams = args;
    _chromeSandbox.testUtils = utils;
    marionette.exports.forEach(function(fn) {
      try {
        _chromeSandbox[fn] = marionette[fn].bind(marionette);
      }
      catch(e) {
        _chromeSandbox[fn] = marionette[fn];
      }
    });
    _chromeSandbox.isSystemMessageListenerReady =
        function() { return systemMessageListenerReady; }
    if (specialPowers == true) {
      loader.loadSubScript("chrome://specialpowers/content/specialpowersAPI.js",
                           _chromeSandbox);
      loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserverAPI.js",
                           _chromeSandbox);
      loader.loadSubScript("chrome://specialpowers/content/ChromePowers.js",
                           _chromeSandbox);
    }
    return _chromeSandbox;
  }
function MDA_createExecuteSandbox ( aWindow , marionette , args , specialPowers , command_id ) { try { args = this . curBrowser . elementManager . convertWrappedArguments ( args , aWindow ) ; } catch ( e ) { this . sendError ( e . message , e . code , e . stack , command_id ) ; return ; } let _chromeSandbox = new Cu . Sandbox ( aWindow , { sandboxPrototype : aWindow , wantXrays : false , sandboxName : '' } ) ; _chromeSandbox . __namedArgs = this . curBrowser . elementManager . applyNamedArgs ( args ) ; _chromeSandbox . __marionetteParams = args ; _chromeSandbox . testUtils = utils ; marionette . exports . forEach ( function ( fn ) { try { _chromeSandbox [ fn ] = marionette [ fn ] . bind ( marionette ) ; } catch ( e ) { _chromeSandbox [ fn ] = marionette [ fn ] ; } } ) ; _chromeSandbox . isSystemMessageListenerReady = function ( ) { return systemMessageListenerReady ; } if ( specialPowers == true ) { loader . loadSubScript ( "chrome://specialpowers/content/specialpowersAPI.js" , _chromeSandbox ) ; loader . loadSubScript ( "chrome://specialpowers/content/SpecialPowersObserverAPI.js" , _chromeSandbox ) ; loader . loadSubScript ( "chrome://specialpowers/content/ChromePowers.js" , _chromeSandbox ) ; } return _chromeSandbox ; }
Returns a chrome sandbox that can be used by the execute_foo functions.
Returns a chrome sandbox that can be used by the execute_foo functions .