зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1481352 - Add whitelist for remote scripts that can run in middleman processes, r=mccr8.
--HG-- extra : rebase_source : 9eabb532e1e310711777b14cd8a21881b646deca
This commit is contained in:
Родитель
60fcac25d8
Коммит
4cf0d8901e
|
@ -2293,6 +2293,21 @@ TabChild::RecvActivateFrameEvent(const nsString& aType, const bool& capture)
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return whether a remote script should be loaded in middleman processes in
|
||||||
|
// addition to any child recording process they have.
|
||||||
|
static bool
|
||||||
|
LoadScriptInMiddleman(const nsString& aURL)
|
||||||
|
{
|
||||||
|
return // Middleman processes run devtools server side scripts.
|
||||||
|
StringBeginsWith(aURL, NS_LITERAL_STRING("resource://devtools/"))
|
||||||
|
// This script includes event listeners needed to propagate document
|
||||||
|
// title changes.
|
||||||
|
|| aURL.EqualsLiteral("chrome://global/content/browser-child.js")
|
||||||
|
// This script is needed to respond to session store requests from the
|
||||||
|
// UI process.
|
||||||
|
|| aURL.EqualsLiteral("chrome://browser/content/content-sessionStore.js");
|
||||||
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult
|
mozilla::ipc::IPCResult
|
||||||
TabChild::RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalScope)
|
TabChild::RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalScope)
|
||||||
{
|
{
|
||||||
|
@ -2307,6 +2322,11 @@ TabChild::RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalSco
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we only load whitelisted scripts in middleman processes.
|
||||||
|
if (recordreplay::IsMiddleman() && !LoadScriptInMiddleman(aURL)) {
|
||||||
|
return IPC_OK();
|
||||||
|
}
|
||||||
|
|
||||||
LoadScriptInternal(global, aURL, aRunInGlobalScope);
|
LoadScriptInternal(global, aURL, aRunInGlobalScope);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче