mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-10 02:29:43 +00:00
#469, #399: more adblock hosts, faster StringBegins/End, any-link, base/srcdoc M1247359 M843579 M1238804
This commit is contained in:
parent
8f266f3359
commit
41675e9698
|
@ -915,6 +915,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
BLOK("se.monetate.net") ||
|
BLOK("se.monetate.net") ||
|
||||||
|
|
||||||
BLOK("ad.crwdcntrl.net") ||
|
BLOK("ad.crwdcntrl.net") ||
|
||||||
|
BLOK("bcp.crwdcntrl.net") ||
|
||||||
BLOK("tags.crwdcntrl.net") ||
|
BLOK("tags.crwdcntrl.net") ||
|
||||||
|
|
||||||
BLOK("cdn.nsstatic.net") ||
|
BLOK("cdn.nsstatic.net") ||
|
||||||
|
@ -930,6 +931,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
BLOK("stats.cloudwp.io") ||
|
BLOK("stats.cloudwp.io") ||
|
||||||
|
|
||||||
BLOK("ap.lijit.com") ||
|
BLOK("ap.lijit.com") ||
|
||||||
|
BLOK("ce.lijit.com") ||
|
||||||
|
|
||||||
BLOK("tlx.3lift.com") ||
|
BLOK("tlx.3lift.com") ||
|
||||||
|
|
||||||
|
|
|
@ -347,17 +347,32 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the base URI for relative URIs in the document (the document uri
|
* Return the fallback base URL for this document, as defined in the HTML
|
||||||
* unless it's overridden by SetBaseURI, HTML <base> tags, etc.). The
|
* specification. Note that this can return null if there is no document URI.
|
||||||
* returned URI could be null if there is no document URI. If the document
|
*
|
||||||
* is a srcdoc document, return the parent document's base URL.
|
* XXXbz: This doesn't implement the bits for about:blank yet.
|
||||||
*/
|
*/
|
||||||
nsIURI* GetDocBaseURI() const
|
nsIURI* GetFallbackBaseURI() const
|
||||||
{
|
{
|
||||||
if (mIsSrcdocDocument && mParentDocument) {
|
if (mIsSrcdocDocument && mParentDocument) {
|
||||||
return mParentDocument->GetDocBaseURI();
|
return mParentDocument->GetDocBaseURI();
|
||||||
}
|
}
|
||||||
return mDocumentBaseURI ? mDocumentBaseURI : mDocumentURI;
|
return mDocumentURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the base URI for relative URIs in the document (the document uri
|
||||||
|
* unless it's overridden by SetBaseURI, HTML <base> tags, etc.). The
|
||||||
|
* returned URI could be null if there is no document URI. If the document is
|
||||||
|
* a srcdoc document and has no explicit base URL, return the parent
|
||||||
|
* document's base URL.
|
||||||
|
*/
|
||||||
|
nsIURI* GetDocBaseURI() const
|
||||||
|
{
|
||||||
|
if (mDocumentBaseURI) {
|
||||||
|
return mDocumentBaseURI;
|
||||||
|
}
|
||||||
|
return GetFallbackBaseURI();
|
||||||
}
|
}
|
||||||
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||||
|
|
||||||
|
|
|
@ -164,14 +164,15 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the <base> element's href relative to our document URI
|
// Resolve the <base> element's href relative to our document's
|
||||||
|
// fallback base URI.
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
child->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> newBaseURI;
|
nsCOMPtr<nsIURI> newBaseURI;
|
||||||
nsContentUtils::NewURIWithDocumentCharset(
|
nsContentUtils::NewURIWithDocumentCharset(
|
||||||
getter_AddRefs(newBaseURI), href, aDocument,
|
getter_AddRefs(newBaseURI), href, aDocument,
|
||||||
aDocument->GetDocumentURI());
|
aDocument->GetFallbackBaseURI());
|
||||||
|
|
||||||
// Try to set our base URI. If that fails, try to set base URI to null
|
// Try to set our base URI. If that fails, try to set base URI to null
|
||||||
nsresult rv = aDocument->SetBaseURI(newBaseURI);
|
nsresult rv = aDocument->SetBaseURI(newBaseURI);
|
||||||
|
|
|
@ -1176,10 +1176,13 @@ GetStatesForPseudoClass(const nsAString& aStatePseudo)
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(aStatePseudo);
|
nsCOMPtr<nsIAtom> atom = do_GetAtom(aStatePseudo);
|
||||||
|
|
||||||
// Ignore :moz-any-link so we don't give the element simultaneous
|
// Ignore :any-link so we don't give the element simultaneous
|
||||||
// visited and unvisited style state
|
// visited and unvisited style state
|
||||||
if (nsCSSPseudoClasses::GetPseudoType(atom) ==
|
if (nsCSSPseudoClasses::GetPseudoType(atom) ==
|
||||||
nsCSSPseudoClasses::ePseudoClass_mozAnyLink) {
|
nsCSSPseudoClasses::ePseudoClass_mozAnyLink ||
|
||||||
|
// XXX: this could be cleaned up. do it once it's building
|
||||||
|
nsCSSPseudoClasses::GetPseudoType(atom) ==
|
||||||
|
nsCSSPseudoClasses::ePseudoClass_anyLink) {
|
||||||
return EventStates();
|
return EventStates();
|
||||||
}
|
}
|
||||||
// Our array above is long enough that indexing into it with
|
// Our array above is long enough that indexing into it with
|
||||||
|
|
|
@ -142,6 +142,8 @@ CSS_STATE_PSEUDO_CLASS(link, ":link", 0, "", NS_EVENT_STATE_UNVISITED)
|
||||||
// what matches :link or :visited
|
// what matches :link or :visited
|
||||||
CSS_STATE_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link", 0, "",
|
CSS_STATE_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link", 0, "",
|
||||||
NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
|
NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
|
||||||
|
CSS_STATE_PSEUDO_CLASS(anyLink, ":any-link", 0, "",
|
||||||
|
NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
|
||||||
CSS_STATE_PSEUDO_CLASS(visited, ":visited", 0, "", NS_EVENT_STATE_VISITED)
|
CSS_STATE_PSEUDO_CLASS(visited, ":visited", 0, "", NS_EVENT_STATE_VISITED)
|
||||||
|
|
||||||
CSS_STATE_PSEUDO_CLASS(active, ":active", 0, "", NS_EVENT_STATE_ACTIVE)
|
CSS_STATE_PSEUDO_CLASS(active, ":active", 0, "", NS_EVENT_STATE_ACTIVE)
|
||||||
|
|
|
@ -1026,6 +1026,17 @@ CountCharInReadable(const nsACString& aStr, char aChar)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring)
|
||||||
|
{
|
||||||
|
nsAString::size_type src_len = aSource.Length(),
|
||||||
|
sub_len = aSubstring.Length();
|
||||||
|
if (sub_len > src_len) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Substring(aSource, 0, sub_len).Equals(aSubstring);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
|
StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
|
||||||
const nsStringComparator& aComparator)
|
const nsStringComparator& aComparator)
|
||||||
|
@ -1038,6 +1049,17 @@ StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
|
||||||
return Substring(aSource, 0, sub_len).Equals(aSubstring, aComparator);
|
return Substring(aSource, 0, sub_len).Equals(aSubstring, aComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring)
|
||||||
|
{
|
||||||
|
nsACString::size_type src_len = aSource.Length(),
|
||||||
|
sub_len = aSubstring.Length();
|
||||||
|
if (sub_len > src_len) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Substring(aSource, 0, sub_len).Equals(aSubstring);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
|
StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
|
||||||
const nsCStringComparator& aComparator)
|
const nsCStringComparator& aComparator)
|
||||||
|
@ -1050,6 +1072,17 @@ StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
|
||||||
return Substring(aSource, 0, sub_len).Equals(aSubstring, aComparator);
|
return Substring(aSource, 0, sub_len).Equals(aSubstring, aComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
StringEndsWith(const nsAString& aSource, const nsAString& aSubstring)
|
||||||
|
{
|
||||||
|
nsAString::size_type src_len = aSource.Length(),
|
||||||
|
sub_len = aSubstring.Length();
|
||||||
|
if (sub_len > src_len) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Substring(aSource, src_len - sub_len, sub_len).Equals(aSubstring);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
|
StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
|
||||||
const nsStringComparator& aComparator)
|
const nsStringComparator& aComparator)
|
||||||
|
@ -1063,6 +1096,17 @@ StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
|
||||||
aComparator);
|
aComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
StringEndsWith(const nsACString& aSource, const nsACString& aSubstring)
|
||||||
|
{
|
||||||
|
nsACString::size_type src_len = aSource.Length(),
|
||||||
|
sub_len = aSubstring.Length();
|
||||||
|
if (sub_len > src_len) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Substring(aSource, src_len - sub_len, sub_len).Equals(aSubstring);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StringEndsWith(const nsACString& aSource, const nsACString& aSubstring,
|
StringEndsWith(const nsACString& aSource, const nsACString& aSubstring,
|
||||||
const nsCStringComparator& aComparator)
|
const nsCStringComparator& aComparator)
|
||||||
|
|
|
@ -386,18 +386,18 @@ uint32_t CountCharInReadable(const nsAString& aStr,
|
||||||
uint32_t CountCharInReadable(const nsACString& aStr,
|
uint32_t CountCharInReadable(const nsACString& aStr,
|
||||||
char aChar);
|
char aChar);
|
||||||
|
|
||||||
|
bool StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring);
|
||||||
bool StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
|
bool StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
|
||||||
const nsStringComparator& aComparator =
|
const nsStringComparator& aComparator);
|
||||||
nsDefaultStringComparator());
|
bool StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring);
|
||||||
bool StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
|
bool StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
|
||||||
const nsCStringComparator& aComparator =
|
const nsCStringComparator& aComparator);
|
||||||
nsDefaultCStringComparator());
|
bool StringEndsWith(const nsAString& aSource, const nsAString& aSubstring);
|
||||||
bool StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
|
bool StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
|
||||||
const nsStringComparator& aComparator =
|
const nsStringComparator& aComparator);
|
||||||
nsDefaultStringComparator());
|
bool StringEndsWith(const nsACString& aSource, const nsACString& aSubstring);
|
||||||
bool StringEndsWith(const nsACString& aSource, const nsACString& aSubstring,
|
bool StringEndsWith(const nsACString& aSource, const nsACString& aSubstring,
|
||||||
const nsCStringComparator& aComparator =
|
const nsCStringComparator& aComparator);
|
||||||
nsDefaultCStringComparator());
|
|
||||||
|
|
||||||
const nsAFlatString& EmptyString();
|
const nsAFlatString& EmptyString();
|
||||||
const nsAFlatCString& EmptyCString();
|
const nsAFlatCString& EmptyCString();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user