Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 var Policy = exports.Policy = | 70 var Policy = exports.Policy = |
71 { | 71 { |
72 /** | 72 /** |
73 * Map of localized content type names by their identifiers. | 73 * Map of localized content type names by their identifiers. |
74 * @type Map | 74 * @type Map |
75 */ | 75 */ |
76 localizedDescr: new Map(), | 76 localizedDescr: new Map(), |
77 | 77 |
78 /** | 78 /** |
79 * Map containing all schemes that should be ignored by content policy. | 79 * Map containing all schemes that should be ignored by content policy. |
80 * @type Object | 80 * @type Set |
tschuster
2015/10/29 13:23:22
@type Set
Wladimir Palant
2015/10/29 18:17:23
Done.
| |
81 */ | 81 */ |
82 whitelistSchemes: new Set(), | 82 whitelistSchemes: new Set(), |
83 | 83 |
84 /** | 84 /** |
85 * Called on module startup, initializes various exported properties. | 85 * Called on module startup, initializes various exported properties. |
86 */ | 86 */ |
87 init: function() | 87 init: function() |
88 { | 88 { |
89 // Populate types map | 89 // Populate types map |
90 let iface = Ci.nsIContentPolicy; | 90 let iface = Ci.nsIContentPolicy; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 // Store node data | 253 // Store node data |
254 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdParty , locationText, match); | 254 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdParty , locationText, match); |
255 if (match) | 255 if (match) |
256 FilterStorage.increaseHitCount(match, wnd); | 256 FilterStorage.increaseHitCount(match, wnd); |
257 | 257 |
258 return !match || match instanceof WhitelistFilter; | 258 return !match || match instanceof WhitelistFilter; |
259 }, | 259 }, |
260 | 260 |
261 /** | 261 /** |
262 * Checks whether the location's scheme is blockable. | 262 * Checks whether the location's scheme is blockable. |
263 * @param location {nsIURI} | 263 * @param location {nsIURI} |
Thomas Greiner
2015/11/02 14:09:03
Detail: That line's in wrong order. It should be `
| |
264 * @return {Boolean} | 264 * @return {Boolean} |
265 */ | 265 */ |
266 isBlockableScheme: function(location) | 266 isBlockableScheme: function(location) |
267 { | 267 { |
268 return !Policy.whitelistSchemes.has(location.scheme); | 268 return !Policy.whitelistSchemes.has(location.scheme); |
269 }, | 269 }, |
270 | 270 |
271 /** | 271 /** |
272 * Checks whether a page is whitelisted. | 272 * Checks whether a page is whitelisted. |
273 * @param {String} url | 273 * @param {String} url |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 let uri = additional || Utils.makeURI(subject.location.href); | 414 let uri = additional || Utils.makeURI(subject.location.href); |
415 if (!Policy.processNode(subject.opener, subject.opener.document, "POPUP" , uri, false)) | 415 if (!Policy.processNode(subject.opener, subject.opener.document, "POPUP" , uri, false)) |
416 { | 416 { |
417 subject.stop(); | 417 subject.stop(); |
418 Utils.runAsync(() => subject.close()); | 418 Utils.runAsync(() => subject.close()); |
419 } | 419 } |
420 else if (uri.spec == "about:blank") | 420 else if (uri.spec == "about:blank") |
421 { | 421 { |
422 // An about:blank pop-up most likely means that a load will be | 422 // An about:blank pop-up most likely means that a load will be |
423 // initiated asynchronously. Wait for that. | 423 // initiated asynchronously. Wait for that. |
424 Utils.runAsync(function() | 424 Utils.runAsync(() => |
425 { | 425 { |
426 let channel = subject.QueryInterface(Ci.nsIInterfaceRequestor) | 426 let channel = subject.QueryInterface(Ci.nsIInterfaceRequestor) |
427 .getInterface(Ci.nsIDocShell) | 427 .getInterface(Ci.nsIDocShell) |
428 .QueryInterface(Ci.nsIDocumentLoader) | 428 .QueryInterface(Ci.nsIDocumentLoader) |
429 .documentChannel; | 429 .documentChannel; |
430 if (channel) | 430 if (channel) |
431 this.observe(subject, topic, data, channel.URI); | 431 this.observe(subject, topic, data, channel.URI); |
432 }); | 432 }); |
433 } | 433 } |
434 break; | 434 break; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 if (!wnd || wnd.closed) | 681 if (!wnd || wnd.closed) |
682 return; | 682 return; |
683 | 683 |
684 if (entry.type == "OBJECT") | 684 if (entry.type == "OBJECT") |
685 { | 685 { |
686 node.removeEventListener("mouseover", objectMouseEventHander, true); | 686 node.removeEventListener("mouseover", objectMouseEventHander, true); |
687 node.removeEventListener("mouseout", objectMouseEventHander, true); | 687 node.removeEventListener("mouseout", objectMouseEventHander, true); |
688 } | 688 } |
689 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; | 689 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; |
690 } | 690 } |
LEFT | RIGHT |