Bug 1604889: Don't rethrow receiveMessage exceptions as NS_ERROR_UNEXPECTED. r=mccr8

When we let the WebIDL callback wrapper report exceptions, it returns an error
result of NS_ERROR_UNEXPECTED, which winds up getting set as a promise
rejection reason or re-reported to the console. This just causes unnecessary
confusion for callers, especially since the error has no location information.

Differential Revision: https://phabricator.services.mozilla.com/D57657

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Maglione 2020-01-09 21:27:25 +00:00
Родитель 17ad11c1e1
Коммит a737bd2c6a
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -265,9 +265,7 @@ void JSWindowActor::ReceiveRawMessage(const JSWindowActorMessageMeta& aMetadata,
MOZ_ASSERT_UNREACHABLE();
}
if (NS_WARN_IF(error.Failed())) {
MOZ_ALWAYS_TRUE(error.MaybeSetPendingException(cx));
}
Unused << error.MaybeSetPendingException(cx);
}
void JSWindowActor::ReceiveMessageOrQuery(
@ -304,7 +302,8 @@ void JSWindowActor::ReceiveMessageOrQuery(
RefPtr<MessageListener> messageListener =
new MessageListener(self, global, nullptr, nullptr);
messageListener->ReceiveMessage(argument, &retval, aRv,
"JSWindowActor receive message");
"JSWindowActor receive message",
MessageListener::eRethrowExceptions);
// If we have a promise, resolve or reject it respectively.
if (promise) {