Closed Bug 1543072 Opened 6 years ago Closed 2 years ago

Support Puppeteer's Page.close's runBeforeUnload argument

Categories

(Remote Protocol :: CDP, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ochameau, Unassigned)

References

Details

Bug 1543071 introduce minimal support for puppeteer's Page.close method,
but did not implemented the optional runBeforeUnload argument.
This option depends on implementing CDP's Page.close method:
https://github.com/GoogleChrome/puppeteer/blob/9ef23b17542cc630e502fcf6689bf6b20fa9911b/lib/Page.js#L985-L990

  async close(options = {runBeforeUnload: undefined}) {
    assert(!!this._client._connection, 'Protocol error: Connection closed. Most likely the page has been closed.');
    const runBeforeUnload = !!options.runBeforeUnload;
    if (runBeforeUnload) {
      await this._client.send('Page.close');
    } else {
Priority: -- → P3
Type: defect → enhancement
Summary: Support puppeteer's Page.close's runBeforeUnload argument → Support Puppeteer's Page.close's runBeforeUnload argument
Component: CDP: Page → CDP
Severity: normal → S3

runBeforeUnload isn't an actual CDP argument and just a Puppeteer internal condition. Since we support Page.close and Target.closeTarget this should be done/marked as complete?

The related code in Puppeteer is here:
https://github.com/puppeteer/puppeteer/blob/9b54365df56914de0c4722233192f2095254da7c/packages/puppeteer-core/src/common/Page.ts#L1568-L1575

So yes, this should probably be done and it doesn't look like its actually awaiting for a Target.detachedFromTarget event.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.