Merge pull request #5917 from Snuffleupagus/bug-1148192-review-comments

Address review comments from Bug 1148192 - Update pdf.js to version 1.1.24
This commit is contained in:
Yury Delendik 2015-04-20 10:23:52 -05:00
commit ebd6ce33b5
2 changed files with 11 additions and 16 deletions

View File

@ -501,8 +501,6 @@ ChromeActions.prototype = {
var winmm = this.domWindow.QueryInterface(Ci.nsIInterfaceRequestor) var winmm = this.domWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell) .getInterface(Ci.nsIDocShell)
.sameTypeRootTreeItem
.QueryInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIContentFrameMessageManager); .getInterface(Ci.nsIContentFrameMessageManager);
@ -815,8 +813,6 @@ function FindEventManager(contentWindow) {
this.contentWindow = contentWindow; this.contentWindow = contentWindow;
this.winmm = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) this.winmm = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell) .getInterface(Ci.nsIDocShell)
.sameTypeRootTreeItem
.QueryInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIContentFrameMessageManager); .getInterface(Ci.nsIContentFrameMessageManager);
} }

View File

@ -179,9 +179,8 @@ let PdfjsChromeUtils = {
}, },
handleEvent: function(aEvent) { handleEvent: function(aEvent) {
// We cannot just forward the message as a CPOW without setting up // To avoid forwarding the message as a CPOW, create a structured cloneable
// __exposedProps__ on it. Instead, let's just create a structured // version of the event for both performance, and ease of usage, reasons.
// cloneable version of the event for performance and for the ease of usage.
let type = aEvent.type; let type = aEvent.type;
let detail = { let detail = {
query: aEvent.detail.query, query: aEvent.detail.query,
@ -190,16 +189,16 @@ let PdfjsChromeUtils = {
findPrevious: aEvent.detail.findPrevious findPrevious: aEvent.detail.findPrevious
}; };
let chromeWindow = aEvent.target.ownerDocument.defaultView; let browser = aEvent.currentTarget.browser;
let browser = chromeWindow.gBrowser.selectedBrowser; if (!this._browsers.has(browser)) {
if (this._browsers.has(browser)) { throw new Error('FindEventManager was not bound ' +
// Only forward the events if the selected browser is a registered 'for the current browser.');
// browser.
let mm = browser.messageManager;
mm.sendAsyncMessage('PDFJS:Child:handleEvent',
{ type: type, detail: detail });
aEvent.preventDefault();
} }
// Only forward the events if the current browser is a registered browser.
let mm = browser.messageManager;
mm.sendAsyncMessage('PDFJS:Child:handleEvent',
{ type: type, detail: detail });
aEvent.preventDefault();
}, },
_types: ['find', _types: ['find',