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

Tizen 2016 TV's throw TypeError: JSON.stringify cannot serialize cyclic structures #935

Closed
chrisfillmore opened this issue Jul 19, 2017 · 2 comments
Assignees
Labels
platform: TV/STB Issues affecting smart TV or set-top box platforms status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@chrisfillmore
Copy link
Contributor

chrisfillmore commented Jul 19, 2017

In ConfigUtils.cloneObject, Shaka clones objects by doing JSON.parse(JSON.stringify(arg)).

In PlayheadObserver.cloneTimelineInfo_, Shaka clones a TimelineRegionInfo using ConfigUtils.cloneObject. There is even a helpful comment saying:

// cloneObject uses JSON to clone, which won't copy the DOM element.
copy.eventElement = source.eventElement;

On Tizen 2016 TV's, it appears that this is not the case. JSON.stringify will attempt to serialize cyclic structures (the DOM element), and throws a TypeError as a result.

Fwiw 2016 TV's report this navigator.userAgent string:

Mozilla/5.0 (SMART-TV; Linux; Tizen 2.4.0) AppleWebKit/538.1 (KHTML, like Gecko) Version/2.4.0 TV Safari/538.1

I don't mind putting together a PR to address this. Perhaps a different cloneObject implementation is warranted? One which detects circular structures and compensates? I'm open to suggestions.

@joeyparrish
Copy link
Member

Another clone implementation sounds reasonable. Using JSON.stringify is a giant hack anyway, so I don't mind seeing that go away.

@joeyparrish joeyparrish added type: enhancement New feature or request flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this labels Jul 19, 2017
@joeyparrish joeyparrish added this to the v2.3.0 milestone Jul 19, 2017
joeyparrish pushed a commit that referenced this issue Sep 26, 2017
Tizen 2016 throws when trying to use JSON to clone cyclic objects.  To
avoid this and to remove a hack to clone objects, this replaces it with
an explicit clone implementation.

Closes #935

Change-Id: Ia057e3f6853b813dd89fe33c291b558b71534726
@joeyparrish joeyparrish removed the flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this label Sep 26, 2017
@joeyparrish
Copy link
Member

The fix has been cherry-picked to v2.2.x and will be released in v2.2.2.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@joeyparrish joeyparrish added the platform: TV/STB Issues affecting smart TV or set-top box platforms label Jul 17, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: TV/STB Issues affecting smart TV or set-top box platforms status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants