Merge pull request #7108 from yurydelendik/frontWindow-null

Removes frontWindow usage from the stream converter.
This commit is contained in:
Brendan Dahl 2016-03-24 10:24:13 -07:00
commit 7aa864db3e

View File

@ -319,11 +319,9 @@ ChromeActions.prototype = {
var extHelperAppSvc = var extHelperAppSvc =
Cc['@mozilla.org/uriloader/external-helper-app-service;1']. Cc['@mozilla.org/uriloader/external-helper-app-service;1'].
getService(Ci.nsIExternalHelperAppService); getService(Ci.nsIExternalHelperAppService);
var frontWindow = Cc['@mozilla.org/embedcomp/window-watcher;1'].
getService(Ci.nsIWindowWatcher).activeWindow;
var docIsPrivate = this.isInPrivateBrowsing(); var docIsPrivate = this.isInPrivateBrowsing();
var netChannel = createNewChannel(blobUri, frontWindow.document, null); var netChannel = createNewChannel(blobUri, this.domWindow.document, null);
if ('nsIPrivateBrowsingChannel' in Ci && if ('nsIPrivateBrowsingChannel' in Ci &&
netChannel instanceof Ci.nsIPrivateBrowsingChannel) { netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
netChannel.setPrivate(docIsPrivate); netChannel.setPrivate(docIsPrivate);
@ -359,10 +357,14 @@ ChromeActions.prototype = {
var listener = { var listener = {
extListener: null, extListener: null,
onStartRequest: function(aRequest, aContext) { onStartRequest: function(aRequest, aContext) {
var loadContext = self.domWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsILoadContext);
this.extListener = extHelperAppSvc.doContent( this.extListener = extHelperAppSvc.doContent(
(data.isAttachment ? 'application/octet-stream' : (data.isAttachment ? 'application/octet-stream' :
'application/pdf'), 'application/pdf'),
aRequest, frontWindow, false); aRequest, loadContext, false);
this.extListener.onStartRequest(aRequest, aContext); this.extListener.onStartRequest(aRequest, aContext);
}, },
onStopRequest: function(aRequest, aContext, aStatusCode) { onStopRequest: function(aRequest, aContext, aStatusCode) {