14 | Zone.__load_patch("Error",(function(r,e,n){var t,a,o,i,c,s=n.symbol("zoneJsInternalStackFrames"),u=r[n.symbol("Error")]=r.Error,f={};r.Error=d;var k=r.__Zone_Error_BlacklistedStackFrames_policy||r.__Zone_Error_ZoneJsInternalStackFrames_policy||"default";function l(r){for(var e={zoneName:r.zone.name},n=e;r.parent;){var t={zoneName:(r=r.parent).zone.name};e.parent=t,e=t}return n}function p(r,e,n){void 0===n&&(n=!0);for(var s=r.split("\n"),u=0;s[u]!==t&&s[u]!==a&&s[u]!==o&&s[u]!==i&&s[u]!==c&&u<s.length;)u++;for(;u<s.length&&e;u++){var k=s[u];if(k.trim())switch(f[k]){case 0:s.splice(u,1),u--;break;case 1:e=e.parent?e.parent:null,s.splice(u,1),u--;break;default:s[u]+=n?" ["+e.zone.name+"]":" ["+e.zoneName+"]"}}return s.join("\n")}function d(){var r=this,e=u.apply(this,arguments),t=e.originalStack=e.stack;if(d.stackRewrite&&t){var a=n.currentZoneFrame();if("lazy"===k)e[n.symbol("zoneFrameNames")]=l(a);else if("default"===k)try{e.stack=e.zoneAwareStack=p(t,a)}catch(r){}}return this instanceof u&&this.constructor!=u?(Object.keys(e).concat("stack","message").forEach((function(n){var t=e[n];if(void 0!==t)try{r[n]=t}catch(r){}})),this):e}d.prototype=u.prototype,d[s]=f,d.stackRewrite=!1;var m=n.symbol("zoneAwareStack");"lazy"===k&&Object.defineProperty(d.prototype,"zoneAwareStack",{configurable:!0,enumerable:!0,get:function(){return this[m]||(this[m]=p(this.originalStack,this[n.symbol("zoneFrameNames")],!1)),this[m]},set:function(r){this.originalStack=r,this[m]=p(this.originalStack,this[n.symbol("zoneFrameNames")],!1)}});var h=["stackTraceLimit","captureStackTrace","prepareStackTrace"],T=Object.keys(u);if(T&&T.forEach((function(r){0===h.filter((function(e){return e===r})).length&&Object.defineProperty(d,r,{get:function(){return u[r]},set:function(e){u[r]=e}})})),u.hasOwnProperty("stackTraceLimit")&&(u.stackTraceLimit=Math.max(u.stackTraceLimit,15),Object.defineProperty(d,"stackTraceLimit",{get:function(){return u.stackTraceLimit},set:function(r){return u.stackTraceLimit=r}})),u.hasOwnProperty("captureStackTrace")&&Object.defineProperty(d,"captureStackTrace",{value:function r(e,n){u.captureStackTrace(e,n)}}),Object.defineProperty(d,"prepareStackTrace",{get:function(){return u.prepareStackTrace},set:function(r){return u.prepareStackTrace=r&&"function"==typeof r?function(e,n){if(n)for(var t=0;t<n.length;t++)if("zoneCaptureStackTrace"===n[t].getFunctionName()){n.splice(t,1);break}return r.call(this,e,n)}:r}}),"disable"!==k){var v=e.current.fork({name:"detect",onHandleError:function(r,e,n,s){if(s.originalStack&&Error===d)for(var u=s.originalStack.split(/\n/),k=!1,l=!1,p=!1;u.length;){var m=u.shift();if(/:\d+:\d+/.test(m)||"ZoneAwareError"===m){var h=m.split("(")[0].split("@")[0],T=1;if(-1!==h.indexOf("ZoneAwareError")&&(-1!==h.indexOf("new ZoneAwareError")?(t=m,a=m.replace("new ZoneAwareError","new Error.ZoneAwareError")):(o=m,i=m.replace("Error.",""),-1===m.indexOf("Error.ZoneAwareError")&&(c=m.replace("ZoneAwareError","Error.ZoneAwareError"))),f[a]=0),-1!==h.indexOf("runGuarded")?l=!0:-1!==h.indexOf("runTask")?p=!0:-1!==h.indexOf("run")?k=!0:T=0,f[m]=T,k&&l&&p){d.stackRewrite=!0;break}}}return!1}}).fork({name:"child",onScheduleTask:function(r,e,n,t){return r.scheduleTask(n,t)},onInvokeTask:function(r,e,n,t,a,o){return r.invokeTask(n,t,a,o)},onCancelTask:function(r,e,n,t){return r.cancelTask(n,t)},onInvoke:function(r,e,n,t,a,o,i){return r.invoke(n,t,a,o,i)}}),E=Error.stackTraceLimit;Error.stackTraceLimit=100,v.run((function(){v.runGuarded((function(){var r=function(){};v.scheduleEventTask(s,(function(){v.scheduleMacroTask(s,(function(){v.scheduleMicroTask(s,(function(){throw new Error}),void 0,(function(e){e._transitionTo=r,e.invoke()})),v.scheduleMicroTask(s,(function(){throw Error()}),void 0,(function(e){e._transitionTo=r,e.invoke()}))}),void 0,(function(e){e._transitionTo=r,e.invoke()}),(function(){}))}),void 0,(function(e){e._transitionTo=r,e.invoke()}),(function(){}))}))})),Error.stackTraceLimit=E}}))})); |
---|