chore: make "nodeIntegration" and "webviewTag" default to false (#16235)
This commit is contained in:
		
					parent
					
						
							
								cdf4bfa68f
							
						
					
				
			
			
				commit
				
					
						fade3eb679
					
				
			
		
					 23 changed files with 261 additions and 140 deletions
				
			
		| 
						 | 
				
			
			@ -38,7 +38,7 @@ const parseOption = function (name, defaultValue, converter = value => value) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
const contextIsolation = hasSwitch('context-isolation')
 | 
			
		||||
let nodeIntegration = hasSwitch('node-integration')
 | 
			
		||||
const nodeIntegration = hasSwitch('node-integration')
 | 
			
		||||
const webviewTag = hasSwitch('webview-tag')
 | 
			
		||||
const isHiddenPage = hasSwitch('hidden-page')
 | 
			
		||||
const isBackgroundPage = hasSwitch('background-page')
 | 
			
		||||
| 
						 | 
				
			
			@ -64,14 +64,11 @@ if (contextIsolation) {
 | 
			
		|||
if (window.location.protocol === 'chrome-devtools:') {
 | 
			
		||||
  // Override some inspector APIs.
 | 
			
		||||
  require('@electron/internal/renderer/inspector')
 | 
			
		||||
  nodeIntegration = false
 | 
			
		||||
} else if (window.location.protocol === 'chrome-extension:') {
 | 
			
		||||
  // Add implementations of chrome API.
 | 
			
		||||
  require('@electron/internal/renderer/chrome-api').injectTo(window.location.hostname, isBackgroundPage, window)
 | 
			
		||||
  nodeIntegration = false
 | 
			
		||||
} else if (window.location.protocol === 'chrome:') {
 | 
			
		||||
  // Disable node integration for chrome UI scheme.
 | 
			
		||||
  nodeIntegration = false
 | 
			
		||||
} else {
 | 
			
		||||
  // Override default web functions.
 | 
			
		||||
  require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue