Skip to content

Commit

Permalink
fix: 页面崩溃下,没有正确关闭页面的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Dec 3, 2017
1 parent 340b89e commit 83972f9
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,30 @@ class App extends EventEmitter {
// create a new tab
const page = await this.browser.newPage();

// listen on tab dialog, like alert, confirm
page.on('dialog', async dialog => {
await dialog.dismiss();
});

page.on('error', async () => {
try {
// 关闭标签
await page.close();
} catch (err) {}
});

// set the browser's viewport
await page.setViewport({
width: 1366,
height: 768
});

// listen on tab dialog, like alert, confirm
page.on('dialog', async dialog => {
await dialog.dismiss();
});

try {
this.emit(EVENT_ON_NEXT, entity);
// 跳转页面
await page.goto(entity.url, {
waitUntil: 'load',
timeout: 3000000
timeout: 1000 * 60
});

// 删除cookies
Expand Down

0 comments on commit 83972f9

Please sign in to comment.