[MediaWiki-commits] [Gerrit] Add length cutoff for text snippets sent over JS bridge - change (apps...wikipedia)

2015-07-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Add length cutoff for text snippets sent over JS bridge
..


Add length cutoff for text snippets sent over JS bridge

Currently, if a user selects a very large text block and attempts to share it,
the share action will fail and/or hang or crash the app.

Example: Visit article Victor Rousseau Emanuel, select all text, and attempt
to share the selection.

This patch truncates the selection sent over the JS bridge at 250 characters
(which appears to be approximately the max that the share-a-fact card can 
display)
in order to eliminate out-of-memory issues.

Bug: T104527
Change-Id: I371a8df1261ca945b3ed32e9eaacaabb74ae43f5
---
M wikipedia/assets/bundle.js
M www/js/sections.js
2 files changed, 6 insertions(+), 0 deletions(-)

Approvals:
  BearND: Looks good to me, approved
  Niedzielski: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js
index b559cdd..878ddd8 100644
--- a/wikipedia/assets/bundle.js
+++ b/wikipedia/assets/bundle.js
@@ -425,6 +425,9 @@
 if (text.length  2) {
 text = getLeadParagraph();
 }
+if (text.length  250) {
+text = text.substring(0, 249);
+}
 bridge.sendMessage( onGetTextSelection, { purpose : payload.purpose, 
text : text } );
 });
 
diff --git a/www/js/sections.js b/www/js/sections.js
index 4635576..b86af3b 100644
--- a/www/js/sections.js
+++ b/www/js/sections.js
@@ -45,6 +45,9 @@
 if (text.length  2) {
 text = getLeadParagraph();
 }
+if (text.length  250) {
+text = text.substring(0, 249);
+}
 bridge.sendMessage( onGetTextSelection, { purpose : payload.purpose, 
text : text } );
 });
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I371a8df1261ca945b3ed32e9eaacaabb74ae43f5
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway mhollo...@wikimedia.org
Gerrit-Reviewer: BearND bsitzm...@wikimedia.org
Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org
Gerrit-Reviewer: Dbrant dbr...@wikimedia.org
Gerrit-Reviewer: Niedzielski sniedziel...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

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


[MediaWiki-commits] [Gerrit] Add length cutoff for text snippets sent over JS bridge - change (apps...wikipedia)

2015-07-06 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/223037

Change subject: Add length cutoff for text snippets sent over JS bridge
..

Add length cutoff for text snippets sent over JS bridge

Currently, if a user selects a very large text block and attempts to share it,
the share action will fail and/or hang or crash the app.

Example: Visit article Victor Rousseau Emanuel, select all text, and attempt
to share the selection.

This patch truncates the selection sent over the JS bridge at 250 characters
(which appears to be approximately the max that the share-a-fact card can 
display)
in order to eliminate out-of-memory issues.

Bug: T104527
Change-Id: I371a8df1261ca945b3ed32e9eaacaabb74ae43f5
---
M wikipedia/assets/bundle.js
M www/js/sections.js
2 files changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/37/223037/1

diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js
index b559cdd..878ddd8 100644
--- a/wikipedia/assets/bundle.js
+++ b/wikipedia/assets/bundle.js
@@ -425,6 +425,9 @@
 if (text.length  2) {
 text = getLeadParagraph();
 }
+if (text.length  250) {
+text = text.substring(0, 249);
+}
 bridge.sendMessage( onGetTextSelection, { purpose : payload.purpose, 
text : text } );
 });
 
diff --git a/www/js/sections.js b/www/js/sections.js
index 4635576..b86af3b 100644
--- a/www/js/sections.js
+++ b/www/js/sections.js
@@ -45,6 +45,9 @@
 if (text.length  2) {
 text = getLeadParagraph();
 }
+if (text.length  250) {
+text = text.substring(0, 249);
+}
 bridge.sendMessage( onGetTextSelection, { purpose : payload.purpose, 
text : text } );
 });
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I371a8df1261ca945b3ed32e9eaacaabb74ae43f5
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway mhollo...@wikimedia.org

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