├── images ├── icon16.png ├── icon32.png ├── icon48.png └── icon128.png ├── manifest.json ├── useragent.js ├── polyfills.js ├── README.md └── LICENSE /images/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InterLinked1/chromefill/HEAD/images/icon16.png -------------------------------------------------------------------------------- /images/icon32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InterLinked1/chromefill/HEAD/images/icon32.png -------------------------------------------------------------------------------- /images/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InterLinked1/chromefill/HEAD/images/icon48.png -------------------------------------------------------------------------------- /images/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InterLinked1/chromefill/HEAD/images/icon128.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "ChromeFill", 4 | "version": "0.1", 5 | "description": "Dynamically injects polyfills into sites to support newer JavaScript", 6 | "author": "InterLinked", 7 | "permissions": [ 8 | "webRequest", // needed for modifying user agent 9 | "webRequestBlocking", 10 | "https://*/*", 11 | "http://*/*" 12 | ], 13 | "content_scripts": [{ 14 | "matches": [ 15 | "https://*/*", 16 | "http://*/*" 17 | ], 18 | "js": ["polyfills.js"], 19 | "run_at": "document_start", 20 | "all_frames": true 21 | } 22 | ], 23 | "background": { 24 | "scripts": [ 25 | "useragent.js" 26 | ], 27 | "persistent": true 28 | }, 29 | "icons": { 30 | "16": "images/icon16.png", 31 | "32": "images/icon32.png", 32 | "48": "images/icon48.png", 33 | "128": "images/icon128.png" 34 | } 35 | } -------------------------------------------------------------------------------- /useragent.js: -------------------------------------------------------------------------------- 1 | chrome.webRequest.onBeforeSendHeaders.addListener( 2 | function(details) { 3 | for (var i = 0; i < details.requestHeaders.length; ++i) { 4 | if (details.requestHeaders[i].name !== 'User-Agent') { 5 | continue; 6 | } 7 | var current_agent = details.requestHeaders[i].value; 8 | var chromeVersion = /Chrome\/([0-9.]+)/.exec(current_agent)[1]; 9 | // Slack idiotically blocks old user agents for no reason, stick it to em by giving them something they can't refuse 10 | if (details.url.indexOf("slack.com") !== -1) { // document.domain isn't set, use details.url instead 11 | var chromeVersion = /Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1]; 12 | current_agent = current_agent.replace(chromeVersion, '150.0'); // bump the Chromium version to 150 (watcha gonna do Slack, block us for being too new??) 13 | } 14 | // medium.com / Cloudflare idiotically block user agents with the word "Iron" in them... 15 | // ditto for Slack 16 | // so make SRWare Iron look like regular Chrome 17 | if (current_agent.indexOf(' Iron ') != -1) { 18 | var new_agent = current_agent.replace(' Iron', ''); 19 | details.requestHeaders[i].value = new_agent; 20 | } 21 | break; 22 | } 23 | return {requestHeaders: details.requestHeaders}; 24 | }, {urls: ['']}, ['blocking', 'requestHeaders']); 25 | -------------------------------------------------------------------------------- /polyfills.js: -------------------------------------------------------------------------------- 1 | var actualCode = ` 2 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis 3 | // implemented in Chrome 71 4 | // https://mathiasbynens.be/notes/globalthis 5 | (function() { 6 | if (typeof globalThis === 'object') return; 7 | Object.defineProperty(Object.prototype, '__magic__', { 8 | get: function() { 9 | return this; 10 | }, 11 | configurable: true 12 | }); 13 | __magic__.globalThis = __magic__; 14 | delete Object.prototype.__magic__; 15 | }()); 16 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries 17 | // implemented in Chrome 73 18 | // https://stackoverflow.com/a/68655198 19 | // https://gitlab.com/moongoal/js-polyfill-object.fromentries/-/blob/master/index.js 20 | // -> https://vanillajstoolkit.com/polyfills/objectfromentries/ 21 | if (!Object.fromEntries) { 22 | Object.fromEntries = function (entries) { 23 | if (!entries || !entries[Symbol.iterator]) { 24 | throw new Error('Object.fromEntries() requires a single iterable argument'); 25 | } 26 | let obj = {}; 27 | for (let [key, value] of entries) { 28 | obj[key] = value; 29 | } 30 | return obj; 31 | }; 32 | } 33 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any 34 | // implemented in Chrome 85 35 | // https://github.com/ungap/promise-any 36 | // copied from github-wc-polyfill 37 | if (!('any' in Promise && typeof Promise.any == 'function')) Promise.any = function($) { 38 | return new Promise(function(D, E, A, L) { 39 | A = []; 40 | L = $.map(function($, i) { 41 | return Promise.resolve($).then(D, function(O) { 42 | return ((A[i] = O), --L) || E({ 43 | errors: A 44 | }); 45 | }); 46 | }).length; 47 | }); 48 | }; 49 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled 50 | // implemented in Chrome 76 51 | // https://95yashsharma.medium.com/polyfill-for-promise-allsettled-965f9f2a003 52 | if (!('allSettled' in Promise && typeof Promise.allSettled == 'function')) Promise.allSettled = function (promises) { 53 | let mappedPromises = promises.map((p) => { 54 | return p 55 | .then((value) => { 56 | return { 57 | status: 'fulfilled', 58 | value, 59 | }; 60 | }) 61 | .catch((reason) => { 62 | return { 63 | status: 'rejected', 64 | reason, 65 | }; 66 | }); 67 | }); 68 | return Promise.all(mappedPromises); 69 | }; 70 | // https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask 71 | // implemented in Chrome 71 72 | // https://stackoverflow.com/a/61569775 73 | (function() { 74 | 'use strict'; 75 | // lazy get globalThis, there might be better ways 76 | const globalObj = typeof globalThis === "object" ? globalThis : 77 | typeof global === "object" ? global : 78 | typeof window === "object" ? window : 79 | typeof self === 'object' ? self : 80 | Function('return this')(); 81 | 82 | if (typeof queueMicrotask !== "function") { 83 | 84 | const checkIsCallable = (callback) => { 85 | if (typeof callback !== "function") { 86 | throw new TypeError("Failed to execute 'queueMicrotask': the callback provided as parameter 1 is not a function"); 87 | } 88 | }; 89 | 90 | if (typeof Promise === "function" && typeof Promise.resolve === "function") { 91 | globalObj.queueMicrotask = (callback) => { 92 | checkIsCallable(callback); 93 | Promise.resolve() 94 | .then(() => callback()) // call with no arguments 95 | // if any error occurs during callback execution, 96 | // throw it back to globalObj (using setTimeout to get out of Promise chain) 97 | .catch((err) => setTimeout(() => {throw err;})); 98 | }; 99 | } 100 | else if (typeof MutationObserver === "function") { 101 | globalObj.queueMicrotask = (callback) => { 102 | checkIsCallable(callback); 103 | const observer = new MutationObserver(function() { 104 | callback(); 105 | observer.disconnect(); 106 | }); 107 | const target = document.createElement('div'); 108 | observer.observe(target, {attributes: true}); 109 | target.setAttribute('data-foo', ''); 110 | }; 111 | } 112 | else if (typeof process === "object" && typeof process.nextTick === "function") { 113 | globalObj.queueMicrotask = (callback) => { 114 | checkIsCallable(callback); 115 | process.nextTick(callback); 116 | }; 117 | } 118 | else { 119 | globalObj.queueMicrotask = (callback) => { 120 | checkIsCallable(callback); 121 | setTimeout(callback, 0); 122 | } 123 | } 124 | } 125 | })(); 126 | queueMicrotask(() => 0); 127 | 128 | 129 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll 130 | // implemented in Chrome 85 131 | // https://vanillajstoolkit.com/polyfills/stringreplaceall/ 132 | if (!String.prototype.replaceAll) { 133 | String.prototype.replaceAll = function(str, newStr) { 134 | // If a regex pattern 135 | if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') { 136 | return this.replace(str, newStr); 137 | } 138 | // If a string 139 | return this.replace(new RegExp(str, 'g'), newStr); 140 | }; 141 | }; 142 | // https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/replaceChildren 143 | // implemented in Chrome 86 144 | // https://github.com/XboxYan/dom-polyfill 145 | // copied from github-wc-polyfill 146 | (function() { 147 | if (Element.prototype.replaceChildren === undefined) { 148 | Element.prototype.replaceChildren = function(...nodesOrDOMStrings) { 149 | while (this.lastChild) { 150 | this.removeChild(this.lastChild) 151 | } 152 | if (nodesOrDOMStrings.length) { 153 | this.append(...nodesOrDOMStrings) 154 | } 155 | } 156 | } 157 | }()); 158 | 159 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll 160 | // implemented in Chrome 73 161 | // https://gist.github.com/TheBrenny/039add509c87a3143b9c077f76aa550b#file-matchall-polyfill-js 162 | if (!String.prototype.matchAll) { 163 | String.prototype.matchAll = function (rx) { 164 | if (typeof rx === "string") rx = new RegExp(rx, "g"); // coerce a string to be a global regex 165 | rx = new RegExp(rx); // Clone the regex so we don't update the last index on the regex they pass us 166 | let cap = []; // the single capture 167 | let all = []; // all the captures (return this) 168 | while ((cap = rx.exec(this)) !== null) all.push(cap); // execute and add 169 | return all; // profit! 170 | }; 171 | } 172 | 173 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed 174 | // implemented in Chrome 110 175 | // https://msfn.org/board/topic/185918-arcticfoxienotheretoplaygames-360chrome-v1351030-redux/page/11/#findComment-1278337 176 | if (!Array.prototype.toReversed) { 177 | Array.prototype.toReversed = function () { 178 | return this.slice().reverse(); 179 | }; 180 | } 181 | 182 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced 183 | // implemented in Chrome 110 184 | // https://msfn.org/board/topic/185918-arcticfoxienotheretoplaygames-360chrome-v1351030-redux/page/11/#findComment-1278337 185 | if (!Array.prototype.toSpliced) { 186 | Array.prototype.toSpliced = function (start, deleteCount, ...items) { 187 | const copy = this.slice(); 188 | copy.splice(start, deleteCount, ...items); 189 | return copy; 190 | }; 191 | } 192 | 193 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/with 194 | // implemented in Chrome 110 195 | // https://msfn.org/board/topic/185918-arcticfoxienotheretoplaygames-360chrome-v1351030-redux/page/11/#findComment-1278337 196 | if (!Array.prototype.with) { 197 | Array.prototype.with = function (index, value) { 198 | const copy = this.slice(); 199 | copy[index] = value; 200 | return copy; 201 | }; 202 | } 203 | 204 | `; 205 | 206 | var script = document.createElement('script'); 207 | script.textContent = actualCode; 208 | (document.head||document.documentElement).appendChild(script); 209 | script.remove(); 210 | 211 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat 212 | // implemented in Chrome 71 213 | var intlocscript = document.createElement('script'); 214 | // XXX: This can violate Content Security Policies, but should work on many sites 215 | intlocscript.src= 'https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0&features=Intl.RelativeTimeFormat,Intl.RelativeTimeFormat.~locale.en'; 216 | (document.head||document.documentElement).appendChild(intlocscript); 217 | intlocscript.remove(); 218 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ChromeFill 2 | 3 | Automatically injects polyfills for old Chromium into webpages 4 | 5 | ### Note for (very) old versions of Chromium 6 | 7 | This extension will no longer work well for *very* old versions of Chromium (released prior to 2020). This is because, as of 2023, a large majority of sites are now using functionality that can no longer be polyfilled in old versions of Chromium (see nullish coalescing and optional chaining section, below), and there is no way such functionality can be polyfilled. 8 | 9 | This extension is thus severely degraded in the Chromium version it was initially written to target (Chromium 70), but may still allow slightly newer browsers (e.g. Chromium 109) to function. 10 | 11 | ## Background 12 | 13 | Many users of non-recent Chromium and Firefox browsers noticed in Q4 of 2021 that a lot of websites suddenly stopped working, partially (and in rare cases, completely), within a few weeks of each other. This was due to the adoption of newer JavaScript standards, many bleeding-edge or vendor-specific, and highly-compatible standards-based JavaScript was replaced with this newer code that caused sites to malfunction in older (in the case of Chromium) and other (in the case of non-Chromium and Firefox) browsers. This meant that sites which *used* to work perfectly fine in these browsers no longer did. 14 | 15 | The problem is not that these browsers aren't capable of running these sites properly - they did, just fine, for a long time. Rather, highly compatible JavaScript code was replaced with less compatible JavaScript, which basically killed off support for the majority of browsers overnight. As many libraries included these changes in their code, this "mass breakage" of the World Wide Web occured within a few weeks of each other. 16 | 17 | This hardly went unnoticed - many retrocomputers and computer enthusiasts on the MSFN Forums decried the breakages. The problem turn out to *not* just affect old versions of Chromium. Pale Moon, for instance, is also affected, as are most "alternative" browsers that don't toe the Chromium and Firefox line. Thus, these changes have seriously threatened the open and standards-based foundations of the World Wide Web. 18 | 19 | For more information, see: 20 | 21 | ## What Does This Extension Do? 22 | 23 | Polyfills are designed to address just this problem. Polyfills are JavaScript "hacks" that add support for a JavaScript feature which isn't natively supported by the browser. 24 | 25 | The ChromeFill extension dynamically injects polyfills into webpages before they load in order to add support for JavaScript that wasn't supported when the browser was released. By adding the extension, the polyfills are injected on every page you visit, automatically adding support for these newer browser features so that sites which use this newer JavaScript are better supported. 26 | 27 | ## Browser Support 28 | 29 | This is intended for use with older versions of Chromium-based browsers (Chrome, Iron, etc.). If you are using a recent or supported version of Chrome, you do not need this extension. 30 | 31 | ## How To Install 32 | 33 | This isn't available in the Chrome Web Store, but it's as easy as 1-2-3 to install it: 34 | 35 | 1. Navigate to chrome://extensions/ in your browser 36 | 37 | 2. Toggle "Developer Mode" to on. 38 | 39 | 3. Click "Load Unpackaged" and upload the unzipped [download](https://github.com/InterLinked1/chromefill/archive/refs/heads/master.zip) of this repository. 40 | 41 | That's it! Sites that no longer work properly in older versions of Chromium (such as StackOverflow, for instance) that can benefit from ChromeFill will now do so. No manual action on sites is needed. 42 | 43 | ## Specific Polyfills 44 | 45 | - [globalThis](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis), which provides `this` in global scope. This was only added to Chromium in version 71. 46 | - [fromEntries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries), which was only added to Chromium in version 73 47 | - [queueMicroTask](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask), which was only added to Chromium in version 71. 48 | - [Promise.any](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any), which was only added to Chromium in version 85. 49 | - [Promise.allSettled](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled), which was only added to Chromium in version 76. 50 | - [String.replaceAll](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll), which was only added to Chromium in version 85. 51 | - [replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren), which was only added to Chromium in version 86. 52 | - [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat), which was only added to Chromium in version 71. 53 | - [String.matchAll](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll), which was only added to Chromium in version 73 (version 69 with optional flag enabled). 54 | - [Array.toReversed](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed), which was only added to Chromium in version 110. 55 | - [Array.toSpliced](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced), which was only added to Chromium in version 110. 56 | - [Array.with](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/with), which was only added to Chromium in version 110. 57 | 58 | More polyfills may be added over time to expand compatability, especially as breakage continues to increase. Contributions to add more polyfills are welcome. 59 | 60 | ## Other Fixes 61 | Medium.com sites erroneously block certain user agents, in particular user agents with the word "Iron" in them. This extension removes the word Iron from any offending user agents so that medium.com sites work. 62 | 63 | ## Sites Known To Have Breakage Fixed By This Extension* 64 | - **GitHub** (globalThis) - currently partially broken again due to nullish coalescing and optional chaining (see below) 65 | - **StackExchange** (globalThis) 66 | - **Canvas** (globalThis) 67 | - **Discord** (fromEntries) 68 | - **Discourse** (queueMicroTask) 69 | - **Rockstar Social Club** (Intl.RelativeTimeFormat) 70 | - **Spotify** (Intl.RelativeTimeFormat) 71 | - **Medium**, **Slack** (user agent blocking) 72 | 73 | \* Some breakage historically has been fixed, but new breakage may well have later been introduced that remains unaddressed. 74 | 75 | ## Nullish Coalescing and Optional Chaining 76 | 77 | [Nullish coalescing](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator) and [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) are the two villains at large today, completely unsupported by UXP and Chromium < 80. These operators likely can't be polyfilled, and will need to be transpiled on the fly. This is a known issue that will need to be addressed to unbreak a growing amount of the breakage that exists on the web today. 78 | 79 | If you encounter either of these operators on a website, you should complain to the webmaster or file a support ticket. Because these can't be polyfilled, the use of these operators forms a serious accessibility barrier for browsers and they should be avoided in all web development. 80 | 81 | ## Will the extension be upgraded to Manifest V3? 82 | 83 | No, because that wouldn't make any sense. 84 | 85 | Manifest V3 is the [most recent version of manifests for extensions](https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/). As of January 2022, new public and unlisted Manifest V2 extensions can no longer be published in the Chrome Web Store, and they'll essentially be deprecated throughout 2022. However, [Manifest V3 only supports Chromium 88+](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/), so it would be pointless to use the newer manifest type for this extension. This extension is specifically targeted at older versions of Chromium, so the older manifest must be used. 86 | 87 | This extension will be available open-source for the public and will not be published in the Chrome Web Store, since that is moving to Manifest V3 exclusively, which would preclude support for Chrome 87 and earlier. You can always install it manually in Chrome by enabling Developer Mode for extensions. 88 | 89 | ## Doesn't this promote the usage of outdated/obsolete browsers? 90 | 91 | Nobody's telling you to use an outdated browser or to use this extension. Fundamentally, however, we believe in browser choice (as well as operating system choice). Chromium version 70 (released Oct. 2018) is the last version of Chromium that allows use of the old UI (naturally, `globalThis` was added in Chromium 71). However, some people do not like the new UI and prefer to the use the older one. We believe that individuals who assume the relevant risks have the right to use the software they wish, and the reality is some people are going to use these older browsers, whether Google wants them to or not. This project specifically aims to bridge this gap in support for older Chromium browsers. This project assumes no liability for security issues arising from use of an older browser version. 92 | 93 | With that, happy browsing! 94 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------