biancadanforth / tracking-protection-shield-study

A Shield study to determine the optimal messaging, if any, for Tracking Protection in Firefox.
0 stars 3 forks source link

TypeError: mainEle is undefined #135

Closed pdehaan closed 6 years ago

pdehaan commented 6 years ago

Not sure why I'm seeing this in my Browser Console on latest Nightly...

TypeError: mainEle is undefined in [new-tab-variation.js:97:13]

https://github.com/biancadanforth/tracking-protection-shield-study/blob/43024167b1b0eb576d487a498053e9e353116c17/addon/content/new-tab-variation.js#L95-L99

If I dig through the DevTools DOM Inspector, I can see a <main> element. Maybe it's just a timing issue.

firefox_nightly

biancadanforth commented 6 years ago

I'm going to guess this was a symptom of #132 , where I was indiscriminately adding the newtab mod to every page. If the page didn't have a <main> element, it'd probably throw that error. Though it may still be possible to get this error if the user reloads about:newtab in the same tab, since frame scripts only load once per tab.

What I can do, just to be safe is to handle the case where <main> is not there.