[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: Protect against target.getSurface() returning null

2016-08-31 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Protect against target.getSurface() returning null
..


Protect against target.getSurface() returning null

This can now happen due to I5510bbe3.

Bug: T139972
Change-Id: Ia9a171fd8f4800c50f116b13dbd00d8e098b47a9
---
M modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
1 file changed, 7 insertions(+), 4 deletions(-)

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



diff --git 
a/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js 
b/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
index 2cc0eca..f7183ed 100644
--- a/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
+++ b/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
@@ -118,7 +118,7 @@
 * @inheritdoc
 */
mw.flow.ui.VisualEditorWidget.prototype.focus = function () {
-   if ( this.target ) {
+   if ( this.target && this.target.getSurface() ) {
this.target.getSurface().getView().focus();
}
};
@@ -127,7 +127,7 @@
 * @inheritdoc
 */
mw.flow.ui.VisualEditorWidget.prototype.moveCursorToEnd = function () {
-   if ( this.target ) {
+   if ( this.target && this.target.getSurface() ) {

this.target.getSurface().getModel().selectLastContentOffset();
}
};
@@ -139,7 +139,7 @@
var doc, html;
 
// If we haven't fully loaded yet, just return nothing.
-   if ( !this.target ) {
+   if ( !this.target || !this.target.getSurface() ) {
return '';
}
 
@@ -163,6 +163,9 @@
 * @inheritdoc
 */
mw.flow.ui.VisualEditorWidget.prototype.isEmpty = function () {
+   if ( !this.target || !this.target.getSurface() ) {
+   return true;
+   }
return 
!this.target.getSurface().getModel().getDocument().data.hasContent();
};
 
@@ -173,7 +176,7 @@
 */
mw.flow.ui.VisualEditorWidget.prototype.hasBeenChanged = function () {
// If we haven't fully loaded yet, just return false
-   if ( !this.target ) {
+   if ( !this.target || !this.target.getSurface() ) {
return false;
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia9a171fd8f4800c50f116b13dbd00d8e098b47a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Catrope 
Gerrit-Reviewer: Florianschmidtwelzow 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Mattflaschen 
Gerrit-Reviewer: Mooeypoo 
Gerrit-Reviewer: Paladox 
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...Flow[master]: Protect against target.getSurface() returning null

2016-08-30 Thread Catrope (Code Review)
Catrope has uploaded a new change for review.

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

Change subject: Protect against target.getSurface() returning null
..

Protect against target.getSurface() returning null

This can now happen due to I5510bbe3.

Bug: T139972
Change-Id: Ia9a171fd8f4800c50f116b13dbd00d8e098b47a9
---
M modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/77/307677/1

diff --git 
a/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js 
b/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
index 2cc0eca..f7183ed 100644
--- a/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
+++ b/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
@@ -118,7 +118,7 @@
 * @inheritdoc
 */
mw.flow.ui.VisualEditorWidget.prototype.focus = function () {
-   if ( this.target ) {
+   if ( this.target && this.target.getSurface() ) {
this.target.getSurface().getView().focus();
}
};
@@ -127,7 +127,7 @@
 * @inheritdoc
 */
mw.flow.ui.VisualEditorWidget.prototype.moveCursorToEnd = function () {
-   if ( this.target ) {
+   if ( this.target && this.target.getSurface() ) {

this.target.getSurface().getModel().selectLastContentOffset();
}
};
@@ -139,7 +139,7 @@
var doc, html;
 
// If we haven't fully loaded yet, just return nothing.
-   if ( !this.target ) {
+   if ( !this.target || !this.target.getSurface() ) {
return '';
}
 
@@ -163,6 +163,9 @@
 * @inheritdoc
 */
mw.flow.ui.VisualEditorWidget.prototype.isEmpty = function () {
+   if ( !this.target || !this.target.getSurface() ) {
+   return true;
+   }
return 
!this.target.getSurface().getModel().getDocument().data.hasContent();
};
 
@@ -173,7 +176,7 @@
 */
mw.flow.ui.VisualEditorWidget.prototype.hasBeenChanged = function () {
// If we haven't fully loaded yet, just return false
-   if ( !this.target ) {
+   if ( !this.target || !this.target.getSurface() ) {
return false;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9a171fd8f4800c50f116b13dbd00d8e098b47a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Catrope 

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