fix(viewer): release sessions on early close, fail fast on dead SW, sync MIME map - #125
Merged
Merged
Conversation
…ync MIME map - If the viewer unmounts while registerSession is in flight, teardown ran without the session, leaving up to the whole package in SW memory. Unregister it once the await returns. - waitForActive never settled when the worker went 'redundant', so the viewer hung on 'Preparing viewer…' and never tried the server fallback. - The PHP fallback map lacked xhtml, xml, txt, ico, m4a, m4v, oga, ogv, otf and pdf, so those were served as octet-stream + nosniff. A parity test now reads asset-map.ts and fails on drift.
Contributor
Preview this PR in the Nextcloud PlaygroundA fresh Nextcloud boots in your browser with this branch's eXeLearning editor: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/asset-and-zip-hardening #125 +/- ##
==============================================================
Coverage 93.79% 93.79%
Complexity 152 152
==============================================================
Files 22 22
Lines 661 661
Branches 54 54
==============================================================
Hits 620 620
Misses 34 34
Partials 7 7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stack 2/5, based on #128.
What
registerSessionis in flight,teardown()runs without the session and the SW keeps the whole package in memory. The viewer now unregisters it once the await returns (this.$.isUnmounted).waitForActivenever settled when the worker wentredundant. The viewer hung on "Preparing viewer…" and never reached the server fallback. It now rejects.xhtml xml txt ico m4a m4v oga ogv otf pdf, so in fallback mode those were served asapplication/octet-stream+nosniff(PDFs, ogv video and otf fonts broke). A PHPUnit parity test now readssrc/elpx/asset-map.tsand fails on drift.New
tests/js/service-worker-client.test.tscovers activation and theredundantrejection.Verification