You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/06/16 17:25:47 UTC

git commit: WICKET-5607 Wicket Ajax fires calls scheduled by AbstractAjaxTimerBehavior even after unload of the page

Repository: wicket
Updated Branches:
  refs/heads/master e7326555e -> 388293e6b


WICKET-5607 Wicket Ajax fires calls scheduled by AbstractAjaxTimerBehavior even after unload of the page

(cherry picked from commit 4ffd8f6f4986617caf9a4dcf293c9f59daa263a8)


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

Branch: refs/heads/master
Commit: 388293e6bcc65e938a60378fb3955be3fd9a3644
Parents: e732655
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jun 16 18:23:42 2014 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Jun 16 18:25:39 2014 +0300

----------------------------------------------------------------------
 .../apache/wicket/ajax/res/js/wicket-ajax-jquery.js  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/388293e6/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 72509f1..7664bac 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -2810,6 +2810,21 @@
 	Wicket.Event.add(window, 'focusout', Wicket.Focus.focusout);
 
 	/**
+	 * Clear any scheduled Ajax timers when leaving the current page
+	 */
+	Wicket.Event.add(window, "beforeunload", function() {
+		var WTH = Wicket.TimerHandles;
+		if (WTH) {
+			for (var th in WTH) {
+				if (WTH.hasOwnProperty(th)) {
+					window.clearTimeout(WTH[th]);
+					delete WTH[th];
+				}
+			}
+		}
+	});
+
+	/**
 	 * Remove any scheduled timers on the removed element.
 	 * This wont remove the timer for elements which are children of the removed one.
 	 */