[page data] don't call unload_page_data too many time (closes #1518398) oldstable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 28 Apr 2011 15:24:51 +0200
brancholdstable
changeset 7267 2fe2ed459e4d
parent 7266 f625097d1e99
child 7268 cd14e03124be
child 7269 de8ae247bb04
[page data] don't call unload_page_data too many time (closes #1518398)
utils.py
--- a/utils.py	Thu Apr 28 15:24:37 2011 +0200
+++ b/utils.py	Thu Apr 28 15:24:51 2011 +0200
@@ -230,7 +230,10 @@
     Request objects use a HTMLHead instance to ease adding of
     javascripts and stylesheets
     """
-    js_unload_code = u'jQuery(window).unload(unloadPageData);'
+    js_unload_code = u'''if (typeof(pageDataUnloaded) == 'undefined') {
+    jQuery(window).unload(unloadPageData);
+    pageDataUnloaded = true;
+}'''
     # Making <script> tag content work properly with all possible
     # content-types (xml/html) and all possible browsers is very
     # tricky, see http://www.hixie.ch/advocacy/xhtml for an in-depth discussion