Skip to content

Conversation

@jonathanKingston
Copy link
Contributor

@jonathanKingston jonathanKingston commented Jul 31, 2025

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/1209253361096901/task/1209488147924654?focus=true

Description

Fixes up the API with the current permission status rather than the new Chromium hardcoding they've added.
Adds a setting to allow us to control the rollout here.

Testing Steps

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

Note

Implements native-aware Permissions handling (with fall-through to original API) and refactors/expands tests to cover both shimmed and existing Permissions APIs.

  • WebCompat (Permissions):
    • Introduce shadow PermissionStatus class for shimming.
    • Add handlePermissionQuery to message native for native-marked permissions and return PermissionStatus, else fall through.
    • Add permissionsPresentFix to proxy existing navigator.permissions.query; gated by webCompat.permissionsPresent.
    • Update permissionsFix to validate args, use shared handler, and default to 'prompt' when falling back.
  • Tests:
    • Refactor with shared runner (createApiTestRunner), setup (setupPermissionsTest), helpers (checkPermission), and reusable cases (permissionsTestCases).
    • Add suite for API present: ensures fall-through for non-native/unsupported/invalid inputs and interception for native permissions, including success/unexpected/error paths.
    • Parameterize runs for API deleted vs shimmed; adjust disabled-feature checks accordingly.

Written by Cursor Bugbot for commit 6f4bc06. This will update automatically on new commits. Configure here.

@netlify
Copy link

netlify bot commented Jul 31, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit 6f4bc06
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/692ec781e86be10008b2812e
😎 Deploy Preview https://deploy-preview-1867--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

github-actions bot commented Jul 31, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

@github-actions
Copy link

github-actions bot commented Jul 31, 2025

[Beta] Generated file diff

Time updated: Tue, 02 Dec 2025 11:04:23 GMT

Android
    - android/adsjsContentScope.js
  • android/autofillImport.js
  • android/brokerProtection.js
  • android/contentScope.js

File has changed

Apple
    - apple/contentScope.js
  • apple/contentScopeIsolated.js
  • apple/pages/new-tab/dist/index.js
  • apple/pages/onboarding/dist/index.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js
  • integration/pages/new-tab/dist/index.js
  • integration/pages/onboarding/dist/index.js

File has changed

Windows
    - windows/contentScope.js
  • windows/pages/new-tab/dist/index.js
  • windows/pages/onboarding/dist/index.js

File has changed

@jonathanKingston jonathanKingston marked this pull request as ready for review July 31, 2025 11:58
@jonathanKingston jonathanKingston requested a review from a team as a code owner July 31, 2025 11:58
cursor[bot]

This comment was marked as outdated.

nshuba
nshuba previously approved these changes Jul 31, 2025
Copy link
Contributor

@nshuba nshuba left a comment

Choose a reason for hiding this comment

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

Changes look good, but it might be worth updating the integration tests? We have some basic ones for permissions APIs already.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

jonathanKingston and others added 10 commits August 18, 2025 12:17
Bumps [@rive-app/canvas-single](https://github.com/rive-app/rive-wasm) from 2.31.1 to 2.31.2.
- [Changelog](https://github.com/rive-app/rive-wasm/blob/master/CHANGELOG.md)
- [Commits](rive-app/rive-wasm@2.31.1...2.31.2)

---
updated-dependencies:
- dependency-name: "@rive-app/canvas-single"
  dependency-version: 2.31.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [esbuild](https://github.com/evanw/esbuild) from 0.25.8 to 0.25.9.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](evanw/esbuild@v0.25.8...v0.25.9)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-version: 0.25.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add in file count check for data.files in canShare

* Update check and tests

* Lint fix
* Update build-and-troubleshooting.md for apple changes

* Lint fix
* Auto approve patch changes to the repo

* Lint fix

* Ignore higher risk deps
* Ensure we check isFeatureEnabled correctly

* Only trigger updates on listenForUpdateChanges enabled features (CTL)

* Add bail out option for invalid messages
* Add additionalCheck for android rollout

* Add test case

* Simplify test case

* Lint fix

* Continue in the loop instead of return
* Add in file count check for data.files in canShare

* Update check and tests

* Lint fix

* Make canShare more permissive
test('should default to prompt when native error occurs', async ({ page }) => {
await setupPermissionsTest(page, { removePermissions: removeApi });
await permissionsTestCases.testNativePermissionError(page);
});
Copy link

Choose a reason for hiding this comment

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

Bug: Tests fail when API exists but permissionsPresent not enabled

The createApiTestRunner runs tests with removeApi: false ("with API shimmed"), but setupPermissionsTest doesn't enable permissionsPresent by default. When the browser's permissions API exists and permissionsPresent is not enabled, permissionsFix returns early without modifying anything (line 571-575 in web-compat.js). Tests like testNameOverride expect custom behavior (e.g., renaming push to notifications), but the browser's unchanged native API won't apply these overrides, causing test failures.


Please tell me if this was useful or not with a 👍 or 👎.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

4 participants