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

playwright-core

Package Overview
Dependencies
Maintainers
1
Versions
4726
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playwright-core - npm Package Compare versions

Comparing version 0.11.1-next.1583444645828 to 0.11.1-next.1583449329858

3

lib/firefox/ffPage.d.ts

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

private _removeContextsForFrame;
_onNavigationStarted(): void;
_onLinkClicked(phase: 'before' | 'after'): void;
_onNavigationStarted(frameId: string): void;
_onNavigationAborted(params: Protocol.Page.navigationAbortedPayload): void;

@@ -45,0 +46,0 @@ _onNavigationCommitted(params: Protocol.Page.navigationCommittedPayload): void;

@@ -49,6 +49,7 @@ "use strict";

helper_1.helper.addEventListener(this._session, 'Page.navigationCommitted', this._onNavigationCommitted.bind(this)),
helper_1.helper.addEventListener(this._session, 'Page.navigationStarted', this._onNavigationStarted.bind(this)),
helper_1.helper.addEventListener(this._session, 'Page.navigationStarted', event => this._onNavigationStarted(event.frameId)),
helper_1.helper.addEventListener(this._session, 'Page.sameDocumentNavigation', this._onSameDocumentNavigation.bind(this)),
helper_1.helper.addEventListener(this._session, 'Runtime.executionContextCreated', this._onExecutionContextCreated.bind(this)),
helper_1.helper.addEventListener(this._session, 'Runtime.executionContextDestroyed', this._onExecutionContextDestroyed.bind(this)),
helper_1.helper.addEventListener(this._session, 'Page.linkClicked', event => this._onLinkClicked(event.phase)),
helper_1.helper.addEventListener(this._session, 'Page.uncaughtError', this._onUncaughtError.bind(this)),

