OLD | NEW |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 * @return {Boolean} false if the request should be blocked | 63 * @return {Boolean} false if the request should be blocked |
64 */ | 64 */ |
65 function shouldAllow(window, node, contentType, location) | 65 function shouldAllow(window, node, contentType, location) |
66 { | 66 { |
67 let response = sendSyncMessage("AdblockPlus:ShouldAllow", { | 67 let response = sendSyncMessage("AdblockPlus:ShouldAllow", { |
68 contentType: contentType, | 68 contentType: contentType, |
69 location: location, | 69 location: location, |
70 frames: getFrames(window), | 70 frames: getFrames(window), |
71 isPrivate: isPrivate(window) | 71 isPrivate: isPrivate(window) |
72 }); | 72 }); |
73 if (response.length == 0) | 73 if (typeof response == "undefined") |
74 return true; | 74 return true; |
75 | 75 |
76 let {allow, collapse, hits} = response[0]; | 76 let {allow, collapse, hits} = response; |
77 for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of
hits) | 77 for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of
hits) |
78 { | 78 { |
79 let context = node; | 79 let context = node; |
80 if (typeof frameIndex == "number") | 80 if (typeof frameIndex == "number") |
81 { | 81 { |
82 context = window; | 82 context = window; |
83 for (let i = 0; i < frameIndex; i++) | 83 for (let i = 0; i < frameIndex; i++) |
84 context = context.parent; | 84 context = context.parent; |
85 context = context.document; | 85 context = context.document; |
86 } | 86 } |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 /** | 313 /** |
314 * Processes nodes scheduled for post-processing (typically hides them). | 314 * Processes nodes scheduled for post-processing (typically hides them). |
315 */ | 315 */ |
316 function postProcessNodes() | 316 function postProcessNodes() |
317 { | 317 { |
318 if (!collapsedClass) | 318 if (!collapsedClass) |
319 { | 319 { |
320 let response = sendSyncMessage("AdblockPlus:GetCollapsedClass"); | 320 collapsedClass = sendSyncMessage("AdblockPlus:GetCollapsedClass"); |
321 if (response.length) | |
322 collapsedClass = response[0]; | |
323 | |
324 if (!collapsedClass) | 321 if (!collapsedClass) |
325 { | 322 { |
326 Utils.runAsync(postProcessNodes); | 323 Utils.runAsync(postProcessNodes); |
327 return; | 324 return; |
328 } | 325 } |
329 } | 326 } |
330 | 327 |
331 let nodes = scheduledNodes; | 328 let nodes = scheduledNodes; |
332 scheduledNodes = null; | 329 scheduledNodes = null; |
333 | 330 |
(...skipping 15 matching lines...) Expand all Loading... |
349 let property = (hasCols ? "cols" : "rows"); | 346 let property = (hasCols ? "cols" : "rows"); |
350 let weights = parentNode[property].split(","); | 347 let weights = parentNode[property].split(","); |
351 weights[index] = "0"; | 348 weights[index] = "0"; |
352 parentNode[property] = weights.join(","); | 349 parentNode[property] = weights.join(","); |
353 } | 350 } |
354 } | 351 } |
355 else | 352 else |
356 node.classList.add(collapsedClass); | 353 node.classList.add(collapsedClass); |
357 } | 354 } |
358 } | 355 } |
OLD | NEW |