Hi,

I thought I had this problem licked in my last extension. And I did.
But now it's happening again and I don't see how this context is any
different from the last.

The following code, in the content script, is sending a couple of
requests to background.html for data in local storage:

var server = "https://"; + getHostParm("hostname") + ":" + getHostParm
("port");

function getHostParm(parm){
chrome.extension.sendRequest({name: parm},
  function(response)
    {
    if (parm == "hostname") return response.hostname;
    if (parm == "port") return response.port;
    if (parm == "passwd") return response.passwd;
    if (parm == "email_addr") return response.email_addr;
    });
}

background.html waits for requests:

//Wait for request for the host name, port, e-mail address and
password from content script
chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse)
  {
  if (request.name == "hostname")
    {
    sendResponse({hostname: localStorage["hostname"]});
    }
  if (request.name == "port")
    {
    sendResponse({port: localStorage["port"]});
    }
  if (request.name == "passwd")
    {
    sendResponse({passwd: localStorage["passwd"]});
    }
  if (request.name == "email_addr")
    {
    sendResponse({email_addr: localStorage["email_addr"]});
    }
  }
  );

However, when I ran the debugger, it seemed that getHostParm()
completed before the listener could respond. In any case, getHostParm
() returns "undefined". I know the requested data is on disk, because
it's part of my options processing and I know that works. Anyone have
any ideas?

--

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


Reply via email to