You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:30:03 UTC

[myfaces-trinidad] 04/04: TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks, Venkata Guddanti, for the patch!

This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.3-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 6e078fe91a392600cd6a619184ed8e05fdccb269
Author: Max Starets <ms...@apache.org>
AuthorDate: Mon Mar 12 15:54:18 2012 +0000

    TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks, Venkata Guddanti, for the patch!
---
 .../src/main/javascript/META-INF/adf/jsLibs/Core.js    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
index 8aed47c..4d9121b 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
@@ -3544,7 +3544,10 @@ function _doPprStartBlocking (win)
 {
   // Clean up timeout set in _pprStartBlocking()
   if (win._pprTimeoutFunc)
+  {
     win.clearTimeout(win._pprTimeoutFunc);
+    win._pprTimeoutFunc = null;
+  }
 
   // In order to force the user to allow a PPR update to complete, we
   // block all mouse clicks between the start of a PPR update, and the end.
@@ -3587,7 +3590,14 @@ function _doPprStartBlocking (win)
 //
 function _pprStopBlocking(win)
 {
-
+  // see TRINIDAD-1833. If _pprStartBlocking() was delayed with setTimeout(),
+  // we need to clear it here. Otherwise _pprStartBlocking() will be called later,
+  // and will end up winning
+  if (win._pprTimeoutFunc)
+  {
+    win.clearTimeout(win._pprTimeoutFunc);
+    win._pprTimeoutFunc = null;
+  }
   // No blocking is performed on Nokia, PPC and BlackBerry devices
   if (_agent.isPIE || _agent.isNokiaPhone || _agent.isBlackBerry)
     return;
@@ -3817,6 +3827,12 @@ function _submitPartialChange(
   if (!form)
     return false;
 
+  // Prevent a submission if we are currently blocking or if we have a timeout set to do blocking
+  // In IE8 the JS engine is very slow and form submission takes time and if the user clicks a link again, the second
+  // click can sneek in before the timeout function is called
+  if(window._pprBlocking || window._pprTimeoutFunc)
+    return false;
+    
   // Tack on the "partial" event parameter parameter
   parameters = _addFormParameter(parameters, "partial", "true");
 

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.