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

Delta Between Two Patch Sets: background.js

Issue 4734012065054720: Issue 2634 - Consider alternative URLs for element collapsing (Closed)
Left Patch Set: Created June 7, 2015, 3:09 p.m.
Right Patch Set: Consider all URLs for element collapsing Created June 7, 2015, 3:14 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | include.postload.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 sendResponse(selectors); 327 sendResponse(selectors);
328 break; 328 break;
329 case "should-collapse": 329 case "should-collapse":
330 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) 330 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT"))
331 { 331 {
332 sendResponse(false); 332 sendResponse(false);
333 break; 333 break;
334 } 334 }
335 335
336 var url = new URL(msg.url);
337 var documentHost = extractHostFromFrame(sender.frame); 336 var documentHost = extractHostFromFrame(sender.frame);
338 var filter = defaultMatcher.matchesAny( 337 var blocked = false;
339 stringifyURL(url), msg.mediatype, 338
340 documentHost, isThirdParty(url, documentHost) 339 for (var i = 0; i < msg.urls.length; i++)
341 ); 340 {
342 341 var url = new URL(msg.urls[i], msg.baseURL);
343 if (filter instanceof BlockingFilter) 342 var filter = defaultMatcher.matchesAny(
344 { 343 stringifyURL(url), msg.mediatype,
345 var collapse = filter.collapse; 344 documentHost, isThirdParty(url, documentHost)
346 if (collapse == null) 345 );
347 collapse = Prefs.hidePlaceholders; 346
348 sendResponse(collapse); 347 if (filter instanceof BlockingFilter)
349 } 348 {
350 else 349 if (filter.collapse != null)
351 sendResponse(false); 350 {
351 sendResponse(filter.collapse);
352 return;
353 }
354
355 blocked = true;
356 }
357 }
358
359 sendResponse(blocked && Prefs.hidePlaceholders);
352 break; 360 break;
353 case "get-domain-enabled-state": 361 case "get-domain-enabled-state":
354 // Returns whether this domain is in the exclusion list. 362 // Returns whether this domain is in the exclusion list.
355 // The browser action popup asks us this. 363 // The browser action popup asks us this.
356 if(sender.page) 364 if(sender.page)
357 { 365 {
358 sendResponse({enabled: !isPageWhitelisted(sender.page)}); 366 sendResponse({enabled: !isPageWhitelisted(sender.page)});
359 return; 367 return;
360 } 368 }
361 break; 369 break;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 break; 422 break;
415 } 423 }
416 }); 424 });
417 425
418 // update icon when page changes location 426 // update icon when page changes location
419 ext.pages.onLoading.addListener(function(page) 427 ext.pages.onLoading.addListener(function(page)
420 { 428 {
421 page.sendMessage({type: "clickhide-deactivate"}); 429 page.sendMessage({type: "clickhide-deactivate"});
422 refreshIconAndContextMenu(page); 430 refreshIconAndContextMenu(page);
423 }); 431 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld