Created
March 31, 2025 14:20
-
-
Save juliandescottes/ef9139eb9b6cb73a69eb2317dea4a6b6 to your computer and use it in GitHub Desktop.
Add simple browserConsole moz:module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Julian Descottes <[email protected]> | |
# Date 1743094445 -3600 | |
# Thu Mar 27 17:54:05 2025 +0100 | |
# Node ID e415e9cb08dc5ca94fb3a81af07e5a22c30bf90a | |
# Parent 882dc1e20711a4d5a4c7fd55e6733086c985f973 | |
XXX Add simple browserConsole moz:module | |
diff --git a/remote/webdriver-bidi/jar.mn b/remote/webdriver-bidi/jar.mn | |
--- a/remote/webdriver-bidi/jar.mn | |
+++ b/remote/webdriver-bidi/jar.mn | |
@@ -28,6 +28,9 @@ remote.jar: | |
content/webdriver-bidi/modules/root/storage.sys.mjs (modules/root/storage.sys.mjs) | |
content/webdriver-bidi/modules/root/webExtension.sys.mjs (modules/root/webExtension.sys.mjs) | |
+ # WebDriver BiDi root moz modules | |
+ content/webdriver-bidi/modules/root/moz/browserConsole.sys.mjs (modules/root/moz/browserConsole.sys.mjs) | |
+ | |
# WebDriver BiDi windowglobal modules | |
content/webdriver-bidi/modules/windowglobal/_configuration.sys.mjs (modules/windowglobal/_configuration.sys.mjs) | |
content/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs (modules/windowglobal/browsingContext.sys.mjs) | |
diff --git a/remote/webdriver-bidi/modules/ModuleRegistry.sys.mjs b/remote/webdriver-bidi/modules/ModuleRegistry.sys.mjs | |
--- a/remote/webdriver-bidi/modules/ModuleRegistry.sys.mjs | |
+++ b/remote/webdriver-bidi/modules/ModuleRegistry.sys.mjs | |
@@ -36,6 +36,12 @@ ChromeUtils.defineESModuleGetters(module | |
}); | |
// eslint-disable-next-line mozilla/lazy-getter-object-name | |
+ChromeUtils.defineESModuleGetters(modules.root.moz, { | |
+ browserConsole: | |
+ "chrome://remote/content/webdriver-bidi/modules/root/moz/browserConsole.sys.mjs", | |
+}); | |
+ | |
+// eslint-disable-next-line mozilla/lazy-getter-object-name | |
ChromeUtils.defineESModuleGetters(modules["windowglobal-in-root"], { | |
browsingContext: | |
"chrome://remote/content/webdriver-bidi/modules/windowglobal-in-root/browsingContext.sys.mjs", | |
diff --git a/remote/webdriver-bidi/modules/root/moz/browserConsole.sys.mjs b/remote/webdriver-bidi/modules/root/moz/browserConsole.sys.mjs | |
new file mode 100644 | |
--- /dev/null | |
+++ b/remote/webdriver-bidi/modules/root/moz/browserConsole.sys.mjs | |
@@ -0,0 +1,17 @@ | |
+/* 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 { RootBiDiModule } from "chrome://remote/content/webdriver-bidi/modules/RootBiDiModule.sys.mjs"; | |
+ | |
+class BrowserConsoleModule extends RootBiDiModule { | |
+ destroy() {} | |
+ | |
+ evaluate(params) { | |
+ const systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal(); | |
+ const chromeSb = new Cu.Sandbox(systemPrincipal); | |
+ return Cu.evalInSandbox(params.expression, chromeSb); | |
+ } | |
+} | |
+ | |
+export const browserConsole = BrowserConsoleModule; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment