Fix notification from showing up in wrong window.
This commit is contained in:
parent
ee54c0bfe4
commit
5d67183b4d
@ -100,7 +100,8 @@ function getLocalizedString(strings, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All the priviledged actions.
|
// All the priviledged actions.
|
||||||
function ChromeActions() {
|
function ChromeActions(domWindow) {
|
||||||
|
this.domWindow = domWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChromeActions.prototype = {
|
ChromeActions.prototype = {
|
||||||
@ -170,11 +171,15 @@ ChromeActions.prototype = {
|
|||||||
return getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false);
|
return getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false);
|
||||||
},
|
},
|
||||||
fallback: function(url) {
|
fallback: function(url) {
|
||||||
var strings = getLocalizedStrings('chrome.properties');
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var domWindow = this.domWindow;
|
||||||
|
var strings = getLocalizedStrings('chrome.properties');
|
||||||
var message = getLocalizedString(strings, 'unsupported_feature');
|
var message = getLocalizedString(strings, 'unsupported_feature');
|
||||||
|
|
||||||
var win = Services.wm.getMostRecentWindow('navigator:browser');
|
var win = Services.wm.getMostRecentWindow('navigator:browser');
|
||||||
var notificationBox = win.gBrowser.getNotificationBox();
|
var browser = win.gBrowser.getBrowserForDocument(domWindow.top.document);
|
||||||
|
var notificationBox = win.gBrowser.getNotificationBox(browser);
|
||||||
|
|
||||||
var buttons = [{
|
var buttons = [{
|
||||||
label: getLocalizedString(strings, 'open_with_different_viewer'),
|
label: getLocalizedString(strings, 'open_with_different_viewer'),
|
||||||
accessKey: null,
|
accessKey: null,
|
||||||
@ -290,7 +295,8 @@ PdfStreamConverter.prototype = {
|
|||||||
var domWindow = getDOMWindow(channel);
|
var domWindow = getDOMWindow(channel);
|
||||||
// Double check the url is still the correct one.
|
// Double check the url is still the correct one.
|
||||||
if (domWindow.document.documentURIObject.equals(aRequest.URI)) {
|
if (domWindow.document.documentURIObject.equals(aRequest.URI)) {
|
||||||
let requestListener = new RequestListener(new ChromeActions);
|
let requestListener = new RequestListener(
|
||||||
|
new ChromeActions(domWindow));
|
||||||
domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
|
domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
|
||||||
requestListener.receive(event);
|
requestListener.receive(event);
|
||||||
}, false, true);
|
}, false, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user