Bug 1213150 - Part 2: Rework ShouldPrepareForIntercept() in terms of subresource requests; r=jdm

This commit is contained in:
Ehsan Akhgari 2015-10-06 22:40:36 -04:00
parent 669ab0513f
commit 8168656799
5 changed files with 9 additions and 15 deletions

View File

@ -13940,8 +13940,7 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
}
NS_IMETHODIMP
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
nsContentPolicyType aLoadContentType,
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNonSubresourceRequest,
bool* aShouldIntercept)
{
*aShouldIntercept = false;
@ -13994,7 +13993,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
}
}
if (aIsNavigate || nsContentUtils::IsWorkerLoad(aLoadContentType)) {
if (aIsNonSubresourceRequest) {
OriginAttributes attrs(GetAppId(), GetIsInBrowserElement());
*aShouldIntercept = swm->IsAvailable(attrs, aURI);
return NS_OK;

View File

@ -883,11 +883,8 @@ nsJARChannel::ShouldIntercept()
getter_AddRefs(controller));
bool shouldIntercept = false;
if (controller && !BypassServiceWorker() && mLoadInfo) {
bool isNavigation = mLoadFlags & LOAD_DOCUMENT_URI;
nsContentPolicyType type = mLoadInfo->InternalContentPolicyType();
nsresult rv = controller->ShouldPrepareForIntercept(mAppURI,
isNavigation,
type,
nsContentUtils::IsNonSubresourceRequest(this),
&shouldIntercept);
NS_ENSURE_SUCCESS(rv, false);
}

View File

@ -112,7 +112,7 @@ interface nsIFetchEventDispatcher : nsISupports
* request should be intercepted before any network request is initiated.
*/
[scriptable, uuid(7157fe12-20e3-45db-b09e-68fdf6d0614f)]
[scriptable, uuid(49eb1997-90fb-49d6-a25d-41f51c7c99e8)]
interface nsINetworkInterceptController : nsISupports
{
/**
@ -122,7 +122,7 @@ interface nsINetworkInterceptController : nsISupports
* @param aURI the URI being requested by a channel
* @param aIsNavigate True if the request is for a navigation, false for a fetch.
*/
bool shouldPrepareForIntercept(in nsIURI aURI, in bool aIsNavigate, in nsContentPolicyType aType);
bool shouldPrepareForIntercept(in nsIURI aURI, in bool aIsNonSubresourceRequest);
/**
* Notification when a given intercepted channel is prepared to accept a synthesized

View File

@ -2313,10 +2313,8 @@ HttpBaseChannel::ShouldIntercept()
GetCallback(controller);
bool shouldIntercept = false;
if (controller && !BypassServiceWorker() && mLoadInfo) {
nsContentPolicyType type = mLoadInfo->InternalContentPolicyType();
nsresult rv = controller->ShouldPrepareForIntercept(mURI,
IsNavigation(),
type,
nsresult rv = controller->ShouldPrepareForIntercept(aURI,
nsContentUtils::IsNonSubresourceRequest(this),
&shouldIntercept);
if (NS_FAILED(rv)) {
return false;

View File

@ -162,8 +162,8 @@ NS_IMPL_ISUPPORTS(HttpChannelParent,
nsIDeprecationWarner)
NS_IMETHODIMP
HttpChannelParent::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
nsContentPolicyType aType,
HttpChannelParent::ShouldPrepareForIntercept(nsIURI* aURI,
bool aIsNonSubresourceRequest,
bool* aShouldIntercept)
{
*aShouldIntercept = mShouldIntercept;