Open Bug 1420639 Opened 5 years ago Updated 6 months ago

channel.frameAncestors throws NS_ERROR_UNEXPECTED for frames embedded within chrome pages

Categories

(WebExtensions :: Request Handling, defect, P5)

defect

Tracking

(Not tracked)

People

(Reporter: simon.lindholm10, Unassigned)

References

Details

I have an addon that registers a onHeadersReceived listener like this:

browser.webRequest.onHeadersReceived.addListener(
	() => { return {}; }, // do nothing
	{urls: ["<all_urls>"], types: ["image", "imageset"]},
	["blocking", "responseHeaders"]
);

When I open the "Get Add-Ons" tab of about:addons, some image gets requested, and this causes some system code to log the following to the browser console:

[Exception... "Unexpected error"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: resource://gre/modules/WebRequest.jsm :: getRequestData :: line 684"  data: no]

where WebRequest.jsm:684 is this line:

      frameAncestors: channel.frameAncestors || undefined,

I'm guessing that https://searchfox.org/mozilla-central/rev/45a3df4e6b8f653b0103d18d97c34dd666706358/toolkit/components/extensions/webrequest/ChannelWrapper.cpp#620 triggers due to the system principle not having a URI.

Not sure what *should* happen here -- should/do webRequest handlers even work for web content embedded in about:addons? -- but either way it shouldn't log an error. I guess either ChannelWrapper::GetFrameAncestors should break instead of return NS_ERROR_UNEXPECTED, or the consumer in WebRequest.jsm should do a try-catch.
Priority: -- → P5
Product: Toolkit → WebExtensions
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.