Closed Bug 1543071 Opened 5 years ago Closed 5 years ago

Support puppeteer's Page.close

Categories

(Remote Protocol :: CDP, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Assigned: jdescottes)

References

Details

Attachments

(3 files, 2 obsolete files)

This is used by Wordpress test suite in order to close the browser at the end of tests.

Puppeteer's Page.close uses CDP's Target.close:
https://github.com/GoogleChrome/puppeteer/blob/9ef23b17542cc630e502fcf6689bf6b20fa9911b/lib/Page.js#L991-L992

      await this._client._connection.send('Target.closeTarget', { targetId: this._target._targetId });
      await this._target._isClosedPromise;

And CDP's Target.targetDestroyed event:
https://github.com/GoogleChrome/puppeteer/blob/3bea5d6017c36ab848a0c0b0c809e2a6b5259749/experimental/puppeteer-firefox/lib/Browser.js#L190-L193

  _onTargetDestroyed({targetId}) {
    const target = this._targets.get(targetId);
    this._targets.delete(targetId);
    target._closedCallback();

I'll ignore the {runBeforeUnload: true} option for now and instead open a followup. Supporting this optional argument depends on CDP's Page.close method.

Blocks: 1543072
Component: Target → Page
Priority: -- → P2
Type: defect → enhancement
Component: Page → Target

Thanks for correcting the component.

Assignee: poirot.alex → nobody
Priority: P2 → P3
Priority: P3 → P2
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Priority: P2 → P1

Depends on D35106

Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f24caf8d9666
Implement Target.targetDestroyed event r=ato
https://hg.mozilla.org/integration/autoland/rev/430bb08ecd68
Implement Target.closeTarget r=ato
https://hg.mozilla.org/integration/autoland/rev/b16a957f53f7
Test remote Target.closeTarget and targetDestroyed event r=ochameau
Regressions: 1560127

I believe that bug 1560127 regression is rather related to bug 1545147.

Attachment #9058242 - Attachment is obsolete: true
Attachment #9058241 - Attachment is obsolete: true
Component: CDP: Target → CDP
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: