Skip to content

Fix localStorage setPreference error on modern browsers#2

Open
HackerWand wants to merge 1 commit into
liriliri:mainfrom
HackerWand:patch-1
Open

Fix localStorage setPreference error on modern browsers#2
HackerWand wants to merge 1 commit into
liriliri:mainfrom
HackerWand:patch-1

Conversation

@HackerWand

Copy link
Copy Markdown

Modern browsers (e.g. Chrome 120+) enforce localStorage.length as a read-only property with only a getter. However, the DevTools frontend occasionally attempts to call setPreference('length', ...) during settings migration, causing a TypeError: "Cannot set property length of # which has only a getter".

This change skips setting localStorage['length'] in InspectorFrontendHostStub.setPreference, since length is automatically managed by the browser and should never be written manually.

Fixes remote debugging crash in tools like Chii when used with up-to-date browsers.

Modern browsers (e.g. Chrome 120+) enforce `localStorage.length` as a read-only property with only a getter.  
However, the DevTools frontend occasionally attempts to call `setPreference('length', ...)` during settings migration, causing a TypeError: "Cannot set property length of #<Storage> which has only a getter".

This change skips setting `localStorage['length']` in `InspectorFrontendHostStub.setPreference`, since `length` is automatically managed by the browser and should never be written manually.

Fixes remote debugging crash in tools like Chii when used with up-to-date browsers.
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.

1 participant