Closed
Description
openedon Apr 23, 2020
Context:
- Playwright Version: Latest (0.14.0)
- Operating System:Linux
- Extra: using typescript
Code Snippet
//context param contains acceptDownloads
let ctx = await firefox.newContext(contextParams)
let p = await ctx.newPage()
//this page download a blob and ensure it is not garbage collected
await p.goto("https://clever-elion-84f381.netlify.app/")
//this page download a blob without making sure the blob is not garbage collected
//await p.goto("https://upbeat-nightingale-6e32da.netlify.app/download")
//this page download a simple zip file
//await p.goto("https://c7ecc89a4366bf00.netlify.app/seekdasky-example")
let elem = await p.waitForSelector("a")
let blob = await new Promise((accept,reject) => {
p.once('download',async (download) => {
//I also tried in a non-async context with promise.then()
let path = await download.path()
let data = readFileSync(path,{encoding: 'utf8'})
accept(data)
})
elem.click()
})
console.log(blob)
Describe the bug
The given code is able to download the file for every use case when using chromium (thanks to #1923 ), firefox on the other hand is only able to download the zip file, when trying to download a Blob the error message could not be saved, because the source file could not be read.
is displayed and the download event is not dispatched.
As suggested in #1777 I tried to prevent the blob from being GC by keeping a reference to it in a setTimeout
but it did not change anything
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels