Chromium Code Reviews| 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]; |
| } |