- Electron version: 1.2.6
- Operating system: Windows 7 x64

I've made a simple app that gets a file with URL list, load every URL in the main window, make a full screenshot and save it in the `img` subdirectory as PNG. Here is all the test code:

`package.json`

``` json
{
  "name": "electron-screenshots",
  "main": "screenshots.win.js"
}
```

`screenshots.urls.txt`

```
http://json.org/json-de.html
http://json.org/json-en.html
http://json.org/json-fr.html
```

`screenshots.win.js`

``` js
/******************************************************************************/
'use strict';
/******************************************************************************/
const fs = require('fs');
const path = require('path');
const rl = require('readline');
const { app, BrowserWindow } = require('electron');
/******************************************************************************/
const imgPath = path.join(__dirname, 'img');
const urls = [];
const timeoutFromLoad = 100;
const timeoutFromResize = 100;

let   mainWindow;
let   i = 0;
/******************************************************************************/
app.disableHardwareAcceleration();
if (!fs.readdirSync(__dirname).includes('img')) fs.mkdirSync(imgPath);
app.once('ready', createWindow);
/******************************************************************************/
function createWindow() {
  mainWindow = new BrowserWindow({
    enableLargerThanScreen: true,
    webPreferences: {
      nodeIntegration: false,
    },
  });
  mainWindow.setMenu(null);
  mainWindow.webContents.on('did-finish-load', () => {
    setTimeout(saveDoc, timeoutFromLoad);
  });
  getURLs();
}
/******************************************************************************/
function getURLs() {
  rl.createInterface({
    input: fs.createReadStream(
      path.join(__dirname, 'screenshots.urls.txt'), { encoding: 'utf8' }
    ),
  }).on('line', line => {
    line = line.trim();
    if (line) urls.push(line);
  }).on('close', getDoc);
}
/******************************************************************************/
function getDoc() {
  if (urls.length) mainWindow.loadURL(urls.shift());
  else console.log('All done.');
}
/******************************************************************************/
function saveDoc() {
  mainWindow.webContents.executeJavaScript(
    `[document.documentElement.scrollWidth, document.documentElement.scrollHeight]`,
    false, result => {
      mainWindow.setContentSize(result[0], result[1]);
      setTimeout(() => {
        mainWindow.capturePage(img => {
          fs.writeFileSync(path.join(imgPath, `${++i}.png`), img.toPNG());
          console.log(`${mainWindow.webContents.getURL()} saved.`);
          getDoc();
        });
      }, timeoutFromResize);
    }
  );
}
/******************************************************************************/
```

This code works fine. Here are some found verifiable issues:
1. If I does not disable hardware acceleration, I get an empty window after resize and empty images after screenshots saving. To verify: comment out `app.disableHardwareAcceleration();`.
2. If I does not add timeout after `setContentSize`, I get the first image with distorted proportions (other images are OK because they do not need resize after the first resize). To verify: set `timeoutFromResize` to `0`.
3. If I does not add timeout after `did-finish-load` fired, I get images with lacunas (no page `img` elements, aborted text an so on). Sometimes I get PNG with 0 bytes. It seems that for `capturePage` to work properly, a user need an event like `document-painted` or `document-rendered`. To verify: set `timeoutFromLoad` to `0`, comment out `app.disableHardwareAcceleration();`, comment out or delete all the resize code, i.e. just make `saveDoc()` like this:
   
   ``` js
   function saveDoc() {
     mainWindow.capturePage(img => {
       fs.writeFileSync(path.join(imgPath, `${++i}.png`), img.toPNG());
       console.log(`${mainWindow.webContents.getURL()} saved.`);
       getDoc();
     });
   }
   ```

atom/browser/api/atom_api_web_contents.cc
#include "atom/browser/api/atom_api_web_contents.h"
#include <set>
#include <string>
#include "atom/browser/api/atom_api_debugger.h"
#include "atom/browser/api/atom_api_session.h"
#include "atom/browser/api/atom_api_window.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_security_state_model_client.h"
#include "atom/browser/lib/bluetooth_chooser.h"
#include "atom/browser/native_window.h"
#include "atom/browser/net/atom_network_delegate.h"
#include "atom/browser/ui/drag_util.h"