Skip to content
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

src/preact: use URL instead of parseUrlDeprecated #37561

Merged
merged 3 commits into from
Feb 4, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/preact/component/3p-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
getBootstrapUrl,
getDefaultBootstrapBaseUrl,
} from '../../3p-frame';
import {parseUrlDeprecated} from '../../url';

/** @type {Object<string,function():void>} 3p frames for that type. */
export const countGenerators = {};
Expand Down Expand Up @@ -105,7 +104,7 @@ function ProxyIframeEmbedWithRef(
};
setNameAndSrc({
name: JSON.stringify({
'host': parseUrlDeprecated(src).hostname,
'host': new URL(src, win.location).hostname,
Copy link
Contributor

Choose a reason for hiding this comment

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

Techincally, but does TS not yell at you? The second arg needs to be a string, but location gets coerced to a string so it works in regular JS.

Copy link
Member Author

Choose a reason for hiding this comment

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

preact/component/*.js isnt' being typechecked yet. that will happen once this lands: #37463

Will preemptively call .toString() here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you're looking for .href… 😝

'bootstrap': getBootstrapUrl(type),
'type': type,
// "name" must be unique across iframes, so we add a count.
Expand Down