chrome.extension.onConnect.addListener(function(port) {
  port.onMessage.addListener(function(msg) {
    port.postMessage({counter: msg.counter+1});
  });
});

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
  sendResponse({counter: request.counter+1});
});

if (window == top) {
  chrome.extension.onConnect.addListener(function(port) {
    port.onMessage.addListener(function(msg) {
      port.postMessage({counter: msg.counter+1});
    });
  });

  chrome.extension.onRequest.addListener(
    function(request, sender, sendResponse) {
      sendResponse({counter: request.counter+1});
    });
}

Fix the messaging timing extension to only message the toplevel frame.
Fix the messaging timing extension to only message the toplevel frame.

BUG=no

Review URL: http://codereview.chromium.org/384133

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@31978 0039d316-1c4b-4281-b951-d872f2087c98
