constructor()

in packages/core/browser-vm/src/Context.js [40:64]


  constructor(conf, frame) {
    this.location = new Location(frame.contentWindow.location);
    this.history = new History(conf.id, frame.contentWindow);
    this.window = new Window(conf, this, frame, location);
    this.allowResources = conf.allowResources || [];

    let { body } = conf;
    const { disableBody } = conf;

    if (disableBody) {
      body = document.body;
    } else if (!body) {
      body = document.createElement('div');
      document.documentElement.appendChild(body);
    }

    this.body = body;
    this.document = new Document({
      enableScriptEscape: true,
      ...conf,
    }, this, frame, location);
    this.baseFrame = frame;
    this._listenerMap = new Map();
    this.window.__IS_CONSOLE_OS_CONTEXT__ = true;
  }