I'm coming across an unexpected behavior with the sendRequest() call.
My basic setup involves a content_script which passes the hostname to
the background.html for processing. Here's the stripped down code:

content_script:
===========
chrome.extension.sendRequest(window.location.hostname);

background.html:
============
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {

 chrome.extension.onRequest.addListener(
    function(hostname, sender, sendResponse) {
      sendResponse({});

      console.log(hostname);
    });
});

What I'm encountering when I view the logs for a site like
'www.amazon.com' is that I'm logging nine different hostnames for each
page load. I was expecting the content_script to only sendRequest()
once instead of nine times. Also, why does the
window.location.hostname from the content script send other hostnames
in addition to Amazon?

Here's the output from the console:

35background.html:26d3l3lkinz3f56t.cloudfront.net
35background.html:26www.amazon.com
70background.html:26d3l3lkinz3f56t.cloudfront.net
35background.html:26spe.atdmt.com
35background.html:26www.amazon.com
35background.html:26d3l3lkinz3f56t.cloudfront.net
35background.html:26view.atdmt.com
35background.html:26www.amazon.com
36background.html:26view.atdmt.com

Any help or clarification would be much appreciated.

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to