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

Side by Side Diff: lib/options.js

Issue 29883571: Issue 6777 - Clicking Subscribe link on testpages.adblockplus.org works only the second time (Closed)
Patch Set: Created Sept. 17, 2018, 5:01 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 26 matching lines...) Expand all
37 // starting with Firefox 56 an extension can query for its own URLs: 37 // starting with Firefox 56 an extension can query for its own URLs:
38 // https://bugzilla.mozilla.org/show_bug.cgi?id=1271354 38 // https://bugzilla.mozilla.org/show_bug.cgi?id=1271354
39 let fullOptionsUrl = browser.extension.getURL(optionsUrl); 39 let fullOptionsUrl = browser.extension.getURL(optionsUrl);
40 let optionsTab = tabs.find(tab => tab.url == fullOptionsUrl); 40 let optionsTab = tabs.find(tab => tab.url == fullOptionsUrl);
41 if (optionsTab) 41 if (optionsTab)
42 { 42 {
43 callback(optionsTab); 43 callback(optionsTab);
44 return; 44 return;
45 } 45 }
46 46
47 // Newly created tabs might have about:blank as their URL in Firefox rather 47 // Newly created tabs might have about:blank as their URL in Firefox
48 // than the final options page URL, we need to wait for those to finish 48 // or undefined in Microsoft Edge rather than the final options page URL,
49 // loading. 49 // we need to wait for those to finish loading.
50 let potentialOptionTabIds = new Set( 50 let potentialOptionTabIds = new Set(
51 tabs.filter(tab => tab.url == "about:blank" && tab.status == "loading") 51 tabs.filter(tab =>
52 (tab.url == "about:blank" || !tab.url) && tab.status == "loading")
52 .map(tab => tab.id) 53 .map(tab => tab.id)
53 ); 54 );
54 if (potentialOptionTabIds.size == 0) 55 if (potentialOptionTabIds.size == 0)
55 { 56 {
56 callback(); 57 callback();
57 return; 58 return;
58 } 59 }
59 let removeListener; 60 let removeListener;
60 let updateListener = (tabId, changeInfo, tab) => 61 let updateListener = (tabId, changeInfo, tab) =>
61 { 62 {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 args: [ 215 args: [
215 { 216 {
216 host: currentPage.url.hostname.replace(/^www\./, ""), 217 host: currentPage.url.hostname.replace(/^www\./, ""),
217 whitelisted: !!checkWhitelisted(currentPage) 218 whitelisted: !!checkWhitelisted(currentPage)
218 } 219 }
219 ] 220 ]
220 }); 221 });
221 }); 222 });
222 }); 223 });
223 }); 224 });
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