Bug 1167423 - patch 3 - Handle return values of FallibleTArray functions in MutationObserver, r=smaug

This commit is contained in:
Andrea Marchesini 2015-05-25 12:50:15 +01:00
parent 98514d828a
commit 4cb28b400a
3 changed files with 10 additions and 4 deletions

View File

@ -693,7 +693,9 @@ nsDOMMutationObserver::TakeRecords(
}
void
nsDOMMutationObserver::GetObservingInfo(nsTArray<Nullable<MutationObservingInfo> >& aResult)
nsDOMMutationObserver::GetObservingInfo(
nsTArray<Nullable<MutationObservingInfo>>& aResult,
mozilla::ErrorResult& aRv)
{
aResult.SetCapacity(mReceivers.Count());
for (int32_t i = 0; i < mReceivers.Count(); ++i) {
@ -712,7 +714,10 @@ nsDOMMutationObserver::GetObservingInfo(nsTArray<Nullable<MutationObservingInfo>
mozilla::dom::Sequence<nsString>& filtersAsStrings =
info.mAttributeFilter.Value();
for (int32_t j = 0; j < filters.Count(); ++j) {
filtersAsStrings.AppendElement(nsDependentAtomString(filters[j]));
if (!filtersAsStrings.AppendElement(nsDependentAtomString(filters[j]))) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
}
}
info.mObservedNode = mr->Target();

View File

@ -493,7 +493,8 @@ public:
void HandleMutation();
void GetObservingInfo(nsTArray<Nullable<MutationObservingInfo> >& aResult);
void GetObservingInfo(nsTArray<Nullable<MutationObservingInfo>>& aResult,
mozilla::ErrorResult& aRv);
mozilla::dom::MutationCallback* MutationCallback() { return mCallback; }

View File

@ -43,7 +43,7 @@ interface MutationObserver {
void disconnect();
sequence<MutationRecord> takeRecords();
[ChromeOnly]
[ChromeOnly, Throws]
sequence<MutationObservingInfo?> getObservingInfo();
[ChromeOnly]
readonly attribute MutationCallback mutationCallback;