\n" +
13 | "Uploaded Date " +
14 | "ID " +
15 | " \n";
16 |
17 | var div = document.getElementById("crash_reporters");
18 | for (var i = 0; i < reporters.length; ++i) {
19 | table += showCrashReporter(reporters[i]);
20 | }
21 | div.innerHTML = table;
22 | document.getElementById('crash').onclick = function() {
23 | process.crash();
24 | }
25 | };
26 |
--------------------------------------------------------------------------------
/ReloadWebviewCrashes_1.4.5/backgroundLogs/1478606728037.log:
--------------------------------------------------------------------------------
1 | Tue Nov 08 2016 17:35:28 GMT+0530 (IST) :: ["Window got crashed reloading browser-window"]
2 |
--------------------------------------------------------------------------------
/ReloadWebviewCrashes_1.4.5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Crash Report
5 |
6 |
7 |
8 |
9 | Crash
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ReloadWebviewCrashes_1.4.5/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "crash-report-demo",
3 | "version" : "0.1.0",
4 | "main" : "main.js"
5 | }
6 |
--------------------------------------------------------------------------------
/RenderStalls/app.js:
--------------------------------------------------------------------------------
1 | var remote = require('remote');
2 | var currentWindow = remote.getCurrentWindow();
3 | var shell = require('shell');
4 |
5 | function log(txt, isError) {
6 | var lDom = document.createElement('span');
7 | lDom.innerHTML = txt;
8 | isError ? lDom.style.color = 'red' : false;
9 | document.querySelector('div').appendChild(lDom);
10 | document.querySelector('div').appendChild(document.createElement('br'));
11 | }
12 |
13 | onload = function() {
14 | log('Render get stalled when window is moved, from position Sample App');
15 | // currentWindow.maximize();
16 | }
--------------------------------------------------------------------------------
/RenderStalls/background.js:
--------------------------------------------------------------------------------
1 | var app = require('app');
2 | var BrowserWindow = require('browser-window');
3 | var mainWindow = null;
4 |
5 | app.commandLine.appendSwitch('remote-debugging-port', '9222'); // enabling remote debugging port
6 |
7 | app.on('ready', function() {
8 | mainWindow = new BrowserWindow({
9 | width: 800,
10 | height: 600,
11 | show: true,
12 | "min-height": 600,
13 | "min-width": 800,
14 | "fullscreen": false,
15 | "kiosk": false,
16 | focus: true
17 | });
18 | mainWindow.loadUrl('file://' + __dirname + '/renderStall.html');
19 | // mainWindow.toggleDevTools();
20 | mainWindow.show();
21 | });
--------------------------------------------------------------------------------
/RenderStalls/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main":"background.js",
3 | "name":"RenderStallingRepo",
4 | "version":"0.1.0"
5 | }
--------------------------------------------------------------------------------
/RenderStalls/renderStall.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Render Stalls during app "move"
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/electron_0.30.4_win_webview_crash/app.js:
--------------------------------------------------------------------------------
1 | onload = function() {
2 | document.querySelector('#withoutWebview').onclick = function(){
3 | /**
4 | * a.Crash the renderer
5 | * application will reload based on detection.
6 | */
7 | process.crash();
8 | };
9 |
10 | document.querySelector('#withWebview').onclick = function(){
11 | /**
12 | * a. Embed an dummy webview
13 | * b. crash the renderer
14 | */
15 | var google = document.createElement('webview');
16 | google.src = 'http://google.com';
17 | document.querySelector('#webviewHolder').appendChild(google);
18 |
19 | google.addEventListener('did-finish-load', function(e){
20 | app.log('Webview is Embedded, simulating crash in 5 seconds !!');
21 | app.write('Webview is Embedded, simulating crash in 5 seconds !!');
22 | setTimeout(process.crash,5000);
23 | });
24 | };
25 | }
26 |
27 | var ipc = require('ipc');
28 |
29 | var app = {
30 | name: 'RenderBehaviourApp',
31 | log: function() {
32 | var tmp = [];
33 | for (var i = arguments.length - 1; i >= 0; i--) {
34 | tmp[i] = arguments[i];
35 | };
36 | tmp.splice(0, 0, '[' + this.name + '] : ');
37 | console.debug.apply(console, tmp);
38 | },
39 | write : function( txt ){
40 | var p = document.createElement('p')
41 | p.innerHTML = txt;
42 | document.querySelector('#console').appendChild(p)
43 | },
44 | msgHandler: function(msg) {
45 | this.log('Message recieved : ', msg);
46 | if (msg && msg.eType) {
47 | switch (msg.eType) {
48 | case "crashed":
49 | {
50 | this.log('Application was crashed and restored back');
51 | break;
52 | }
53 | default:
54 | break;
55 | }
56 | }
57 | }
58 | };
59 |
60 | ipc.on('ElectronIPCMessage', app.msgHandler.bind(app));
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/electron_0.30.4_win_webview_crash/main.js:
--------------------------------------------------------------------------------
1 | var app = require('app');
2 | var BrowserWindow = require('browser-window');
3 | var Menu = require('menu');
4 |
5 | var mainWindow = null;
6 |
7 | app.on('ready', function() {
8 | mainWindow = new BrowserWindow({});
9 | mainWindow.loadUrl('file://' + __dirname + '/win_renderer_behaviour_crash.html');
10 | mainWindow.maximize();
11 | mainWindow.openDevTools();
12 |
13 | mainWindow.webContents.on('dom-ready', function() {
14 | mainWindow.send('ElectronIPCMessage', {
15 | eType: 'dom-ready',
16 | source: 'main'
17 | });
18 | });
19 |
20 | mainWindow.on('crashed', function() {
21 | /**
22 | * Successful detection
23 | * we might include snapshot to restore
24 | * the data / state of app.
25 | */
26 | mainWindow.reload();
27 | /**
28 | * Informational message to browser
29 | * window, we are unable to hook
30 | * main process js with node-inspector
31 | * so. just a small workaround to getinformation
32 | * to print.
33 | */
34 | // mainWindow.webContents.on('did-finish-load', function() {
35 | // mainWindow.send('ElectronIPCMessage', {
36 | // eType: 'Crashed',
37 | // source: 'main'
38 | // });
39 |
40 | // mainWindow.send('ElectronIPCMessage', {
41 | // eType: 'Reloaded',
42 | // source: 'main'
43 | // });
44 | // });
45 | });
46 | });
--------------------------------------------------------------------------------
/electron_0.30.4_win_webview_crash/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "chromium-args":"--remote-debugging-port=8888",
3 | "name":"WebviewCrashHandler",
4 | "main":"Main.js",
5 | "version":"0.0.1"
6 | }
--------------------------------------------------------------------------------
/electron_0.30.4_win_webview_crash/win_renderer_behaviour_crash.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Renderer Behaviour in WINDOWS with and without webview being embedded
8 | ( Note: MAC-OS exhibits same behaviour regardless on webview present or not )
9 | "Crash Without Webview Embedded" : Renderer turns white but background and application stays
10 | running we are able to detect and capture "crashed" event on BrowserWindowObject, hopefully atleast
11 | we can reload the application
12 |
13 | "Crash WITH Webview Embedded" : Entire application is closed
14 |
15 | Proposed Ideas :
16 | - Webview crash should not crash the BrowserWindow Render
17 | - Any way to stop the webview crash event to cancel bubbling up, as all webview events go till
18 | the embedder if we assume correctly, this might also be reason render crashing along with it. If in case
19 | webview crashes with any of the documented events like "crashed","gpu-crashed","plugin-crashed" .
20 | - Function to simulate webview.crash instead or process.crash in this example
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/sessionNotPersistent/app.js:
--------------------------------------------------------------------------------
1 | var remote = require('remote');
2 | var currentWindow = remote.getCurrentWindow();
3 | var shell = require('shell');
4 |
5 | function log(txt, isError) {
6 | var lDom = document.createElement('span');
7 | lDom.innerHTML = txt;
8 | isError ? lDom.style.color = 'red' : false;
9 | document.querySelector('div').appendChild(lDom);
10 | document.querySelector('div').appendChild(document.createElement('br'));
11 | }
12 |
13 | onload = function() {
14 | log('SessionNotPersisting Sample App');
15 | }
--------------------------------------------------------------------------------
/sessionNotPersistent/background.js:
--------------------------------------------------------------------------------
1 | var app = require('app');
2 | var BrowserWindow = require('browser-window');
3 | var mainWindow = null;
4 |
5 | app.commandLine.appendSwitch('remote-debugging-port', '9222'); // enabling remote debugging port
6 |
7 | app.on('ready', function() {
8 | mainWindow = new BrowserWindow({
9 | width: 800,
10 | height: 600,
11 | show: true,
12 | focus:true
13 | });
14 | mainWindow.loadUrl('file://' + __dirname + '/sessionTest.html');
15 | // mainWindow.toggleDevTools();
16 | mainWindow.show();
17 | });
--------------------------------------------------------------------------------
/sessionNotPersistent/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main":"background.js",
3 | "name":"SessionNotPersisting",
4 | "version":"0.1.0"
5 | }
--------------------------------------------------------------------------------
/sessionNotPersistent/sessionTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | SessionNotPersistent
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sessioncheck/app.js:
--------------------------------------------------------------------------------
1 | var webview = document.createElement('webview');
2 | webview.src = 'http://www.oauthlogin.com/home.php';
3 | webview.partition = 'persist:sessioncheck';
4 |
5 | onload = function(){
6 | document.body.appendChild(webview);
7 | }
--------------------------------------------------------------------------------
/sessioncheck/main.js:
--------------------------------------------------------------------------------
1 | var app = require('app');
2 | var BrowserWindow = require('browser-window');
3 | var mainWindow = null;
4 |
5 | app.commandLine.appendSwitch('remote-debugging-port', '9222'); // enabling remote debugging port
6 | app.on('ready', function() {
7 | mainWindow = new BrowserWindow({
8 | width: 1100,
9 | height: 900,
10 | show: true,
11 | focus:true
12 | });
13 | mainWindow.loadUrl('file://' + __dirname + '/render.html');
14 | mainWindow.show();
15 | });
--------------------------------------------------------------------------------
/sessioncheck/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main":"main.js",
3 | "name":"Sessioncheck",
4 | "version":"0.1.0"
5 | }
--------------------------------------------------------------------------------
/sessioncheck/render.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sessioncheck
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/willDownload/app.js:
--------------------------------------------------------------------------------
1 | var download = {
2 | register: function() {
3 | var win = require('remote').getCurrentWindow();
4 | var path = require('path');
5 | var shell = require('shell');
6 | var session = win.webContents.session;
7 | console.log('Registering listeners ');
8 | /*
9 | * Default Application's Downloads Path
10 | * replaced with system Downloads
11 | */
12 | session.once('will-download', function(event, item, webContents) {
13 | /*
14 | * This will not fire in electron engine v0.35.0 /mac
15 | *
16 | */
17 | console.log('Download Event firing');
18 | console.log('Received bytes in startup:', item.getReceivedBytes());
19 |
20 | item.on('updated', function() {
21 | console.log('Receiving bytes in stream: ' + item.getReceivedBytes());
22 | });
23 |
24 | item.on('done', function(e, state) {
25 | if (state == "completed") {
26 | var pathToFile = path.join(this.getDownloadFolder(), item.getFilename())
27 | console.log('Downloaded SuccessFully !!!!! ' + pathToFile);
28 | }
29 | }.bind(this));
30 |
31 | });
32 | }
33 | };
34 |
35 | onload = function() {
36 | download.register();
37 | }
--------------------------------------------------------------------------------
/willDownload/main.js:
--------------------------------------------------------------------------------
1 | var app = require('app'); // Module to control application life.
2 | var BrowserWindow = require('browser-window'); // Module to create native browser window.
3 |
4 | var win= null;
5 | app.on('ready', function() {
6 | win = new BrowserWindow({width: 1000, height: 700});
7 | win.loadURL('file://' + __dirname + '/testDownload.html');
8 | win.openDevTools();
9 | });
10 |
--------------------------------------------------------------------------------
/willDownload/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "downLoadTestApp",
3 | "version" : "0.1.0",
4 | "main" : "main.js"
5 | }
--------------------------------------------------------------------------------
/willDownload/testDownload.html:
--------------------------------------------------------------------------------
1 |
2 | Download test
3 |
4 | Click to download
5 |
6 |
7 |
--------------------------------------------------------------------------------