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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 E("tooltipPreviewBox").hidden = true; | 299 E("tooltipPreviewBox").hidden = true; |
300 if (showPreview) | 300 if (showPreview) |
301 { | 301 { |
302 if (!cacheStorage) | 302 if (!cacheStorage) |
303 { | 303 { |
304 let {Services} = Cu.import("resource://gre/modules/Services.jsm", null); | 304 let {Services} = Cu.import("resource://gre/modules/Services.jsm", null); |
305 // Cache v2 API is enabled by default starting with Gecko 32 | 305 // Cache v2 API is enabled by default starting with Gecko 32 |
306 if (Services.vc.compare(Utils.platformVersion, "32.0a1") >= 0) | 306 if (Services.vc.compare(Utils.platformVersion, "32.0a1") >= 0) |
307 { | 307 { |
308 let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInf o.jsm", null); | 308 let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInf o.jsm", null); |
309 cacheStorage = Services.cache2.diskCacheStorage(LoadContextInfo.fromLoad Context( | 309 let loadContext = content.QueryInterface(Ci.nsIInterfaceRequestor) |
310 content.QueryInterface(Ci.nsIInterfaceRequestor) | 310 .getInterface(Ci.nsIWebNavigation) |
311 .getInterface(Ci.nsIWebNavigation) | 311 .QueryInterface(Ci.nsILoadContext); |
312 .QueryInterface(Ci.nsILoadContext), false), false); | 312 cacheStorage = Services.cache2.diskCacheStorage(LoadContextInfo.fromLoad Context(loadContext, false), false); |
Wladimir Palant
2014/07/04 18:09:00
Nit: The indentation here is strange, normally you
saroyanm
2014/07/04 19:32:12
Done.
| |
313 } | 313 } |
314 else | 314 else |
315 cacheStorage = Services.cache.createSession("HTTP", Ci.nsICache.STORE_AN YWHERE, true); | 315 cacheStorage = Services.cache.createSession("HTTP", Ci.nsICache.STORE_AN YWHERE, true); |
316 } | 316 } |
317 | 317 |
318 let showTooltipPreview = function () | 318 let showTooltipPreview = function () |
319 { | 319 { |
320 E("tooltipPreview").setAttribute("src", item.location); | 320 E("tooltipPreview").setAttribute("src", item.location); |
321 E("tooltipPreviewBox").hidden = false; | 321 E("tooltipPreviewBox").hidden = false; |
322 }; | 322 }; |
323 try | 323 try |
324 { | 324 { |
325 if (Ci.nsICacheStorage && cacheStorage instanceof Ci.nsICacheStorage) | 325 if (Ci.nsICacheStorage && cacheStorage instanceof Ci.nsICacheStorage) |
326 { | 326 { |
327 cacheStorage.asyncOpenURI(Utils.makeURI(item.location), "", Ci.nsICacheS torage.OPEN_READONLY, { | 327 cacheStorage.asyncOpenURI(Utils.makeURI(item.location), "", Ci.nsICacheS torage.OPEN_READONLY, { |
328 onCacheEntryCheck: function () | 328 onCacheEntryCheck: function (entry, appCache) |
329 { | 329 { |
330 return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; | 330 return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; |
331 }, | 331 }, |
332 onCacheEntryAvailable: function (entry, isNew) { | 332 onCacheEntryAvailable: function (entry, isNew, appCache, status) |
333 { | |
333 if (!isNew) | 334 if (!isNew) |
334 showTooltipPreview(); | 335 showTooltipPreview(); |
335 } | 336 } |
336 }); | 337 }); |
337 } | 338 } |
338 else | 339 else |
339 { | 340 { |
340 cacheStorage.asyncOpenCacheEntry(item.location, Ci.nsICache.ACCESS_READ, { | 341 cacheStorage.asyncOpenCacheEntry(item.location, Ci.nsICache.ACCESS_READ, { |
341 onCacheEntryAvailable: function(descriptor) | 342 onCacheEntryAvailable: function(descriptor, accessGranted, status) |
342 { | 343 { |
343 if (!descriptor) | 344 if (!descriptor) |
344 return; | 345 return; |
345 descriptor.close(); | 346 descriptor.close(); |
346 showTooltipPreview(); | 347 showTooltipPreview(); |
347 }, | 348 }, |
348 onCacheEntryDoomed: function(status) | 349 onCacheEntryDoomed: function(status) |
349 { | 350 { |
350 } | 351 } |
351 }); | 352 }); |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1261 return {tooltip: this.itemsDummyTooltip}; | 1262 return {tooltip: this.itemsDummyTooltip}; |
1262 }, | 1263 }, |
1263 | 1264 |
1264 invalidateItem: function(item) | 1265 invalidateItem: function(item) |
1265 { | 1266 { |
1266 let row = this.data.indexOf(item); | 1267 let row = this.data.indexOf(item); |
1267 if (row >= 0) | 1268 if (row >= 0) |
1268 this.boxObject.invalidateRow(row); | 1269 this.boxObject.invalidateRow(row); |
1269 } | 1270 } |
1270 } | 1271 } |
LEFT | RIGHT |