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

Delta Between Two Patch Sets: lib/options.js

Issue 29604555: Issue 5965 - Handle edge case when searching for options page tab (Closed)
Left Patch Set: Addressed Wladimir's initial feedback Created Nov. 13, 2017, 12:30 p.m.
Right Patch Set: Renamed urlMatch variable Created Nov. 23, 2017, 11:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 callback(); 57 callback();
58 return; 58 return;
59 } 59 }
60 let removeListener; 60 let removeListener;
61 let updateListener = (tabId, changeInfo, tab) => 61 let updateListener = (tabId, changeInfo, tab) =>
62 { 62 {
63 if (potentialOptionTabIds.has(tabId) && 63 if (potentialOptionTabIds.has(tabId) &&
64 changeInfo.status == "complete") 64 changeInfo.status == "complete")
65 { 65 {
66 potentialOptionTabIds.delete(tabId); 66 potentialOptionTabIds.delete(tabId);
67 let urlMatches = tab.url == fullOptionsUrl; 67 let urlMatch = tab.url == fullOptionsUrl;
Wladimir Palant 2017/11/23 11:37:12 Nit: Variable names are supposed to be nouns, not
kzar 2017/11/23 11:51:08 Done. (It's quite nice in Clojure you can use symb
68 if (urlMatches || potentialOptionTabIds.size == 0) 68 if (urlMatch || potentialOptionTabIds.size == 0)
69 { 69 {
70 browser.tabs.onUpdated.removeListener(updateListener); 70 browser.tabs.onUpdated.removeListener(updateListener);
71 browser.tabs.onRemoved.removeListener(removeListener); 71 browser.tabs.onRemoved.removeListener(removeListener);
72 callback(urlMatches ? tab : undefined); 72 callback(urlMatch ? tab : undefined);
73 } 73 }
74 } 74 }
75 }; 75 };
76 browser.tabs.onUpdated.addListener(updateListener); 76 browser.tabs.onUpdated.addListener(updateListener);
77 removeListener = removedTabId => 77 removeListener = removedTabId =>
78 { 78 {
79 potentialOptionTabIds.delete(removedTabId); 79 potentialOptionTabIds.delete(removedTabId);
80 if (potentialOptionTabIds.size == 0) 80 if (potentialOptionTabIds.size == 0)
81 { 81 {
82 browser.tabs.onUpdated.removeListener(updateListener); 82 browser.tabs.onUpdated.removeListener(updateListener);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 args: [ 189 args: [
190 { 190 {
191 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), 191 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""),
192 whitelisted: !!checkWhitelisted(currentPage) 192 whitelisted: !!checkWhitelisted(currentPage)
193 } 193 }
194 ] 194 ]
195 }); 195 });
196 }); 196 });
197 }); 197 });
198 }); 198 });
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld