LEFT | RIGHT |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // While the Fetch API is natively supported since Chrome 42, before | 59 // While the Fetch API is natively supported since Chrome 42, before |
60 // Chrome 47 it failed to fetch files from within the extension bundle. | 60 // Chrome 47 it failed to fetch files from within the extension bundle. |
61 // https://code.google.com/p/chromium/issues/detail?id=466876 | 61 // https://code.google.com/p/chromium/issues/detail?id=466876 |
62 var builtinFetch = global.fetch; | 62 var builtinFetch = global.fetch; |
63 if (builtinFetch) | 63 if (builtinFetch) |
64 global.fetch = function(url, init) | 64 global.fetch = function(url, init) |
65 { | 65 { |
66 return builtinFetch(url, init).catch(function(reason) | 66 return builtinFetch(url, init).catch(function(reason) |
67 { | 67 { |
68 if (new URL(url, document.URL).protocol == "chrome-extension:") | 68 if (new URL(url, document.URL).protocol == "chrome-extension:") |
69 return fetch(url) | 69 return fetch(url); |
70 throw reason; | 70 throw reason; |
71 }); | 71 }); |
72 }; | 72 }; |
73 else | 73 else |
74 global.fetch = fetch; | 74 global.fetch = fetch; |
75 })(this); | 75 })(this); |
LEFT | RIGHT |