New issue
Advanced search Search tips

Issue 601559 link

Starred by 4 users

Issue metadata

Status: Duplicate
Merged: issue 544182
Owner: ----
Closed: May 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Chrome Extension startkup: Cannot read property 'addListener' of undefined

Reported by rich.bur...@gmail.com, Apr 7 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36

Steps to reproduce the problem:
1. Simple event script with 1 line:
2. chrome.runtime.onInstalled.addListener(...);
3. Install app

What is the expected behavior?
Event handler is set.

What went wrong?
1 time out of 5 the error is thrown: Cannot read property 'addListener' of undefined

Seems like a race condition between my event code running and the API being available. 4 out of 5 works fine.

Did this work before? N/A 

Chrome version: 49.0.2623.110  Channel: stable
OS Version: OS X 10.11.3
Flash Version: Shockwave Flash 21.0 r0
 
Components: -Platform>DevTools Platform>Extensions
This only SEEMS to happen when the background page is open when the extension is reloaded.
I've been dealing with this on OSX Chrome 50.0.2661.86 (64-bit) for a few days.

Doing a log of chrome.runtime at the point of adding the onInstall event listener shows that when the background page is open on extension reload, chrome.runtime isn't completely populated. (See attached screenshot).

It wasn't clear to me that this was happening when leaving the event page inspector open until I found this issue. 



chrome-50-extension-reload.png
45.1 KB View Download

Comment 4 by rob@robwu.nl, May 15 2016

Mergedinto: 544182
Status: Duplicate (was: Unconfirmed)
Sounds like  issue 544182 , which is fixed in Chrome 51.
I still get this (Uncaught TypeError: Cannot read property 'addListener' of undefined) even when I Disable -> Enable while debugging unpacked extension. 
I console.log(chrome.runtime) at the top of the background page and get below:

Regarding my comment (Comment 5) the complete source is at:
https://github.com/timtocci/Chrome-Share-It/blob/master/app.js
Behavior is the same with Chrome and Chrome Canary.
Thank you for your time.
Ignore Comment 5 and 6 - my bad.
Apologies

Sign in to add a comment