jenkins-bot has submitted this change and it was merged.

Change subject: Always deep copy when writing to and reading from the fake 
clipboard
......................................................................


Always deep copy when writing to and reading from the fake clipboard

Otherwise, changes to deeply nested structures like template blobs or
references will leak from the data model into the clipboard data.

Change-Id: I85d8d311f676d45856f30b3747e7383c70c95460
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 357597f..fab71d6 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -722,6 +722,7 @@
                try {
                        // Try to paste in the orignal data
                        // Take a copy to prevent the data being annotated a 
second time in the catch block
+                       // and to prevent actions in the data model affecting 
view.clipboard
                        pasteData = ve.copy( slice.getData() );
 
                        // Annotate
@@ -735,7 +736,8 @@
                        );
                } catch ( e ) {
                        // If that fails, balance the data before pasting
-                       pasteData = slice.getBalancedData();
+                       // Take a copy to prevent actions in the data model 
affecting view.clipboard
+                       pasteData = ve.copy( slice.getBalancedData() );
 
                        // Annotate
                        ve.dm.Document.addAnnotationsToData( pasteData, 
this.model.getInsertionAnnotations() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I85d8d311f676d45856f30b3747e7383c70c95460
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to