-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2969 from ckeditor/t/589
Fix for: Memory leaks during editor create / destroy cycles
- Loading branch information
Showing
22 changed files
with
280 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* bender-tags: editor */ | ||
/* bender-ckeditor-plugins: wysiwygarea */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
bender.editor = {}; | ||
|
||
bender.test( { | ||
// (#589) | ||
'test currentInstance after editor destroy': function() { | ||
this.editor.fire( 'focus' ); | ||
this.editor.on( 'destroy', function() { | ||
setTimeout( function() { | ||
resume( function() { | ||
assert.isNull( CKEDITOR.currentInstance ); | ||
} ); | ||
} ); | ||
} ); | ||
|
||
assert.areSame( this.editor, CKEDITOR.currentInstance ); | ||
|
||
this.editor.destroy(); | ||
wait(); | ||
} | ||
} ); | ||
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* bender-tags: editor */ | ||
( function() { | ||
'use strict'; | ||
|
||
bender.test( { | ||
// Script listeners should be removed because it might cause memory leaks (#589). | ||
'test script load listeners removed': function() { | ||
var loader = CKEDITOR.loader; | ||
|
||
if ( !loader ) { | ||
// All core modules are bundled in release version, so we can't and don't need to test it there. | ||
assert.ignore(); | ||
} | ||
|
||
var scriptName = loader.loadedScripts.pop(); | ||
|
||
getScript().remove(); | ||
|
||
delete loader.loadedScripts[ 's:' + scriptName ]; | ||
|
||
loader.load( scriptName, false ); | ||
|
||
var script = getScript(); | ||
|
||
script.on( script.$.onload ? 'load' : 'readystatechange', function() { | ||
setTimeout( function() { | ||
resume( function() { | ||
assert.isFalse( !!script.$.onreadystatechange ); | ||
assert.isFalse( !!script.$.onload ); | ||
} ); | ||
}, 50 ); | ||
} ); | ||
|
||
wait(); | ||
|
||
function getScript() { | ||
return CKEDITOR.document.findOne( 'script[src="' + CKEDITOR.getUrl( 'core/' + scriptName + '.js' ) + '"]' ); | ||
} | ||
} | ||
} ); | ||
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
<div id="init"></div> | ||
<textarea id="destroy"></textarea> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.