deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject git commit: DELTASPIKE-726 reverted old correct logic, fixed a minor bug and added comments
Date Fri, 19 Sep 2014 21:01:20 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 641abce69 -> bf77a23ef


DELTASPIKE-726 reverted old correct logic, fixed a minor bug and added comments

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/bf77a23e
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/bf77a23e
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/bf77a23e

Branch: refs/heads/master
Commit: bf77a23ef610c25521fe0ca72f37de6e74b82564
Parents: 641abce
Author: tandraschko <tandraschko@apache.org>
Authored: Fri Sep 19 23:00:57 2014 +0200
Committer: tandraschko <tandraschko@apache.org>
Committed: Fri Sep 19 23:00:57 2014 +0200

----------------------------------------------------------------------
 .../resources/deltaspike/windowhandler.js       | 31 ++++++++++++++++----
 1 file changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bf77a23e/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
index dccf4d7..c40ba81 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
+++ b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
@@ -161,14 +161,35 @@ function assertWindowId() {
         }
     }
     else if (window.deltaspikeClientWindowRenderMode === 'LAZY') {
+        var dswid = getUrlParameter('dswid');
+        
+        // window.name is null which means that "open in new tab/window" was used
         if (!window.name || window.name.length < 1) {
-            window.name = window.deltaspikeWindowId;
+
+            // url param available?
+            if (dswid) {
+                // -- url param available, we must recreate a new windowId to be sure that
it is new and valid --
+
+                // set tempWindowId to remember the current state                
+                window.name = 'tempWindowId';
+                // we remove the dswid if avilable and redirect to the same url again the
create a new windowId
+                window.location = setUrlParam(window.location.href, 'dswid', null);
+            }
+            else if (window.deltaspikeWindowId) {
+                // -- no dswid in the url -> an initial request without initial redirect
--
+
+                // this means that the initial redirect is disabled and we can just use the
windowId as window.name
+                window.name = window.deltaspikeWindowId;
+            }
         }
         else {
-            var dswid = getUrlParameter('dswid');
-
-            if (window.name !== dswid) {
-                // redirect with current window.name / windowId
+            if (window.name === 'tempWindowId') {
+                // we triggered the windowId recreation last request - use it now!
+                window.name = dswid;
+            }
+            else if (window.name !== dswid) {
+                // window.name doesn't match requested windowId
+                // -> redirect to the same view with current window.name / windowId
                 window.location = setUrlParam(window.location.href, 'dswid', window.name);
             }
         }


Mime
View raw message