Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/polyfills/fetch.js

Issue 29334701: Issue 3588 - Worked around fetch() API not supporting chrome-extension:// URLs on Chrome <47 (Closed)
Left Patch Set: Created Jan. 27, 2016, 1 p.m.
Right Patch Set: Added missing semicolon Created Jan. 27, 2016, 1:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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);
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld