Skip to content

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

Closed
@chrisfillmore

Description

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.

Metadata

Assignees

Labels

platform: TV/STBIssues affecting smart TV or set-top box platformsstatus: archivedArchived and locked; will not be updatedtype: enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions