mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
1b648cc1d8
6 changed files with 47 additions and 3 deletions
|
|
@ -76,6 +76,7 @@ nsIIOService *nsScriptSecurityManager::sIOService = nullptr;
|
|||
nsIStringBundle *nsScriptSecurityManager::sStrBundle = nullptr;
|
||||
JSContext *nsScriptSecurityManager::sContext = nullptr;
|
||||
bool nsScriptSecurityManager::sStrictFileOriginPolicy = true;
|
||||
bool nsScriptSecurityManager::sSameOriginPolicy = true;
|
||||
|
||||
///////////////////////////
|
||||
// Convenience Functions //
|
||||
|
|
@ -607,7 +608,7 @@ nsScriptSecurityManager::CheckSameOriginURI(nsIURI* aSourceURI,
|
|||
nsIURI* aTargetURI,
|
||||
bool reportError)
|
||||
{
|
||||
if (!SecurityCompareURIs(aSourceURI, aTargetURI))
|
||||
if (sSameOriginPolicy && !SecurityCompareURIs(aSourceURI, aTargetURI))
|
||||
{
|
||||
if (reportError) {
|
||||
ReportError(nullptr, NS_LITERAL_STRING("CheckSameOriginError"),
|
||||
|
|
@ -1434,10 +1435,13 @@ nsScriptSecurityManager::CanGetService(JSContext *cx,
|
|||
const char sJSEnabledPrefName[] = "javascript.enabled";
|
||||
const char sFileOriginPolicyPrefName[] =
|
||||
"security.fileuri.strict_origin_policy";
|
||||
const char sSameOriginPolicyPrefName[] =
|
||||
"security.same_origin_policy.enabled";
|
||||
|
||||
static const char* kObservedPrefs[] = {
|
||||
sJSEnabledPrefName,
|
||||
sFileOriginPolicyPrefName,
|
||||
sSameOriginPolicyPrefName,
|
||||
"capability.policy.",
|
||||
nullptr
|
||||
};
|
||||
|
|
@ -1593,6 +1597,8 @@ nsScriptSecurityManager::ScriptSecurityPrefChanged()
|
|||
Preferences::GetBool(sJSEnabledPrefName, mIsJavaScriptEnabled);
|
||||
sStrictFileOriginPolicy =
|
||||
Preferences::GetBool(sFileOriginPolicyPrefName, false);
|
||||
sSameOriginPolicy =
|
||||
Preferences::GetBool(sSameOriginPolicyPrefName, true);
|
||||
mFileURIWhitelist.reset();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ private:
|
|||
}
|
||||
|
||||
static bool sStrictFileOriginPolicy;
|
||||
static bool sSameOriginPolicy;
|
||||
|
||||
static nsIIOService *sIOService;
|
||||
static nsIStringBundle *sStrBundle;
|
||||
|
|
|
|||
|
|
@ -287,8 +287,15 @@ ReserveProcessExecutableMemory(size_t bytes)
|
|||
// Note that randomAddr is just a hint: if the address is not available
|
||||
// mmap will pick a different address.
|
||||
void* randomAddr = ComputeRandomAllocationAddress();
|
||||
#ifdef PROT_MPROTECT
|
||||
void* p = MozTaggedAnonymousMmap(randomAddr, bytes,
|
||||
PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
|
||||
MAP_PRIVATE | MAP_ANON,
|
||||
-1, 0, "js-executable-memory");
|
||||
#else
|
||||
void* p = MozTaggedAnonymousMmap(randomAddr, bytes, PROT_NONE, MAP_PRIVATE | MAP_ANON,
|
||||
-1, 0, "js-executable-memory");
|
||||
#endif
|
||||
if (p == MAP_FAILED)
|
||||
return nullptr;
|
||||
return p;
|
||||
|
|
@ -315,7 +322,13 @@ ProtectionSettingToFlags(ProtectionSetting protection)
|
|||
static void
|
||||
CommitPages(void* addr, size_t bytes, ProtectionSetting protection)
|
||||
{
|
||||
void* p = MozTaggedAnonymousMmap(addr, bytes, ProtectionSettingToFlags(protection),
|
||||
void* p = MozTaggedAnonymousMmap(addr, bytes,
|
||||
#ifdef PROT_MPROTECT
|
||||
ProtectionSettingToFlags(protection) |
|
||||
PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
|
||||
#else
|
||||
ProtectionSettingToFlags(protection),
|
||||
#endif
|
||||
MAP_FIXED | MAP_PRIVATE | MAP_ANON,
|
||||
-1, 0, "js-executable-memory");
|
||||
MOZ_RELEASE_ASSERT(addr == p);
|
||||
|
|
|
|||
|
|
@ -644,7 +644,12 @@ WasmArrayRawBuffer::Allocate(uint32_t numBytes, Maybe<uint32_t> maxSize)
|
|||
return nullptr;
|
||||
}
|
||||
# else // XP_WIN
|
||||
void* data = MozTaggedAnonymousMmap(nullptr, (size_t) mappedSizeWithHeader, PROT_NONE,
|
||||
void* data = MozTaggedAnonymousMmap(nullptr, (size_t) mappedSizeWithHeader,
|
||||
#ifdef PROT_MPROTECT
|
||||
PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
|
||||
#else
|
||||
PROT_NONE,
|
||||
#endif
|
||||
MAP_PRIVATE | MAP_ANON, -1, 0, "wasm-reserved");
|
||||
if (data == MAP_FAILED)
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -1221,6 +1221,12 @@ pref("dom.cycle_collector.incremental", false);
|
|||
pref("content.sink.pending_event_mode", 0);
|
||||
#endif
|
||||
|
||||
// Is support for CORS enabled?
|
||||
pref("content.cors.disable", false);
|
||||
|
||||
// Should preflight requests be bypassed when CORS is disabled?
|
||||
pref("content.cors.bypass_preflight_request", false);
|
||||
|
||||
// Disable popups from plugins by default
|
||||
// 0 = openAllowed
|
||||
// 1 = openControlled
|
||||
|
|
@ -1337,6 +1343,9 @@ pref("javascript.options.streams", true);
|
|||
pref("advanced.mailftp", false);
|
||||
pref("image.animation_mode", "normal");
|
||||
|
||||
// Same-origin policy for all URIs.
|
||||
pref("security.same_origin_policy.enabled", true);
|
||||
|
||||
// Same-origin policy for file URIs, "false" is traditional
|
||||
pref("security.fileuri.strict_origin_policy", true);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ using namespace mozilla;
|
|||
|
||||
static bool gDisableCORS = false;
|
||||
static bool gDisableCORSPrivateData = false;
|
||||
static bool gBypassCORSPreflightRequest = false;
|
||||
|
||||
static void
|
||||
LogBlockedRequest(nsIRequest* aRequest,
|
||||
|
|
@ -414,6 +415,8 @@ nsCORSListenerProxy::Startup()
|
|||
"content.cors.disable");
|
||||
Preferences::AddBoolVarCache(&gDisableCORSPrivateData,
|
||||
"content.cors.no_private_data");
|
||||
Preferences::AddBoolVarCache(&gBypassCORSPreflightRequest,
|
||||
"content.cors.bypass_preflight_request");
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
@ -543,6 +546,9 @@ nsCORSListenerProxy::CheckRequestApproved(nsIRequest* aRequest)
|
|||
}
|
||||
|
||||
if (gDisableCORS) {
|
||||
if (gBypassCORSPreflightRequest) {
|
||||
return NS_OK;
|
||||
}
|
||||
LogBlockedRequest(aRequest, "CORSDisabled", nullptr);
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
|
@ -1413,6 +1419,10 @@ nsCORSListenerProxy::StartCORSPreflight(nsIChannel* aRequestChannel,
|
|||
*aPreflightChannel = nullptr;
|
||||
|
||||
if (gDisableCORS) {
|
||||
if (gBypassCORSPreflightRequest) {
|
||||
aCallback->OnPreflightSucceeded();
|
||||
return NS_OK;
|
||||
}
|
||||
LogBlockedRequest(aRequestChannel, "CORSDisabled", nullptr);
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue