- Electron version: 0.37.2
- Operating system: OS X 10.11.3 

https://github.com/atom/electron/pull/4700 added support for the `visibilitychange` event (thank you @zcbenz!), but that event doesn't make its way into `<webview>`s, which are always "visible" regardless of their host page's `document.visibilityState`.

Tested using the following setup

Host page:

``` coffee
console.log "<webview> host page initial visibilityState =", document.visibilityState

document.addEventListener "visibilitychange", ->
  console.log "<webview> host page visibilitychange event, visibilityState =", document.visibilityState
```

`<webview>`:

``` coffee
console.log "<webview> initial visibilityState =", document.visibilityState

addEventListener "visibilitychange", ->
  console.log "<webview> visibilitychange, visibilityState =", document.visibilityState

setInterval ->
  console.log "<webview> visibilityState =", document.visibilityState
, 3000
```

Host page logs:

```
<webview> host page initial visibilityState = visible
<webview> host page visibilitychange event, visibilityState = hidden
<webview> host page visibilitychange event, visibilityState = visible
```

`<webview>` logs:

```
<webview> initial visibilityState = visible
(24) <webview> visibilityState = visible
```

atom/browser/web_view_manager.cc
int owner_process_id,
    int element_instance_id) {
  ElementInstanceKey key(owner_process_id, element_instance_id);
  if (!ContainsKey(element_instance_id_to_guest_map_, key))
    return nullptr;
  int guest_instance_id = element_instance_id_to_guest_map_[key];
  if (ContainsKey(web_contents_embedder_map_, guest_instance_id))
    return web_contents_embedder_map_[guest_instance_id].web_contents;
  else
    return nullptr;
}
bool WebViewManager::ForEachGuest(content::WebContents* embedder_web_contents,
                                  const GuestCallback& callback) {
  for (auto& item : web_contents_embedder_map_)
    if (item.second.embedder == embedder_web_contents &&
        callback.Run(item.second.web_contents))
      return true;
  return false;
}
}