• 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
..
test Loading commit data...
cross-frame.js Loading commit data...
document.js Loading commit data...
pdf-metadata.js Loading commit data...
pdf.js Loading commit data...