From fb3ff3454a9997369de4ff22778fe59ecda7bf43 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev <zloirock@zloirock.ru> Date: Tue, 8 Mar 2016 21:06:20 +0600 Subject: [PATCH] Additional fallback for IE11 Script Access Denied error, close #165 --- library/modules/_classof.js | 9 ++++++++- modules/_classof.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/library/modules/_classof.js b/library/modules/_classof.js index 7813b3de33cd..dab3a80f1e56 100644 --- a/library/modules/_classof.js +++ b/library/modules/_classof.js @@ -4,11 +4,18 @@ var cof = require('./_cof') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; +// fallback for IE11 Script Access Denied error +var tryGet = function(it, key){ + try { + return it[key]; + } catch(e){ /* empty */ } +}; + module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case - : typeof (T = (O = Object(it))[TAG]) == 'string' ? T + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback diff --git a/modules/_classof.js b/modules/_classof.js index 7813b3de33cd..dab3a80f1e56 100644 --- a/modules/_classof.js +++ b/modules/_classof.js @@ -4,11 +4,18 @@ var cof = require('./_cof') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; +// fallback for IE11 Script Access Denied error +var tryGet = function(it, key){ + try { + return it[key]; + } catch(e){ /* empty */ } +}; + module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case - : typeof (T = (O = Object(it))[TAG]) == 'string' ? T + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback