Source code

Revision control

Other Tools

1
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
"use strict";
6
7
var EXPORTED_SYMBOLS = ["SubframeCrashChild"];
8
9
let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
10
11
class SubframeCrashChild extends JSWindowActorChild {
12
receiveMessage(message) {
13
if (message.name == "SubframeCrashed") {
14
this.onSubframeCrashed(message.data.id);
15
}
16
}
17
18
onSubframeCrashed(browsingContextId) {
19
let bc = BrowsingContext.get(browsingContextId);
20
let iframe = bc.embedderElement;
21
let uri = Services.io.newURI(iframe.src);
22
iframe.removeAttribute("fission");
23
iframe.removeAttribute("src");
24
// Passing a null remoteType is currently how we tell the iframe to run
25
// in the same process as the embedder.
26
iframe.changeRemoteness({ remoteType: null });
27
let docShell = iframe.frameLoader.docShell;
28
docShell.displayLoadError(Cr.NS_ERROR_FRAME_CRASHED, uri, null);
29
}
30
}