Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore reponses not associated with a tab. #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dvogel
Copy link

@dvogel dvogel commented Jan 8, 2025

This fixes #210 for me. The root cause seems to be that the relationship between frames and service workers has been contentious and shifty over time.

Based on my debugging, when the request to the SharePoint site for a page like https://...sharepoint.com/.../CollabHome.apsx is made, the response seen by JSONView has a header content-type: application/json. However, with JSONView disabled, in the browser dev tools network panel, that same response has a header content-type: text/html; charset=utf-8. This makes me suspect JSONView is seeing the response prior to it being transformed by the service worker.

The empty JSON responses I see from SharePoint do have tabId == -1 as mentioned in that linked report. Based on the discussion in that report though I'm not sure how stable that relationship will be. We could instead use a more direct workaround for the parsing issue by ignoring empty JSON documents. I tested that approach too and it does fix SharePoint sites for me. However, if I'm right about the service workers, then such a workaround would carry the risk of an empty JSON response being hydrated by a service worker into a non-empty JSON response that would then be ignored by JSONView. Something to keep in mind if the tabId == -1 condition ever stops working.

The same change should be applicable to the chrome code but I don't have a system on hand to test that right now.

@bhollis
Copy link
Owner

bhollis commented Jan 8, 2025

This is great! Let me test it with all the existing cases.

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.

Extension causes JSON parse error when loading SharePoint page
2 participants