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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 function webViewEventListeners() { | 94 function webViewEventListeners() { |
95 var webview = document.createElement('webview'); | 95 var webview = document.createElement('webview'); |
96 webview.setAttribute('src', 'data:text/html,webview check api'); | 96 webview.setAttribute('src', 'data:text/html,webview check api'); |
97 document.body.appendChild(webview); | 97 document.body.appendChild(webview); |
98 | 98 |
99 var validEvents = [ | 99 var validEvents = [ |
100 'exit', | 100 'exit', |
101 'loadabort', | 101 'loadabort', |
102 'loadredirect', | 102 'loadredirect', |
| 103 'loadcommit', |
103 'loadstart', | 104 'loadstart', |
104 'loadstop' | 105 'loadstop', |
| 106 'titlechange' |
105 ]; | 107 ]; |
106 var invalidEvents = [ | 108 var invalidEvents = [ |
107 'makemesandwich', | 109 'makemesandwich', |
108 'sudomakemesandwich' | 110 'sudomakemesandwich' |
109 ]; | 111 ]; |
110 | 112 |
111 // Timeout is necessary to give the mutation observers of the webview tag | 113 // Timeout is necessary to give the mutation observers of the webview tag |
112 // shim a chance to fire. | 114 // shim a chance to fire. |
113 setTimeout(function() { | 115 setTimeout(function() { |
114 for (var i = 0; i < validEvents.length; ++i) { | 116 for (var i = 0; i < validEvents.length; ++i) { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // The test starts from here, by setting the src to |url|. Event | 396 // The test starts from here, by setting the src to |url|. Event |
395 // listener registration works because we already have a (dummy) src set | 397 // listener registration works because we already have a (dummy) src set |
396 // on the <webview> tag. | 398 // on the <webview> tag. |
397 webview.addEventListener('loadcommit', onLoadCommitA); | 399 webview.addEventListener('loadcommit', onLoadCommitA); |
398 webview.addEventListener('loadcommit', onLoadCommitB); | 400 webview.addEventListener('loadcommit', onLoadCommitB); |
399 webview.setAttribute('src', url); | 401 webview.setAttribute('src', url); |
400 }, 0); | 402 }, 0); |
401 } | 403 } |
402 ]); | 404 ]); |
403 }; | 405 }; |
OLD | NEW |