#534: M1499861 M1500759 M1500310 M1507907
This commit is contained in:
parent
5fc65abade
commit
6db6f6ac23
|
@ -487,7 +487,7 @@ public:
|
||||||
|
|
||||||
mMechanism = CKM_AES_CBC_PAD;
|
mMechanism = CKM_AES_CBC_PAD;
|
||||||
telemetryAlg = TA_AES_CBC;
|
telemetryAlg = TA_AES_CBC;
|
||||||
AesCbcParams params;
|
RootedDictionary<AesCbcParams> params(aCx);
|
||||||
nsresult rv = Coerce(aCx, params, aAlgorithm);
|
nsresult rv = Coerce(aCx, params, aAlgorithm);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
mEarlyRv = NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
mEarlyRv = NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||||
|
@ -504,7 +504,7 @@ public:
|
||||||
|
|
||||||
mMechanism = CKM_AES_CTR;
|
mMechanism = CKM_AES_CTR;
|
||||||
telemetryAlg = TA_AES_CTR;
|
telemetryAlg = TA_AES_CTR;
|
||||||
AesCtrParams params;
|
RootedDictionary<AesCtrParams> params(aCx);
|
||||||
nsresult rv = Coerce(aCx, params, aAlgorithm);
|
nsresult rv = Coerce(aCx, params, aAlgorithm);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
mEarlyRv = NS_ERROR_DOM_SYNTAX_ERR;
|
mEarlyRv = NS_ERROR_DOM_SYNTAX_ERR;
|
||||||
|
@ -523,7 +523,7 @@ public:
|
||||||
|
|
||||||
mMechanism = CKM_AES_GCM;
|
mMechanism = CKM_AES_GCM;
|
||||||
telemetryAlg = TA_AES_GCM;
|
telemetryAlg = TA_AES_GCM;
|
||||||
AesGcmParams params;
|
RootedDictionary<AesGcmParams> params(aCx);
|
||||||
nsresult rv = Coerce(aCx, params, aAlgorithm);
|
nsresult rv = Coerce(aCx, params, aAlgorithm);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
mEarlyRv = NS_ERROR_DOM_SYNTAX_ERR;
|
mEarlyRv = NS_ERROR_DOM_SYNTAX_ERR;
|
||||||
|
|
|
@ -35,23 +35,8 @@ namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
HTMLOptionsCollection::HTMLOptionsCollection(HTMLSelectElement* aSelect)
|
HTMLOptionsCollection::HTMLOptionsCollection(HTMLSelectElement* aSelect)
|
||||||
{
|
: mSelect(aSelect)
|
||||||
// Do not maintain a reference counted reference. When
|
{}
|
||||||
// the select goes away, it will let us know.
|
|
||||||
mSelect = aSelect;
|
|
||||||
}
|
|
||||||
|
|
||||||
HTMLOptionsCollection::~HTMLOptionsCollection()
|
|
||||||
{
|
|
||||||
DropReference();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
HTMLOptionsCollection::DropReference()
|
|
||||||
{
|
|
||||||
// Drop our (non ref-counted) reference
|
|
||||||
mSelect = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
HTMLOptionsCollection::GetOptionIndex(Element* aOption,
|
HTMLOptionsCollection::GetOptionIndex(Element* aOption,
|
||||||
|
@ -88,7 +73,9 @@ HTMLOptionsCollection::GetOptionIndex(Element* aOption,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(HTMLOptionsCollection, mElements)
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(HTMLOptionsCollection,
|
||||||
|
mElements,
|
||||||
|
mSelect)
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
|
|
||||||
|
@ -124,10 +111,6 @@ HTMLOptionsCollection::GetLength(uint32_t* aLength)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
HTMLOptionsCollection::SetLength(uint32_t aLength)
|
HTMLOptionsCollection::SetLength(uint32_t aLength)
|
||||||
{
|
{
|
||||||
if (!mSelect) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mSelect->SetLength(aLength);
|
return mSelect->SetLength(aLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,10 +118,6 @@ NS_IMETHODIMP
|
||||||
HTMLOptionsCollection::SetOption(uint32_t aIndex,
|
HTMLOptionsCollection::SetOption(uint32_t aIndex,
|
||||||
nsIDOMHTMLOptionElement* aOption)
|
nsIDOMHTMLOptionElement* aOption)
|
||||||
{
|
{
|
||||||
if (!mSelect) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the new option is null, just remove this option. Note that it's safe
|
// if the new option is null, just remove this option. Note that it's safe
|
||||||
// to pass a too-large aIndex in here.
|
// to pass a too-large aIndex in here.
|
||||||
if (!aOption) {
|
if (!aOption) {
|
||||||
|
@ -187,11 +166,6 @@ HTMLOptionsCollection::SetOption(uint32_t aIndex,
|
||||||
int32_t
|
int32_t
|
||||||
HTMLOptionsCollection::GetSelectedIndex(ErrorResult& aError)
|
HTMLOptionsCollection::GetSelectedIndex(ErrorResult& aError)
|
||||||
{
|
{
|
||||||
if (!mSelect) {
|
|
||||||
aError.Throw(NS_ERROR_UNEXPECTED);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t selectedIndex;
|
int32_t selectedIndex;
|
||||||
aError = mSelect->GetSelectedIndex(&selectedIndex);
|
aError = mSelect->GetSelectedIndex(&selectedIndex);
|
||||||
return selectedIndex;
|
return selectedIndex;
|
||||||
|
@ -209,11 +183,6 @@ void
|
||||||
HTMLOptionsCollection::SetSelectedIndex(int32_t aSelectedIndex,
|
HTMLOptionsCollection::SetSelectedIndex(int32_t aSelectedIndex,
|
||||||
ErrorResult& aError)
|
ErrorResult& aError)
|
||||||
{
|
{
|
||||||
if (!mSelect) {
|
|
||||||
aError.Throw(NS_ERROR_UNEXPECTED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aError = mSelect->SetSelectedIndex(aSelectedIndex);
|
aError = mSelect->SetSelectedIndex(aSelectedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,10 +300,6 @@ HTMLOptionsCollection::Add(nsIDOMHTMLOptionElement* aOption,
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mSelect) {
|
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMHTMLElement> elem = do_QueryInterface(aOption);
|
nsCOMPtr<nsIDOMHTMLElement> elem = do_QueryInterface(aOption);
|
||||||
return mSelect->Add(elem, aBefore);
|
return mSelect->Add(elem, aBefore);
|
||||||
}
|
}
|
||||||
|
@ -344,22 +309,12 @@ HTMLOptionsCollection::Add(const HTMLOptionOrOptGroupElement& aElement,
|
||||||
const Nullable<HTMLElementOrLong>& aBefore,
|
const Nullable<HTMLElementOrLong>& aBefore,
|
||||||
ErrorResult& aError)
|
ErrorResult& aError)
|
||||||
{
|
{
|
||||||
if (!mSelect) {
|
|
||||||
aError.Throw(NS_ERROR_NOT_INITIALIZED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSelect->Add(aElement, aBefore, aError);
|
mSelect->Add(aElement, aBefore, aError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HTMLOptionsCollection::Remove(int32_t aIndex, ErrorResult& aError)
|
HTMLOptionsCollection::Remove(int32_t aIndex, ErrorResult& aError)
|
||||||
{
|
{
|
||||||
if (!mSelect) {
|
|
||||||
aError.Throw(NS_ERROR_UNEXPECTED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
mSelect->GetLength(&len);
|
mSelect->GetLength(&len);
|
||||||
if (aIndex < 0 || (uint32_t)aIndex >= len)
|
if (aIndex < 0 || (uint32_t)aIndex >= len)
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
using nsWrapperCache::GetWrapper;
|
using nsWrapperCache::GetWrapper;
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
protected:
|
protected:
|
||||||
virtual ~HTMLOptionsCollection();
|
virtual ~HTMLOptionsCollection() = default;
|
||||||
|
|
||||||
virtual JSObject* GetWrapperPreserveColorInternal() override
|
virtual JSObject* GetWrapperPreserveColorInternal() override
|
||||||
{
|
{
|
||||||
|
@ -112,11 +112,6 @@ public:
|
||||||
mElements.AppendElement(aOption);
|
mElements.AppendElement(aOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Drop the reference to the select. Called during select destruction.
|
|
||||||
*/
|
|
||||||
void DropReference();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the index of a given option element.
|
* Finds the index of a given option element.
|
||||||
* If the option isn't part of the collection, return NS_ERROR_FAILURE
|
* If the option isn't part of the collection, return NS_ERROR_FAILURE
|
||||||
|
@ -162,7 +157,7 @@ private:
|
||||||
* various members such as InsertOptionAt are also infallible. */
|
* various members such as InsertOptionAt are also infallible. */
|
||||||
nsTArray<RefPtr<mozilla::dom::HTMLOptionElement> > mElements;
|
nsTArray<RefPtr<mozilla::dom::HTMLOptionElement> > mElements;
|
||||||
/** The select element that contains this array */
|
/** The select element that contains this array */
|
||||||
HTMLSelectElement* mSelect;
|
RefPtr<HTMLSelectElement> mSelect;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
|
@ -130,11 +130,6 @@ HTMLSelectElement::HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>& a
|
||||||
NS_EVENT_STATE_VALID);
|
NS_EVENT_STATE_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLSelectElement::~HTMLSelectElement()
|
|
||||||
{
|
|
||||||
mOptions->DropReference();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISupports
|
// ISupports
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLSelectElement)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLSelectElement)
|
||||||
|
|
|
@ -431,7 +431,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~HTMLSelectElement();
|
virtual ~HTMLSelectElement() = default;
|
||||||
|
|
||||||
friend class SafeOptionListMutation;
|
friend class SafeOptionListMutation;
|
||||||
|
|
||||||
|
|
|
@ -1251,20 +1251,22 @@ IDBObjectStore::GetAddInfo(JSContext* aCx,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out indexes and the index values to update here.
|
// Figure out indexes and the index values to update here.
|
||||||
const nsTArray<IndexMetadata>& indexes = mSpec->indexes();
|
{
|
||||||
|
const nsTArray<IndexMetadata>& indexes = mSpec->indexes();
|
||||||
|
uint32_t idxCount = indexes.Length();
|
||||||
|
|
||||||
const uint32_t idxCount = indexes.Length();
|
aUpdateInfoArray.SetCapacity(idxCount); // Pretty good estimate
|
||||||
aUpdateInfoArray.SetCapacity(idxCount); // Pretty good estimate
|
|
||||||
|
|
||||||
for (uint32_t idxIndex = 0; idxIndex < idxCount; idxIndex++) {
|
for (uint32_t idxIndex = 0; idxIndex < idxCount; idxIndex++) {
|
||||||
const IndexMetadata& metadata = indexes[idxIndex];
|
const IndexMetadata& metadata = indexes[idxIndex];
|
||||||
|
|
||||||
rv = AppendIndexUpdateInfo(metadata.id(), metadata.keyPath(),
|
rv = AppendIndexUpdateInfo(metadata.id(), metadata.keyPath(),
|
||||||
metadata.unique(), metadata.multiEntry(),
|
metadata.unique(), metadata.multiEntry(),
|
||||||
metadata.locale(), aCx, aValue,
|
metadata.locale(), aCx, aValue,
|
||||||
aUpdateInfoArray);
|
aUpdateInfoArray);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1322,6 +1324,11 @@ IDBObjectStore::AddOrPut(JSContext* aCx,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mTransaction->IsOpen()) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
FallibleTArray<uint8_t> cloneData;
|
FallibleTArray<uint8_t> cloneData;
|
||||||
if (NS_WARN_IF(!cloneData.SetLength(cloneWriteInfo.mCloneBuffer.nbytes(),
|
if (NS_WARN_IF(!cloneData.SetLength(cloneWriteInfo.mCloneBuffer.nbytes(),
|
||||||
fallible))) {
|
fallible))) {
|
||||||
|
|
|
@ -164,6 +164,8 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
|
||||||
// Create the formatter and fix up its formatting as necessary:
|
// Create the formatter and fix up its formatting as necessary:
|
||||||
CFDateFormatterRef formatter =
|
CFDateFormatterRef formatter =
|
||||||
CFDateFormatterCreate(nullptr, formatterLocale, dateStyle, timeStyle);
|
CFDateFormatterCreate(nullptr, formatterLocale, dateStyle, timeStyle);
|
||||||
|
if (MOZ_UNLIKELY(!formatter))
|
||||||
|
return NS_ERROR_FAILURE; // don't continue
|
||||||
|
|
||||||
CFRelease(formatterLocale);
|
CFRelease(formatterLocale);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue