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

Delta Between Two Patch Sets: adblockplus/Api.jsm

Issue 29626577: Issue 6108 - No filter list is selected after a migration failure (Closed)
Left Patch Set: Adding USER_REMOVED_EXCEPTIONS_SUB_PREF Created Dec. 5, 2017, 9:42 a.m.
Right Patch Set: Small adjustments Created Dec. 5, 2017, 3:51 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 | « no previous file | adblockplus/build.py » ('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-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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const USER_REMOVED_EXCEPTIONS_SUB_PREF = "user_removed_exception_subscription"; 50 const USER_REMOVED_EXCEPTIONS_SUB_PREF = "user_removed_exception_subscription";
51 51
52 function initFilterListeners() 52 function initFilterListeners()
53 { 53 {
54 FilterNotifier.on("load", onFiltersLoad); 54 FilterNotifier.on("load", onFiltersLoad);
55 FilterNotifier.on("save", onFiltersSave); 55 FilterNotifier.on("save", onFiltersSave);
56 } 56 }
57 57
58 function onFiltersLoad() 58 function onFiltersLoad()
59 { 59 {
60 let {addonVersion} = require("info");
61 let detectedSubscriptionFailure = !hasBlockSubscription() && 60 let detectedSubscriptionFailure = !hasBlockSubscription() &&
62 (!getBoolPref(SUBSCRIPTIONS_SAVED_PREF) || !getBoolPref(USER_REMOVED_BLOCK_S UBS_PREF) || FilterStorage.loadFromDiskFailed); 61 (!getBoolPref(SUBSCRIPTIONS_SAVED_PREF) || !getBoolPref(USER_REMOVED_BLOCK_S UBS_PREF) || FilterStorage.loadFromDiskFailed);
63 62
64 // We will only try to recover the default subscription settings if the addonV ersion hasn't changed, 63 // We will only try to recover the default subscription settings if the addonV ersion hasn't changed,
65 // otherwise it will be handled in firstRunActions(), inside ui.js 64 // otherwise it will be handled in firstRunActions(), inside ui.js
65 let {addonVersion} = require("info");
66 if (Prefs.currentVersion == addonVersion && detectedSubscriptionFailure) 66 if (Prefs.currentVersion == addonVersion && detectedSubscriptionFailure)
67 { 67 {
68 if (getBoolPref(USER_REMOVED_EXCEPTIONS_SUB_PREF)) 68 if (getBoolPref(USER_REMOVED_EXCEPTIONS_SUB_PREF))
69 { 69 {
70 UI.addSubscription(UI.currentWindow, Prefs.currentVersion); 70 UI.addSubscription(UI.currentWindow, Prefs.currentVersion);
71 } 71 }
72 else 72 else
73 { 73 {
74 UI.addSubscription(UI.currentWindow, "0.0"); 74 UI.addSubscription(UI.currentWindow, "0.0");
75 } 75 }
76 } 76 }
77 Messaging.sendRequest({ type: "Abb:OnFiltersLoad" }); 77 Messaging.sendRequest({ type: "Abb:OnFiltersLoad" });
78 } 78 }
79
79 function onFiltersSave() 80 function onFiltersSave()
80 { 81 {
81 if (hasBlockSubscription()) 82 if (hasBlockSubscription())
82 { 83 {
83 setBoolPref(SUBSCRIPTIONS_SAVED_PREF, true); 84 setBoolPref(SUBSCRIPTIONS_SAVED_PREF, true);
84 } 85 }
85 Messaging.sendRequest({ type: "Abb:OnFiltersSave" }); 86 Messaging.sendRequest({ type: "Abb:OnFiltersSave" });
86 } 87 }
87 88
88 function getBoolPref(name) 89 function getBoolPref(name)
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 { 330 {
330 this.whitelistSite(data["url"], data["whitelisted"]); 331 this.whitelistSite(data["url"], data["whitelisted"]);
331 return {"success": true}; 332 return {"success": true};
332 } 333 }
333 break; 334 break;
334 } 335 }
335 return {"success": false, "error": "malformed request"}; 336 return {"success": false, "error": "malformed request"};
336 }).bind(this), "AdblockPlus:Api"); 337 }).bind(this), "AdblockPlus:Api");
337 } 338 }
338 }; 339 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld