You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by ta...@apache.org on 2016/05/18 07:51:49 UTC

deltaspike git commit: DELTASPIKE-1144 added maxWindowIdLength check also on client side

Repository: deltaspike
Updated Branches:
  refs/heads/master c25a89f1d -> a86c606a3


DELTASPIKE-1144 added maxWindowIdLength check also on client side

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

Branch: refs/heads/master
Commit: a86c606a3b4e642acc6fa7b78cc9ce499ebc9aaa
Parents: c25a89f
Author: tandraschko <ta...@apache.org>
Authored: Wed May 18 09:51:10 2016 +0200
Committer: tandraschko <ta...@apache.org>
Committed: Wed May 18 09:51:10 2016 +0200

----------------------------------------------------------------------
 .../resources/deltaspike/windowhandler.js        | 19 +++++++++++++++----
 .../src/main/resources/static/windowhandler.html |  2 +-
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a86c606a/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 2805b9e..0833ffe 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
@@ -19,6 +19,7 @@
 window.dswh = window.dswh || {
 
     DEBUG_MODE : false,
+    TEMP_WINDOW_NAME : 'tempWindowId',
 
     windowId : null,
     clientWindowRenderMode : null,
@@ -113,7 +114,7 @@ window.dswh = window.dswh || {
             assertWindowId : function() {
                 // ensure that windowIds get checked even if no windowhandler.html is used
                 if (!window.name || window.name.length < 1) {
-                    window.name = 'tempWindowId';
+                    window.name = dswh.TEMP_WINDOW_NAME;
                     window.location = dswh.utils.setUrlParam(window.location.href, 'dswid', null);
                 }
             },
@@ -330,8 +331,8 @@ window.dswh = window.dswh || {
                                 console.log('request new windowId');
                             }
 
-                            // set tempWindowId to remember the current state
-                            window.name = 'tempWindowId';
+                            // set temp window name to remember the current state
+                            window.name = dswh.TEMP_WINDOW_NAME;
                             // we remove the dswid if available and redirect to the same url again to create a new windowId
                             window.location = dswh.utils.setUrlParam(window.location.href, 'dswid', null);
                         }
@@ -348,7 +349,7 @@ window.dswh = window.dswh || {
                     }
                 }
                 else {
-                    if (window.name === 'tempWindowId') {
+                    if (window.name === dswh.TEMP_WINDOW_NAME) {
                         if (dswid) {
                             // we triggered the windowId recreation last request - use it now!
                             window.name = dswid;
@@ -366,6 +367,16 @@ window.dswh = window.dswh || {
                             }
                         }
                     }
+                    else if (window.name.length > dswh.maxWindowIdLength) {
+                        if (dswh.DEBUG_MODE === true) {
+                            console.log('current window.name exeeds maxWindowIdLength - request new windowId');
+                        }
+
+                        // set temp window name to remember the current state
+                        window.name = dswh.TEMP_WINDOW_NAME;
+                        // we remove the dswid if available and redirect to the same url again to create a new windowId
+                        window.location = dswh.utils.setUrlParam(window.location.href, 'dswid', null);
+                    }
                     else if (window.name !== dswid) {
                         if (dswh.DEBUG_MODE === true) {
                             console.log('reload view with window.name');

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a86c606a/deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html b/deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html
index 07c3b0f..b5bdf21 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html
+++ b/deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html
@@ -135,7 +135,7 @@
                     }
                 }
                 // occurs with the "duplicate tab" feature of chrome
-                else if (windowId === 'tempWindowId') {
+                else if (windowId === dswh.TEMP_WINDOW_NAME) {
                     window.name = '';
                     windowId = 'automatedEntryPoint';
                     urlId = null;