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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 frame = frames[frameId] || frames[Object.keys(frames)[0]]; | 318 frame = frames[frameId] || frames[Object.keys(frames)[0]]; |
319 | 319 |
320 if (frame) | 320 if (frame) |
321 { | 321 { |
322 // Since Chrome 38 requests of type 'object' (e.g. requests | 322 // Since Chrome 38 requests of type 'object' (e.g. requests |
323 // initiated by Flash) are mistakenly reported with the type 'other'. | 323 // initiated by Flash) are mistakenly reported with the type 'other'. |
324 // https://code.google.com/p/chromium/issues/detail?id=410382 | 324 // https://code.google.com/p/chromium/issues/detail?id=410382 |
325 if (requestType == "other" && parseInt(navigator.userAgent.match(/\bCh
rome\/(\d+)/)[1], 10) >= 38) | 325 if (requestType == "other" && parseInt(navigator.userAgent.match(/\bCh
rome\/(\d+)/)[1], 10) >= 38) |
326 requestType = "object"; | 326 requestType = "object"; |
327 | 327 |
328 if (!ext.webRequest.onBeforeRequest._dispatch(details.url, requestType
, new Page({id: details.tabId}), frame)) | 328 var results = ext.webRequest.onBeforeRequest._dispatch( |
| 329 details.url, |
| 330 requestType, |
| 331 new Page({id: details.tabId}), |
| 332 frame |
| 333 ); |
| 334 |
| 335 if (results.indexOf(false) != -1) |
329 return {cancel: true}; | 336 return {cancel: true}; |
330 } | 337 } |
331 } | 338 } |
332 | 339 |
333 if (isMainFrame || details.type == "sub_frame") | 340 if (isMainFrame || details.type == "sub_frame") |
334 frames[details.frameId] = {url: details.url, parent: frame}; | 341 frames[details.frameId] = {url: details.url, parent: frame}; |
335 } | 342 } |
336 catch (e) | 343 catch (e) |
337 { | 344 { |
338 // recent versions of Chrome cancel the request when an error occurs in | 345 // recent versions of Chrome cancel the request when an error occurs in |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 callback(new Page(tab)); | 424 callback(new Page(tab)); |
418 } | 425 } |
419 else | 426 else |
420 { | 427 { |
421 ext.pages.open(optionsUrl, callback); | 428 ext.pages.open(optionsUrl, callback); |
422 } | 429 } |
423 }); | 430 }); |
424 }); | 431 }); |
425 }; | 432 }; |
426 })(); | 433 })(); |
OLD | NEW |