Closed Bug 1365299 Opened 4 years ago Closed 4 years ago

Response `redirected` attribute set incorrectly for intercepted requests

Categories

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

defect

Tracking

()

RESOLVED DUPLICATE of bug 1222008

People

(Reporter: jugglinmike, Unassigned)

Details

Attachments

(1 file)

Attached file sw-redirect.py
When a service worker intercepts a request and provides a response by
performing a fetch, the response's `redirected` attribute should reflect
whether a redirect occurred. In Firefox today, the attribute is incorrectly set
to `false` in cases where the service worker provides a response that was the
result of an HTTP 302 redirect.

Attached, please find a Python script that creates a web server for
demonstration purposes. It may be invoked with Python 2.7 as follows:

    python sw-redirect.py

And subsequently accessed by navigating to `http://localhost:9000`.
Demonstration results are printed to the developer's console.

Expected:

    In worker:
    > response.type = basic
    > response.status = 200
    > response.redirected = true
    In client:
    > response.type = basic
    > response.status = 200
    > response.redirected = true

Actual:

    In worker:
    > response.type = basic
    > response.status = 200
    > response.redirected = true
    In client:
    > response.type = basic
    > response.status = 200
    > response.redirected = false

System information:

- Firefox: 55.0a1 (2017-05-12) (64-bit)
- Platform: GNU/Linux (Ubuntu 16.04)
So if I'm reading this right, the Response returned in the outer window is the one with the wrong .redirected value.

So this is a bug in our code that synthesizes nsIChannel from Response in SW and then extracts Response back from nsIChannel on the main thread.
Priority: -- → P2
Fixed by bug 1222008.
No longer blocks: ServiceWorkers-compat
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1222008
You need to log in before you can comment on or make changes to this bug.