Skip to content

Commit

Permalink
Fixes #1627 #1623
Browse files Browse the repository at this point in the history
  • Loading branch information
petkaantonov committed Nov 28, 2019
1 parent bd20f79 commit f880445
Showing 1 changed file with 4 additions and 31 deletions.
35 changes: 4 additions & 31 deletions src/debuggability.js
Expand Up @@ -46,37 +46,10 @@ var deferUnhandledRejectionCheck;
promises.length = 0;
}

if (typeof document === "object" && document.createElement) {
deferUnhandledRejectionCheck = (function() {
var iframeSetTimeout;

function checkIframe() {
if (document.body) {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
if (iframe.contentWindow &&
iframe.contentWindow.setTimeout) {
iframeSetTimeout = iframe.contentWindow.setTimeout;
}
document.body.removeChild(iframe);
}
}
checkIframe();
return function(promise) {
promises.push(promise);
if (iframeSetTimeout) {
iframeSetTimeout(unhandledRejectionCheck, 1);
} else {
checkIframe();
}
};
})();
} else {
deferUnhandledRejectionCheck = function(promise) {
promises.push(promise);
setTimeout(unhandledRejectionCheck, 1);
};
}
deferUnhandledRejectionCheck = function(promise) {
promises.push(promise);
setTimeout(unhandledRejectionCheck, 1);
};

es5.defineProperty(Promise, "_unhandledRejectionCheck", {
value: unhandledRejectionCheck
Expand Down

0 comments on commit f880445

Please sign in to comment.