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 |