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

Issue 626926 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

sender.url is undefined when tabs.sendMessage sends to an extension page

Reported by natalie....@gmail.com, Jul 10 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0

Steps to reproduce the problem:
1. Log the `sender.url` in a content script `runtime.onMessage` listener.
2. Send a message from the background page to a tab with `runtime.sendMessage`.
3. Check the log - `sender.url` is `undefined`.

What is the expected behavior?
`sender.url` should be the background page's `document.documentURI`.

What went wrong?
`sender.url` is `undefined`, not the background page URL.

Did this work before? N/A 

Chrome version: 51.0.2704.79  Channel: stable
OS Version: 
Flash Version: 

When a tab contains an extension page one can't assume that the background page is the message sender - any extension page could have sent it. Thus, the `sender.url` should be set in `tabs.sendMessage` as it is in `runtime.sendMessage`.

Components: Platform>Extensions>API
 
Cc: durga.behera@chromium.org
Labels: Needs-Feedback M-51
natalie.grrossman@ : Thanks for the report, could you please help providing a jsfiddle/extension/url to further triage it.
The attached extension opens an extension page, which immediately sends a message to the background page. The background page responds by sending two messages, one with `tabs.sendMessage` and one with `runtime.sendMessage`. 

Each page logs MessageSender.url and MessageSender.tab.id (formatted as "<url>#<tabId>") and the message to the console. You'll see in the extension page's log that MessageSender.url is a URL string for messages sent with `runtime.sendMessage` but is `undefined` for messages sent with `tabs.sendMessage`. It should be  URL string in both cases.

Thank you.
tabs-sendMessage to extension page.zip
1.2 KB Download
Oh, the extension page is listed as the options page in the manifest, but any extension page will act the same way.
Project Member

Comment 4 by sheriffbot@chromium.org, Jul 13 2016

Labels: -Needs-Feedback Needs-Review
Owner: durga.behera@chromium.org
Thank you for providing more feedback. Adding requester "durga.behera@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: UI>Notifications Platform>Extensions
Labels: -Needs-Review -M-51 M-54 OS-Mac OS-Windows
Owner: ----
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Ubuntu 14.04,Win 7 and Mac 10.11.5 using latest stable 51.0.2704.106 and canary 54.0.2797.0.
This is a non-regression issue since 30.0.1557.0(prior to 35 versions this extension is going to infinite loop).
Owner: asargent@chromium.org
Status: Assigned (was: Untriaged)
I'll have a look at this since I've been investigating some related code recently. 

Comment 7 by peter@chromium.org, Jul 15 2016

Components: -UI>Notifications
I don't see how this has to do with notifications, removing the label.
Ok, I can confirm that for messages sent via chrome.tabs.sendMessage, we do not include an url, but for ones that are sent via chrome.runtime.sendMessage, we do. 


Owner: ----

Sign in to add a comment