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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 689633007: Revert "dart2js: Don't emit additional precompiled file." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
index fd49c22f886cc1caaee8ec3105a72f73d7829941..f8740569495da8f5613a8cd160ace7ccb50ad7ca 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -1672,6 +1672,34 @@ class OldEmitter implements Emitter {
..add(assembledCode)
..close();
compiler.assembledCode = assembledCode;
+
+ if (!compiler.useContentSecurityPolicy) {
+ CodeBuffer cspBuffer = new CodeBuffer();
+ cspBuffer.add(mainBuffer);
+ cspBuffer.write("""
+{
+ var message =
+ 'Deprecation: Automatic generation of output for Content Security\\n' +
+ 'Policy is deprecated and will be removed with the next development\\n' +
+ 'release. Use the --csp option to generate CSP restricted output.';
+ if (typeof dartPrint == "function") {
+ dartPrint(message);
+ } else if (typeof console == "object" && typeof console.log == "function") {
+ console.log(message);
+ } else if (typeof print == "function") {
+ print(message);
+ }
+}\n""");
+
+ cspBuffer.write(
+ jsAst.prettyPrint(
+ precompiledFunctionAst, compiler,
+ allowVariableMinification: false).getText());
+
+ compiler.outputProvider('', 'precompiled.js')
+ ..add(cspBuffer.getText())
+ ..close();
+ }
}
/// Returns a map from OutputUnit to a hash of its content. The hash uniquely
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698