Created
February 3, 2021 16:40
-
-
Save ckerr/ee185d9555ecebdde611eb347eb7d212 to your computer and use it in GitHub Desktop.
gist of @t57ser's testcase for https://github.com/electron/electron/issues/27605
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<iframe src="http://www.orf.at"/> | |
</body> | |
<script> | |
</script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const electron = require("electron"); | |
function init() { | |
let browserWindow3 = new electron.BrowserWindow({ | |
show: true, | |
x: 500, | |
y: 100, | |
width: 900, | |
height: 900, | |
webPreferences: { | |
partition: "persist:test1" | |
} | |
}); | |
let browserWindow2 = new electron.BrowserWindow({ | |
show: true, | |
x: 500, | |
y: 100, | |
width: 900, | |
height: 900, | |
webPreferences: { | |
partition: "persist:test2" | |
} | |
}); | |
browserWindow2.webContents.loadURL("http://www.google.com") | |
browserWindow3.webContents.loadURL("http://localhost:9000/index.html").then(() => { | |
setTimeout(() => { | |
console.log("calling print to pdf"); | |
// Comment out this one to make the other one work | |
browserWindow3.webContents.printToPDF({ | |
}).then(() => { | |
console.log("done 1"); | |
}) | |
setTimeout(() => { | |
browserWindow2.webContents.printToPDF({ | |
}).then(() => { | |
console.log("done 2"); | |
}) | |
}, 2000); | |
}, 2000); | |
}); | |
} | |
electron.app.on("ready", () => { | |
init(); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "electron-quick-start", | |
"version": "1.0.0", | |
"description": "A minimal Electron application", | |
"main": "main.js", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"repository": "https://github.com/electron/electron-quick-start", | |
"keywords": [ | |
"Electron", | |
"quick", | |
"start", | |
"tutorial", | |
"demo" | |
], | |
"author": "GitHub", | |
"license": "CC0-1.0", | |
"devDependencies": { | |
"electron": "^11.2.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All of the Node.js APIs are available in the preload process. | |
// It has the same sandbox as a Chrome extension. | |
window.addEventListener('DOMContentLoaded', () => { | |
const replaceText = (selector, text) => { | |
const element = document.getElementById(selector) | |
if (element) element.innerText = text | |
} | |
for (const type of ['chrome', 'node', 'electron']) { | |
replaceText(`${type}-version`, process.versions[type]) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is required by the index.html file and will | |
// be executed in the renderer process for that window. | |
// No Node.js APIs are available in this process because | |
// `nodeIntegration` is turned off. Use `preload.js` to | |
// selectively enable features needed in the rendering | |
// process. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment