8
0
Pārlūkot izejas kodu

Internal: Removed checking whether the dependencies of loaded plugin exist.

Kamil Piechaczek 8 gadi atpakaļ
vecāks
revīzija
8a5495603c

+ 0 - 14
packages/ckeditor5-core/src/plugincollection.js

@@ -129,7 +129,6 @@ export default class PluginCollection {
 			.then( () => loaded );
 
 		function loadPlugin( PluginConstructor ) {
-			// Don't load the plugin if it cannot be loaded.
 			if ( pluginConstructorsToRemove.includes( PluginConstructor ) ) {
 				return;
 			}
@@ -163,19 +162,6 @@ export default class PluginCollection {
 					PluginConstructor.requires.forEach( ( RequiredPluginConstructorOrName ) => {
 						const RequiredPluginConstructor = getPluginConstructor( RequiredPluginConstructorOrName );
 
-						if ( !RequiredPluginConstructor ) {
-							/**
-							 * The plugin cannot be loaded by name.
-							 *
-							 * @error plugincollection-plugin-not-found
-							 * @param {String} plugin The name of the plugin which could not be loaded.
-							 */
-							throw new CKEditorError(
-								'plugincollection-plugin-not-found: The plugin cannot be loaded by name.',
-								{ plugins: RequiredPluginConstructorOrName }
-							);
-						}
-
 						if ( removePlugins.includes( RequiredPluginConstructor ) ) {
 							/**
 							 * Cannot load a plugin because one of its dependencies is listed in the `removePlugins` options.

+ 0 - 21
packages/ckeditor5-core/tests/plugincollection.js

@@ -336,27 +336,6 @@ describe( 'PluginCollection', () => {
 					expect( logSpy.calledTwice ).to.equal( true );
 				} );
 		} );
-
-		it( 'should reject when loaded plugin requires non-existing plugin', () => {
-			let logSpy = testUtils.sinon.stub( log, 'error' );
-
-			let plugins = new PluginCollection( editor, availablePlugins );
-
-			PluginA.requires = [ 'NonExistentPlugin' ];
-
-			return plugins.load( [ PluginA ] )
-				// Throw here, so if by any chance plugins.load() was resolved correctly catch() will be stil executed.
-				.then( () => {
-					throw new Error( 'Test error: this promise should not be resolved successfully' );
-				} )
-				.catch( ( err ) => {
-					expect( err ).to.be.an.instanceof( CKEditorError );
-					expect( err.message ).to.match( /^plugincollection-plugin-not-found/ );
-
-					sinon.assert.calledOnce( logSpy );
-					expect( logSpy.args[ 0 ][ 0 ] ).to.match( /^plugincollection-load:/ );
-				} );
-		} );
 	} );
 
 	describe( 'get()', () => {