fix: illegal access errors with nodeIntegrationInSubFrames (#29093)
This commit is contained in:
parent
4073599f59
commit
b7a23450b7
6 changed files with 104 additions and 4 deletions
29
spec-main/fixtures/crash-cases/js-execute-iframe/index.html
Normal file
29
spec-main/fixtures/crash-cases/js-execute-iframe/index.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<html>
|
||||
<body>
|
||||
<iframe id="mainframe"></iframe>
|
||||
<script>
|
||||
const net = require('net');
|
||||
const path = require('path');
|
||||
|
||||
document.getElementById("mainframe").src="./page2.html";
|
||||
|
||||
const p = process.platform === 'win32'
|
||||
? path.join('\\\\?\\pipe', process.cwd(), 'myctl')
|
||||
: '/tmp/echo.sock';
|
||||
|
||||
const client = net.createConnection({ path: p }, () => {
|
||||
console.log('connected to server');
|
||||
client.write('world!\r\n');
|
||||
});
|
||||
|
||||
client.on('data', (data) => {
|
||||
console.log(data.toString());
|
||||
client.end();
|
||||
});
|
||||
|
||||
client.on('end', () => {
|
||||
console.log('disconnected from server');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
51
spec-main/fixtures/crash-cases/js-execute-iframe/index.js
Normal file
51
spec-main/fixtures/crash-cases/js-execute-iframe/index.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
const { app, BrowserWindow } = require('electron');
|
||||
const net = require('net');
|
||||
const path = require('path');
|
||||
|
||||
function createWindow () {
|
||||
const mainWindow = new BrowserWindow({
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
nodeIntegrationInSubFrames: true
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.loadFile('index.html');
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow();
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
||||
});
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit();
|
||||
});
|
||||
|
||||
const server = net.createServer((c) => {
|
||||
console.log('client connected');
|
||||
|
||||
c.on('end', () => {
|
||||
console.log('client disconnected');
|
||||
app.quit();
|
||||
});
|
||||
|
||||
c.write('hello\r\n');
|
||||
c.pipe(c);
|
||||
});
|
||||
|
||||
server.on('error', (err) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
const p = process.platform === 'win32'
|
||||
? path.join('\\\\?\\pipe', process.cwd(), 'myctl')
|
||||
: '/tmp/echo.sock';
|
||||
|
||||
server.listen(p, () => {
|
||||
console.log('server bound');
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>HELLO</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue