| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var util = {}; | 5 var util = {}; |
| 6 | 6 |
| 7 // Creates a <webview> tag in document.body and returns the reference to it. | 7 // Creates a <webview> tag in document.body and returns the reference to it. |
| 8 // It also sets a dummy src. The dummy src is significant because this makes | 8 // It also sets a dummy src. The dummy src is significant because this makes |
| 9 // sure that the <object> shim is created (asynchronously at this point) for the | 9 // sure that the <object> shim is created (asynchronously at this point) for the |
| 10 // <webview> tag. This makes the <webview> tag ready for add/removeEventListener | 10 // <webview> tag. This makes the <webview> tag ready for add/removeEventListener |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 webview.setAttribute('src', 'data:text/html,trigger navigation'); | 198 webview.setAttribute('src', 'data:text/html,trigger navigation'); |
| 199 document.body.appendChild(webview); | 199 document.body.appendChild(webview); |
| 200 setTimeout(function() { | 200 setTimeout(function() { |
| 201 try { | 201 try { |
| 202 webview.partition = 'illegal'; | 202 webview.partition = 'illegal'; |
| 203 chrome.test.fail(); | 203 chrome.test.fail(); |
| 204 } catch (e) { | 204 } catch (e) { |
| 205 chrome.test.succeed(); | 205 chrome.test.succeed(); |
| 206 } | 206 } |
| 207 }, 0); | 207 }, 0); |
| 208 }, |
| 209 |
| 210 function webViewExecuteScript() { |
| 211 var webview = document.createElement('webview'); |
| 212 webview.addEventListener('loadstop', function() { |
| 213 webview.executeScript( |
| 214 {code:'document.body.style.backgroundColor = "red";'}, |
| 215 function(results) { |
| 216 chrome.test.assertEq(1, results.length); |
| 217 chrome.test.assertEq('red', results[0]); |
| 218 chrome.test.succeed(); |
| 219 }); |
| 220 }); |
| 221 webview.setAttribute('src', 'data:text/html,trigger navigation'); |
| 222 document.body.appendChild(webview); |
| 208 } | 223 } |
| 209 ]); | 224 ]); |
| 210 }; | 225 }; |
| OLD | NEW |