Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auto-chrome

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-chrome - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

13

lib/Chrome.js

@@ -122,6 +122,15 @@ "use strict";

// await this.send('Browser.close');
await this.send('Browser.close').then(data => {
this.process.kill();
// 返回错位消息时,强制退出chrome进程
if (data.error) {
logger.warn('Browser.close消息响应超时,强制退出进程');
this.process.kill();
}
})
}

@@ -128,0 +137,0 @@ }

28

lib/ChromeEvent.js

@@ -30,8 +30,7 @@ "use strict";

const id = this.id++
const id = this.id++;
const message = { id, method, params }
const message = JSON.stringify({ id, method, params });
// 发送消息
this.ws.send(JSON.stringify(message));
this.ws.send(message); // 发送消息

@@ -43,3 +42,4 @@ return new Promise((resolve, reject) => {

logger.error(error);
})
return { error };
});

@@ -54,8 +54,10 @@ }

const { id } = message;
// 带id为主动消息
if (message.id) {
if (id) {
let { id, result, error } = message
const { result, error } = message;
const callback = this.callbacks.get(id)
const callback = this.callbacks.get(id);

@@ -66,3 +68,3 @@ if (callback) {

if (error) {
callback.reject(error)
callback.reject(error);
} else {

@@ -78,8 +80,8 @@ callback.resolve(result);

let { method, params } = message
const { method, params } = message;
// 带sessionId的Target子消息
if (method === 'Target.receivedMessageFromTarget') {
let { targetId, message } = params
let page = this.pages.get(targetId)
const { targetId, message } = params;
const page = this.pages.get(targetId);
if (page) {

@@ -90,3 +92,3 @@ page.message(message);

if (this[method]) {
this[method](params)
this[method](params);
}

@@ -93,0 +95,0 @@ }

@@ -7,3 +7,3 @@ "use strict";

const timechain = new timeChain({ delay: 10000 })
const timechain = new timeChain({ delay: 10000 });

@@ -10,0 +10,0 @@ module.exports = {

{
"name": "auto-chrome",
"version": "1.0.0",
"version": "1.0.1",
"description": "使用Node.js操作Chrome或Chromium,高仿真的用户行为模拟器",

@@ -5,0 +5,0 @@ "main": "lib/",

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