Bug 1231211 P18 Make blob URL worker scripts inherit the parent's controller. r=asuth

This commit is contained in:
Ben Kelly
2018-01-23 10:38:54 -05:00
parent 1f4454bdc6
commit dfd8d0e640
5 changed files with 24 additions and 4 deletions

View File

@@ -29,6 +29,7 @@
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
#include "nsDocShellCID.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsISupportsPrimitives.h"
#include "nsNetUtil.h"
#include "nsIPipe.h"
@@ -1260,6 +1261,18 @@ private:
if (chanLoadInfo) {
mController = chanLoadInfo->GetController();
}
// If we are loading a blob URL we must inherit the controller
// from the parent. This is a bit odd as the blob URL may have
// been created in a different context with a different controller.
// For now, though, this is what the spec says. See:
//
// https://github.com/w3c/ServiceWorker/issues/1261
//
if (IsBlobURI(mWorkerPrivate->GetBaseURI())) {
MOZ_DIAGNOSTIC_ASSERT(mController.isNothing());
mController = mWorkerPrivate->GetParentController();
}
}
return NS_OK;