| 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-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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 353   var keyPrefix = "file:"; | 353   var keyPrefix = "file:"; | 
| 354 | 354 | 
| 355   function fileToKey(file) | 355   function fileToKey(file) | 
| 356   { | 356   { | 
| 357     return keyPrefix + (file instanceof FakeFile ? file.path : file.spec); | 357     return keyPrefix + (file instanceof FakeFile ? file.path : file.spec); | 
| 358   } | 358   } | 
| 359 | 359 | 
| 360   function loadFile(file, successCallback, errorCallback) | 360   function loadFile(file, successCallback, errorCallback) | 
| 361   { | 361   { | 
| 362     var key = fileToKey(file); | 362     var key = fileToKey(file); | 
| 363     ext.storage.get([key], function(items) | 363     var entry = localStorage.getItem(key); | 
| 364     { | 364     if (entry) | 
| 365       var entry = items[key]; | 365       successCallback(JSON.parse(entry)); | 
| 366       if (entry) | 366     else | 
| 367       { | 367       errorCallback(new Error("File doesn't exist")); | 
| 368         successCallback(entry); |  | 
| 369       } |  | 
| 370       else |  | 
| 371       { |  | 
| 372         errorCallback(new Error("File doesn't exist")); |  | 
| 373       } |  | 
| 374     }); |  | 
| 375   } | 368   } | 
| 376 | 369 | 
| 377   function saveFile(file, data, callback) | 370   function saveFile(file, data, callback) | 
| 378   { | 371   { | 
| 379     ext.storage.set(fileToKey(file), | 372     try | 
| 380     { | 373     { | 
| 381       content: data, | 374       localStorage.setItem(fileToKey(file), JSON.stringify({ | 
| 382       lastModified: Date.now() | 375         content: data, | 
| 383     }, callback); | 376         lastModified: Date.now() | 
|  | 377       })); | 
|  | 378     } | 
|  | 379     catch(error) | 
|  | 380     { | 
|  | 381       // QuotaExceededError can happen. Notify the user and ignore | 
|  | 382       var errorMessage = "Subscription storage is full. " + | 
|  | 383         "Please remove some subscriptions and try again."; | 
|  | 384       alert(errorMessage); | 
|  | 385       callback(new Error(errorMessage)); | 
|  | 386       return; | 
|  | 387     } | 
|  | 388     callback(); | 
| 384   } | 389   } | 
| 385   exports.IO = { | 390   exports.IO = { | 
| 386     resolveFilePath: function(path) | 391     resolveFilePath: function(path) | 
| 387     { | 392     { | 
| 388       return new FakeFile(path); | 393       return new FakeFile(path); | 
| 389     }, | 394     }, | 
| 390     readFromFile: function(file, listener, callback) | 395     readFromFile: function(file, listener, callback) | 
| 391     { | 396     { | 
| 392       function onLoaded(entry) | 397       function onLoaded(entry) | 
| 393       { | 398       { | 
| (...skipping 6143 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6537     search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); | 6542     search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); | 
| 6538     chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + searc
      h.join("&")); | 6543     chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + searc
      h.join("&")); | 
| 6539   } | 6544   } | 
| 6540   if ("setUninstallURL" in chrome.runtime) | 6545   if ("setUninstallURL" in chrome.runtime) | 
| 6541   { | 6546   { | 
| 6542     Prefs.untilLoaded.then(setUninstallURL); | 6547     Prefs.untilLoaded.then(setUninstallURL); | 
| 6543     Prefs.on("notificationdata", setUninstallURL); | 6548     Prefs.on("notificationdata", setUninstallURL); | 
| 6544   } | 6549   } | 
| 6545   return exports; | 6550   return exports; | 
| 6546 })(); | 6551 })(); | 
| OLD | NEW | 
|---|