From c1d4e41bb3dcdd118357a27589441cbdef71df6b Mon Sep 17 00:00:00 2001
From: Shane Tomlinson <stomlinson@mozilla.com>
Date: Thu, 12 Jan 2012 15:52:20 +0000
Subject: [PATCH] Fix IE7 error on focusing a window.

IE7 on Windows XP blows up when trying to focus the opened window. Putting the w.focus() calls into a try/catch.

close #831
---
 resources/static/include_js/include.js | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/resources/static/include_js/include.js b/resources/static/include_js/include.js
index 047697492..8b3679952 100644
--- a/resources/static/include_js/include.js
+++ b/resources/static/include_js/include.js
@@ -782,7 +782,14 @@
           return {
             close: cleanup,
             focus: function() {
-              if (w) w.focus();
+              if (w) {
+                try {
+                  w.focus();
+                }
+                catch(e) {
+                  /* IE7 blows up here, do nothing */
+                }
+              }
             }
           };
         }
@@ -925,7 +932,12 @@
       } else {
         // focus an existing window
         if (w) {
-          w.focus();
+          try {
+            w.focus();
+          }
+          catch(e) {
+            /* IE7 blows up here, do nothing */
+          }
           return;
         }
 
-- 
GitLab