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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // | 272 // |
273 // nsIContentPolicy interface implementation | 273 // nsIContentPolicy interface implementation |
274 // | 274 // |
275 | 275 |
276 shouldLoad: function(contentType, contentLocation, requestOrigin, node, mimeTy
peGuess, extra) | 276 shouldLoad: function(contentType, contentLocation, requestOrigin, node, mimeTy
peGuess, extra) |
277 { | 277 { |
278 // Ignore requests without context and top-level documents | 278 // Ignore requests without context and top-level documents |
279 if (!node || contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT) | 279 if (!node || contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT) |
280 return Ci.nsIContentPolicy.ACCEPT; | 280 return Ci.nsIContentPolicy.ACCEPT; |
281 | 281 |
| 282 // Bail out early for chrome: an resource: URLs, this is a work-around for |
| 283 // https://bugzil.la/1127744 and https://bugzil.la/1247640 |
| 284 let location = Utils.unwrapURL(contentLocation); |
| 285 if (location.schemeIs("chrome") || location.schemeIs("resource")) |
| 286 return Ci.nsIContentPolicy.ACCEPT; |
| 287 |
282 // Ignore standalone objects | 288 // Ignore standalone objects |
283 if (contentType == Ci.nsIContentPolicy.TYPE_OBJECT && node.ownerDocument &&
!/^text\/|[+\/]xml$/.test(node.ownerDocument.contentType)) | 289 if (contentType == Ci.nsIContentPolicy.TYPE_OBJECT && node.ownerDocument &&
!/^text\/|[+\/]xml$/.test(node.ownerDocument.contentType)) |
284 return Ci.nsIContentPolicy.ACCEPT; | 290 return Ci.nsIContentPolicy.ACCEPT; |
285 | 291 |
286 let wnd = Utils.getWindow(node); | 292 let wnd = Utils.getWindow(node); |
287 if (!wnd) | 293 if (!wnd) |
288 return Ci.nsIContentPolicy.ACCEPT; | 294 return Ci.nsIContentPolicy.ACCEPT; |
289 | 295 |
290 // Data loaded by plugins should be associated with the document | 296 // Data loaded by plugins should be associated with the document |
291 if (contentType == Ci.nsIContentPolicy.TYPE_OBJECT_SUBREQUEST && node instan
ceof Ci.nsIDOMElement) | 297 if (contentType == Ci.nsIContentPolicy.TYPE_OBJECT_SUBREQUEST && node instan
ceof Ci.nsIDOMElement) |
292 node = node.ownerDocument; | 298 node = node.ownerDocument; |
293 | 299 |
294 // Fix type for objects misrepresented as frames or images | 300 // Fix type for objects misrepresented as frames or images |
295 if (contentType != Ci.nsIContentPolicy.TYPE_OBJECT && (node instanceof Ci.ns
IDOMHTMLObjectElement || node instanceof Ci.nsIDOMHTMLEmbedElement)) | 301 if (contentType != Ci.nsIContentPolicy.TYPE_OBJECT && (node instanceof Ci.ns
IDOMHTMLObjectElement || node instanceof Ci.nsIDOMHTMLEmbedElement)) |
296 contentType = Ci.nsIContentPolicy.TYPE_OBJECT; | 302 contentType = Ci.nsIContentPolicy.TYPE_OBJECT; |
297 | 303 |
298 let location = Utils.unwrapURL(contentLocation); | |
299 let result = shouldAllow(wnd, node, types.get(contentType), location.spec); | 304 let result = shouldAllow(wnd, node, types.get(contentType), location.spec); |
300 return (result ? Ci.nsIContentPolicy.ACCEPT : Ci.nsIContentPolicy.REJECT_REQ
UEST); | 305 return (result ? Ci.nsIContentPolicy.ACCEPT : Ci.nsIContentPolicy.REJECT_REQ
UEST); |
301 }, | 306 }, |
302 | 307 |
303 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode
, mimeType, extra) | 308 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode
, mimeType, extra) |
304 { | 309 { |
305 return Ci.nsIContentPolicy.ACCEPT; | 310 return Ci.nsIContentPolicy.ACCEPT; |
306 }, | 311 }, |
307 | 312 |
308 // | 313 // |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 let property = (hasCols ? "cols" : "rows"); | 485 let property = (hasCols ? "cols" : "rows"); |
481 let weights = parentNode[property].split(","); | 486 let weights = parentNode[property].split(","); |
482 weights[index] = "0"; | 487 weights[index] = "0"; |
483 parentNode[property] = weights.join(","); | 488 parentNode[property] = weights.join(","); |
484 } | 489 } |
485 } | 490 } |
486 else | 491 else |
487 node.classList.add(collapsedClass); | 492 node.classList.add(collapsedClass); |
488 } | 493 } |
489 } | 494 } |
OLD | NEW |