Firefox exception about helper [SOLVED]

I get a rather lengthy exception in Firefox for my helper called ‘codes’. Can anyone help me make this code better? The exception doesn’t get thrown in Chrome, but it seems to stop the page from rendering in Firefox.

Here is the helper…

Template.regionSnowload.helpers({
    ...
    codes: function() {
      var c = Regions.findOne().snow_load_factors.codes;
      c.sort(function(a,b) { // sort by year, then by importance
        var key1A = new Date(a.year),
            key1B = new Date(b.year);
        if(key1A < key1B) return -1;
        if(key1A > key1B) return 1;
        var key2A = a.importance,
            key2B = b.importance;
        if(key2A == "Low importance" && key2B == "Normal importance") return -1;
        if(key2A == "Low importance" && key2B == "High importance") return -1;
        if(key2A == "Low importance" && key2B == "Post-disaster importance") return -1;
        if(key2A == "Normal importance" && key2B == "High importance") return -1;
        if(key2A == "Normal importance" && key2B == "Post-disaster importance") return -1;
        if(key2A == "High importance" && key2B == "Post-disaster importance") return -1;
        if(key2A == "Post-disaster importance" && key2B == "High importance") return 1;
        if(key2A == "Post-disaster importance" && key2B == "Normal importance") return 1;
        if(key2A == "Post-disaster importance" && key2B == "Low importance") return 1;
        if(key2A == "High importance" && key2B == "Normal importance") return 1;
        if(key2A == "High importance" && key2B == "Low importance") return 1;
        if(key2A == "Normal importance" && key2B == "Low importance") return 1;
        return 0;
      });
      return c.filter(function(e) {
        return e.roof == getRoofType();
      });
    },
...
}

Exception in template helper: codes@http://localhost:3000/app/app.js?hash=c4c97aeef3618dcac718a1cda55b072b25ab7e42:2291:11
bindDataContext/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:14
Blaze._wrapCatchingExceptions/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:14
wrapHelper/</<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:14
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12
wrapHelper/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:12
Spacebars.call@http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:12
require<.client.regions[“template.regionSnowload.js”]/Template.regionSnowload</</</<@http://localhost:3000/app/app.js?hash=c4c97aeef3618dcac718a1cda55b072b25ab7e42:1880:16
Blaze.Each/</<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2754:17
viewAutorun/<@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:344:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2214:12
viewAutorun@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:343:5
KernelComputation@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:295:7
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:339:5
Tracker.Computation@http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:229:5
Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:604:11
Kernel.autorun@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:292:10
Blaze.View.prototype.autorun@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:341:11
Blaze.Each/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2751:5
fireCallbacks@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1955:19
Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:631:12
Blaze._fireCallbacks/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1952:5
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2214:12
Blaze._fireCallbacks@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1951:3
Blaze._createView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1969:3
Blaze._materializeView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2014:3
materializeDOMInner@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1476:9
Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1418:3
Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1427:7
doMaterialize@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2033:32
Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:631:12
doRender@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2031:9
viewAutorun/<@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:344:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2214:12
viewAutorun@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:343:5
Kernel.autorun/later@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:276:7
KernelComputation/<@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:299:9
renderLoop@http://localhost:3000/packages/dispatch_kernel.js?hash=0b93ecb82383fd87b25c370d38393ff759b68257:436:6

Problem went away but i don’t know why shrug:confounded: