Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 293 } |
294 | 294 |
295 var showPreview = Prefs.previewimages && !("tooltip" in item); | 295 var showPreview = Prefs.previewimages && !("tooltip" in item); |
296 showPreview = showPreview && item.typeDescr == "IMAGE"; | 296 showPreview = showPreview && item.typeDescr == "IMAGE"; |
297 showPreview = showPreview && (!item.filter || item.filter.disabled || item.fil ter instanceof WhitelistFilter); | 297 showPreview = showPreview && (!item.filter || item.filter.disabled || item.fil ter instanceof WhitelistFilter); |
298 E("tooltipPreviewBox").hidden = true; | 298 E("tooltipPreviewBox").hidden = true; |
299 if (showPreview) | 299 if (showPreview) |
300 { | 300 { |
301 if (!cacheStorage) | 301 if (!cacheStorage) |
302 { | 302 { |
303 let {Services} = Cu.import("resource://gre/modules/Services.jsm", null); | |
303 // Cache v2 API is enabled by default starting with Gecko 32 | 304 // Cache v2 API is enabled by default starting with Gecko 32 |
304 if (Services.vc.compare(Utils.platformVersion, "32.0") >= 0) | 305 if (Services.vc.compare(Utils.platformVersion, "32.0") >= 0) |
305 { | 306 { |
306 let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInf o.jsm", null); | 307 let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInf o.jsm", null); |
307 let cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].ge tService(Ci.nsICacheStorageService); | 308 cacheStorage = Services.cache2.diskCacheStorage(LoadContextInfo.default, true); |
308 cacheStorage = cacheService.diskCacheStorage(LoadContextInfo.default, tr ue); | |
Wladimir Palant
2014/07/02 05:00:03
Apparently, this interface was added to Services.j
saroyanm
2014/07/02 07:03:41
Good point.
| |
309 } | 309 } |
310 else | 310 else |
311 { | 311 cacheStorage = Services.cache.createSession("HTTP", Ci.nsICache.STORE_AN YWHERE, true); |
312 let cacheService = Cc["@mozilla.org/network/cache-service;1"].getService (Ci.nsICacheService); | |
313 cacheStorage = cacheService.createSession("HTTP", Ci.nsICache.STORE_ANYW HERE, true); | |
Wladimir Palant
2014/07/02 05:00:03
We should use Services.cache here.
| |
314 } | |
315 } | 312 } |
316 | 313 |
317 let showTooltipPreview = function () | 314 let showTooltipPreview = function () |
318 { | 315 { |
319 E("tooltipPreview").setAttribute("src", item.location); | 316 E("tooltipPreview").setAttribute("src", item.location); |
320 E("tooltipPreviewBox").hidden = false; | 317 E("tooltipPreviewBox").hidden = false; |
321 } | 318 }; |
Wladimir Palant
2014/07/02 05:00:03
Missing semicolon after } here.
saroyanm
2014/07/02 07:03:41
Done.
| |
322 try | 319 try |
323 { | 320 { |
324 if (Ci.nsICacheStorage && cacheStorage instanceof Ci.nsICacheStorage) | 321 if (Ci.nsICacheStorage && cacheStorage instanceof Ci.nsICacheStorage) |
325 { | 322 { |
326 cacheStorage.asyncOpenURI(Utils.makeURI(item.location), "", Ci.nsICacheS torage.OPEN_READONLY, { | 323 cacheStorage.asyncOpenURI(Utils.makeURI(item.location), "", Ci.nsICacheS torage.OPEN_READONLY, { |
327 onCacheEntryCheck: function (entry, appCache) | 324 onCacheEntryCheck: function (entry, appCache) |
328 { | 325 { |
329 return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; | 326 return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; |
330 }, | 327 }, |
331 onCacheEntryAvailable: function (entry, isNew, appCache, status) { | 328 onCacheEntryAvailable: function (entry, isNew, appCache, status) { |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1260 return {tooltip: this.itemsDummyTooltip}; | 1257 return {tooltip: this.itemsDummyTooltip}; |
1261 }, | 1258 }, |
1262 | 1259 |
1263 invalidateItem: function(item) | 1260 invalidateItem: function(item) |
1264 { | 1261 { |
1265 let row = this.data.indexOf(item); | 1262 let row = this.data.indexOf(item); |
1266 if (row >= 0) | 1263 if (row >= 0) |
1267 this.boxObject.invalidateRow(row); | 1264 this.boxObject.invalidateRow(row); |
1268 } | 1265 } |
1269 } | 1266 } |
LEFT | RIGHT |