New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 10 users

Issue metadata

Status: Fixed
Last visit > 30 days ago
Closed: Dec 2012
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Blocked on:
issue 163246

Sign in to add a comment

chrome.tabs.oncreated.addlistener is called twice for event pages

Reported by, Nov 25 2012 Back to list

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.19 (KHTML, like Gecko) Chrome/25.0.1323.1 Safari/537.19

Steps to reproduce the problem:
Copy the attachments and run the extension, event is fired twice

What is the expected behavior?
chrome.tabs.oncreated.addlistener should be called once in an event page

What went wrong?
chrome.tabs.oncreated.addlistener is called twice in an event page

WebStore page: 

Did this work before? N/A 

Chrome version: 25.0.1323.1  Channel: dev
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
93 bytes View Download
291 bytes View Download

Comment 1 by, Nov 27 2012

Status: Available
This looks like a bug with event pages. If I remove the "persistent:false" from the manifest then the event only gets fired once.

It also seems specific to chrome.tabs.onCreated - I tried also setting a value in and observing and it only gets the event twice.

Matt, any ideas?
Status: Assigned
Summary: chrome.tabs.oncreated.addlistener is called twice for event pages (was: NULL)
This happens for chrome.tabs.onCreated and onUpdated, because they each do a custom dispatch to all listeners. "All listeners" includes lazy listeners and process listeners, so if the process is alive, it'll dispatch twice.

The quick fix is to uniq the listener list by extension_id. I'm going to think about a better solution, though. EventRouter's API sucks mustard.
Blockedon: chromium:163246
Fixing  issue 163246  would fix this the right way.
Project Member

Comment 4 by, Dec 5 2012

The following revision refers to this bug:

r171141 | | 2012-12-05T03:22:48.238191Z

Changed paths:

Add a more generic API for dispatching events from extension EventRouter.

Also fixes a bug where chrome.tabs.oncreated.addlistener is called twice for
event pages.

The new API allows the caller to specify a callback which gives them a chance
to tailor the event args for each extension and Profile.

BUG= 163246 , 162543 

Review URL:
Status: Fixed
Project Member

Comment 6 by, Mar 11 2013

Labels: -Feature-Extensions Cr-Platform-Extensions
As of 28.0.1500.71 on OS X, this appears to be happening again with chrome.tabs.onUpdated. Possible regression?
OS X 10.7.5

Comment 9 by, Aug 17 2013

I'm seeing this, too.
Google Chrome	28.0.1500.95 (Official Build 213514) 
Platform	4100.89.0 (Official Build) stable-channel link

Extra info: I don't have "tabs" permission for my extension.

chrome.tabs.onUpdated calls callback with:
tabId, changeInfo, tab

1. 604, "loading", {...,status:"loading,...}
2. 604, "complete", {...,status:"complete",...}
3. 604, undefined, {...,status:"complete",...}

So perhaps this is not a bug, the "duplicate" events 2 and 3 are slightly different in that the second argument is not present in the third event. In any case, it is a little confusing. Perhaps this is expected behavior and I am not reading the docs correctly.

Sign in to add a comment