diff --git a/addons/web/static/lib/unhandled-rejection-polyfill/LICENSE b/addons/web/static/lib/unhandled-rejection-polyfill/LICENSE deleted file mode 100644 index 36fa430616740786fd3e44120acf37e964ff69c5..0000000000000000000000000000000000000000 --- a/addons/web/static/lib/unhandled-rejection-polyfill/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 ustccjw - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/addons/web/static/lib/unhandled-rejection-polyfill/unhandled-rejection-polyfill.js b/addons/web/static/lib/unhandled-rejection-polyfill/unhandled-rejection-polyfill.js deleted file mode 100644 index 9422078ac370ed1d16da1377208a95de8f4f3436..0000000000000000000000000000000000000000 --- a/addons/web/static/lib/unhandled-rejection-polyfill/unhandled-rejection-polyfill.js +++ /dev/null @@ -1,75 +0,0 @@ -// based on https://github.com/ustccjw/unhandled-rejection-polyfill -(function () { -"use strict"; - -var self = window; -var OriginalPromise = self.Promise; - -function dispatchUnhandledRejectionEvent(promise, reason) { - var event = document.createEvent('Event'); - Object.defineProperties(event, { - promise: { - value: promise, - writable: false, - }, - reason: { - value: reason, - writable: false, - }, - }); - event.initEvent('unhandledrejection', false, true); - window.dispatchEvent(event); -} - -function MyPromise(resolver) { - if (!(this instanceof MyPromise)) { - throw new TypeError('Cannot call a class as a function'); - } - var promise = new OriginalPromise(function (resolve, reject) { - var customReject = function (reason) { - // macro-task (setTimeout) will execute after micro-task (promise) - setTimeout(function () { - if (promise.handled !== true) { - dispatchUnhandledRejectionEvent(promise, reason); - } - }, 0); - return reject(reason); - }; - try { - return resolver(resolve, customReject); - } catch (err) { - return customReject(err); - } - }); - promise.__proto__ = MyPromise.prototype; - return promise; -} - -MyPromise.__proto__ = OriginalPromise; -MyPromise.prototype.__proto__ = OriginalPromise.prototype; - - -MyPromise.prototype.then = function (resolve, reject) { - var self = this; - return OriginalPromise.prototype.then.call(this, resolve, reject && (function (reason) { - self.handled = true; - return reject(reason); - })); -}; - -MyPromise.prototype.catch = function (reject) { - var self = this; - return OriginalPromise.prototype.catch.call(this, reject && (function (reason) { - self.handled = true; - return reject(reason); - })); -}; - -MyPromise.polyfill = function () { - if (typeof PromiseRejectionEvent === 'undefined') { - window.Promise = MyPromise; - } -}; -MyPromise.polyfill(); - -})(); diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index 294475e5aca26e37ae46a4ac156516cbfbdb18f2..644f72b2435dd32cdf13988ee5b237f5617420bc 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -45,7 +45,6 @@ <!-- boot.js script needs to work --> <template id="_assets_common_minimal_js"> <script type="text/javascript" src="/web/static/lib/es6-promise/es6-promise-polyfill.js"></script> - <script type="text/javascript" src="/web/static/lib/unhandled-rejection-polyfill/unhandled-rejection-polyfill.js"></script> <script type="text/javascript" src="/web/static/src/js/promise_extension.js"></script> <script type="text/javascript" src="/web/static/src/js/boot.js"></script> </template>