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:
@@ -931,12 +931,8 @@ nsresult ScriptLoader::PrepareIncrementalStreamLoader(
|
||||
ScriptLoadRequest* aRequest) {
|
||||
UniquePtr<mozilla::dom::SRICheckDataVerifier> sriDataVerifier;
|
||||
if (!aRequest->mIntegrity.IsEmpty()) {
|
||||
nsAutoCString sourceUri;
|
||||
if (mDocument->GetDocumentURI()) {
|
||||
mDocument->GetDocumentURI()->GetAsciiSpec(sourceUri);
|
||||
}
|
||||
sriDataVerifier = MakeUnique<SRICheckDataVerifier>(aRequest->mIntegrity,
|
||||
sourceUri, mReporter);
|
||||
aChannel, mReporter);
|
||||
}
|
||||
|
||||
RefPtr<ScriptLoadHandler> handler =
|
||||
@@ -3837,13 +3833,7 @@ nsresult ScriptLoader::VerifySRI(ScriptLoadRequest* aRequest,
|
||||
if (!aRequest->mIntegrity.IsEmpty() && NS_SUCCEEDED((rv = aSRIStatus))) {
|
||||
MOZ_ASSERT(aSRIDataVerifier);
|
||||
MOZ_ASSERT(mReporter);
|
||||
|
||||
nsAutoCString sourceUri;
|
||||
if (mDocument && mDocument->GetDocumentURI()) {
|
||||
mDocument->GetDocumentURI()->GetAsciiSpec(sourceUri);
|
||||
}
|
||||
rv = aSRIDataVerifier->Verify(aRequest->mIntegrity, channel, sourceUri,
|
||||
mReporter);
|
||||
rv = aSRIDataVerifier->Verify(aRequest->mIntegrity, channel, mReporter);
|
||||
if (channelRequest) {
|
||||
mReporter->FlushReportsToConsole(
|
||||
nsContentUtils::GetInnerWindowID(channelRequest));
|
||||
|
||||
Reference in New Issue
Block a user