Bug 1631346 - Fix a null ptr crash in PerformanceObserver::Observe r=baku

Differential Revision: https://phabricator.services.mozilla.com/D76193
This commit is contained in:
sefeng 2020-05-28 16:01:56 +00:00
parent 7ac7aeb879
commit 4b4bf8886f

View File

@ -161,6 +161,11 @@ void PerformanceObserver::Observe(const PerformanceObserverInit& aOptions,
const Optional<nsString>& maybeType = aOptions.mType;
const Optional<bool>& maybeBuffered = aOptions.mBuffered;
if (!mPerformance) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
if (!maybeEntryTypes.WasPassed() && !maybeType.WasPassed()) {
/* Per spec (3.3.1.2), this should be a syntax error. */
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);