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

Fix web extension issues #8000

Merged
merged 7 commits into from May 23, 2022
Merged

Fix web extension issues #8000

merged 7 commits into from May 23, 2022

Conversation

101arrowz
Copy link
Member

↪️ Pull Request

Fixes #7997

There were some issues with the web extension schema that this PR fixes. However, the main change is making the dependency merging logic more robust, which fixes an issue where two dependencies for an asset added as needsStableName: true and needsStableName: false but otherwise identical would sometimes result in a bundle with needsStableName: false. This was because the merging logic would simply update the first dependency's options with the newer dependency's options, when in reality the merged dependency should have a stable name if either source dependency needed it.

I also applied this logic to all the other fields that weren't factored into the dependency ID. For instance, if the dependency is optional in one dependency but not the other, the merged dependency should not be optional. The only field I wasn't sure about was bundleBehavior; I'm just guessing that the precedence should be 'isolated' > 'inline' > null. IMO bundleBehavior should actually be factored into the dependency ID but I wasn't sure so I didn't change that.

💻 Examples

manifest.json:

{
{
    "manifest_version": 3,
    "version": "1",
    "name": "test",
    "action": {
      "default_popup": "popup.html"
    },
    "web_accessible_resources": [{
        "matches": ["<all_urls>"],
        "resources": ["popup.html"]
    }]
}

Previously this manifest resulted in the popup.html file receiving a content hash, which is undesired behavior because web_accessible_resources aren't really that accessible if their names aren't constant. (If popup.html were only present in web_accessible_resources and not in action, however, it would work)

This inconsistency is now fixed so if either dependency needs a stable name, the final merged dependency does too.

@101arrowz
Copy link
Member Author

101arrowz commented Apr 23, 2022

Looks like the content hashing tests are failing due to the changes in WriteBundlesRequest.js. Not sure how to work around that...

EDIT: Found and fixed the issue, should be working now.

@parcel-benchmark
Copy link

parcel-benchmark commented Apr 23, 2022

Benchmark Results

Kitchen Sink 🚨

Timings

Description Time Difference
Cold FAILED -0.00ms
Cached FAILED -0.00ms

Cold Bundles

No bundles found, this is probably a failed build...

Cached Bundles

No bundles found, this is probably a failed build...

React HackerNews ✅

Timings

Description Time Difference
Cold 9.27s -42.00ms
Cached 439.00ms -10.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 1.67m +1.51s
Cached 2.58s -34.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/index.5c7ce5ea.js 3.33mb +144.00b ⚠️ 32.37s +678.00ms

Cached Bundles

Bundle Size Difference Time Difference
dist/index.4ac13050.js 3.33mb +144.00b ⚠️ 31.88s -155.00ms

Three.js ✅

Timings

Description Time Difference
Cold 6.75s +79.00ms
Cached 286.00ms +3.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@101arrowz 101arrowz requested a review from devongovett May 1, 2022 04:20
@devongovett devongovett merged commit 2c18016 into v2 May 23, 2022
@devongovett devongovett deleted the webext-mv3-fixes branch May 23, 2022 14:20
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.

WebExtension manifestV3 doesn't work as expected
4 participants