| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 }); | 49 }); |
| 50 | 50 |
| 51 var frames = {}; | 51 var frames = {}; |
| 52 | 52 |
| 53 function onBeforeRequest(details) | 53 function onBeforeRequest(details) |
| 54 { | 54 { |
| 55 if (details.tabId == -1) | 55 if (details.tabId == -1) |
| 56 return {}; | 56 return {}; |
| 57 | 57 |
| 58 var type = details.type; | 58 var type = details.type; |
| 59 // Workaround: Under some circumstances Chrome 29+ gives top frame the | 59 |
| 60 // type "object" instead of "main_frame". We work around that by assuming | 60 // Assume that the first request belongs to the top frame. Chrome may give the |
| 61 // that the first request belongs to the top frame. | 61 // top frame the type "object" instead of "main_frame". |
| 62 if (type == "main_frame" || type == "sub_frame" || !(details.tabId in frames)) | 62 // https://code.google.com/p/chromium/issues/detail?id=281711 |
| 63 if (details.frameId == 0 && !(details.tabId in frames) && type == "object") |
| 64 type = "main_frame"; |
| 65 |
| 66 if (type == "main_frame" || type == "sub_frame") |
| 63 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u
rl); | 67 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u
rl); |
| 64 | 68 |
| 65 if (type == "main_frame") | 69 if (type == "main_frame") |
| 66 return {}; | 70 return {}; |
| 67 | 71 |
| 68 // Type names match Mozilla's with main_frame and sub_frame being the only exc
eptions. | 72 // Type names match Mozilla's with main_frame and sub_frame being the only exc
eptions. |
| 69 if (type == "sub_frame") | 73 if (type == "sub_frame") |
| 70 type = "SUBDOCUMENT"; | 74 type = "SUBDOCUMENT"; |
| 71 else | 75 else |
| 72 type = type.toUpperCase(); | 76 type = type.toUpperCase(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 parent = frameData.parent; | 197 parent = frameData.parent; |
| 194 parentData = getFrameData(tabId, parent); | 198 parentData = getFrameData(tabId, parent); |
| 195 | 199 |
| 196 var frameUrl = frameData.url; | 200 var frameUrl = frameData.url; |
| 197 var parentUrl = (parentData ? parentData.url : frameUrl); | 201 var parentUrl = (parentData ? parentData.url : frameUrl); |
| 198 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) | 202 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) |
| 199 return true; | 203 return true; |
| 200 } | 204 } |
| 201 return false; | 205 return false; |
| 202 } | 206 } |
| LEFT | RIGHT |