зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1609474 - Handle if extensions.webextensions.remote changes during runtime for the purposes of Eval/JS Load Telemetry r=robwu,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D60034 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2454017bc8
Коммит
be31335d9f
|
@ -291,6 +291,11 @@ class EvalUsageNotificationRunnable final : public Runnable {
|
|||
uint32_t mColumnNumber;
|
||||
};
|
||||
|
||||
// The Web Extension process pref may be toggled during a session, at which
|
||||
// point stuff may be loaded in the parent process but we would send telemetry
|
||||
// for it. Avoid this by observing if the pref ever was disabled.
|
||||
static bool sWebExtensionsRemoteWasEverDisabled = false;
|
||||
|
||||
/* static */
|
||||
bool nsContentSecurityUtils::IsEvalAllowed(JSContext* cx,
|
||||
bool aIsSystemPrincipal,
|
||||
|
@ -377,11 +382,18 @@ bool nsContentSecurityUtils::IsEvalAllowed(JSContext* cx,
|
|||
|
||||
if (XRE_IsE10sParentProcess() &&
|
||||
!StaticPrefs::extensions_webextensions_remote()) {
|
||||
sWebExtensionsRemoteWasEverDisabled = true;
|
||||
MOZ_LOG(sCSMLog, LogLevel::Debug,
|
||||
("Allowing eval() in parent process because the web extension "
|
||||
"process is disabled"));
|
||||
return true;
|
||||
}
|
||||
if (XRE_IsE10sParentProcess() && sWebExtensionsRemoteWasEverDisabled) {
|
||||
MOZ_LOG(sCSMLog, LogLevel::Debug,
|
||||
("Allowing eval() in parent process because the web extension "
|
||||
"process was disabled at some point"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// We permit these two common idioms to get access to the global JS object
|
||||
if (!aScript.IsEmpty() &&
|
||||
|
@ -737,12 +749,20 @@ bool nsContentSecurityUtils::ValidateScriptFilename(const char* aFilename,
|
|||
|
||||
if (XRE_IsE10sParentProcess() &&
|
||||
!StaticPrefs::extensions_webextensions_remote()) {
|
||||
sWebExtensionsRemoteWasEverDisabled = true;
|
||||
MOZ_LOG(sCSMLog, LogLevel::Debug,
|
||||
("Allowing a javascript load of %s because the web extension "
|
||||
"process is disabled.",
|
||||
aFilename));
|
||||
return true;
|
||||
}
|
||||
if (XRE_IsE10sParentProcess() && sWebExtensionsRemoteWasEverDisabled) {
|
||||
MOZ_LOG(sCSMLog, LogLevel::Debug,
|
||||
("Allowing a javascript load of %s because the web extension "
|
||||
"process was disabled at some point.",
|
||||
aFilename));
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_ConvertUTF8toUTF16 filenameU(aFilename);
|
||||
if (StringBeginsWith(filenameU, NS_LITERAL_STRING("chrome://"))) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче