DescriptionModify pdf_scripting_api.js to support postMessage using BrowserPlugin
This modifies how pdf_scripting_api.js interacts with the PDF extension. Previously messages would just be posted to the parent window by pdf.js. But inside BrowserPlugin there isn't a notion of a parent window. Instead, the embedder can post a message into the plugin and pdf.js uses the source window of that message to respond.
A protocol is setup where pdf_scripting_api.js sends a 'setParentWindow' message to initialize the channel. pdf.js responds with a 'readyToReceieve' message when the plugin is initialized, at which point further messages can be safely sent. Since the 'setParentWindow' message can be received by pdf.js at any point after the page has loaded, the code has been changed a little to install the message handler on page load rather than when the stream is available (an init function has been added to PDFViewer to do initialization when the stream has loaded).
There are a few other more cosmetic fixes to the code here as well.
BUG=415858
Committed: https://crrev.com/850e893700850b70959f6d5baf879e9b5916f28b
Cr-Commit-Position: refs/heads/master@{#310632}
Patch Set 1 #Patch Set 2 : #Patch Set 3 : #Patch Set 4 : #Patch Set 5 : #Patch Set 6 : #Patch Set 7 : #
Total comments: 16
Patch Set 8 : #
Total comments: 2
Patch Set 9 : #Patch Set 10 : #
Total comments: 8
Patch Set 11 : #
Messages
Total messages: 12 (2 generated)
|