Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterComposer.js

Issue 29596637: Issue 5985 - Work around Firefox bug causing Block element dialog to be empty on Linux (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome
Patch Set: Created Nov. 3, 2017, 1:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterComposer.js
===================================================================
--- a/lib/filterComposer.js
+++ b/lib/filterComposer.js
@@ -210,43 +210,46 @@ port.on("composer.isPageReady", (message
port.on("composer.ready", (message, sender) =>
{
readyPages.set(sender.page, null);
updateContextMenu(sender.page);
});
port.on("composer.openDialog", (message, sender) =>
{
- return new Promise(resolve =>
+ return browser.windows.create({
+ url: browser.extension.getURL("composer.html"),
+ left: 50,
+ top: 50,
+ width: 420,
+ height: 200,
+ type: "popup"
+ }).then(window =>
{
- ext.windows.create({
kzar 2017/11/03 13:24:06 I think we can remove ext.windows from ext/backgro
Wladimir Palant 2017/11/03 13:49:05 Sure - after the release.
kzar 2017/11/03 13:57:06 Well if we're only doing the bare minimum for the
Wladimir Palant 2017/11/03 13:59:37 Because the ext API only gives us a tab ID but not
kzar 2017/11/03 14:00:56 Ah, OK.
- url: browser.extension.getURL("composer.html"),
- left: 50,
- top: 50,
- width: 420,
- height: 200,
- type: "popup"
- },
- popupPage =>
+ let popupPageId = window.tabs[0].id;
+ function onRemoved(removedPageId)
{
- let popupPageId = popupPage.id;
- function onRemoved(removedPageId)
+ if (popupPageId == removedPageId)
{
- if (popupPageId == removedPageId)
- {
- sender.page.sendMessage({
- type: "composer.content.dialogClosed",
- popupId: popupPageId
- });
- ext.pages.onRemoved.removeListener(onRemoved);
- }
+ sender.page.sendMessage({
+ type: "composer.content.dialogClosed",
+ popupId: popupPageId
+ });
+ ext.pages.onRemoved.removeListener(onRemoved);
}
- ext.pages.onRemoved.addListener(onRemoved);
- resolve(popupPageId);
- });
+ }
+ ext.pages.onRemoved.addListener(onRemoved);
+
+ if (require("info").application == "firefox" &&
+ navigator.oscpu.startsWith("Linux"))
kzar 2017/11/03 13:24:06 (I'll take your word for it that this is the best
Wladimir Palant 2017/11/03 13:49:05 It's not a great way, but it's worse than any othe
kzar 2017/11/03 13:57:06 Acknowledged.
+ {
+ // Work around https://bugzil.la/1408446
+ browser.windows.update(window.id, {width: window.width + 1});
+ }
+ return popupPageId;
});
});
port.on("composer.getFilters", (message, sender) =>
{
return composeFilters({
tagName: message.tagName,
id: message.id,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld