playwright-core
Advanced tools
Comparing version 0.13.0-post-next.1586932567111 to 0.13.0-post-next.1586935519554
@@ -108,2 +108,3 @@ "use strict"; | ||
this._callbacks = new Map(); | ||
this._crashed = false; | ||
this._connection = connection; | ||
@@ -119,3 +120,8 @@ this._rootSessionId = rootSessionId; | ||
} | ||
_markAsCrashed() { | ||
this._crashed = true; | ||
} | ||
async send(method, params) { | ||
if (this._crashed) | ||
throw new Error('Target crashed'); | ||
if (!this._connection) | ||
@@ -122,0 +128,0 @@ throw new Error(`Protocol error (${method}): Session closed. Most likely the ${this._targetType} has been closed.`); |
@@ -518,3 +518,4 @@ "use strict"; | ||
} | ||
_onTargetCrashed() { | ||
async _onTargetCrashed() { | ||
this._client._markAsCrashed(); | ||
this._page._didCrash(); | ||
@@ -521,0 +522,0 @@ } |
@@ -32,2 +32,3 @@ "use strict"; | ||
Close: 'close', | ||
Crash: 'crash', | ||
Console: 'console', | ||
@@ -34,0 +35,0 @@ Dialog: 'dialog', |
@@ -114,2 +114,3 @@ "use strict"; | ||
this._disposed = false; | ||
this._crashed = false; | ||
this._callbacks = new Map(); | ||
@@ -126,3 +127,8 @@ this._connection = connection; | ||
} | ||
markAsCrashed() { | ||
this._crashed = true; | ||
} | ||
async send(method, params) { | ||
if (this._crashed) | ||
throw new Error('Page crashed'); | ||
if (this._disposed) | ||
@@ -129,0 +135,0 @@ throw new Error(`Protocol error (${method}): Session closed. Most likely the ${this._targetType} has been closed.`); |
@@ -212,2 +212,3 @@ "use strict"; | ||
async _onCrashed(event) { | ||
this._session.markAsCrashed(); | ||
this._page._didCrash(); | ||
@@ -214,0 +215,0 @@ } |
@@ -82,6 +82,3 @@ "use strict"; | ||
_didCrash() { | ||
const error = new Error('Page crashed!'); | ||
// Do not report node.js stack. | ||
error.stack = 'Error: ' + error.message; // Stack is supposed to contain error message as the first line. | ||
this.emit('error', error); | ||
this.emit(events_1.Events.Page.Crash); | ||
} | ||
@@ -88,0 +85,0 @@ _didDisconnect() { |
@@ -82,2 +82,3 @@ "use strict"; | ||
this._callbacks = new Map(); | ||
this._crashed = false; | ||
this.connection = connection; | ||
@@ -94,2 +95,4 @@ this.sessionId = sessionId; | ||
async send(method, params) { | ||
if (this._crashed) | ||
throw new Error('Target crashed'); | ||
if (this._disposed) | ||
@@ -105,2 +108,5 @@ throw new Error(`Protocol error (${method}): ${this.errorText}`); | ||
} | ||
markAsCrashed() { | ||
this._crashed = true; | ||
} | ||
isDisposed() { | ||
@@ -107,0 +113,0 @@ return this._disposed; |
@@ -170,4 +170,6 @@ "use strict"; | ||
helper_1.helper.removeEventListeners(this._sessionListeners); | ||
if (crashed) | ||
if (crashed) { | ||
this._session.markAsCrashed(); | ||
this._page._didCrash(); | ||
} | ||
} | ||
@@ -174,0 +176,0 @@ } |
{ | ||
"name": "playwright-core", | ||
"version": "0.13.0-post-next.1586932567111", | ||
"version": "0.13.0-post-next.1586935519554", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -5,0 +5,0 @@ "repository": "github:Microsoft/playwright", |
Sorry, the diff of this file is too big to display
1399036
34411