| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 var frameUrl = frameData.url; | 136 var frameUrl = frameData.url; |
| 137 var parentUrl = (parentData ? parentData.url : frameUrl); | 137 var parentUrl = (parentData ? parentData.url : frameUrl); |
| 138 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) | 138 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) |
| 139 return true; | 139 return true; |
| 140 } | 140 } |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 | 143 |
| 144 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest, ["http://*/*", "http
s://*/*"]); | 144 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest, ["http://*/*", "http
s://*/*"]); |
| 145 | 145 |
| 146 if ('chrome' in window) | 146 if (require("info").platform == "chromium") |
| 147 { | 147 { |
| 148 function onHeadersReceived(details) | 148 function onHeadersReceived(details) |
| 149 { | 149 { |
| 150 if (details.tabId == -1) | 150 if (details.tabId == -1) |
| 151 return; | 151 return; |
| 152 | 152 |
| 153 var type = details.type; | 153 var type = details.type; |
| 154 if (type != "main_frame" && type != "sub_frame") | 154 if (type != "main_frame" && type != "sub_frame") |
| 155 return; | 155 return; |
| 156 | 156 |
| 157 var tab = new Tab({id: details.tabId}); | 157 var tab = new Tab({id: details.tabId}); |
| 158 var url = getFrameUrl(tab, details.frameId); | 158 var url = getFrameUrl(tab, details.frameId); |
| 159 if (url != details.url) | 159 if (url != details.url) |
| 160 return; | 160 return; |
| 161 | 161 |
| 162 var key = null; | 162 var key = null; |
| 163 var signature = null; | 163 var signature = null; |
| 164 for (var i = 0; i < details.responseHeaders.length; i++) | 164 for (var i = 0; i < details.responseHeaders.length; i++) |
| 165 { | 165 { |
| 166 var header = details.responseHeaders[i]; | 166 var header = details.responseHeaders[i]; |
| 167 if (header.name.toLowerCase() == "x-adblock-key" && header.value) | 167 if (header.name.toLowerCase() == "x-adblock-key" && header.value) |
| 168 { | 168 { |
| 169 var index = header.value.indexOf("_"); | 169 var index = header.value.indexOf("_"); |
| 170 if (index >= 0) | 170 if (index >= 0) |
| 171 { | 171 { |
| 172 var key = header.value.substr(0, index); | 172 key = header.value.substr(0, index); |
| 173 var signature = header.value.substr(index + 1); | 173 signature = header.value.substr(index + 1); |
| 174 break; | 174 break; |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 if (!key) | 178 if (!key) |
| 179 return; | 179 return; |
| 180 | 180 |
| 181 var parentUrl = null; | 181 var parentUrl = null; |
| 182 if (type == "sub_frame") | 182 if (type == "sub_frame") |
| 183 parentUrl = getFrameUrl(tab, details.parentFrameId); | 183 parentUrl = getFrameUrl(tab, details.parentFrameId); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 198 host, // HTTP_HOST | 198 host, // HTTP_HOST |
| 199 window.navigator.userAgent // HTTP_USER_AGENT | 199 window.navigator.userAgent // HTTP_USER_AGENT |
| 200 ]; | 200 ]; |
| 201 if (verifySignature(key, signature, params.join("\0"))) | 201 if (verifySignature(key, signature, params.join("\0"))) |
| 202 frames.get(tab)[details.frameId].keyException = true; | 202 frames.get(tab)[details.frameId].keyException = true; |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); | 206 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht
tp://*/*", "https://*/*"]}, ["responseHeaders"]); |
| 207 } | 207 } |
| LEFT | RIGHT |