Skip to content

Conversation

@seia-soto
Copy link
Contributor

Summary

This adds json to webextensions.api.webRequest.ResourceType.

Test results and supporting details

The test code is defined in Firefox source-code: https://phabricator.services.mozilla.com/D230563, but import attribution support on Firefox is blocking this.

Also, declarativeNetRequest.ResourceType should be confirmed in the future.

Related issues

fixes #26016
refs mdn/content#38305

@github-actions github-actions bot added data:webext Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions size:s [PR only] 7-24 LoC changed labels Apr 15, 2025
@caugner
Copy link
Contributor

caugner commented Apr 15, 2025

import attribution support on Firefox is blocking this

Does this mean this feature is effectively not yet supported in Firefox?

@seia-soto
Copy link
Contributor Author

@caugner Yes, the feature is effectively not available. I don't know if there's another way around but I couldn't able to get resource type of json without import attribution from webRequest events. For the current versions of Firefox, the resource type is shown as script instead.

@caugner
Copy link
Contributor

caugner commented Apr 18, 2025

Yes, the feature is effectively not available.

Apologies for the confusion, if the feature is in fact not yet available, then it is too early to document in BCD.

@caugner caugner closed this Apr 18, 2025
@dotproto
Copy link
Contributor

@caugner, where's the line for availability? Does it need to be available in a stable release of at least one browser? Can it be available behind a flag? Does Nightly/Canary/STP count?

I haven't tested the feature yet, but it looks like the feature was implemented behind a flag in D230563 as part of bug 1858078. Per bug 1950836, the flag is being enabled by default in 138.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 28, 2025

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@caugner caugner changed the title Add json to webextensions.api.webRequest.ResourceType Firefox 138 adds webextensions.api.webRequest.ResourceType.json Apr 28, 2025
@caugner
Copy link
Contributor

caugner commented Apr 28, 2025

where's the line for availability? Does it need to be available in a stable release of at least one browser? Can it be available behind a flag? Does Nightly/Canary/STP count?

Generally, our data guidelines only require an "intent to implement" by at least one browser engine in order to record a feature in BCD, and this is enforced by requiring at least one impl_url if no browser currently supports the feature.

If the feature is available behind a flag, then that can be documented in BCD, but we should only do this for features such as Temporal with significant interest by BCD consumers or users, because we cannot automatically test those flags, and the flag statements get removed once the feature becomes available without a flag in a non-preview release (see the flags lint).

In this case, given that the feature appears to have been enabled in Firefox 138 beta, we can just set the version number accordingly.

@rebloor Would you like to test that it actually works before merging this PR?

@rebloor
Copy link
Contributor

rebloor commented Apr 29, 2025

@Rob--W I see that you were a reviewer on Bug 1858078 - Part 5: Add JSON tests for webRequest.ResourceType - could you take a look and tell us whether we're good to go with this one.

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the same change to declarativeNetRequest? It was supported with the same bug/patch stack: https://phabricator.services.mozilla.com/D229524#change-aViG2RKNWdeb

@github-actions github-actions bot added size:m [PR only] 25-100 LoC changed and removed size:s [PR only] 7-24 LoC changed labels May 2, 2025
@seia-soto seia-soto requested a review from caugner May 4, 2025 07:45
@seia-soto
Copy link
Contributor Author

The commit is pushed and pinging as we can proceed. Also, thanks for all the efforts to the review and investigation.

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically the value was accepted in the webRequest API since Firefox 135, but there was nothing that would trigger it until enabled in 138.

Being accepted in the webRequest API means that adding it as a value to the types filter in addListener was accepted instead of an error being thrown.

This is a subtle distinction that mainly matters for feature detection. In theory we could add this to "notes", e.g. "notes": "The "json" property is supported since Firefox 135, but requests of this type are only available since Firefox 138."

@rebloor
Copy link
Contributor

rebloor commented May 5, 2025

@seia-soto if you want to make the change suggested by Rob, could you order it as follows "notes": "The "json" property is supported from Firefox 135, but requests of this type are only available from Firefox 138."

@seia-soto
Copy link
Contributor Author

@rebloor @Rob--W notes added. 👍

@rebloor rebloor merged commit 83bf635 into mdn:main May 6, 2025
6 checks passed
@rebloor
Copy link
Contributor

rebloor commented May 6, 2025

Thanks @seia-soto

@mdn-bot mdn-bot mentioned this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:webext Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions size:m [PR only] 25-100 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webextensions.api.webRequest.ResourceType - json

5 participants