mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-06 22:29:34 +00:00
#433: M1390980 M1376306 M1390550 M1376825 M1380824 M1385272
This commit is contained in:
parent
71b8c3d256
commit
94d5cb15d2
|
@ -1323,6 +1323,8 @@ DocAccessible::UnbindFromDocument(Accessible* aAccessible)
|
||||||
mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible)
|
mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible)
|
||||||
mNodeToAccessibleMap.Remove(aAccessible->GetNode());
|
mNodeToAccessibleMap.Remove(aAccessible->GetNode());
|
||||||
|
|
||||||
|
aAccessible->mStateFlags |= eIsNotInDocument;
|
||||||
|
|
||||||
// Update XPCOM part.
|
// Update XPCOM part.
|
||||||
xpcAccessibleDocument* xpcDoc = GetAccService()->GetCachedXPCDocument(this);
|
xpcAccessibleDocument* xpcDoc = GetAccService()->GetCachedXPCDocument(this);
|
||||||
if (xpcDoc)
|
if (xpcDoc)
|
||||||
|
|
|
@ -1087,6 +1087,14 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
|
||||||
return EncodeToStringWithMaxLength(0, aOutputString);
|
return EncodeToStringWithMaxLength(0, aOutputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ParentIsTR(nsIContent* aContent) {
|
||||||
|
mozilla::dom::Element* parent = aContent->GetParentElement();
|
||||||
|
if (!parent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return parent->IsHTMLElement(nsGkAtoms::tr);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength,
|
nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength,
|
||||||
nsAString& aOutputString)
|
nsAString& aOutputString)
|
||||||
|
@ -1153,7 +1161,7 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||||
if (content && content->IsHTMLElement(nsGkAtoms::tr)) {
|
if (content && content->IsHTMLElement(nsGkAtoms::tr) && MOZ_LIKELY(!ParentIsTR(content))) {
|
||||||
nsINode* n = content;
|
nsINode* n = content;
|
||||||
if (!prevNode) {
|
if (!prevNode) {
|
||||||
// Went from a non-<tr> to a <tr>
|
// Went from a non-<tr> to a <tr>
|
||||||
|
|
|
@ -4771,6 +4771,24 @@ nsEditor::InitializeSelection(nsIDOMEventTarget* aFocusEventTarget)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RepaintSelectionRunner final : public nsRunnable {
|
||||||
|
public:
|
||||||
|
explicit RepaintSelectionRunner(nsISelectionController* aSelectionController)
|
||||||
|
: mSelectionController(aSelectionController)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHOD Run() override
|
||||||
|
{
|
||||||
|
mSelectionController->RepaintSelection(
|
||||||
|
nsISelectionController::SELECTION_NORMAL);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsCOMPtr<nsISelectionController> mSelectionController;
|
||||||
|
};
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEditor::FinalizeSelection()
|
nsEditor::FinalizeSelection()
|
||||||
{
|
{
|
||||||
|
@ -4819,7 +4837,10 @@ nsEditor::FinalizeSelection()
|
||||||
selCon->SetDisplaySelection(nsISelectionController::SELECTION_DISABLED);
|
selCon->SetDisplaySelection(nsISelectionController::SELECTION_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
selCon->RepaintSelection(nsISelectionController::SELECTION_NORMAL);
|
// FinalizeSelection might be called from ContentRemoved even if selection
|
||||||
|
// isn't updated. So we need to call RepaintSelection after updated it.
|
||||||
|
nsContentUtils::AddScriptRunner(
|
||||||
|
new RepaintSelectionRunner(selCon));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,11 @@ if (!mIsDataUserFont || mIsLocalUserFont) {
|
||||||
// (It is not likely to encounter these on 10.4 or 10.5.)
|
// (It is not likely to encounter these on 10.4 or 10.5.)
|
||||||
if (mRequiresAAT && (FamilyName().EqualsLiteral("Songti SC") ||
|
if (mRequiresAAT && (FamilyName().EqualsLiteral("Songti SC") ||
|
||||||
FamilyName().EqualsLiteral("Songti TC") ||
|
FamilyName().EqualsLiteral("Songti TC") ||
|
||||||
FamilyName().EqualsLiteral("STSong"))) {
|
// Bug 1390980: on 10.11, the Kaiti fonts are also affected.
|
||||||
|
// Again, this is mostly here if someone copied them from a later Mac.
|
||||||
|
FamilyName().EqualsLiteral("Kaiti SC") ||
|
||||||
|
FamilyName().EqualsLiteral("Kaiti TC") ||
|
||||||
|
FamilyName().EqualsLiteral("STKaiti"))) {
|
||||||
charmap->ClearRange(0x0f8c, 0x0f8f);
|
charmap->ClearRange(0x0f8c, 0x0f8f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "nsIArray.h"
|
#include "nsIArray.h"
|
||||||
#include "nsIApplicationReputation.h"
|
#include "nsIApplicationReputation.h"
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
|
#include "nsICryptoHash.h"
|
||||||
#include "nsIHttpChannel.h"
|
#include "nsIHttpChannel.h"
|
||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
|
@ -168,8 +169,11 @@ private:
|
||||||
nsresult aResult,
|
nsresult aResult,
|
||||||
bool* aShouldBlock);
|
bool* aShouldBlock);
|
||||||
|
|
||||||
|
// Return the hex-encoded hash of the whole URI.
|
||||||
|
nsresult GetSpecHash(nsACString& aSpec, nsACString& hexEncodedHash);
|
||||||
|
|
||||||
// Strip url parameters, fragments, and user@pass fields from the URI spec
|
// Strip url parameters, fragments, and user@pass fields from the URI spec
|
||||||
// using nsIURL. If aURI is not an nsIURL, returns the original nsIURI.spec.
|
// using nsIURL. Hash data URIs and return blob URIs unfiltered.
|
||||||
nsresult GetStrippedSpec(nsIURI* aUri, nsACString& spec);
|
nsresult GetStrippedSpec(nsIURI* aUri, nsACString& spec);
|
||||||
|
|
||||||
// Escape '/' and '%' in certificate attribute values.
|
// Escape '/' and '%' in certificate attribute values.
|
||||||
|
@ -278,8 +282,11 @@ PendingDBLookup::LookupSpec(const nsACString& aSpec,
|
||||||
mAllowlistOnly = aAllowlistOnly;
|
mAllowlistOnly = aAllowlistOnly;
|
||||||
nsresult rv = LookupSpecInternal(aSpec);
|
nsresult rv = LookupSpecInternal(aSpec);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
LOG(("Error in LookupSpecInternal"));
|
// XXX: We don't have xpcom/base/ErrorNames.* yet. When we do, consider
|
||||||
return mPendingLookup->OnComplete(false, NS_OK);
|
// redoing the patch from M1376036, but make the lookup DEBUG only since
|
||||||
|
// it isn't cheap.
|
||||||
|
LOG(("Error in LookupSpecInternal()"));
|
||||||
|
return mPendingLookup->LookupNext(); // ignore this lookup and move to next
|
||||||
}
|
}
|
||||||
// LookupSpecInternal has called nsIUrlClassifierCallback.lookup, which is
|
// LookupSpecInternal has called nsIUrlClassifierCallback.lookup, which is
|
||||||
// guaranteed to call HandleEvent.
|
// guaranteed to call HandleEvent.
|
||||||
|
@ -671,17 +678,84 @@ PendingLookup::StartLookup()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
PendingLookup::GetStrippedSpec(nsIURI* aUri, nsACString& escaped)
|
PendingLookup::GetSpecHash(nsACString& aSpec, nsACString& hexEncodedHash)
|
||||||
{
|
{
|
||||||
// If aURI is not an nsIURL, we do not want to check the lists or send a
|
|
||||||
// remote query.
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aUri, &rv);
|
|
||||||
|
nsCOMPtr<nsICryptoHash> cryptoHash =
|
||||||
|
do_CreateInstance("@mozilla.org/security/hash;1", &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = cryptoHash->Init(nsICryptoHash::SHA256);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = url->GetScheme(escaped);
|
rv = cryptoHash->Update(reinterpret_cast<const uint8_t*>(aSpec.BeginReading()),
|
||||||
|
aSpec.Length());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsAutoCString binaryHash;
|
||||||
|
rv = cryptoHash->Finish(false, binaryHash);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
// This needs to match HexEncode() in Chrome's
|
||||||
|
// src/base/strings/string_number_conversions.cc
|
||||||
|
static const char* const hex = "0123456789ABCDEF";
|
||||||
|
hexEncodedHash.SetCapacity(2 * binaryHash.Length());
|
||||||
|
for (size_t i = 0; i < binaryHash.Length(); ++i) {
|
||||||
|
auto c = static_cast<const unsigned char>(binaryHash[i]);
|
||||||
|
hexEncodedHash.Append(hex[(c >> 4) & 0x0F]);
|
||||||
|
hexEncodedHash.Append(hex[c & 0x0F]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
PendingLookup::GetStrippedSpec(nsIURI* aUri, nsACString& escaped)
|
||||||
|
{
|
||||||
|
if (NS_WARN_IF(!aUri)) {
|
||||||
|
return NS_ERROR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
rv = aUri->GetScheme(escaped);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (escaped.EqualsLiteral("blob")) {
|
||||||
|
aUri->GetSpec(escaped);
|
||||||
|
LOG(("PendingLookup::GetStrippedSpec(): blob URL left unstripped as '%s' [this = %p]",
|
||||||
|
PromiseFlatCString(escaped).get(), this));
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
|
} else if (escaped.EqualsLiteral("data")) {
|
||||||
|
// Replace URI with "data:<everything before comma>,SHA256(<whole URI>)"
|
||||||
|
aUri->GetSpec(escaped);
|
||||||
|
int32_t comma = escaped.FindChar(',');
|
||||||
|
if (comma > -1 &&
|
||||||
|
static_cast<nsCString::size_type>(comma) < escaped.Length() - 1) {
|
||||||
|
MOZ_ASSERT(comma > 4, "Data URIs start with 'data:'");
|
||||||
|
nsAutoCString hexEncodedHash;
|
||||||
|
rv = GetSpecHash(escaped, hexEncodedHash);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
escaped.Truncate(comma + 1);
|
||||||
|
escaped.Append(hexEncodedHash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(("PendingLookup::GetStrippedSpec(): data URL stripped to '%s' [this = %p]",
|
||||||
|
PromiseFlatCString(escaped).get(), this));
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If aURI is not an nsIURL, we do not want to check the lists or send a
|
||||||
|
// remote query.
|
||||||
|
nsCOMPtr<nsIURL> url = do_QueryInterface(aUri, &rv);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
LOG(("PendingLookup::GetStrippedSpec(): scheme '%s' is not supported [this = %p]",
|
||||||
|
PromiseFlatCString(escaped).get(), this));
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
nsCString temp;
|
nsCString temp;
|
||||||
rv = url->GetHostPort(temp);
|
rv = url->GetHostPort(temp);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -695,6 +769,8 @@ PendingLookup::GetStrippedSpec(nsIURI* aUri, nsACString& escaped)
|
||||||
// nsIUrl.filePath starts with '/'
|
// nsIUrl.filePath starts with '/'
|
||||||
escaped.Append(temp);
|
escaped.Append(temp);
|
||||||
|
|
||||||
|
LOG(("PendingLookup::GetStrippedSpec(): URL stripped to '%s' [this = %p]",
|
||||||
|
PromiseFlatCString(escaped).get(), this));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,6 +836,7 @@ PendingLookup::OnComplete(bool shouldBlock, nsresult rv)
|
||||||
mTimeoutTimer = nullptr;
|
mTimeoutTimer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(0)
|
||||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK,
|
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK,
|
||||||
shouldBlock);
|
shouldBlock);
|
||||||
double t = (TimeStamp::Now() - mStartTime).ToMilliseconds();
|
double t = (TimeStamp::Now() - mStartTime).ToMilliseconds();
|
||||||
|
@ -769,6 +846,7 @@ PendingLookup::OnComplete(bool shouldBlock, nsresult rv)
|
||||||
} else {
|
} else {
|
||||||
LOG(("Application Reputation check passed in %f ms [this = %p]", t, this));
|
LOG(("Application Reputation check passed in %f ms [this = %p]", t, this));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
nsresult res = mCallback->OnComplete(shouldBlock, rv);
|
nsresult res = mCallback->OnComplete(shouldBlock, rv);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user