fix: crash loading about:blank in subframes (35-x-y) (#45758)

* fix: crash loading `about:blank` in subframes (#45694)

fix: crash loading about:blank in subframes

* chore: e patches all

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
Charles Kerr 2025-02-23 04:42:51 -06:00 committed by GitHub
parent 768daef27b
commit 0a543f389d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 10 deletions

View file

@ -217,6 +217,40 @@ describe('renderer nodeIntegrationInSubFrames', () => {
});
});
describe('subframe with non-standard schemes', () => {
it('should not crash when changing subframe src to about:blank and back', async () => {
const w = new BrowserWindow({ show: false, width: 400, height: 400 });
const fwfPath = path.resolve(__dirname, 'fixtures/sub-frames/frame-with-frame.html');
await w.loadFile(fwfPath);
const originalSrc = await w.webContents.executeJavaScript(`
const iframe = document.querySelector('iframe');
iframe.src;
`);
const updatedSrc = await w.webContents.executeJavaScript(`
new Promise((resolve, reject) => {
const iframe = document.querySelector('iframe');
iframe.src = 'about:blank';
resolve(iframe.src);
})
`);
expect(updatedSrc).to.equal('about:blank');
const restoredSrc = await w.webContents.executeJavaScript(`
new Promise((resolve, reject) => {
const iframe = document.querySelector('iframe');
iframe.src = '${originalSrc}';
resolve(iframe.src);
})
`);
expect(restoredSrc).to.equal(originalSrc);
});
});
// app.getAppMetrics() does not return sandbox information on Linux.
ifdescribe(process.platform !== 'linux')('cross-site frame sandboxing', () => {
let server: http.Server;