Merge branch 'login_placeholder_382107'
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js b/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js
index 4066214..8d3a727 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js
@@ -581,19 +581,18 @@
 			
 			setTitle : function(title, /*optional*/ metadata) {
 				var name;
-				if (title.charAt(0) === '*') { //$NON-NLS-0$
-					mGlobalCommands.setDirtyIndicator(true);
-					name = title.substring(1);
-				} else {
-					mGlobalCommands.setDirtyIndicator(false);
-				} 
 				if (metadata) {
 					name = metadata.Name;
 				}
 				mGlobalCommands.setPageTarget({task: messages["Compare"], name: name, target: metadata,
 							serviceRegistry: serviceRegistry, commandService: this._commandService,
 							searchService: this._searchService, fileService: this._fileClient});
-				var indexOfSlash = title.lastIndexOf("/"); //$NON-NLS-0$
+				if (title.charAt(0) === '*') { //$NON-NLS-0$
+					mGlobalCommands.setDirtyIndicator(true);
+					name = title.substring(1);
+				} else {
+					mGlobalCommands.setDirtyIndicator(false);
+				} 
 			},
 			
 			afterSave: function(){
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/globalCommands.js b/bundles/org.eclipse.orion.client.core/web/orion/globalCommands.js
index cea0af0..8bf97e4 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/globalCommands.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/globalCommands.js
@@ -223,6 +223,7 @@
 	var pageItem;
 	var exclusions = [];
 	var favoriteTarget = null;
+	var title;
 	
 	function _emptyLinksMenu() {
 		var related = dojo.byId("relatedLinks"); //$NON-NLS-0$
@@ -465,10 +466,22 @@
 	}
 	
 	/**
-	 * Set a dirty indicator for the page.
+	 * Set a dirty indicator for the page.  An in-page indicator will always be set.  
+	 * If the document has a title (set via setPageTarget), then the title will also be updated
+	 * with a dirty indicator.
 	 */
 	function setDirtyIndicator(isDirty) {
-		var dirty = dojo.byId("dirty");
+		if (title) {
+			if (title.charAt(0) === '*' && !isDirty) { //$NON-NLS-0$
+				title = title.substring(1);
+			}
+			if (isDirty && title.charAt(0) !== '*') { //$NON-NLS-0$
+				title = '*' + title; //$NON-NLS-0$
+			}
+			window.document.title = title;
+		}
+
+		var dirty = dojo.byId("dirty"); //$NON-NLS-0$f
 		if (dirty) {
 			if (isDirty) {
 				dirty.innerHTML = "*"; //$NON-NLS-0$
@@ -531,7 +544,7 @@
 			}
 			name = options.name;
 		}
-		var title = options.title;
+		title = options.title;
 		if (!title) {
 			if (name) {
 				title = name + " - "+ options.task;
diff --git a/bundles/org.eclipse.orion.client.core/web/sites/site.js b/bundles/org.eclipse.orion.client.core/web/sites/site.js
index e0c1b38..76fd1e7 100644
--- a/bundles/org.eclipse.orion.client.core/web/sites/site.js
+++ b/bundles/org.eclipse.orion.client.core/web/sites/site.js
@@ -43,7 +43,6 @@
 				var editor = dijit.byId("site-editor"); //$NON-NLS-0$
 				var site = editor && editor.getSiteConfiguration();
 				if (editor && site) {
-					mGlobalCommands.setDirtyIndicator(editor.isDirty());
 					var item = 	{};
 					item.Parents = [];
 					item.Name = site.Name;
@@ -56,6 +55,7 @@
 						},
 						serviceRegistry: serviceRegistry, searchService: searcher, fileService: fileClient, commandService: commandService
 					});
+					mGlobalCommands.setDirtyIndicator(editor.isDirty());
 				}
 			};