
Loading…
Gmail stops working properly due to JS issues #399
I don't use Gmail but I have an account which I used just to test when a problem is reported. I tried with this account + uBlock with out-of-the-box settings and everything worked fine, i.e. switching tabs worked as expected, no matter how often I switched tabs.
I didn't see the error Invalid gadgets.rpc token as seen in your console, neither the Uncaught CustomError... ones, so this could be a hint that something differs in your environment compared to mine.
- Browser/version?
- What filter lists do you have enabled?
- Do you have any dynamic filtering enabled?
- What other extensions do you have enabled?
I'm on Windows now and still notice the issue. I've attached my console log.
Chrome Version 39.0.2171.71 m (64-bit)
uBlock Version 0.7.0.11
I haven't touched the setting so all defaults.
No
Hangout, OneTab, Timer, and uBlock
With uBlock turned off, go to Gmail, refresh, then go to Promotions. Do you see 2 ads, in yellow at the top? (If not, then maybe this is why you may not be able to replicate it). These disappear when I turn on uBlock, which is great but then Promotion and Updates tab stop working. I'll note that I don't see any js issues with my existing extensions enabled and uBlock turned off.
With uBlock turned on, go to Gmail, refresh, go to Promotions, then switch back and forth between Promotions and Updates a few times (because I leave Gmail open all the time, I end up doing this). I'm assuming you have messages in these tabs. I'm not sure if Google decides not to display those two ads in Promotions if you don't use it regularly.
Oh and thanks for looking into this!
With uBlock turned off, go to Gmail, refresh, then go to Promotions. Do you see 2 ads, in yellow at the top?
Actually, with uBlock turned off, I can't find ads nowhere in Gmail so far. Maybe it's because it is an account without history, so Google doesn't know what ads to serve in such case.
I don't have this issue.
If I could reproduce, I would first investigate the Uncaught CustomError.., as usually uncaught exceptions cause javascript to abort in the current context, so that appears the best candidate as to why the tabs are not updated properly. But that is the key of all bugs: to reproduce.
I found a thread here where the user was getting a similar bug without an ad blocker.
Here is a case where I wished Google served me some ads..
Hey, I created a test gmail account and managed to get email into both Promotions and Update tabs. I'm getting the same issues there. What's the best way to share the credentials?
Hmm...I guess I didn't have to do all that. Just try adding the label "Promotions" and "Updates" to a few emails and you should be able to replicate the issue although if you don't see the ads with uBlock turned off, then it still doesn't help.
I have lots of stuff in Promotions and Updates, probably as a result to using the email address a long time ago for the purpose of receiving random emails, but I just can't see no ads. I can get ads no problem with Google search though, so unclear why I can't get them with Gmail. This reminds me of this never resolved issue which I was never able to reproduce.
Best is if other developers with knowledge javascript/html can reproduce on their side and investigate what is happening. On the thread I linked to the helper suggest to disabled the blocker, but really using the dev console to step into why the code fire an exception would be the best.
Bummer! I'll try to take a look at it this weekend.
I have looked at the error, and it looks like its throwing from one of the gmail scripts..
Attached screenshot for reference..
Whitelisting below filter causes no more errors in GMail Functionality. Also, no ads displayed..
@@pagead2.googlesyndication.com
And below are two resources are fetched due to the above filter..Strangely when i manaully try to load the image i didn't see anything
https://pagead2.googlesyndication.com/pagead/adview?ai=C1N_EHSCDVKmmGISxhAS-6ICIAdzqsrdB5Iba9ZkB59-8_wIQASCGj4ACYOXq4wOgAcSW89kDyAEGqQKXx6o4dlhRPqgDAaoERU_Q3eVtPh17VGggqUOtpIW384BI4Vk-zS7BeCzePHIYEpBAnxafGvspGyv6TPYu9xq_7S8LE60MwIqTl5R_zwn-lCdiJ4gFxOPeXJIFBggDEAEYB6AGN4AHpOmMJg&sigh=VP-s02c9gjc&template_id=459
However, if i disable uBlock, i can see ads..
Thanks for digging. Do you know if the resource from https://pagead2.googlesyndication.com/pagead/adview is an image, a frame, or ...? You can find out in the Network tab, refresh the page and search for pagead2.googlesyndication.com. I am curious about the type of the resource.
its an image..
Thanks. I am wondering now...
Some blocked elements on a web page are sometimes removed by uBlock, rather than merely hidden. I wonder if this could be the root of the problem. One way to test this is to disabled the setting "Hide placeholders of blocked elements", in which case the DOM counterpart of blocked resources will never be removed from the page. I suspect the Gmail script may be expecting to find the DOM counterpart of an image -- regardless of whether it was blocked or not -- but can't find it, because uBlock removed it completely from the DOM.
Would be nice if you could disable the setting, remove the exception filter you created to workaround the issue, and see if the problem is still there.
Great! That is the issue. You are right on the spot!! :)
I am no longer seeing the issue once i have disabled that setting.
Thank you very much for assisting in narrowing the problem. I will issue a fix today, it's obviously a serious issue -- I am just hoping there is no unexpected bad side effects.
Not a problem, Welcome.
So, is it now "Removing blocked resource from DOM" Vs "Not Removing Them from DOM". Wondering if there could be any implications if we simply stop removing from DOM..
Let's also hope that layout/scrolling performance benefit will be still there, as less DOM elements mean less clutter to calculate and etc for browsers..
Interesting if there are some tests to test these things to append some numbers to the words..
Let's also hope that layout/scrolling performance benefit will be still there, as less DOM elements mean less clutter to calculate
My understanding is that collapsed elements are ignored when calculating layout, as if the element did not exist.


I'll describe my Gmail setup. I have all of the tabs checked (Primary, Social, Promotions, Updates, Forums) as well as the Starred Messages option checked.
I clicked on Promotions (uBlock does a great job of hiding the ads in Promotions, thanks!) but if you go to Developer Tools, you will notice a lot of js errors (I'm sure because of the ads not appearing). Unfortunately, this ends up affecting functionality in Gmail. I try switching to Updates (after being on Promotions) and it works fine the first time - meaning the Updates tab displays messages. Then if I switch away from Updates, I cannot view these messages again. I can click on Promotions and it takes me to the bottom of the Promotions page. I can click Updates tab and it takes me to the top of the Promotions page. I'm attaching a screenshot of the js errors as I see them on Developer Tools in Chrome. (I'm on a Mac btw though I notice the same issue on Windows). I know that uBlock is causing these issues because I turned it off and reloaded Gmail and everything was working again. I reenable uBlock and reloaded and if you follow the instructions I laid out, you'll notice the issue as well. Note that the issue goes away if I refresh Gmail with uBlock turned on but it will reoccur if I go to Promotions then Updates.