Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 3778)
+++ /CKEditor/trunk/CHANGES.html	(revision 3779)
@@ -1,3 +1,3 @@
-﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+﻿﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
@@ -65,4 +65,7 @@
 		<li><a href="http://dev.fckeditor.net/ticket/3789">#3789</a> : The &quot;src&quot; attribute 
 			was getting duplicated in some situations.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3591">#3591</a> : Protecting flash related elements
+			including '&lt;object&gt;', '&lt;embed&gt;' and '&lt;param&gt;'.
+			</li>
 	</ul>
 	<h3>
Index: /CKEditor/trunk/_source/plugins/flash/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/flash/plugin.js	(revision 3778)
+++ /CKEditor/trunk/_source/plugins/flash/plugin.js	(revision 3779)
@@ -20,5 +20,5 @@
 		var attributes = element.attributes;
 
-		return ( attributes.type != 'application/x-shockwave-flash' || !flashFilenameRegex.test( attributes.src || '' ) );
+		return ( attributes.type == 'application/x-shockwave-flash' || flashFilenameRegex.test( attributes.src || '' ) );
 	}
 
Index: /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 3778)
+++ /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 3779)
@@ -1,3 +1,3 @@
-﻿/*
+﻿﻿/*
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -73,10 +73,4 @@
 	var defaultDataFilterRules =
 	{
-		elementNames :
-		[
-			// Elements that cause problems in wysiwyg mode.
-			[ ( /^(object|embed|param)$/ ), 'cke:$1' ]
-		],
-
 		attributeNames :
 		[
@@ -140,7 +134,16 @@
 					if ( parent && parent.name == 'object' )
 					{
-						element.attributes.width = parent.attributes.width;
-						element.attributes.height = parent.attributes.height;
+						var parentWidth = parent.attributes.width,
+							parentHeight = parent.attributes.height;
+						parentWidth && ( element.attributes.width = parentWidth );
+						parentHeight && ( element.attributes.height = parentHeight );
 					}
+				},
+				// Restore param elements into self-closing.
+				param : function( param )
+				{
+					param.children = [];
+					param.isEmpty = true;
+					return param;
 				}
 			},
@@ -188,4 +191,6 @@
 	var protectStyleTagsRegex = /<(style)(?=[ >])[^>]*>[^<]*<\/\1>/gi;
 	var encodedTagsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi;
+	var protectElementNamesRegex = /(<\/?)((?:object|embed|param).*?>)/gi;
+	var protectSelfClosingRegex = /<cke:param(.*?)\/>/gi;
 
 	function protectStyleTagsMatch( match )
@@ -197,4 +202,12 @@
 	{
 		return html.replace( protectStyleTagsRegex, protectStyleTagsMatch );
+	}
+	function protectElementsNames( html )
+	{
+		return html.replace( protectElementNamesRegex, '$1cke:$2');
+	}
+	function protectSelfClosingElements( html )
+	{
+		return html.replace( protectSelfClosingRegex, '<cke:param$1></cke:param>' );
 	}
 
@@ -281,4 +294,12 @@
 				data = protectStyleTags( data );
 
+			// Certain elements has problem to go through DOM operation, protect
+			// them by prefixing 'cke' namespace.(#3591)
+			data = protectElementsNames( data );
+
+			// All none-IE browsers ignore self-closed custom elements,
+			// protecting them into open-close.(#3591)
+			data = protectSelfClosingElements( data );
+
 			// Call the browser to help us fixing a possibly invalid HTML
 			// structure.
Index: /CKEditor/trunk/_source/tests/plugins/htmldataprocessor/htmldataprocessor.html
===================================================================
--- /CKEditor/trunk/_source/tests/plugins/htmldataprocessor/htmldataprocessor.html	(revision 3778)
+++ /CKEditor/trunk/_source/tests/plugins/htmldataprocessor/htmldataprocessor.html	(revision 3779)
@@ -242,4 +242,33 @@
 			assert.areSame( html , dataProcessor.toDataFormat( protectedHtml ) );
 		},
+
+		test_ticket_3591 : function()
+		{
+			var editor = CKEDITOR.instances.editor1,
+				dataProcessor = editor.dataProcessor;
+
+			dataProcessor.writer = new CKEDITOR.htmlParser.basicWriter();
+			var html = getTextAreaValue( '_TEXTAREA_3591' );
+			var protectedHtml = dataProcessor.toHtml( html );
+
+			assert.areSame( getTextAreaValue( '_TEXTAREA_3591_protected' ),
+				protectedHtml );
+			assert.areSame( getTextAreaValue( '_TEXTAREA_3591' ),
+				dataProcessor.toDataFormat( protectedHtml ) );
+		},
+
+		test_ticket_3591_2 : function()
+		{
+			var editor = CKEDITOR.instances.editor1,
+				dataProcessor = editor.dataProcessor;
+
+			dataProcessor.writer = new CKEDITOR.htmlParser.basicWriter();
+			var html = getTextAreaValue( '_TEXTAREA_3591_2' );
+			var protectedHtml = dataProcessor.toHtml( html );
+
+			assert.areSame( getTextAreaValue( '_TEXTAREA_3591_2' ),
+				dataProcessor.toDataFormat( protectedHtml ) );
+		},
+
 
 		name : document.title
@@ -259,4 +288,7 @@
 <![endif]--><td><%Response.Write(now())%></td><td><asp:control_name id="some_id" runat="server"/></td><td><?php
 include ("head.html"); ?></td></tr></tbody></table><noscript>Your browser doesn't support JavaScript</noscript></textarea>
+	<textarea id="_TEXTAREA_3591"><object><param /><param /><embed></embed></object></textarea>
+	<textarea id="_TEXTAREA_3591_protected"><cke:object><cke:param></cke:param><cke:param></cke:param><cke:embed></cke:embed></cke:object></textarea>
+	<textarea id="_TEXTAREA_3591_2"><object classid="clsid"><param name="movie" value="movie.swf" /><embed src="movie.swf" type="application/x-shockwave-flash"></embed></object></textarea>
 </body>
 </html>
