electron/spec/fixtures/api/native-window-open.html
2017-04-06 11:43:57 +09:00

30 lines
839 B
HTML

<html>
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require("electron");
const tests = {
'blank': () => {
const popup = window.open();
popup.document.write('<h1>Hello</h1>');
const content = popup.document.querySelector('h1').innerText;
ipcRenderer.send('answer', content);
},
'file': () => {
const popup = window.open('native-window-open-child.html');
popup.onload = () => {
const content = popup.document.querySelector('h1').innerText;
ipcRenderer.send('answer', content);
};
},
'native-addon': () => {
const runas = require('runas');
ipcRenderer.send('answer', typeof runas);
}
}
const test = location.hash.slice(1);
if (tests.hasOwnProperty(test)) {
tests[test]();
}
</script>
</body>
</html>