Index: /CKEditor/branches/features/adobeair/_source/plugins/adobeair/plugin.js
===================================================================
--- /CKEditor/branches/features/adobeair/_source/plugins/adobeair/plugin.js	(revision 6173)
+++ /CKEditor/branches/features/adobeair/_source/plugins/adobeair/plugin.js	(revision 6174)
@@ -102,7 +102,4 @@
 			// Body doesn't get default margin on AIR.
 			editor.addCss( 'body { padding: 8px }' );
-
-			// Frame source from application sandbox to be consumed by 'wysiwyg' plugin.
-			editor._.air_bootstrap_frame_url = this.path + '/assets/air_boostrap_frame.html?' + editor.name;
 
 			editor.on( 'uiReady', function()
@@ -161,4 +158,12 @@
 	function( original_write )
 	{
+		function appendElement( parent, tagName, fullTag, text )
+		{
+			var node = parent.append( tagName ),
+				attrs = CKEDITOR.htmlParser.fragment.fromHtml( fullTag ).children[ 0 ].attributes;
+			attrs && node.setAttributes( attrs );
+			text && node.append( parent.getDocument().createText( text ) );
+		}
+
 		return function( html, mode )
 			{
@@ -170,55 +175,50 @@
 					// We're taking the below extra work only because innerHTML
 					// on <html> element doesn't work as expected.
-					var doc = this;
-
-					// Grab all the <link> and <style>.
-					var styleSheetLinks = [],
-							styleTexts = [];
-
-					html.replace( /<style[^>]*>([\s\S]*?)<\/style>/gi, function ( match, styleText )
-					{
-						styleTexts.push( styleText );
-					});
-
-					html.replace( /<link[^>]*?>/gi, function( linkHtml )
-					{
-						styleSheetLinks.push( linkHtml );
-					});
-
-					if ( styleSheetLinks.length )
-					{
-						// Inject the <head> HTML inside a <div>.
-						// Do that before getDocumentHead because WebKit moves
-						// <link css> elements to the <head> at this point.
-						var div = new CKEDITOR.dom.element( 'div', doc );
-						div.setHtml( styleSheetLinks.join( '' ) );
-						// Move the <div> nodes to <head>.
-						div.moveChildren( this.getHead( doc ) );
-					}
-
-					// Create style nodes for inline css.
-					// ( <style> content doesn't applied when setting via innerHTML )
-					var count = styleTexts.length;
-					if ( count )
-					{
-						var head = this.getHead( doc );
-						for ( var i = 0; i < count; i++ )
-						{
-							var node = head.append( 'style' );
-							node.setAttribute( "type", "text/css" );
-							node.append( doc.createText( styleTexts[ i ] ) );
-						}
-					}
-			
-					// Copy the entire <body>.  
-					doc.getBody().setAttributes( CKEDITOR.htmlParser.fragment.fromHtml(
-						// Separate body content and attributes.
-						html.replace( /(<body[^>]*>)([\s\S]*)(?=<\/body>)/i,
-							function( match, startTag, innerHTML )
-							{
-								doc.getBody().setHtml( innerHTML );
-								return startTag;
-							})
-						).children[ 0 ].attributes );
+					var doc = this,
+						head = this.getHead( doc );
+
+					// Create style nodes for inline css. ( <style> content doesn't applied when setting via innerHTML )
+					html = html.replace( /(<style[^>]*>)([\s\S]*?)<\/style>/gi,
+						function ( match, startTag, styleText )
+						{
+							appendElement( head, 'style', startTag, styleText );
+							return '';
+						});
+
+					html = html.replace( /<base\b[^>]*\/>/i,
+						function( match )
+						{
+							appendElement( head, 'base', match );
+							return '';
+						});
+
+					html = html.replace( /<title>([\s\S]*)<\/title>/i,
+						function( match, title )
+						{
+							doc.$.title = title;
+							return '';
+						});
+
+					// Move the rest of head stuff.
+					html = html.replace( /<head>([\s\S]*)<\/head>/i,
+						function( headHtml )
+						{
+							// Inject the <head> HTML inside a <div>.
+							// Do that before getDocumentHead because WebKit moves
+							// <link css> elements to the <head> at this point.
+							var div = new CKEDITOR.dom.element( 'div', doc );
+							div.setHtml( headHtml );
+							// Move the <div> nodes to <head>.
+							div.moveChildren( head );
+							return '';
+						});
+
+					html.replace( /(<body[^>]*>)([\s\S]*)(?=$|<\/body>)/i,
+						function( match, startTag, innerHTML )
+						{
+							doc.getBody().setHtml( innerHTML );
+							var attrs = CKEDITOR.htmlParser.fragment.fromHtml( startTag ).children[ 0 ].attributes;
+							attrs && doc.getBody().setAttributes( attrs );
+						});
 				}
 				else
Index: /CKEditor/branches/features/adobeair/_source/plugins/clipboard/dialogs/paste.js
===================================================================
--- /CKEditor/branches/features/adobeair/_source/plugins/clipboard/dialogs/paste.js	(revision 6173)
+++ /CKEditor/branches/features/adobeair/_source/plugins/clipboard/dialogs/paste.js	(revision 6174)
@@ -14,5 +14,6 @@
 			docElement = doc.$;
 
-		doc.getById( 'cke_actscrpt' ).remove();
+		var script = doc.getById( 'cke_actscrpt' );
+		script && script.remove();
 
 		CKEDITOR.env.ie ?
@@ -81,5 +82,5 @@
 						' allowTransparency="true"' +
 						// Support for custom document.domain in IE.
-						( CKEDITOR.env.air ? ' src="' + editor._.air_bootstrap_frame_url + '"' :
+						( CKEDITOR.env.air ? ' src="javascript:void(0)"' :
 							( isCustomDomain ?
 							' src="javascript:void((function(){' +
@@ -94,12 +95,19 @@
 						'></iframe>' );
 
-			if ( CKEDITOR.env.air )
-				CKEDITOR._[ 'air_bootstrap_data' + editor.name ] = htmlToLoad;
-			else
-			{
-				iframe.on( 'load', function( e )
-				{
-					e.removeListener();
-					var doc = iframe.getFrameDocument().$;
+			iframe.on( 'load', function( e )
+			{
+				e.removeListener();
+
+				var doc;
+
+				if ( CKEDITOR.env.air )
+				{
+					doc = iframe.getFrameDocument();
+					doc.write( htmlToLoad );
+					onPasteFrameLoad.call( this, doc.getWindow().$ );
+				}
+				else
+				{
+					doc = iframe.getFrameDocument().$;
 					// Custom domain handling is needed after each document.open().
 					doc.open();
@@ -108,6 +116,6 @@
 					doc.write( htmlToLoad );
 					doc.close();
-				}, this );
-			}
+				}
+			}, this );
 
 			iframe.setCustomData( 'dialog', this );
Index: /CKEditor/branches/features/adobeair/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/features/adobeair/_source/plugins/wysiwygarea/plugin.js	(revision 6173)
+++ /CKEditor/branches/features/adobeair/_source/plugins/wysiwygarea/plugin.js	(revision 6174)
@@ -422,34 +422,35 @@
 							// for other browers, the 'src' attribute should be left empty to
 							// trigger iframe's 'load' event.
-  							' src="' + ( CKEDITOR.env.air ? editor._.air_bootstrap_frame_url : CKEDITOR.env.ie ? 'javascript:void(function(){' + encodeURIComponent( srcScript ) + '}())' : '' ) + '"' +
+  							' src="' + ( CKEDITOR.env.air ? 'javascript:void(0)' : CKEDITOR.env.ie ? 'javascript:void(function(){' + encodeURIComponent( srcScript ) + '}())' : '' ) + '"' +
 							' tabIndex="' + ( CKEDITOR.env.webkit? -1 : editor.tabIndex ) + '"' +
   							' allowTransparency="true"' +
   							'></iframe>' );
 
-						if ( CKEDITOR.env.air )
-						{
-							CKEDITOR._[ 'air_bootstrap_data' + editor.name ] = data;
+						// Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689)
+						if ( document.location.protocol == 'chrome:' )
+							CKEDITOR.event.useCapture = true;
+
+						// With FF, it's better to load the data on iframe.load. (#3894,#4058)
+						iframe.on( 'load', function( ev )
+						{
 							frameLoaded = 1;
-						}
-						else
-						{
-							// Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689)
-							if ( document.location.protocol == 'chrome:' )
-								CKEDITOR.event.useCapture = true;
-
-							// With FF, it's better to load the data on iframe.load. (#3894,#4058)
-							iframe.on( 'load', function( ev )
-								{
-									frameLoaded = 1;
-									ev.removeListener();
-
-									var doc = iframe.getFrameDocument().$;
-
-									// Don't leave any history log in IE. (#5657)
-									doc.open( "text/html","replace" );
-									doc.write( data );
-									doc.close();
-								});
-						}
+							ev.removeListener();
+
+							var doc;
+							if ( CKEDITOR.env.air )
+							{
+								doc = iframe.getFrameDocument();
+								doc.write( data );
+								contentDomReady( doc.getWindow().$ );
+							}
+							else
+							{
+								doc = iframe.getFrameDocument().$;
+								// Don't leave any history log in IE. (#5657)
+								doc.open( "text/html", "replace" );
+								doc.write( data );
+								doc.close();
+							}
+						});
 
 						// Reset adjustment back to default (#5689)
@@ -506,5 +507,5 @@
 						// Remove this script from the DOM.
 						var script = domDocument.getElementById( "cke_actscrpt" );
-						script.parentNode.removeChild( script );
+						script && script.parentNode.removeChild( script );
 
 						body.spellcheck = !editor.config.disableNativeSpellChecker;
