Closed Bug 1909081 Opened 3 months ago Closed 2 months ago

webextension reports wrong HTTP method after 303 redirect

Categories

(WebExtensions :: Request Handling, defect, P3)

Firefox 128
defect

Tracking

(firefox131 fixed)

RESOLVED FIXED
131 Branch
Tracking Status
firefox131 --- fixed

People

(Reporter: binarynoise, Assigned: robwu)

References

Details

(Whiteboard: [addons-jira])

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0

Steps to reproduce:

I created an extension that uses webRequest to listen for HTTP traffic.

Actual results:

  • I submit a form (HTTP POST)
  • The server accepts the form and sends 303 (to the same url)
  • I receive onBeforeRedirect with the new url
  • Firefox follows the redirect to the url via GET
  • subsequent callbacks (like onHeadersReceived) still report HTTP POST

Expected results:

The callbacks should have GET as method after the redirect.

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions

Additional info:

  • this happens on desktop and android.
  • The network log in the developer tools correctly show the GET request.
  • I use "manifest_version": 2
Attached image screenshot.png

To fix this, I think that we should add a call to ClearCachedMethodValue at https://searchfox.org/mozilla-central/rev/5756c5a3dea4f2896cdb3c8bb15d0ced5e2bf690/toolkit/components/extensions/webrequest/ChannelWrapper.cpp#200

Would also be nice to confirm that there are no other "Cached" entries that are affected by this kind of bug.
https://searchfox.org/mozilla-central/source/dom/chrome-webidl/ChannelWrapper.webidl

As a work-around, assume that the method is GET when you observe a HTTP 303 redirect.

Assignee: nobody → rob
Severity: -- → S4
Status: UNCONFIRMED → NEW
Component: Untriaged → Request Handling
Ever confirmed: true
Priority: -- → P3
Whiteboard: [addons-jira]
See Also: → 1909270

Also clear the cached canModify flag for completeness.
This does not change any behavior in practice, but is more accurate.

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:robwu, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(wdurand)
Flags: needinfo?(rob)

I'm waiting for a review of the patch in bug 1909270 before landing the patch stack.

Flags: needinfo?(wdurand)
Flags: needinfo?(rob)
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/7a11746b9949 Clear cached method upon redirect r=willdurand https://hg.mozilla.org/integration/autoland/rev/f444f3e0955c Clear cached canModify flag upon redirect r=willdurand
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: