• 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
..
annotator Loading commit data...
boot Loading commit data...
images/icons Loading commit data...
shared Loading commit data...
sidebar Loading commit data...
styles Loading commit data...
test-util Loading commit data...
types Loading commit data...
.eslintrc Loading commit data...
karma.config.js Loading commit data...
tsconfig.json Loading commit data...