Devtools Extension Cannot read property 'connect'

394 views
Skip to first unread message

Ambati Manoj

unread,
Jul 25, 2018, 5:33:28 AM7/25/18
to Chromium-Extensions-Announce
Hi All,

I developing Devtools extension by following this example from github. I am able to run the extension fine in the developer mode but when i moved the same to web store. I am facing the following issue This extension may have been corrupted. and found following console error :

(Uncaught TypeError: Cannot read property 'connect' of undefined
    at createChannel (messaging.js:13)
    
messaging.js:13 has this code 

(function createChannel() {   
    var port = chrome.extension.connect({
        name: "Sample" 
    });
    var count=0;
    var activeTabClass;
    // Listen to messages from the background page
    port.onMessage.addListener(function (message) {
setTimeout(function(){showResult(message);},1)       

    });


and Manifest.json has this.


{
  "name": "Sample Engine",
  "version": "1.04",
  "manifest_version": 2,
  "devtools_page": "devtools.html",
  "description": "Chrome Developer Tools",
  "icons": { "64": "images/pact.png" },
  "background": {
    "scripts": [
      "scripts/jquery1.12.4-min.js",
      "scripts/jquery-ui.min.js",
     "scripts/background.js",
  "scripts/panel.js",
  "scripts/tab-order.js",
  "scripts/high-lighter.js"   
    ],
   "persistent": false
  },
  "content_scripts": [
    {     
      "js": [ "scripts/jquery1.12.4-min.js", "scripts/jquery-ui.min.js"],
  "css": ["css/Injected-styles.css"]
    }
  ],
 
  "permissions": [
    "activeTab",
    "tabs",
    "http://*/*",
    "https://*/*",
"storage"  
  ]
}


Thanks in Advance 
Manoj

Vikas Gupta

unread,
Jul 26, 2018, 5:06:11 PM7/26/18
to Chromium-Extensions-Announce
I don't see connect listed as a property or method for chrome.extensions: https://developer.chrome.com/extensions/extension

Have you looked at using chrome.runtime? https://developer.chrome.com/extensions/runtime

 The documentation here (https://developer.chrome.com/extensions/messaging) suggests you should be using chrome.runtime.connect.

Ambati Manoj

unread,
Jul 27, 2018, 1:02:44 AM7/27/18
to Vikas Gupta, Chromium-Extensions-Announce
Thanks for the reply I have tried with chrome.runtime.connect as well. The result remained the same.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/95f43fdb-d0f2-4e78-9d30-4ff184596726%40chromium.org.

Reply all
Reply to author
Forward
0 new messages