[Pkg-javascript-commits] [sockjs-client] 153/350: handle htmlfile iframe errors

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:03:57 UTC 2016


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

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

commit 1096a4cfc72a231c16b428bf47187a6baf7583ba
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Thu Oct 16 19:52:40 2014 -0400

    handle htmlfile iframe errors
---
 lib/utils/iframe.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/utils/iframe.js b/lib/utils/iframe.js
index 0fe7d9f..670de81 100644
--- a/lib/utils/iframe.js
+++ b/lib/utils/iframe.js
@@ -108,6 +108,7 @@ module.exports = {
     var iframe;
     var unattach = function() {
         clearTimeout(tref);
+        iframe.onerror = null;
     };
     var cleanup = function() {
       if (doc) {
@@ -119,6 +120,7 @@ module.exports = {
       }
     };
     var onerror = function(r)  {
+      debug('onerror', r);
       if (doc) {
         cleanup();
         errorCallback(r);
@@ -138,7 +140,7 @@ module.exports = {
 
     doc.open();
     doc.write('<html><s' + 'cript>' +
-              'document.domain="' + document.domain + '";' +
+              'document.domain="' + global.document.domain + '";' +
               '</s' + 'cript></html>');
     doc.close();
     doc.parentWindow[this.WPrefix] = global[this.WPrefix];
@@ -147,7 +149,12 @@ module.exports = {
     iframe = doc.createElement('iframe');
     c.appendChild(iframe);
     iframe.src = iframeUrl;
-    tref = setTimeout(function(){onerror('timeout');}, 15000);
+    iframe.onerror = function () {
+      onerror('onerror');
+    };
+    tref = setTimeout(function(){
+      onerror('timeout');
+    }, 15000);
     unloadRef = eventUtils.unloadAdd(cleanup);
     return {
       post: post,

-- 
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