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

Delta Between Two Patch Sets: chrome/content/ui/sidebar.js

Issue 6349471881363456: Fixed: Topic 12380 - No image preview in list of blockable items (Closed)
Left Patch Set: Created Nov. 14, 2013, 11:13 a.m.
Right Patch Set: Created Nov. 29, 2013, 2:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (showPreview) 298 if (showPreview)
299 { 299 {
300 // Check whether image is in cache (stolen from ImgLikeOpera) 300 // Check whether image is in cache (stolen from ImgLikeOpera)
301 if (!cacheSession) 301 if (!cacheSession)
302 { 302 {
303 var cacheService = Cc["@mozilla.org/network/cache-service;1"].getService(C i.nsICacheService); 303 var cacheService = Cc["@mozilla.org/network/cache-service;1"].getService(C i.nsICacheService);
304 cacheSession = cacheService.createSession("HTTP", Ci.nsICache.STORE_ANYWHE RE, true); 304 cacheSession = cacheService.createSession("HTTP", Ci.nsICache.STORE_ANYWHE RE, true);
305 } 305 }
306 306
307 let cacheListener = { 307 let cacheListener =
Wladimir Palant 2013/11/26 11:35:31 Style nit: this bracket should be on the next line
Thomas Greiner 2013/11/29 14:35:44 Done.
308 {
308 onCacheEntryAvailable: function(descriptor, accessGranted, status) 309 onCacheEntryAvailable: function(descriptor, accessGranted, status)
309 { 310 {
310 if (!descriptor) 311 if (!descriptor)
311 return; 312 return;
312 313
313 descriptor.close(); 314 descriptor.close();
314 // Show preview here since this is asynchronous now 315 // Show preview here since this is asynchronous now
315 // and we have a valid descriptor 316 // and we have a valid descriptor
316 E("tooltipPreview").setAttribute("src", item.location); 317 E("tooltipPreview").setAttribute("src", item.location);
318 E("tooltipPreviewBox").hidden = false;
317 }, 319 },
318 onCacheEntryDoomed: function(status) 320 onCacheEntryDoomed: function(status)
319 { 321 {
320 } 322 }
321 }; 323 };
322 try 324 try
323 { 325 {
324 cacheSession.asyncOpenCacheEntry(item.location, Ci.nsICache.ACCESS_READ, c acheListener); 326 cacheSession.asyncOpenCacheEntry(item.location, Ci.nsICache.ACCESS_READ, c acheListener);
325 } 327 }
326 catch (e) 328 catch (e)
327 { 329 {
328 showPreview = false; 330 Cu.reportError(e);
Wladimir Palant 2013/11/26 11:35:31 This should normally never happen, please add Cu.r
Thomas Greiner 2013/11/29 14:35:44 Done.
329 } 331 }
330 } 332 }
331 333
332 if (showPreview) 334 E("tooltipPreviewBox").hidden = true;
333 {
334 E("tooltipPreviewBox").hidden = false;
335 E("tooltipPreview").setAttribute("src", "");
336 }
337 else
338 E("tooltipPreviewBox").hidden = true;
Wladimir Palant 2013/11/26 11:35:31 We should not show the preview box at all if we ar
Thomas Greiner 2013/11/29 14:35:44 Done.
339 } 335 }
340 336
341 const visual = { 337 const visual = {
342 OTHER: true, 338 OTHER: true,
343 IMAGE: true, 339 IMAGE: true,
344 SUBDOCUMENT: true 340 SUBDOCUMENT: true
345 } 341 }
346 342
347 /** 343 /**
348 * Updates context menu before it is shown. 344 * Updates context menu before it is shown.
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 return {tooltip: this.itemsDummyTooltip}; 1237 return {tooltip: this.itemsDummyTooltip};
1242 }, 1238 },
1243 1239
1244 invalidateItem: function(item) 1240 invalidateItem: function(item)
1245 { 1241 {
1246 let row = this.data.indexOf(item); 1242 let row = this.data.indexOf(item);
1247 if (row >= 0) 1243 if (row >= 0)
1248 this.boxObject.invalidateRow(row); 1244 this.boxObject.invalidateRow(row);
1249 } 1245 }
1250 } 1246 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld