Left: | ||
Right: |
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-2014 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 * |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 { | 209 { |
210 tabs.forEach(function(tab) | 210 tabs.forEach(function(tab) |
211 { | 211 { |
212 chrome.webNavigation.getAllFrames({tabId: tab.id}, function(details) | 212 chrome.webNavigation.getAllFrames({tabId: tab.id}, function(details) |
213 { | 213 { |
214 if (details && details.length > 0) | 214 if (details && details.length > 0) |
215 { | 215 { |
216 var frames = framesOfTabs[tab.id] = {__proto__: null}; | 216 var frames = framesOfTabs[tab.id] = {__proto__: null}; |
217 | 217 |
218 for (var i = 0; i < details.length; i++) | 218 for (var i = 0; i < details.length; i++) |
219 frames[details[i].frameId] = {url: details[i].url, parent: null}; | |
220 | |
221 for (var i = 0; i < details.length; i++) | |
219 { | 222 { |
220 var parentFrameId = details[i].parentFrameId; | 223 var parentFrameId = details[i].parentFrameId; |
221 | 224 |
222 frames[details[i].frameId] = { | 225 if (parentFrameId != -1) |
223 url: details[i].url, | 226 frames[details[i].frameId].parent = frames[parentFrameId]; |
224 parent: parentFrameId != -1 ? frames[parentFrameId] : null | |
Wladimir Palant
2014/03/06 20:58:18
I don't think that parent frames are guaranteed to
Sebastian Noack
2014/03/06 21:11:55
I tested it and it lists the frames top-down. But
Wladimir Palant
2014/03/21 14:17:35
I think a second pass is exactly what we should im
Sebastian Noack
2014/03/31 15:43:44
Done.
| |
225 }; | |
226 } | 227 } |
227 } | 228 } |
228 }); | 229 }); |
229 }); | 230 }); |
230 }); | 231 }); |
231 | 232 |
232 chrome.webRequest.onBeforeRequest.addListener(function(details) | 233 chrome.webRequest.onBeforeRequest.addListener(function(details) |
233 { | 234 { |
234 if (details.tabId == -1) | 235 if (details.tabId == -1) |
235 return; | 236 return; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 { | 343 { |
343 if (frames[frameId].url == sender.url) | 344 if (frames[frameId].url == sender.url) |
344 return frames[frameId].parent; | 345 return frames[frameId].parent; |
345 } | 346 } |
346 | 347 |
347 return frames[0]; | 348 return frames[0]; |
348 } | 349 } |
349 } | 350 } |
350 }; | 351 }; |
351 }); | 352 }); |
353 | |
354 | |
355 /* Storage */ | |
356 | |
357 ext.storage = localStorage; | |
352 })(); | 358 })(); |
LEFT | RIGHT |