-
Notifications
You must be signed in to change notification settings - Fork 891
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
climb frame tree to determine top level eTLD+1 when generating farble seed #5877
Conversation
return ""; | ||
} | ||
|
||
return top_sec_ctx->GetSecurityOrigin()->RegistrableDomain().Utf8(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RegistrableDomain
is not what we want. See examples in https://url.spec.whatwg.org/#host-registrable-domain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
// are disconnect, remote or local to the top level frame. | ||
// | ||
// If the top level frame is not discoverable, an empty string is returned. | ||
std::string topETLDPlusOneForDoc(const Document& doc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method name should be capitalized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
const std::string host = top_sec_ctx->GetSecurityOrigin()->Host().Utf8(); | ||
return net::registry_controlled_domains::GetDomainAndRegistry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be using network_utils::GetDomainAndRegistry
in blink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okie, moved to network_utils::GetDomainAndRegistry
// frame that the given document is in. This includes frames that | ||
// are disconnect, remote or local to the top level frame. | ||
// | ||
// If the top level frame is not discoverable, an empty string is returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when does this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't know all the cases, but I updated the comment to include an example
// This can happen in cases including frames that are not connected | ||
// to the document, or iframes that are accessed while they're moving | ||
// between processes (e.g., a frame's url is being changed to | ||
// be LocalFrame to a RemoveFrame, or vise versa). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove -> Remote
std::string TopETLDPlusOneForDoc(const Document& doc) { | ||
const auto* top_loc_frame = doc.GetFrameOfMasterDocument(); | ||
if (top_loc_frame == nullptr) { | ||
LOG(ERROR) << "Unable to farble frame bc can't find top local frame: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have a DCHECK here to see if it's still happening with this change or do we still expect it to be null in some cases?
e8c429c
to
b093351
Compare
b093351
to
63d585b
Compare
climb frame tree to determine top level eTLD+1 when generating farble seed
climb frame tree to determine top level eTLD+1 when generating farble seed
This PR tries to solve a problem where we were using garbage memory sometimes when generating the farble seed, by trying to climb the frame tree. I hope i got it right…
Should fix brave/brave-browser#10260