title: Google Chrome Extension Websocket Object error undefined for facebook.com
body: <p>I am having issue when I use WebSocket object in contentscript.js file of Google Chrome Extension. It produces error only for facebook.com main page. Err.Message gives me undefined value. I am not getting any clue why it is giving error only on facebook.com. Error is produced on the following line<br/><br/></p>
  
  <pre><code>var ws = new WebSocket("ws://localhost:3345/");
  </code></pre>
  
  <p>Here is the code snippet of <code>contentscript.js</code> : </p>
  
  <pre><code>/////////////////////SendMessage/////////////////////// &lt;br/&gt;
  //Description: We are creating websocket(Chrome API).  &lt;br/&gt;
  /////////////////////////////////////////////////////// &lt;br/&gt;
  
  function SendMessage(message) {
      try {
          if ("WebSocket" in window) {
  
              //creating websocket(Chrome API)
              //Below code line produces error on facebook.com
              var ws = new WebSocket("ws://localhost:3345/");
  
              //Hook function against  ws.onmessage event.
              ws.onmessage = function (evt) {
  
                  OnMessage(evt);
              };
  
              ws.onopen = function () {
                ws.send( message););
              };
  
          }
      }
      catch (err) { alert("Err-&gt;" + err.Message); }
  }
  </code></pre>
  
  <p>Here is the mainfest.json code</p>
  
  <pre><code>{
    "name" : "myextension",
    "version" : "1.1",
    "description" : "me extension detail",
    "background" : {
      "scripts": ["background.js"]
    },
  
    "content_scripts" : [
      {
        "matches" : [
          "http://*/*",
          "https://*/*"
        ],
        "js" : ["contentscript.js"],
        "run_at" : "document_end",
        "all_frames" : true
      }
    ],
  "permissions": [
      "tabs", "&lt;all_urls&gt;",
   "*://*.facebook.com/",
   "*://www.facebook.com/"
  
    ],
  
  "content_security_policy": "script-src https://www.facebook.com 'self'; object-src 'self'; connect-src https://www.facebook.com",
  
    "manifest_version": 2
  }
  </code></pre>