• K Moon's avatar
    Suppress exception in PDFViewer.sendScriptingMessage() · d4692321
    K Moon authored
    The postMessage() in sendScriptingMessage() may throw if targetOrigin is
    an opaque URL (such as a "data:" URL). To work around this, suppress the
    exception, which has the same effect as a blocked cross-origin message
    (message is not sent, but caller completes normally).
    
    This prevents the proposed changes in crrev.com/c/1747170 from causing
    the ExtensionApiTest.TemporaryAddressSpoof test to get stuck, due to
    asynchronous layout never completing.
    
    Also made some tweaks to crrev.com/696209, which fixed the flakiness in
    ExtensionApiTest.TemporaryAddressSpoof. The previous fix misunderstood
    the purpose of TestNavigationManager, which observes navigations rather
    than causing them. It also doesn't make sense to proceed if the call to
    WaitForRequestStart() fails, so this is now an ASSERT.
    
    Bug: 885110, 1004425
    Change-Id: I5eb42992a8c3306c6c76eafac5caa34e5cf3134d
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1857598
    Commit-Queue: K Moon <kmoon@chromium.org>
    Reviewed-by: default avatarRaymes Khoury <raymes@chromium.org>
    Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#707625}
    d4692321
pdf_viewer.js 49.4 KB