[Pkg-javascript-commits] [sockjs-client] 26/434: Iframe timers fixed.

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:46:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository sockjs-client.

commit 27befdce8980f86c786c316ee8fdc411cfa476da
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Tue Jul 26 16:50:15 2011 +0100

    Iframe timers fixed.
---
 lib/utils.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/utils.js b/lib/utils.js
index 27660c6..41ef971 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -87,8 +87,6 @@ utils.createXHR = function(method, url, payload, callback) {
     }
     xhr.open(method, url, true);
 
-    // Try to clear some headers, in order to save bandwidth.
-    // See http://blog.mibbit.com/?p=143
     for (var k in xhrDefaultHeaders) {
         try {
             xhr.setRequestHeader(k, xhrDefaultHeaders[k]);
@@ -131,10 +129,10 @@ utils.createIframe = function (iframe_url, error_callback) {
     var iframe = _document.createElement('iframe');
     var tref;
     var unattach = function() {
+        clearTimeout(tref);
         // Explorer had problems with that.
         try {iframe.onload = null;} catch (x) {}
         iframe.onerror = null;
-        clearTimeout(tref);
     };
     var cleanup = function() {
         if (iframe) {
@@ -156,10 +154,11 @@ utils.createIframe = function (iframe_url, error_callback) {
     iframe.onload = function() {
         // `onload` is triggered before scripts on the iframe are
         // executed. Give it few seconds to actually load stuff.
-        setTimeout(onerror, 2000);
+        clearTimeout(tref);
+        tref = setTimeout(onerror, 2000);
     };
     _document.body.appendChild(iframe);
-    tref = setTimeout(cleanup, 5000);
+    tref = setTimeout(onerror, 5000);
     return {
         iframe: iframe,
         cleanup: cleanup,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list