Merge pull request #9278 from electron/dont-override-argument-value

Disable node integration in chrome-devtools URLs
This commit is contained in:
Kevin Sawicki 2017-04-26 09:08:24 -07:00 committed by GitHub
commit 4e7e9d1752
2 changed files with 15 additions and 1 deletions

View file

@ -78,7 +78,7 @@ for (let arg of process.argv) {
if (window.location.protocol === 'chrome-devtools:') {
// Override some inspector APIs.
require('./inspector')
nodeIntegration = 'true'
nodeIntegration = 'false'
} else if (window.location.protocol === 'chrome-extension:') {
// Add implementations of chrome API.
require('./chrome-api').injectTo(window.location.hostname, isBackgroundPage, window)

View file

@ -229,6 +229,20 @@ describe('chromium feature', function () {
b = window.open(windowUrl, '', 'nodeIntegration=no,show=no')
})
it('disables node integration when it is disabled on the parent window for chrome devtools URLs', function (done) {
var b
app.once('web-contents-created', (event, contents) => {
contents.once('did-finish-load', () => {
contents.executeJavaScript('typeof process').then((typeofProcessGlobal) => {
assert.equal(typeofProcessGlobal, 'undefined')
b.close()
done()
}).catch(done)
})
})
b = window.open('chrome-devtools://devtools/bundled/inspector.html', '', 'nodeIntegration=no,show=no')
})
it('disables JavaScript when it is disabled on the parent window', function (done) {
var b
app.once('web-contents-created', (event, contents) => {