Issue #2255 - Follow-up: Check if we actually have a non-null global object.

This should avoid the intermittent crashes that are still being reported
on this issue that end up crashing because of a proxied object that can't
be unwrapped after being passed around.
This commit is contained in:
Moonchild 2024-11-27 18:27:00 +01:00 committed by roytam1
commit 24f3a981b6

View file

@ -490,6 +490,11 @@ Performance::Measure(JSContext* aCx,
const Optional<nsAString>& aEndMark,
ErrorResult& aRv)
{
if (!GetParentObject()) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
// Don't add the entry if the buffer is full. XXX should be removed by bug
// 1159003.
if (mUserEntries.Length() >= mResourceTimingBufferSize) {