From 9a9714e69a7383d2c31fd9ccb331af2eb076ecb5 Mon Sep 17 00:00:00 2001
From: Shane Tomlinson <stomlinson@mozilla.com>
Date: Tue, 8 May 2012 16:13:52 +0100
Subject: [PATCH] Partial fix IE6 and IE7 blowing up on main site.  These
 browsers do not have Array.prototype.indexOf

issue #1552
---
 resources/static/pages/start.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/resources/static/pages/start.js b/resources/static/pages/start.js
index e43661c6d..c38018d08 100644
--- a/resources/static/pages/start.js
+++ b/resources/static/pages/start.js
@@ -28,6 +28,15 @@ $(function() {
       checkCookiePaths = [ "/signin", "/signup", "/forgot", "/add_email_address", "/verify_email_address" ];
 
 
+  function shouldCheckCookies(path) {
+    if (path) {
+      // IE6 and IE7 will blow up if trying to use indexOf on the array.
+      for(var i = 0, checkCookiePath; checkCookiePath = checkCookiePaths[i]; ++i) {
+        if (checkCookiePath === path) return true;
+      }
+    }
+  }
+
   xhr.init({ time_until_delay: 10 * 1000 });
   network.init();
 
@@ -42,7 +51,7 @@ $(function() {
   moduleManager.register("xhr_disable_form", XHRDisableForm);
   moduleManager.start("xhr_disable_form");
 
-  if(path && (checkCookiePaths.indexOf(path) > -1)) {
+  if(shouldCheckCookies(path)) {
     // do a cookie check on every page except the main page.
     moduleManager.register("cookie_check", CookieCheck);
     moduleManager.start("cookie_check", { ready: start });
-- 
GitLab