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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.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: 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
Index: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
index 62841e6bc9b83842748be1d37e763257893fb4a0..abd65a132973e343256508880987b4ccb920fd25 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
@@ -227,8 +227,6 @@ jsAst.Expression getReflectionDataParser(String classesCollector,
jsAst.Statement init = js.statement('''{
var functionCounter = 0;
- var tearOffGetter = (typeof dart_precompiled == "function")
- ? tearOffGetterCsp : tearOffGetterNoCsp;
if (!#) # = []; // embedded libraries.
if (!#) # = map(); // embedded mangledNames.
if (!#) # = map(); // embedded mangledGlobalNames.
@@ -338,7 +336,7 @@ List<jsAst.Statement> buildTearOffCode(JavaScriptBackend backend) {
// avoided, except for the string literals that contain the compiled access
// path to 'closureFromTearOff'.
jsAst.Statement tearOffGetterNoCsp = js.uncachedStatementTemplate('''
- function tearOffGetterNoCsp(funcs, reflectionInfo, name, isIntercepted) {
+ function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
return isIntercepted
? new Function("funcs", "reflectionInfo", "name",
"$tearOffGlobalObjectName", "c",
@@ -357,7 +355,7 @@ List<jsAst.Statement> buildTearOffCode(JavaScriptBackend backend) {
}''').instantiate([]);
jsAst.Statement tearOffGetterCsp = js.statement('''
- function tearOffGetterCsp(funcs, reflectionInfo, name, isIntercepted) {
+ function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
var cache = null;
return isIntercepted
? function(x) {
@@ -384,7 +382,10 @@ List<jsAst.Statement> buildTearOffCode(JavaScriptBackend backend) {
: tearOffGetter(funcs, reflectionInfo, name, isIntercepted);
}''', tearOffAccessExpression);
floitsch 2014/12/17 15:03:38 No need to build both variants. jsAst.Statement t
zarah 2014/12/18 08:22:16 Done.
- return <jsAst.Statement>[tearOffGetterNoCsp, tearOffGetterCsp, tearOff];
+ return <jsAst.Statement>[ compiler.useContentSecurityPolicy
+ ? tearOffGetterCsp
+ : tearOffGetterNoCsp,
+ tearOff];
}

Powered by Google App Engine
This is Rietveld 408576698