1
0
Fork 0
firefox/js/xpconnect/tests/unit/test_sandbox_name.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

26 lines
564 B
JavaScript

"use strict";
/**
* Test that the name of a sandbox contains the name of all principals.
*/
function test_sandbox_name() {
let names = [
"http://example.com/?" + Math.random(),
"http://example.org/?" + Math.random()
];
let sandbox = Cu.Sandbox(names);
let fileName = Cu.evalInSandbox(
"(new Error()).fileName",
sandbox,
"latest" /*js version*/,
""/*file name*/
);
for (let name of names) {
Assert.ok(fileName.includes(name), `Name ${name} appears in ${fileName}`);
}
};
function run_test() {
test_sandbox_name();
}