[MediaWiki-commits] [Gerrit] mediawiki...ContentTranslation[master]: Guard against js errors for invalid/corrupted(?) templates

2017-12-11 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/397408 )

Change subject: Guard against js errors for invalid/corrupted(?) templates
..


Guard against js errors for invalid/corrupted(?) templates

This just prevents a potential js error when a templates data-mw
has no parts attribute, which I had assumed impossible.

I tried to reproduce the issue, but failed.

Bug: T182528
Change-Id: I68f42397aec336af84f568b51c71ef62e85d7957
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 5 insertions(+), 0 deletions(-)

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



diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 13e4d0d..e36d248 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -68,6 +68,11 @@
}
}
 
+   if ( !mwData.parts ) {
+   mw.log( '[CX] data-mw for Template#' + 
this.$template.attr( 'id' ) + ' has no parts.' );
+   return $.Deferred().reject().promise();
+   }
+
if ( mwData.parts.length > 1 ) {
mw.log( '[CX] Skipping multipart template for now for 
Template#' + this.$template.attr( 'id' ) );
return $.Deferred().reject().promise();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I68f42397aec336af84f568b51c71ef62e85d7957
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: Nikerabbit 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...ContentTranslation[master]: Guard against js errors for invalid/corrupted(?) templates

2017-12-11 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397408 )

Change subject: Guard against js errors for invalid/corrupted(?) templates
..

Guard against js errors for invalid/corrupted(?) templates

This just prevents a potential js error when a templates data-mw
has no parts attribute, which I had assumed impossible.

I tried to reproduce the issue, but failed.

Bug: T182528
Change-Id: I68f42397aec336af84f568b51c71ef62e85d7957
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/08/397408/1

diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 13e4d0d..e36d248 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -68,6 +68,11 @@
}
}
 
+   if ( !mwData.parts ) {
+   mw.log( '[CX] data-mw for Template#' + 
this.$template.attr( 'id' ) + ' has no parts.' );
+   return $.Deferred().reject().promise();
+   }
+
if ( mwData.parts.length > 1 ) {
mw.log( '[CX] Skipping multipart template for now for 
Template#' + this.$template.attr( 'id' ) );
return $.Deferred().reject().promise();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68f42397aec336af84f568b51c71ef62e85d7957
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

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