Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1487,12 +1487,11 @@ fn get_fetch_directive_fallback_list(directive_name: &str) -> &'static [&'static
fn get_the_effective_directive_for_request(request: &Request) -> &'static str {
use Initiator::*;
use Destination::*;
if request.initiator == Fetch || request.destination == Destination::None {
return "connect-src";
}
// Step 1: If request’s initiator is "prefetch" or "prerender", return default-src.
if request.initiator == Prefetch || request.initiator == Prerender {
return "default-src";
}
// Step 2: Switch on request’s destination, and execute the associated steps:
match request.destination {
Destination::Manifest => "manifest-src",
Object | Embed => "object-src",
Expand All @@ -1505,6 +1504,7 @@ fn get_the_effective_directive_for_request(request: &Request) -> &'static str {
ServiceWorker | SharedWorker | Worker => "worker-src",
Json | WebIdentity => "connect-src",
Report => "",
// Step 3: Return connect-src.
_ => "connect-src",
}
}
Expand Down