Window.chrome object is undefined


#1

I want to measuring First Paint Time with Electron. A close approximation is available in Chrome called window.chrome.loadTimes(), which returnsan object.

But with Electron window.chrome object is undefined.

I do this

var app = require('app');
var BrowserWindow = require('browser-window');
var mainWindow = null;

app.on('ready', function() { 
    var preloadJS = __dirname + '/TestPreloadJS.js'
    mainWindow = new BrowserWindow({width: 800, height: 600, show: true, preload: preloadJS}); 
    mainWindow.loadUrl('http://crawlbin.com/');
    mainWindow.openDevTools();

    mainWindow.on('closed', function() {
        mainWindow = null;
    }); 
    
    mainWindow.webContents.on('dom-ready', function() {
        mainWindow.webContents.executeJavaScript("console.log(process.versions['electron'])");
        mainWindow.webContents.executeJavaScript("console.log('Chrome version: ' + getChromeVersion())");
        mainWindow.webContents.executeJavaScript("console.log('window.chrome:' + window.chrome)");
    });
    
});

That display
[4792:0115/150607:INFO:renderer_main.cc(200)] Renderer process started
[456:0115/150608:INFO:renderer_main.cc(200)] Renderer process started
[4776:0115/150608:INFO:CONSOLE(1)] “0.31.0”, source: (1)
[4776:0115/150608:INFO:CONSOLE(1)] “Chrome version: 44”, source: (1)
[4776:0115/150608:INFO:CONSOLE(1)] “window.chrome:undefined”, source: (1)