| OLD | NEW | 
|    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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  193     let subscription = Subscription.fromURL(downloadable.redirectURL || |  193     let subscription = Subscription.fromURL(downloadable.redirectURL || | 
|  194                                             downloadable.url); |  194                                             downloadable.url); | 
|  195     if (downloadable.redirectURL && |  195     if (downloadable.redirectURL && | 
|  196         downloadable.redirectURL != downloadable.url) |  196         downloadable.redirectURL != downloadable.url) | 
|  197     { |  197     { | 
|  198       let oldSubscription = Subscription.fromURL(downloadable.url); |  198       let oldSubscription = Subscription.fromURL(downloadable.url); | 
|  199       subscription.title = oldSubscription.title; |  199       subscription.title = oldSubscription.title; | 
|  200       subscription.disabled = oldSubscription.disabled; |  200       subscription.disabled = oldSubscription.disabled; | 
|  201       subscription.lastCheck = oldSubscription.lastCheck; |  201       subscription.lastCheck = oldSubscription.lastCheck; | 
|  202  |  202  | 
|  203       let listed = (oldSubscription.url in FilterStorage.knownSubscriptions); |  203       let listed = FilterStorage.knownSubscriptions.has(oldSubscription.url); | 
|  204       if (listed) |  204       if (listed) | 
|  205         FilterStorage.removeSubscription(oldSubscription); |  205         FilterStorage.removeSubscription(oldSubscription); | 
|  206  |  206  | 
|  207       delete Subscription.knownSubscriptions[oldSubscription.url]; |  207       Subscription.knownSubscriptions.delete(oldSubscription.url); | 
|  208  |  208  | 
|  209       if (listed) |  209       if (listed) | 
|  210         FilterStorage.addSubscription(subscription); |  210         FilterStorage.addSubscription(subscription); | 
|  211     } |  211     } | 
|  212  |  212  | 
|  213     // The download actually succeeded |  213     // The download actually succeeded | 
|  214     subscription.lastSuccess = subscription.lastDownload = Math.round( |  214     subscription.lastSuccess = subscription.lastDownload = Math.round( | 
|  215       Date.now() / MILLIS_IN_SECOND |  215       Date.now() / MILLIS_IN_SECOND | 
|  216     ); |  216     ); | 
|  217     subscription.downloadStatus = "synchronize_ok"; |  217     subscription.downloadStatus = "synchronize_ok"; | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  328         request.open("GET", fallbackURL); |  328         request.open("GET", fallbackURL); | 
|  329         request.overrideMimeType("text/plain"); |  329         request.overrideMimeType("text/plain"); | 
|  330         request.channel.loadFlags = request.channel.loadFlags | |  330         request.channel.loadFlags = request.channel.loadFlags | | 
|  331                                     request.channel.INHIBIT_CACHING | |  331                                     request.channel.INHIBIT_CACHING | | 
|  332                                     request.channel.VALIDATE_ALWAYS; |  332                                     request.channel.VALIDATE_ALWAYS; | 
|  333         request.addEventListener("load", ev => |  333         request.addEventListener("load", ev => | 
|  334         { |  334         { | 
|  335           if (onShutdown.done) |  335           if (onShutdown.done) | 
|  336             return; |  336             return; | 
|  337  |  337  | 
|  338           if (!(subscription.url in FilterStorage.knownSubscriptions)) |  338           if (!FilterStorage.knownSubscriptions.has(subscription.url)) | 
|  339             return; |  339             return; | 
|  340  |  340  | 
|  341           let match = /^(\d+)(?:\s+(\S+))?$/.exec(request.responseText); |  341           let match = /^(\d+)(?:\s+(\S+))?$/.exec(request.responseText); | 
|  342           if (match && match[1] == "301" &&    // Moved permanently |  342           if (match && match[1] == "301" &&    // Moved permanently | 
|  343               match[2] && /^https?:\/\//i.test(match[2])) |  343               match[2] && /^https?:\/\//i.test(match[2])) | 
|  344           { |  344           { | 
|  345             redirectCallback(match[2]); |  345             redirectCallback(match[2]); | 
|  346           } |  346           } | 
|  347           else if (match && match[1] == "410") // Gone |  347           else if (match && match[1] == "410") // Gone | 
|  348           { |  348           { | 
|  349             let data = "[Adblock]\n" + |  349             let data = "[Adblock]\n" + | 
|  350               subscription.filters.map(f => f.text).join("\n"); |  350               subscription.filters.map(f => f.text).join("\n"); | 
|  351             redirectCallback("data:text/plain," + encodeURIComponent(data)); |  351             redirectCallback("data:text/plain," + encodeURIComponent(data)); | 
|  352           } |  352           } | 
|  353         }, false); |  353         }, false); | 
|  354         request.send(null); |  354         request.send(null); | 
|  355       } |  355       } | 
|  356     } |  356     } | 
|  357   } |  357   } | 
|  358 }; |  358 }; | 
|  359 Synchronizer.init(); |  359 Synchronizer.init(); | 
| OLD | NEW |