gmail.js
gmail.js copied to clipboard
Cross-Origin Frame block of mail.google.com from Chrome Extension
I have a Chrome Extension that loads on Gmail.
All of a sudden, this error appeared:
Error: Blocked a frame with origin "https://mail.google.com" from accessing a cross-origin frame.↵ at new Gmail (chrome-extension://xxx/js/utils/gmail.js:53:94)↵ at eval (eval at dDa (https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.en.kjGV-KkZdAY.O/am=3j-RZTyg_r7P8TF4mxHA4IHhoRgA-38jyKK2b_sbZgQgyhI48oen_9v4Bvz_Y90MAAAAAAAAAAAAAAAAAAAArkCBFg/rt=j/d=1/im=1/rs=AHGWq9DDgj_edzJKMVcwwN96q7UV1JR91g/m=sps,spl,spit,m_i,spt,t:122:193), <anonymous>:19:15)↵ at refresh (chrome-extension://xxx/js/main.js:11:5)↵ at eval (eval at dDa (https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.en.kjGV-KkZdAY.O/am=3j-RZTyg_r7P8TF4mxHA4IHhoRgA-38jyKK2b_sbZgQgyhI48oen_9v4Bvz_Y90MAAAAAAAAAAAAAAAAAAAArkCBFg/rt=j/d=1/im=1/rs=AHGWq9DDgj_edzJKMVcwwN96q7UV1JR91g/m=sps,spl,spit,m_i,spt,t:122:193), <anonymous>:1:1)↵ at eval (<anonymous>)↵ at dDa (https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.en.kjGV-KkZdAY.O/am=3j-RZTyg_r7P8TF4mxHA4IHhoRgA-38jyKK2b_sbZgQgyhI48oen_9v4Bvz_Y90MAAAAAAAAAAAAAAAAAAAArkCBFg/rt=j/d=1/im=1/rs=AHGWq9DDgj_edzJKMVcwwN96q7UV1JR91g/m=sps,spl,spit,m_i,spt,t:122:193)↵ at https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.en.kjGV-KkZdAY.O/am=3j-RZTyg_r7P8TF4mxHA4IHhoRgA-38jyKK2b_sbZgQgyhI48oen_9v4Bvz_Y90MAAAAAAAAAAAAAAAAAAAArkCBFg/rt=j/d=1/im=1/rs=AHGWq9DDgj_edzJKMVcwwN96q7UV1JR91g/m=sps,spl,spit,m_i,spt,t:121:386↵ at d (https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.en.kjGV-KkZdAY.O/am=3j-RZTyg_r7P8TF4mxHA4IHhoRgA-38jyKK2b_sbZgQgyhI48oen_9v4Bvz_Y90MAAAAAAAAAAAAAAAAAAAArkCBFg/rt=j/d=1/im=1/rs=AHGWq9DDgj_edzJKMVcwwN96q7UV1JR91g/m=sps,spl,spit,m_i,spt,t:232:137)" __proto__: Xp
I tried the latest version of gmail.js, but the same issue occurred.
The problem seems to be coming from line 54, with window.opener.VIEW_DATA. If that is changed to [] just for the sake of this example, everything works.
Is there something better I can do for this issue? Thanks.
UPDATE: I also have to remove it from the ternary in line 53 as well for the code to work.
Thanks for the report and thanks for the thorough debugging!
Does it better if you avoid the window.opener
part? Iirc, that was part of an earlier bugfix, but if it causes issues we should look into ways to avoid those.
If avoiding window.opener
fixes things, try creating a function getting VIEW_DATA
which has a try/catch based fallback to avoid window.opener when that fails.
If that works fine, would you please able able to submit a PR for those changes?
Will do, thank you for your speedy reply!
Old issue is old. Closing.