Skip to content

turning on nativeWindowOpen leads to nodeIntegration-like behavior #9928

Closed

Description

@WhiteFur
  • Electron version: 1.7.4
  • Operating system: macOS Sierra 10.12.1

I've turned off nodeIntegration to make jQuery work.
And nativeWindowOpen is true.
Whenever window.open or <a href="blablabla" target="_blank">,
and then window.location.href="blablablablabla" in the opened window, the window context is polluted by electron that jQuery failed.

main process:

  mainWindow = new BrowserWindow({
    webPreferences: {
      plugins: true,
      nodeIntegration: false,
      nativeWindowOpen: true,
    },
  });

app.on('browser-window-created', (event, window) => {
  window.webContents.on('new-window', function (event, url, frameName, disposition, options, additionalFeatures) {
    options.webPreferences.plugins = true;
    options.webPreferences.nodeIntegration = false;
    options.webPreferences.nativeWindowOpen = true;
  });
})

renderer process
html

 <a href="https://github.com/electron" target="_blank">blank localhost</a>

When the original html loaded, the window.require and window.module is undefined as expected.
But after running as below
js

window.location.href="https://electron.atom.io/"

window.require and window.module is not empty.

Activity

  1. changed the title [-]truning on nativeWindowOpen leads to nodeIntegration-like behavior[/-] [+]turning on nativeWindowOpen leads to nodeIntegration-like behavior[/+] on Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions