Bug 1266221 P1 Get devtools http service worker testing option from top window. r=bz

This commit is contained in:
Ben Kelly 2016-04-21 16:26:42 -07:00
parent 24969b7621
commit d472e3219c
2 changed files with 24 additions and 9 deletions

View File

@ -3764,6 +3764,28 @@ nsPIDOMWindowOuter::RefreshMediaElements()
}
}
void
nsPIDOMWindowOuter::SetServiceWorkersTestingEnabled(bool aEnabled)
{
// Devtools should only be setting this on the top level window. Its
// ok if devtools clears the flag on clean up of nested windows, though.
// It will have no affect.
#ifdef DEBUG
nsCOMPtr<nsPIDOMWindowOuter> topWindow = GetScriptableTop();
MOZ_ASSERT_IF(aEnabled, this == topWindow);
#endif
mServiceWorkersTestingEnabled = aEnabled;
}
bool
nsPIDOMWindowOuter::GetServiceWorkersTestingEnabled()
{
// Automatically get this setting from the top level window so that nested
// iframes get the correct devtools setting.
nsCOMPtr<nsPIDOMWindowOuter> topWindow = GetScriptableTop();
return topWindow->mServiceWorkersTestingEnabled;
}
bool
nsPIDOMWindowInner::GetAudioCaptured() const
{

View File

@ -865,15 +865,8 @@ public:
float GetAudioVolume() const;
nsresult SetAudioVolume(float aVolume);
void SetServiceWorkersTestingEnabled(bool aEnabled)
{
mServiceWorkersTestingEnabled = aEnabled;
}
bool GetServiceWorkersTestingEnabled()
{
return mServiceWorkersTestingEnabled;
}
void SetServiceWorkersTestingEnabled(bool aEnabled);
bool GetServiceWorkersTestingEnabled();
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMWindowOuter, NS_PIDOMWINDOWOUTER_IID)