53 |
struct IfDirective * next; |
struct IfDirective * next; |
54 |
}; |
}; |
55 |
|
|
56 |
bool jscoverage_mozilla = false; |
enum JSCoverageMode jscoverage_mode = JSCOVERAGE_NORMAL; |
57 |
|
|
58 |
static bool * exclusive_directives = NULL; |
static bool * exclusive_directives = NULL; |
59 |
|
|
1392 |
|
|
1393 |
/* write line number info to the output */ |
/* write line number info to the output */ |
1394 |
Stream_write_string(output, "/* automatically generated by JSCoverage - do not edit */\n"); |
Stream_write_string(output, "/* automatically generated by JSCoverage - do not edit */\n"); |
1395 |
if (jscoverage_mozilla) { |
switch (jscoverage_mode) { |
1396 |
|
case JSCOVERAGE_MOZILLA: |
1397 |
Stream_write_string(output, "try {\n"); |
Stream_write_string(output, "try {\n"); |
1398 |
Stream_write_string(output, " Components.utils.import('resource://gre/modules/jscoverage.jsm');\n"); |
Stream_write_string(output, " Components.utils.import('resource://gre/modules/jscoverage.jsm');\n"); |
1399 |
Stream_printf(output, " dump('%s: successfully imported jscoverage module\\n');\n", id); |
Stream_printf(output, " dump('%s: successfully imported jscoverage module\\n');\n", id); |
1402 |
Stream_write_string(output, " _$jscoverage = {};\n"); |
Stream_write_string(output, " _$jscoverage = {};\n"); |
1403 |
Stream_printf(output, " dump('%s: failed to import jscoverage module - coverage not available for this file\\n');\n", id); |
Stream_printf(output, " dump('%s: failed to import jscoverage module - coverage not available for this file\\n');\n", id); |
1404 |
Stream_write_string(output, "}\n"); |
Stream_write_string(output, "}\n"); |
1405 |
} |
break; |
1406 |
else { |
case JSCOVERAGE_NORMAL: |
1407 |
Stream_write_string(output, "if (! top._$jscoverage) {\n top._$jscoverage = {};\n}\n"); |
Stream_write_string(output, "if (! top._$jscoverage) {\n top._$jscoverage = {};\n}\n"); |
1408 |
Stream_write_string(output, "var _$jscoverage = top._$jscoverage;\n"); |
Stream_write_string(output, "var _$jscoverage = top._$jscoverage;\n"); |
1409 |
|
break; |
1410 |
|
case JSCOVERAGE_NO_BROWSER: |
1411 |
|
Stream_write_string(output, "if (typeof _$jscoverage === 'undefined') {\n var _$jscoverage = {};\n}\n"); |
1412 |
|
break; |
1413 |
} |
} |
1414 |
Stream_printf(output, "if (! _$jscoverage['%s']) {\n", file_id); |
Stream_printf(output, "if (! _$jscoverage['%s']) {\n", file_id); |
1415 |
Stream_printf(output, " _$jscoverage['%s'] = [];\n", file_id); |
Stream_printf(output, " _$jscoverage['%s'] = [];\n", file_id); |