Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix(error): fix #674, handle error.stack readonly case #675

Merged
merged 1 commit into from
Mar 14, 2017

Conversation

JiaLiPassion
Copy link
Collaborator

in phantomJS, the error.stack is readonly, so we need to catch such case and set the stack property directly to ZoneAwareError.

before 0.8.1, the case is OK because code here, https://github.com/angular/zone.js/blob/master/lib/zone.ts#L1955

and

https://github.com/angular/zone.js/blob/master/lib/zone.ts#L1992

before 0.8.1 , the stackTraceLimit is 15, so in PhantomJS, ZoneAwareError can't finish finding all run/runGuarded/runTask, so stackRewrite is false, and ZoneAwareError will not try to override NativeError.stack.

and in 0.8.1, the stackTraceLimit increased to 100 in detect phase, so ZoneAwareError can find all run/runGuarded/runTask, so stackRewrite is true.

In this PR, we just try/catch and write the zoneAware stack frames to ZoneAwareError directly

@mhevery mhevery merged commit 8322be8 into angular:master Mar 14, 2017
@JiaLiPassion JiaLiPassion deleted the stack branch March 17, 2017 03:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants