зеркало из https://github.com/mozilla/gecko-dev.git
Bug 581341 - Part 4: Always run the IPC testshell callback, regardless of execution success or failure. r=bent
This commit is contained in:
Родитель
812b334553
Коммит
4560199bc4
|
@ -327,6 +327,14 @@ ContentParent::DestroyTestShell(TestShellParent* aTestShell)
|
||||||
return PTestShellParent::Send__delete__(aTestShell);
|
return PTestShellParent::Send__delete__(aTestShell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TestShellParent*
|
||||||
|
ContentParent::GetTestShellSingleton()
|
||||||
|
{
|
||||||
|
if (!ManagedPTestShellParent().Length())
|
||||||
|
return nsnull;
|
||||||
|
return static_cast<TestShellParent*>(ManagedPTestShellParent()[0]);
|
||||||
|
}
|
||||||
|
|
||||||
ContentParent::ContentParent()
|
ContentParent::ContentParent()
|
||||||
: mGeolocationWatchID(-1)
|
: mGeolocationWatchID(-1)
|
||||||
, mRunToCompletionDepth(0)
|
, mRunToCompletionDepth(0)
|
||||||
|
|
|
@ -94,6 +94,7 @@ public:
|
||||||
|
|
||||||
TestShellParent* CreateTestShell();
|
TestShellParent* CreateTestShell();
|
||||||
bool DestroyTestShell(TestShellParent* aTestShell);
|
bool DestroyTestShell(TestShellParent* aTestShell);
|
||||||
|
TestShellParent* GetTestShellSingleton();
|
||||||
|
|
||||||
void ReportChildAlreadyBlocked();
|
void ReportChildAlreadyBlocked();
|
||||||
bool RequestRunToCompletion();
|
bool RequestRunToCompletion();
|
||||||
|
|
|
@ -146,3 +146,18 @@ TestShellCommandParent::ReleaseCallback()
|
||||||
{
|
{
|
||||||
mCallback.Release();
|
mCallback.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TestShellCommandParent::ExecuteCallback(const nsString& aResponse)
|
||||||
|
{
|
||||||
|
return static_cast<TestShellParent*>(Manager())->CommandDone(
|
||||||
|
this, aResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TestShellCommandParent::ActorDestroy(ActorDestroyReason why)
|
||||||
|
{
|
||||||
|
if (why == AbnormalShutdown) {
|
||||||
|
ExecuteCallback(EmptyString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -92,9 +92,12 @@ public:
|
||||||
void ReleaseCallback();
|
void ReleaseCallback();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool ExecuteCallback(const nsString& aResponse);
|
||||||
|
|
||||||
|
void ActorDestroy(ActorDestroyReason why);
|
||||||
|
|
||||||
bool Recv__delete__(const nsString& aResponse) {
|
bool Recv__delete__(const nsString& aResponse) {
|
||||||
return static_cast<TestShellParent*>(Manager())->CommandDone(
|
return ExecuteCallback(aResponse);
|
||||||
this, aResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -706,16 +706,18 @@ XRE_ShutdownChildProcess()
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
TestShellParent* gTestShellParent = nsnull;
|
|
||||||
TestShellParent* GetOrCreateTestShellParent()
|
TestShellParent* GetOrCreateTestShellParent()
|
||||||
{
|
{
|
||||||
if (!gTestShellParent) {
|
ContentParent* parent = ContentParent::GetSingleton();
|
||||||
ContentParent* parent = ContentParent::GetSingleton();
|
if (!parent) {
|
||||||
NS_ENSURE_TRUE(parent, nsnull);
|
return nsnull;
|
||||||
gTestShellParent = parent->CreateTestShell();
|
|
||||||
NS_ENSURE_TRUE(gTestShellParent, nsnull);
|
|
||||||
}
|
}
|
||||||
return gTestShellParent;
|
TestShellParent* testShell = parent->GetTestShellSingleton();
|
||||||
|
if (testShell) {
|
||||||
|
return testShell;
|
||||||
|
}
|
||||||
|
testShell = parent->CreateTestShell();
|
||||||
|
return testShell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,9 +756,11 @@ XRE_GetChildGlobalObject(JSContext* aCx, JSObject** aGlobalP)
|
||||||
bool
|
bool
|
||||||
XRE_ShutdownTestShell()
|
XRE_ShutdownTestShell()
|
||||||
{
|
{
|
||||||
if (!gTestShellParent)
|
ContentParent* cp = ContentParent::GetSingleton(PR_FALSE);
|
||||||
|
TestShellParent* tsp = cp ? cp->GetTestShellSingleton() : nsnull;
|
||||||
|
if (!tsp)
|
||||||
return true;
|
return true;
|
||||||
return ContentParent::GetSingleton()->DestroyTestShell(gTestShellParent);
|
return cp->DestroyTestShell(tsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
|
|
Загрузка…
Ссылка в новой задаче