feat: sandbox renderer processes for cross-origin frames (#18650)

This commit is contained in:
Milan Burda 2019-06-20 12:10:56 +02:00 committed by Alexey Kuzmin
parent 23286fe557
commit f3f2990b9e
8 changed files with 139 additions and 10 deletions

View file

@ -1213,6 +1213,18 @@ base::ProcessId WebContents::GetOSProcessID() const {
return base::GetProcId(process_handle);
}
base::ProcessId WebContents::GetOSProcessIdForFrame(
const std::string& name,
const std::string& document_url) const {
for (auto* frame : web_contents()->GetAllFrames()) {
if (frame->GetFrameName() == name &&
frame->GetLastCommittedURL().spec() == document_url) {
return base::GetProcId(frame->GetProcess()->GetProcess().Handle());
}
}
return base::kNullProcessId;
}
WebContents::Type WebContents::GetType() const {
return type_;
}
@ -2194,6 +2206,8 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
&WebContents::SetBackgroundThrottling)
.SetMethod("getProcessId", &WebContents::GetProcessID)
.SetMethod("getOSProcessId", &WebContents::GetOSProcessID)
.SetMethod("_getOSProcessIdForFrame",
&WebContents::GetOSProcessIdForFrame)
.SetMethod("equal", &WebContents::Equal)
.SetMethod("_loadURL", &WebContents::LoadURL)
.SetMethod("downloadURL", &WebContents::DownloadURL)