SLING-8278 provide non render blocking version of Sling.getSessionInfo and Sling.httpGet

Closes #4
diff --git a/src/main/resources/system/sling.js b/src/main/resources/system/sling.js
index c96587c..565e8ce 100644
--- a/src/main/resources/system/sling.js
+++ b/src/main/resources/system/sling.js
@@ -61,15 +61,23 @@
     /**
      * HTTP GET XHR Helper
      * @param {String} url The URL
+     * @param {Function} optional second parameter for async version of the method.
+     *        The callback will get the XHR object, method returns immediately
      * @return the XHR object, use .responseText for the data
      * @type String
      */
-    Sling.httpGet = function(url) {
+    Sling.httpGet = function(url, callback) {
         var httpcon = Sling.getXHR();
         if (httpcon) {
-            httpcon.open('GET', url, false);
-            httpcon.send(null);
-            return httpcon;
+            if(callback) {
+                httpcon.onload = function() { callback(this); };
+                httpcon.open('GET', url);
+                httpcon.send(null);
+            } else {
+                httpcon.open('GET', url, false);
+                httpcon.send(null);
+                return httpcon;
+            }
         } else {
             return null;
         }
@@ -83,7 +91,7 @@
      * @type String
      */
     Sling.dumpObj = function(obj, level) {
-        var res="";
+        var res = "";
         for (var a in obj) {
             if (typeof(obj[a])!="object") {
                 res+=a+":"+obj[a]+"  ";
@@ -104,7 +112,7 @@
      * @type Array
      */
     Sling.getAllPropNames = function(obj, names) {
-        var root=false;
+        var root = false;
         if (!names) {
             names=new Object();
             root=true;
@@ -209,7 +217,24 @@
         }
         return null;
     }
-    
+
+    /** Get "session info" from repository. Mainly answers the question: "Who am I"
+     *  and "Which workspace am I logged into. Async version of getSessionInfo
+     * @param {Function} callback function, will get an An Object tree as first argument
+     *        containing the session information, null if server status <> 200
+     */
+    Sling.getSessionInfoAsync = function(callback) {
+        var res = Sling.httpGet(Sling.baseurl+"/system/sling/info.sessionInfo.json",
+            function(res) {
+                if(res.status == 200) {
+                    var info = Sling.evalString(res.responseText);
+                    callback(info);
+                } else {
+                    callback(null);
+                }
+            });
+    }
+
     /** Replace extension in a path */
     Sling._replaceExtension = function(path,newExtension) {
         var i = path.lastIndexOf(".");