зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337522 P1 Add diagnostic assertions that worker principal is valid before compilation. r=baku
This commit is contained in:
Родитель
52b735a227
Коммит
adfc2e425e
|
@ -1993,6 +1993,14 @@ WorkerLoadInfo::FinalChannelPrincipalIsValid(nsIChannel* aChannel)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
WorkerLoadInfo::PrincipalIsValid() const
|
||||
{
|
||||
return mPrincipal && mPrincipalInfo &&
|
||||
mPrincipalInfo->type() != PrincipalInfo::T__None &&
|
||||
mPrincipalInfo->type() <= PrincipalInfo::T__Last;
|
||||
}
|
||||
#endif // defined(DEBUG) || !defined(RELEASE_OR_BETA)
|
||||
|
||||
bool
|
||||
|
@ -4017,6 +4025,15 @@ WorkerPrivateParent<Derived>::AssertInnerWindowIsCorrect() const
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
|
||||
template <class Derived>
|
||||
bool
|
||||
WorkerPrivateParent<Derived>::PrincipalIsValid() const
|
||||
{
|
||||
return mLoadInfo.PrincipalIsValid();
|
||||
}
|
||||
#endif
|
||||
|
||||
class PostDebuggerMessageRunnable final : public Runnable
|
||||
{
|
||||
WorkerDebugger *mDebugger;
|
||||
|
@ -4589,6 +4606,8 @@ WorkerPrivate::Constructor(JSContext* aCx,
|
|||
|
||||
worker->EnableDebugger();
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(worker->PrincipalIsValid());
|
||||
|
||||
RefPtr<CompileScriptRunnable> compiler =
|
||||
new CompileScriptRunnable(worker, aScriptURL);
|
||||
if (!compiler->Dispatch()) {
|
||||
|
@ -4858,6 +4877,8 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindowInner* aWindow,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(loadInfo.PrincipalIsValid());
|
||||
|
||||
aLoadInfo->StealFrom(loadInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -867,6 +867,11 @@ public:
|
|||
AssertInnerWindowIsCorrect() const
|
||||
{ }
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
|
||||
bool
|
||||
PrincipalIsValid() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
class WorkerDebugger : public nsIWorkerDebugger {
|
||||
|
|
|
@ -293,6 +293,9 @@ struct WorkerLoadInfo
|
|||
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
|
||||
bool
|
||||
FinalChannelPrincipalIsValid(nsIChannel* aChannel);
|
||||
|
||||
bool
|
||||
PrincipalIsValid() const;
|
||||
#endif
|
||||
|
||||
bool
|
||||
|
|
Загрузка…
Ссылка в новой задаче