• Robert Knight's avatar
    Remove `beforeAnnotationCreated` event handler in `DocumentMeta` · 3771ff0e
    Robert Knight authored
    This handler sets the `document` property of new annotations to metadata
    extracted from `<meta>` and `<link>` tags on the page. It is unnecessary
    however because the `Guest` class sets this property using either
    `DocumentMeta.metadata` or `PDF.getMetadata`, depending on the document
    type, before it emits the `beforeAnnotationCreated` event.
    
    In PDFs this code is a serious hazard because if the
    `beforeAnnotationCreated` event subscriber in `DocumentMeta` runs before
    `AnnotationSync`'s corresponding event handler then DocumentMeta will
    overwrite the PDF document-specific annotation metadata with generic
    HTML document metadata - losing the critical `documentFingerprint`
    property. Fortunately this problem did not occur because the `Guest`
    constructor instantiates the `AnnotationSync` class before the
    `DocumentMeta` class. Consequently AnnotationSync's
    `beforeAnnotationCreated` event handler runs before DocumentMeta's and
    pushes new annotations to the sidebar with the correct document metadata
    before `DocumentMeta` overwrites it.
    3771ff0e
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...
frontend-shared Loading commit data...
images 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.js Loading commit data...
package.json Loading commit data...
requirements-dev.in Loading commit data...
tox.ini Loading commit data...
yarn.lock Loading commit data...