Add minimal test for PDF viewer scripting and opaque origins
This change adds a test that verifies the current behavior: When the PDF
viewer tries to send a scripting message to an opaque origin (such as a
"data:" URL), the postMessage() fails with a SyntaxError.
We may want to make this case work, in which case, simply change the
expected result of this test from "blocked" (false) to "allowed" (true).
This leverages the existing TestGetSelectedTextReply() test (used to
test same-origin and cross-origin requests). The existing test doesn't
behave correctly if PDFViewer.sendScriptingMessage_() throws, so I've
moved the postMessage("flush") call into a finally block to fix that.
Bug: 1004425
Change-Id: I28ad56a21f634f42e20e3ca76fa4a02151b2560a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808580Reviewed-by:
Lei Zhang <thestig@chromium.org>
Commit-Queue: K Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697305}
Showing
Please register or sign in to comment