From e45bfa4449d92cd327ec8fe465175c71de72578b Mon Sep 17 00:00:00 2001 From: Richard Herrera Date: Tue, 26 Jan 2016 18:47:16 -0800 Subject: [PATCH 1/2] fix IE11 Script Access Denied error. --- modules/_classof.js | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/modules/_classof.js b/modules/_classof.js index 7813b3de33cd..34d33cbb0b1f 100644 --- a/modules/_classof.js +++ b/modules/_classof.js @@ -5,12 +5,32 @@ var cof = require('./_cof') , ARG = cof(function(){ return arguments; }()) == 'Arguments'; 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 - // builtinTag case - : ARG ? cof(O) - // ES3 arguments fallback - : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; -}; \ No newline at end of file + if (it === undefined) { + return 'Undefined'; + } + + if (it === null) { + return 'Null'; + } + + var O = Object(it); + + // @@toStringTag case + if (TAG in O && typeof O[TAG] === 'string') { + return O[TAG]; + } + + var B = cof(O); + + // builtinTag case + if (ARG) { + return B; + } + + // ES3 arguments fallback + if (B === 'Object' && typeof O.callee === 'function') { + return 'Arguments'; + } + + return B; +}; From 49fce43229dd2a38c9021d60bbc4d75f31416e11 Mon Sep 17 00:00:00 2001 From: Richard Herrera Date: Wed, 3 Feb 2016 15:02:44 -0800 Subject: [PATCH 2/2] Use try/catch to suppress error in IE Edge as well. --- modules/_classof.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/_classof.js b/modules/_classof.js index 34d33cbb0b1f..8849a528fafb 100644 --- a/modules/_classof.js +++ b/modules/_classof.js @@ -16,9 +16,11 @@ module.exports = function(it){ var O = Object(it); // @@toStringTag case - if (TAG in O && typeof O[TAG] === 'string') { - return O[TAG]; - } + try { + if (typeof O[TAG] === 'string') { + return O[TAG]; + } + } catch (e) {} var B = cof(O);