New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer

Package Overview
Dependencies
Maintainers
3
Versions
920
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer - npm Package Compare versions

Comparing version 1.0.0-next.1515618391320 to 1.0.0-next.1515641713768

14

lib/Browser.js

@@ -196,2 +196,3 @@ /**

this._browser = browser;
this._targetId = targetInfo.targetId;
this._targetInfo = targetInfo;

@@ -207,2 +208,9 @@ /** @type {?Promise<!Page>} */

/**
* @return {!Promise<!Puppeteer.CDPSession>}
*/
createCDPSession() {
return this._browser._connection.createSession(this._targetId);
}
/**
* @return {!Promise<?Page>}

@@ -212,4 +220,4 @@ */

if (this._targetInfo.type === 'page' && !this._pagePromise) {
this._pagePromise = this._browser._connection.createSession(this._targetInfo.targetId)
.then(client => Page.create(client, this._browser._ignoreHTTPSErrors, this._browser._appMode, this._browser._screenshotTaskQueue));
this._pagePromise = this._browser._connection.createSession(this._targetId)
.then(client => Page.create(client, this, this._browser._ignoreHTTPSErrors, this._browser._appMode, this._browser._screenshotTaskQueue));
}

@@ -264,2 +272,2 @@ return this._pagePromise;

module.exports = { Browser, TaskQueue };
module.exports = { Browser, TaskQueue, Target };

@@ -16,2 +16,3 @@ /**

*/
const {helper} = require('./helper');
const debugProtocol = require('debug')('puppeteer:protocol');

@@ -53,3 +54,3 @@ const debugSession = require('debug')('puppeteer:session');

this._ws.on('close', this._onClose.bind(this));
/** @type {!Map<string, !Session>}*/
/** @type {!Map<string, !CDPSession>}*/
this._sessions = new Map();

@@ -140,7 +141,7 @@ }

* @param {string} targetId
* @return {!Promise<!Session>}
* @return {!Promise<!CDPSession>}
*/
async createSession(targetId) {
const {sessionId} = await this.send('Target.attachToTarget', {targetId});
const session = new Session(this, targetId, sessionId);
const session = new CDPSession(this, targetId, sessionId);
this._sessions.set(sessionId, session);

@@ -151,3 +152,3 @@ return session;

class Session extends EventEmitter {
class CDPSession extends EventEmitter {
/**

@@ -169,9 +170,2 @@ * @param {!Connection} connection

/**
* @return {string}
*/
targetId() {
return this._targetId;
}
/**
* @param {string} method

@@ -219,5 +213,4 @@ * @param {!Object=} params

async dispose() {
console.assert(!!this._connection, 'Protocol error: Connection closed. Most likely the page has been closed.');
await this._connection.send('Target.closeTarget', {targetId: this._targetId});
async detach() {
await this._connection.send('Target.detachFromTarget', {sessionId: this._sessionId});
}

@@ -232,2 +225,3 @@

}
helper.tracePublicAPI(CDPSession);

@@ -244,2 +238,2 @@ /**

module.exports = {Connection, Session};
module.exports = {Connection, CDPSession};

@@ -28,3 +28,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
*/

@@ -70,3 +70,3 @@ constructor(client) {

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
*/

@@ -159,3 +159,3 @@ constructor(client) {

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
*/

@@ -162,0 +162,0 @@ constructor(client) {

@@ -21,3 +21,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {string} type

@@ -24,0 +24,0 @@ * @param {string} message

@@ -23,3 +23,3 @@ /**

* @param {!Puppeteer.ExecutionContext} context
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Object} remoteObject

@@ -26,0 +26,0 @@ * @param {!Puppeteer.Page} page

@@ -19,3 +19,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
*/

@@ -22,0 +22,0 @@ constructor(client) {

@@ -21,3 +21,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Object} contextPayload

@@ -121,3 +121,3 @@ * @param {function(*):!JSHandle} objectHandleFactory

* @param {!ExecutionContext} context
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Object} remoteObject

@@ -124,0 +124,0 @@ */

@@ -1,3 +0,3 @@

import { Connection as RealConnection, Session as RealSession } from './Connection.js';
import {Browser as RealBrowser, TaskQueue as RealTaskQueue} from './Browser.js';
import { Connection as RealConnection, CDPSession as RealCDPSession } from './Connection.js';
import {Browser as RealBrowser, TaskQueue as RealTaskQueue, Target as RealTarget} from './Browser.js';
import * as RealPage from './Page.js';

@@ -13,3 +13,3 @@ import {Mouse as RealMouse, Keyboard as RealKeyboard, Touchscreen as RealTouchscreen} from './Input.js';

export class Connection extends RealConnection {}
export class Session extends RealSession {}
export class CDPSession extends RealCDPSession {}
export class Mouse extends RealMouse {}

@@ -20,2 +20,3 @@ export class Keyboard extends RealKeyboard {}

export class Browser extends RealBrowser {}
export class Target extends RealTarget {}
export class Frame extends RealFrame {}

@@ -22,0 +23,0 @@ export class FrameManager extends RealFrameManager {}

@@ -27,3 +27,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {{frame: Object, childFrames: ?Array}} frameTree

@@ -230,3 +230,3 @@ * @param {!Puppeteer.Page} page

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {?Frame} parentFrame

@@ -233,0 +233,0 @@ * @param {string} frameId

@@ -86,3 +86,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Object} remoteObject

@@ -89,0 +89,0 @@ */

@@ -31,3 +31,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
*/

@@ -193,3 +193,3 @@ constructor(client) {

/**
* @param {Puppeteer.Session} client
* @param {Puppeteer.CDPSession} client
* @param {!Keyboard} keyboard

@@ -273,3 +273,3 @@ */

/**
* @param {Puppeteer.Session} client
* @param {Puppeteer.CDPSession} client
* @param {Keyboard} keyboard

@@ -276,0 +276,0 @@ */

@@ -22,3 +22,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Puppeteer.FrameManager} frameManager

@@ -285,3 +285,3 @@ */

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {?string} requestId

@@ -484,3 +484,3 @@ * @param {string} interceptionId

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Request} request

@@ -487,0 +487,0 @@ * @param {number} status

@@ -34,3 +34,4 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Puppeteer.Target} target
* @param {boolean} ignoreHTTPSErrors

@@ -41,7 +42,7 @@ * @param {boolean} appMode

*/
static async create(client, ignoreHTTPSErrors, appMode, screenshotTaskQueue) {
static async create(client, target, ignoreHTTPSErrors, appMode, screenshotTaskQueue) {
await client.send('Page.enable');
const {frameTree} = await client.send('Page.getFrameTree');
const page = new Page(client, frameTree, ignoreHTTPSErrors, screenshotTaskQueue);
const page = new Page(client, target, frameTree, ignoreHTTPSErrors, screenshotTaskQueue);

@@ -65,3 +66,4 @@ await Promise.all([

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {!Puppeteer.Target} target
* @param {{frame: Object, childFrames: ?Array}} frameTree

@@ -71,5 +73,6 @@ * @param {boolean} ignoreHTTPSErrors

*/
constructor(client, frameTree, ignoreHTTPSErrors, screenshotTaskQueue) {
constructor(client, target, frameTree, ignoreHTTPSErrors, screenshotTaskQueue) {
super();
this._client = client;
this._target = target;
this._keyboard = new Keyboard(client);

@@ -108,2 +111,9 @@ this._mouse = new Mouse(client, this._keyboard);

/**
* @return {!Puppeteer.Target}
*/
target() {
return this._target;
}
_onTargetCrashed() {

@@ -513,3 +523,3 @@ this.emit('error', new Error('Page crashed!'));

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
* @param {string} url

@@ -700,3 +710,3 @@ * @param {string} referrer

async _screenshotTask(format, options) {
await this._client.send('Target.activateTarget', {targetId: this._client.targetId()});
await this._client.send('Target.activateTarget', {targetId: this._target._targetId});
let clip = options.clip ? Object.assign({}, options['clip']) : undefined;

@@ -795,3 +805,4 @@ if (clip)

async close() {
await this._client.dispose();
console.assert(!!this._client._connection, 'Protocol error: Connection closed. Most likely the page has been closed.');
await this._client._connection.send('Target.closeTarget', {targetId: this._target._targetId});
}

@@ -798,0 +809,0 @@

@@ -25,3 +25,3 @@ /**

/**
* @param {!Puppeteer.Session} client
* @param {!Puppeteer.CDPSession} client
*/

@@ -28,0 +28,0 @@ constructor(client) {

{
"name": "puppeteer",
"version": "1.0.0-next.1515618391320",
"version": "1.0.0-next.1515641713768",
"description": "A high-level API to control headless Chrome over the DevTools Protocol",

@@ -5,0 +5,0 @@ "main": "index.js",

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