summaryrefslogtreecommitdiffstats
path: root/remote/cdp/domains/parent/Browser.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /remote/cdp/domains/parent/Browser.sys.mjs
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'remote/cdp/domains/parent/Browser.sys.mjs')
-rw-r--r--remote/cdp/domains/parent/Browser.sys.mjs40
1 files changed, 40 insertions, 0 deletions
diff --git a/remote/cdp/domains/parent/Browser.sys.mjs b/remote/cdp/domains/parent/Browser.sys.mjs
new file mode 100644
index 0000000000..ecf93d4d8d
--- /dev/null
+++ b/remote/cdp/domains/parent/Browser.sys.mjs
@@ -0,0 +1,40 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs";
+
+export class Browser extends Domain {
+ getVersion() {
+ const { isHeadless } = Cc["@mozilla.org/gfx/info;1"].getService(
+ Ci.nsIGfxInfo
+ );
+ const { userAgent } = Cc[
+ "@mozilla.org/network/protocol;1?name=http"
+ ].getService(Ci.nsIHttpProtocolHandler);
+ return {
+ jsVersion: Services.appinfo.version,
+ protocolVersion: "1.3",
+ product:
+ (isHeadless ? "Headless" : "") +
+ `${Services.appinfo.name}/${Services.appinfo.version}`,
+ revision: Services.appinfo.sourceURL.split("/").pop(),
+ userAgent,
+ };
+ }
+
+ close() {
+ // Notify all windows that an application quit has been requested.
+ const cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(
+ Ci.nsISupportsPRBool
+ );
+ Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
+
+ // If the shutdown of the application is prevented force quit it instead.
+ const mode = cancelQuit.data
+ ? Ci.nsIAppStartup.eForceQuit
+ : Ci.nsIAppStartup.eAttemptQuit;
+
+ Services.startup.quit(mode);
+ }
+}