Skip to content

fix: Failed to construct URL: Invalid URL at new URL #31502

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

Merged
merged 4 commits into from
Apr 9, 2025

Conversation

Teng-Web3
Copy link
Contributor

@Teng-Web3 Teng-Web3 commented Apr 2, 2025

Description

When go to certain websites the background console show error: "TypeError: Failed to construct 'URL': Invalid URL at new URL."

Root Cause:
Sometimes the website's initiator is "null", not null, so we will create URL object with Illegal string("null"):
屏幕截图 2025-04-01 230234

Solution:
Filter out "null" strings

Open in GitHub Codespaces

Related issues

Fixes: #31465

Manual testing steps

  1. Open the browser
  2. Open the background console
  3. Go to https://soundcloud.com/
  4. Check if the error "TypeError: Failed to construct 'URL': Invalid URL at new URL" shown.

Screenshots/Recordings

Before

before

After

after

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@Teng-Web3 Teng-Web3 marked this pull request as draft April 2, 2025 01:20
Copy link
Contributor

github-actions bot commented Apr 2, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@seaona seaona added the team-extension-platform Extension Platform team label Apr 3, 2025
@Teng-Web3 Teng-Web3 marked this pull request as ready for review April 5, 2025 16:30
@seaona
Copy link
Contributor

seaona commented Apr 9, 2025

thank you for your contribution @Teng-Web3 🙏 I've sync your PR with main and re-running the ci jobs now. I'll follow up on the results and share your PR for reviews

Copy link
Contributor

@MajorLift MajorLift left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your contribution.

@itsyoboieltr itsyoboieltr added this pull request to the merge queue Apr 9, 2025
Merged via the queue into MetaMask:main with commit 17b9874 Apr 9, 2025
167 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: TypeError: Failed to construct 'URL': Invalid URL at new URL
5 participants