Index: /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fck.js	(revision 1741)
+++ /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fck.js	(revision 1742)
@@ -364,5 +364,5 @@
 		// IE doesn't support <abbr> and it breaks it. Let's protect it.
 		if ( FCKBrowserInfo.IsIE )
-			sTags += sTags.length > 0 ? '|ABBR|XML|EMBED' : 'ABBR|XML|EMBED' ;
+			sTags += sTags.length > 0 ? '|ABBR|XML|EMBED|OBJECT' : 'ABBR|XML|EMBED|OBJECT' ;
 
 		var oRegex ;
Index: /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fckconfig.js
===================================================================
--- /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fckconfig.js	(revision 1741)
+++ /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fckconfig.js	(revision 1742)
@@ -180,6 +180,4 @@
 ] ;
 
-FCKConfig.ProtectedSource.CustomRegexHandlers = [] ;
-
 FCKConfig.ProtectedSource.Add = function( regexPattern )
 {
@@ -194,9 +192,4 @@
 		var index = FCKTempBin.AddElement( protectedSource ) ;
 		return '<!--{' + codeTag + index + '}-->' ;
-	}
-
-	for ( var i = 0 ; i < this.CustomRegexHandlers.length ; i++ )
-	{
-		html = html.replace( this.CustomRegexHandlers[i][0], this.CustomRegexHandlers[i][1] ) ;
 	}
 
Index: /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fckdocumentprocessor.js
===================================================================
--- /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fckdocumentprocessor.js	(revision 1741)
+++ /FCKeditor/branches/features/generic_plugin/editor/_source/internals/fckdocumentprocessor.js	(revision 1742)
@@ -34,7 +34,10 @@
 FCKDocumentProcessor.Process = function( document )
 {
+	var bIsDirty = FCK.IsDirty() ;
 	var oProcessor, i = 0 ;
 	while( ( oProcessor = this._Items[i++] ) )
 		oProcessor.ProcessDocument( document ) ;
+	if ( !bIsDirty )
+		FCK.ResetIsDirty() ;
 }
 
