| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library trydart.main; | 5 library trydart.main; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 | 10 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 onDone(_) { | 408 onDone(_) { |
| 409 isDone = true; | 409 isDone = true; |
| 410 receivePort.close(); | 410 receivePort.close(); |
| 411 } | 411 } |
| 412 | 412 |
| 413 // This is called in browsers that support creating Object URLs in a | 413 // This is called in browsers that support creating Object URLs in a |
| 414 // web worker. For example, Chrome and Firefox 21. | 414 // web worker. For example, Chrome and Firefox 21. |
| 415 onUrl(String url) { | 415 onUrl(String url) { |
| 416 objectUrls.add(url); | 416 objectUrls.add(url); |
| 417 clear(); | 417 clear(); |
| 418 String wrapper = | 418 String wrapper = ''' |
| 419 'function dartPrint(msg) { self.postMessage(msg); };' | 419 // Fool isolate_helper.dart so it does not think this is an isolate. |
| 420 'self.importScripts("$url");'; | 420 var window = self; |
| 421 function dartPrint(msg) { |
| 422 self.postMessage(msg); |
| 423 }; |
| 424 self.importScripts("$url"); |
| 425 '''; |
| 421 var wrapperUrl = | 426 var wrapperUrl = |
| 422 Url.createObjectUrl(new Blob([wrapper], 'application/javascript')); | 427 Url.createObjectUrl(new Blob([wrapper], 'application/javascript')); |
| 423 objectUrls.add(wrapperUrl); | 428 objectUrls.add(wrapperUrl); |
| 424 void retryInIframe(_) { | 429 void retryInIframe(_) { |
| 425 var frame = makeOutputFrame(url); | 430 var frame = makeOutputFrame(url); |
| 426 outputFrame.replaceWith(frame); | 431 outputFrame.replaceWith(frame); |
| 427 outputFrame = frame; | 432 outputFrame = frame; |
| 428 } | 433 } |
| 429 void onError(String errorMessage) { | 434 void onError(String errorMessage) { |
| 430 console.appendText(errorMessage); | 435 console.appendText(errorMessage); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 } | 1322 } |
| 1318 | 1323 |
| 1319 .center { | 1324 .center { |
| 1320 display: block; | 1325 display: block; |
| 1321 margin: 0px auto; | 1326 margin: 0px auto; |
| 1322 text-align: center; | 1327 text-align: center; |
| 1323 } | 1328 } |
| 1324 """; | 1329 """; |
| 1325 | 1330 |
| 1326 '''; | 1331 '''; |
| OLD | NEW |