| OLD | NEW |
| 1 <script> | 1 <!-- |
| 2 | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
| 3 var baseUrl = 'http://a.com:PORT/files/extensions/api_test/executescript/' + | 3 * source code is governed by a BSD-style license that can be found in the |
| 4 'frame_after_load/'; | 4 * LICENSE file. |
| 5 | 5 --> |
| 6 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { | 6 <script src="test.js"></script> |
| 7 if (changeInfo.status != 'complete') | |
| 8 return; | |
| 9 | |
| 10 chrome.test.runTests([ | |
| 11 function() { | |
| 12 // Tests that we can still execute scripts after a frame has loaded after | |
| 13 // the main document has completed. | |
| 14 var injectFrameCode = 'var frame = document.createElement("iframe");' + | |
| 15 'frame.src = "' + baseUrl + 'inner.html";' + | |
| 16 'frame.onload = function() {chrome.extension.connect().postMessage("lo
aded")};' + | |
| 17 'document.body.appendChild(frame)'; | |
| 18 var postFrameCode = 'chrome.extension.connect().postMessage("done");'; | |
| 19 | |
| 20 chrome.self.onConnect.addListener(function(port) { | |
| 21 port.onMessage.addListener(function(data) { | |
| 22 if (data == 'loaded') { | |
| 23 chrome.tabs.executeScript(tabId, {code: postFrameCode}); | |
| 24 } else if (data == 'done') { | |
| 25 chrome.test.succeed(); | |
| 26 } | |
| 27 }); | |
| 28 }); | |
| 29 chrome.tabs.executeScript(tabId, {code: injectFrameCode}); | |
| 30 } | |
| 31 ]); | |
| 32 }); | |
| 33 | |
| 34 chrome.test.getConfig(function(config) { | |
| 35 baseUrl = baseUrl.replace(/PORT/, config.testServer.port); | |
| 36 chrome.tabs.create({ url: baseUrl + 'outer.html' }); | |
| 37 }); | |
| 38 | |
| 39 </script> | |
| OLD | NEW |