You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
A recent regression, probably in Webkit, has broken certain error messages in Webkit browsers using angularJS with angular.mock. This example:
1'use strict';2describe('failure in ng-mocks',function(){3beforeEach(inject(function($compile,$rootScope){4$compile(5'<div ng-include="\'nofilehere\'"></div>'6)($rootScope);7$rootScope.$digest();8}));9it('displayed by example',function(){10console.log('hello, world');11});12});
Properly fails because "nofilehere" does not exist and has not been inserted into the template cache. We get a very meaningful message when driving this with karma under Chrome (and it worked until recently on most browsers):
Error: Unexpected request: GET nofilehere
(stack trace)
At this time, however, PhantomJS and Chrome instead give the following incomprehensible message with angularJS v1.2.0 and v1.2.1:
TypeError: Attempted to assign to readonly property.
at workFn (/Users/werdna/errors/app/bower_components/angular-mocks/angular-mocks.js:2122)
This occurs because the error is at caught at line 2122 in the following angular-mocks code:
2116for(vari=0,ii=blockFns.length;i<ii;i++){2117try{2118/* jshint -W040 *//* Jasmine explicitly provides a `this` object when calling functions */2119injector.invoke(blockFns[i]||angular.noop,this);2120/* jshint +W040 */2121}catch(e){2122if(e.stack&&errorForStack)e.stack+='\n'+errorForStack.stack;2123throwe;2124}finally{2125errorForStack=null;2126}2127}
and some recent versions of Webkit Error messages have read-only 'stack' properties. Thus, line 2122 fails, and the new TypeError is thrown, losing the stack. Unfortunately, I couldn't think of any other way to rethrow an Error instance with a modified stack string, and was unable to come up with a meaningful pull request.
Clearly, changes derive from the now-false assumption that Error instances were mutable -- at least for Webkit, now, they are not.
Any thoughts?
The text was updated successfully, but these errors were encountered:
I closed the issue because I inadvertently entered it twice. The original post is still standing, and a pull request fixes the issue without losing the inject-level stack messages.
A recent regression, probably in Webkit, has broken certain error messages in Webkit browsers using angularJS with angular.mock. This example:
Properly fails because "nofilehere" does not exist and has not been inserted into the template cache. We get a very meaningful message when driving this with karma under Chrome (and it worked until recently on most browsers):
At this time, however, PhantomJS and Chrome instead give the following incomprehensible message with angularJS v1.2.0 and v1.2.1:
This occurs because the error is at caught at line 2122 in the following angular-mocks code:
and some recent versions of Webkit Error messages have read-only 'stack' properties. Thus, line 2122 fails, and the new TypeError is thrown, losing the stack. Unfortunately, I couldn't think of any other way to rethrow an Error instance with a modified stack string, and was unable to come up with a meaningful pull request.
Clearly, changes derive from the now-false assumption that Error instances were mutable -- at least for Webkit, now, they are not.
Any thoughts?
The text was updated successfully, but these errors were encountered: