Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn instead of error when service_worker is combined with background.scripts/page #5156

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

willdurand
Copy link
Member

@willdurand willdurand commented Jan 8, 2024

Fixes #5152

┆Issue is synchronized with this Jira Task

Copy link

codecov bot commented Jan 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8eeab65) 98.73% compared to head (04435f7) 98.73%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5156   +/-   ##
=======================================
  Coverage   98.73%   98.73%           
=======================================
  Files          54       54           
  Lines        2927     2932    +5     
  Branches      891      893    +2     
=======================================
+ Hits         2890     2895    +5     
  Misses         37       37           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@willdurand willdurand requested review from rpl and Rob--W January 8, 2024 09:37
Copy link
Member

@rpl rpl left a comment

Choose a reason for hiding this comment

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

@willdurand lgtm, in the comments below just a nit for an assertion currently left as commented + some details about that schema update file history (at least the amount of history that I could gather without spending too much time on it).

{
"additionalProperties": false
},
{},
{},
{
"min_manifest_version": 3
Copy link
Member

Choose a reason for hiding this comment

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

@willdurand as we were discussing earlier today this property was being merged only into the first entry of the background anyOf schema definitions and so it was allowing only background.page along with other unknown properties but not for background.scripts, which clearly looked odd and not what the original intention likely was and so I did some archeology to track back what happened and if there was any historical reason for only apply that change to the first entry.

Turned out that originally "additionalProperties": false was merged into both the anyOf entries and applied to both background.page and background.scripts entries as we were both expecting to be more likely the original intention, then we lost the background.scripts one long long time ago due to (pretty sure unvoluntary mistake) this patch 8e7f2bc#diff-00f4beb517c238ef6210e32350012fa0eec24b2d2834731494c108c4136a17ac

As for the "wait forcing it to be strict", I couldn't track that back, the original manifest.json update file was introduced by #1169, and I don't see that much comments I could use to track back the motivation quickly, but my guess would be that we were keeping the same strictness we were using on the Firefox side.

and so (even if non blocking for this specific PR), as we were considering earlier today, leaving a note about how these updates file should be maintained (and suggest to cover new ones with a unit test, at least one testing the resulting merged schema) to avoid the same kind of mistake going unnoticed may be useful, but I'm not sure were that note would better fit in this repo, maybe a README.md file in this src/schema/updates/ source dir?

@rpl rpl changed the title Warn about service_worker when background.scripts and/or background.page are pesent Warn about service_worker when background.scripts and/or background.page are present Jan 8, 2024
@rpl
Copy link
Member

rpl commented Jan 8, 2024

@willdurand forgot to mention, there is a typo in the commit message (pesent -> present), I took care of fixing the one in the PR subject message derived from the commit message

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.

LGTM, thanks for the fix.

Note: the commit title states that its purpose is to emit a warning. That's not the objective: instead, the goal is to get rid of the hard error. Downgrading the error to a warning meets that goal, so this patch is indeed a right fix.

I suggest to change the commit message to: Warn instead of error when service_worker is combined with background.scripts/page

@willdurand willdurand changed the title Warn about service_worker when background.scripts and/or background.page are present Warn instead of error when service_worker is combined with background.scripts/page Jan 9, 2024
@willdurand willdurand merged commit d2cb7fe into master Jan 9, 2024
@willdurand willdurand deleted the fix-service-worker branch January 9, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return a warning for the service_worker property
3 participants