Skip to content

Commit a4d6761

Browse files
committed
fix: address Copilot review comments
- service_worker.js: wrap skipWaiting() in event.waitUntil() so the install event cannot complete before skipWaiting resolves - firefox_version.py: use re.subn() and raise if no TAG line matched, preventing silent no-op updates if install-firefox.sh format changes - docs/Release-Checklist.md: replace manual Firefox-tag step and stale update.sh reference with the new update.py / firefox_version.py workflow
1 parent 8f7de1b commit a4d6761

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

docs/Release-Checklist.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
We aim to release a new version of OpenWPM with each new Firefox release (~1 release per month). The following steps are necessary for a release:
44

5-
1. Upgrade Firefox to the newest version.
6-
1. Go to: <https://hg.mozilla.org/releases/mozilla-release/tags>.
7-
2. Find the commit hash for the Firefox release version you'd like to upgrade to.
8-
3. Update the `TAG` variable in [`scripts/install-firefox.sh`](../scripts/install-firefox.sh#L12) to that hash and the comment to the new tag name.
5+
1. Run `python scripts/update.py` — this will:
6+
- Repin the conda environment
7+
- Bump all npm dependencies to their latest compatible versions
8+
- Rebuild the extension
9+
- Automatically detect and apply any new Firefox release to `scripts/install-firefox.sh`
910
2. Check if we can unpin our python version (this requires Linux to test) See <https://github.com/openwpm/OpenWPM/issues/1111>
10-
3. Run `./scripts/update.sh`
11+
3. Run `./scripts/install-firefox.sh` to install the updated Firefox locally and verify the test suite passes.
1112
4. Increment the version number in [VERSION](../VERSION)
1213
5. Add a summary of changes since the last version to [CHANGELOG](../CHANGELOG.md)
1314
6. Squash and merge the release PR to master.

scripts/firefox_version.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,16 @@ def update_if_needed() -> bool:
6666

6767
print(f"Updating Firefox: {current}{latest_tag}")
6868
text = INSTALL_SCRIPT.read_text()
69-
new_text = re.sub(
69+
new_text, count = re.subn(
7070
r"^TAG='[^']*' # .*$",
7171
f"TAG='{latest_hash}' # {latest_tag}",
7272
text,
7373
flags=re.MULTILINE,
7474
)
75+
if count == 0:
76+
raise RuntimeError(
77+
f"Failed to update TAG line in {INSTALL_SCRIPT}: no matching line found"
78+
)
7579
INSTALL_SCRIPT.write_text(new_text)
7680
print(f"Updated {INSTALL_SCRIPT.name} to {latest_tag} ({latest_hash})")
7781
print("Remember to run ./scripts/install-firefox.sh and test before releasing.")

test/test_pages/shared/service_worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var IMAGE_URL = 'http://localhost:8000/test_pages/shared/test_image_2.png';
22

33
self.addEventListener('install', function(event) {
44
// Skip the waiting phase so this worker activates immediately after install.
5-
self.skipWaiting();
5+
event.waitUntil(self.skipWaiting());
66
});
77

88
self.addEventListener('activate', function(event) {

0 commit comments

Comments
 (0)