OLD | NEW |
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-2014 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 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 { | 306 { |
307 // we are looking for the frame that contains the element that | 307 // we are looking for the frame that contains the element that |
308 // is about to load, however if a frame is loading the surrounding | 308 // is about to load, however if a frame is loading the surrounding |
309 // frame is indicated by parentFrameId instead of frameId | 309 // frame is indicated by parentFrameId instead of frameId |
310 var frameId; | 310 var frameId; |
311 if (details.type == "sub_frame") | 311 if (details.type == "sub_frame") |
312 frameId = details.parentFrameId; | 312 frameId = details.parentFrameId; |
313 else | 313 else |
314 frameId = details.frameId; | 314 frameId = details.frameId; |
315 | 315 |
316 frame = frames[frameId] || frames[0]; | 316 frame = frames[frameId] || frames[Object.keys(frames)[0]]; |
317 | 317 |
318 if (frame && !ext.webRequest.onBeforeRequest._dispatch(details.url, deta
ils.type, new Page({id: details.tabId}), frame)) | 318 if (frame && !ext.webRequest.onBeforeRequest._dispatch(details.url, deta
ils.type, new Page({id: details.tabId}), frame)) |
319 return {cancel: true}; | 319 return {cancel: true}; |
320 } | 320 } |
321 | 321 |
322 if (isMainFrame || details.type == "sub_frame") | 322 if (isMainFrame || details.type == "sub_frame") |
323 frames[details.frameId] = {url: details.url, parent: frame}; | 323 frames[details.frameId] = {url: details.url, parent: frame}; |
324 } | 324 } |
325 catch (e) | 325 catch (e) |
326 { | 326 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 }; | 359 }; |
360 | 360 |
361 return ext.onMessage._dispatch(message, sender, sendResponse); | 361 return ext.onMessage._dispatch(message, sender, sendResponse); |
362 }); | 362 }); |
363 | 363 |
364 | 364 |
365 /* Storage */ | 365 /* Storage */ |
366 | 366 |
367 ext.storage = localStorage; | 367 ext.storage = localStorage; |
368 })(); | 368 })(); |
OLD | NEW |