angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

(iOS 8 GM iPhone5C) TypeError: Attempted to assign to readonly property

Open HAKASHUN opened this issue 12 years ago • 163 comments

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...

HAKASHUN avatar Sep 17 '14 13:09 HAKASHUN

I agree. More than one person tried to reproduce this in a controlled environment unsuccessfully (me included), I guess it won't be fixed anytime soon.

m3kka avatar Mar 17 '15 17:03 m3kka

I experience the same problem on iPhone 6 also, developing with Ionic framework

On Tue, Mar 17, 2015 at 7:50 PM, Marco Visintin [email protected] wrote:

I agree. More than one person tried to reproduce this in a controlled environment unsuccessfully (me included), I guess it won't be fixed anytime soon.

— Reply to this email directly or view it on GitHub https://github.com/angular/angular.js/issues/9128#issuecomment-82496015.

leonprou avatar Mar 17 '15 20:03 leonprou

I am too having the same issue iphone 6 simulator running iOS 8.2

scripterkaran avatar Mar 19 '15 12:03 scripterkaran

I'm having the same problem on my iPad (3rd generation) running iOS 8.2 (12D508), with remote logging. And the problem goes away when I remove "use strict" from the angular.js source code. Have anybody notified Apple about this?

karl-gustav avatar Mar 21 '15 07:03 karl-gustav

Without a reproduction it's unlikely this issue can be taken seriously by anyone, and those (relatively) few of us affected by the issue have mostly found alternate solutions. Every so often I set aside some time to attempt a reproduction, and I get nowhere.

I've experienced the problem on all versions of iOS >= 8.0.0, but only on a few models. I've tried several Angular versions in the 1.2.x, and 1.3.x lines, up to 1.3.14 - I don't encounter the issue in any of my unit tests, or e2e component tests - only in one particular application, typically on route change, and only after the app has been running for a while.

jhunken 's solution has worked very well for me. Using it unminified I don't have issues at all. However minifications with Uglify, and Closure Compiler break the fix. I have not had time to try excluding the decorator from the minification process, and catting it on yet...

bennett000 avatar Mar 22 '15 04:03 bennett000

just fwiw, it's okay if the reproduction is not "minimal", though simpler is better --- you can link to an affected app (ideally with minimal backend requirements, so it's easier for us to build a repro with)

caitp avatar Mar 22 '15 04:03 caitp

@caitp I'm seeing this consistently here. If you click the "cross" in the upper-right of the screen, I get the error described (and the main part of the screen goes white - it should navigate to another page). Note that it doesn't happen in the iOS simulator, but using iOS 8.2 on an iPhone 5 I can reproduce every time.

iainbeeston avatar Mar 23 '15 12:03 iainbeeston

@iainbeeston I can't repro that on my iphone 6 or ipad air :( I'll see what I can do though (you might want to try clearing history on the phone though, it could be a caching bug of some kind)

caitp avatar Mar 23 '15 13:03 caitp

I've cleared the cache and it still happens on my iPhone 5.

I've also just tested on an iPhone 6 (also iOS 8.2) and as you said, it works correctly there. So it seems to be specific to iPhone 5x (not sure about iPhone 4x).

iainbeeston avatar Mar 23 '15 14:03 iainbeeston

I collect Angular JS errors from my website and I see this error on random iPads and iPhones based on user agent.

I have tried to reproduce this on an iPhone 5, iPad mini2 and iPad air and I cannot replicate it.

darrenmerrett avatar Mar 23 '15 14:03 darrenmerrett

@iainbeeston I tried that on my iPad but I wasn't 100% sure what you meant by cross - can I assume the layout is different on the pad?

Anyway clicking on a few things, including the toggling menu, and an 'x' didn't throw any errors on my pad, IIRC my mini's model is MD528C/A

bennett000 avatar Mar 25 '15 16:03 bennett000

It's possible it only affects iphone 5 and before.

On Wed, 25 Mar 2015 at 16:35 Michael Bennett [email protected] wrote:

@iainbeeston https://github.com/iainbeeston I tried that on my iPad but I wasn't 100% sure what you meant by cross - can I assume the layout is different on the pad?

Anyway clicking on a few things, including the toggling menu, and an 'x' didn't throw any errors on my pad, IIRC my mini's model is MD528C/A

— Reply to this email directly or view it on GitHub https://github.com/angular/angular.js/issues/9128#issuecomment-86107019.

iainbeeston avatar Mar 25 '15 16:03 iainbeeston

I've asked a family member with an iphone 5 (no additional details on the model #, but hey) on iOS 8.2 to try it, and they sent back screenshots that appear to be working just fine. This seems like a bit of a heisenbug, maybe it's worth reporting it as a bug on Safari itself

caitp avatar Mar 25 '15 16:03 caitp

Hey that's interesting. Works for me too now (we've updated the code since then, so perhaps an unrelated change fixed it?)

Does anyone else have a site that can reliably reproduce the issue? On Wed, 25 Mar 2015 at 4:59 pm, ⭐caitp⭐ [email protected] wrote:

I've asked a family member with an iphone 5 (no additional details on the model #, but hey) on iOS 8.2 to try it, and they sent back screenshots that appear to be working just fine. This seems like a bit of a heisenbug, maybe it's worth reporting it as a bug on Safari itself

— Reply to this email directly or view it on GitHub https://github.com/angular/angular.js/issues/9128#issuecomment-86121113.

iainbeeston avatar Mar 25 '15 18:03 iainbeeston

I have a reproducible scenario on the website I'm working on, but I can only share the login details privately. Please give me your email so I can send you the details.

khashayar avatar Mar 26 '15 20:03 khashayar

@caitp I'm still getting the problem actually. If you go to the same page as before, then click the arrow at the top-left arrow (which loads the previous page), then the arrow at the top-right (which goes back to the original page) I get the error fairly reliably.

photo 02-04-2015 3 08 25 pm

If it doesn't happen immediately, try clicking back and forth a few times (just click on the arrows, but not the cross icon). You can tell the error has occurred because the image no longer appears.

photo 02-04-2015 3 13 29 pm

iainbeeston avatar Apr 02 '15 14:04 iainbeeston

This is on an iPhone 5 (A1429), running iOS 8.2 and mobile safari 8.0 (useragent Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D508 Safari/600.1.4)

iainbeeston avatar Apr 02 '15 14:04 iainbeeston

as explained, I'm unable to reproduce this on 3 different iOS devices, or any of the iOS simulator devices.

I think you should file this as a bug on webkit or contact Apple. There is very little anyone can do if we can't see the bug ourselves

caitp avatar Apr 02 '15 14:04 caitp

Sorry, I just figured that a more detailed explanation would help reproduce the bug.

Is it worth closing this issue then?

iainbeeston avatar Apr 02 '15 14:04 iainbeeston

It seems to me this bug is random on devices and iOS versions. I have several devices and I cannot reproduce the fault, but I know that some people on my website do experience this problem because I see the error messages.

I would suggest that under these circumstances, perhaps it's something about the configuration of the devices, some settings or perhaps some other software that's been installed that causes the conflict.

darrenmerrett avatar Apr 03 '15 07:04 darrenmerrett