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

Unified Diff: pkg/dev_compiler/lib/src/compiler/compiler.dart

Issue 2746033003: Inline source maps as part of each script. (Closed)
Patch Set: Base64 encode inline sourcemaps to work around strange v8 bug. Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/compiler/compiler.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/compiler.dart b/pkg/dev_compiler/lib/src/compiler/compiler.dart
index 93389ab2f94fa20b4694ef25cfc671cf8c2f56ca..332ec6b43c99b90cff9dd71b5810eaf77509439a 100644
--- a/pkg/dev_compiler/lib/src/compiler/compiler.dart
+++ b/pkg/dev_compiler/lib/src/compiler/compiler.dart
@@ -509,12 +509,18 @@ class JSModuleFile {
}
var text = printer.getText();
- var rawSourceMap = options.inlineSourceMap ? JSON.encode(builtMap) : null;
+ var rawSourceMap = 'null';
+ if (options.inlineSourceMap) {
+ var bytes = UTF8.encode(JSON.encode(builtMap));
+ // Base64 encode instead of json escaping to work around V8 bug
+ // unescaping strings with a large number of slashes.
+ rawSourceMap = "'${BASE64.encode(bytes)}'";
+ }
// Encode the sourcemap as an escaped string rather than JSON
// as Dart code using the sourcemap can't take advantage of it being JS
// JSON so we might as well encode it as a String which should be quicker
// to parse.
- text = text.replaceFirst(sourceMapHoleID, JSON.encode(rawSourceMap));
+ text = text.replaceFirst(sourceMapHoleID, rawSourceMap);
return new JSModuleCode(text, builtMap);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698