Bug 1206247 - Do not collect coverage information if the source has no filename. r=bhackett

This commit is contained in:
Nicolas B. Pierron 2015-10-01 12:41:40 +02:00
parent 1aefe3b946
commit 3f0b55db0b
3 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,4 @@
evaluate("", {
fileName: null
});
getLcovInfo();

View File

@ -1955,8 +1955,12 @@ GenerateLcovInfo(JSContext* cx, JSCompartment* comp, GenericPrinter& out)
for (ZonesIter zone(rt, SkipAtoms); !zone.done(); zone.next()) {
for (ZoneCellIter i(zone, AllocKind::SCRIPT); !i.done(); i.next()) {
JSScript* script = i.get<JSScript>();
if (script->compartment() != comp || !script->isTopLevel())
if (script->compartment() != comp ||
!script->isTopLevel() ||
!script->filename())
{
continue;
}
if (!topScripts.append(script))
return false;

View File

@ -326,6 +326,10 @@ LCovCompartment::collectCodeCoverageInfo(JSCompartment* comp, JSObject* sso,
void
LCovCompartment::collectSourceFile(JSCompartment* comp, ScriptSourceObject* sso)
{
// Do not add sources if there is no file name associated to it.
if (!sso->source()->filename())
return;
// Skip any operation if we already some out-of memory issues.
if (outTN_.hadOutOfMemory())
return;