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

Delta Between Two Patch Sets: options.js

Issue 29339314: Issue 3870 - Rewrite legacy options page to use async messages (Closed)
Left Patch Set: Fetch acceptable ads URL once initially and re-use Created April 7, 2016, 1:03 p.m.
Right Patch Set: Avoid another race condition Created April 7, 2016, 1:27 p.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 | « lib/notificationHelper.js ('k') | safari/ext/background.js » ('j') | 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 "text", "removeExisting"); 76 "text", "removeExisting");
77 var addFilter = wrapper({type: "filters.add"}, "text"); 77 var addFilter = wrapper({type: "filters.add"}, "text");
78 var getFilters = wrapper({type: "filters.get"}, "subscriptionUrl"); 78 var getFilters = wrapper({type: "filters.get"}, "subscriptionUrl");
79 var removeFilter = wrapper({type: "filters.remove"}, "text"); 79 var removeFilter = wrapper({type: "filters.remove"}, "text");
80 80
81 var i18n = ext.i18n; 81 var i18n = ext.i18n;
82 var whitelistedDomainRegexp = /^@@\|\|([^\/:]+)\^\$document$/; 82 var whitelistedDomainRegexp = /^@@\|\|([^\/:]+)\^\$document$/;
83 var delayedSubscriptionSelection = null; 83 var delayedSubscriptionSelection = null;
84 84
85 var acceptableAdsUrl; 85 var acceptableAdsUrl;
86 getPref("subscriptions_exceptionsurl", function(url)
87 {
88 acceptableAdsUrl = url;
89 });
90 86
91 // Loads options and sets UI elements accordingly 87 // Loads options and sets UI elements accordingly
92 function loadOptions() 88 function loadOptions()
93 { 89 {
94 // Set page title to i18n version of "Adblock Plus Options" 90 // Set page title to i18n version of "Adblock Plus Options"
95 document.title = i18n.getMessage("options"); 91 document.title = i18n.getMessage("options");
96 92
97 // Set links 93 // Set links
98 $("#acceptableAdsLink").attr("href", acceptableAdsUrl); 94 getPref("subscriptions_exceptionsurl", function(url)
Sebastian Noack 2016/04/07 13:15:51 We have a race here. Dependent on whether we first
kzar 2016/04/07 13:28:15 Done.
95 {
96 acceptableAdsUrl = url;
97 $("#acceptableAdsLink").attr("href", acceptableAdsUrl);
98 });
99 getDocLink("acceptable_ads", function(url) 99 getDocLink("acceptable_ads", function(url)
100 { 100 {
101 $("#acceptableAdsDocs").attr("href", url); 101 $("#acceptableAdsDocs").attr("href", url);
102 }); 102 });
103 getDocLink("filterdoc", function(url) 103 getDocLink("filterdoc", function(url)
104 { 104 {
105 setLinks("filter-must-follow-syntax", url); 105 setLinks("filter-must-follow-syntax", url);
106 }); 106 });
107 getInfo("application", function(application) 107 getInfo("application", function(application)
108 { 108 {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 onFilterMessage(message.action, message.args[0]); 741 onFilterMessage(message.action, message.args[0]);
742 break; 742 break;
743 case "prefs.respond": 743 case "prefs.respond":
744 onPrefMessage(message.action, message.args[0]); 744 onPrefMessage(message.action, message.args[0]);
745 break; 745 break;
746 case "subscriptions.respond": 746 case "subscriptions.respond":
747 onSubscriptionMessage(message.action, message.args[0]); 747 onSubscriptionMessage(message.action, message.args[0]);
748 break; 748 break;
749 } 749 }
750 }); 750 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld