Open Bug 1658889 Opened 4 years ago Updated 4 years ago

Unable to store ImageBitmap object in IndexedDB

Categories

(Core :: Storage: IndexedDB, enhancement, P3)

79 Branch
enhancement

Tracking

()

People

(Reporter: sardeeplakhera, Unassigned)

References

(Depends on 1 open bug)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36

Steps to reproduce:

  1. open https://sardeeplakhera.github.io/imageBitmap/
  2. Click on 'Open DB' button
  3. Click on 'Store image' button'

Actual results:

IndexedDB put API fails with 'Uncaught (in promise) DOMException: The object could not be cloned.' error. Error suggests that ImageBitmap objects are not clonable, but I am able to post it to a worker. (click on 'Post to Worker' button) that means ImageBitmap objects are clonable.

Expected results:

ImageBitmap object should be stored in the indexedDB

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Storage: IndexedDB
Product: Firefox → Core

Thanks for reporting this. Our IndexedDB implementation indeed currently does not support persistence of ImageBitmap objects.

ImageBitmap is defined to be Serializable in the HTML spec so this is something we need to implement (although it sounds like adoption rate may be low?).

The implementation difficulty seems to be that the ImageBitmap structured clone write logic in ImageBitmap::WriteStructuredClone is for same-process-only use, storing reference counted graphic buffers on the StructuredCloneHolder in mClonedSurfaces. This also means they can't be transferred via MessageChannel or BroadcastChannel, which I see :annevk filed as bug 1575501. It likely makes sense to consider these enhancements together.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Type: defect → enhancement
Depends on: 1575501
Ever confirmed: true
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.