/[jscoverage]/trunk/instrument-js.cpp
ViewVC logotype

Diff of /trunk/instrument-js.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 430 by siliconforks, Wed Feb 18 16:08:33 2009 UTC revision 431 by siliconforks, Wed Feb 18 18:24:51 2009 UTC
# Line 53  Line 53 
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    
# Line 1392  Line 1392 
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);
# Line 1401  Line 1402 
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);

Legend:
Removed from v.430  
changed lines
  Added in v.431

  ViewVC Help
Powered by ViewVC 1.1.24