adium 4646:8fc9e07216a8: We should add content to the WKMV after...

commits at adium.im commits at adium.im
Sat Feb 4 10:09:44 UTC 2012


details:	http://hg.adium.im/adium/rev/8fc9e07216a8
revision:	4646:8fc9e07216a8
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Sat Feb 04 12:09:28 2012 +0200

We should add content to the WKMV after DOM is ready. Fixes #15377, Message History Only Shows on 1st Tab on Startup.

diffs (68 lines):

diff -r 04605b9e9b83 -r 8fc9e07216a8 Plugins/WebKit Message View/AIWebKitMessageViewController.h
--- a/Plugins/WebKit Message View/AIWebKitMessageViewController.h	Thu Feb 02 14:54:34 2012 +0200
+++ b/Plugins/WebKit Message View/AIWebKitMessageViewController.h	Sat Feb 04 12:09:28 2012 +0200
@@ -36,6 +36,7 @@
 	NSMutableArray				*contentQueue;
 	NSMutableArray				*storedContentObjects;
 	BOOL						webViewIsReady;
+	BOOL						documentIsReady;	// Is DOM ready?
 	
 	//Style & Variant
 	AIWebkitMessageViewStyle	*messageStyle;
diff -r 04605b9e9b83 -r 8fc9e07216a8 Plugins/WebKit Message View/AIWebKitMessageViewController.m
--- a/Plugins/WebKit Message View/AIWebKitMessageViewController.m	Thu Feb 02 14:54:34 2012 +0200
+++ b/Plugins/WebKit Message View/AIWebKitMessageViewController.m	Sat Feb 04 12:09:28 2012 +0200
@@ -67,6 +67,7 @@
 - (void)processQueuedContent;
 - (void)_processContentObject:(AIContentObject *)content willAddMoreContentObjects:(BOOL)willAddMoreContentObjects;
 - (void)_appendContent:(AIContentObject *)content similar:(BOOL)contentIsSimilar willAddMoreContentObjects:(BOOL)willAddMoreContentObjects replaceLastContent:(BOOL)replaceLastContent;
+- (void)_setDocumentReady;
 
 - (NSString *)_webKitBackgroundImagePathForUniqueID:(NSInteger)uniqueID;
 - (NSString *)_webKitUserIconPathForObject:(AIListObject *)inObject;
@@ -568,6 +569,12 @@
 	[chatElement setClassName:chatClassName];
 }
 
+// Set document is ready (DOM ready)
+- (void)_setDocumentReady
+{
+	documentIsReady = YES;
+}
+
 //Content --------------------------------------------------------------------------------------------------------------
 #pragma mark Content
 /*!
@@ -611,7 +618,7 @@
 		NSUInteger	contentQueueCount = 1;
 		NSUInteger	objectsAdded = 0;
 		
-		if (webViewIsReady) {
+		if (webViewIsReady && documentIsReady) {
 			contentQueueCount = contentQueue.count;
 			
 			while (contentQueueCount > 0) {
@@ -1630,7 +1637,8 @@
 	if (
 		sel_isEqual(aSelector, @selector(handleAction:forFileTransfer:)) ||
 		sel_isEqual(aSelector, @selector(debugLog:)) ||
-		sel_isEqual(aSelector, @selector(zoomImage:))
+		sel_isEqual(aSelector, @selector(zoomImage:)) ||
+		sel_isEqual(aSelector, @selector(_setDocumentReady))
 	)
 		return NO;
 	
diff -r 04605b9e9b83 -r 8fc9e07216a8 Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html	Thu Feb 02 14:54:34 2012 +0200
+++ b/Plugins/WebKit Message View/Template.html	Sat Feb 04 12:09:28 2012 +0200
@@ -8,6 +8,10 @@
 		// Any percent signs in this file must be escaped!
 		// Use two escape signs (%%) to display it, this is passed through a format call!
 
+		// We listen for DOM ready and notify our controller
+		document.addEventListener("DOMContentLoaded", function() {window.client.$_setDocumentReady()}, false);
+		//
+		
 		function appendHTML(html) {
 			var node = document.getElementById("Chat");
 			var range = document.createRange();




More information about the commits mailing list