Index: lib/filterComposer.js |
=================================================================== |
--- a/lib/filterComposer.js |
+++ b/lib/filterComposer.js |
@@ -220,28 +220,52 @@ port.on("composer.openDialog", (message, |
left: 50, |
top: 50, |
width: 420, |
height: 200, |
type: "popup" |
}).then(window => |
{ |
let popupPageId = window.tabs[0].id; |
- function onRemoved(removedPageId) |
+ |
+ let doInit = () => |
+ { |
+ browser.tabs.sendMessage(popupPageId, { |
+ type: "composer.dialog.init", |
+ sender: sender.page.id, |
+ filters: message.filters |
+ }); |
+ }; |
+ if (window.tabs[0].status != "complete") |
{ |
- if (popupPageId == removedPageId) |
+ let updateListener = (tabId, changeInfo, tab) => |
+ { |
+ if (tabId == popupPageId && changeInfo.status == "complete") |
+ { |
+ browser.tabs.onUpdated.removeListener(updateListener); |
+ doInit(); |
+ } |
+ }; |
+ browser.tabs.onUpdated.addListener(updateListener); |
+ } |
+ else |
+ doInit(); |
+ |
+ let onRemoved = removedTabId => |
Wladimir Palant
2017/11/09 14:14:12
The changes after this line aren't strictly necess
kzar
2017/11/10 14:51:50
Acknowledged.
|
+ { |
+ if (removedTabId == popupPageId) |
{ |
sender.page.sendMessage({ |
type: "composer.content.dialogClosed", |
popupId: popupPageId |
}); |
- ext.pages.onRemoved.removeListener(onRemoved); |
+ browser.tabs.onRemoved.removeListener(onRemoved); |
} |
- } |
- ext.pages.onRemoved.addListener(onRemoved); |
+ }; |
+ browser.tabs.onRemoved.addListener(onRemoved); |
if (require("info").application == "firefox" && |
navigator.oscpu.startsWith("Linux")) |
{ |
// Work around https://bugzil.la/1408446 |
browser.windows.update(window.id, {width: window.width + 1}); |
} |
return popupPageId; |