Bug 1184798 - Ensure workers loads are treated as non-subresource fetches. r=jdm
This commit is contained in:
@@ -13850,6 +13850,7 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
|
||||
nsContentPolicyType aLoadContentType,
|
||||
bool* aShouldIntercept)
|
||||
{
|
||||
*aShouldIntercept = false;
|
||||
@@ -13902,7 +13903,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
|
||||
}
|
||||
}
|
||||
|
||||
if (aIsNavigate) {
|
||||
if (aIsNavigate || nsContentUtils::IsWorkerLoad(aLoadContentType)) {
|
||||
OriginAttributes attrs(GetAppId(), GetIsInBrowserElement());
|
||||
*aShouldIntercept = swm->IsAvailable(attrs, aURI);
|
||||
return NS_OK;
|
||||
@@ -13982,9 +13983,15 @@ nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel,
|
||||
nsresult rv = aChannel->GetIsNavigation(&isNavigation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsContentPolicyType loadType;
|
||||
rv = aChannel->GetInternalContentPolicyType(&loadType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
||||
if (!isNavigation) {
|
||||
bool isSubresourceLoad = !isNavigation &&
|
||||
!nsContentUtils::IsWorkerLoad(loadType);
|
||||
if (isSubresourceLoad) {
|
||||
doc = GetDocument();
|
||||
if (!doc) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
@@ -13997,7 +14004,7 @@ nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel,
|
||||
|
||||
ErrorResult error;
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
swm->PrepareFetchEvent(attrs, doc, aChannel, isReload, error);
|
||||
swm->PrepareFetchEvent(attrs, doc, aChannel, isReload, isSubresourceLoad, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user