mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
6d191b58d4
64 changed files with 532 additions and 20498 deletions
|
|
@ -718,9 +718,9 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
if (mType == eType_Plugin) {
|
||||
nsIDocument* doc = thisContent->GetComposedDoc();
|
||||
if (doc && doc->IsActive()) {
|
||||
nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(doc,
|
||||
NS_LITERAL_STRING("PluginRemoved"));
|
||||
NS_DispatchToCurrentThread(ev);
|
||||
nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(doc,
|
||||
NS_LITERAL_STRING("PluginRemoved"));
|
||||
NS_DispatchToCurrentThread(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3628,6 +3628,14 @@ nsObjectLoadingContent::HasGoodFallback() {
|
|||
}
|
||||
}
|
||||
|
||||
// RULE "nosrc":
|
||||
// Use fallback content if the object has not specified a src URI.
|
||||
if (rulesList[i].EqualsLiteral("nosrc")) {
|
||||
if (!mOriginalURI) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// RULE "adobelink":
|
||||
// Don't use fallback content when it has a link to adobe's website.
|
||||
if (rulesList[i].EqualsLiteral("adobelink")) {
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ ImageDocument::CreateSyntheticDocument()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Add the image element
|
||||
Element* body = GetBodyElement();
|
||||
RefPtr<Element> body = GetBodyElement();
|
||||
if (!body) {
|
||||
NS_WARNING("no body on image document!");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ PluginDocument::CreateSyntheticPluginDocument()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// then attach our plugin
|
||||
|
||||
Element* body = GetBodyElement();
|
||||
RefPtr<Element> body = GetBodyElement();
|
||||
if (!body) {
|
||||
NS_WARNING("no body on plugin document!");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
|
|||
nsresult rv = MediaDocument::CreateSyntheticDocument();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
Element* body = GetBodyElement();
|
||||
RefPtr<Element> body = GetBodyElement();
|
||||
if (!body) {
|
||||
NS_WARNING("no body on video document!");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ IDBCursor::Continue(JSContext* aCx,
|
|||
}
|
||||
|
||||
Key key;
|
||||
aRv = key.SetFromJSVal(aCx, aKey);
|
||||
aRv = key.SetFromJSVal(aCx, aKey, /* aCallGetters */ true);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ IDBCursor::ContinuePrimaryKey(JSContext* aCx,
|
|||
}
|
||||
|
||||
Key key;
|
||||
aRv = key.SetFromJSVal(aCx, aKey);
|
||||
aRv = key.SetFromJSVal(aCx, aKey, /* aCallGetters */ true);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -558,7 +558,7 @@ IDBCursor::ContinuePrimaryKey(JSContext* aCx,
|
|||
}
|
||||
|
||||
Key primaryKey;
|
||||
aRv = primaryKey.SetFromJSVal(aCx, aPrimaryKey);
|
||||
aRv = primaryKey.SetFromJSVal(aCx, aPrimaryKey, /* aCallGetters */ true);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -718,7 +718,7 @@ IDBCursor::Update(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
|||
const KeyPath& keyPath = objectStore->GetKeyPath();
|
||||
Key key;
|
||||
|
||||
aRv = keyPath.ExtractKey(aCx, aValue, key);
|
||||
aRv = keyPath.ExtractKey(aCx, aValue, key, /* aCallGetters */ false);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -482,13 +482,13 @@ IDBFactory::Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst,
|
|||
JS::Handle<JS::Value> aSecond, ErrorResult& aRv)
|
||||
{
|
||||
Key first, second;
|
||||
nsresult rv = first.SetFromJSVal(aCx, aFirst);
|
||||
nsresult rv = first.SetFromJSVal(aCx, aFirst, /* aCallGetters */ true);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rv = second.SetFromJSVal(aCx, aSecond);
|
||||
rv = second.SetFromJSVal(aCx, aSecond, /* aCallGetters */ true);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ GetKeyFromJSVal(JSContext* aCx,
|
|||
JS::Handle<JS::Value> aVal,
|
||||
Key& aKey)
|
||||
{
|
||||
nsresult rv = aKey.SetFromJSVal(aCx, aVal);
|
||||
nsresult rv = aKey.SetFromJSVal(aCx, aVal, /* aCallGetters */ true);
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_ASSERT(NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM_INDEXEDDB);
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -1084,7 +1084,7 @@ IDBObjectStore::AppendIndexUpdateInfo(
|
|||
|
||||
if (!aMultiEntry) {
|
||||
Key key;
|
||||
rv = aKeyPath.ExtractKey(aCx, aVal, key);
|
||||
rv = aKeyPath.ExtractKey(aCx, aVal, key, /* aCallGetters */ false);
|
||||
|
||||
// If an index's keyPath doesn't match an object, we ignore that object.
|
||||
if (rv == NS_ERROR_DOM_INDEXEDDB_DATA_ERR || key.IsUnset()) {
|
||||
|
|
@ -1128,13 +1128,13 @@ IDBObjectStore::AppendIndexUpdateInfo(
|
|||
|
||||
for (uint32_t arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {
|
||||
JS::Rooted<JS::Value> arrayItem(aCx);
|
||||
if (NS_WARN_IF(!JS_GetElement(aCx, array, arrayIndex, &arrayItem))) {
|
||||
if (NS_WARN_IF(!JS_GetOwnElement(aCx, array, arrayIndex, &arrayItem))) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
Key value;
|
||||
if (NS_FAILED(value.SetFromJSVal(aCx, arrayItem)) ||
|
||||
if (NS_FAILED(value.SetFromJSVal(aCx, arrayItem, /* aCallGetters */ false)) ||
|
||||
value.IsUnset()) {
|
||||
// Not a value we can do anything with, ignore it.
|
||||
continue;
|
||||
|
|
@ -1153,7 +1153,7 @@ IDBObjectStore::AppendIndexUpdateInfo(
|
|||
}
|
||||
else {
|
||||
Key value;
|
||||
if (NS_FAILED(value.SetFromJSVal(aCx, val)) ||
|
||||
if (NS_FAILED(value.SetFromJSVal(aCx, val, /* aCallGetters */ false)) ||
|
||||
value.IsUnset()) {
|
||||
// Not a value we can do anything with, ignore it.
|
||||
return NS_OK;
|
||||
|
|
@ -1324,12 +1324,12 @@ IDBObjectStore::GetAddInfo(JSContext* aCx,
|
|||
|
||||
if (!HasValidKeyPath()) {
|
||||
// Out-of-line keys must be passed in.
|
||||
rv = aKey.SetFromJSVal(aCx, aKeyVal);
|
||||
rv = aKey.SetFromJSVal(aCx, aKeyVal, /* aCallGetters */ true);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
} else if (!isAutoIncrement) {
|
||||
rv = GetKeyPath().ExtractKey(aCx, aValue, aKey);
|
||||
rv = GetKeyPath().ExtractKey(aCx, aValue, aKey, /* aCallGetters */ false);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -1368,7 +1368,8 @@ IDBObjectStore::GetAddInfo(JSContext* aCx,
|
|||
aValue,
|
||||
aKey,
|
||||
&GetAddInfoCallback,
|
||||
&data);
|
||||
&data,
|
||||
/* aCallGetters */ false);
|
||||
} else {
|
||||
rv = GetAddInfoCallback(aCx, &data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,8 +201,11 @@ Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const
|
|||
}
|
||||
|
||||
nsresult
|
||||
Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal,
|
||||
uint8_t aTypeOffset, uint16_t aRecursionDepth)
|
||||
Key::EncodeJSValInternal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
uint8_t aTypeOffset,
|
||||
uint16_t aRecursionDepth,
|
||||
bool aCallGetters)
|
||||
{
|
||||
static_assert(eMaxType * kMaxArrayCollapse < 256,
|
||||
"Unable to encode jsvals.");
|
||||
|
|
@ -257,13 +260,18 @@ Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal,
|
|||
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!JS_GetElement(aCx, obj, index, &val)) {
|
||||
bool ok = aCallGetters ? JS_GetElement(aCx, obj, index, &val)
|
||||
: JS_GetOwnElement(aCx, obj, index, &val);
|
||||
if (!ok) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
nsresult rv = EncodeJSValInternal(aCx, val, aTypeOffset,
|
||||
aRecursionDepth + 1);
|
||||
nsresult rv = EncodeJSValInternal(aCx,
|
||||
val,
|
||||
aTypeOffset,
|
||||
aRecursionDepth + 1,
|
||||
aCallGetters);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -406,9 +414,10 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
|||
nsresult
|
||||
Key::EncodeJSVal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
uint8_t aTypeOffset)
|
||||
uint8_t aTypeOffset,
|
||||
bool aCallGetters)
|
||||
{
|
||||
return EncodeJSValInternal(aCx, aVal, aTypeOffset, 0);
|
||||
return EncodeJSValInternal(aCx, aVal, aTypeOffset, 0, aCallGetters);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -741,7 +750,8 @@ Key::SetFromValueArray(mozIStorageValueArray* aValues,
|
|||
|
||||
nsresult
|
||||
Key::SetFromJSVal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal)
|
||||
JS::Handle<JS::Value> aVal,
|
||||
bool aCallGetters)
|
||||
{
|
||||
mBuffer.Truncate();
|
||||
|
||||
|
|
@ -750,7 +760,7 @@ Key::SetFromJSVal(JSContext* aCx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = EncodeJSVal(aCx, aVal, 0);
|
||||
nsresult rv = EncodeJSVal(aCx, aVal, 0, aCallGetters);
|
||||
if (NS_FAILED(rv)) {
|
||||
Unset();
|
||||
return rv;
|
||||
|
|
@ -793,9 +803,15 @@ Key::ToJSVal(JSContext* aCx,
|
|||
}
|
||||
|
||||
nsresult
|
||||
Key::AppendItem(JSContext* aCx, bool aFirstOfArray, JS::Handle<JS::Value> aVal)
|
||||
Key::AppendItem(JSContext* aCx,
|
||||
bool aFirstOfArray,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
bool aCallGetters)
|
||||
{
|
||||
nsresult rv = EncodeJSVal(aCx, aVal, aFirstOfArray ? eMaxType : 0);
|
||||
nsresult rv = EncodeJSVal(aCx,
|
||||
aVal,
|
||||
aFirstOfArray ? eMaxType : 0,
|
||||
aCallGetters);
|
||||
if (NS_FAILED(rv)) {
|
||||
Unset();
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public:
|
|||
}
|
||||
|
||||
nsresult
|
||||
SetFromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal);
|
||||
SetFromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal, bool aCallGetters);
|
||||
|
||||
nsresult
|
||||
ToJSVal(JSContext* aCx, JS::MutableHandle<JS::Value> aVal) const;
|
||||
|
|
@ -212,7 +212,10 @@ public:
|
|||
ToJSVal(JSContext* aCx, JS::Heap<JS::Value>& aVal) const;
|
||||
|
||||
nsresult
|
||||
AppendItem(JSContext* aCx, bool aFirstOfArray, JS::Handle<JS::Value> aVal);
|
||||
AppendItem(JSContext* aCx,
|
||||
bool aFirstOfArray,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
bool aCallGetters);
|
||||
|
||||
nsresult
|
||||
ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const;
|
||||
|
|
@ -283,7 +286,10 @@ private:
|
|||
|
||||
// Encoding functions. These append the encoded value to the end of mBuffer
|
||||
nsresult
|
||||
EncodeJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal, uint8_t aTypeOffset);
|
||||
EncodeJSVal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
uint8_t aTypeOffset,
|
||||
bool aCallGetters);
|
||||
|
||||
void
|
||||
EncodeString(const nsAString& aString, uint8_t aTypeOffset);
|
||||
|
|
@ -331,7 +337,8 @@ private:
|
|||
EncodeJSValInternal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
uint8_t aTypeOffset,
|
||||
uint16_t aRecursionDepth);
|
||||
uint16_t aRecursionDepth,
|
||||
bool aCallGetters);
|
||||
|
||||
static nsresult
|
||||
DecodeJSValInternal(const unsigned char*& aPos,
|
||||
|
|
|
|||
|
|
@ -372,11 +372,13 @@ KeyPath::AppendStringWithValidation(const nsAString& aString)
|
|||
}
|
||||
|
||||
nsresult
|
||||
KeyPath::ExtractKey(JSContext* aCx, const JS::Value& aValue, Key& aKey) const
|
||||
KeyPath::ExtractKey(JSContext* aCx,
|
||||
const JS::Value& aValue,
|
||||
Key& aKey,
|
||||
bool aCallGetters) const
|
||||
{
|
||||
uint32_t len = mStrings.Length();
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
|
||||
aKey.Unset();
|
||||
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
|
|
@ -388,7 +390,10 @@ KeyPath::ExtractKey(JSContext* aCx, const JS::Value& aValue, Key& aKey) const
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (NS_FAILED(aKey.AppendItem(aCx, IsArray() && i == 0, value))) {
|
||||
if (NS_FAILED(aKey.AppendItem(aCx,
|
||||
IsArray() && i == 0,
|
||||
value,
|
||||
aCallGetters))) {
|
||||
NS_ASSERTION(aKey.IsUnset(), "Encoding error should unset");
|
||||
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
|
||||
}
|
||||
|
|
@ -437,9 +442,12 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
|||
}
|
||||
|
||||
nsresult
|
||||
KeyPath::ExtractOrCreateKey(JSContext* aCx, const JS::Value& aValue,
|
||||
Key& aKey, ExtractOrCreateKeyCallback aCallback,
|
||||
void* aClosure) const
|
||||
KeyPath::ExtractOrCreateKey(JSContext* aCx,
|
||||
const JS::Value& aValue,
|
||||
Key& aKey,
|
||||
ExtractOrCreateKeyCallback aCallback,
|
||||
void* aClosure,
|
||||
bool aCallGetters) const
|
||||
{
|
||||
NS_ASSERTION(IsString(), "This doesn't make sense!");
|
||||
|
||||
|
|
@ -455,7 +463,7 @@ KeyPath::ExtractOrCreateKey(JSContext* aCx, const JS::Value& aValue,
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (NS_FAILED(aKey.AppendItem(aCx, false, value))) {
|
||||
if (NS_FAILED(aKey.AppendItem(aCx, false, value, aCallGetters))) {
|
||||
NS_ASSERTION(aKey.IsUnset(), "Should be unset");
|
||||
return value.isUndefined() ? NS_OK : NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ public:
|
|||
Parse(const Nullable<OwningStringOrStringSequence>& aValue, KeyPath* aKeyPath);
|
||||
|
||||
nsresult
|
||||
ExtractKey(JSContext* aCx, const JS::Value& aValue, Key& aKey) const;
|
||||
ExtractKey(JSContext* aCx,
|
||||
const JS::Value& aValue,
|
||||
Key& aKey,
|
||||
bool aCallGetters) const;
|
||||
|
||||
nsresult
|
||||
ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
||||
|
|
@ -82,9 +85,12 @@ public:
|
|||
(*ExtractOrCreateKeyCallback)(JSContext* aCx, void* aClosure);
|
||||
|
||||
nsresult
|
||||
ExtractOrCreateKey(JSContext* aCx, const JS::Value& aValue, Key& aKey,
|
||||
ExtractOrCreateKey(JSContext* aCx,
|
||||
const JS::Value& aValue,
|
||||
Key& aKey,
|
||||
ExtractOrCreateKeyCallback aCallback,
|
||||
void* aClosure) const;
|
||||
void* aClosure,
|
||||
bool aCallGetters) const;
|
||||
|
||||
inline bool IsValid() const {
|
||||
return mType != NONEXISTENT;
|
||||
|
|
|
|||
|
|
@ -513,8 +513,19 @@ nsCSPContext::GetAllowsInline(nsContentPolicyType aContentType,
|
|||
for (uint32_t i = 0; i < mPolicies.Length(); i++) {
|
||||
bool allowed =
|
||||
mPolicies[i]->allows(aContentType, CSP_UNSAFE_INLINE, EmptyString(), aParserCreated) ||
|
||||
mPolicies[i]->allows(aContentType, CSP_NONCE, aNonce, aParserCreated) ||
|
||||
mPolicies[i]->allows(aContentType, CSP_HASH, aContent, aParserCreated);
|
||||
mPolicies[i]->allows(aContentType, CSP_NONCE, aNonce, aParserCreated);
|
||||
|
||||
// If the inlined script or style is allowed by either unsafe-inline or the
|
||||
// nonce, go ahead and shortcut this loop.
|
||||
if (allowed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if the csp-hash matches against the hash of the script.
|
||||
// If we don't have any content to check, block the script.
|
||||
if (!aContent.IsEmpty()) {
|
||||
allowed = mPolicies[i]->allows(aContentType, CSP_HASH, aContent, aParserCreated);
|
||||
}
|
||||
|
||||
if (!allowed) {
|
||||
// policy is violoated: deny the load unless policy is report only and
|
||||
|
|
|
|||
|
|
@ -641,13 +641,22 @@ nsCSPHostSrc::permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected
|
|||
// just a specific scheme, the parser should generate a nsCSPSchemeSource.
|
||||
NS_ASSERTION((!mHost.IsEmpty()), "host can not be the empty string");
|
||||
|
||||
// Before we can check if the host matches, we have to
|
||||
// extract the host part from aUri.
|
||||
nsAutoCString uriHost;
|
||||
nsresult rv = aUri->GetAsciiHost(uriHost);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsString decodedUriHost;
|
||||
CSP_PercentDecodeStr(NS_ConvertUTF8toUTF16(uriHost), decodedUriHost);
|
||||
|
||||
// 2) host matching: Enforce a single *
|
||||
if (mHost.EqualsASCII("*")) {
|
||||
// The single ASTERISK character (*) does not match a URI's scheme of a type
|
||||
// designating a globally unique identifier (such as blob:, data:, or filesystem:)
|
||||
// At the moment firefox does not support filesystem; but for future compatibility
|
||||
// At the moment UXP does not support "filesystem:" but for future compatibility
|
||||
// we support it in CSP according to the spec, see: 4.2.2 Matching Source Expressions
|
||||
// Note, that whitelisting any of these schemes would call nsCSPSchemeSrc::permits().
|
||||
// Note: whitelisting any of these schemes would call nsCSPSchemeSrc::permits().
|
||||
bool isBlobScheme =
|
||||
(NS_SUCCEEDED(aUri->SchemeIs("blob", &isBlobScheme)) && isBlobScheme);
|
||||
bool isDataScheme =
|
||||
|
|
@ -658,20 +667,15 @@ nsCSPHostSrc::permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected
|
|||
if (isBlobScheme || isDataScheme || isFileScheme) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
// If no scheme is present there also won't be a port and folder to check
|
||||
// which means we can return early.
|
||||
if (mScheme.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Before we can check if the host matches, we have to
|
||||
// extract the host part from aUri.
|
||||
nsAutoCString uriHost;
|
||||
nsresult rv = aUri->GetAsciiHost(uriHost);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsString decodedUriHost;
|
||||
CSP_PercentDecodeStr(NS_ConvertUTF8toUTF16(uriHost), decodedUriHost);
|
||||
|
||||
// 4.5) host matching: Check if the allowed host starts with a wilcard.
|
||||
if (mHost.First() == '*') {
|
||||
else if (mHost.First() == '*') {
|
||||
NS_ASSERTION(mHost[1] == '.', "Second character needs to be '.' whenever host starts with '*'");
|
||||
|
||||
// Eliminate leading "*", but keeping the FULL STOP (.) thereafter before checking
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue