| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // (e.g. requests initiated by Flash) with the type `other`. | 369 // (e.g. requests initiated by Flash) with the type `other`. |
| 370 // https://code.google.com/p/chromium/issues/detail?id=410382 | 370 // https://code.google.com/p/chromium/issues/detail?id=410382 |
| 371 var match = navigator.userAgent.match(/\bChrome\/(\d+)/); | 371 var match = navigator.userAgent.match(/\bChrome\/(\d+)/); |
| 372 if (match) | 372 if (match) |
| 373 { | 373 { |
| 374 var version = parseInt(match[1], 10); | 374 var version = parseInt(match[1], 10); |
| 375 if (version >= 38 && version <= 48) | 375 if (version >= 38 && version <= 48) |
| 376 return [["OTHER", "OBJECT", "OBJECT_SUBREQUEST"]]; | 376 return [["OTHER", "OBJECT", "OBJECT_SUBREQUEST"]]; |
| 377 } | 377 } |
| 378 | 378 |
| 379 // Chrome <44 doesn't have ResourceType. |
| 380 var ResourceType = chrome.webRequest.ResourceType || {}; |
| 381 |
| 379 // Before Chrome 49, requests of the type `font` and `ping` | 382 // Before Chrome 49, requests of the type `font` and `ping` |
| 380 // have been reported with the type `other`. | 383 // have been reported with the type `other`. |
| 381 // https://code.google.com/p/chromium/issues/detail?id=410382 | 384 // https://code.google.com/p/chromium/issues/detail?id=410382 |
| 382 var otherTypes = ["OTHER", "MEDIA"]; | 385 var otherTypes = ["OTHER", "MEDIA"]; |
| 383 if (!("FONT" in chrome.webRequest.ResourceType)) | 386 if (!("FONT" in ResourceType)) |
| 384 otherTypes.push("FONT"); | 387 otherTypes.push("FONT"); |
| 385 if (!("PING" in chrome.webRequest.ResourceType)) | 388 if (!("PING" in ResourceType)) |
| 386 otherTypes.push("PING"); | 389 otherTypes.push("PING"); |
| 387 | 390 |
| 388 return [["OBJECT", "OBJECT_SUBREQUEST"], otherTypes]; | 391 return [["OBJECT", "OBJECT_SUBREQUEST"], otherTypes]; |
| 389 } | 392 } |
| 390 }; | 393 }; |
| 391 | 394 |
| 392 chrome.tabs.query({}, function(tabs) | 395 chrome.tabs.query({}, function(tabs) |
| 393 { | 396 { |
| 394 tabs.forEach(function(tab) | 397 tabs.forEach(function(tab) |
| 395 { | 398 { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 callback(new Page(tab)); | 579 callback(new Page(tab)); |
| 577 } | 580 } |
| 578 else | 581 else |
| 579 { | 582 { |
| 580 ext.pages.open(optionsUrl, callback); | 583 ext.pages.open(optionsUrl, callback); |
| 581 } | 584 } |
| 582 }); | 585 }); |
| 583 }); | 586 }); |
| 584 }; | 587 }; |
| 585 })(); | 588 })(); |
| OLD | NEW |