Bartosz Dziewoński has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397914 )

Change subject: ClippableElement: Handle failures in 
FloatableElement#computePosition
......................................................................

ClippableElement: Handle failures in FloatableElement#computePosition

FloatableElement#computePosition can't handle certain weird edge cases
and will throw exceptions when called unexpectedly.

Perhaps we could handle this more elegantly, but let's just wrap this
in try...catch to avoid the error right now.

Bug: T182658
Change-Id: Ibb4a81f4eabda8bffa44ae1629031ac9192c94e5
---
M src/mixins/ClippableElement.js
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/14/397914/1

diff --git a/src/mixins/ClippableElement.js b/src/mixins/ClippableElement.js
index 43c2220..6b555bf 100644
--- a/src/mixins/ClippableElement.js
+++ b/src/mixins/ClippableElement.js
@@ -204,7 +204,12 @@
  * @return {string} 'left' or 'right'
  */
 OO.ui.mixin.ClippableElement.prototype.getHorizontalAnchorEdge = function () {
-       if ( this.computePosition && this.computePosition().right !== '' ) {
+       var position;
+       try {
+               position = this.computePosition && this.computePosition();
+       } catch ( err ) {
+       }
+       if ( position && position.right !== '' ) {
                return 'right';
        }
        return 'left';
@@ -226,7 +231,12 @@
  * @return {string} 'top' or 'bottom'
  */
 OO.ui.mixin.ClippableElement.prototype.getVerticalAnchorEdge = function () {
-       if ( this.computePosition && this.computePosition().bottom !== '' ) {
+       var position;
+       try {
+               position = this.computePosition && this.computePosition();
+       } catch ( err ) {
+       }
+       if ( position && position.bottom !== '' ) {
                return 'bottom';
        }
        return 'top';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb4a81f4eabda8bffa44ae1629031ac9192c94e5
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

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

Reply via email to