Bug 1948889 - Simplify SRICheck by getting location from http referrer info. r=freddyb,tschuster
The referrer info is more directly what we want (what triggered this load). I could add this information for non-http channels, but I think it's probably not worth it. This is useful because it's thread-safe, which allows me to support off-main-thread parsing of stylesheets that contain SRI metadata. It also simplifies the API and avoids getting URIs around in non-error code paths. Differential Revision: https://phabricator.services.mozilla.com/D238612
This commit is contained in:
@@ -1356,7 +1356,7 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest) {
|
||||
SRICheck::IntegrityMetadata(mRequest->GetIntegrity(), sourceUri, reporter,
|
||||
&mSRIMetadata);
|
||||
mSRIDataVerifier =
|
||||
MakeUnique<SRICheckDataVerifier>(mSRIMetadata, sourceUri, reporter);
|
||||
MakeUnique<SRICheckDataVerifier>(mSRIMetadata, channel, reporter);
|
||||
|
||||
// Do not retarget off main thread when using SRI API.
|
||||
return NS_OK;
|
||||
@@ -1583,14 +1583,7 @@ FetchDriver::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
|
||||
reporter = mObserver->GetReporter();
|
||||
}
|
||||
|
||||
nsAutoCString sourceUri;
|
||||
if (mDocument && mDocument->GetDocumentURI()) {
|
||||
mDocument->GetDocumentURI()->GetAsciiSpec(sourceUri);
|
||||
} else if (!mWorkerScript.IsEmpty()) {
|
||||
sourceUri.Assign(mWorkerScript);
|
||||
}
|
||||
nsresult rv =
|
||||
mSRIDataVerifier->Verify(mSRIMetadata, channel, sourceUri, reporter);
|
||||
nsresult rv = mSRIDataVerifier->Verify(mSRIMetadata, channel, reporter);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (altDataListener) {
|
||||
altDataListener->Cancel();
|
||||
|
||||
Reference in New Issue
Block a user