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

Side by Side Diff: background.js

Issue 6468765319430144: Issue 417 - Reinitializing removed filter lists (Platform) (Closed)
Patch Set: Moved check out of Core code Created May 26, 2014, 5:43 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 | lib/filesystem/io.js » ('j') | 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; 47 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
48 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT HER; 48 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT HER;
49 49
50 // Chrome on Linux does not fully support chrome.notifications until version 35 50 // Chrome on Linux does not fully support chrome.notifications until version 35
51 // https://code.google.com/p/chromium/issues/detail?id=291485 51 // https://code.google.com/p/chromium/issues/detail?id=291485
52 var canUseChromeNotifications = require("info").platform == "chromium" 52 var canUseChromeNotifications = require("info").platform == "chromium"
53 && "notifications" in chrome 53 && "notifications" in chrome
54 && (navigator.platform.indexOf("Linux") == -1 || parseInt(require("info").appl icationVersion) > 34); 54 && (navigator.platform.indexOf("Linux") == -1 || parseInt(require("info").appl icationVersion) > 34);
55 55
56 var seenDataCorruption = false; 56 var seenDataCorruption = false;
57 var filterlistsReinitialized = false;
57 require("filterNotifier").FilterNotifier.addListener(function(action) 58 require("filterNotifier").FilterNotifier.addListener(function(action)
58 { 59 {
59 if (action == "load") 60 if (action == "load")
60 { 61 {
61 var importingOldData = importOldData(); 62 var importingOldData = importOldData();
62 63
63 var addonVersion = require("info").addonVersion; 64 var addonVersion = require("info").addonVersion;
64 var prevVersion = ext.storage.currentVersion; 65 var prevVersion = ext.storage.currentVersion;
66
67 // There are no filters stored so we need to reinitialize all filterlists
68 if (FilterStorage.subscriptions.length === 0)
69 {
70 filterlistsReinitialized = true;
71 prevVersion = null;
72 }
73
65 if (prevVersion != addonVersion || FilterStorage.firstRun) 74 if (prevVersion != addonVersion || FilterStorage.firstRun)
66 { 75 {
67 seenDataCorruption = prevVersion && FilterStorage.firstRun; 76 seenDataCorruption = prevVersion && FilterStorage.firstRun;
68 ext.storage.currentVersion = addonVersion; 77 ext.storage.currentVersion = addonVersion;
69 if (!importingOldData) 78 if (!importingOldData)
70 addSubscription(prevVersion); 79 addSubscription(prevVersion);
71 } 80 }
72 81
73 if (canUseChromeNotifications) 82 if (canUseChromeNotifications)
74 initChromeNotifications(); 83 initChromeNotifications();
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 page.sendMessage({type: "clickhide-deactivate"}); 607 page.sendMessage({type: "clickhide-deactivate"});
599 refreshIconAndContextMenu(page); 608 refreshIconAndContextMenu(page);
600 }); 609 });
601 610
602 setTimeout(function() 611 setTimeout(function()
603 { 612 {
604 var notificationToShow = Notification.getNextToShow(); 613 var notificationToShow = Notification.getNextToShow();
605 if (notificationToShow) 614 if (notificationToShow)
606 showNotification(notificationToShow); 615 showNotification(notificationToShow);
607 }, 3 * 60 * 1000); 616 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « no previous file | lib/filesystem/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld