 +    }
 +    if (!this._pendingPromises.size)
 +      this._debugger.onPromiseSettled = undefined;
-+    this._debugger.removeDebuggee(destroyedContext._domWindow);
++    this._debugger.removeDebuggee(destroyedContext._contextGlobal);
 +    this._executionContexts.delete(destroyedContext._id);
-+    this._windowToExecutionContext.delete(destroyedContext._domWindow);
++    if (destroyedContext._domWindow)
++      this._windowToExecutionContext.delete(destroyedContext._domWindow);
 +    this._notifyExecutionContextDestroyed(destroyedContext);
 +  }
 +

+      helper.on(this._frameTree, 'navigationaborted', this._onNavigationAborted.bind(this)),
+      helper.on(this._frameTree, 'samedocumentnavigation', this._onSameDocumentNavigation.bind(this)),
+    ];
+  }
+
+  setInterceptFileChooserDialog({enabled}) {
+    this._docShell.fileInputInterceptionEnabled = !!enabled;
+  }
+
+  _filePickerShown(inputElement) {

+    this._docShell = docShell;
+    this._initialDPPX = docShell.contentViewer.overrideDPPX;
+    this._customScrollbars = null;
+
+    this._wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"].createInstance(Ci.nsIWorkerDebuggerManager);
+    this._wdmListener = {
+      QueryInterface: ChromeUtils.generateQI([Ci.nsIWorkerDebuggerManagerListener]),
+      onRegister: this._onWorkerCreated.bind(this),
+      onUnregister: this._onWorkerDestroyed.bind(this),
+    };
+
+    this._runtime.setOnErrorFromWorker((domWindow, message, stack) => {
+      const frame = this._frameTree.frameForDocShell(domWindow.docShell);
+      if (!frame)
+        return;
+      this._session.emitEvent('Page.uncaughtError', {
+        frameId: frame.id(),
+        message,
+        stack,
+      });
+    });
+  }
+
+  async awaitViewportDimensions({width, height}) {
