Open Bug 1681345 Opened 4 years ago Updated 3 years ago

javascript Fetch() does not seem to be fully working to reroute browser

Categories

(Core :: DOM: Networking, defect, P3)

Firefox 83
defect

Tracking

()

UNCONFIRMED

People

(Reporter: ecpantalone, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:83.0) Gecko/20100101 Firefox/83.0

Steps to reproduce:

javascript Fetch() does not seem to be fully working, specifically
fetch(${window.origin}/changes_confirmed, {
method: "POST",
credentials: "include",
body: JSON.stringify(output_rows),
cache: "no-cache",
headers: new Headers({
"content-type": "application/json"
})
})
.then(function(response) {
if (response.status !== 200) {
console.log(Looks like there was a problem. Status code: ${response.status});
return;
}
response.json().then(function(data) {
console.log(data);
window.location.replace(data['url']); <-------- this never happens, though it works on Safari and Chrome. the 'url' is provided within the python def()
});
})
.catch(function(error) {
console.log("Fetch error: " + error);
});

where the url is replaced with a specified url on the backend. This is in a flask app that I've been working on. It works in Chrome and Safari, but Firefox.

Actual results:

The page does not reroute.

Expected results:

The page should reroute to the specified url on the python backend.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Component: DOM: Core & HTML → DOM: Networking

Hi Reporter,

Could you try to provide us a minimal test case to reproduce this?

Thanks.

Flags: needinfo?(ecpantalone)
Blocks: fetch
Severity: -- → S4
Flags: needinfo?(ecpantalone)
Priority: -- → P3
Whiteboard: [necko-triaged]
You need to log in before you can comment on or make changes to this bug.