Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Issue 823813002: Modify pdf_scripting_api.js to support postMessage using BrowserPlugin (Closed)

Created:
6 years ago by raymes
Modified:
5 years, 11 months ago
Reviewers:
Sam McNally
CC:
chromium-reviews, arv+watch_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Modify 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 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+161 lines, -118 lines) Patch
M chrome/browser/resources/pdf/index.html View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/resources/pdf/main.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +76 lines, -39 lines 0 comments Download
M chrome/browser/resources/pdf/pdf.js View 1 2 3 4 5 6 7 8 9 10 12 chunks +34 lines, -33 lines 0 comments Download
M chrome/browser/resources/pdf/pdf_scripting_api.js View 1 2 3 4 5 6 7 8 9 5 chunks +43 lines, -33 lines 0 comments Download
M chrome/test/data/pdf/basic_plugin_test.js View 1 2 3 4 5 6 7 8 9 10 4 chunks +7 lines, -12 lines 0 comments Download

Messages

Total messages: 12 (2 generated)
raymes
5 years, 11 months ago (2015-01-06 03:16:28 UTC) #2
Sam McNally
https://codereview.chromium.org/823813002/diff/120001/chrome/browser/resources/pdf/pdf.js File chrome/browser/resources/pdf/pdf.js (right): https://codereview.chromium.org/823813002/diff/120001/chrome/browser/resources/pdf/pdf.js#newcode45 chrome/browser/resources/pdf/pdf.js:45: this.documentLoaded_ = false; The public "loaded" property is still ...
5 years, 11 months ago (2015-01-06 05:31:04 UTC) #3
raymes
https://codereview.chromium.org/823813002/diff/120001/chrome/browser/resources/pdf/pdf.js File chrome/browser/resources/pdf/pdf.js (right): https://codereview.chromium.org/823813002/diff/120001/chrome/browser/resources/pdf/pdf.js#newcode45 chrome/browser/resources/pdf/pdf.js:45: this.documentLoaded_ = false; I removed the use of it. ...
5 years, 11 months ago (2015-01-07 03:17:58 UTC) #4
Sam McNally
https://codereview.chromium.org/823813002/diff/140001/chrome/browser/resources/pdf/pdf.js File chrome/browser/resources/pdf/pdf.js (right): https://codereview.chromium.org/823813002/diff/140001/chrome/browser/resources/pdf/pdf.js#newcode575 chrome/browser/resources/pdf/pdf.js:575: if (this.documentLoaded_) { loaded_
5 years, 11 months ago (2015-01-07 05:01:04 UTC) #5
raymes
https://codereview.chromium.org/823813002/diff/140001/chrome/browser/resources/pdf/pdf.js File chrome/browser/resources/pdf/pdf.js (right): https://codereview.chromium.org/823813002/diff/140001/chrome/browser/resources/pdf/pdf.js#newcode575 chrome/browser/resources/pdf/pdf.js:575: if (this.documentLoaded_) { On 2015/01/07 05:01:04, Sam McNally wrote: ...
5 years, 11 months ago (2015-01-07 06:10:39 UTC) #6
Sam McNally
LGTM https://codereview.chromium.org/823813002/diff/180001/chrome/browser/resources/pdf/main.js File chrome/browser/resources/pdf/main.js (right): https://codereview.chromium.org/823813002/diff/180001/chrome/browser/resources/pdf/main.js#newcode64 chrome/browser/resources/pdf/main.js:64: function(streamDetails) { initViewer(streamDetails); }); Pass initViewer directly. https://codereview.chromium.org/823813002/diff/180001/chrome/browser/resources/pdf/main.js#newcode92 ...
5 years, 11 months ago (2015-01-08 03:50:26 UTC) #7
raymes
https://codereview.chromium.org/823813002/diff/180001/chrome/browser/resources/pdf/main.js File chrome/browser/resources/pdf/main.js (right): https://codereview.chromium.org/823813002/diff/180001/chrome/browser/resources/pdf/main.js#newcode64 chrome/browser/resources/pdf/main.js:64: function(streamDetails) { initViewer(streamDetails); }); On 2015/01/08 03:50:26, Sam McNally ...
5 years, 11 months ago (2015-01-08 22:08:21 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/823813002/200001
5 years, 11 months ago (2015-01-08 22:09:40 UTC) #10
commit-bot: I haz the power
Committed patchset #11 (id:200001)
5 years, 11 months ago (2015-01-08 23:52:23 UTC) #11
commit-bot: I haz the power
5 years, 11 months ago (2015-01-08 23:53:42 UTC) #12
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/850e893700850b70959f6d5baf879e9b5916f28b
Cr-Commit-Position: refs/heads/master@{#310632}

Powered by Google App Engine
This is Rietveld 408576698