Chromium Code Reviews| Index: chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/page.js |
| diff --git a/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/page.js b/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/page.js |
| index 34d27fc654bde11b1cd333c5753e78f3ab7ae655..8fc4a94ed6a8b94282ad15a399f364b2749f6763 100644 |
| --- a/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/page.js |
| +++ b/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/page.js |
| @@ -3,28 +3,26 @@ if (typeof(contentWindow) != 'undefined') { |
| win = contentWindow; |
| } |
| -win.onload = function() { |
| - // Do this in an onload handler because I'm not sure if chrome.extension |
| - // is available before then. |
| - chrome.extension.onConnect.addListener(function(port) { |
| - console.log('connected'); |
| - port.onMessage.addListener(function(msg) { |
| - console.log('got ' + msg); |
| - if (msg.testPostMessage) { |
| - port.postMessage({success: true}); |
| - } else if (msg.testPostMessageFromTab) { |
| - testPostMessageFromTab(port); |
| - } else if (msg.testDisconnect) { |
| - port.disconnect(); |
| - } else if (msg.testDisconnectOnClose) { |
| - win.location = "about:blank"; |
| - } else if (msg.testPortName) { |
| - port.postMessage({portName:port.name}); |
| - } |
| - // Ignore other messages since they are from us. |
| - }); |
| +// Do this in an onload handler because I'm not sure if chrome.extension |
|
Matt Perry
2009/11/02 19:46:30
remove this comment
|
| +// is available before then. |
| +chrome.extension.onConnect.addListener(function(port) { |
| + console.log('connected'); |
| + port.onMessage.addListener(function(msg) { |
| + console.log('got ' + msg); |
| + if (msg.testPostMessage) { |
| + port.postMessage({success: true}); |
| + } else if (msg.testPostMessageFromTab) { |
| + testPostMessageFromTab(port); |
| + } else if (msg.testDisconnect) { |
| + port.disconnect(); |
| + } else if (msg.testDisconnectOnClose) { |
| + win.location = "about:blank"; |
| + } else if (msg.testPortName) { |
| + port.postMessage({portName:port.name}); |
| + } |
| + // Ignore other messages since they are from us. |
| }); |
| -}; |
| +}); |
| // Tests that postMessage to the extension and its response works. |
| function testPostMessageFromTab(origPort) { |