Chromium Code Reviews| Index: dart/tests/try/web/incremental_compilation_update.html |
| diff --git a/dart/tests/try/web/incremental_compilation_update.html b/dart/tests/try/web/incremental_compilation_update.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0018f77f1546221e98ab6b8c164f45c01187c1f9 |
| --- /dev/null |
| +++ b/dart/tests/try/web/incremental_compilation_update.html |
| @@ -0,0 +1,52 @@ |
| +<!DOCTYPE html> |
| +<!-- Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| + -- for details. All rights reserved. Use of this source code is governed by a |
| + -- BSD-style license that can be found in the LICENSE file. |
| + --> |
| +<html lang="en"> |
| + <head> |
| + <title>incremental_compilation_update_test.html</title> |
| + <meta charset="UTF-8"> |
| + </head> |
| + <body> |
| + <h1>incremental_compilation_update_test.html</h1> |
| + <pre id="console"></pre> |
| +<script type="application/javascript" src="print.js"></script> |
| +<script type="application/javascript"> |
| +/// Invoked by JavaScript code generated by dart2js when the program is ready |
| +/// to invoke main. |
| +function dartMainRunner(main) { |
| + // Invoke the "main" method of the Dart program. |
| + main(); |
| + |
| + // Let the sandbox embedder know that main is done running. |
| + window.parent.postMessage('iframe-dart-main-done', '*'); |
| +} |
| +(function() { |
| + |
| + /// Invoked when a 'message' event is received. Message events are generated |
| + /// with Window.postMessage and used to communicate between the this iframe |
|
Johnni Winther
2014/10/10 10:28:56
'the this' -> 'this'.
ahe
2014/10/13 11:47:35
Done.
|
| + /// and its embedding parent page. |
| + function onMessage(e) { |
| + if (e.data[0] === 'add-script') { |
| + // Received a message on the form ['add-script', uri]. |
| + // Install a new script tag with the uri. |
| + var script = document.createElement('script'); |
| + script.src = e.data[1]; |
| + script.type = 'application/javascript'; |
| + document.body.appendChild(script); |
| + } else { |
| + // Other messages are just logged. |
| + console.log(e); |
| + } |
| + } |
| + window.addEventListener('message', onMessage, false); |
| + |
| + // Let the sandbox embedder know that this iframe is ready, that is, |
| + // listening for messages. |
| + window.parent.postMessage('iframe-ready', '*'); |
| + |
| +})(); |
| +</script> |
| + </body> |
| +</html> |