diff --git a/atom/common/native_mate_converters/network_converter.cc b/atom/common/native_mate_converters/network_converter.cc index b4ae1b8c7191..1707ed018bc5 100644 --- a/atom/common/native_mate_converters/network_converter.cc +++ b/atom/common/native_mate_converters/network_converter.cc @@ -27,12 +27,12 @@ Converter>::ToV8( for (const auto& element : *(val->elements())) { auto post_data_dict = std::make_unique(); auto type = element.type(); - if (type == network::DataElement::TYPE_BYTES) { + if (type == network::mojom::DataElementType::kBytes) { auto bytes = std::make_unique(std::vector( element.bytes(), element.bytes() + (element.length()))); post_data_dict->SetString("type", "rawData"); post_data_dict->Set("bytes", std::move(bytes)); - } else if (type == network::DataElement::TYPE_FILE) { + } else if (type == network::mojom::DataElementType::kFile) { post_data_dict->SetString("type", "file"); post_data_dict->SetKey("filePath", base::Value(element.path().AsUTF8Unsafe())); @@ -40,7 +40,7 @@ Converter>::ToV8( post_data_dict->SetInteger("length", static_cast(element.length())); post_data_dict->SetDouble( "modificationTime", element.expected_modification_time().ToDoubleT()); - } else if (type == network::DataElement::TYPE_BLOB) { + } else if (type == network::mojom::DataElementType::kBlob) { post_data_dict->SetString("type", "blob"); post_data_dict->SetString("blobUUID", element.blob_uuid()); } diff --git a/patches/common/chromium/can_create_window.patch b/patches/common/chromium/can_create_window.patch index 5220eb6718a6..22b8d817b1cf 100644 --- a/patches/common/chromium/can_create_window.patch +++ b/patches/common/chromium/can_create_window.patch @@ -5,114 +5,29 @@ Subject: can_create_window.patch diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc -index 1a023385a3d27d9145f2a0a069ff6799c69ec66a..30328f5e62b4fdbb423a97454ee0591c076ac6bc 100644 +index 1a023385a3d27d9145f2a0a069ff6799c69ec66a..8289c09b9e3d30ae171942a987fbc1dca83f58d9 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc -@@ -3669,6 +3669,38 @@ void RenderFrameHostImpl::CreateNewWindow( - "frame_tree_node", frame_tree_node_->frame_tree_node_id(), "url", - params->target_url.possibly_invalid_spec()); - -+ scoped_refptr body; -+ if (params->body->has_object) { -+ body = new network::ResourceRequestBody; -+ std::vector elements; -+ for (const auto& iter : params->body->elements) { -+ network::DataElement element; -+ switch (iter->type) { -+ case network::DataElement::TYPE_BYTES: { -+ element.SetToBytes(iter->bytes.data(), iter->bytes.length()); -+ break; -+ } -+ case network::DataElement::TYPE_FILE: { -+ element.SetToFilePathRange(iter->path, iter->offset, iter->length, -+ iter->expected_modification_time); -+ break; -+ } -+ case network::DataElement::TYPE_BLOB: { -+ element.SetToBlobRange(iter->blob_uuid, iter->offset, iter->length); -+ break; -+ } -+ case network::DataElement::TYPE_DATA_PIPE: -+ default: -+ NOTREACHED(); -+ break; -+ } -+ elements.push_back(std::move(element)); -+ } -+ body->swap_elements(&elements); -+ body->set_identifier(params->body->identifier); -+ body->set_contains_sensitive_info(params->body->contains_sensitive_info); -+ } -+ - bool no_javascript_access = false; - - // Filter out URLs to which navigation is disallowed from this context. -@@ -3697,6 +3729,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -3697,6 +3697,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, -+ params->additional_features, body, ++ params->additional_features, params->body, effective_transient_activation_state, params->opener_suppressed, &no_javascript_access); -diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc -index 8d01f4e181793677a1eee7585fd7c484767a58b0..01f7a49e7a559e6ae70a4311a2539bc4f60849d7 100644 ---- a/content/browser/security_exploit_browsertest.cc -+++ b/content/browser/security_exploit_browsertest.cc -@@ -364,6 +364,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, - - mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); - params->target_url = GURL("about:blank"); -+ params->body = mojom::ResourceRequestBody::New(); - pending_rfh->CreateNewWindow( - std::move(params), base::BindOnce([](mojom::CreateNewWindowStatus, - mojom::CreateNewWindowReplyPtr) {})); diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index e566a15b798e2586fa4fae3c4db97ce5f4f2f09f..8a08c7a79eba24bce7f11cf8c499432549c4f25b 100644 +index e566a15b798e2586fa4fae3c4db97ce5f4f2f09f..08f52fd73bc9b6231a75f7804bb9b9f367bca62e 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -12,6 +12,8 @@ import "content/public/common/resource_type.mojom"; - import "content/public/common/resource_load_info.mojom"; - import "content/public/common/transferrable_url_loader.mojom"; - import "content/public/common/window_container_type.mojom"; -+import "mojo/public/mojom/base/file_path.mojom"; -+import "mojo/public/mojom/base/time.mojom"; - import "mojo/public/mojom/base/string16.mojom"; - import "mojo/public/mojom/base/unguessable_token.mojom"; - import "services/network/public/mojom/url_loader.mojom"; -@@ -187,6 +189,24 @@ interface FrameFactory { - CreateFrame(int32 frame_routing_id, Frame& frame); - }; - -+struct DataElement { -+ int32 type; -+ int64 length; -+ string bytes; -+ mojo_base.mojom.FilePath path; -+ int64 offset; -+ mojo_base.mojom.Time expected_modification_time; -+ url.mojom.Url filesystem_url; -+ string blob_uuid; -+}; -+ -+struct ResourceRequestBody { -+ bool has_object; -+ int64 identifier; -+ bool contains_sensitive_info; -+ array elements; -+}; -+ - struct CreateNewWindowParams { - // True if this open request came in the context of a user gesture. - // -@@ -226,6 +246,10 @@ struct CreateNewWindowParams { +@@ -226,6 +226,10 @@ struct CreateNewWindowParams { // The window features to use for the new window. blink.mojom.WindowFeatures features; + + // Extra fields added by Electron. + array additional_features; -+ ResourceRequestBody body; ++ network.mojom.URLRequestBody? body; }; // Operation result when the renderer asks the browser to create a new window. @@ -151,7 +66,7 @@ index 92425b0bded161d513a3e39b8f9631d4c98c143c..5dc21230970fe23a25ad6e811d65c434 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index ad23a9040c21a674c1b011e7120d4288a722f2bb..c16005d6e20b801217249ed8b902cb42d9223dc4 100644 +index ad23a9040c21a674c1b011e7120d4288a722f2bb..ffe7e5d4b2359d8490c514b8abee91c885ac973b 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -76,6 +76,7 @@ @@ -162,49 +77,11 @@ index ad23a9040c21a674c1b011e7120d4288a722f2bb..c16005d6e20b801217249ed8b902cb42 #include "content/renderer/media/audio/audio_device_factory.h" #include "content/renderer/media/stream/media_stream_device_observer.h" #include "content/renderer/media/video_capture_impl_manager.h" -@@ -1345,6 +1346,46 @@ WebView* RenderViewImpl::CreateView( +@@ -1345,6 +1346,8 @@ WebView* RenderViewImpl::CreateView( } params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); -+ params->body = mojom::ResourceRequestBody::New(); -+ auto body = GetRequestBodyForWebURLRequest(request); -+ if (body) { -+ params->body->has_object = true; -+ params->body->identifier = body->identifier(); -+ params->body->contains_sensitive_info = body->contains_sensitive_info(); -+ for (const auto& element : *body->elements()) { -+ content::mojom::DataElementPtr ptr = content::mojom::DataElement::New(); -+ ptr->type = element.type(); -+ switch (element.type()) { -+ case network::DataElement::TYPE_BYTES: { -+ ptr->bytes = std::string(element.bytes(), element.length()); -+ break; -+ } -+ case network::DataElement::TYPE_FILE: { -+ ptr->path = element.path(); -+ ptr->offset = element.offset(); -+ ptr->length = element.length(); -+ ptr->expected_modification_time = element.expected_modification_time(); -+ break; -+ } -+ case network::DataElement::TYPE_BLOB: { -+ ptr->blob_uuid = element.blob_uuid(); -+ ptr->offset = element.offset(); -+ ptr->length = element.length(); -+ break; -+ } -+ case network::DataElement::TYPE_CHUNKED_DATA_PIPE: -+ case network::DataElement::TYPE_RAW_FILE: -+ case network::DataElement::TYPE_DATA_PIPE: -+ case network::DataElement::TYPE_UNKNOWN: -+ NOTREACHED(); -+ break; -+ } -+ params->body->elements.push_back(std::move(ptr)); -+ } -+ } else { -+ params->body->has_object = false; -+ } ++ params->body = GetRequestBodyForWebURLRequest(request); + // We preserve this information before sending the message since |params| is // moved on send.