Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook JS API initialization error in Firefox: "Couldn't parse invalid source chrome-extension"

Tags:

I've got a simple page using the Facebook JS API that is causing errors in Firefox 27.0.1. I have stripped it down to just the initialization code, and I'm still getting the errors. I'm NOT getting the errors in IE. (I've replaced the real app ID with 1's.)

Any idea what's causing this? Why is there a "chrome-extension" error in Firefox?

Screenshot of errors

<http> <head> </head> <body> <div id='fb-root'></div> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId : '1111111111111111', status : true, xfbml : true }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> </body> </http> 
like image 737
Steve Johnston Avatar asked Mar 14 '14 19:03

Steve Johnston


1 Answers

I'm getting this on my website myself currently. It's not the first time it's appeared either.

My code (uses jQuery):

$(document).ready(function() { console.log('page ready'); $.ajaxSetup({ cache: true }); $.getScript('//connect.facebook.net/en_UK/all.js', function(){     console.log('fb.init calling', FB);     FB.init({         appId: '<?=FB_APP_ID?>',         status: true,         xfbml: true     });     console.log('fb.init called', '<?=FB_APP_ID?>', FB);     $('#loginbutton,#feedbutton').removeAttr('disabled');     console.log('activate buttons');     FB.getLoginStatus(updateStatusCallback, true);     console.log('getloginstatus called'); }); 

and my output

page ready <my script> (line 280) fb.init calling Object { __globalCallbacks={...}, Canvas={...}, CanvasInsights={...}, more...} <my script> (line 283) fb.init called <my FB ID omitted> Object { __globalCallbacks={...}, Canvas={...}, CanvasInsights={...}, more...} <my script> (line 289) activate buttons <my script> (line 291) getloginstatus called <my script> (line 293) Content Security Policy: Couldn't parse invalid source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl ...conds();wa=na.getUTCMilliseconds();}na=(pa<=0||pa>=10000?(pa<0?"-":"+")+o(6,pa<0... all.js (line 28) Content Security Policy: Failed to parse unrecognized source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl Content Security Policy: Couldn't parse invalid source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl Content Security Policy: Failed to parse unrecognized source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl Content Security Policy: Couldn't parse invalid source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl Content Security Policy: Failed to parse unrecognized source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl Content Security Policy: Couldn't parse invalid source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl Content Security Policy: Failed to parse unrecognized source chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl 

Tracing the execution path, we see that the all.js script is downloaded asynchronously and the code that follows is called when it has finished. All goes well until a function FB.getLoginStatus() is invoked in the callback. This function is defined in the all.js script that is downloaded from Facebook. Therefore any problems occurring at this point are in that file and out of my or anybody elses control but Facebook.

As I said, I've agonized for hours and days on this problem before and in the end, all you can do is wait for Facebook to fix it. Usually a day or so.

You can look here Facebook API Status for more information about the API status and Facebook Bug Reporting to report problems.

Sorry I couldn't be more help.

like image 189
Joe Avatar answered Oct 25 '22 05:10

Joe