Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash when using vm after window.open() #37506

Closed
wants to merge 1 commit into from

fix: crash when using vm after window.open()

0ff6c2a
Select commit
Failed to load commit list.
Closed

fix: crash when using vm after window.open() #37506

fix: crash when using vm after window.open()
0ff6c2a
Select commit
Failed to load commit list.
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

See this annotation in the file changed.

@trop 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()