-
Notifications
You must be signed in to change notification settings - Fork 27.5k
TypeError: Cannot assign to read only property 'data' of object '#<ImageData>' #15904
Comments
Thanks for the report. Simple repro: https://plnkr.co/edit/7EQVABDTUOd7dzmllXA9 In Firefox, you can see that the resulting copy doesn't throw, but it's actually not usable as a copy. So I assume you don't actually use this copy in your state data? We could add this case to the
|
I'm passing the ImageData instance through |
Well, the method is called copy, and we should respect that ;). I'm still wondering why exactly it works like it does - if you run this simple example in FF (https://plnkr.co/edit/veOspfMfsja3OmHu9hjB?p=preview), you can see that the "copied" ImageData is totally clobbered, and totally unusable. I assume in your working example, this is different (because it works in FF). What are you actually passing? A Canvas? Any chance you can break down your example to plnkr size? |
Your plnkr is an accurate representation of the issue. I'm passing an instance of ImageData (not Canvas) to More to the point, is |
Both FF and Chrome get into the "copyRecurse" path - the difference is that Chrome respects the readonly state of the data property and FF doesn't. FF also ends up with a broken object that should be unusable for your purpose, so I'm not sure why your app works. Btw, have you fixed / introduced a workaround in your app? I can't reproduce the error anymore. Understandable, as it is in running in production. Can you please reproduce your example in a minimal demo? For the mentioned reasons (FF produces a broken object when copying ImageData directly), I believe your app cannot rely on the copy of the ImageData - it must be something else. |
I created a workaround so that ImageData objects didn't go through the $state calls, which seems more appropriate. I also can't recreate now. I believe the latest build of Chrome v57 has fixed the underlying issue. |
My plnkr still fails in Chrome 58 - as expected, I'd say. If it works for you, then that's good to hear. |
check for angular.copy , for me angular.copy was causing this issue |
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
I'm submitting a ... (check one with "x")
Current behavior
In Chrome 57 (not 56 or prior) on Windows or Mac, using Angular 1.5.7 and ui.router module, when calling $state.go and passing state variable object containing instance of ImageData, at some point
copyRecurse
tries to do a member-wise copy of the ImageData instance, even though it's immutable and should be copied by reference only.Expected behavior
copyRecurse
should detect that theImageData
instance is immutable and not do a member-wise copy on it.Minimal reproduction of the problem with instructions
Steps:
See the error message in the console.
What is the motivation / use case for changing the behavior?
Whatever reason for recursively copying state variables, stop recursion when you hit an ImageData instance.
Please tell us about your environment:
Windows or Mac. This is happening only on Chrome 57, not any previous versions. We've tested and used this feature for years.
Language: [ES5]
Node (for AoT issues):
node --version
=The text was updated successfully, but these errors were encountered: