GWicke has submitted this change and it was merged.

Change subject: Fix one more instance of attempting to update readonly tokens.
......................................................................


Fix one more instance of attempting to update readonly tokens.

* A lot of pain selective cloning has wrought -- made worse because the
  errors seem to be dependent on async code paths. Hopefully one of the
  last update sites that needs fixing.

* Fixes a few more crashers in local RT testing.

Change-Id: I7e6613c79893538a5e22f0b959a5a5e0bea0a109
---
M js/lib/ext.core.AttributeExpander.js
1 file changed, 12 insertions(+), 8 deletions(-)

Approvals:
  GWicke: Verified; Looks good to me, approved



diff --git a/js/lib/ext.core.AttributeExpander.js 
b/js/lib/ext.core.AttributeExpander.js
index 59d0df4..c9be228 100644
--- a/js/lib/ext.core.AttributeExpander.js
+++ b/js/lib/ext.core.AttributeExpander.js
@@ -69,14 +69,18 @@
                newK = newA.k;
 
                // Preserve the key and value source, if available
-               if (a.ksrc) {
-                       newA.ksrc = a.ksrc;
-               }
-               if (a.vsrc) {
-                       newA.vsrc = a.vsrc;
-               }
-               if (a.srcOffsets) {
-                       newA.srcOffsets = a.srcOffsets;
+               // But, if 'a' wasn't cloned, newA will be the same as a.
+               // Dont try to update it and crash since a is frozen.
+               if (a !== newA) {
+                       if (a.ksrc) {
+                               newA.ksrc = a.ksrc;
+                       }
+                       if (a.vsrc) {
+                               newA.vsrc = a.vsrc;
+                       }
+                       if (a.srcOffsets) {
+                               newA.srcOffsets = a.srcOffsets;
+                       }
                }
 
                if (newK) {

-- 
To view, visit https://gerrit.wikimedia.org/r/51277
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7e6613c79893538a5e22f0b959a5a5e0bea0a109
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to