/[jscoverage]/trunk/jscoverage.jsm
ViewVC logotype

Diff of /trunk/jscoverage.jsm

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

revision 439 by siliconforks, Sun Jul 12 05:52:40 2009 UTC revision 441 by siliconforks, Tue Jul 14 16:14:24 2009 UTC
# Line 58  Line 58 
58      return this;      return this;
59    },    },
60    
61      getReportDirectory: function() {
62        const Cc = Components.classes;
63        const Ci = Components.interfaces;
64    
65        var directoryService = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties);
66        /*
67        CurProcD - directory in which the firefox process was started
68        CurWorkD - current working directory
69        Home - home directory
70        TmpD - temp directory
71        See xpcom/io/nsDirectoryServiceDefs.h
72        */
73        var reportDirectory = directoryService.get('CurProcD', Ci.nsILocalFile);
74        reportDirectory.appendRelativePath('jscoverage-report');
75        return reportDirectory;
76      },
77    
78    readExistingCoverage: function() {    readExistingCoverage: function() {
79      try {      try {
80        const Cc = Components.classes;        const Cc = Components.classes;
81        const Ci = Components.interfaces;        const Ci = Components.interfaces;
82    
83        var directoryService = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties);        var reportDirectory = this.getReportDirectory();
       var reportDirectory = directoryService.get('CurWorkD', Ci.nsILocalFile);  
       reportDirectory.appendRelativePath('jscoverage-report');  
84        if (! reportDirectory.exists()) {        if (! reportDirectory.exists()) {
85          return;          return;
86        }        }
# Line 111  Line 126 
126        const Cc = Components.classes;        const Cc = Components.classes;
127        const Ci = Components.interfaces;        const Ci = Components.interfaces;
128    
129        var directoryService = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties);        var reportDirectory = this.getReportDirectory();
       var reportDirectory = directoryService.get('CurWorkD', Ci.nsILocalFile);  
       reportDirectory.appendRelativePath('jscoverage-report');  
130        if (! reportDirectory.exists()) {        if (! reportDirectory.exists()) {
131          reportDirectory.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);          reportDirectory.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
132        }        }
# Line 228  Line 241 
241    const Cc = Components.classes;    const Cc = Components.classes;
242    const Ci = Components.interfaces;    const Ci = Components.interfaces;
243    const jscoverage_observerService = Cc['@mozilla.org/observer-service;1'].getService(Ci.nsIObserverService);    const jscoverage_observerService = Cc['@mozilla.org/observer-service;1'].getService(Ci.nsIObserverService);
244    jscoverage_observerService.addObserver(JSCoverageUtils, 'xpcom-shutdown', false);    jscoverage_observerService.addObserver(JSCoverageUtils, 'quit-application', false);
245    
246    dump('jscoverage.jsm: initialized\n');    dump('jscoverage.jsm: initialized\n');
247  }  }

Legend:
Removed from v.439  
changed lines
  Added in v.441

  ViewVC Help
Powered by ViewVC 1.1.24