Skip to content

Commit

Permalink
Bug 1921759: Restart Windows Explorer at start of browser_bookmark_co…
Browse files Browse the repository at this point in the history
…py_folder_tree.js a=dmeehan

In a new Windows update, explorer.exe is grabs the clipboard mutex and holds
it for a long time, which is causing test failures.  Killing explorer.exe
restarts it and forces it to give up the mutex, allowing the test to pass.
  • Loading branch information
Ponchale committed Nov 27, 2024
1 parent d73f93f commit dd6f11a
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,33 @@ add_task(async function () {
await PlacesUtils.bookmarks.eraseEverything();
});

if (AppConstants.platform === "win") {
if (Services.env.get("MOZ_AUTOMATION")) {
// When running in CI, pre-emptively kill Windows Explorer, using system
// from the standard library, since it sometimes holds the clipboard for
// long periods, thereby breaking the test (bug 1921759).
const { ctypes } = ChromeUtils.importESModule(
"resource://gre/modules/ctypes.sys.mjs"
);
let libc = ctypes.open("ucrtbase.dll");
let exec = libc.declare(
"system",
ctypes.default_abi,
ctypes.int,
ctypes.char.ptr
);
let rv = exec(
'"powershell -command "&{&Stop-Process -ProcessName explorer}"'
);
libc.close();
is(rv, 0, "Launched powershell to stop explorer.exe");
} else {
info(
"Skipping terminating Windows Explorer since we are not running in automation"
);
}
}

await withSidebarTree("bookmarks", async function (tree) {
const selectedNodeComparator = {
equalTitle: itemNode => {
Expand Down

0 comments on commit dd6f11a

Please sign in to comment.