fix: crash when using vm after window.open()
#37506
+35
−2
Closed
This check has been archived and is scheduled for deletion.
Learn more about checks retention
trop / Backportable? - 22-x-y
completed
Apr 6, 2023 in 31d 1h 3m 5s
Cancelled
This trop check was cancelled and can be ignored as this PR is no longer targeting this branch for a backport
Annotations
Check failure on line 180 in spec/guest-window-manager-spec.ts
trop / Backportable? - 22-x-y
spec/guest-window-manager-spec.ts#L180
Patch Conflict
Raw output
++<<<<<<< HEAD
+ it('can change webPreferences of child windows', (done) => {
++=======
+ it('does not crash when used in conjunction with the vm module', async () => {
+ const w = new BrowserWindow({
+ show: false,
+ webPreferences: {
+ contextIsolation: false,
+ nodeIntegration: true
+ }
+ });
+
+ await w.loadURL('about:blank');
+
+ const didCreateWindow = once(w.webContents, 'did-create-window');
+ w.webContents.executeJavaScript("window.open('')");
+ await didCreateWindow;
+
+ const result = await w.webContents.executeJavaScript(`
+ const vm = require('node:vm')
+ const run = () => {
+ const context = { x: 2 }
+ vm.createContext(context)
+ vm.runInContext('x += 40', context)
+ return context.x
+ }
+ run()
+ `);
+
+ expect(result).to.equal(42);
+ });
+
+ it('can change webPreferences of child windows', async () => {
++>>>>>>> fix: crash when using vm after window.open()