Chromium Code Reviews| 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 /// Includes any additional polyfills that may needed by the deployed app. | 5 /// Includes any additional polyfills that may needed by the deployed app. |
| 6 library polymer.src.build.polyfill_injector; | 6 library polymer.src.build.polyfill_injector; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 // Remove "packages/browser/dart.js". It is not needed in release mode, | 62 // Remove "packages/browser/dart.js". It is not needed in release mode, |
| 63 // and in debug mode we want to ensure it is the last script on the page. | 63 // and in debug mode we want to ensure it is the last script on the page. |
| 64 if (dartJs != null) dartJs.remove(); | 64 if (dartJs != null) dartJs.remove(); |
| 65 | 65 |
| 66 // TODO(jmesserly): ideally we would generate an HTML that loads | 66 // TODO(jmesserly): ideally we would generate an HTML that loads |
| 67 // dart2dart too. But for now dart2dart is not a supported deployment | 67 // dart2dart too. But for now dart2dart is not a supported deployment |
| 68 // target, so just inline the JS script. This has the nice side effect of | 68 // target, so just inline the JS script. This has the nice side effect of |
| 69 // fixing our tests: even if content_shell supports Dart VM, we'll still | 69 // fixing our tests: even if content_shell supports Dart VM, we'll still |
| 70 // test the compiled JS code. | 70 // test the compiled JS code. |
| 71 if (options.directlyIncludeJS) { | 71 if (options.directlyIncludeJS) { |
| 72 // If using CSP add the "precompiled" extension | |
| 73 final csp = options.contentSecurityPolicy ? '.precompiled' : ''; | |
|
Siggi Cherem (dart-lang)
2014/07/29 21:30:54
this is obsolete - now dart2js outputs the file wi
| |
| 74 | |
| 75 // Replace all other Dart script tags with JavaScript versions. | 72 // Replace all other Dart script tags with JavaScript versions. |
| 76 for (var script in dartScripts) { | 73 for (var script in dartScripts) { |
| 77 final src = script.attributes['src']; | 74 final src = script.attributes['src']; |
| 78 if (src.endsWith('.dart')) { | 75 if (src.endsWith('.dart')) { |
| 79 script.attributes.remove('type'); | 76 script.attributes.remove('type'); |
| 80 script.attributes['src'] = '$src$csp.js'; | 77 script.attributes['src'] = '$src.js'; |
| 81 // TODO(sigmund): we shouldn't need 'async' here. Remove this | 78 // TODO(sigmund): we shouldn't need 'async' here. Remove this |
| 82 // workaround for dartbug.com/19653. | 79 // workaround for dartbug.com/19653. |
| 83 script.attributes['async'] = ''; | 80 script.attributes['async'] = ''; |
| 84 } | 81 } |
| 85 } | 82 } |
| 86 } else { | 83 } else { |
| 87 document.body.nodes.add(parseFragment( | 84 document.body.nodes.add(parseFragment( |
| 88 '<script src="packages/browser/dart.js"></script>')); | 85 '<script src="packages/browser/dart.js"></script>')); |
| 89 } | 86 } |
| 90 | 87 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 102 } | 99 } |
| 103 | 100 |
| 104 transform.addOutput( | 101 transform.addOutput( |
| 105 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); | 102 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); |
| 106 }); | 103 }); |
| 107 } | 104 } |
| 108 } | 105 } |
| 109 | 106 |
| 110 final _webComponentsJS = new RegExp(r'platform.*\.js', | 107 final _webComponentsJS = new RegExp(r'platform.*\.js', |
| 111 caseSensitive: false); | 108 caseSensitive: false); |
| OLD | NEW |