Repository: deltaspike Updated Branches: refs/heads/master 726b4ed87 -> 403c0b79b
DELTASPIKE-1144 fixed infinite loop when using CLIENTWINDOW + url parameters Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/403c0b79 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/403c0b79 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/403c0b79 Branch: refs/heads/master Commit: 403c0b79bb9faca01ef1018f207f3133ebff2fb9 Parents: 726b4ed Author: tandraschko <[email protected]> Authored: Wed May 18 16:43:30 2016 +0200 Committer: tandraschko <[email protected]> Committed: Wed May 18 16:43:30 2016 +0200 ---------------------------------------------------------------------- .../resources/META-INF/resources/deltaspike/windowhandler.js | 8 ++++---- .../jsf/impl/src/main/resources/static/windowhandler.html | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/403c0b79/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 e6184af..1dcbe97 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 @@ -511,10 +511,11 @@ window.dswh = window.dswh || { return a.href; } - // loop old paramaters and build array with new parameters var oldParameters = a.search.substring(1).split('&'); var newParameters = []; + newParameters.push(parameterName + "=" + encodeURIComponent(parameterValue)); + // loop old parameters, remove empty ones and remove the parameter with the same name as the new one for (var i = 0; i < oldParameters.length; i++) { var oldParameterPair = oldParameters[i]; @@ -524,9 +525,8 @@ window.dswh = window.dswh || { // don't add empty parameters again if (oldParameterValue && oldParameterValue.replace(/^\s+|\s+$/g, '').length > 0) { - if (oldParameterName === parameterName) { - newParameters.push(oldParameterName + "=" + encodeURIComponent(parameterValue)); - } else { + // skip the the old parameter if it's the same as the new parameter + if (oldParameterName !== parameterName) { newParameters.push(oldParameterName + "=" + oldParameterValue); } } http://git-wip-us.apache.org/repos/asf/deltaspike/blob/403c0b79/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 f8dd6b8..0374484 100644 --- a/deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html +++ b/deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html @@ -182,6 +182,8 @@ dswh.utils.storeCookie('dsrwid-' + requestToken, windowId, 3); + dswh.utils.log('redirect to ' + redirectUrl); + window.location = redirectUrl; }; //]]>
