Closed Bug 1366710 Opened 3 years ago Closed 3 years ago

browser.webRequest reports window.fetch() requests with type "other"

Categories

(WebExtensions :: Request Handling, defect, P3)

defect

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: ecfbugzilla, Assigned: mixedpuppy)

References

(Blocks 1 open bug)

Details

(Whiteboard: [triaged][webRequest])

Attachments

(1 file)

Currently, Firefox implements the resource types supported by Chrome and some more: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/ResourceType#Type. However, a request triggered via window.fetch() will be reported with type "other" - the expected value and what I see in Chrome would be "xmlhttprequest". While the "XML" part in the name here is unfortunate, as far as webRequest is concerned, there is no real difference between XMLHttpRequest and window.fetch().

I see this behavior in Firefox 55.0a1 nightly (2017-05-21), and it is also visible in the code under https://hg.mozilla.org/mozilla-central/file/74566d5345f4cab06c5683d4b620124104801e65/toolkit/modules/addons/WebRequestCommon.jsm#l16 - there is no mapping for TYPE_FETCH, so the code goes into the default case.
need infoing shane to prioritize since it's webrequest (after the Monday holiday).  If Shane wants to discuss with team, remove needinfo and we'll take at next triage.
Flags: needinfo?(mixedpuppy)
I think we should just fix this to be compatible with Chrome, one less papercut.
Assignee: nobody → mixedpuppy
Flags: needinfo?(mixedpuppy)
Priority: -- → P3
Comment on attachment 8870517 [details]
Bug 1366710 set webrequest type to xmlhttprequest for fetch requests,

https://reviewboard.mozilla.org/r/141950/#review145660

Your test appears to be failing on try.
Also, I don't love the idea of using xmlhttprequest just because chrome does it.  We should figure out what makes sense and let the polyfill handle rewriting it if that's desired in some cases...
Comment on attachment 8870517 [details]
Bug 1366710 set webrequest type to xmlhttprequest for fetch requests,

https://reviewboard.mozilla.org/r/141950/#review145660

Yeah, try was intentional to check for any missed tests that relied on .type.  

I think we should keep xmlhttprequest, there's no difference between fetch and xhr from a webrequest perspective.
Comment on attachment 8870517 [details]
Bug 1366710 set webrequest type to xmlhttprequest for fetch requests,

https://reviewboard.mozilla.org/r/141950/#review146072
Attachment #8870517 - Flags: review?(aswan) → review+
Whiteboard: [triaged][webRequest]
Pushed by mixedpuppy@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/c53d4e01d100
set webrequest type to xmlhttprequest for fetch requests, r=aswan
https://hg.mozilla.org/mozilla-central/rev/c53d4e01d100
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.