mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
Don't compare annotations directly with ve.compare()
Annotations' attributes might contain DOM elements, which cause infinite recursion in ve.compare(). Annotation classes can protect against this by overriding getHashObject() to summarize DOM nodes, but that doesn't help if that's not respected everywhere. Instead, compare the hash objects, those are safe. This does not appear to be a problem in practice, currently, because the nowiki annotation is experimental, oo.compare() now short-circuits if a === b, and because of optimizations in openAndCloseAnnotations() which lead to the relevant compareToForSerialization() code path being taken very rarely. Bug: 51948 Change-Id: If1bcc3eee4fd14d107db1935d89dcc5516643b53
This commit is contained in:
parent
fe40b86e74
commit
83e1888275
|
@ -165,7 +165,7 @@ ve.dm.Annotation.prototype.isGenerated = function () {
|
|||
ve.dm.Annotation.prototype.compareToForSerialization = function ( annotation ) {
|
||||
// If both annotations were generated
|
||||
if ( this.isGenerated() && annotation.isGenerated() ) {
|
||||
return ve.compare( this, annotation );
|
||||
return ve.compare( this.getHashObject(), annotation.getHashObject() );
|
||||
}
|
||||
|
||||
return ve.compare(
|
||||
|
|
Loading…
Reference in a new issue