pass shallow copy of updates to deliverChangeRecords method#21
pass shallow copy of updates to deliverChangeRecords method#21chopstikk wants to merge 1 commit intojdarling:masterfrom
Conversation
|
Can you post a simple example that this breaks with so I can create a test case from it. Also the PR you submitted utilizes bind, as that isn't supported in all targeted environments we can't use it. Will have to rework the code a bit. Once you post the test case I'll check it against Chromium and see what the expected behavior should be and see if I can't get an update together for it. |
|
I tried to make a simple example. Depending on the order of the My fix is only some kind of a quick fix to make the polyfill work. Chrome's behaviour in this use case is more precise as the log output shows. |
|
Excellent, I'll take a look and see what I can put together, will take me a few days at minimum as I'm buried in real work and home activities. |
This is a fix for the following use case:
If the callback passed to the
Observeris itself changing some of theobject's properties, further updates are added to the queue (queueUpdatesmethod) from within the for loop in thedeliverChangeRecordsmethod. In the current version of the polyfill,deliverChangeRecordsprocesses the_updates, which are changed in different places. This leads to errors in the use case described above. My solution is to pass in a shallow copy of the_updatesarray to ensure that during processing the_updates(indeliverChangeRecord) they are not changed.