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 |
index d929ba9d14acdfd93233e1fe3ec9dbdf70349d24..54e929f61e5155cc4fb0f991096b8ee4ada8d320 100644 |
--- a/dart/tests/try/web/incremental_compilation_update.html |
+++ b/dart/tests/try/web/incremental_compilation_update.html |
@@ -13,16 +13,20 @@ |
<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() { |
+ var dartMainClosure; |
+ |
+ /// Invoked by JavaScript code generated by dart2js when the program is ready |
+ /// to invoke main. |
+ self.dartMainRunner = function dartMainRunner(main) { |
+ dartMainClosure = 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', '*'); |
+ } |
/// Invoked when a 'message' event is received. Message events are generated |
/// with Window.postMessage and used to communicate between this iframe and |
@@ -35,6 +39,13 @@ function dartMainRunner(main) { |
script.src = e.data[1]; |
script.type = 'application/javascript'; |
document.body.appendChild(script); |
+ } else if (e.data[0] === 'apply-update') { |
+ self.$dart_unsafe_eval.patch(e.data[1]); |
+ |
+ dartMainClosure(); |
+ |
+ // Let the sandbox embedder know that main is done running. |
+ window.parent.postMessage('iframe-dart-updated-main-done', '*'); |
} else { |
// Other messages are just logged. |
console.log(e); |