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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart

Issue 219053003: Deprecate automatic generation of precompiled.js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
index 231035a42efce9cc6a30e789781a8005e7d5bc2b..3418c9aec9fca13e7b506b5afbd867dc790794e0 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
@@ -1530,6 +1530,14 @@ if (typeof $printHelperName === "function") {
} else {
mainBuffer.add('\n');
}
+
+ if (compiler.useContentSecurityPolicy) {
+ mainBuffer.write(
+ jsAst.prettyPrint(
+ precompiledFunctionAst, compiler,
+ allowVariableMinification: false).getText());
+ }
+
String assembledCode = mainBuffer.getText();
String sourceMapTags = "";
if (generateSourceMap) {
@@ -1544,15 +1552,31 @@ if (typeof $printHelperName === "function") {
..close();
compiler.assembledCode = assembledCode;
- mainBuffer.write(
- jsAst.prettyPrint(
- precompiledFunctionAst, compiler,
- allowVariableMinification: false).getText());
+ if (!compiler.useContentSecurityPolicy) {
+ mainBuffer.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""");
- compiler.outputProvider('', 'precompiled.js')
- ..add(mainBuffer.getText())
- ..close();
+ mainBuffer.write(
+ jsAst.prettyPrint(
+ precompiledFunctionAst, compiler,
+ allowVariableMinification: false).getText());
+ compiler.outputProvider('', 'precompiled.js')
+ ..add(mainBuffer.getText())
+ ..close();
+ }
emitDeferredCode();
});
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/dart2js.dart ('k') | tools/testing/dart/compiler_configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698