Fix safari+firefox with service worker: clone file.encodedName on yield #83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Love the library. I encountered a very weird issue i painstakingly debugged, resulting in this PR.
Setup:
ArrayBuffer
chunks, rather than a blob or file (not sure if relevant, but could be)Error occurs on closing the zip (i.e. once all files have been included and the stream is being closed by client-zip)
Firefox error:
MessagePort.postMessage: attempting to access detached ArrayBuffer
Safari error:
Unhandled Promise Rejection: DataCloneError: The object can not be cloned.
The firefox error is the actual cause, the safari one gets hidden behind the above opaque one.
What I think is happening and why this PR fixes it:
file.encodedName
ends up getting sent twice during the zipping process, probably with the file, and in the zip's manifestThis change works for me now on both safari and firefox.
Thanks!