feat: sandbox renderer processes for cross-origin frames (#18650)
This commit is contained in:
parent
23286fe557
commit
f3f2990b9e
8 changed files with 139 additions and 10 deletions
|
@ -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)
|
||||
|
|
|
@ -138,6 +138,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
void SetBackgroundThrottling(bool allowed);
|
||||
int GetProcessID() const;
|
||||
base::ProcessId GetOSProcessID() const;
|
||||
base::ProcessId GetOSProcessIdForFrame(const std::string& name,
|
||||
const std::string& document_url) const;
|
||||
Type GetType() const;
|
||||
bool Equal(const WebContents* web_contents) const;
|
||||
void LoadURL(const GURL& url, const mate::Dictionary& options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue