Repository: deltaspike Updated Branches: refs/heads/master f3ee6faff -> b100e47e6
DELTASPIKE-1144 added some debug logging Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/b100e47e Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/b100e47e Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/b100e47e Branch: refs/heads/master Commit: b100e47e693de21bd4a6d33660320759c22654e9 Parents: f3ee6fa Author: tandraschko <[email protected]> Authored: Tue May 17 13:13:03 2016 +0200 Committer: tandraschko <[email protected]> Committed: Tue May 17 13:13:03 2016 +0200 ---------------------------------------------------------------------- .../resources/deltaspike/windowhandler.js | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b100e47e/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 287fd57..f4bdcb5 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 @@ -18,6 +18,8 @@ */ window.dswh = window.dswh || { + DEBUG_MODE : false, + windowId : null, clientWindowRenderMode : null, cfg: null, @@ -272,12 +274,27 @@ window.dswh = window.dswh || { }, init : function(ajax) { + if (dswh.DEBUG_MODE === true) { + console.log('LAZY#init'); + } + dswh.utils.appendHiddenWindowIdToForms(); }, assertWindowId : function() { + if (dswh.DEBUG_MODE === true) { + console.log('LAZY#assertWindowId'); + } + var dswid = dswh.utils.getUrlParameter(window.location.href, 'dswid'); + if (dswh.DEBUG_MODE === true) { + console.log('window.name: ' + window.name); + console.log('dswid: ' + dswid); + console.log('windowId: ' + dswh.windowId); + console.log('initialRedirectWindowId: ' + dswh.cfg.initialRedirectWindowId); + } + // window.name is null which means that "open in new tab/window" was used if (!window.name || window.name.length < 1) { @@ -287,10 +304,18 @@ window.dswh = window.dswh || { // the windowId is valid - we don't need to a second request if (dswh.cfg.initialRedirectWindowId && dswid === dswh.cfg.initialRedirectWindowId) { window.name = dswh.cfg.initialRedirectWindowId; + + if (dswh.DEBUG_MODE === true) { + console.log('overtake initialRedirectWindowId'); + } } else { // -- url param available, we must recreate a new windowId to be sure that it is new and valid -- + if (dswh.DEBUG_MODE === true) { + console.log('request new windowId'); + } + // set tempWindowId to remember the current state window.name = 'tempWindowId'; // we remove the dswid if available and redirect to the same url again to create a new windowId @@ -302,6 +327,10 @@ window.dswh = window.dswh || { // this means that the initial redirect is disabled and we can just use the windowId as window.name window.name = dswh.windowId; + + if (dswh.DEBUG_MODE === true) { + console.log('assign window.name from windowId'); + } } } else { @@ -309,13 +338,25 @@ window.dswh = window.dswh || { if (dswid) { // we triggered the windowId recreation last request - use it now! window.name = dswid; + + if (dswh.DEBUG_MODE === true) { + console.log('assign window.name from request parameter'); + } } else { // it could be from dswh.windowId in case of open in new tab and initial redirect is disabled window.name = dswh.windowId; + + if (dswh.DEBUG_MODE === true) { + console.log('assign window.name from windowId'); + } } } else if (window.name !== dswid) { + if (dswh.DEBUG_MODE === true) { + console.log('reload view with window.name'); + } + // window.name doesn't match requested windowId // -> redirect to the same view with current window.name / windowId window.location = dswh.utils.setUrlParam(window.location.href, 'dswid', window.name);