@@ -101,4 +102,11 @@ helper_1.helper.addEventListener(this._session, 'Runtime.console', this._onConsole.bind(this)),

}
_onNavigationStarted() {
_onLinkClicked(phase) {
if (phase === 'before')
this._page._frameManager.frameWillPotentiallyRequestNavigation();
else
this._page._frameManager.frameDidPotentiallyRequestNavigation();
}
_onNavigationStarted(frameId) {
this._page._frameManager.frameRequestedNavigation(frameId);
}
_onNavigationAborted(params) {

@@ -105,0 +113,0 @@ const frame = this._page._frameManager.frame(params.frameId);

@@ -288,2 +288,5 @@ export declare module Protocol {

};
type linkClickedPayload = {
phase: ("before" | "after");
};
type fileChooserOpenedPayload = {

@@ -834,2 +837,3 @@ executionContextId: string;

"Page.bindingCalled": Page.bindingCalledPayload;
"Page.linkClicked": Page.linkClickedPayload;
"Page.fileChooserOpened": Page.fileChooserOpenedPayload;

@@ -836,0 +840,0 @@ "Page.workerCreated": Page.workerCreatedPayload;

@@ -46,3 +46,3 @@ /**

readonly _consoleMessageTags: Map<string, ConsoleTagHandler>;
private _navigationRequestCollectors;
private _pendingNavigationBarriers;
constructor(page: Page);

@@ -53,5 +53,6 @@ mainFrame(): Frame;

frameAttached(frameId: string, parentFrameId: string | null | undefined): Frame;
waitForNavigationsCreatedBy<T>(action: () => Promise<T>): Promise<T>;
waitForNavigationsCreatedBy<T>(action: () => Promise<T>, options?: WaitForNavigationOptions): Promise<T>;
frameWillPotentiallyRequestNavigation(): void;
frameDidPotentiallyRequestNavigation(): void;
frameRequestedNavigation(frameId: string): void;
_cancelFrameRequestedNavigation(frameId: string): void;
frameCommittedNewDocumentNavigation(frameId: string, url: string, name: string, documentId: string, initial: boolean): void;

@@ -58,0 +59,0 @@ frameCommittedSameDocumentNavigation(frameId: string, url: string): void;

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

this._consoleMessageTags = new Map();
this._navigationRequestCollectors = new Set();
this._pendingNavigationBarriers = new Set();
this._page = page;

@@ -74,11 +74,9 @@ this._mainFrame = undefined;

}
async waitForNavigationsCreatedBy(action) {
const frameIds = new Set();
this._navigationRequestCollectors.add(frameIds);
async waitForNavigationsCreatedBy(action, options) {
const barrier = new PendingNavigationBarrier(options);
this._pendingNavigationBarriers.add(barrier);
try {
const result = await action();
if (!frameIds.size)
return result;
const frames = Array.from(frameIds.values()).map(frameId => this._frames.get(frameId));
await Promise.all(frames.map(frame => frame.waitForNavigation({ waitUntil: [] }))).catch(e => { });
await barrier.waitFor();
// Resolve in the next task, after all waitForNavigations.
await new Promise(platform.makeWaitForNextTask());

@@ -88,15 +86,21 @@ return result;

finally {
this._navigationRequestCollectors.delete(frameIds);
this._pendingNavigationBarriers.delete(barrier);
}
}
frameWillPotentiallyRequestNavigation() {
for (const barrier of this._pendingNavigationBarriers)
barrier.retain();
}
frameDidPotentiallyRequestNavigation() {
for (const barrier of this._pendingNavigationBarriers)
barrier.release();
}
frameRequestedNavigation(frameId) {
for (const frameIds of this._navigationRequestCollectors)
frameIds.add(frameId);
const frame = this._frames.get(frameId);
if (!frame)
return;
for (const barrier of this._pendingNavigationBarriers)
barrier.addFrame(frame);
}
_cancelFrameRequestedNavigation(frameId) {
for (const frameIds of this._navigationRequestCollectors)
frameIds.delete(frameId);
}
frameCommittedNewDocumentNavigation(frameId, url, name, documentId, initial) {
this._cancelFrameRequestedNavigation(frameId);
const frame = this._frames.get(frameId);

@@ -115,3 +119,2 @@ for (const child of frame.childFrames())

frameCommittedSameDocumentNavigation(frameId, url) {
this._cancelFrameRequestedNavigation(frameId);
const frame = this._frames.get(frameId);

@@ -193,3 +196,2 @@ if (!frame)

if (!isCurrentDocument) {
this._cancelFrameRequestedNavigation(frame._id);
let errorText = request.failure().errorText;

@@ -206,3 +208,2 @@ if (canceled)

provisionalLoadFailed(frame, documentId, error) {
this._cancelFrameRequestedNavigation(frame._id);
for (const watcher of frame._documentWatchers)

@@ -212,3 +213,2 @@ watcher(documentId, new Error(error));

_removeFramesRecursively(frame) {
this._cancelFrameRequestedNavigation(frame._id);
for (const child of frame.childFrames())

@@ -958,2 +958,32 @@ this._removeFramesRecursively(child);

}
class PendingNavigationBarrier {
constructor(options) {
this._frameIds = new Map();
this._protectCount = 0;
this._promiseCallback = () => { };
this._waitOptions = options;
this._promise = new Promise(f => this._promiseCallback = f);
this.retain();
}
waitFor() {
this.release();
return this._promise;
}
async addFrame(frame) {
this.retain();
await frame.waitForNavigation(this._waitOptions).catch(e => { });
this.release();
}
retain() {
++this._protectCount;
}
release() {
--this._protectCount;
this._maybeResolve();
}
async _maybeResolve() {
if (!this._protectCount && !this._frameIds.size)
this._promiseCallback();
}
}
//# sourceMappingURL=frames.js.map

@@ -249,3 +249,4 @@ "use strict";

function makeWaitForNextTask() {
helper_1.assert(exports.isNode, 'Waitng for the next task is only supported in nodejs');
if (!exports.isNode)
return (func) => setTimeout(func, 0);
if (parseInt(process.versions.node, 10) >= 11)

@@ -252,0 +253,0 @@ return setImmediate;

@@ -159,7 +159,10 @@ "use strict";

}
if (launchType !== 'persistent')
chromeArguments.push(...args);
if (launchType === 'persistent') {
if (args.every(arg => arg.startsWith('-')))
chromeArguments.push('about:blank');
}
else {
chromeArguments.push('--no-startup-window');
chromeArguments.push(...args);
if (args.every(arg => arg.startsWith('-')))
chromeArguments.push('about:blank');
}
return chromeArguments;

@@ -166,0 +169,0 @@ }

{
"name": "playwright-core",
"version": "0.11.1-next.1583444645828",
"version": "0.11.1-next.1583449329858",
"description": "A high-level API to automate web browsers",

@@ -12,3 +12,3 @@ "repository": "github:Microsoft/playwright",

"chromium_revision": "747023",
"firefox_revision": "1032",
"firefox_revision": "1035",
"webkit_revision": "1168"

@@ -15,0 +15,0 @@ },

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