jimmywarting / native-file-system-adapter

File system, based on the spec reference implementation

Home Page:https://jimmywarting.github.io/native-file-system-adapter/example/test.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firefox 102.0.1 (64-bit) on Linux: showSaveFilePicker doesn't spawn a dialog

gizahNL opened this issue · comments

Not sure if a bug or simply not supported: the showSaveFilePicker doesn't pop a download dialog on Firefox 102.0.1 on Ubuntu. This is true both in real world code and the example/test.html case.

Same for Firefox 112.0 (64-bit). True for both real world code and example/test.html case.

Hmm, will try it out on my mac now...

hmm, works for me...
this is basically what it all dose: https://jsfiddle.net/abscjqkt/

dose that jsfiddle not working for you to open the dialog?

but i haven't tested Linux 64 bit
only Mac...

could you maybe tinker with the jsfiddle until it works?

Hmmm, your fiddle works for me, but my code and the example in the repo doesn't. I came here expecting nothing and was surprised when someone posted the exact same problem as me. Let me take an animated movie for you.

firefox
It takes a while for the example to do anything....

In my real world code, it pops up the dialog after the file has been downloaded and saved with the suggestedName.

It used to work in FF and just recently stopped. I'll check Safari really quick, but of course it works fine in Chrome and Edge.

ah darn it... miss read that open file picker when it actually was save

I didn't notice the fiddle was open! By the way...streaming is working great thanks to your help!

think i have found the error

The root cause was: #49
so closing this.

I still can't get Firefox to open the showSaveFilePicker dialog box in example/test.html. It works in Safari, Chrome and Edge, but not FF. I've even tried to debug it, but without spending a lot of time understanding FileSystemFileHandle, I don't know what's going on.

Uhm, try unregister & register the service worker to get a fresh one.

  1. close all tabs that have jimmywarting.github.io open.
  2. go to about:debugging#/runtime/this-firefox and kill the service worker under https://jimmywarting.github.io
  3. open up the test page
  4. wait a sec and reload the page (just making sure that service worker takes claim of the requests)
  5. try the save-picker

alternative solution for step 2-3 could be to open devtool and run this on the page.

navigator.serviceWorker.getRegistrations().then(registrations => {
    for (const registration of registrations) {
        registration.unregister()
    }
    location.reload()
})

I started a new browser window and did all that and can't get it to work. I guess I'm not going to worry about it too much. The main browsers I care about are Edge and Chrome.

Next question though....are you going to do a release soon? Or?

Hmm, not sure if there is any point in making a new release,

  • the service worker script isn't part of the npm package, or at least shouldn't be.
  • and the fix was applied in the service worker example that i use on my test site. how you set up your service worker is mostly up to the developers.
  • also the service worker solution is optional. The downloader/showSaveFilePicker checks wether or not a service worker is installed and use it if it exist.
    if (isOldSafari || !sw) {
    /** @type {Blob[]} */
    let chunks = []
    ts.readable.pipeTo(new WritableStream({
    write (chunk) {
    chunks.push(new Blob([chunk]))
    },
    close () {
    const blob = new Blob(chunks, { type: 'application/octet-stream; charset=utf-8' })
    chunks = []
    link.href = URL.createObjectURL(blob)
    link.click()
    setTimeout(() => URL.revokeObjectURL(link.href), 10000)
    }
    }))

    in which case it will just create a dummy blob and save it using regular objectURL and without no MessageChannel/postMessage stuff going on which isn't at all related to #49 problem at all.

I observed this "not spawning" problem when i was using _preferPolyfill: true in other browsers too which made it skip using the native showSaveFilePicker all togheter. so it was not just firefox

It's still not working for me.

But I figured it's due to a Firefox "feature" where it will simply not prompt by default.

Setting "browser.download.improvements_to_download_panel" to false in about:config on FF will make it prompt again for a file location. I don't think they've added a way for site builders to hint that, yes really, we would prefer a prompt. Which is unfortunate because in our case it feels like an important feedback point in the our workflow.