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

Side by Side Diff: lib/filterComposer.js

Issue 29901596: Issue 6493 - Ensure Firefox draws the "Block element" popup window (Closed)
Patch Set: Keep the window's width correct Created Oct. 8, 2018, 5:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 browser.tabs.sendMessage(popupPageId, { 181 browser.tabs.sendMessage(popupPageId, {
182 type: "composer.dialog.init", 182 type: "composer.dialog.init",
183 sender: sender.page.id, 183 sender: sender.page.id,
184 filters: message.filters 184 filters: message.filters
185 }).then(response => 185 }).then(response =>
186 { 186 {
187 // Sometimes sendMessage incorrectly reports a success on Firefox, so 187 // Sometimes sendMessage incorrectly reports a success on Firefox, so
188 // we must check the response too. 188 // we must check the response too.
189 if (!response) 189 if (!response)
190 throw new Error(); 190 throw new Error();
191
192 // Sometimes Firefox doesn't draw the window's contents initially, so we
193 // resize the window slightly as a workaround.
194 // https://issues.adblockplus.org/ticket/6493
Thomas Greiner 2018/10/09 11:43:15 Since this issue is specific to Firefox, mind if w
kzar 2018/10/09 11:48:28 I considered doing that, but it seems kind of inco
Thomas Greiner 2018/10/09 12:00:27 I'm not the one to judge but I'd prefer a good UX
kzar 2018/10/09 12:16:37 Fair enough, Done.
195 browser.windows.update(window.id, {width: window.width + 2}).then(
Thomas Greiner 2018/10/09 11:43:15 Detail: Do we even need to wait for the callback o
kzar 2018/10/09 11:48:28 Well, doing it this way seemed better since I worr
Thomas Greiner 2018/10/09 12:00:27 Presumably, it's a similar assumption as whether +
196 () => { browser.windows.update(window.id, {width: window.width}); }
kzar 2018/10/08 17:23:15 I checked and the `window.width` property isn't up
Sebastian Noack 2018/10/08 17:33:56 So now we are creating the window with a width of
Jon Sonesen 2018/10/08 18:59:06 Yeah, since this code always ends up updating the
kzar 2018/10/09 09:58:47 I don't think an extra two pixels on the window wi
Thomas Greiner 2018/10/09 11:43:15 Indeed, 2px more or less shouldn't make much of a
kzar 2018/10/09 12:16:37 Alright, I won't bother shrink the window 2px agai
197 );
191 }).catch(e => 198 }).catch(e =>
192 { 199 {
193 // Firefox sometimes sets the status for a window to "complete" before 200 // Firefox sometimes sets the status for a window to "complete" before
194 // it is ready to receive messages[1]. As a workaround we'll try again a 201 // it is ready to receive messages[1]. As a workaround we'll try again a
195 // few times with a second delay. 202 // few times with a second delay.
196 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1418655 203 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1418655
197 setTimeout(doInit, 100); 204 setTimeout(doInit, 100);
198 }); 205 });
199 }; 206 };
200 if (window.tabs[0].status != "complete") 207 if (window.tabs[0].status != "complete")
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 port.on("composer.isPageReady", (message, sender) => 365 port.on("composer.isPageReady", (message, sender) =>
359 { 366 {
360 return readyActivePages.has(new ext.Page({id: message.pageId})); 367 return readyActivePages.has(new ext.Page({id: message.pageId}));
361 }); 368 });
362 369
363 port.on("composer.ready", (message, sender) => 370 port.on("composer.ready", (message, sender) =>
364 { 371 {
365 readyActivePages.set(sender.page, !checkWhitelisted(sender.page)); 372 readyActivePages.set(sender.page, !checkWhitelisted(sender.page));
366 updateContextMenu(sender.page); 373 updateContextMenu(sender.page);
367 }); 374 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld