Skip to content

Commit

Permalink
fix(webkit): rewrite global object retrieval errors (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored and pavelfeldman committed Jan 24, 2020
1 parent fb9ec96 commit f1d1dfb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/webkit/wkExecutionContext.ts
Expand Up @@ -111,7 +111,15 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
serializableArgs = args;
}

const thisObjectId = await this._contextGlobalObjectId();
let thisObjectId;
try {
thisObjectId = await this._contextGlobalObjectId();
} catch (error) {
if (error.message.includes('Missing injected script for given'))
throw new Error('Execution context was destroyed, most likely because of a navigation.');
throw error;
}

let callFunctionOnPromise;
try {
callFunctionOnPromise = this._session.send('Runtime.callFunctionOn', {
Expand Down
4 changes: 2 additions & 2 deletions test/screenshot.spec.js
Expand Up @@ -181,8 +181,8 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
const screenshot = await page.screenshot();
expect(screenshot).toBeGolden('screenshot-webgl.png');
});
// firefox and webkit are flaky
it.skip(FFOX || WEBKIT)('should work while navigating', async({page, server}) => {
// firefox is flaky
it.skip(FFOX)('should work while navigating', async({page, server}) => {
await page.setViewport({width: 500, height: 500});
await page.goto(server.PREFIX + '/redirectloop1.html');
for (let i = 0; i < 10; i++) {
Expand Down

0 comments on commit f1d1dfb

Please sign in to comment.