mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 01:57:30 +09:00
ported changes from mozilla upstream:
bug1351303, bug1352235, bug1371508, bug1430268, bug1352734
This commit is contained in:
parent
ec217d91d9
commit
11ce2e06e8
11 changed files with 123 additions and 31 deletions
|
|
@ -1316,7 +1316,7 @@ Element::SetAttribute(const nsAString& aName,
|
||||||
nsAutoString nameToUse;
|
nsAutoString nameToUse;
|
||||||
const nsAttrName* name = InternalGetAttrNameFromQName(aName, &nameToUse);
|
const nsAttrName* name = InternalGetAttrNameFromQName(aName, &nameToUse);
|
||||||
if (!name) {
|
if (!name) {
|
||||||
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(nameToUse);
|
nsCOMPtr<nsIAtom> nameAtom = NS_AtomizeMainThread(nameToUse);
|
||||||
if (!nameAtom) {
|
if (!nameAtom) {
|
||||||
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
|
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1398,7 +1398,7 @@ Element::GetAttributeNS(const nsAString& aNamespaceURI,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> name = NS_Atomize(aLocalName);
|
nsCOMPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
|
||||||
bool hasAttr = GetAttr(nsid, name, aReturn);
|
bool hasAttr = GetAttr(nsid, name, aReturn);
|
||||||
if (!hasAttr) {
|
if (!hasAttr) {
|
||||||
SetDOMStringToNull(aReturn);
|
SetDOMStringToNull(aReturn);
|
||||||
|
|
@ -1430,7 +1430,7 @@ Element::RemoveAttributeNS(const nsAString& aNamespaceURI,
|
||||||
const nsAString& aLocalName,
|
const nsAString& aLocalName,
|
||||||
ErrorResult& aError)
|
ErrorResult& aError)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> name = NS_Atomize(aLocalName);
|
nsCOMPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
|
||||||
int32_t nsid =
|
int32_t nsid =
|
||||||
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI,
|
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI,
|
||||||
nsContentUtils::IsChromeDoc(OwnerDoc()));
|
nsContentUtils::IsChromeDoc(OwnerDoc()));
|
||||||
|
|
@ -1518,7 +1518,7 @@ Element::HasAttributeNS(const nsAString& aNamespaceURI,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> name = NS_Atomize(aLocalName);
|
nsCOMPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
|
||||||
return HasAttr(nsid, name);
|
return HasAttr(nsid, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -742,7 +742,7 @@ nsAttrValue::GetAsAtom() const
|
||||||
{
|
{
|
||||||
switch (Type()) {
|
switch (Type()) {
|
||||||
case eString:
|
case eString:
|
||||||
return NS_Atomize(GetStringValue());
|
return NS_AtomizeMainThread(GetStringValue());
|
||||||
|
|
||||||
case eAtom:
|
case eAtom:
|
||||||
{
|
{
|
||||||
|
|
@ -754,7 +754,7 @@ nsAttrValue::GetAsAtom() const
|
||||||
{
|
{
|
||||||
nsAutoString val;
|
nsAutoString val;
|
||||||
ToString(val);
|
ToString(val);
|
||||||
return NS_Atomize(val);
|
return NS_AtomizeMainThread(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1267,7 +1267,7 @@ nsAttrValue::ParseAtomArray(const nsAString& aValue)
|
||||||
++iter;
|
++iter;
|
||||||
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
|
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> classAtom = NS_Atomize(Substring(start, iter));
|
nsCOMPtr<nsIAtom> classAtom = NS_AtomizeMainThread(Substring(start, iter));
|
||||||
if (!classAtom) {
|
if (!classAtom) {
|
||||||
Reset();
|
Reset();
|
||||||
return;
|
return;
|
||||||
|
|
@ -1308,7 +1308,7 @@ nsAttrValue::ParseAtomArray(const nsAString& aValue)
|
||||||
++iter;
|
++iter;
|
||||||
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
|
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
|
||||||
|
|
||||||
classAtom = NS_Atomize(Substring(start, iter));
|
classAtom = NS_AtomizeMainThread(Substring(start, iter));
|
||||||
|
|
||||||
if (!array->AppendElement(classAtom)) {
|
if (!array->AppendElement(classAtom)) {
|
||||||
Reset();
|
Reset();
|
||||||
|
|
@ -1757,7 +1757,7 @@ nsAttrValue::SetMiscAtomOrString(const nsAString* aValue)
|
||||||
"Empty string?");
|
"Empty string?");
|
||||||
MiscContainer* cont = GetMiscContainer();
|
MiscContainer* cont = GetMiscContainer();
|
||||||
if (len <= NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM) {
|
if (len <= NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM) {
|
||||||
nsCOMPtr<nsIAtom> atom = NS_Atomize(*aValue);
|
nsCOMPtr<nsIAtom> atom = NS_AtomizeMainThread(*aValue);
|
||||||
if (atom) {
|
if (atom) {
|
||||||
cont->mStringBits =
|
cont->mStringBits =
|
||||||
reinterpret_cast<uintptr_t>(atom.forget().take()) | eAtomBase;
|
reinterpret_cast<uintptr_t>(atom.forget().take()) | eAtomBase;
|
||||||
|
|
|
||||||
|
|
@ -2947,11 +2947,11 @@ nsContentUtils::SplitQName(const nsIContent* aNamespaceResolver,
|
||||||
if (*aNamespace == kNameSpaceID_Unknown)
|
if (*aNamespace == kNameSpaceID_Unknown)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
*aLocalName = NS_Atomize(Substring(colon + 1, end)).take();
|
*aLocalName = NS_AtomizeMainThread(Substring(colon + 1, end)).take();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*aNamespace = kNameSpaceID_None;
|
*aNamespace = kNameSpaceID_None;
|
||||||
*aLocalName = NS_Atomize(aQName).take();
|
*aLocalName = NS_AtomizeMainThread(aQName).take();
|
||||||
}
|
}
|
||||||
NS_ENSURE_TRUE(aLocalName, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(aLocalName, NS_ERROR_OUT_OF_MEMORY);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -2976,7 +2976,8 @@ nsContentUtils::GetNodeInfoFromQName(const nsAString& aNamespaceURI,
|
||||||
const char16_t* end;
|
const char16_t* end;
|
||||||
qName.EndReading(end);
|
qName.EndReading(end);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> prefix = NS_Atomize(Substring(qName.get(), colon));
|
nsCOMPtr<nsIAtom> prefix =
|
||||||
|
NS_AtomizeMainThread(Substring(qName.get(), colon));
|
||||||
|
|
||||||
rv = aNodeInfoManager->GetNodeInfo(Substring(colon + 1, end), prefix,
|
rv = aNodeInfoManager->GetNodeInfo(Substring(colon + 1, end), prefix,
|
||||||
nsID, aNodeType, aNodeInfo);
|
nsID, aNodeType, aNodeInfo);
|
||||||
|
|
@ -3036,7 +3037,7 @@ nsContentUtils::SplitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix,
|
||||||
nameStart = (uriEnd + 1);
|
nameStart = (uriEnd + 1);
|
||||||
if (nameEnd) {
|
if (nameEnd) {
|
||||||
const char16_t *prefixStart = nameEnd + 1;
|
const char16_t *prefixStart = nameEnd + 1;
|
||||||
*aPrefix = NS_Atomize(Substring(prefixStart, pos)).take();
|
*aPrefix = NS_AtomizeMainThread(Substring(prefixStart, pos)).take();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nameEnd = pos;
|
nameEnd = pos;
|
||||||
|
|
@ -3049,7 +3050,7 @@ nsContentUtils::SplitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix,
|
||||||
nameEnd = pos;
|
nameEnd = pos;
|
||||||
*aPrefix = nullptr;
|
*aPrefix = nullptr;
|
||||||
}
|
}
|
||||||
*aLocalName = NS_Atomize(Substring(nameStart, nameEnd)).take();
|
*aLocalName = NS_AtomizeMainThread(Substring(nameStart, nameEnd)).take();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
@ -3887,7 +3888,8 @@ nsContentUtils::GetEventMessageAndAtom(const nsAString& aName,
|
||||||
}
|
}
|
||||||
|
|
||||||
*aEventMessage = eUnidentifiedEvent;
|
*aEventMessage = eUnidentifiedEvent;
|
||||||
nsCOMPtr<nsIAtom> atom = NS_Atomize(NS_LITERAL_STRING("on") + aName);
|
nsCOMPtr<nsIAtom> atom =
|
||||||
|
NS_AtomizeMainThread(NS_LITERAL_STRING("on") + aName);
|
||||||
sUserDefinedEvents->AppendObject(atom);
|
sUserDefinedEvents->AppendObject(atom);
|
||||||
mapping.mAtom = atom;
|
mapping.mAtom = atom;
|
||||||
mapping.mMessage = eUnidentifiedEvent;
|
mapping.mMessage = eUnidentifiedEvent;
|
||||||
|
|
@ -3920,7 +3922,7 @@ nsContentUtils::GetEventMessageAndAtomForListener(const nsAString& aName,
|
||||||
if (mapping.mMaybeSpecialSVGorSMILEvent) {
|
if (mapping.mMaybeSpecialSVGorSMILEvent) {
|
||||||
// Try the atom version so that we should get the right message for
|
// Try the atom version so that we should get the right message for
|
||||||
// SVG/SMIL.
|
// SVG/SMIL.
|
||||||
atom = NS_Atomize(NS_LITERAL_STRING("on") + aName);
|
atom = NS_AtomizeMainThread(NS_LITERAL_STRING("on") + aName);
|
||||||
msg = GetEventMessage(atom);
|
msg = GetEventMessage(atom);
|
||||||
} else {
|
} else {
|
||||||
atom = mapping.mAtom;
|
atom = mapping.mAtom;
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,8 @@ nsNodeInfoManager::nsNodeInfoManager()
|
||||||
mNonDocumentNodeInfos(0),
|
mNonDocumentNodeInfos(0),
|
||||||
mTextNodeInfo(nullptr),
|
mTextNodeInfo(nullptr),
|
||||||
mCommentNodeInfo(nullptr),
|
mCommentNodeInfo(nullptr),
|
||||||
mDocumentNodeInfo(nullptr)
|
mDocumentNodeInfo(nullptr),
|
||||||
|
mRecentlyUsedNodeInfos{}
|
||||||
{
|
{
|
||||||
nsLayoutStatics::AddRef();
|
nsLayoutStatics::AddRef();
|
||||||
|
|
||||||
|
|
@ -232,11 +233,19 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||||
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType,
|
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType,
|
||||||
aExtraName);
|
aExtraName);
|
||||||
|
|
||||||
|
uint32_t index =
|
||||||
|
GetNodeInfoInnerHashValue(&tmpKey) % RECENTLY_USED_NODEINFOS_SIZE;
|
||||||
|
NodeInfo* ni = mRecentlyUsedNodeInfos[index];
|
||||||
|
if (ni && NodeInfoInnerKeyCompare(&(ni->mInner), &tmpKey)) {
|
||||||
|
RefPtr<NodeInfo> nodeInfo = ni;
|
||||||
|
return nodeInfo.forget();
|
||||||
|
}
|
||||||
|
|
||||||
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
RefPtr<NodeInfo> nodeInfo = static_cast<NodeInfo*>(node);
|
RefPtr<NodeInfo> nodeInfo = static_cast<NodeInfo*>(node);
|
||||||
|
mRecentlyUsedNodeInfos[index] = nodeInfo;
|
||||||
return nodeInfo.forget();
|
return nodeInfo.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,6 +263,7 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||||
NS_IF_ADDREF(mDocument);
|
NS_IF_ADDREF(mDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mRecentlyUsedNodeInfos[index] = newNodeInfo;
|
||||||
return newNodeInfo.forget();
|
return newNodeInfo.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -272,10 +282,20 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
|
||||||
|
|
||||||
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType);
|
NodeInfo::NodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType);
|
||||||
|
|
||||||
|
uint32_t index =
|
||||||
|
GetNodeInfoInnerHashValue(&tmpKey) % RECENTLY_USED_NODEINFOS_SIZE;
|
||||||
|
NodeInfo* ni = mRecentlyUsedNodeInfos[index];
|
||||||
|
if (ni && NodeInfoInnerKeyCompare(&(ni->mInner), &tmpKey)) {
|
||||||
|
RefPtr<NodeInfo> nodeInfo = ni;
|
||||||
|
nodeInfo.forget(aNodeInfo);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
RefPtr<NodeInfo> nodeInfo = static_cast<NodeInfo*>(node);
|
RefPtr<NodeInfo> nodeInfo = static_cast<NodeInfo*>(node);
|
||||||
|
mRecentlyUsedNodeInfos[index] = nodeInfo;
|
||||||
nodeInfo.forget(aNodeInfo);
|
nodeInfo.forget(aNodeInfo);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -297,6 +317,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
|
||||||
NS_IF_ADDREF(mDocument);
|
NS_IF_ADDREF(mDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mRecentlyUsedNodeInfos[index] = newNodeInfo;
|
||||||
newNodeInfo.forget(aNodeInfo);
|
newNodeInfo.forget(aNodeInfo);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -421,6 +442,12 @@ nsNodeInfoManager::RemoveNodeInfo(NodeInfo *aNodeInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t index =
|
||||||
|
GetNodeInfoInnerHashValue(&aNodeInfo->mInner) % RECENTLY_USED_NODEINFOS_SIZE;
|
||||||
|
if (mRecentlyUsedNodeInfos[index] == aNodeInfo) {
|
||||||
|
mRecentlyUsedNodeInfos[index] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool ret =
|
bool ret =
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ class NodeInfo;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#define RECENTLY_USED_NODEINFOS_SIZE 31
|
||||||
|
|
||||||
class nsNodeInfoManager final
|
class nsNodeInfoManager final
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
@ -137,6 +139,7 @@ private:
|
||||||
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mCommentNodeInfo; // WEAK to avoid circular ownership
|
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mCommentNodeInfo; // WEAK to avoid circular ownership
|
||||||
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mDocumentNodeInfo; // WEAK to avoid circular ownership
|
mozilla::dom::NodeInfo * MOZ_NON_OWNING_REF mDocumentNodeInfo; // WEAK to avoid circular ownership
|
||||||
RefPtr<nsBindingManager> mBindingManager;
|
RefPtr<nsBindingManager> mBindingManager;
|
||||||
|
mozilla::dom::NodeInfo* mRecentlyUsedNodeInfos[RECENTLY_USED_NODEINFOS_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsNodeInfoManager_h___ */
|
#endif /* nsNodeInfoManager_h___ */
|
||||||
|
|
|
||||||
|
|
@ -3808,12 +3808,14 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
|
||||||
// region on scrollbar frames that won't be placed in their own layer. See
|
// region on scrollbar frames that won't be placed in their own layer. See
|
||||||
// bug 1213324 for details.
|
// bug 1213324 for details.
|
||||||
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
|
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
|
||||||
|
mDispatchToContentHitRegion.SimplifyOutward(8);
|
||||||
} else if (aFrame->GetType() == nsGkAtoms::objectFrame) {
|
} else if (aFrame->GetType() == nsGkAtoms::objectFrame) {
|
||||||
// If the frame is a plugin frame and wants to handle wheel events as
|
// If the frame is a plugin frame and wants to handle wheel events as
|
||||||
// default action, we should add the frame to dispatch-to-content region.
|
// default action, we should add the frame to dispatch-to-content region.
|
||||||
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
|
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
|
||||||
if (pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
|
if (pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
|
||||||
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
|
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
|
||||||
|
mDispatchToContentHitRegion.SimplifyOutward(8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3850,6 +3852,7 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
|
||||||
}
|
}
|
||||||
if (alreadyHadRegions) {
|
if (alreadyHadRegions) {
|
||||||
mDispatchToContentHitRegion.OrWith(CombinedTouchActionRegion());
|
mDispatchToContentHitRegion.OrWith(CombinedTouchActionRegion());
|
||||||
|
mDispatchToContentHitRegion.SimplifyOutward(8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3859,6 +3862,7 @@ nsDisplayLayerEventRegions::AddInactiveScrollPort(const nsRect& aRect)
|
||||||
{
|
{
|
||||||
mHitRegion.Or(mHitRegion, aRect);
|
mHitRegion.Or(mHitRegion, aRect);
|
||||||
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aRect);
|
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aRect);
|
||||||
|
mDispatchToContentHitRegion.SimplifyOutward(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ nsHtml5Portability::releaseString(nsString* str)
|
||||||
bool
|
bool
|
||||||
nsHtml5Portability::localEqualsBuffer(nsIAtom* local, char16_t* buf, int32_t offset, int32_t length)
|
nsHtml5Portability::localEqualsBuffer(nsIAtom* local, char16_t* buf, int32_t offset, int32_t length)
|
||||||
{
|
{
|
||||||
return local->Equals(nsDependentSubstring(buf + offset, buf + offset + length));
|
return local->Equals(buf + offset, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ class nsHtml5TreeOperation {
|
||||||
}
|
}
|
||||||
nsAutoString str;
|
nsAutoString str;
|
||||||
aAtom->ToString(str);
|
aAtom->ToString(str);
|
||||||
return NS_Atomize(str);
|
return NS_AtomizeMainThread(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult AppendTextToTextNode(const char16_t* aBuffer,
|
static nsresult AppendTextToTextNode(const char16_t* aBuffer,
|
||||||
|
|
|
||||||
|
|
@ -2331,6 +2331,12 @@ nsSSLIOLayerSetOptions(PRFileDesc* fd, bool forSTARTTLS,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set TLS 1.3 compat mode.
|
||||||
|
if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_TLS13_COMPAT_MODE, PR_TRUE)) {
|
||||||
|
MOZ_LOG(gPIPNSSLog, LogLevel::Error,
|
||||||
|
("[%p] nsSSLIOLayerSetOptions: Setting compat mode failed\n", fd));
|
||||||
|
}
|
||||||
|
|
||||||
if ((infoObject->GetProviderFlags() & nsISocketProvider::BE_CONSERVATIVE) &&
|
if ((infoObject->GetProviderFlags() & nsISocketProvider::BE_CONSERVATIVE) &&
|
||||||
(range.max > SSL_LIBRARY_VERSION_TLS_1_2)) {
|
(range.max > SSL_LIBRARY_VERSION_TLS_1_2)) {
|
||||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
|
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
|
||||||
|
|
|
||||||
|
|
@ -325,13 +325,7 @@ AtomTableMatchKey(const PLDHashEntryHdr* aEntry, const void* aKey)
|
||||||
nsDependentAtomString(he->mAtom)) == 0;
|
nsDependentAtomString(he->mAtom)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t length = he->mAtom->GetLength();
|
return he->mAtom->Equals(k->mUTF16String, k->mLength);
|
||||||
if (length != k->mLength) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return memcmp(he->mAtom->GetUTF16String(),
|
|
||||||
k->mUTF16String, length * sizeof(char16_t)) == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -364,17 +358,28 @@ static const PLDHashTableOps AtomTableOps = {
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE 31
|
||||||
|
static nsIAtom*
|
||||||
|
sRecentlyUsedMainThreadAtoms[RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE] = {};
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicAtom::GCAtomTable()
|
DynamicAtom::GCAtomTable()
|
||||||
{
|
{
|
||||||
|
if (NS_IsMainThread()) {
|
||||||
MutexAutoLock lock(*gAtomTableLock);
|
MutexAutoLock lock(*gAtomTableLock);
|
||||||
GCAtomTableLocked(lock, GCKind::RegularOperation);
|
GCAtomTableLocked(lock, GCKind::RegularOperation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
|
DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
|
||||||
GCKind aKind)
|
GCKind aKind)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
for (uint32_t i = 0; i < RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE; ++i) {
|
||||||
|
sRecentlyUsedMainThreadAtoms[i] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t removedCount = 0; // Use a non-atomic temporary for cheaper increments.
|
uint32_t removedCount = 0; // Use a non-atomic temporary for cheaper increments.
|
||||||
nsAutoCString nonZeroRefcountAtoms;
|
nsAutoCString nonZeroRefcountAtoms;
|
||||||
uint32_t nonZeroRefcountAtomsCount = 0;
|
uint32_t nonZeroRefcountAtomsCount = 0;
|
||||||
|
|
@ -712,6 +717,40 @@ NS_Atomize(const nsAString& aUTF16String)
|
||||||
return atom.forget();
|
return atom.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<nsIAtom>
|
||||||
|
NS_AtomizeMainThread(const nsAString& aUTF16String)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
nsCOMPtr<nsIAtom> retVal;
|
||||||
|
uint32_t hash;
|
||||||
|
AtomTableKey key(aUTF16String.Data(), aUTF16String.Length(), &hash);
|
||||||
|
uint32_t index = hash % RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE;
|
||||||
|
nsIAtom* atom =
|
||||||
|
sRecentlyUsedMainThreadAtoms[index];
|
||||||
|
if (atom) {
|
||||||
|
uint32_t length = atom->GetLength();
|
||||||
|
if (length == key.mLength &&
|
||||||
|
(memcmp(atom->GetUTF16String(),
|
||||||
|
key.mUTF16String, length * sizeof(char16_t)) == 0)) {
|
||||||
|
retVal = atom;
|
||||||
|
return retVal.forget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MutexAutoLock lock(*gAtomTableLock);
|
||||||
|
AtomTableEntry* he = static_cast<AtomTableEntry*>(gAtomTable->Add(&key));
|
||||||
|
|
||||||
|
if (he->mAtom) {
|
||||||
|
retVal = he->mAtom;
|
||||||
|
} else {
|
||||||
|
retVal = DynamicAtom::Create(aUTF16String, hash);
|
||||||
|
he->mAtom = retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
sRecentlyUsedMainThreadAtoms[index] = retVal;
|
||||||
|
return retVal.forget();
|
||||||
|
}
|
||||||
|
|
||||||
nsrefcnt
|
nsrefcnt
|
||||||
NS_GetNumberOfAtoms(void)
|
NS_GetNumberOfAtoms(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,15 @@ interface nsIAtom : nsISupports
|
||||||
size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
// note this is NOT virtual so this won't muck with the vtable!
|
// note these are NOT virtual so they won't muck with the vtable!
|
||||||
|
inline bool Equals(char16ptr_t aString, uint32_t aLength) const
|
||||||
|
{
|
||||||
|
return mLength == aLength &&
|
||||||
|
memcmp(mString, aString, mLength * sizeof(char16_t)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool Equals(const nsAString& aString) const {
|
inline bool Equals(const nsAString& aString) const {
|
||||||
return aString.Equals(nsDependentString(mString, mLength));
|
return Equals(aString.BeginReading(), aString.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsStaticAtom() const {
|
inline bool IsStaticAtom() const {
|
||||||
|
|
@ -119,6 +125,11 @@ extern already_AddRefed<nsIAtom> NS_Atomize(const char16_t* aUTF16String);
|
||||||
*/
|
*/
|
||||||
extern already_AddRefed<nsIAtom> NS_Atomize(const nsAString& aUTF16String);
|
extern already_AddRefed<nsIAtom> NS_Atomize(const nsAString& aUTF16String);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An optimized version of the method above for the main thread.
|
||||||
|
*/
|
||||||
|
extern already_AddRefed<nsIAtom> NS_AtomizeMainThread(const nsAString& aUTF16String);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a count of the total number of atoms currently
|
* Return a count of the total number of atoms currently
|
||||||
* alive in the system.
|
* alive in the system.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue