52 |
struct IfDirective * next; |
struct IfDirective * next; |
53 |
}; |
}; |
54 |
|
|
55 |
|
bool jscoverage_mozilla = false; |
56 |
|
|
57 |
static bool * exclusive_directives = NULL; |
static bool * exclusive_directives = NULL; |
58 |
|
|
59 |
static JSRuntime * runtime = NULL; |
static JSRuntime * runtime = NULL; |
1294 |
|
|
1295 |
/* write line number info to the output */ |
/* write line number info to the output */ |
1296 |
Stream_write_string(output, "/* automatically generated by JSCoverage - do not edit */\n"); |
Stream_write_string(output, "/* automatically generated by JSCoverage - do not edit */\n"); |
1297 |
Stream_write_string(output, "if (! top._$jscoverage) {\n top._$jscoverage = {};\n}\n"); |
if (jscoverage_mozilla) { |
1298 |
Stream_write_string(output, "var _$jscoverage = top._$jscoverage;\n"); |
Stream_write_string(output, "try {\n"); |
1299 |
|
Stream_write_string(output, " Components.utils.import('resource://gre/modules/jscoverage.jsm');\n"); |
1300 |
|
Stream_printf(output, " dump('%s: successfully imported jscoverage module\\n');\n", id); |
1301 |
|
Stream_write_string(output, "}\n"); |
1302 |
|
Stream_write_string(output, "catch (e) {\n"); |
1303 |
|
Stream_write_string(output, " _$jscoverage = {};\n"); |
1304 |
|
Stream_printf(output, " dump('%s: failed to import jscoverage module - coverage not available for this file\\n');\n", id); |
1305 |
|
Stream_write_string(output, "}\n"); |
1306 |
|
} |
1307 |
|
else { |
1308 |
|
Stream_write_string(output, "if (! top._$jscoverage) {\n top._$jscoverage = {};\n}\n"); |
1309 |
|
Stream_write_string(output, "var _$jscoverage = top._$jscoverage;\n"); |
1310 |
|
} |
1311 |
Stream_printf(output, "if (! _$jscoverage['%s']) {\n", file_id); |
Stream_printf(output, "if (! _$jscoverage['%s']) {\n", file_id); |
1312 |
Stream_printf(output, " _$jscoverage['%s'] = [];\n", file_id); |
Stream_printf(output, " _$jscoverage['%s'] = [];\n", file_id); |
1313 |
for (int i = 0; i < num_lines; i++) { |
for (int i = 0; i < num_lines; i++) { |