diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 40207e6a..661968a1 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -270,6 +270,16 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { if (value instanceof Error) { return true; } + if ( + typeof window !== 'undefined' && + typeof window.trustedTypes !== 'undefined' + ) { + return ( + value && + typeof value.stack === 'string' && + typeof value.message === 'string' + ); + } if (value && value.constructor && value.constructor.constructor) { var valueGlobal = value.constructor.constructor('return this'); if (j$.isFunction_(valueGlobal)) { diff --git a/src/core/base.js b/src/core/base.js index c40c6559..1d31d89d 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -102,6 +102,16 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { if (value instanceof Error) { return true; } + if ( + typeof window !== 'undefined' && + typeof window.trustedTypes !== 'undefined' + ) { + return ( + value && + typeof value.stack === 'string' && + typeof value.message === 'string' + ); + } if (value && value.constructor && value.constructor.constructor) { var valueGlobal = value.constructor.constructor('return this'); if (j$.isFunction_(valueGlobal)) {