Index: /CKEditor/branches/versions/3.1.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4582)
+++ /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4583)
@@ -92,4 +92,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4676">#4676</a> : Fixed editing tables using table properties dialog overwrites original style values.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4714">#4714</a> : Fixed IE6 JavaScript error when editing flash by commit 'Flash' dialog.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3905">#3905</a> : Fixed 'wysiwyg' mode causes unauthenticated content warnings over SSL in FF 3.5.</li>
 	</ul>
 	<h3>
Index: /CKEditor/branches/versions/3.1.x/_source/core/_bootstrap.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/_bootstrap.js	(revision 4582)
+++ /CKEditor/branches/versions/3.1.x/_source/core/_bootstrap.js	(revision 4583)
@@ -13,10 +13,15 @@
 	// background image.
 
-	var testImage = ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) ? ( CKEDITOR.basePath + 'images/spacer.gif' ) : 'about:blank';
+	var useSpacer = CKEDITOR.env.ie && CKEDITOR.env.version < 7,
+		useBlank = CKEDITOR.env.ie && CKEDITOR.env.version == 7;
+
+
+	var backgroundImageUrl = useSpacer ? ( CKEDITOR.basePath + 'images/spacer.gif' ) :
+							 useBlank ? 'about:blank' : 'data:image/png;base64,';
 
 	var hcDetect = CKEDITOR.dom.element.createFromHtml(
 		'<div style="width:0px;height:0px;' +
 			'position:absolute;left:-10000px;' +
-			'background-image:url(' + testImage + ')"></div>', CKEDITOR.document );
+			'background-image:url(' + backgroundImageUrl + ')"></div>', CKEDITOR.document );
 
 	hcDetect.appendTo( CKEDITOR.document.getHead() );
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js	(revision 4582)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js	(revision 4583)
@@ -252,5 +252,5 @@
 
 					// Creates the iframe that holds the editable document.
-					var createIFrame = function()
+					var createIFrame = function( data )
 					{
 						if ( iframe )
@@ -260,32 +260,34 @@
 
 						frameLoaded = 0;
-						// The document domain must be set within the src
-						// attribute;
-						// Defer the script execution until iframe
-						// has been added to main window, this is needed for some
-						// browsers which will begin to load the frame content
-						// prior to it's presentation in DOM.(#3894)
-						var src = 'void( '
-								+ ( CKEDITOR.env.gecko ? 'setTimeout' : '' ) + '( function(){' +
-								'document.open();' +
-								( CKEDITOR.env.ie && isCustomDomain ? 'document.domain="' + document.domain + '";' : '' ) +
-								'document.write( window.parent[ "_cke_htmlToLoad_' + editor.name + '" ] );' +
-								'document.close();' +
-								'window.parent[ "_cke_htmlToLoad_' + editor.name + '" ] = null;' +
-								'}'
-								+ ( CKEDITOR.env.gecko ? ', 0 )' : ')()' )
-								+ ' )';
-
-						// Loading via src attribute does not work in Opera.
-						if ( CKEDITOR.env.opera )
-							src = 'void(0);';
 
 						iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +
-								' style="width:100%;height:100%"' +
-								' frameBorder="0"' +
-								' tabIndex="-1"' +
-								' allowTransparency="true"' +
-								' src="javascript:' + encodeURIComponent( src ) + '"' +
-								'></iframe>' );
+  							' style="width:100%;height:100%"' +
+  							' frameBorder="0"' +
+							// Support for custom document.domain in IE.
+							( isCustomDomain ?
+								' src="javascript:void((function(){' +
+									'document.open();' +
+									'document.domain=\'' + document.domain + '\';' +
+									'document.close();' +
+								'})())"' : '' ) +
+  							' tabIndex="-1"' +
+  							' allowTransparency="true"' +
+  							'></iframe>' );
+
+						// Register onLoad event for iframe element, which
+						// will fill it with content and set custom domain.
+						iframe.on( 'load', function( e )
+						{
+							e.removeListener();
+							var doc = iframe.getFrameDocument().$;
+
+							// Custom domain handling is needed after each document.open().
+							doc.open();
+							if ( isCustomDomain )
+								doc.domain = document.domain;
+							doc.write( data );
+							doc.close();
+
+						} );
 
 						var accTitle = editor.lang.editorTitle.replace( '%1', editor.name );
@@ -293,11 +295,4 @@
 						if ( CKEDITOR.env.gecko )
 						{
-							// Double checking the iframe will be loaded properly(#4058).
-							iframe.on( 'load', function( ev )
-							{
-								ev.removeListener();
-								contentDomReady( iframe.$.contentWindow );
-							} );
-
 							// Accessibility attributes for Firefox.
 							mainElement.setAttributes(
@@ -597,16 +592,6 @@
 									activationScript;
 
-								window[ '_cke_htmlToLoad_' + editor.name ] = data;
 								CKEDITOR._[ 'contentDomReady' + editor.name ] = contentDomReady;
-								createIFrame();
-
-								// Opera must use the old method for loading contents.
-								if ( CKEDITOR.env.opera )
-								{
-									var doc = iframe.$.contentWindow.document;
-									doc.open();
-									doc.write( data );
-									doc.close();
-								}
+								createIFrame( data );
 							},
 
