testing-library / testing-playground

Simple and complete DOM testing playground that encourage good testing practices.

Home Page:https://testing-playground.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chrome extension doesn't work when third-party cookies are blocked

SebastienWae opened this issue Β· comments

Bug Report πŸ›

When third-party cookies are blocked in Chrome the main "Testing Playground" tab for the testing-playground extension doesn't work.
The tab is empty and the console return the error:
Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document

To Reproduce βœ”οΈ

  1. Install the testing-playground extension in Chrome
  2. Go to chrome://settings/cookies
  3. Select "Block third-party cookies"
  4. Re-load the extension
  5. The Elements tab is working but the main "Testing Playground" tab is empty.

Expected behavior πŸ€”

The extension should try to work without localStorage if possible and display an error message informing the user to enable third-party cookies if required.

Suggested solution πŸ”¦

Looking at issues from other extensions (like bvaughn/react-devtools-experimental#292) the only solution is to wrap all calls to localStorage or sessionStorage in a try/catch.

Your Environment πŸ’»

  • browser: Chrome
  • os: Mac, Linux

Hi @SebastienWae thanks for reaching us :).

You're right, localStorage is used to save user settings like testid attribute and auto-run option to make them persistent even if you refresh the page.

I think that we could simply check the navigator.cookieEnabled property and save only in the case the cookies are enabled

We've fixed it in the current develop version. The chrome extension in the store will be updated asap.

commented

Hi ! It seems the chrome extension in the store is still not updated (latest release is from July). Can you eventually push a newer release ? It is frustrating to have a painful bug fixed but not deployed

Sorry, this slipped my mind. I've submitted the new version to the Chrome store, and we're waiting for review by the Chrome team. Usually, this will happen in just a few days. I don't know how the holidays will affect this, but please ping me here if the update isn't available in a few days.

The extension has been published! πŸŽ‰ Please let me know if the problem persists.

commented

Problem fixed, thanks a lot πŸ™