B2G/gecko/browser/devtools/scratchpad/scratchpad.js
/**
   * Get the Cu.Sandbox object for the active tab content window object. Note
   * that the returned object is cached for later reuse. The cached object is
   * kept only for the current location in the current tab of the current
   * browser window and it is reset for each context switch,
   * navigator:browser window switch, tab switch or navigation.
   */
Get the Cu.Sandbox object for the active tab content window object. Note
that the returned object is cached for later reuse. The cached object is
kept only for the current location in the current tab of the current
browser window and it is reset for each context switch,
navigator:browser window switch, tab switch or navigation.
Get the Cu . Sandbox object for the active tab content window object . Note that the returned object is cached for later reuse . The cached object is kept only for the current location in the current tab of the current browser window and it is reset for each context switch navigator : browser window switch tab switch or navigation .
get contentSandbox()
  {
    if (!this.browserWindow) {
      Cu.reportError(this.strings.
                     GetStringFromName("browserWindow.unavailable"));
      return;
    }
    if (!this._contentSandbox ||
        this.browserWindow != this._previousBrowserWindow ||
        this._previousBrowser != this.gBrowser.selectedBrowser ||
        this._previousLocation != this.gBrowser.contentWindow.location.href) {
      let contentWindow = this.gBrowser.selectedBrowser.contentWindow;
      this._contentSandbox = new Cu.Sandbox(contentWindow,
        { sandboxPrototype: contentWindow, wantXrays: false, 
          sandboxName: 'scratchpad-content'});
      this._contentSandbox.__SCRATCHPAD__ = this;
      this._previousBrowserWindow = this.browserWindow;
      this._previousBrowser = this.gBrowser.selectedBrowser;
      this._previousLocation = contentWindow.location.href;
    }
    return this._contentSandbox;
  }
get contentSandbox ( ) { if ( ! this . browserWindow ) { Cu . reportError ( this . strings . GetStringFromName ( "browserWindow.unavailable" ) ) ; return ; } if ( ! this . _contentSandbox || this . browserWindow != this . _previousBrowserWindow || this . _previousBrowser != this . gBrowser . selectedBrowser || this . _previousLocation != this . gBrowser . contentWindow . location . href ) { let contentWindow = this . gBrowser . selectedBrowser . contentWindow ; this . _contentSandbox = new Cu . Sandbox ( contentWindow , { sandboxPrototype : contentWindow , wantXrays : false , sandboxName : 'scratchpad-content' } ) ; this . _contentSandbox . __SCRATCHPAD__ = this ; this . _previousBrowserWindow = this . browserWindow ; this . _previousBrowser = this . gBrowser . selectedBrowser ; this . _previousLocation = contentWindow . location . href ; } return this . _contentSandbox ; }
Get the Cu.Sandbox object for the active tab content window object.
Get the Cu . Sandbox object for the active tab content window object .