• Robert Knight's avatar
    Inject client into newly loaded VitalSource book chapters sooner · 9481c420
    Robert Knight authored
    When a new content frame was found in VitalSource the client was only injected
    either if the frame is already loaded, or when the frame next emits a `load`
    event. In the latter case this waits until the document and its subresources
    have fully loaded. This can be slow in EPUB chapters that have a lot of images.
    Improve this by replacing the frame `load` event observer with a call to a new
    `onDocumentReady` function which fires as soon as a document becomes interactive
    (according to its `readyState`).
    
     - Rename existing `onDocumentReady` utility to `onNextDocumentReady` to
       make it clear that it only fires once, and change the implementation to
       be a wrapper around a new `onDocumentReady` function.
    
     - Add new `onDocumentReady` utility which monitors a frame for changes in the
       content document and invokes a callback each time a document becomes _ready_
       (`readyState` is `interactive` or `complete`).
    
     - Redo the tests for utilities in `frame-observer.js` so that they use
       real iframes rather than fake ones. Iframes have a complex interface
       and loading sequence, so we really need to use the real thing for
       tests to give us confidence.
    
     - Use `onDocumentReady` in the VitalSource integration to respond more quickly
       to book content loading in a new content frame.
    
     - Modify several tests for `FrameObserver`, `VitalSourceInjector` and
       `HypothesisInjector` to be less sensitive to exact timings of events,
       as these changed between the previous and new methods for detecting
       when a document is ready.
    
    Fixes https://github.com/hypothesis/client/issues/4270
    9481c420
Name
Last commit
Last update
.github Loading commit data...
bin Loading commit data...
dev-server Loading commit data...
docs Loading commit data...
embedding-examples Loading commit data...
images Loading commit data...
requirements Loading commit data...
scripts Loading commit data...
src Loading commit data...
.babelrc Loading commit data...
.dockerignore Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.prettierignore Loading commit data...
.python-version Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Dockerfile Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
codecov.yml Loading commit data...
gulpfile.mjs Loading commit data...
package.json Loading commit data...
pyproject.toml Loading commit data...
requirements-dev.in Loading commit data...
rollup-boot.config.mjs Loading commit data...
rollup-tests.config.mjs Loading commit data...
rollup.config.mjs Loading commit data...
tailwind.config.mjs Loading commit data...
tox.ini Loading commit data...
tsconfig.json Loading commit data...
yarn.lock Loading commit data...