| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus extension, | 2 * This file is part of the Adblock Plus extension, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://*
/*", "https://*/*"]}, ["blocking"]); | 18 chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://*
/*", "https://*/*"]}, ["blocking"]); |
| 19 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http
://*/*", "https://*/*"]}, ["responseHeaders"]); | 19 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http
://*/*", "https://*/*"]}, ["responseHeaders"]); |
| 20 chrome.tabs.onUpdated.addListener(onUpdated); |
| 20 chrome.tabs.onRemoved.addListener(forgetTab); | 21 chrome.tabs.onRemoved.addListener(forgetTab); |
| 21 | 22 |
| 22 var onFilterChangeTimeout = null; | 23 var onFilterChangeTimeout = null; |
| 23 function onFilterChange() | 24 function onFilterChange() |
| 24 { | 25 { |
| 25 onFilterChangeTimeout = null; | 26 onFilterChangeTimeout = null; |
| 26 chrome.webRequest.handlerBehaviorChanged(); | 27 chrome.webRequest.handlerBehaviorChanged(); |
| 27 } | 28 } |
| 28 | 29 |
| 29 var importantNotifications = { | 30 var importantNotifications = { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 43 { | 44 { |
| 44 // Execute delayed to prevent multiple executions in a quick succession | 45 // Execute delayed to prevent multiple executions in a quick succession |
| 45 if (onFilterChangeTimeout != null) | 46 if (onFilterChangeTimeout != null) |
| 46 window.clearTimeout(onFilterChangeTimeout); | 47 window.clearTimeout(onFilterChangeTimeout); |
| 47 onFilterChangeTimeout = window.setTimeout(onFilterChange, 2000); | 48 onFilterChangeTimeout = window.setTimeout(onFilterChange, 2000); |
| 48 } | 49 } |
| 49 }); | 50 }); |
| 50 | 51 |
| 51 var frames = {}; | 52 var frames = {}; |
| 52 | 53 |
| 54 function onUpdated(tabId, changeInfo, tab) |
| 55 { |
| 56 var url = changeInfo.url; |
| 57 if (url) |
| 58 { |
| 59 if (url.indexOf("#") > -1) |
| 60 url = url.match(/^(.*?)#/) && RegExp.$1; |
| 61 var lastURL = tabId in frames && frames[tabId].lastURL; |
| 62 if (lastURL != url) |
| 63 { |
| 64 if (lastURL) |
| 65 forgetTab(tabId); |
| 66 |
| 67 if (!(tabId in frames)) |
| 68 frames[tabId] = {}; |
| 69 |
| 70 frames[tabId].lastURL = url; |
| 71 } |
| 72 } |
| 73 } |
| 74 |
| 53 function onBeforeRequest(details) | 75 function onBeforeRequest(details) |
| 54 { | 76 { |
| 55 if (details.tabId == -1) | 77 if (details.tabId == -1) |
| 56 return {}; | 78 return {}; |
| 57 | 79 |
| 58 var type = details.type; | 80 var type = details.type; |
| 59 if (type == "main_frame" || type == "sub_frame") | 81 if (type == "main_frame" || type == "sub_frame") |
| 60 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u
rl); | 82 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u
rl); |
| 61 | 83 |
| 62 if (type == "main_frame") | 84 if (type == "main_frame") |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 parent = frameData.parent; | 212 parent = frameData.parent; |
| 191 parentData = getFrameData(tabId, parent); | 213 parentData = getFrameData(tabId, parent); |
| 192 | 214 |
| 193 var frameUrl = frameData.url; | 215 var frameUrl = frameData.url; |
| 194 var parentUrl = (parentData ? parentData.url : frameUrl); | 216 var parentUrl = (parentData ? parentData.url : frameUrl); |
| 195 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) | 217 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) |
| 196 return true; | 218 return true; |
| 197 } | 219 } |
| 198 return false; | 220 return false; |
| 199 } | 221 } |
| OLD | NEW |