Skip to content

Fix page crashes while logging large objects  #19

Open
@Thejus-Paul

Description

@Thejus-Paul

During testing, I encountered two issues:

  1. We are currently stringifying values only if they are instances of window or document objects in @bigbinary/console-feed. When I clone the window.parent object as shown below and attempt to log it, the page crashes. While this scenario is not common, it illustrates that if a user were to copy and paste a large JavaScript object with circular dependencies, the current logic would fail.

    const windowParent = structuredClone(window.parent);
    console.log(windowParent);
  2. Even when logging the stringified value of a window or document object, each code change appends this large stringified value to the current log history, eventually causing the page to hang.

To address this, we either need to truncate the large stringified output (which would undermine the purpose of logging the entire object) or programmatically clear the console when detecting a large object in the current log history. Please investigate.

Metadata

Metadata

Assignees

Labels

low-priorityOther open issues can be taken up before this one

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions