Refactor OrionHome calculation into single util function: PageLinks.getOrionHome()
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
index 271bb4d..c48092c 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
@@ -14,9 +14,9 @@
 
 define(['i18n!git/nls/gitmessages', 'require', 'orion/Deferred', 'orion/i18nUtil', 'orion/webui/littlelib', 'orion/commands', 'orion/commandRegistry', 'orion/git/util', 'orion/compare/compareUtils', 'orion/git/gitPreferenceStorage', 
         'orion/git/widgets/ConfirmPushDialog', 'orion/git/widgets/RemotePrompterDialog', 'orion/git/widgets/ReviewRequestDialog', 'orion/git/widgets/CloneGitRepositoryDialog', 
-        'orion/git/widgets/GitCredentialsDialog', 'orion/git/widgets/OpenCommitDialog', 'orion/git/widgets/CommitDialog', 'orion/git/widgets/ApplyPatchDialog', 'orion/URL-shim'], 
+        'orion/git/widgets/GitCredentialsDialog', 'orion/git/widgets/OpenCommitDialog', 'orion/git/widgets/CommitDialog', 'orion/git/widgets/ApplyPatchDialog', 'orion/URL-shim', 'orion/PageLinks'], 
         function(messages, require, Deferred, i18nUtil, lib, mCommands, mCommandRegistry, mGitUtil, mCompareUtils, GitPreferenceStorage, mConfirmPush, mRemotePrompter,
-        mReviewRequest, mCloneGitRepository, mGitCredentials, mOpenCommit, mCommit, mApplyPatch) {
+        mReviewRequest, mCloneGitRepository, mGitCredentials, mOpenCommit, mCommit, mApplyPatch, _, PageLinks) {
 
 /**
  * @namespace The global container for eclipse APIs.
@@ -1838,7 +1838,7 @@
 							"Getting repository details " + item.Name).then(
 						function(clone) {
 							var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
-							var orionHome = new URL(require.toUrl("."), window.location).href.slice(0,-1);
+							var orionHome = PageLinks.getOrionHome();
 							var url = sshCheck(clone.Children[0].GitUrl);
 							var reviewRequestUrl = orionHome + "/git/reviewRequest.html#" + url + "_" + item.Name;
 							progress.progress(
@@ -1861,7 +1861,7 @@
 					progress.progress(serviceRegistry.getService("orion.git.provider").getGitClone(item.CloneLocation),
 							"Getting git details " + item.Name).then(function(clone) {
 						var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
-						var orionHome = new URL(require.toUrl("."), window.location).href.slice(0,-1);
+						var orionHome = PageLinks.getOrionHome();
 						var url = sshCheck(clone.Children[0].GitUrl);
 						var reviewRequestUrl = orionHome + "/git/reviewRequest.html#" + url + "_" + item.Name;
 						var dialog = new mReviewRequest.ReviewRequestDialog({ title : messages["Contribution Review Request"],
diff --git a/bundles/org.eclipse.orion.client.ui/web/content/content.js b/bundles/org.eclipse.orion.client.ui/web/content/content.js
index c4d9e20..6c32158 100644
--- a/bundles/org.eclipse.orion.client.ui/web/content/content.js
+++ b/bundles/org.eclipse.orion.client.ui/web/content/content.js
@@ -17,9 +17,9 @@
  */
 
 define(['i18n!orion/content/nls/messages', 'require', 'orion/webui/littlelib', 'orion/bootstrap', 'orion/status', 'orion/progress', 'orion/commandRegistry', 'orion/fileClient', 'orion/operationsClient',
-	        'orion/searchClient', 'orion/globalCommands', 'orion/URITemplate', 'orion/PageUtil', 'orion/URL-shim'], 
+	        'orion/searchClient', 'orion/globalCommands', 'orion/URITemplate', 'orion/PageUtil', 'orion/URL-shim', 'orion/PageLinks'], 
 			function(messages, require, lib, mBootstrap, mStatus, mProgress, mCommandRegistry, mFileClient, mOperationsClient, mSearchClient, 
-			mGlobalCommands, URITemplate, PageUtil) {
+			mGlobalCommands, URITemplate, PageUtil, PageLinks) {
 
 	mBootstrap.startup().then(function(core) {
 		var serviceRegistry = core.serviceRegistry;
@@ -34,7 +34,7 @@
 		var searcher = new mSearchClient.Searcher({serviceRegistry: serviceRegistry, commandService: commandRegistry, fileService: fileClient});
 		
 		var fileMetadata;
-		var orionHome = new URL(require.toUrl("."), window.location).href.slice(0,-1);
+		var orionHome = PageLinks.getOrionHome();
 		
 		/**
 		 * Utility method for saving file contents to a specified location
diff --git a/bundles/org.eclipse.orion.client.ui/web/navigate/table.js b/bundles/org.eclipse.orion.client.ui/web/navigate/table.js
index 64749d1..71c1bb0 100644
--- a/bundles/org.eclipse.orion.client.ui/web/navigate/table.js
+++ b/bundles/org.eclipse.orion.client.ui/web/navigate/table.js
@@ -14,9 +14,9 @@
 
 define(['require', 'i18n!orion/navigate/nls/messages', 'orion/bootstrap', 'orion/Deferred', 'orion/i18nUtil', 'orion/webui/littlelib', 'orion/selection', 'orion/status', 'orion/progress', 'orion/dialogs',
         'orion/ssh/sshTools', 'orion/keyBinding', 'orion/commandRegistry', 'orion/favorites', 'orion/tasks', 'orion/navoutliner', 'orion/searchClient', 'orion/fileClient', 'orion/operationsClient', 'orion/globalCommands',
-        'orion/fileCommands', 'orion/extensionCommands', 'orion/explorers/explorer-table', 'orion/explorers/navigatorRenderer', 'orion/fileUtils', 'orion/PageUtil', 'orion/URITemplate', 'orion/contentTypes', 'orion/URL-shim'], 
+        'orion/fileCommands', 'orion/extensionCommands', 'orion/explorers/explorer-table', 'orion/explorers/navigatorRenderer', 'orion/fileUtils', 'orion/PageUtil', 'orion/URITemplate', 'orion/contentTypes', 'orion/URL-shim', 'orion/PageLinks'], 
 		function(require, messages, mBootstrap, Deferred, i18nUtil, lib, mSelection, mStatus, mProgress, mDialogs, mSsh, KeyBinding, mCommandRegistry, mFavorites, mTasks, mNavOutliner,
-				mSearchClient, mFileClient, mOperationsClient, mGlobalCommands, mFileCommands, mExtensionCommands, mExplorerTable, mNavigatorRenderer, mFileUtils, PageUtil, URITemplate, mContentTypes) {
+				mSearchClient, mFileClient, mOperationsClient, mGlobalCommands, mFileCommands, mExtensionCommands, mExplorerTable, mNavigatorRenderer, mFileUtils, PageUtil, URITemplate, mContentTypes, _, PageLinks) {
 
 	mBootstrap.startup().then(function(core) {
 		var serviceRegistry = core.serviceRegistry;
@@ -60,7 +60,7 @@
 			var pageParams = PageUtil.matchResourceParameters();
 			// TODO working around https://bugs.eclipse.org/bugs/show_bug.cgi?id=373450
 			var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
-			var orionHome = new URL(require.toUrl("."), window.location).href.slice(0,-1);
+			var orionHome = PageLinks.getOrionHome();
 
 			explorer.loadResourceList(pageParams.resource, false, function() {
 				mGlobalCommands.setPageTarget({task: "Navigator", target: explorer.treeRoot, 
@@ -180,4 +180,4 @@
 
 		window.addEventListener("hashchange", function() {refresh();}, false); //$NON-NLS-0$
 	});
-});
\ No newline at end of file
+});
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/PageLinks.js b/bundles/org.eclipse.orion.client.ui/web/orion/PageLinks.js
index a61de2a..15bef30 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/PageLinks.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/PageLinks.js
@@ -11,6 +11,13 @@
 define(["require", "orion/Deferred", "orion/PageUtil", "orion/URITemplate", "orion/URL-shim"], function(require, Deferred, PageUtil, URITemplate) {
 
 	/**
+	 * @returns {String} The value of the <code>{OrionHome}</code> variable.
+	 */
+	function getOrionHome() {
+		return new URL(require.toUrl("."), window.location).href.slice(0,-1); //$NON-NLS-0$
+	}
+
+	/**
 	 * Read info from an <code>orion.page.*</code> service extension.
 	 * @methodOf orion.PageLinks
 	 * @param {orion.ServiceRegistry} serviceRegistry The service registry.
@@ -31,7 +38,7 @@
 		var navLinks= serviceRegistry.getServiceReferences(serviceName); //$NON-NLS-0$
 		var params = PageUtil.matchResourceParameters(window.location.href);
 		// TODO: should not be necessary, see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=373450
-		var orionHome = new URL(require.toUrl("."), window.location).href.slice(0,-1); //$NON-NLS-0$
+		var orionHome = getOrionHome();
 		var locationObject = {OrionHome: orionHome, Location: params.resource};
 		var infos = [];
 		navLinks.forEach(function(navLink) {
@@ -95,6 +102,7 @@
 	 */
 	return {
 		createPageLinks: createPageLinks,
-		getPageLinksInfo: getPageLinksInfo
+		getPageLinksInfo: getPageLinksInfo,
+		getOrionHome: getOrionHome
 	};
 });
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/extensionCommands.js b/bundles/org.eclipse.orion.client.ui/web/orion/extensionCommands.js
index 86db7f3..d61d12d 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/extensionCommands.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/extensionCommands.js
@@ -12,8 +12,8 @@
 /*global window define orion URL*/
 /*browser:true*/
 
-define(["require", "orion/Deferred", "orion/commands", "orion/editor/regex", "orion/contentTypes", "orion/URITemplate", "orion/i18nUtil", "orion/URL-shim"],
-	function(require, Deferred, mCommands, mRegex, mContentTypes, URITemplate, i18nUtil){
+define(["require", "orion/Deferred", "orion/commands", "orion/editor/regex", "orion/contentTypes", "orion/URITemplate", "orion/i18nUtil", "orion/URL-shim", "orion/PageLinks"],
+	function(require, Deferred, mCommands, mRegex, mContentTypes, URITemplate, i18nUtil, _, PageLinks){
 
 	/**
 	 * Utility methods
@@ -24,7 +24,7 @@
 	var extensionCommandUtils  = {};
 	
 	// TODO working around https://bugs.eclipse.org/bugs/show_bug.cgi?id=373450
-	var orionHome = new URL(require.toUrl("."), window.location).href.slice(0,-1);
+	var orionHome = PageLinks.getOrionHome();
 	
 	extensionCommandUtils._cloneItemWithoutChildren = function clone(item){
 	    if (item === null || typeof(item) !== 'object') { //$NON-NLS-0$
diff --git a/bundles/org.eclipse.orion.client.ui/web/shell/extensionCommands.js b/bundles/org.eclipse.orion.client.ui/web/shell/extensionCommands.js
index a487cd6..2f9cc6b 100644
--- a/bundles/org.eclipse.orion.client.ui/web/shell/extensionCommands.js
+++ b/bundles/org.eclipse.orion.client.ui/web/shell/extensionCommands.js
@@ -23,8 +23,8 @@
  * depend on everything else in the file. 

  */

  

-define(["require", "orion/Deferred", "orion/commands", "orion/editor/regex", "orion/contentTypes", "orion/URITemplate", "orion/i18nUtil", "orion/URL-shim"],

-	function(require, Deferred, mCommands, mRegex, mContentTypes, URITemplate, i18nUtil){

+define(["require", "orion/Deferred", "orion/commands", "orion/editor/regex", "orion/contentTypes", "orion/URITemplate", "orion/i18nUtil", "orion/URL-shim", "orion/PageLinks"],

+	function(require, Deferred, mCommands, mRegex, mContentTypes, URITemplate, i18nUtil, _, PageLinks){

 

 	/**

 	 * Utility methods

@@ -35,7 +35,7 @@
 	var extensionCommandUtils  = {};

 	

 	// TODO working around https://bugs.eclipse.org/bugs/show_bug.cgi?id=373450

-	var orionHome = new URL(require.toUrl("."), window.location).href.slice(0,-1);

+	var orionHome = PageLinks.getOrionHome();

 	

 	extensionCommandUtils._cloneItemWithoutChildren = function clone(item){

 	    if (item === null || typeof(item) !== 'object') { //$NON-NLS-0$