Preserve uncertain remote commits and destructive source-cleanup requirements across cancellation, persistence failures, retries, and restart recovery. Revalidate account availability after admission waits and prevent late upload results from bypassing cancellation state. Strengthen release argument, CI tag, source allowlist, and secret scanning gates. Run the Electron smoke suite in a fully hidden offscreen harness that cannot reveal, focus, or elevate native windows.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
function installHiddenElectronWindowHarness({ BrowserWindow, targetGlobal = globalThis }) {
|
||||
const requestedAlwaysOnTop = new WeakMap();
|
||||
const createdWindows = new Set();
|
||||
|
||||
class HiddenBrowserWindow extends BrowserWindow {
|
||||
constructor(options = {}) {
|
||||
super({
|
||||
...options,
|
||||
show: false,
|
||||
focusable: false,
|
||||
skipTaskbar: true,
|
||||
alwaysOnTop: false,
|
||||
paintWhenInitiallyHidden: true,
|
||||
webPreferences: {
|
||||
...(options.webPreferences || {}),
|
||||
offscreen: true,
|
||||
backgroundThrottling: false
|
||||
}
|
||||
});
|
||||
createdWindows.add(this);
|
||||
if (typeof this.setIgnoreMouseEvents === 'function') this.setIgnoreMouseEvents(true);
|
||||
}
|
||||
|
||||
show() {}
|
||||
showInactive() {}
|
||||
focus() {}
|
||||
restore() {}
|
||||
moveTop() {}
|
||||
|
||||
setAlwaysOnTop(value) {
|
||||
requestedAlwaysOnTop.set(this, Boolean(value));
|
||||
}
|
||||
|
||||
isAlwaysOnTop() {
|
||||
return requestedAlwaysOnTop.get(this) === true;
|
||||
}
|
||||
}
|
||||
|
||||
targetGlobal.__mhuBrowserWindowConstructor = HiddenBrowserWindow;
|
||||
|
||||
return {
|
||||
getWindows() {
|
||||
return [...createdWindows].filter(window => typeof window.isDestroyed !== 'function' || !window.isDestroyed());
|
||||
},
|
||||
isAlwaysOnTopRequested(window) {
|
||||
return requestedAlwaysOnTop.get(window) === true;
|
||||
},
|
||||
isNativeSurfaceSuppressed(window) {
|
||||
return window.isVisible() === false && window.isFocused() === false;
|
||||
},
|
||||
areNativeSurfacesSuppressed(windows) {
|
||||
return windows.every(window => window.isVisible() === false && window.isFocused() === false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { installHiddenElectronWindowHarness };
|
||||
Reference in New Issue
Block a user