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

Side by Side Diff: background.js

Issue 29328928: Issue 3170 - Fixed: Sitekey not considered for element collapsing (Closed)
Patch Set: Created Oct. 8, 2015, 12:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 break; 332 break;
333 case "should-collapse": 333 case "should-collapse":
334 if (isFrameWhitelisted(sender.page, sender.frame, RegExpFilter.typeMap.DOC UMENT)) 334 if (isFrameWhitelisted(sender.page, sender.frame, RegExpFilter.typeMap.DOC UMENT))
335 { 335 {
336 sendResponse(false); 336 sendResponse(false);
337 break; 337 break;
338 } 338 }
339 339
340 var typeMask = RegExpFilter.typeMap[msg.mediatype]; 340 var typeMask = RegExpFilter.typeMap[msg.mediatype];
341 var documentHost = extractHostFromFrame(sender.frame); 341 var documentHost = extractHostFromFrame(sender.frame);
342 var sitekey = getKey(sender.page, sender.frame);
342 var blocked = false; 343 var blocked = false;
343 344
344 for (var i = 0; i < msg.urls.length; i++) 345 for (var i = 0; i < msg.urls.length; i++)
345 { 346 {
346 var url = new URL(msg.urls[i], msg.baseURL); 347 var url = new URL(msg.urls[i], msg.baseURL);
347 var filter = defaultMatcher.matchesAny( 348 var filter = defaultMatcher.matchesAny(
348 stringifyURL(url), typeMask, 349 stringifyURL(url), typeMask,
349 documentHost, isThirdParty(url, documentHost) 350 documentHost, isThirdParty(url, documentHost), sitekey
350 ); 351 );
351 352
352 if (filter instanceof BlockingFilter) 353 if (filter instanceof BlockingFilter)
353 { 354 {
354 if (filter.collapse != null) 355 if (filter.collapse != null)
355 { 356 {
356 sendResponse(filter.collapse); 357 sendResponse(filter.collapse);
357 return; 358 return;
358 } 359 }
359 360
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 break; 428 break;
428 } 429 }
429 }); 430 });
430 431
431 // update icon when page changes location 432 // update icon when page changes location
432 ext.pages.onLoading.addListener(function(page) 433 ext.pages.onLoading.addListener(function(page)
433 { 434 {
434 page.sendMessage({type: "clickhide-deactivate"}); 435 page.sendMessage({type: "clickhide-deactivate"});
435 refreshIconAndContextMenu(page); 436 refreshIconAndContextMenu(page);
436 }); 437 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld