summaryrefslogtreecommitdiffstats
path: root/dom/ipc/tests/process_error.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/ipc/tests/process_error.xhtml
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/ipc/tests/process_error.xhtml')
-rw-r--r--dom/ipc/tests/process_error.xhtml58
1 files changed, 58 insertions, 0 deletions
diff --git a/dom/ipc/tests/process_error.xhtml b/dom/ipc/tests/process_error.xhtml
new file mode 100644
index 0000000000..7760b3e516
--- /dev/null
+++ b/dom/ipc/tests/process_error.xhtml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ orient="vertical">
+
+ <browser id="thebrowser" type="content" remote="true" />
+ <script type="application/javascript"><![CDATA[
+ const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
+
+ const ok = window.arguments[0].ok;
+ const is = window.arguments[0].is;
+ const done = window.arguments[0].done;
+ const SimpleTest = window.arguments[0].SimpleTest;
+
+ // Parse test options.
+ const url = new URL(document.location);
+ const crashType = url.searchParams.get("crashType");
+
+ // Allow the browser to get connected before using the messageManager to cause
+ // a crash:
+ addEventListener("DOMContentLoaded", () => {
+ let browser = document.getElementById('thebrowser');
+
+ let observerPromise = new Promise(resolve => {
+ let crashObserver = (subject, topic, data) => {
+ is(topic, 'ipc:content-shutdown', 'Received correct observer topic.');
+ ok(subject instanceof Ci.nsIPropertyBag2,
+ 'Subject implements nsIPropertyBag2.');
+
+ var dumpID;
+ if ('nsICrashReporter' in Ci) {
+ dumpID = subject.getPropertyAsAString('dumpID');
+ ok(dumpID, "dumpID is present and not an empty string");
+ }
+
+ Services.obs.removeObserver(crashObserver, 'ipc:content-shutdown');
+ resolve();
+ }
+
+ Services.obs.addObserver(crashObserver, 'ipc:content-shutdown');
+ });
+
+ let browsingContextId = browser.frameLoader.browsingContext.id;
+
+ let eventFiredPromise = BrowserTestUtils.waitForEvent(browser, "oop-browser-crashed");
+ let eventPromise = eventFiredPromise.then(event => {
+ is(event.browsingContextId, browsingContextId,
+ "Expected the right browsing context id on the oop-browser-crashed event.");
+ })
+
+ BrowserTestUtils.crashFrame(browser, true, false, /* Default browsing context */ null, { crashType });
+
+ Promise.all([observerPromise, eventPromise]).then(done);
+ });
+ ]]></script>
+
+</window>