angular/angular.js — pull request #5047 by wizardwerdna (2013-11-20 07:09:58+00:00)
Title: fix(ngMock window.inject): Remove Error 'stack' property changes

Recent browsers, particularly PhantomJS 1.9.2 and Safari 7.0
treat the stack property as non-configurable and unwritable.

Because window.inject captures the stack at the time of the inject,
and attempts to insert it into a captured throw from the injected
function by modifying e.stack, a meaningless error message and
stack is thrown instead.

This commit inserts two tests exposing the problem, and implements
a solution passing those tests. The solution provides an object that
mimics the old Error object, with the additional stack information, where
possible (Error is not standardized on stack, line and file information), and
then captures the toString function from the Error object prototype.

An exception is IE8 or less, which fails to yield meaningful messages
under both the status quo and this instant commit. Accordingly, the test
memorializes the current IE8 behavior as a passing example.

modified: src/ngMock/angular-mocks.js
modified: test/ngMock/angular-mocksSpec.js