New issue
Advanced search Search tips

Issue 596284 link

Starred by 3 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Uncaught TypeError in sendMessageImpl in extensions::messaging

Reported by teo8...@gmail.com, Mar 19 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36

Steps to reproduce the problem:
This is not systematically reproducible, but the code that triggers the error is:

var message={
	type: 'activeTab',
	active: !document.hidden,
};
chrome.runtime.sendMessage(message, function(response) {
	// do nothing
});

What is the expected behavior?
I can't think of any scenario where the above code could fail at all for any valid reason.

However, if it does, the error should have a meaningful message and the very first element in the stack trace should be a line in MY code (or in any third party library I may be using).

What went wrong?
I occasionally observe the stack trace you can see in the attached screenshot.

An UNCAUGHT error inside Chrome's internal code is by definition a bug, regardless of whether it is triggered by something wrong in my code.

Note also that the stack trace points to lines in code that I cannot inspect, such as "extensions::messaging:326". If I click on that, I get the message you get when trying to open a link with an unknown scheme.

Did this work before? N/A 

Chrome version: 49.0.2623.87  Channel: stable
OS Version: 
Flash Version: Shockwave Flash 21.0 r0
 
Screenshot from 2016-03-19 21-45-16.png
36.1 KB View Download
Labels: Needs-Feedback
Tested the issue on Windows 7, Mac 10.10.5, Ubuntu 14.04 using 49.0.2623.87, latest canary 51.0.2686.0 with below steps:

1.Paste given code in dev tools->console.
2.Got error 'Uncaught TypeError: chrome.runtime.sendMessage is not a function(…)'.

Please find attached screenshot and update if anything missed here in triaging the issue.

teo8976@Could you please provide expected behavior screenshot for better understanding the issue to triage it further.
596284.png
248 KB View Download
LOL obviously you have to test that from the content script of an extension.


Comment 3 by rob@robwu.nl, Mar 23 2016

Cc: rdevlin....@chromium.org
Components: -Blink Platform>Extensions
Labels: -Needs-Feedback
Status: Untriaged (was: Unconfirmed)
> I can't think of any scenario where the above code could fail at all for any valid reason.

I do! When an extension is reloaded, the runtime is torn down and seemingly non-sensical things start to happen: from APIs returning the undefined value, to callbacks that are never called (or APIs that disappear, e.g. chrome.app and chrome.i18n, in content scripts). Or in this case, an obscure error being thrown.


I can reproduce the issue as follows:

1. Open any webpage where an extension has a content script (e.g. visit example.com after installing an adblocking extension).
2. Reload the extension at chrome://extensions (causing the content script to be invalidated).
3. Switch the console's execution environment to the extension, and run chrome.runtime.sendMessage('anything');

Expected:
- No error, or some non-obscure error.

Actual:
- Uncaught TypeError: Cannot read property 'name' of undefined


Devlin: Should this quirk be fixed, and if so, how?
Labels: -Pri-2 Hotlist-GoodFirstBug Pri-3
Status: Available (was: Untriaged)
I'm adding the GoodFirstBug label since it *might* be fairly straightforward to do something like send an ipc to the content scripts letting them know to tear down any open channels, and from then on return a sensible error message. 
Project Member

Comment 5 by sheriffbot@chromium.org, Jun 26 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment