(iOS 8 GM iPhone5C) TypeError: Attempted to assign to readonly property
I am using on iOS 8 GM(iPhone5C). With this device, I am getting this error in this line(https://github.com/angular/angular.js/blob/master/src/ng/rootScope.js#L216) But on iOS 8 GM(iPhone5S) and iOS 7.x (iPhone5C, iPhone5S), this error does not occur.
To resolve this error, I rewrote the code as follows:
$new: function(isolate) {
var child;
if (isolate) {
child = new Scope();
child.$root = this.$root;
// ensure that there is just one async queue per $rootScope and its children
child.$$asyncQueue = this.$$asyncQueue;
child.$$postDigestQueue = this.$$postDigestQueue;
} else {
// Only create a child scope class if somebody asks for one,
// but cache it to allow the VM to optimize lookups.
if (!this.$$ChildScope) {
this.$$ChildScope = function ChildScope() {
this['$$watchers'] = this['$$nextSibling'] =
this['$$childHead'] = this['$$childTail'] = null;
this['$$listeners'] = {};
this['$$listenerCount'] = {};
this['$id'] = nextUid();
this['$$ChildScope'] = null;
};
this.$$ChildScope.prototype = this;
}
child = new this.$$ChildScope();
}
child['this'] = child;
child['$parent'] = this;
child['$$prevSibling'] = this.$$childTail;
if (this.$$childHead) {
this.$$childTail.$$nextSibling = child;
this.$$childTail = child;
} else {
this.$$childHead = this.$$childTail = child;
}
return child;
},
The situation has improved, but I do not understand the reason...
Making some changes from dot notation to brackets notation by monkey patching like @jhunken did worked for me too. Very strange problem.
Still no word about an official solution?
Removing use strict did it for me. Still waiting on the official solution though.
@rjbernaldo To clarify, are you removing 'use strict' from angular.js, your own source files, or both?
@hamstu I removed it from angular.js only.
Removing 'use strict'; fixed the issue on my end as well. I'm fairly convinced Apple is trying to kill off web-apps with breakage like this. =]
Removing 'use strict'; did stop the crashes but seems to have caused another problem: now my app seems to hang instead of crashing, and the tab in Safari becomes totally unresponsive. This even happens in the iOS simulator, and the simulator process starts using 200% CPU on my mac.
Has this happened to anyone else?
could you post a stack trace of the crash, along with versions of al the libraries you're using? that would be helpfulp.
oh hang on, I see what it is... wow I don't think that's the right behaviour in JSC, but just to check...
I haven't been able to reproduce this on my iphone, ipad, or any of the ios simulators I've tried. It looks to me like the issue is the prototype property being incorrectly defined as non-writable in JSC, which would be a bug (and, would explain why it's no longer reproducible if they've fixed it). If that's not the bug being hit, then please supply a reproduction for us.
To me it seems more like that the bug creating this problem is https://bugs.webkit.org/show_bug.cgi?id=138038 (posted in a previous answer by @edzis)
@m3kka we aren't using O.create anywhere in 1.2.x
In our situation this problem started when we moved to 1.3.x branch, in which source code I can find some instances of Object.create()
Am I completely off track?
The original bug report (and most of the comments) indicate that this affects version 1.2.x
at any rate, anyone experiencing this issue, please provide a reproduction :<
Here's what I get out of the Safari console from the iOS simulator on a iPhone 5 running iOS 8.0. This is with AngularJS v1.3.13.
[Error] Error: Attempted to assign to readonly property.
ChildScope@http://localhost:9000/bower_components/angular/angular.js:13682:42
$new@http://localhost:9000/bower_components/angular/angular.js:13690:40
boundTranscludeFn@http://localhost:9000/bower_components/angular/angular.js:7092:40
controllersBoundTransclude@http://localhost:9000/bower_components/angular/angular.js:7756:35
ngRepeatAction@http://localhost:9000/bower_components/angular/angular.js:24502:26
$watchCollectionAction@http://localhost:9000/bower_components/angular/angular.js:14110:21
$digest@http://localhost:9000/bower_components/angular/angular.js:14243:31
$apply@http://localhost:9000/bower_components/angular/angular.js:14506:31
done@http://localhost:9000/bower_components/angular/angular.js:9659:53
completeRequest@http://localhost:9000/bower_components/angular/angular.js:9849:15
requestLoaded@http://localhost:9000/bower_components/angular/angular.js:9790:24
(anonymous function) (angular.js, line 11607)
(anonymous function) (angular.js, line 8557)
$digest (angular.js, line 14261)
$apply (angular.js, line 14506)
done (angular.js, line 9659)
completeRequest (angular.js, line 9849)
requestLoaded (angular.js, line 9790)
@pascalc great, now provide a reproduction =)
Using AngularJS v1.2.22 Error: Attempted to assign to readonly property. $$childScopeClass@http://XXX/bower_components/angular/angular.js:12037:23 $new@http://12wbt-frontend.dev/bower_components/angular/angular.js:12045:45 compositeLinkFn@http://XXX/bower_components/angular/angular.js:6067:38 compositeLinkFn@http://XXX/bower_components/angular/angular.js:6089:24 compositeLinkFn@http://XXX/bower_components/angular/angular.js:6089:24 compositeLinkFn@http://XXX/bower_components/angular/angular.js:6089:24 nodeLinkFn@http://XXX/bower_components/angular/angular.js:6686:35 compositeLinkFn@http://XXX/bower_components/angular/angular.js:6086:23 publicLinkFn@http://XXX/bower_components/angular/angular.js:5982:45 http://XXX/assets/scripts/app.js:51874:49
and the code in app.js is '$compile(element.contents())($scope);' . The error is reproduced on Ipad safari with IOS Simulator. Commenting out 'user strict' does fix the error as well.
@chriswu14 please provide a reproduction in addition, thanks!
Seeing the issue as well. That said, not sure how successful or even useful the 'reproduction' request is, in light of the fact that this phenomena seems very specific to certain setups. Eg. I only ran into this with ui-router, child ui-states & views AND the iphone 5 iOS simulator.
Remove any of the variables and it works fine, with the key issue apparently being the iPhone5 sim.
The iPhone 4S and 5S work like a charm and so does the iPad2 / retina sim.