Преглед изворни кода

To avoid race conditions, guarantee that the `ckeditor` module is loaded before any other module in bender.amd.require().

fredck пре 10 година
родитељ
комит
00baaa012f
1 измењених фајлова са 11 додато и 7 уклоњено
  1. 11 7
      dev/bender/plugins/ckeditor5/static/extensions.js

+ 11 - 7
dev/bender/plugins/ckeditor5/static/extensions.js

@@ -31,13 +31,17 @@
 
 			var names = [].slice.call( arguments );
 
-			CKEDITOR.require( names, function() {
-				for ( var i = 0; i < names.length; i++ ) {
-					modules[ names[ i ] ] = arguments[ i ] ;
-				}
-
-				// Finally give green light for tests to start.
-				done();
+			// To avoid race conditions with required modules, require `ckeditor` first and then others. This guarantees
+			// that `ckeditor` will be loaded before any other module.
+			CKEDITOR.require( [ 'ckeditor' ], function() {
+				CKEDITOR.require( names, function() {
+					for ( var i = 0; i < names.length; i++ ) {
+						modules[ names[ i ] ] = arguments[ i ] ;
+					}
+
+					// Finally give green light for tests to start.
+					done();
+				} );
 			} );
 
 			return modules;