Skip to content

Commit bc8041b

Browse files
authored
Merge pull request #223 from hnb2/fix_webmaf_polyfill
Supporting polyfill for WebMAF
2 parents e344943 + d4c8523 commit bc8041b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/es6-promise/polyfill.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ export default function polyfill() {
1818

1919
var P = local.Promise;
2020

21-
if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
22-
return;
21+
if (P) {
22+
var promiseToString = null;
23+
try {
24+
promiseToString = Object.prototype.toString.call(P.resolve());
25+
} catch(e) {
26+
// silently ignored
27+
}
28+
29+
if (promiseToString === '[object Promise]' && !P.cast){
30+
return;
31+
}
2332
}
2433

2534
local.Promise = Promise;

0 commit comments

Comments
 (0)