Closed Bug 1643611 Opened 4 years ago Closed 2 years ago

Stop intercepting requests in embed and object elements

Categories

(Core :: DOM: Service Workers, defect, P2)

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: annevk, Assigned: joshuacmarshall)

References

(Blocks 1 open bug)

Details

(Whiteboard: [orb:m2][sp3])

Attachments

(1 file)

As per WPT service-workers/service-worker/embed-and-object-are-not-intercepted.https.html and https://github.com/w3c/ServiceWorker/pull/1486 no navigations inside embed and object elements should be intercepted.

This came up as part of https://github.com/whatwg/fetch/pull/948.

Severity: -- → S4
Priority: -- → P3

Fixing this might be important for ORB as otherwise we route requests through the service worker that will get blocked by ORB whereas they would not if they were not intercepted at all. I'm not sure how many sites use embed/object and have a service worker as well, but if any exist we shouldn't impact them.

Blocks: orb
Severity: S4 → S3
Priority: P3 → P2
Assignee: nobody → echuang

Hi Andrew, could you please help us with understanding the effort needed here?

Assignee: echuang → nobody
Flags: needinfo?(bugmail)

So this might be a good thing for :jmarshall to look at as a more atomic fix.

The general situation is this:

  • Spec:
  • Our implementation:
    • Because necko's internal concept of destinations pre-dates fetch's concept of destinations, we have our own internal nsIContentPolicy enum type that gets mapped to RequestDestination types by mozilla::dom::InternalRequest::MapContentPolicyTypeToRequestDestination. For example, currently TYPE_OBJECT and TYPE_INTERNAL_OBJECT both map to RequestDestination::Object.
    • There's somewhat of a 2-layer check for deciding whether to intercept something:
      • mozilla::net::HttpBaseChannel::ShouldIntercept first makes sure the request is eligible for redirection.
      • mozilla::dom::ServiceWorkerInterceptController::ShouldPrepareForIntercept Is where the ServiceWorker logic gets involved and applies storage access rules (if you can't access storage for a principal, you can't see the ServiceWorkers!) as well as checks whether there are any matching scopes for navigations, or just asks the existing ServiceWorker (controller) if it's not a navigation. (Where navigation is oddly defined as "not being a subresource load" and involving delightful double-negations because of that.)
        • Note that the first big block of code in the method deals with subresources, and then the rest is considering navigations (non-subresource requests). Also note that it's step 15 and step 16 of handle fetch that are where they start to care about navigation versus sub-resource, but the new destination check is in step 14, so our destination check would want to go near the top of the method-ish.

With a check added, we expect the test https://searchfox.org/mozilla-central/source/testing/web-platform/tests/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html to start passing which means that the disablings in the corresponding meta file at https://searchfox.org/mozilla-central/source/testing/web-platform/meta/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html.ini would be removed... possibly removing the whole file.

Flags: needinfo?(bugmail) → needinfo?(jmarshall)
Whiteboard: [orb:m2]
Assignee: nobody → jmarshall
Status: NEW → ASSIGNED
Flags: needinfo?(jmarshall)

hi Andrew/Marshall,
Any updates here? Thank you. :)

Pushed by jmarshall@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b7af43abc684 Stop intercepting requests in embed and object elements r=edenchuang
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
Whiteboard: [orb:m2] → [orb:m2][sp3]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: