Divec has uploaded a new change for review.

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

Change subject: Polyfill Set for PhantomJS (for debug only)
......................................................................

Polyfill Set for PhantomJS (for debug only)

A slow (O(n^2)) half-implementation that does enough for Filibuster's needs.

Change-Id: I832e4abaf37c44867dce627fb5a57965d35e612d
---
M src/ve.Filibuster.js
1 file changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/53/166753/1

diff --git a/src/ve.Filibuster.js b/src/ve.Filibuster.js
index f2f3275..c7236b3 100644
--- a/src/ve.Filibuster.js
+++ b/src/ve.Filibuster.js
@@ -310,6 +310,27 @@
        );
 };
 
+if ( typeof Set === 'undefined' ) {
+       // No native 'Set'; implement the bits we need with a (slow) 
array-based algorithm
+       // This is needed by PhantomJS 1.9.x
+       /*jshint -W020 */
+       Set = function () {
+               this.contents = [];
+       };
+       Set.prototype.has = function ( x ) {
+               var i, len;
+               for ( i = 0, len = this.contents.length; i < len; i++ ) {
+                       if ( this.contents[ i ] === x ) {
+                               return true;
+                       }
+                       return false;
+               }
+       };
+       Set.prototype.add = function ( x ) {
+               this.contents.push( x );
+       };
+}
+
 /**
  * Get a plain-old-data deep clone of val.
  *

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I832e4abaf37c44867dce627fb5a57965d35e612d
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec <da...@sheetmusic.org.uk>

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

Reply via email to