Cscott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/63009
Change subject: Prevent selser of zero-length DSR chunks.
......................................................................
Prevent selser of zero-length DSR chunks.
We use zero-length TSRs to mark synthetic chunks of the DOM, for example
the <meta typeof="mw:Category"> generated by '#REDIRECT [[Category:Foo]]'.
We want to make sure that we don't try to selser these chunks if they
are edited.
Change-Id: I07cf0b5432ed188f8d33eda8178d205f48f36b82
---
M js/lib/mediawiki.WikitextSerializer.js
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid
refs/changes/09/63009/1
diff --git a/js/lib/mediawiki.WikitextSerializer.js
b/js/lib/mediawiki.WikitextSerializer.js
index c3f5892..e52fa01 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -2964,6 +2964,9 @@
// To serialize from source, we need 2 things
of the node:
// -- it should not have a diff marker
// -- it should have valid, usable DSR
+ // -- it should have a non-zero length DSR
+ // (this is used to prevent selser on
synthetic content,
+ // like the category link for '#REDIRECT
[[Category:Foo]]')
//
// SSS FIXME: Additionally, we can guard
against buggy DSR with
// some sanity checks. We can test that non-sep
src content
@@ -2973,7 +2976,9 @@
//
// TO BE DONE
//
- if (dp && isValidDSR(dp.dsr) &&
!DU.hasCurrentDiffMark(node, this.env)) {
+ if (dp && isValidDSR(dp.dsr) &&
+ (dp.dsr[1] > dp.dsr[0]) &&
+ !DU.hasCurrentDiffMark(node, this.env))
{
// Strip leading/trailing separators
*ONLY IF* the previous/following
// node will go through non-selser
serialization.
var src = state.getOrigSrc(dp.dsr[0],
dp.dsr[1]),
--
To view, visit https://gerrit.wikimedia.org/r/63009
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I07cf0b5432ed188f8d33eda8178d205f48f36b82
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits