mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1097998 - Warn when using CPOWs when content process isn't in a safe state r=billm, bholley
This commit is contained in:
parent
d1c0f96396
commit
033d1d7603
@ -1606,6 +1606,25 @@ ContentParent::OnChannelError()
|
||||
PContentParent::OnChannelError();
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::OnBeginSyncTransaction() {
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (console && cx) {
|
||||
nsAutoString filename;
|
||||
uint32_t lineno = 0;
|
||||
nsJSUtils::GetCallingLocation(cx, filename, &lineno);
|
||||
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||
error->Init(NS_LITERAL_STRING("unsafe CPOW usage"), filename, EmptyString(),
|
||||
lineno, 0, nsIScriptError::warningFlag, "chrome javascript");
|
||||
console->LogMessage(error);
|
||||
} else {
|
||||
NS_WARNING("Unsafe synchronous IPC message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::OnChannelConnected(int32_t pid)
|
||||
{
|
||||
|
@ -253,6 +253,8 @@ public:
|
||||
|
||||
virtual void OnChannelError() MOZ_OVERRIDE;
|
||||
|
||||
virtual void OnBeginSyncTransaction() MOZ_OVERRIDE;
|
||||
|
||||
virtual PCrashReporterParent*
|
||||
AllocPCrashReporterParent(const NativeThreadId& tid,
|
||||
const uint32_t& processType) MOZ_OVERRIDE;
|
||||
|
@ -719,6 +719,9 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
|
||||
if (mCurrentTransaction == 0)
|
||||
mListener->OnBeginSyncTransaction();
|
||||
|
||||
#ifdef OS_WIN
|
||||
SyncStackFrame frame(this, false);
|
||||
#endif
|
||||
|
@ -88,6 +88,10 @@ class MessageListener
|
||||
virtual void OnExitedCall() {
|
||||
NS_RUNTIMEABORT("default impl shouldn't be invoked");
|
||||
}
|
||||
/* This callback is called when a sync message is sent that begins a new IPC transaction
|
||||
(i.e., when it is not part of an existing sequence of nested messages). */
|
||||
virtual void OnBeginSyncTransaction() {
|
||||
}
|
||||
virtual RacyInterruptPolicy MediateInterruptRace(const Message& parent,
|
||||
const Message& child)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user