fix(wallpaper): Revoke blob URL only after new one is set#209
Merged
Conversation
This comment was marked as spam.
This comment was marked as spam.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/wallpaper.js`:
- Around line 19-25: The function setBackground currently revokes currentBgUrl
before creating and applying the new object URL, risking loss of the background
if creation or application fails; change the order in setBackground so you first
call URL.createObjectURL(blob) to get newUrl, apply it via
document.body.style.setProperty("--bg-image", `url(${newUrl})`) and update
currentBgUrl, and only after successful creation/application call
URL.revokeObjectURL on the old currentBgUrl (using the existing currentBgUrl
variable), ensuring you reference the same identifiers (setBackground,
currentBgUrl, URL.createObjectURL, URL.revokeObjectURL,
document.body.style.setProperty).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9b8dc2b7-af6c-4d02-8585-dfaf4e68488e
📒 Files selected for processing (2)
CHANGELOG.mdscripts/wallpaper.js
14 tasks
Revoke old blob URL after updating background
e56cc96 to
db964a3
Compare
itz-rj-here
approved these changes
May 10, 2026
This was referenced Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed wallpaper disappearing on load due to blob URL being revoked too early
Closes #169
Supersedes #206
Overview
This PR fixes a bug where wallpapers could disappear on load because a background blob URL was revoked too early. The change ensures the old object URL is revoked only after a new one has been created and applied, preventing the race condition that made wallpaper images unavailable. This closes issue #169 and supersedes PR #206.
Changes
scripts/wallpaper.js
currentBgUrlto track the active background object URL.setBackground(blob)helper that:--bg-imageanddata-bg, then revokes the previous object URL (revocation occurs after the new URL is set).currentBgUrl.setBackground()instead of creating ad-hocURL.createObjectURLand manually revoking URLs.setBackground()(removed previous delayed-revocation logic).setBackground()and re-fetches daily random images when the stored timestamp is not from the current day.currentBgUrlbefore removing the--bg-imageCSS property and switching to color mode.checkAndUpdateImage()call to align with the refactored lifecycle.CHANGELOG.md
manifest.json / manifest(firefox).json
style.css
.shortcutSettingsEntry input::placeholder..shortcutInputRow:last-child.Problem Solved
Fixes issue #169: prevents automatic removal of user-set wallpapers by ensuring object URLs are revoked only after a new background has been applied. Wallpapers should now persist across browser sessions and days until changed by the user or the extension is reset/uninstalled.
Impact