Bug #12 - jscoverage does not handle popups - can easily be fixed - solution attached
Submitted by: Duncan Loveday
Date submitted: 2009-06-11 17:06:03 UTC
Status: Closed
Hi,
I'm terribly impressed with jscoverage, however I have a suggestion to make.
My app launches popups a lot and I wanted cumulative coverage for the code
running in all the popups. As it stands, coverage figures for each popup are
separate. If popups are opened and closed then the figures cannot be combined.
I fixed this easily by editting the first few lines of boilerplate code in each
.js to replace "top" by the expression "(top.opener==null ? top : top.opener)" -
see below. It seems to work nicely - means all the coverage numbers are
accumulated in the top level window.
Duncan.
/* automatically generated by JSCoverage - do not edit */
if (! (top.opener==null ? top : top.opener)._$jscoverage) {
(top.opener==null ? top : top.opener)._$jscoverage = {};
}
var _$jscoverage = (top.opener==null ? top : top.opener)._$jscoverage;
if (! _$jscoverage['slider/js/range.js']) {
_$jscoverage['slider/js/range.js'] = [];
_$jscoverage['slider/js/range.js'][33] = 0;
_$jscoverage['slider/js/range.js'][34] = 0;
_$jscoverage['slider/js/range.js'][35] = 0;
Add a comment
Date submitted: 2009-06-11 23:33:06 UTC