fix: support blob downloads (#1954)
This commit is contained in:
parent
21dc346b16
commit
7c9762fae9
|
|
@ -9,8 +9,8 @@
|
|||
"main": "index.js",
|
||||
"playwright": {
|
||||
"chromium_revision": "759546",
|
||||
"firefox_revision": "1085",
|
||||
"webkit_revision": "1208"
|
||||
"firefox_revision": "1086",
|
||||
"webkit_revision": "1209"
|
||||
},
|
||||
"scripts": {
|
||||
"ctest": "cross-env BROWSER=chromium node --unhandled-rejections=strict test/test.js",
|
||||
|
|
|
|||
|
|
@ -99,6 +99,14 @@ export class WKBrowser extends BrowserBase {
|
|||
const page = this._wkPages.get(payload.pageProxyId);
|
||||
if (!page)
|
||||
return;
|
||||
const frameManager = page._page._frameManager;
|
||||
const frame = frameManager.frame(payload.frameId);
|
||||
if (frame) {
|
||||
// In some cases, e.g. blob url download, we receive only frameScheduledNavigation
|
||||
// but no signals that the navigation was canceled and replaced by download. Fix it
|
||||
// here by simulating cancelled provisional load which matches downloads from network.
|
||||
frameManager.provisionalLoadFailed(frame, '', 'Download is starting');
|
||||
}
|
||||
this._downloadCreated(page._page, payload.uuid, payload.url);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const {FFOX, CHROMIUM, WEBKIT} = require('./utils').testOptions(browserType);
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC} = require('./utils').testOptions(browserType);
|
||||
|
||||
describe('Download', function() {
|
||||
beforeEach(async(state) => {
|
||||
|
|
@ -83,7 +83,7 @@ describe('Download', function() {
|
|||
expect(fs.readFileSync(path).toString()).toBe('Hello world');
|
||||
await page.close();
|
||||
})
|
||||
it.fail(FFOX || WEBKIT)(`should report download path within page.on('download', …) handler for Blobs`, async({browser, server}) => {
|
||||
it.fail(WEBKIT && MAC)(`should report download path within page.on('download', …) handler for Blobs`, async({browser, server}) => {
|
||||
const page = await browser.newPage({ acceptDownloads: true });
|
||||
const onDownloadPath = new Promise((res) => {
|
||||
page.on('download', dl => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue