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

Side by Side Diff: lib/synchronizer.js

Issue 29339382: Issue 3889 - Dispatch subscription.downloading event on transfer (Closed)
Patch Set: Created April 5, 2016, 1:02 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-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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 { 121 {
122 let subscription = Subscription.fromURL(downloadable.url); 122 let subscription = Subscription.fromURL(downloadable.url);
123 subscription.lastCheck = Math.round(downloadable.lastCheck / MILLIS_IN_SECON D); 123 subscription.lastCheck = Math.round(downloadable.lastCheck / MILLIS_IN_SECON D);
124 subscription.softExpiration = Math.round(downloadable.softExpiration / MILLI S_IN_SECOND); 124 subscription.softExpiration = Math.round(downloadable.softExpiration / MILLI S_IN_SECOND);
125 subscription.expires = Math.round(downloadable.hardExpiration / MILLIS_IN_SE COND); 125 subscription.expires = Math.round(downloadable.hardExpiration / MILLIS_IN_SE COND);
126 }, 126 },
127 127
128 _onDownloadStarted: function(downloadable) 128 _onDownloadStarted: function(downloadable)
129 { 129 {
130 let subscription = Subscription.fromURL(downloadable.url); 130 let subscription = Subscription.fromURL(downloadable.url);
131 FilterNotifier.triggerListeners("subscription.downloadStatus", subscription) ; 131 subscription.downloadStatus = "in_progress";
132 }, 132 },
133 133
134 _onDownloadSuccess: function(downloadable, responseText, errorCallback, redire ctCallback) 134 _onDownloadSuccess: function(downloadable, responseText, errorCallback, redire ctCallback)
135 { 135 {
136 let lines = responseText.split(/[\r\n]+/); 136 let lines = responseText.split(/[\r\n]+/);
137 let match = /\[Adblock(?:\s*Plus\s*([\d\.]+)?)?\]/i.exec(lines[0]); 137 let match = /\[Adblock(?:\s*Plus\s*([\d\.]+)?)?\]/i.exec(lines[0]);
138 if (!match) 138 if (!match)
139 return errorCallback("synchronize_invalid_data"); 139 return errorCallback("synchronize_invalid_data");
140 let minVersion = match[1]; 140 let minVersion = match[1];
141 141
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j oin("\n"); 315 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j oin("\n");
316 redirectCallback("data:text/plain," + encodeURIComponent(data)); 316 redirectCallback("data:text/plain," + encodeURIComponent(data));
317 } 317 }
318 }, false); 318 }, false);
319 request.send(null); 319 request.send(null);
320 } 320 }
321 } 321 }
322 }, 322 },
323 }; 323 };
324 Synchronizer.init(); 324 Synchronizer.init();
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