<!--
Thanks for opening an issue! A few things to keep in mind:

- The issue tracker is only for bugs and feature requests.
- Before reporting a bug, please try reproducing your issue against
  the latest version of Electron.
- If you need general advice, join our Slack: http://atom-slack.herokuapp.com
-->

* Electron version: 1.7.9
* Operating system: macOS

### Expected behavior

The callback should be used only for URLs matching the filter.

```
const filter = { urls: ['*://www.googleapis.com'] };
session.defaultSession.webRequest.onBeforeRequest(filter, (details, callback) => {
  console.log('onBeforeRequest: ', details);
  callback({ cancel: true });
});
```

<!-- What do you think should happen? -->

### Actual behavior

The callback is called for random URLs.

```
onBeforeRequest:  { id: 1,
  method: 'GET',
  referrer: '',
  resourceType: 'mainFrame',
  timestamp: 1512654154551.9841,
  url: 'file:///Users/pronebird/apple/mail/build/index.html' }
onBeforeRequest:  { id: 4,
  method: 'GET',
  referrer: '',
  resourceType: 'mainFrame',
  timestamp: 1512654154564.2021,
  url: 'chrome-devtools://devtools/bundled/inspector.html?remoteBase=https://chrome-devtools-frontend.appspot.com/serve_file/@691bdb490962d4e6ae7f25c6ab1fdd0faaf19cd0/&can_dock=&toolbarColor=rgba(223,223,223,1)&textColor=rgba(0,0,0,1)&experiments=true' }
```

<!-- What actually happens? -->

shell/browser/api/atom_api_web_request.cc
#include "shell/browser/api/atom_api_web_request.h"
#include <string>
#include <utility>
#include "base/task/post_task.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "shell/browser/atom_browser_context.h"
#include "shell/browser/net/atom_network_delegate.h"
#include "shell/common/native_mate_converters/net_converter.h"
#include "shell/common/native_mate_converters/once_callback.h"
#include "shell/common/native_mate_converters/value_converter.h"
using content::BrowserThread;
namespace mate {
template <>
struct Converter<URLPattern> {
  static bool FromV8(v8::Isolate* isolate,