Skip to content

Gates console.warn statements behind debug flag in Duck Player Native #1861

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

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

Conversation

mgurgel
Copy link
Contributor

@mgurgel mgurgel commented Jul 29, 2025

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/1203249713006009/task/1210889176929371?focus=true

Description

Duck Player Native was sending console.warn messages when not in debug mode.

Testing Steps

  • Run locally on a browser that doesn't support Duck Player Native (anything but iOS)
  • Set Duck Player to ASK
  • Visit a YouTube video e.g. https://www.youtube.com/watch?v=8BXd47ni7VU
  • Check the console unexpected console.warn messages such as Failed to get initial setup

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

@mgurgel mgurgel requested a review from a team as a code owner July 29, 2025 15:22
@mgurgel mgurgel self-assigned this Jul 29, 2025
Copy link

netlify bot commented Jul 29, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit e06d42c
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/688cc8fcee5fed0008c82854
😎 Deploy Preview https://deploy-preview-1861--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mgurgel mgurgel requested a review from Copilot July 29, 2025 15:22
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR gates console.warn statements behind a debug flag in the Duck Player Native feature to prevent unnecessary warning messages from appearing in the console for users on browsers that don't support the feature.

  • Wraps existing console.warn statements with debug flag checks
  • Changes one console.warn to use logger.warn for consistency
  • Prevents console spam for users on unsupported browsers when Duck Player is enabled

@@ -103,7 +103,7 @@ export class DuckPlayerNativeFeature extends ContentFeature {
break;
case 'UNKNOWN':
default:
console.warn('No known pageType');
logger.warn('No known pageType');
Copy link
Preview

Copilot AI Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line uses logger.warn while the other warning statements in this PR use console.warn with debug checks. For consistency, this should either be if (this.isDebug) console.warn('No known pageType'); or all warning statements should use the logger approach with appropriate debug level configuration.

Suggested change
logger.warn('No known pageType');
if (this.isDebug) console.warn('No known pageType');

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgurgel following this advise, is there a reason not to switch to the logger you have? (assuming that is gated)

@mgurgel mgurgel force-pushed the mgurgel/gate-console-warn branch from ae56308 to 053bd84 Compare July 29, 2025 15:23
Copy link

github-actions bot commented Jul 29, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

@mgurgel mgurgel requested a review from shakyShane July 29, 2025 15:23
Copy link

github-actions bot commented Jul 29, 2025

[Beta] Generated file diff

Time updated: Fri, 01 Aug 2025 14:03:34 GMT

Apple
    - apple/contentScope.js
  • apple/contentScopeIsolated.js

File has changed

Integration
    - integration/contentScope.js

File has changed

cursor[bot]

This comment was marked as outdated.

@mgurgel mgurgel force-pushed the mgurgel/gate-console-warn branch from 053bd84 to e06d42c Compare August 1, 2025 14:02
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.

2 participants