@@ -122,44 +125,25 @@
 FCKEmbedAndObjectProcessor = (function()
 {
-	var classidProcessors = {} ;
-	var suffixProcessors = {} ;
-	var contentTypeProcessors = {} ;
-	var defaultObjectHandler = {
-		'Process' : function( el )
-		{
-			var clone = el.cloneNode( true ) ;
-			var fakeImg = FCKDocumentProcessor_CreateFakeImage( 'FCK__UnknownObject', clone ) ;
-			this.Refresh( fakeImg, el ) ;
-			el.parentNode.replaceChild( fakeImg, el ) ;
-		},
-
-		'Refresh' : function( placeHolder, original )
-		{
-			if ( original.getAttribute( 'width' ) > 0 )
-				placeHolder.style.width = FCKTools.ConvertHtmlSizeToStyle( original.getAttribute( 'width' ) ) ;
-
-			if ( original.getAttribute( 'height' ) > 0 )
-				placeHolder.style.height = FCKTools.ConvertHtmlSizeToStyle( original.getAttribute( 'height' ) ) ;
-		}
-	} ;
+	var defaultObjectRefresh = function( placeHolder, original )
+	{
+		if ( original.getAttribute( 'width' ) > 0 )
+			placeHolder.style.width = FCKTools.ConvertHtmlSizeToStyle( original.getAttribute( 'width' ) ) ;
+
+		if ( original.getAttribute( 'height' ) > 0 )
+			placeHolder.style.height = FCKTools.ConvertHtmlSizeToStyle( original.getAttribute( 'height' ) ) ;
+	}
+
+	var customProcessors = [] ;
 
 	var processElement = function( el )
 	{
-		var classId = el.nodeName.IEquals( 'object' ) && el.classid ;
-		classId = classId && classId.replace( /[ \t]/g, '' ).toLowerCase() ;
-		var uri = el.nodeName.IEquals( 'embed' ) && el.src ;
-		var suffix = uri && uri.match( /\.(\w+)(?:\?[0-9A-Za-z!'()*-._~+&=]*)?$/ ) ;
-		suffix = suffix && suffix[1] ;
-		var type = el.type ;
-
-		var retval = false ;
-		if ( type && contentTypeProcessors[type] )
-			retval = contentTypeProcessors[type].Process( el ) ;
-		if ( !retval && classId && classidProcessors[classId] )
-			retval = classidProcessors[classId].Process( el ) ;
-		if ( !retval && suffix && suffixProcessors[suffix] )
-			retval = suffixProcessors[suffix].Process( el ) ;
-		if ( !retval )
-			defaultObjectHandler.Process( el ) ;
+		var retval = true ;
+		var clone = el.cloneNode( true ) ;
+		var fakeImg = FCKDocumentProcessor_CreateFakeImage( 'FCK__UnknownObject', clone ) ;
+		defaultObjectRefresh( fakeImg, el ) ;
+		el.parentNode.replaceChild( fakeImg, el ) ;
+
+		for ( var i = 0 ; i < customProcessors.length && retval !== false ; i++ )
+			retval = customProcessors[i]( el, fakeImg ) ;
 	}
 
@@ -168,75 +152,33 @@
 				ProcessDocument : function( doc )
 				{
-					var bIsDirty = FCK.IsDirty() ;
-
-					// Process OBJECTs first, since EMBEDs can sometimes go inside OBJECTS (e.g. Flash).
-					var aObjects = doc.getElementsByTagName( 'object' );
-					for ( var i = aObjects.length - 1 ; i >= 0 ; i-- )
-						processElement( aObjects[i] ) ;
-
-					// Now process any EMBEDs left.
-					var aEmbeds = doc.getElementsByTagName( 'embed' ) ;
-					for ( var i = aEmbeds.length - 1 ; i >= 0 ; i-- )
-						processElement( aEmbeds[i] ) ;
-
-					if ( !bIsDirty )
-						FCK.ResetIsDirty() ;
+					// Firefox 3 would sometimes throw an unknown exception while accessing EMBEDs and OBJECTs
+					// without the setTimeout().
+					FCKTools.RunFunction( function()
+						{
+							// Process OBJECTs first, since EMBEDs can sometimes go inside OBJECTS (e.g. Flash).
+							var aObjects = doc.getElementsByTagName( 'object' );
+							for ( var i = aObjects.length - 1 ; i >= 0 ; i-- )
+								processElement( aObjects[i] ) ;
+
+							// Now process any EMBEDs left.
+							var aEmbeds = doc.getElementsByTagName( 'embed' ) ;
+							for ( var i = aEmbeds.length - 1 ; i >= 0 ; i-- )
+								processElement( aEmbeds[i] ) ;
+						} ) ;
 				},
 
-				ProcessHtml : function( html )
-				{
-					var tmp = document.createElement( 'div' ) ;
-					tmp.innerHTML = html ;
-					processElement( tmp.firstChild ) ;
-					return tmp.innerHTML ;
+				RefreshView : function( placeHolder, original )
+				{
+					defaultObjectRefresh( placeHolder, original ) ;
 				},
 
-				RefreshView : function( placeHolder, original )
-				{
-					var classId = original.nodeName.IEquals( 'object' ) && original.classid ;
-					classId = classId && classId.replace( /[ \t]/g, '' ).toLowerCase() ;
-					var uri = original.nodeName.IEquals( 'embed' ) && original.src ;
-					var suffix = uri && uri.match( /\.(\w+)(?:\?[0-9A-Za-z!'()*-._~+&=]*)?$/ ) ;
-					suffix = suffix && suffix[1] ;
-					var type = original.type ;
-
-					var retval = false ;
-					if ( type && contentTypeProcessors[type] )
-						retval = contentTypeProcessors[type].Refresh( placeHolder, original ) ;
-					if ( !retval && classId && classidProcessors[classId] )
-						retval = classidProcessors[classId].Refresh( placeHolder, original ) ;
-					if ( !retval && suffix && suffixProcessors[suffix] )
-						retval = suffixProcessors[suffix].Refresh( placeHolder, original ) ;
-					if ( !retval )
-						defaultObjectHandler.Refresh( placeHolder, original ) ;
-				},
-
-				// Include the "clsid:" part to classID as well, case insensitive.
-				AttachClassIdHandler : function( classId, obj )
-				{
-					classId = classId.replace( /[ \t]/g, '' ).toLowerCase() ;
-					classidProcessors[classId] = obj ;
-				},
-
-				// Suffix is case insensitive.
-				AttachFileSuffixHandler : function( suffix, obj )
-				{
-					suffixProcessors[suffix.toLowerCase()] = obj ;
-				},
-
-				// MIME type is case sensitive since there are some MIME types that are distinguished by case alone.
-				AttachContentTypeHandler : function( mimestr, obj )
-				{
-					contentTypeProcessors[mimestr] = obj ;
+				DefaultObjectRefresh : defaultObjectRefresh,
+
+				AddCustomHandler : function( func )
+				{
+					customProcessors.push( func ) ;
 				}
 			} ) ;
 } )() ;
-
-if ( FCKBrowserInfo.IsIE )
-{
-	// Protect <object> tags. See #359.
-	FCKConfig.ProtectedSource.CustomRegexHandlers.push( [/<object[\s\S]+?<\/object>/gi, 
-			FCKTools.Bind( FCKEmbedAndObjectProcessor, FCKEmbedAndObjectProcessor.ProcessHtml ) ] ) ;
-}
 
 FCK.GetRealElement = function( fakeElement )
@@ -302,29 +244,10 @@
 
 // Flash handler.
-var FCKFlashHandler =
-{
-	Process : function( el )
-	{
-		if ( !el.nodeName.IEquals( 'embed' ) )
-			return false ;
-		var clone = el.cloneNode( true ) ;
-		var fakeImg = FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', clone ) ;
+FCKEmbedAndObjectProcessor.AddCustomHandler( function( el, fakeImg )
+	{
+		if ( ! ( el.nodeName.IEquals( 'embed' ) && ( el.type == 'application/x-shockwave-flash' || /\.swf($|#|\?)/i.test( el.src ) ) ) )
+			return ;
+		fakeImg.className = 'FCK__Flash' ;
 		fakeImg.setAttribute( '_fckflash', 'true', 0 ); 
-		this.Refresh( fakeImg, el ) ;
-		el.parentNode.replaceChild( fakeImg, el ) ;
-		return true ;
-	},
-
-	Refresh : function( placeHolderImage, originalEmbed )
-	{
-		if ( !originalEmbed.nodeName.IEquals( 'embed' ) )
-			return false ;
-		if ( originalEmbed.getAttribute( 'width' ) > 0 )
-			placeHolderImage.style.width = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.getAttribute( 'width' ) ) ;
-		if ( originalEmbed.getAttribute( 'height' ) > 0 )
-			placeHolderImage.style.height = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.getAttribute( 'height' ) ) ;
-		return true ;
-	}
-} ;
-FCKEmbedAndObjectProcessor.AttachFileSuffixHandler( 'swf', FCKFlashHandler ) ;
-FCKEmbedAndObjectProcessor.AttachContentTypeHandler( 'application/x-shockwave-flash', FCKFlashHandler ) ;
+		return false ;
+	} ) ;
Index: /FCKeditor/branches/features/generic_plugin/editor/dialog/fck_flash/fck_flash.js
===================================================================
--- /FCKeditor/branches/features/generic_plugin/editor/dialog/fck_flash/fck_flash.js	(revision 1741)
+++ /FCKeditor/branches/features/generic_plugin/editor/dialog/fck_flash/fck_flash.js	(revision 1742)
@@ -142,5 +142,5 @@
 	}
 
-	oEditor.FCKFlashHandler.Refresh( oFakeImage, oEmbed ) ;
+	oEditor.FCKEmbedAndObjectProcessor.DefaultObjectRefresh( oFakeImage, oEmbed ) ;
 
 	return true ;
