Closed Bug 1361917 Opened 7 years ago Closed 2 years ago

File created from IDBMutableFile does not work where other File objects do

Categories

(Core :: Storage: IndexedDB, defect, P5)

53 Branch
defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: alexanderomara, Unassigned)

References

Details

Attachments

(1 file)

Attached file index.html (deleted) —
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170413192749

Steps to reproduce:

Tested:
- Firefox 53+ (plus Beta and Nightly)
- macOS 10.12.4 (the latest version)
- Used a fresh profile for testing

Issue:
File objects created from IDBMutableFile.prototype.getFile do not behave properly like other File objects in many cases, making them almost unusable in many cases.

Sample:
1. Open the attached sample file or visit https://cdn.rawgit.com/AlexanderOMara/459f9938d79a8d9739c1aa1553ee677b/raw/22898d79acd12967b3d8b0d1e7cb61438bde77a2/index.html
2. Click the various sample links, and observe that those created from an IDBMutableFile do not behave as expected.

Note:
The console offers a possible hint to why it may be failing, for those examples that use window.location:
"FileHandleInactiveError: A request was placed against a file handle which is currently not active, or which is finished."



Actual results:

Nothing happens with the URL created from a File created from a IDBMutableFile, except those that redirect to the location during the success handler.


Expected results:

I would expect all File objects to behave the same, and their Blob URL's to work whenever accessed.
Component: Untriaged → DOM: IndexedDB
Product: Firefox → Core
Jan, what should be happening here?
Flags: needinfo?(jvarga)
IDBMutableFile.prototype.getFile gets a very special File object, it's a snapshot.
If you want to read it, etc., you must do that immediately/synchronously when you get it.
If you return to the event loop and try to do it later, things won't work since the snapshot is invalid at that point.

The attached sample looks right, but I remember there was/is a bug related to "snapshots" not working with the download attribute :(
Flags: needinfo?(jvarga)
(In reply to Jan Varga [:janv] from comment #2)
> IDBMutableFile.prototype.getFile gets a very special File object, it's a
> snapshot.
> If you want to read it, etc., you must do that immediately/synchronously
> when you get it.
> If you return to the event loop and try to do it later, things won't work
> since the snapshot is invalid at that point.
> 
> The attached sample looks right, but I remember there was/is a bug related
> to "snapshots" not working with the download attribute :(

What should we do next?
Flags: needinfo?(jvarga)
Well, not sure if we want to invest here much, given that we want to remove mutable file from IndexedDB at some point.
But if someone depends on this, we can try to fix it.
Flags: needinfo?(jvarga)
(In reply to Jan Varga [:janv] from comment #4)
> Well, not sure if we want to invest here much, given that we want to remove
> mutable file from IndexedDB at some point.

I forgot about that => P5.

Can you please reference the bug we have to remove mutable file? I couldn't find one but I probably just searched for the wrong terms. Thanks.
Flags: needinfo?(jvarga)
Priority: -- → P5
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Depends on: 1500343
Resolution: --- → DUPLICATE
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---

Wontfixing FileHandle bugs as bug 1500343 will remove it.

Status: REOPENED → RESOLVED
Closed: 4 years ago2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: