Bug 1153963 - Add telemetry for regexp.hasOwnProperty("source") and Object.getOwnPropertyDescriptor(regexp, "source") on non-release build. r=till

This commit is contained in:
Tooru Fujisawa
2015-04-21 20:04:38 +09:00
parent fee6601bd0
commit 6d0bc6f213
3 changed files with 20 additions and 0 deletions

View File

@@ -3002,6 +3002,15 @@ js::GetOwnPropertyDescriptor(JSContext* cx, HandleObject obj, HandleId id,
return ok;
}
#ifndef RELEASE_BUILD
if (obj->is<RegExpObject>() && id == NameToId(cx->names().source)) {
if (JSScript* script = cx->currentScript()) {
const char* filename = script->filename();
cx->compartment()->addTelemetry(filename, JSCompartment::RegExpSourceProperty);
}
}
#endif
RootedShape shape(cx);
if (!NativeLookupOwnProperty<CanGC>(cx, obj.as<NativeObject>(), id, &shape))
return false;