mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: implement Page.close prompt unload (#11399)
This commit is contained in:
parent
a6b508aa36
commit
856802fec3
26
package-lock.json
generated
26
package-lock.json
generated
@ -2987,18 +2987,6 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/chromium-bidi": {
|
|
||||||
"version": "0.4.33",
|
|
||||||
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.33.tgz",
|
|
||||||
"integrity": "sha512-IxoFM5WGQOIAd95qrSXzJUv4eXIrh+RvU3rwwqIiwYuvfE7U/Llj4fejbsJnjJMUYCuGtVQsY2gv7oGl4aTNSQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"mitt": "3.0.1",
|
|
||||||
"urlpattern-polyfill": "9.0.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"devtools-protocol": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ci-info": {
|
"node_modules/ci-info": {
|
||||||
"version": "3.9.0",
|
"version": "3.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
||||||
@ -12014,7 +12002,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@puppeteer/browsers": "1.8.0",
|
"@puppeteer/browsers": "1.8.0",
|
||||||
"chromium-bidi": "0.4.33",
|
"chromium-bidi": "0.4.34",
|
||||||
"cross-fetch": "4.0.0",
|
"cross-fetch": "4.0.0",
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
"devtools-protocol": "0.0.1203626",
|
"devtools-protocol": "0.0.1203626",
|
||||||
@ -12038,6 +12026,18 @@
|
|||||||
"integrity": "sha512-2yrWpBk32tvV/JAd3HNHWuZn/VDN1P+72hWirHnvsvTGSqbANi+kSeuQR9yAHnbvaBvHDsoTdXV0Fe+iRtHLKA==",
|
"integrity": "sha512-2yrWpBk32tvV/JAd3HNHWuZn/VDN1P+72hWirHnvsvTGSqbANi+kSeuQR9yAHnbvaBvHDsoTdXV0Fe+iRtHLKA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"packages/puppeteer-core/node_modules/chromium-bidi": {
|
||||||
|
"version": "0.4.34",
|
||||||
|
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.34.tgz",
|
||||||
|
"integrity": "sha512-IV0JZWcgS+OYmwmC9E05vu3puJfbg3WSfGP2RqydZ2BvxTlBUKc1YtRCIlmkhHef6scXmWtzVXq52tm2IX0Ptg==",
|
||||||
|
"dependencies": {
|
||||||
|
"mitt": "3.0.1",
|
||||||
|
"urlpattern-polyfill": "9.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"devtools-protocol": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"packages/puppeteer/node_modules/@types/node": {
|
"packages/puppeteer/node_modules/@types/node": {
|
||||||
"version": "18.17.15",
|
"version": "18.17.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.15.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.15.tgz",
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@puppeteer/browsers": "1.8.0",
|
"@puppeteer/browsers": "1.8.0",
|
||||||
"chromium-bidi": "0.4.33",
|
"chromium-bidi": "0.4.34",
|
||||||
"cross-fetch": "4.0.0",
|
"cross-fetch": "4.0.0",
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
"devtools-protocol": "0.0.1203626",
|
"devtools-protocol": "0.0.1203626",
|
||||||
|
@ -473,7 +473,7 @@ export class BidiPage extends Page {
|
|||||||
return this.#closedDeferred.finished();
|
return this.#closedDeferred.finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
override async close(): Promise<void> {
|
override async close(options?: {runBeforeUnload?: boolean}): Promise<void> {
|
||||||
if (this.#closedDeferred.finished()) {
|
if (this.#closedDeferred.finished()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -483,6 +483,7 @@ export class BidiPage extends Page {
|
|||||||
|
|
||||||
await this.#connection.send('browsingContext.close', {
|
await this.#connection.send('browsingContext.close', {
|
||||||
context: this.mainFrame()._id,
|
context: this.mainFrame()._id,
|
||||||
|
promptUnload: options?.runBeforeUnload ?? false,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.emit(PageEvent.Close, undefined);
|
this.emit(PageEvent.Close, undefined);
|
||||||
|
@ -929,6 +929,12 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[page.spec] Page Page.close should *not* run beforeunload by default",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
|
"expectations": ["PASS"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[page.spec] Page Page.close should not be visible in browser.pages",
|
"testIdPattern": "[page.spec] Page Page.close should not be visible in browser.pages",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1331,6 +1337,12 @@
|
|||||||
"parameters": ["firefox", "webDriverBiDi"],
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[browser.spec] Browser specs Browser.process should not return child_process for remote browser",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
|
"expectations": ["PASS"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[browser.spec] Browser specs Browser.target should return browser target",
|
"testIdPattern": "[browser.spec] Browser specs Browser.target should return browser target",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
Loading…
Reference in New Issue
Block a user