B2G/gecko/toolkit/devtools/webconsole/dbg-webconsole-actors.js
/**
   * Evaluates a string in the sandbox.
   *
   * @param string aString
   *        String to evaluate in the sandbox.
   * @return mixed
   *         The result of the evaluation.
   */
Evaluates a string in the sandbox.
@param string aString
String to evaluate in the sandbox.
@return mixed
The result of the evaluation.
Evaluates a string in the sandbox . @param string aString String to evaluate in the sandbox . @return mixed The result of the evaluation .
function WCA_evalInSandbox(aString)
  {
    if (this._sandboxLocation !== this.window.location) {
      this._createSandbox();
    }
    if (aString.trim() == "help" || aString.trim() == "?") {
      aString = "help()";
    }
    let window = WebConsoleUtils.unwrap(this.sandbox.window);
    let $ = null, $$ = null;
    if (typeof window.$ == "function") {
      $ = this.sandbox.$;
      delete this.sandbox.$;
    }
    if (typeof window.$$ == "function") {
      $$ = this.sandbox.$$;
      delete this.sandbox.$$;
    }
    let result = Cu.evalInSandbox(aString, this.sandbox, "1.8",
                                  "Web Console", 1);
    if ($) {
      this.sandbox.$ = $;
    }
    if ($$) {
      this.sandbox.$$ = $$;
    }
    return result;
  }
function WCA_evalInSandbox ( aString ) { if ( this . _sandboxLocation !== this . window . location ) { this . _createSandbox ( ) ; } if ( aString . trim ( ) == "help" || aString . trim ( ) == "?" ) { aString = "help()" ; } let window = WebConsoleUtils . unwrap ( this . sandbox . window ) ; let $ = null , $$ = null ; if ( typeof window . $ == "function" ) { $ = this . sandbox . $ ; delete this . sandbox . $ ; } if ( typeof window . $$ == "function" ) { $$ = this . sandbox . $$ ; delete this . sandbox . $$ ; } let result = Cu . evalInSandbox ( aString , this . sandbox , "1.8" , "Web Console" , 1 ) ; if ( $ ) { this . sandbox . $ = $ ; } if ( $$ ) { this . sandbox . $$ = $$ ; } return result ; }
Evaluates a string in the sandbox.
Evaluates a string in the sandbox .
// If the user changed to a different location, we need to update the // sandbox. // The help function needs to be easy to guess, so we make the () optional // We prefer to execute the page-provided implementations for the $() and // $$() functions.