Socket
Socket
Sign inDemoInstall

chrome-remote-interface

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-remote-interface - npm Package Compare versions

Comparing version 0.17.0 to 0.17.1

lib/protocol-error.js

4

index.js

@@ -5,4 +5,4 @@ 'use strict';

const devtools = require('./lib/devtools.js');
const Chrome = require('./lib/chrome.js');
const devtools = require('./lib/devtools');
const Chrome = require('./lib/chrome');

@@ -9,0 +9,0 @@ module.exports = function (options, callback) {

@@ -8,5 +8,6 @@ 'use strict';

const api = require('./api.js');
const defaults = require('./defaults.js');
const devtools = require('./devtools.js');
const api = require('./api');
const defaults = require('./defaults');
const devtools = require('./devtools');
const ProtocolError = require('./protocol-error');

@@ -52,3 +53,3 @@ class Chrome extends EventEmitter {

if (error) {
reject(response);
reject(new ProtocolError(response));
} else {

@@ -86,3 +87,3 @@ fulfill(response);

const id = chrome._nextCommandId++;
const message = {'id': id, 'method': method, 'params': params};
const message = {'id': id, 'method': method, 'params': params || {}};
chrome._ws.send(JSON.stringify(message));

@@ -89,0 +90,0 @@ chrome._callbacks[id] = callback;

@@ -6,4 +6,4 @@ 'use strict';

const defaults = require('./defaults.js');
const externalRequest = require('./external-request.js');
const defaults = require('./defaults');
const externalRequest = require('./external-request');

@@ -180,6 +180,6 @@ // callback(err, protocol)

urls = [`https://chromium.googlesource.com/chromium/src/+/${hash}/third_party/WebKit/Source/core/inspector/browser_protocol.json?format=TEXT`,
`https://chromium.googlesource.com/chromium/src/+/${hash}/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json?format=TEXT`];
`https://chromium.googlesource.com/chromium/src/+/${hash}/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json?format=TEXT`];
} else if (v8Version) {
urls = [`https://chromium.googlesource.com/chromium/src/+/${hash}/third_party/WebKit/Source/core/inspector/browser_protocol.json?format=TEXT`,
`https://chromium.googlesource.com/v8/v8/+/${v8Version}/src/inspector/js_protocol.json?format=TEXT`];
`https://chromium.googlesource.com/v8/v8/+/${v8Version}/src/inspector/js_protocol.json?format=TEXT`];
} else {

@@ -189,3 +189,3 @@ console.error('Warning: the protocol might be outdated, see: https://groups.google.com/d/topic/chrome-debugging-protocol/HjyOKainKus/discussion');

urls = [`https://chromium.googlesource.com/chromium/src/+/${hash}/third_party/WebKit/Source/core/inspector/browser_protocol.json?format=TEXT`,
`https://chromium.googlesource.com/chromium/src/+/${lastBeforeV8ChromeVersion}/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json?format=TEXT`];
`https://chromium.googlesource.com/chromium/src/+/${lastBeforeV8ChromeVersion}/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json?format=TEXT`];
}

@@ -192,0 +192,0 @@ }

@@ -12,3 +12,3 @@ {

"homepage": "https://github.com/cyrus-and/chrome-remote-interface",
"version": "0.17.0",
"version": "0.17.1",
"repository": {

@@ -41,3 +41,3 @@ "type": "git",

"mocha": "3.1.x",
"eslint": "3.9.x",
"eslint": "3.12.x",
"babel-core": "^6.18.2",

@@ -44,0 +44,0 @@ "babel-loader": "^6.2.8",

@@ -18,19 +18,26 @@ chrome-remote-interface [![Build Status](https://travis-ci.org/cyrus-and/chrome-remote-interface.svg?branch=master)](https://travis-ci.org/cyrus-and/chrome-remote-interface)

```javascript
```js
const CDP = require('chrome-remote-interface');
CDP(function (client) {
with (client) {
Network.requestWillBeSent(function (params) {
console.log(params.request.url);
});
Page.loadEventFired(function () {
close();
});
Network.enable();
Page.enable();
once('ready', function () {
Page.navigate({'url': 'https://github.com'});
});
}
}).on('error', function (err) {
CDP((client) => {
// extract domains
const {Network, Page} = client;
// setup handlers
Network.requestWillBeSent((params) => {
console.log(params.request.url);
});
Page.loadEventFired(() => {
client.close();
});
// enable events then start!
Promise.all([
Network.enable(),
Page.enable()
]).then(() => {
return Page.navigate({url: 'https://github.com'});
}).catch((err) => {
console.error(`ERROR: ${err.message}`);
client.close();
});
}).on('error', (err) => {
console.error('Cannot connect to remote endpoint:', err);

@@ -40,2 +47,6 @@ });

Find more examples in the [wiki].
[wiki]: https://github.com/cyrus-and/chrome-remote-interface/wiki
Installation

@@ -704,5 +715,8 @@ ------------

the [`send`](#clientsendmethod-params-callback) method. This event acts as a
barrier and it is useful to avoid the callback hell in certain simple
barrier and it is useful to avoid the *callback hell* in certain simple
situations.
Users are encouraged to extensively check the response of each method and should
prefer the promises API when dealing with complex asynchronous program flows.
For example to load a URL only after having enabled the notifications of both

@@ -709,0 +723,0 @@ `Network` and `Page` domains:

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc