Divec has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/354888 )
Change subject: Tree modifications: don't presume the tree is in sync with the linear model ...................................................................... Tree modifications: don't presume the tree is in sync with the linear model Change-Id: Ia79e9a393309b1dec024869f15b19218f463fd7d --- M src/ce/ve.ce.ContentBranchNode.js M tests/ce/ve.ce.Surface.test.js 2 files changed, 19 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/88/354888/1 diff --git a/src/ce/ve.ce.ContentBranchNode.js b/src/ce/ve.ce.ContentBranchNode.js index 6e73bf5..8c19362 100644 --- a/src/ce/ve.ce.ContentBranchNode.js +++ b/src/ce/ve.ce.ContentBranchNode.js @@ -335,6 +335,9 @@ unicornInfo.unicorns = null; } } else { + if ( item.length === undefined ) { + throw new Error( 'Unexpected item type' ); + } if ( buffer !== '' ) { current.appendChild( doc.createTextNode( buffer ) ); buffer = ''; diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js index cb53164..fd78f8a 100644 --- a/tests/ce/ve.ce.Surface.test.js +++ b/tests/ce/ve.ce.Surface.test.js @@ -179,6 +179,22 @@ this.preventDefault = this.stopPropagation = function () {}; }; +QUnit.test( 'Transaction with two removals in the same CBN', function ( assert ) { + var tx, + view = ve.test.utils.createSurfaceViewFromHtml( '<p>abc<img>defghijklmnop</p><p>x</p>' ), + doc = view.model.documentModel, + txBuilder = new ve.dm.TransactionBuilder(); + + txBuilder.pushRetain( 1 ); + txBuilder.pushReplace( doc, 1, 3, [] ); + txBuilder.pushRetain( 4 ); + txBuilder.pushReplace( doc, 8, 11, [] ); + txBuilder.pushRetain( 4 ); + tx = txBuilder.getTransaction(); + view.model.change( tx ); + assert.ok( true, 'No crash' ); +} ); + QUnit.test( 'special key down: backspace/delete', function ( assert ) { var i, emptyList = '<ul><li><p></p></li></ul>', -- To view, visit https://gerrit.wikimedia.org/r/354888 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia79e9a393309b1dec024869f15b19218f463fd7d Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Divec <da...@troi.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits