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

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

Issue 797513004: Emit either csp or non-csp versions of the program. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 6 years 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 | pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart » ('j') | 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 ad8fa35a7bbcbbf690141ca3007118df8013784f..40c4cbccc81839d0d01c578693a4ea9148f3cf4e 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -490,9 +490,11 @@ class OldEmitter implements Emitter {
var hasOwnProperty = Object.prototype.hasOwnProperty;
- if (typeof dart_precompiled == "function") {
+ if (#inCspMode) {
constructors = dart_precompiled(collectedClasses);
- } else {
+ }
+
+ if (#notInCspMode) {
var combinedConstructorFunction =
"function \$reflectable(fn){fn.$reflectableField=1;return fn};\\n"+
"var \$desc;\\n";
@@ -529,17 +531,17 @@ class OldEmitter implements Emitter {
})(functionSignature);
}
- if (typeof dart_precompiled != "function") {
+ if (#notInCspMode) {
combinedConstructorFunction += defineClass(cls, fields);
constructorsList.push(cls);
}
if (supr) pendingClasses[cls] = supr;
}
- if (typeof dart_precompiled != "function") {
+ if (#notInCspMode) {
combinedConstructorFunction +=
- "return [\\n " + constructorsList.join(",\\n ") + "\\n]";
- var constructors =
+ "return [\\n " + constructorsList.join(",\\n ") + "\\n]";
+ var constructors =
new Function("\$collectedClasses", combinedConstructorFunction)
(collectedClasses);
combinedConstructorFunction = null;
@@ -573,7 +575,9 @@ class OldEmitter implements Emitter {
'metadata': metadataAccess,
'isTreeShakingDisabled': backend.isTreeShakingDisabled,
'finishClassFunction': buildFinishClass(),
- 'trivialNsmHandlers': nsmEmitter.buildTrivialNsmHandlers()});
+ 'trivialNsmHandlers': nsmEmitter.buildTrivialNsmHandlers(),
+ 'inCspMode': compiler.useContentSecurityPolicy,
+ 'notInCspMode': !compiler.useContentSecurityPolicy});
}
jsAst.Node optional(bool condition, jsAst.Node node) {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698