Skip to content

Injected code unnecessarily clobbers external browser console.logs #508

@andreamah

Description

@andreamah

creating this issue to accompany the PR at #503

What createConsoleOverride does is just to call postParentMessage before calling console output methods, but if window.parent === window postParentMessage does nothing, so should we override console only if window.parent !== window? At least this fixes the issue in external browser.

Repro steps:

  1. Open a preview in an external window.
  2. console.log some text in your code.
  3. devtools console shows the line number in the injected script rather than where it is in user code 🐛

This is related to #449, but this can be easily fixed in the external browser because the console doesn't need to be overridden. In this particular case, we can easily identify this as an external browser because the window parent is itself.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions