Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: pkg/polymer/lib/src/build/polyfill_injector.dart

Issue 330683003: Use dart.js in release mode to workaround dartbug.com/19653 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (options.directlyIncludeJS) { 71 if (options.directlyIncludeJS) {
72 // If using CSP add the "precompiled" extension 72 // If using CSP add the "precompiled" extension
73 final csp = options.contentSecurityPolicy ? '.precompiled' : ''; 73 final csp = options.contentSecurityPolicy ? '.precompiled' : '';
74 74
75 // Replace all other Dart script tags with JavaScript versions. 75 // Replace all other Dart script tags with JavaScript versions.
76 for (var script in dartScripts) { 76 for (var script in dartScripts) {
77 final src = script.attributes['src']; 77 final src = script.attributes['src'];
78 if (src.endsWith('.dart')) { 78 if (src.endsWith('.dart')) {
79 script.attributes.remove('type'); 79 script.attributes.remove('type');
80 script.attributes['src'] = '$src$csp.js'; 80 script.attributes['src'] = '$src$csp.js';
81 // TODO(sigmund): we shouldn't need 'async' here. Remove this
82 // workaround for dartbug.com/19653.
83 script.attributes['async'] = '';
81 } 84 }
82 } 85 }
83 } else { 86 } else {
84 document.body.nodes.add(parseFragment( 87 document.body.nodes.add(parseFragment(
85 '<script src="packages/browser/dart.js"></script>')); 88 '<script src="packages/browser/dart.js"></script>'));
86 } 89 }
87 90
88 _addScriptFirst(urlSegment) { 91 _addScriptFirst(urlSegment) {
89 document.head.nodes.insert(0, parseFragment( 92 document.head.nodes.insert(0, parseFragment(
90 '<script src="packages/$urlSegment"></script>\n')); 93 '<script src="packages/$urlSegment"></script>\n'));
91 } 94 }
92 95
93 var suffix = options.releaseMode ? '.js' : '.concat.js'; 96 var suffix = options.releaseMode ? '.js' : '.concat.js';
94 if (!webComponentsFound) { 97 if (!webComponentsFound) {
95 _addScriptFirst('web_components/dart_support.js'); 98 _addScriptFirst('web_components/dart_support.js');
96 99
97 // platform.js should come before all other scripts. 100 // platform.js should come before all other scripts.
98 _addScriptFirst('web_components/platform$suffix'); 101 _addScriptFirst('web_components/platform$suffix');
99 } 102 }
100 103
101 transform.addOutput( 104 transform.addOutput(
102 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); 105 new Asset.fromString(transform.primaryInput.id, document.outerHtml));
103 }); 106 });
104 } 107 }
105 } 108 }
106 109
107 final _webComponentsJS = new RegExp(r'platform.*\.js', 110 final _webComponentsJS = new RegExp(r'platform.*\.js',
108 caseSensitive: false); 111 caseSensitive: false);
OLDNEW
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698