chore: bump chromium to 105.0.5129.0 (main) (#34403)
* chore: bump chromium in DEPS to 104.0.5096.0 * 3651284: Use the entry settings object for window.open navigation3651284
* 3644598: Make RenderFrameHost used for notification permission decision3644598
* 3642842: Window Placement: Prototype Fullscreen Capability Delegation - Part 23642842
* 3652785: [sandbox] Enable sandboxed pointers on sanitizer builds3652785
* 3611967: webhid: Migrate HidDelegate to use BrowserContext and Origin3611967
* 3665762: Remove RenderFrameHost::IsRenderFrameCreated from //content/.3665762
* 3659375: Fold x509_util_ios and most of x509_util_mac into x509_util_apple3659375
* 3656234: [CodeHealth] Remove uses of base::ListValue::Append() (Final, take 2)3656234
* chore: update patch indices * chore: fix lint * 3644598: Make RenderFrameHost used for notification permission decision3644598
* webhid: Migrate HidDelegate to use BrowserContext and Origin This is a temporary fix for3611967
to get the build compiling, but we need to either patch around3611967
or move our device permissioning to BrowserContext * chore: fix lint * build: run electron/script/gen-libc++-filenames.js fixes gn check * chore: bump chromium in DEPS to 104.0.5098.0 * chore: disable flaking tests * 3682394: Change pipes surrounding code references in comments to backticks3682394
* 3652749: Delete GLRenderer and related classes3652749
* chore: fixup patch indices * 3671199: Remove ContentMainDelegate::PostFieldTrialInitialization3671199
* 3607963: hid: Do not exclude HID device with no collections3607963
* refactor: use ElectronBrowserContext instead of WebContents to persist devices due to changes like3611967
, we can no longer use WebContents to store device permissions so this commit moves device permission storage to live in memory in ElectronBrowserContext instead. * 3557253: Deprecate some signature checks3557253
* chore: bump chromium in DEPS to 104.0.5100.0 * 3680781: Add policy for Renderer App Container.3680781
* chore: update patch indices * 3675465: Update NetLog network service API to use mojom::DictionaryValue.3675465
* chore: bump chromium in DEPS to 104.0.5102.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5103.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5104.0 * chore: update patches * fix: add patch for DCHECK in fullscreen test * build: fix nan build * build: make the nan spec runner work on macOS * chore: bump chromium in DEPS to 104.0.5106.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5108.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5110.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5112.0 * chore: bump chromium in DEPS to 105.0.5113.0 * chore: bump chromium in DEPS to 105.0.5115.0 * chore: bump chromium in DEPS to 105.0.5117.0 * chore: update patches * chore: update libcpp patch * 3693745: Delete base::LowerCaseEqualsASCII() Ref:3693745
* 3669226: Remove printing PostTask usage of IO thread Ref:3669226
* 3687395: Remove DictionaryValue::HasKey(). Ref:3687395
* 3691014: Prevent unsafe narrowing: ui/accessibility, part 2 Ref:3691014
* 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. Ref:3560567
* 3684873: [Bluetooth][Win/Linux] Add bluetooth pair confirmation prompt3684873
* chore: bump chromium in DEPS to 105.0.5119.0 * chore: missing includes in desktop_notification_controller * chore: update patches * 3685951: Reland "Make sure screen object is created once in tests."3685951
* fixup: Reland "Make sure screen object is created once in tests." * 3646014: [API] Deprecate LegacyOOMErrorCallback Ref:3646014
* chore: bump chromium in DEPS to 105.0.5121.0 * chore: update patches * 3699085: [cleanup] update PrintBackend::EnumeratePrinters to use reference Ref:3699085
* chore: bump chromium in DEPS to 105.0.5123.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5125.0 * chore: update patches * 3630082: [sandbox] Also enable the sandbox outside of Chromium builds Ref:3630082
* chore: bump chromium in DEPS to 105.0.5127.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5129.0 * chore: update patches * 3703741: Remove WebContents::GetMainFrame.3703741
* chore: update patches * fixup! 3703741: Remove WebContents::GetMainFrame. * fix lint * more lint * chore: document breaking change * 3687671: [v8] Freeze flags after initialization3687671
* fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. * use the v8 allocator for node serdes * chore: update patches * remove faulty non-v8-sandbox-compatible code * make NodeArrayBufferAllocator use the v8 allocator under the hood * fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. * fix build on windows * 3691954: [Reland][Extensions Bindings] Validate arguments sent to API events3691954
* chore: remove deprecated AccessorSignatures https://github.com/nodejs/nan/pull/941 * Update patches/chromium/notification_provenance.patch Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * remove chore_expose_v8_initialization_isolate_callbacks.patch * add link to nodejs/nan#941 * 52026: Do not allow md4 or md5 based signatures in X.509 certificates. https://boringssl-review.googlesource.com/c/boringssl/+/52026 * chore: update patches * disable nan buffer-test * disable sandboxed pointers for now * force sandboxed pointers off * improve node allocation patch * restore accidentally dropped node crypto test patch Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@salesforce.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
This commit is contained in:
parent
032e1d9bef
commit
e86d1cba75
144 changed files with 1906 additions and 1231 deletions
|
@ -103,40 +103,20 @@ class DataPipeReader {
|
|||
}
|
||||
|
||||
void OnSuccess() {
|
||||
// Pass the buffer to JS.
|
||||
//
|
||||
// Note that the lifetime of the native buffer belongs to us, and we will
|
||||
// free memory when JS buffer gets garbage collected.
|
||||
// Copy the buffer to JS.
|
||||
// TODO(nornagon): make this zero-copy by allocating the array buffer
|
||||
// inside the sandbox
|
||||
v8::HandleScope handle_scope(promise_.isolate());
|
||||
#if defined(V8_SANDBOX)
|
||||
v8::Local<v8::Value> buffer =
|
||||
node::Buffer::Copy(promise_.isolate(), &buffer_.front(), buffer_.size())
|
||||
.ToLocalChecked();
|
||||
promise_.Resolve(buffer);
|
||||
#else
|
||||
v8::Local<v8::Value> buffer =
|
||||
node::Buffer::New(promise_.isolate(), &buffer_.front(), buffer_.size(),
|
||||
&DataPipeReader::FreeBuffer, this)
|
||||
.ToLocalChecked();
|
||||
promise_.Resolve(buffer);
|
||||
#endif
|
||||
|
||||
// Destroy data pipe.
|
||||
handle_watcher_.Cancel();
|
||||
#if defined(V8_SANDBOX)
|
||||
delete this;
|
||||
#else
|
||||
data_pipe_.reset();
|
||||
data_pipe_getter_.reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(V8_SANDBOX)
|
||||
static void FreeBuffer(char* data, void* self) {
|
||||
delete static_cast<DataPipeReader*>(self);
|
||||
}
|
||||
#endif
|
||||
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise_;
|
||||
|
||||
mojo::Remote<network::mojom::DataPipeGetter> data_pipe_getter_;
|
||||
|
|
|
@ -132,9 +132,8 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
|
|||
auto command_line_string =
|
||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString();
|
||||
auto channel_string = std::string("Electron " ELECTRON_VERSION);
|
||||
base::Value custom_constants =
|
||||
base::Value::FromUniquePtrValue(net_log::GetPlatformConstantsForNetLog(
|
||||
command_line_string, channel_string));
|
||||
base::Value::Dict custom_constants = net_log::GetPlatformConstantsForNetLog(
|
||||
command_line_string, channel_string);
|
||||
|
||||
auto* network_context =
|
||||
browser_context_->GetDefaultStoragePartition()->GetNetworkContext();
|
||||
|
@ -156,7 +155,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
|
|||
|
||||
void NetLog::StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode,
|
||||
uint64_t max_file_size,
|
||||
base::Value custom_constants,
|
||||
base::Value::Dict custom_constants,
|
||||
base::File output_file) {
|
||||
if (!net_log_exporter_) {
|
||||
// Theoretically the mojo pipe could have been closed by the time we get
|
||||
|
@ -204,7 +203,7 @@ v8::Local<v8::Promise> NetLog::StopLogging(gin::Arguments* args) {
|
|||
// pointer lives long enough to resolve the promise. Moving it into the
|
||||
// callback will cause the instance variable to become empty.
|
||||
net_log_exporter_->Stop(
|
||||
base::Value(base::Value::Type::DICTIONARY),
|
||||
base::Value::Dict(),
|
||||
base::BindOnce(
|
||||
[](mojo::Remote<network::mojom::NetLogExporter>,
|
||||
gin_helper::Promise<void> promise, int32_t error) {
|
||||
|
|
|
@ -57,7 +57,7 @@ class NetLog : public gin::Wrappable<NetLog> {
|
|||
|
||||
void StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode,
|
||||
uint64_t max_file_size,
|
||||
base::Value custom_constants,
|
||||
base::Value::Dict custom_constants,
|
||||
base::File output_file);
|
||||
void NetLogStarted(int32_t error);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ printing::PrinterList GetPrinterList(v8::Isolate* isolate) {
|
|||
{
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
printing::mojom::ResultCode code =
|
||||
print_backend->EnumeratePrinters(&printers);
|
||||
print_backend->EnumeratePrinters(printers);
|
||||
if (code != printing::mojom::ResultCode::kSuccess)
|
||||
LOG(INFO) << "Failed to enumerate printers";
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ v8::Local<v8::Promise> GetPrinterListAsync(v8::Isolate* isolate) {
|
|||
auto print_backend = printing::PrintBackend::CreateInstance(
|
||||
g_browser_process->GetApplicationLocale());
|
||||
printing::mojom::ResultCode code =
|
||||
print_backend->EnumeratePrinters(&printers);
|
||||
print_backend->EnumeratePrinters(printers);
|
||||
if (code != printing::mojom::ResultCode::kSuccess)
|
||||
LOG(INFO) << "Failed to enumerate printers";
|
||||
return printers;
|
||||
|
|
|
@ -451,7 +451,7 @@ std::pair<std::string, std::u16string> GetDefaultPrinterAsync() {
|
|||
// Check for existing printers and pick the first one should it exist.
|
||||
if (printer_name.empty()) {
|
||||
printing::PrinterList printers;
|
||||
if (print_backend->EnumeratePrinters(&printers) !=
|
||||
if (print_backend->EnumeratePrinters(printers) !=
|
||||
printing::mojom::ResultCode::kSuccess)
|
||||
return std::make_pair("Failed to enumerate printers", std::u16string());
|
||||
if (!printers.empty())
|
||||
|
@ -944,12 +944,6 @@ void WebContents::InitWithWebContents(
|
|||
}
|
||||
|
||||
WebContents::~WebContents() {
|
||||
// clear out objects that have been granted permissions so that when
|
||||
// WebContents::RenderFrameDeleted is called as a result of WebContents
|
||||
// destruction it doesn't try to clear out a granted_devices_
|
||||
// on a destructed object.
|
||||
granted_devices_.clear();
|
||||
|
||||
if (!inspectable_web_contents_) {
|
||||
WebContentsDestroyed();
|
||||
return;
|
||||
|
@ -1557,11 +1551,6 @@ void WebContents::RenderFrameDeleted(
|
|||
// is swapped by content::RenderFrameHostManager.
|
||||
//
|
||||
|
||||
// clear out objects that have been granted permissions
|
||||
if (!granted_devices_.empty()) {
|
||||
granted_devices_.erase(render_frame_host->GetFrameTreeNodeId());
|
||||
}
|
||||
|
||||
// WebFrameMain::FromRenderFrameHost(rfh) will use the RFH's FrameTreeNode ID
|
||||
// to find an existing instance of WebFrameMain. During a cross-origin
|
||||
// navigation, the deleted RFH will be the old host which was swapped out. In
|
||||
|
@ -1771,7 +1760,7 @@ void WebContents::Invoke(
|
|||
|
||||
void WebContents::OnFirstNonEmptyLayout(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
if (render_frame_host == web_contents()->GetMainFrame()) {
|
||||
if (render_frame_host == web_contents()->GetPrimaryMainFrame()) {
|
||||
Emit("ready-to-show");
|
||||
}
|
||||
}
|
||||
|
@ -2088,7 +2077,7 @@ bool WebContents::GetBackgroundThrottling() const {
|
|||
void WebContents::SetBackgroundThrottling(bool allowed) {
|
||||
background_throttling_ = allowed;
|
||||
|
||||
auto* rfh = web_contents()->GetMainFrame();
|
||||
auto* rfh = web_contents()->GetPrimaryMainFrame();
|
||||
if (!rfh)
|
||||
return;
|
||||
|
||||
|
@ -2110,12 +2099,15 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
|
|||
}
|
||||
|
||||
int WebContents::GetProcessID() const {
|
||||
return web_contents()->GetMainFrame()->GetProcess()->GetID();
|
||||
return web_contents()->GetPrimaryMainFrame()->GetProcess()->GetID();
|
||||
}
|
||||
|
||||
base::ProcessId WebContents::GetOSProcessID() const {
|
||||
base::ProcessHandle process_handle =
|
||||
web_contents()->GetMainFrame()->GetProcess()->GetProcess().Handle();
|
||||
base::ProcessHandle process_handle = web_contents()
|
||||
->GetPrimaryMainFrame()
|
||||
->GetProcess()
|
||||
->GetProcess()
|
||||
.Handle();
|
||||
return base::GetProcId(process_handle);
|
||||
}
|
||||
|
||||
|
@ -2311,7 +2303,7 @@ void WebContents::SetWebRTCIPHandlingPolicy(
|
|||
|
||||
std::string WebContents::GetMediaSourceID(
|
||||
content::WebContents* request_web_contents) {
|
||||
auto* frame_host = web_contents()->GetMainFrame();
|
||||
auto* frame_host = web_contents()->GetPrimaryMainFrame();
|
||||
if (!frame_host)
|
||||
return std::string();
|
||||
|
||||
|
@ -2321,7 +2313,7 @@ std::string WebContents::GetMediaSourceID(
|
|||
content::WebContentsMediaCaptureId(frame_host->GetProcess()->GetID(),
|
||||
frame_host->GetRoutingID()));
|
||||
|
||||
auto* request_frame_host = request_web_contents->GetMainFrame();
|
||||
auto* request_frame_host = request_web_contents->GetPrimaryMainFrame();
|
||||
if (!request_frame_host)
|
||||
return std::string();
|
||||
|
||||
|
@ -2453,7 +2445,7 @@ void WebContents::EnableDeviceEmulation(
|
|||
return;
|
||||
|
||||
DCHECK(web_contents());
|
||||
auto* frame_host = web_contents()->GetMainFrame();
|
||||
auto* frame_host = web_contents()->GetPrimaryMainFrame();
|
||||
if (frame_host) {
|
||||
auto* widget_host_impl = static_cast<content::RenderWidgetHostImpl*>(
|
||||
frame_host->GetView()->GetRenderWidgetHost());
|
||||
|
@ -2469,7 +2461,7 @@ void WebContents::DisableDeviceEmulation() {
|
|||
return;
|
||||
|
||||
DCHECK(web_contents());
|
||||
auto* frame_host = web_contents()->GetMainFrame();
|
||||
auto* frame_host = web_contents()->GetPrimaryMainFrame();
|
||||
if (frame_host) {
|
||||
auto* widget_host_impl = static_cast<content::RenderWidgetHostImpl*>(
|
||||
frame_host->GetView()->GetRenderWidgetHost());
|
||||
|
@ -2632,7 +2624,7 @@ void WebContents::OnGetDefaultPrinter(
|
|||
auto* focused_frame = web_contents()->GetFocusedFrame();
|
||||
auto* rfh = focused_frame && focused_frame->HasSelection()
|
||||
? focused_frame
|
||||
: web_contents()->GetMainFrame();
|
||||
: web_contents()->GetPrimaryMainFrame();
|
||||
|
||||
print_view_manager->PrintNow(rfh, silent, std::move(print_settings),
|
||||
std::move(print_callback));
|
||||
|
@ -2839,10 +2831,10 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
|
|||
|
||||
absl::variant<printing::mojom::PrintPagesParamsPtr, std::string>
|
||||
print_pages_params = print_to_pdf::GetPrintPagesParams(
|
||||
web_contents()->GetMainFrame()->GetLastCommittedURL(), landscape,
|
||||
display_header_footer, print_background, scale, paper_width,
|
||||
paper_height, margin_top, margin_bottom, margin_left, margin_right,
|
||||
absl::make_optional(header_template),
|
||||
web_contents()->GetPrimaryMainFrame()->GetLastCommittedURL(),
|
||||
landscape, display_header_footer, print_background, scale,
|
||||
paper_width, paper_height, margin_top, margin_bottom, margin_left,
|
||||
margin_right, absl::make_optional(header_template),
|
||||
absl::make_optional(footer_template), prefer_css_page_size);
|
||||
|
||||
if (absl::holds_alternative<std::string>(print_pages_params)) {
|
||||
|
@ -2861,7 +2853,7 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
|
|||
absl::get<printing::mojom::PrintPagesParamsPtr>(print_pages_params));
|
||||
params->params->document_cookie = unique_id.value_or(0);
|
||||
|
||||
manager->PrintToPdf(web_contents()->GetMainFrame(), page_ranges,
|
||||
manager->PrintToPdf(web_contents()->GetPrimaryMainFrame(), page_ranges,
|
||||
std::move(params),
|
||||
base::BindOnce(&WebContents::OnPDFCreated, GetWeakPtr(),
|
||||
std::move(promise)));
|
||||
|
@ -2993,7 +2985,7 @@ void WebContents::ShowDefinitionForSelection() {
|
|||
}
|
||||
|
||||
void WebContents::CopyImageAt(int x, int y) {
|
||||
auto* const host = web_contents()->GetMainFrame();
|
||||
auto* const host = web_contents()->GetPrimaryMainFrame();
|
||||
if (host)
|
||||
host->CopyImageAt(x, y);
|
||||
}
|
||||
|
@ -3159,7 +3151,7 @@ v8::Local<v8::Promise> WebContents::CapturePage(gin::Arguments* args) {
|
|||
// If the view's renderer is suspended this may fail on Windows/Linux -
|
||||
// bail if so. See CopyFromSurface in
|
||||
// content/public/browser/render_widget_host_view.h.
|
||||
auto* rfh = web_contents()->GetMainFrame();
|
||||
auto* rfh = web_contents()->GetPrimaryMainFrame();
|
||||
if (rfh &&
|
||||
rfh->GetVisibilityState() == blink::mojom::PageVisibilityState::kHidden) {
|
||||
promise.Resolve(gfx::Image());
|
||||
|
@ -3437,11 +3429,11 @@ v8::Local<v8::Value> WebContents::Debugger(v8::Isolate* isolate) {
|
|||
}
|
||||
|
||||
content::RenderFrameHost* WebContents::MainFrame() {
|
||||
return web_contents()->GetMainFrame();
|
||||
return web_contents()->GetPrimaryMainFrame();
|
||||
}
|
||||
|
||||
void WebContents::NotifyUserActivation() {
|
||||
content::RenderFrameHost* frame = web_contents()->GetMainFrame();
|
||||
content::RenderFrameHost* frame = web_contents()->GetPrimaryMainFrame();
|
||||
if (frame)
|
||||
frame->NotifyUserActivation(
|
||||
blink::mojom::UserActivationNotificationType::kInteraction);
|
||||
|
@ -3457,7 +3449,7 @@ v8::Local<v8::Promise> WebContents::GetProcessMemoryInfo(v8::Isolate* isolate) {
|
|||
gin_helper::Promise<gin_helper::Dictionary> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto* frame_host = web_contents()->GetMainFrame();
|
||||
auto* frame_host = web_contents()->GetPrimaryMainFrame();
|
||||
if (!frame_host) {
|
||||
promise.RejectWithErrorMessage("Failed to create memory dump");
|
||||
return handle;
|
||||
|
@ -3487,13 +3479,13 @@ v8::Local<v8::Promise> WebContents::TakeHeapSnapshot(
|
|||
return handle;
|
||||
}
|
||||
|
||||
auto* frame_host = web_contents()->GetMainFrame();
|
||||
auto* frame_host = web_contents()->GetPrimaryMainFrame();
|
||||
if (!frame_host) {
|
||||
promise.RejectWithErrorMessage("takeHeapSnapshot failed");
|
||||
return handle;
|
||||
}
|
||||
|
||||
if (!frame_host->IsRenderFrameCreated()) {
|
||||
if (!frame_host->IsRenderFrameLive()) {
|
||||
promise.RejectWithErrorMessage("takeHeapSnapshot failed");
|
||||
return handle;
|
||||
}
|
||||
|
@ -3521,132 +3513,6 @@ v8::Local<v8::Promise> WebContents::TakeHeapSnapshot(
|
|||
return handle;
|
||||
}
|
||||
|
||||
void WebContents::GrantDevicePermission(
|
||||
const url::Origin& origin,
|
||||
const base::Value* device,
|
||||
blink::PermissionType permission_type,
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
granted_devices_[render_frame_host->GetFrameTreeNodeId()][permission_type]
|
||||
[origin]
|
||||
.push_back(
|
||||
std::make_unique<base::Value>(device->Clone()));
|
||||
}
|
||||
|
||||
void WebContents::RevokeDevicePermission(
|
||||
const url::Origin& origin,
|
||||
const base::Value* device,
|
||||
blink::PermissionType permission_type,
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
const auto& devices_for_frame_host_it =
|
||||
granted_devices_.find(render_frame_host->GetFrameTreeNodeId());
|
||||
if (devices_for_frame_host_it == granted_devices_.end())
|
||||
return;
|
||||
|
||||
const auto& current_devices_it =
|
||||
devices_for_frame_host_it->second.find(permission_type);
|
||||
if (current_devices_it == devices_for_frame_host_it->second.end())
|
||||
return;
|
||||
|
||||
const auto& origin_devices_it = current_devices_it->second.find(origin);
|
||||
if (origin_devices_it == current_devices_it->second.end())
|
||||
return;
|
||||
|
||||
for (auto it = origin_devices_it->second.begin();
|
||||
it != origin_devices_it->second.end();) {
|
||||
if (DoesDeviceMatch(device, it->get(), permission_type)) {
|
||||
it = origin_devices_it->second.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WebContents::DoesDeviceMatch(const base::Value* device,
|
||||
const base::Value* device_to_compare,
|
||||
blink::PermissionType permission_type) {
|
||||
if (permission_type ==
|
||||
static_cast<blink::PermissionType>(
|
||||
WebContentsPermissionHelper::PermissionType::HID)) {
|
||||
if (device->GetDict().FindInt(kHidVendorIdKey) !=
|
||||
device_to_compare->GetDict().FindInt(kHidVendorIdKey) ||
|
||||
device->GetDict().FindInt(kHidProductIdKey) !=
|
||||
device_to_compare->GetDict().FindInt(kHidProductIdKey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto* serial_number =
|
||||
device_to_compare->GetDict().FindString(kHidSerialNumberKey);
|
||||
const auto* device_serial_number =
|
||||
device->GetDict().FindString(kHidSerialNumberKey);
|
||||
|
||||
if (serial_number && device_serial_number &&
|
||||
*device_serial_number == *serial_number)
|
||||
return true;
|
||||
} else if (permission_type ==
|
||||
static_cast<blink::PermissionType>(
|
||||
WebContentsPermissionHelper::PermissionType::SERIAL)) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
const auto* instance_id =
|
||||
device->GetDict().FindString(kDeviceInstanceIdKey);
|
||||
const auto* port_instance_id =
|
||||
device_to_compare->GetDict().FindString(kDeviceInstanceIdKey);
|
||||
if (instance_id && port_instance_id && *instance_id == *port_instance_id)
|
||||
return true;
|
||||
#else
|
||||
const auto* serial_number = device->GetDict().FindString(kSerialNumberKey);
|
||||
const auto* port_serial_number =
|
||||
device_to_compare->GetDict().FindString(kSerialNumberKey);
|
||||
if (device->GetDict().FindInt(kVendorIdKey) !=
|
||||
device_to_compare->GetDict().FindInt(kVendorIdKey) ||
|
||||
device->GetDict().FindInt(kProductIdKey) !=
|
||||
device_to_compare->GetDict().FindInt(kProductIdKey) ||
|
||||
(serial_number && port_serial_number &&
|
||||
*port_serial_number != *serial_number)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
const auto* usb_driver_key = device->GetDict().FindString(kUsbDriverKey);
|
||||
const auto* port_usb_driver_key =
|
||||
device_to_compare->GetDict().FindString(kUsbDriverKey);
|
||||
if (usb_driver_key && port_usb_driver_key &&
|
||||
*usb_driver_key != *port_usb_driver_key) {
|
||||
return false;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
return true;
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WebContents::CheckDevicePermission(
|
||||
const url::Origin& origin,
|
||||
const base::Value* device,
|
||||
blink::PermissionType permission_type,
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
const auto& devices_for_frame_host_it =
|
||||
granted_devices_.find(render_frame_host->GetFrameTreeNodeId());
|
||||
if (devices_for_frame_host_it == granted_devices_.end())
|
||||
return false;
|
||||
|
||||
const auto& current_devices_it =
|
||||
devices_for_frame_host_it->second.find(permission_type);
|
||||
if (current_devices_it == devices_for_frame_host_it->second.end())
|
||||
return false;
|
||||
|
||||
const auto& origin_devices_it = current_devices_it->second.find(origin);
|
||||
if (origin_devices_it == current_devices_it->second.end())
|
||||
return false;
|
||||
|
||||
for (const auto& device_to_compare : origin_devices_it->second) {
|
||||
if (DoesDeviceMatch(device, device_to_compare.get(), permission_type))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void WebContents::UpdatePreferredSize(content::WebContents* web_contents,
|
||||
const gfx::Size& pref_size) {
|
||||
Emit("preferred-size-changed", pref_size);
|
||||
|
@ -3784,7 +3650,8 @@ void WebContents::DevToolsRequestFileSystems() {
|
|||
|
||||
base::ListValue file_system_value;
|
||||
for (const auto& file_system : file_systems)
|
||||
file_system_value.Append(CreateFileSystemValue(file_system));
|
||||
file_system_value.Append(
|
||||
base::Value::FromUniquePtrValue(CreateFileSystemValue(file_system)));
|
||||
inspectable_web_contents_->CallClientFunction(
|
||||
"DevToolsAPI.fileSystemsLoaded", &file_system_value, nullptr, nullptr);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "shell/common/gin_helper/constructible.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/pinnable.h"
|
||||
#include "third_party/blink/public/common/permissions/permission_utils.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
|
||||
|
@ -95,11 +94,6 @@ class OffScreenWebContentsView;
|
|||
|
||||
namespace api {
|
||||
|
||||
using DevicePermissionMap = std::map<
|
||||
int,
|
||||
std::map<blink::PermissionType,
|
||||
std::map<url::Origin, std::vector<std::unique_ptr<base::Value>>>>>;
|
||||
|
||||
// Wrapper around the content::WebContents.
|
||||
class WebContents : public ExclusiveAccessContext,
|
||||
public gin::Wrappable<WebContents>,
|
||||
|
@ -438,28 +432,6 @@ class WebContents : public ExclusiveAccessContext,
|
|||
|
||||
void SetImageAnimationPolicy(const std::string& new_policy);
|
||||
|
||||
// Grants |origin| access to |device|.
|
||||
// To be used in place of ObjectPermissionContextBase::GrantObjectPermission.
|
||||
void GrantDevicePermission(const url::Origin& origin,
|
||||
const base::Value* device,
|
||||
blink::PermissionType permissionType,
|
||||
content::RenderFrameHost* render_frame_host);
|
||||
|
||||
// Revokes |origin| access to |device|.
|
||||
// To be used in place of ObjectPermissionContextBase::RevokeObjectPermission.
|
||||
void RevokeDevicePermission(const url::Origin& origin,
|
||||
const base::Value* device,
|
||||
blink::PermissionType permission_type,
|
||||
content::RenderFrameHost* render_frame_host);
|
||||
|
||||
// Returns the list of devices that |origin| has been granted permission to
|
||||
// access. To be used in place of
|
||||
// ObjectPermissionContextBase::GetGrantedObjects.
|
||||
bool CheckDevicePermission(const url::Origin& origin,
|
||||
const base::Value* device,
|
||||
blink::PermissionType permissionType,
|
||||
content::RenderFrameHost* render_frame_host);
|
||||
|
||||
// disable copy
|
||||
WebContents(const WebContents&) = delete;
|
||||
WebContents& operator=(const WebContents&) = delete;
|
||||
|
@ -755,10 +727,6 @@ class WebContents : public ExclusiveAccessContext,
|
|||
// Update the html fullscreen flag in both browser and renderer.
|
||||
void UpdateHtmlApiFullscreen(bool fullscreen);
|
||||
|
||||
bool DoesDeviceMatch(const base::Value* device,
|
||||
const base::Value* device_to_compare,
|
||||
blink::PermissionType permission_type);
|
||||
|
||||
v8::Global<v8::Value> session_;
|
||||
v8::Global<v8::Value> devtools_web_contents_;
|
||||
v8::Global<v8::Value> debugger_;
|
||||
|
@ -843,9 +811,6 @@ class WebContents : public ExclusiveAccessContext,
|
|||
// Stores the frame thats currently in fullscreen, nullptr if there is none.
|
||||
content::RenderFrameHost* fullscreen_frame_ = nullptr;
|
||||
|
||||
// In-memory cache that holds objects that have been granted permissions.
|
||||
DevicePermissionMap granted_devices_;
|
||||
|
||||
base::WeakPtrFactory<WebContents> weak_factory_{this};
|
||||
};
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ void WebFrameMain::MaybeSetupMojoConnection() {
|
|||
|
||||
// Wait for RenderFrame to be created in renderer before accessing remote.
|
||||
if (pending_receiver_ && render_frame_ &&
|
||||
render_frame_->IsRenderFrameCreated()) {
|
||||
render_frame_->IsRenderFrameLive()) {
|
||||
render_frame_->GetRemoteInterfaces()->GetInterface(
|
||||
std::move(pending_receiver_));
|
||||
}
|
||||
|
|
|
@ -49,13 +49,13 @@ void GPUInfoEnumerator::EndGPUDevice() {
|
|||
auto& top_value = value_stack.top();
|
||||
// GPUDevice can be more than one. So create a list of all.
|
||||
// The first one is the active GPU device.
|
||||
if (top_value->HasKey(kGPUDeviceKey)) {
|
||||
if (top_value->FindKey(kGPUDeviceKey)) {
|
||||
base::ListValue* list;
|
||||
top_value->GetList(kGPUDeviceKey, &list);
|
||||
list->Append(std::move(current));
|
||||
list->Append(base::Value::FromUniquePtrValue(std::move(current)));
|
||||
} else {
|
||||
auto gpus = std::make_unique<base::ListValue>();
|
||||
gpus->Append(std::move(current));
|
||||
std::unique_ptr<base::ListValue> gpus(new base::ListValue());
|
||||
gpus->Append(base::Value::FromUniquePtrValue(std::move(current)));
|
||||
top_value->SetList(kGPUDeviceKey, std::move(gpus));
|
||||
}
|
||||
current = std::move(top_value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue