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

fix #574, captureStackTrace will have additional stackframe from Zone…#575

Merged
mhevery merged 1 commit intoangular:masterfrom
JiaLiPassion:issue-574
Jan 12, 2017
Merged

fix #574, captureStackTrace will have additional stackframe from Zone…#575
mhevery merged 1 commit intoangular:masterfrom
JiaLiPassion:issue-574

Conversation

@JiaLiPassion
Copy link
Copy Markdown
Collaborator

Fix #574, from zone.js 0.7.x, we have a patched ZoneAwareError, and we patch everything from native Error includes captureStackTrace and prepareStackTrace like this.

      if (NativeError.hasOwnProperty('captureStackTrace')) {
    Object.defineProperty(ZoneAwareError, 'captureStackTrace', {
      // add named function here because we need to remove this
      // stack frame when prepareStackTrace below
      value: function(targetObject: Object, constructorOpt?: Function) {
        NativeError.captureStackTrace(targetObject, constructorOpt);
      }
    });
  }

It works but will add an additional stack frame, which is the patched function named
value above. So it will break binding.js which try to find the current loaded js filename.

So in this fix, I change the patch function to a named function(zoneCaptureStackTrace),
and remove this stack information when call prepareStackTrace.

@mhevery mhevery merged commit 41f5306 into angular:master Jan 12, 2017
@JiaLiPassion JiaLiPassion deleted the issue-574 branch January 12, 2017 01:23
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.

update to 0.7.4 breaks Electron/PouchDB/LevelDB

3 participants