From 52fe92d02ef94712fc7b19b3f03d3363cfa71a4d Mon Sep 17 00:00:00 2001 From: Robo Date: Sat, 12 Jan 2019 06:30:43 +0530 Subject: [PATCH] feat: Upgrade to Chromium 71.0.3578.98 (#15966) --- .gitignore | 3 + BUILD.gn | 77 ++-- DEPS | 4 +- VERSION => ELECTRON_VERSION | 0 atom/app/atom_main_delegate.cc | 4 + atom/app/atom_main_delegate.h | 1 + atom/browser/api/atom_api_browser_window.cc | 2 +- atom/browser/api/atom_api_content_tracing.cc | 30 +- atom/browser/api/atom_api_cookies.cc | 23 +- atom/browser/api/atom_api_menu_mac.mm | 4 +- atom/browser/api/atom_api_net_log.cc | 4 +- atom/browser/api/atom_api_protocol.cc | 12 +- atom/browser/api/atom_api_protocol.h | 10 +- atom/browser/api/atom_api_session.cc | 32 +- .../api/atom_api_system_preferences_mac.mm | 1 + atom/browser/api/atom_api_top_level_window.h | 6 +- atom/browser/api/atom_api_web_contents.cc | 28 +- atom/browser/api/atom_api_web_contents.h | 3 +- atom/browser/api/atom_api_web_request.cc | 8 +- atom/browser/api/frame_subscriber.cc | 2 +- atom/browser/api/gpu_info_enumerator.cc | 12 + atom/browser/api/gpu_info_enumerator.h | 3 + atom/browser/api/stream_subscriber.cc | 20 +- atom/browser/atom_blob_reader.cc | 10 +- atom/browser/atom_browser_client.cc | 10 +- atom/browser/atom_browser_main_parts.cc | 21 +- atom/browser/atom_browser_main_parts.h | 1 - atom/browser/atom_browser_main_parts_posix.cc | 4 +- .../atom_resource_dispatcher_host_delegate.cc | 6 +- atom/browser/browser_process_impl.cc | 2 +- atom/browser/common_web_contents_delegate.cc | 16 +- atom/browser/common_web_contents_delegate.h | 5 +- atom/browser/lib/power_observer_linux.cc | 4 +- atom/browser/login_handler.cc | 14 +- atom/browser/mac/atom_application.h | 7 - atom/browser/mac/atom_application.mm | 5 - atom/browser/mac/in_app_purchase.mm | 6 +- atom/browser/mac/in_app_purchase_observer.mm | 6 +- atom/browser/mac/in_app_purchase_product.mm | 6 +- atom/browser/native_window_mac.mm | 2 +- atom/browser/net/atom_cert_verifier.cc | 10 +- atom/browser/net/atom_network_delegate.cc | 20 +- atom/browser/net/atom_network_delegate.h | 6 +- atom/browser/net/atom_url_request.cc | 68 +-- .../net/system_network_context_manager.cc | 9 + .../net/system_network_context_manager.h | 10 + .../browser/net/url_request_async_asar_job.cc | 9 +- atom/browser/net/url_request_buffer_job.cc | 13 +- .../browser/net/url_request_context_getter.cc | 7 +- atom/browser/net/url_request_fetch_job.cc | 17 +- atom/browser/net/url_request_stream_job.cc | 22 +- atom/browser/net/url_request_string_job.cc | 13 +- atom/browser/node_debugger.cc | 9 +- .../platform_notification_service.cc | 14 +- .../platform_notification_service.h | 8 +- .../win/notification_presenter_win.cc | 1 - .../win/windows_toast_notification.cc | 14 +- .../osr/osr_render_widget_host_view.cc | 22 +- atom/browser/osr/osr_web_contents_view.cc | 6 - atom/browser/osr/osr_web_contents_view.h | 2 - .../printing/print_preview_message_handler.cc | 23 +- .../atom_inspectable_web_contents_view.mm | 8 - atom/browser/ui/cocoa/atom_menu_controller.mm | 6 +- atom/browser/ui/cocoa/atom_ns_window.h | 2 +- .../ui/cocoa/atom_ns_window_delegate.h | 2 +- .../ui/cocoa/atom_ns_window_delegate.mm | 12 +- atom/browser/ui/devtools_manager_delegate.cc | 2 +- atom/browser/ui/devtools_ui.cc | 6 +- atom/browser/ui/file_dialog_gtk.cc | 8 +- .../ui/inspectable_web_contents_impl.cc | 18 +- .../ui/inspectable_web_contents_impl.h | 5 +- atom/browser/ui/message_box_gtk.cc | 6 +- atom/browser/ui/message_box_win.cc | 7 +- atom/browser/ui/views/autofill_popup_view.cc | 2 +- atom/browser/ui/views/menu_delegate.cc | 6 +- atom/browser/ui/webui/pdf_viewer_ui.cc | 10 +- atom/browser/web_dialog_helper.cc | 87 ++-- atom/browser/web_dialog_helper.h | 10 +- atom/common/api/atom_api_asar.cc | 24 +- atom/common/api/atom_api_crash_reporter.cc | 4 +- atom/common/api/atom_api_native_image.cc | 8 +- .../native_mate_converters/blink_converter.cc | 14 - .../native_mate_converters/blink_converter.h | 8 - atom/common/node_includes.h | 3 +- atom/renderer/api/atom_api_web_frame.cc | 17 +- atom/renderer/api/atom_api_web_frame.h | 6 +- atom/renderer/atom_autofill_agent.cc | 3 +- atom/renderer/atom_renderer_client.cc | 31 +- atom/renderer/atom_renderer_client.h | 2 +- .../atom_sandboxed_renderer_client.cc | 36 +- buildflags/buildflags.gni | 2 +- .../browser/certificate_manager_model.cc | 10 +- .../chrome/browser/process_singleton_posix.cc | 10 +- electron_paks.gni | 2 - electron_resources.grd | 1 + filenames.gni | 8 +- lib/common/asar_init.js | 26 +- lib/isolated_renderer/init.js | 13 +- lib/renderer/init.js | 21 +- lib/renderer/web-view/web-view-attributes.js | 2 +- lib/renderer/web-view/web-view-element.js | 110 +++++ .../{web-view.js => web-view-impl.js} | 92 +--- lib/sandboxed_renderer/init.js | 6 +- patches/common/boringssl/.patches | 2 + ...order_bits_for_openssl_compatibility.patch | 39 ++ ...ey_key2buf_for_openssl_compatibility.patch | 65 +++ ...implement_ssl_get_tlsext_status_type.patch | 2 +- patches/common/chromium/.patches | 1 - patches/common/chromium/accelerator.patch | 6 +- patches/common/chromium/add_realloc.patch | 14 +- .../chromium/allow_webview_file_url.patch | 4 +- ...ink-worker-enable-csp-in-file-scheme.patch | 2 +- patches/common/chromium/blink_file_path.patch | 6 +- .../common/chromium/blink_local_frame.patch | 6 +- .../common/chromium/blink_world_context.patch | 12 +- .../common/chromium/boringssl_build_gn.patch | 2 +- .../chromium/browser_compositor_mac.patch | 4 +- .../common/chromium/can_create_window.patch | 36 +- .../common/chromium/chrome_key_systems.patch | 4 +- patches/common/chromium/color_chooser.patch | 4 +- .../common/chromium/compositor_delegate.patch | 14 +- ...r_to_prevent_locking_scheme_registry.patch | 13 +- .../chromium/content_browser_main_loop.patch | 4 +- ...cross_site_document_resource_handler.patch | 12 +- ...customizable_app_indicator_id_prefix.patch | 14 +- patches/common/chromium/dcheck.patch | 2 +- .../common/chromium/desktop_media_list.patch | 23 +- .../common/chromium/disable-redraw-lock.patch | 2 +- .../disable_detach_webview_frame.patch | 4 +- patches/common/chromium/disable_hidden.patch | 8 +- ...requirement_for_beforeunload_dialogs.patch | 4 +- .../common/chromium/dom_storage_limits.patch | 22 +- patches/common/chromium/enable_widevine.patch | 13 +- .../exclude-a-few-test-files-from-build.patch | 6 +- .../chromium/fix_trackpad_scrolling.patch | 6 +- .../common/chromium/fix_zoom_display.patch | 30 -- .../common/chromium/frame_host_manager.patch | 35 +- .../gin_enable_disable_v8_platform.patch | 10 +- .../chromium/gritsettings_resource_ids.patch | 4 +- patches/common/chromium/isolate_holder.patch | 4 +- patches/common/chromium/leveldb_ssize_t.patch | 25 -- patches/common/chromium/libgtkui_export.patch | 18 +- .../common/chromium/mas-audiodeviceduck.patch | 4 +- .../mas-cgdisplayusesforcetogray.patch | 2 +- ...launchservicesserverconnectionstatus.patch | 4 +- .../common/chromium/mas_no_private_api.patch | 63 ++- .../chromium/no_cache_storage_check.patch | 8 +- .../chromium/notification_provenance.patch | 46 +- .../chromium/out_of_process_instance.patch | 4 +- patches/common/chromium/pepper_flash.patch | 65 +-- patches/common/chromium/printing.patch | 75 ++-- .../chromium/proxy_config_monitor.patch | 91 ++-- .../render_widget_host_view_base.patch | 12 +- .../render_widget_host_view_mac.patch | 18 +- .../chromium/resource_file_conflict.patch | 9 +- .../common/chromium/scroll_bounce_flag.patch | 4 +- .../ssl_security_state_tab_helper.patch | 4 +- patches/common/chromium/sysroot.patch | 2 +- patches/common/chromium/tts.patch | 17 +- patches/common/chromium/web_contents.patch | 42 +- .../chromium/webgl_context_attributes.patch | 24 +- .../common/chromium/webview_cross_drag.patch | 4 +- .../worker_context_will_destroy.patch | 24 +- patches/common/v8/.patches | 6 +- ...cherry-pick-0483e9a-from-upstream-V8.patch | 112 +++++ ...cherry-pick-b87d408-from-upstream-V8.patch | 136 ++++++ ...cherry-pick-073073b-from-upstream-V8.patch | 180 ++++++++ ...cherry-pick-88f8fe1-from-upstream-V8.patch | 352 +++++++++++++++ patches/common/v8/add_realloc.patch | 8 +- patches/common/v8/array_buffer.patch | 8 +- ...ild-torque-with-x64-toolchain-on-arm.patch | 39 +- patches/common/v8/build_gn.patch | 6 +- patches/common/v8/dcheck.patch | 8 +- ..._detailed_line_info_for_cpu_profiler.patch | 4 +- ...cherry-pick_2363cdf_from_upstream_v8.patch | 74 ---- ...vide_more_v8_backwards_compatibility.patch | 54 +-- ...revert_9136dd8088a9_from_upstream_v8.patch | 409 ------------------ ...ot_run_arm_arm64_mksnapshot_binaries.patch | 10 +- patches/common/v8/export_platform.patch | 4 +- patches/common/v8/expose_mksnapshot.patch | 4 +- patches/common/v8/ostreams.patch | 6 +- script/bump-version.js | 2 +- script/lib/util.py | 2 +- script/lib/version-utils.js | 2 +- script/sysroots.json | 18 +- spec/api-session-spec.js | 7 +- spec/chromium-spec.js | 22 +- .../api/native-window-open-native-addon.html | 8 +- spec/fixtures/module/echo-renamed.js | 7 + spec/fixtures/module/{runas.js => echo.js} | 4 +- spec/fixtures/module/runas-renamed.js | 6 - spec/fixtures/native-addon/echo/binding.cc | 38 ++ spec/fixtures/native-addon/echo/binding.gyp | 10 + spec/fixtures/native-addon/echo/lib/echo.js | 1 + spec/fixtures/native-addon/echo/package.json | 6 + spec/fixtures/pages/native-module.html | 2 +- spec/fixtures/pages/storage/cookie.html | 9 +- spec/fixtures/pages/storage/indexed_db.html | 7 +- .../fixtures/pages/storage/local_storage.html | 7 +- spec/modules-spec.js | 14 +- spec/node-spec.js | 13 +- spec/package-lock.json | 19 +- spec/package.json | 4 +- tools/js2c.py | 46 +- 204 files changed, 2291 insertions(+), 1760 deletions(-) rename VERSION => ELECTRON_VERSION (100%) create mode 100644 lib/renderer/web-view/web-view-element.js rename lib/renderer/web-view/{web-view.js => web-view-impl.js} (81%) create mode 100644 patches/common/boringssl/add_ec_group_order_bits_for_openssl_compatibility.patch create mode 100644 patches/common/boringssl/add_ec_key_key2buf_for_openssl_compatibility.patch delete mode 100644 patches/common/chromium/fix_zoom_display.patch delete mode 100644 patches/common/chromium/leveldb_ssize_t.patch create mode 100644 patches/common/v8/0001-deps-cherry-pick-0483e9a-from-upstream-V8.patch create mode 100644 patches/common/v8/0002-deps-cherry-pick-b87d408-from-upstream-V8.patch create mode 100644 patches/common/v8/0003-deps-cherry-pick-073073b-from-upstream-V8.patch create mode 100644 patches/common/v8/0004-deps-cherry-pick-88f8fe1-from-upstream-V8.patch delete mode 100644 patches/common/v8/deps_cherry-pick_2363cdf_from_upstream_v8.patch delete mode 100644 patches/common/v8/deps_revert_9136dd8088a9_from_upstream_v8.patch create mode 100644 spec/fixtures/module/echo-renamed.js rename spec/fixtures/module/{runas.js => echo.js} (60%) delete mode 100644 spec/fixtures/module/runas-renamed.js create mode 100644 spec/fixtures/native-addon/echo/binding.cc create mode 100644 spec/fixtures/native-addon/echo/binding.gyp create mode 100644 spec/fixtures/native-addon/echo/lib/echo.js create mode 100644 spec/fixtures/native-addon/echo/package.json diff --git a/.gitignore b/.gitignore index fab874312090..68f066691492 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ spec/.hash # Eslint Cache .eslintcache + +# Generated native addon files +/spec/fixtures/native-addon/echo/build/ diff --git a/BUILD.gn b/BUILD.gn index b362b4fc7dbf..234a9b62c866 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -54,17 +54,7 @@ config("branding") { } npm_action("atom_browserify_sandbox") { - deps = [ - ":atom_js2c_copy", - ] - - sandbox_args = [ - "lib/sandboxed_renderer/init.js", - "-r", - "./lib/sandboxed_renderer/api/exports/electron.js:electron", - "-t", - "aliasify", - ] + script = "browserify" inputs = [ # FIXME(zcbenz): The dependencies of these files are not listed here, so @@ -73,36 +63,40 @@ npm_action("atom_browserify_sandbox") { "lib/sandboxed_renderer/init.js", "lib/sandboxed_renderer/api/exports/electron.js", ] + outputs = [ "$target_gen_dir/js2c/preload_bundle.js", ] - script = "browserify" - args = sandbox_args + [ - "-o", - rebase_path(outputs[0]), - ] + args = [ + "lib/sandboxed_renderer/init.js", + "-r", + "./lib/sandboxed_renderer/api/exports/electron.js:electron", + "-t", + "aliasify", + "-o", + rebase_path(outputs[0]), + ] } npm_action("atom_browserify_isolated") { - deps = [ - ":atom_js2c_copy", - ] + script = "browserify" inputs = [ "lib/isolated_renderer/init.js", ] + outputs = [ "$target_gen_dir/js2c/isolated_bundle.js", ] - script = "browserify" - args = inputs + [ - "-t", - "aliasify", - "-o", - rebase_path(outputs[0]), - ] + args = [ + "lib/isolated_renderer/init.js", + "-t", + "aliasify", + "-o", + rebase_path(outputs[0]), + ] } copy("atom_js2c_copy") { @@ -122,23 +116,25 @@ action("atom_js2c") { ":atom_js2c_copy", ] - js2c_sources = filenames.js2c_sources - browserify_sources = [ "$target_gen_dir/js2c/isolated_bundle.js", "$target_gen_dir/js2c/preload_bundle.js", ] - inputs = js2c_sources + browserify_sources + sources = browserify_sources + [ + "$target_gen_dir/js2c/asar.js", + "$target_gen_dir/js2c/asar_init.js", + ] + inputs = sources outputs = [ - "$target_gen_dir/atom_natives.h", + "$root_gen_dir/atom_natives.cc", ] script = "tools/js2c.py" args = [ rebase_path("//third_party/electron_node") ] + rebase_path(outputs, root_build_dir) + - [ rebase_path("$target_gen_dir/js2c", root_build_dir) ] + rebase_path(sources, root_build_dir) } asar("js2asar") { @@ -182,18 +178,30 @@ grit("resources") { "electron_resources.pak", ] + # Mojo manifest overlays are generated. + source_is_generated = true grit_flags = [ "-E", "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir), ] deps = [ + ":copy_shell_devtools_discovery_page", ":electron_content_manifest_overlays", ] output_dir = "$target_gen_dir" } +copy("copy_shell_devtools_discovery_page") { + sources = [ + "//content/shell/resources/shell_devtools_discovery_page.html", + ] + outputs = [ + "$target_gen_dir/shell_devtools_discovery_page.html", + ] +} + if (is_linux) { generate_library_loader("libnotify_loader") { name = "LibNotifyLoader" @@ -244,7 +252,6 @@ static_library("electron_lib") { "//content/public/browser", "//content/public/child", "//content/public/common:service_names", - "//content/shell:copy_shell_resources", "//gin", "//media/capture/mojom:video_capture", "//media/mojo/interfaces", @@ -326,8 +333,6 @@ static_library("electron_lib") { sources = filenames.lib_sources set_sources_assignment_filter(sources_assignment_filter) - sources += [ "$target_gen_dir/atom_natives.h" ] - if (is_component_build) { defines += [ "NODE_SHARED_MODE" ] } @@ -576,7 +581,7 @@ if (is_mac) { } info_plist = "atom/common/resources/mac/Info.plist" - electron_version = read_file("VERSION", "trim string") + electron_version = read_file("ELECTRON_VERSION", "trim string") extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework", "ELECTRON_VERSION=$electron_version", @@ -897,7 +902,7 @@ group("licenses") { copy("electron_version") { sources = [ - "VERSION", + "ELECTRON_VERSION", ] outputs = [ "$root_build_dir/version", diff --git a/DEPS b/DEPS index b19f87ab4dbd..3a0b5f903715 100644 --- a/DEPS +++ b/DEPS @@ -10,9 +10,9 @@ gclient_gn_args = [ vars = { 'chromium_version': - '70.0.3538.110', + '71.0.3578.98', 'node_version': - '1b192088522d10d126e5bb9316adae2a97add62a', + 'aeae08cda811ed122918bfd48fd9e56f8204d818', 'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b', 'pyyaml_version': '3.12', diff --git a/VERSION b/ELECTRON_VERSION similarity index 100% rename from VERSION rename to ELECTRON_VERSION diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc index ea31f1ce69a2..a667d7e8ddb1 100644 --- a/atom/app/atom_main_delegate.cc +++ b/atom/app/atom_main_delegate.cc @@ -273,4 +273,8 @@ bool AtomMainDelegate::ShouldLockSchemeRegistry() { return false; } +bool AtomMainDelegate::ShouldCreateFeatureList() { + return false; +} + } // namespace atom diff --git a/atom/app/atom_main_delegate.h b/atom/app/atom_main_delegate.h index 352983a9ec94..317be4804eaf 100644 --- a/atom/app/atom_main_delegate.h +++ b/atom/app/atom_main_delegate.h @@ -36,6 +36,7 @@ class AtomMainDelegate : public content::ContentMainDelegate { bool DelaySandboxInitialization(const std::string& process_type) override; #endif bool ShouldLockSchemeRegistry() override; + bool ShouldCreateFeatureList() override; private: #if defined(OS_MACOSX) diff --git a/atom/browser/api/atom_api_browser_window.cc b/atom/browser/api/atom_api_browser_window.cc index 59842687bc52..fe7797e2c0d4 100644 --- a/atom/browser/api/atom_api_browser_window.cc +++ b/atom/browser/api/atom_api_browser_window.cc @@ -231,7 +231,7 @@ void BrowserWindow::OnCloseButtonClicked(bool* prevent_default) { return; if (web_contents()->NeedToFireBeforeUnload()) - web_contents()->DispatchBeforeUnload(); + web_contents()->DispatchBeforeUnload(false /* auto_cancel */); else web_contents()->Close(); } diff --git a/atom/browser/api/atom_api_content_tracing.cc b/atom/browser/api/atom_api_content_tracing.cc index bb4cc075d99c..46eb1cac2c2d 100644 --- a/atom/browser/api/atom_api_content_tracing.cc +++ b/atom/browser/api/atom_api_content_tracing.cc @@ -71,20 +71,34 @@ void StopRecording(const base::FilePath& path, GetTraceDataEndpoint(path, callback)); } +bool GetCategories( + const base::RepeatingCallback&)>& + callback) { + return TracingController::GetInstance()->GetCategories( + base::BindOnce(callback)); +} + +bool StartTracing(const base::trace_event::TraceConfig& trace_config, + const base::RepeatingCallback& callback) { + return TracingController::GetInstance()->StartTracing( + trace_config, base::BindOnce(callback)); +} + +bool GetTraceBufferUsage( + const base::RepeatingCallback& callback) { + return TracingController::GetInstance()->GetTraceBufferUsage( + base::BindOnce(callback)); +} + void Initialize(v8::Local exports, v8::Local unused, v8::Local context, void* priv) { - auto controller = base::Unretained(TracingController::GetInstance()); mate::Dictionary dict(context->GetIsolate(), exports); - dict.SetMethod("getCategories", - base::Bind(&TracingController::GetCategories, controller)); - dict.SetMethod("startRecording", - base::Bind(&TracingController::StartTracing, controller)); + dict.SetMethod("getCategories", &GetCategories); + dict.SetMethod("startRecording", &StartTracing); dict.SetMethod("stopRecording", &StopRecording); - dict.SetMethod( - "getTraceBufferUsage", - base::Bind(&TracingController::GetTraceBufferUsage, controller)); + dict.SetMethod("getTraceBufferUsage", &GetTraceBufferUsage); } } // namespace diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 882937b1c6be..ef7afc4397a9 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -12,9 +12,11 @@ #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/value_converter.h" +#include "base/task/post_task.h" #include "base/time/time.h" #include "base/values.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" @@ -136,7 +138,7 @@ inline net::CookieStore* GetCookieStore( // Run |callback| on UI thread. void RunCallbackInUI(const base::Closure& callback) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, callback); } // Remove cookies from |list| not matching |filter|, and pass it to |callback|. @@ -270,8 +272,8 @@ void Cookies::Get(const base::DictionaryValue& filter, auto copy = base::DictionaryValue::From( base::Value::ToUniquePtrValue(filter.Clone())); auto* getter = browser_context_->GetRequestContext(); - content::BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(GetCookiesOnIO, base::RetainedRef(getter), std::move(copy), callback)); } @@ -280,8 +282,8 @@ void Cookies::Remove(const GURL& url, const std::string& name, const base::Closure& callback) { auto* getter = browser_context_->GetRequestContext(); - content::BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(RemoveCookieOnIOThread, base::RetainedRef(getter), url, name, callback)); } @@ -291,18 +293,17 @@ void Cookies::Set(const base::DictionaryValue& details, auto copy = base::DictionaryValue::From( base::Value::ToUniquePtrValue(details.Clone())); auto* getter = browser_context_->GetRequestContext(); - content::BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(SetCookieOnIO, base::RetainedRef(getter), std::move(copy), callback)); } void Cookies::FlushStore(const base::Closure& callback) { auto* getter = browser_context_->GetRequestContext(); - content::BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::BindOnce(FlushCookieStoreOnIOThread, base::RetainedRef(getter), - callback)); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO}, + base::BindOnce(FlushCookieStoreOnIOThread, + base::RetainedRef(getter), callback)); } void Cookies::OnCookieChanged(const CookieDetails* details) { diff --git a/atom/browser/api/atom_api_menu_mac.mm b/atom/browser/api/atom_api_menu_mac.mm index 8d284e50ad88..bec33b934acc 100644 --- a/atom/browser/api/atom_api_menu_mac.mm +++ b/atom/browser/api/atom_api_menu_mac.mm @@ -9,6 +9,8 @@ #include "base/mac/scoped_sending_event.h" #include "base/message_loop/message_loop.h" #include "base/strings/sys_string_conversions.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" @@ -43,7 +45,7 @@ void MenuMac::PopupAt(TopLevelWindow* window, auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(), native_window->GetWeakPtr(), window->weak_map_id(), x, y, positioning_item, callback); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, popup); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, popup); } void MenuMac::PopupOnUI(const base::WeakPtr& native_window, diff --git a/atom/browser/api/atom_api_net_log.cc b/atom/browser/api/atom_api_net_log.cc index dd4f4cc7f10c..7464b46b1dd1 100644 --- a/atom/browser/api/atom_api_net_log.cc +++ b/atom/browser/api/atom_api_net_log.cc @@ -7,6 +7,7 @@ #include #include "atom/browser/atom_browser_context.h" +#include "atom/browser/net/system_network_context_manager.h" #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/file_path_converter.h" #include "base/command_line.h" @@ -27,7 +28,8 @@ NetLog::NetLog(v8::Isolate* isolate, AtomBrowserContext* browser_context) : browser_context_(browser_context) { Init(isolate); - net_log_writer_ = g_browser_process->net_log()->net_export_file_writer(); + net_log_writer_ = g_browser_process->system_network_context_manager() + ->GetNetExportFileWriter(); net_log_writer_->AddObserver(this); } diff --git a/atom/browser/api/atom_api_protocol.cc b/atom/browser/api/atom_api_protocol.cc index f0ec02a0a588..1e6e9806466d 100644 --- a/atom/browser/api/atom_api_protocol.cc +++ b/atom/browser/api/atom_api_protocol.cc @@ -85,8 +85,8 @@ void Protocol::UnregisterProtocol(const std::string& scheme, args->GetNext(&callback); auto* getter = static_cast( browser_context_->GetRequestContext()); - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&Protocol::UnregisterProtocolInIO, base::RetainedRef(getter), scheme), base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback)); @@ -107,8 +107,8 @@ void Protocol::IsProtocolHandled(const std::string& scheme, const BooleanCallback& callback) { auto* getter = static_cast( browser_context_->GetRequestContext()); - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {content::BrowserThread::IO}, base::Bind(&Protocol::IsProtocolHandledInIO, base::RetainedRef(getter), scheme), callback); @@ -127,8 +127,8 @@ void Protocol::UninterceptProtocol(const std::string& scheme, args->GetNext(&callback); auto* getter = static_cast( browser_context_->GetRequestContext()); - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&Protocol::UninterceptProtocolInIO, base::RetainedRef(getter), scheme), base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback)); diff --git a/atom/browser/api/atom_api_protocol.h b/atom/browser/api/atom_api_protocol.h index 7bfe4ac90226..ae029bbf4dbd 100644 --- a/atom/browser/api/atom_api_protocol.h +++ b/atom/browser/api/atom_api_protocol.h @@ -16,6 +16,8 @@ #include "atom/browser/net/atom_url_request_job_factory.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "native_mate/arguments.h" #include "native_mate/dictionary.h" @@ -104,8 +106,8 @@ class Protocol : public mate::TrackableObject { args->GetNext(&callback); auto* getter = static_cast( browser_context_->GetRequestContext()); - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&Protocol::RegisterProtocolInIO, base::RetainedRef(getter), isolate(), scheme, handler), base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback)); @@ -149,8 +151,8 @@ class Protocol : public mate::TrackableObject { args->GetNext(&callback); auto* getter = static_cast( browser_context_->GetRequestContext()); - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&Protocol::InterceptProtocolInIO, base::RetainedRef(getter), isolate(), scheme, handler), base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback)); diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index ffb1589f9ac9..65069d4904e8 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -32,6 +32,7 @@ #include "base/guid.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" +#include "base/task/post_task.h" #include "chrome/browser/browser_process.h" #include "chrome/common/pref_names.h" #include "components/download/public/common/download_danger_type.h" @@ -39,6 +40,7 @@ #include "components/prefs/value_map_pref_store.h" #include "components/proxy_config/proxy_config_dictionary.h" #include "components/proxy_config/proxy_config_pref_names.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_item_utils.h" #include "content/public/browser/download_manager_delegate.h" @@ -211,12 +213,12 @@ std::map> g_sessions; // Runs the callback in UI thread. void RunCallbackInUI(const base::Callback& callback) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, callback); } template void RunCallbackInUI(const base::Callback& callback, T... result) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(callback, result...)); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(callback, result...)); } // Callback of HttpCache::GetBackend. @@ -421,8 +423,8 @@ void Session::ResolveProxy( template void Session::DoCacheAction(const net::CompletionCallback& callback) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&DoCacheActionInIO, WrapRefCounted(browser_context_->GetRequestContext()), action, callback)); @@ -533,8 +535,8 @@ void Session::SetCertVerifyProc(v8::Local val, return; } - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&SetCertVerifyProcInIO, WrapRefCounted(browser_context_->GetRequestContext()), base::Bind(&WrapVerifyProc, proc))); @@ -568,8 +570,8 @@ void Session::ClearHostResolverCache(mate::Arguments* args) { base::Closure callback; args->GetNext(&callback); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&ClearHostResolverCacheInIO, WrapRefCounted(browser_context_->GetRequestContext()), callback)); @@ -584,16 +586,16 @@ void Session::ClearAuthCache(mate::Arguments* args) { base::Closure callback; args->GetNext(&callback); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&ClearAuthCacheInIO, WrapRefCounted(browser_context_->GetRequestContext()), options, callback)); } void Session::AllowNTLMCredentialsForDomains(const std::string& domains) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&AllowNTLMCredentialsForDomainsInIO, WrapRefCounted(browser_context_->GetRequestContext()), domains)); @@ -623,8 +625,8 @@ void Session::GetBlobData(const std::string& uuid, return; AtomBlobReader* blob_reader = browser_context()->GetBlobReader(); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&AtomBlobReader::StartReading, base::Unretained(blob_reader), uuid, callback)); } diff --git a/atom/browser/api/atom_api_system_preferences_mac.mm b/atom/browser/api/atom_api_system_preferences_mac.mm index 268459d25fbe..4a55058fd543 100644 --- a/atom/browser/api/atom_api_system_preferences_mac.mm +++ b/atom/browser/api/atom_api_system_preferences_mac.mm @@ -13,6 +13,7 @@ #include "atom/browser/mac/dict_util.h" #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/value_converter.h" +#include "base/mac/sdk_forward_declarations.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h" diff --git a/atom/browser/api/atom_api_top_level_window.h b/atom/browser/api/atom_api_top_level_window.h index 61ba4eeeac0d..32f28a0c8e09 100644 --- a/atom/browser/api/atom_api_top_level_window.h +++ b/atom/browser/api/atom_api_top_level_window.h @@ -14,6 +14,8 @@ #include "atom/browser/native_window.h" #include "atom/browser/native_window_observer.h" #include "atom/common/api/atom_api_native_image.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "native_mate/handle.h" @@ -230,8 +232,8 @@ class TopLevelWindow : public mate::TrackableObject, template void EmitEventSoon(base::StringPiece eventName) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(base::IgnoreResult(&TopLevelWindow::Emit), weak_factory_.GetWeakPtr(), eventName)); } diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 41024affd84f..8416b9ad37e0 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -57,7 +57,7 @@ #include "content/browser/frame_host/render_frame_host_manager.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" -#include "content/common/view_messages.h" +#include "content/common/widget_messages.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/download_request_utils.h" #include "content/public/browser/favicon_status.h" @@ -80,8 +80,8 @@ #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" #include "net/url_request/url_request_context.h" +#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h" #include "third_party/blink/public/platform/web_input_event.h" -#include "third_party/blink/public/web/web_find_options.h" #include "ui/display/screen.h" #include "ui/events/base_event_utils.h" @@ -768,7 +768,8 @@ void WebContents::OnAudioStateChanged(bool audible) { Emit("-audio-state-changed", audible); } -void WebContents::BeforeUnloadFired(const base::TimeTicks& proceed_time) { +void WebContents::BeforeUnloadFired(bool proceed, + const base::TimeTicks& proceed_time) { // Do nothing, we override this method just to avoid compilation error since // there are two virtual functions named BeforeUnloadFired. } @@ -1052,7 +1053,7 @@ void WebContents::ShowAutofillPopup(content::RenderFrameHost* frame_host, bool WebContents::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebContents, message) - IPC_MESSAGE_HANDLER_CODE(ViewHostMsg_SetCursor, OnCursorChange, + IPC_MESSAGE_HANDLER_CODE(WidgetHostMsg_SetCursor, OnCursorChange, handled = false) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -1372,8 +1373,8 @@ void WebContents::EnableDeviceEmulation( frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr; if (!widget_host) return; - widget_host->Send( - new ViewMsg_EnableDeviceEmulation(widget_host->GetRoutingID(), params)); + widget_host->Send(new WidgetMsg_EnableDeviceEmulation( + widget_host->GetRoutingID(), params)); } } @@ -1388,7 +1389,7 @@ void WebContents::DisableDeviceEmulation() { if (!widget_host) return; widget_host->Send( - new ViewMsg_DisableDeviceEmulation(widget_host->GetRoutingID())); + new WidgetMsg_DisableDeviceEmulation(widget_host->GetRoutingID())); } } @@ -1597,17 +1598,22 @@ void WebContents::ReplaceMisspelling(const base::string16& word) { } uint32_t WebContents::FindInPage(mate::Arguments* args) { - uint32_t request_id = GetNextRequestId(); base::string16 search_text; - blink::WebFindOptions options; if (!args->GetNext(&search_text) || search_text.empty()) { args->ThrowError("Must provide a non-empty search content"); return 0; } - args->GetNext(&options); + uint32_t request_id = GetNextRequestId(); + mate::Dictionary dict; + auto options = blink::mojom::FindOptions::New(); + if (args->GetNext(&dict)) { + dict.Get("forward", &options->forward); + dict.Get("matchCase", &options->match_case); + dict.Get("findNext", &options->find_next); + } - web_contents()->Find(request_id, search_text, options); + web_contents()->Find(request_id, search_text, std::move(options)); return request_id; } diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 9a1ed0f571fa..ebf75ead1879 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -406,7 +406,8 @@ class WebContents : public mate::TrackableObject, void OnAudioStateChanged(bool audible) override; // content::WebContentsObserver: - void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; + void BeforeUnloadFired(bool proceed, + const base::TimeTicks& proceed_time) override; void RenderViewCreated(content::RenderViewHost*) override; void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) override; diff --git a/atom/browser/api/atom_api_web_request.cc b/atom/browser/api/atom_api_web_request.cc index b5cfeb134007..d36de889076d 100644 --- a/atom/browser/api/atom_api_web_request.cc +++ b/atom/browser/api/atom_api_web_request.cc @@ -12,6 +12,8 @@ #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/net_converter.h" #include "atom/common/native_mate_converters/value_converter.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" @@ -29,7 +31,7 @@ struct Converter { if (!ConvertFromV8(isolate, val, &pattern)) return false; *out = URLPattern(URLPattern::SCHEME_ALL); - return out->Parse(pattern) == URLPattern::PARSE_SUCCESS; + return out->Parse(pattern) == URLPattern::ParseResult::kSuccess; } }; @@ -97,8 +99,8 @@ void WebRequest::SetListener(Method method, Event type, mate::Arguments* args) { browser_context_->GetRequestContext()); if (!url_request_context_getter) return; - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&CallNetworkDelegateMethod, base::RetainedRef(url_request_context_getter), method, type, std::move(patterns), std::move(listener))); diff --git a/atom/browser/api/frame_subscriber.cc b/atom/browser/api/frame_subscriber.cc index de688b796b33..5b74ae69b651 100644 --- a/atom/browser/api/frame_subscriber.cc +++ b/atom/browser/api/frame_subscriber.cc @@ -52,7 +52,7 @@ void FrameSubscriber::AttachToHost(content::RenderWidgetHost* host) { video_capturer_->SetAutoThrottlingEnabled(false); video_capturer_->SetMinSizeChangePeriod(base::TimeDelta()); video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB, - media::COLOR_SPACE_UNSPECIFIED); + gfx::ColorSpace::CreateREC709()); video_capturer_->SetMinCapturePeriod(base::TimeDelta::FromSeconds(1) / kMaxFrameRate); video_capturer_->Start(this); diff --git a/atom/browser/api/gpu_info_enumerator.cc b/atom/browser/api/gpu_info_enumerator.cc index d3bd9247f725..c6d0288f0e51 100644 --- a/atom/browser/api/gpu_info_enumerator.cc +++ b/atom/browser/api/gpu_info_enumerator.cc @@ -107,6 +107,18 @@ void GPUInfoEnumerator::EndOverlayCapability() { value_stack.pop(); } +void GPUInfoEnumerator::BeginDx12VulkanVersionInfo() { + value_stack.push(std::move(current)); + current = std::make_unique(); +} + +void GPUInfoEnumerator::EndDx12VulkanVersionInfo() { + auto& top_value = value_stack.top(); + top_value->SetDictionary(kDx12VulkanVersionInfoKey, std::move(current)); + current = std::move(top_value); + value_stack.pop(); +} + std::unique_ptr GPUInfoEnumerator::GetDictionary() { return std::move(current); } diff --git a/atom/browser/api/gpu_info_enumerator.h b/atom/browser/api/gpu_info_enumerator.h index b0ab7a9212a4..9d7655a30299 100644 --- a/atom/browser/api/gpu_info_enumerator.h +++ b/atom/browser/api/gpu_info_enumerator.h @@ -24,6 +24,7 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator { "videoEncodeAcceleratorSupportedProfile"; const char* kAuxAttributesKey = "auxAttributes"; const char* kOverlayCapabilityKey = "overlayCapability"; + const char* kDx12VulkanVersionInfoKey = "dx12VulkanVersionInfo"; public: GPUInfoEnumerator(); @@ -44,6 +45,8 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator { void EndAuxAttributes() override; void BeginOverlayCapability() override; void EndOverlayCapability() override; + void BeginDx12VulkanVersionInfo() override; + void EndDx12VulkanVersionInfo() override; std::unique_ptr GetDictionary(); private: diff --git a/atom/browser/api/stream_subscriber.cc b/atom/browser/api/stream_subscriber.cc index 431dfcbe776a..7bdeb20ded35 100644 --- a/atom/browser/api/stream_subscriber.cc +++ b/atom/browser/api/stream_subscriber.cc @@ -9,6 +9,8 @@ #include "atom/browser/net/url_request_stream_job.h" #include "atom/common/api/event_emitter_caller.h" #include "atom/common/native_mate_converters/callback.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "atom/common/node_includes.h" @@ -76,23 +78,21 @@ void StreamSubscriber::OnData(mate::Arguments* args) { // Pass the data to the URLJob in IO thread. std::vector buffer(data, data + length); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::Bind(&atom::URLRequestStreamJob::OnData, url_job_, - base::Passed(&buffer))); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::Bind(&atom::URLRequestStreamJob::OnData, + url_job_, base::Passed(&buffer))); } void StreamSubscriber::OnEnd(mate::Arguments* args) { - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::Bind(&atom::URLRequestStreamJob::OnEnd, url_job_)); } void StreamSubscriber::OnError(mate::Arguments* args) { - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::Bind(&atom::URLRequestStreamJob::OnError, url_job_, - net::ERR_FAILED)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::Bind(&atom::URLRequestStreamJob::OnError, + url_job_, net::ERR_FAILED)); } void StreamSubscriber::RemoveAllListeners() { diff --git a/atom/browser/atom_blob_reader.cc b/atom/browser/atom_blob_reader.cc index 5e2d09caf1eb..1796b81a6327 100644 --- a/atom/browser/atom_blob_reader.cc +++ b/atom/browser/atom_blob_reader.cc @@ -6,7 +6,9 @@ #include +#include "base/task/post_task.h" #include "content/browser/blob_storage/chrome_blob_storage_context.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -60,8 +62,8 @@ void AtomBlobReader::StartReading( auto blob_data_handle = blob_context_->context()->GetBlobDataFromUUID(uuid); auto callback = base::Bind(&RunCallbackInUI, completion_callback); if (!blob_data_handle) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(callback, nullptr, 0)); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(callback, nullptr, 0)); return; } @@ -116,8 +118,8 @@ void AtomBlobReader::BlobReadHelper::DidReadBlobData( char* data = new char[size]; memcpy(data, blob_data->data(), size); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(completion_callback_, data, size)); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(completion_callback_, data, size)); delete this; } diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 900b37d8bb22..dbc8b5d348d2 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -45,9 +45,11 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" #include "chrome/browser/browser_process.h" #include "components/net_log/chrome_net_log.h" #include "content/public/browser/browser_ppapi_host.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" @@ -158,8 +160,8 @@ void AtomBrowserClient::SetApplicationLocale(const std::string& locale) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) || - !BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + !base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&SetApplicationLocaleOnIOThread, locale))) { g_io_thread_application_locale.Get() = locale; } @@ -792,8 +794,8 @@ bool AtomBrowserClient::HandleExternalProtocol( bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&HandleExternalProtocolInUI, url, web_contents_getter, has_user_gesture)); return true; diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index c35f793fbb87..e55bb579563c 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -74,7 +74,9 @@ #if defined(OS_WIN) #include "ui/base/cursor/cursor_loader_win.h" #include "ui/base/l10n/l10n_util_win.h" +#include "ui/display/win/dpi.h" #include "ui/gfx/platform_font_win.h" +#include "ui/strings/grit/app_locale_settings.h" #endif #if defined(OS_MACOSX) @@ -102,12 +104,17 @@ void Erase(T* container, typename T::iterator iter) { #if defined(OS_WIN) // gfx::Font callbacks -void AdjustUIFont(LOGFONT* logfont) { - l10n_util::AdjustUIFont(logfont); +void AdjustUIFont(gfx::PlatformFontWin::FontAdjustment* font_adjustment) { + l10n_util::NeedOverrideDefaultUIFont(&font_adjustment->font_family_override, + &font_adjustment->font_scale); + font_adjustment->font_scale *= display::win::GetAccessibilityFontScale(); } int GetMinimumFontSize() { - return 10; + int min_font_size; + base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), + &min_font_size); + return min_font_size; } #endif @@ -276,10 +283,6 @@ void AtomBrowserMainParts::RegisterDestructionCallback( destructors_.insert(destructors_.begin(), std::move(callback)); } -bool AtomBrowserMainParts::ShouldContentCreateFeatureList() { - return false; -} - int AtomBrowserMainParts::PreEarlyInitialization() { InitializeFeatureList(); OverrideAppLogsPath(); @@ -393,8 +396,8 @@ void AtomBrowserMainParts::ToolkitInitialized() { #endif #if defined(OS_WIN) - gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont; - gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize; + gfx::PlatformFontWin::SetAdjustFontCallback(&AdjustUIFont); + gfx::PlatformFontWin::SetGetMinimumFontSizeCallback(&GetMinimumFontSize); wchar_t module_name[MAX_PATH] = {0}; if (GetModuleFileName(NULL, module_name, MAX_PATH)) diff --git a/atom/browser/atom_browser_main_parts.h b/atom/browser/atom_browser_main_parts.h index 5005321c000b..dee3ff6a83e7 100644 --- a/atom/browser/atom_browser_main_parts.h +++ b/atom/browser/atom_browser_main_parts.h @@ -73,7 +73,6 @@ class AtomBrowserMainParts : public content::BrowserMainParts { protected: // content::BrowserMainParts: - bool ShouldContentCreateFeatureList() override; int PreEarlyInitialization() override; void PostEarlyInitialization() override; int PreCreateThreads() override; diff --git a/atom/browser/atom_browser_main_parts_posix.cc b/atom/browser/atom_browser_main_parts_posix.cc index d79e60049f4d..3f0e5327d3af 100644 --- a/atom/browser/atom_browser_main_parts_posix.cc +++ b/atom/browser/atom_browser_main_parts_posix.cc @@ -15,6 +15,8 @@ #include "atom/browser/browser.h" #include "base/posix/eintr_wrapper.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; @@ -137,7 +139,7 @@ void ShutdownDetector::ThreadMain() { base::Closure task = base::Bind(&Browser::Quit, base::Unretained(Browser::Get())); - if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) { + if (!base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, task)) { // Without a UI thread to post the exit task to, there aren't many // options. Raise the signal again. The default handler will pick it up // and cause an ungraceful exit. diff --git a/atom/browser/atom_resource_dispatcher_host_delegate.cc b/atom/browser/atom_resource_dispatcher_host_delegate.cc index 8ae84be28201..0775e716fb1c 100644 --- a/atom/browser/atom_resource_dispatcher_host_delegate.cc +++ b/atom/browser/atom_resource_dispatcher_host_delegate.cc @@ -7,6 +7,8 @@ #include "atom/browser/atom_browser_context.h" #include "atom/browser/web_contents_preferences.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/render_frame_host.h" @@ -90,8 +92,8 @@ bool AtomResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( if (mime_type == "application/pdf") { *origin = GURL(kPdfViewerUIOrigin); - content::BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::Bind(&OnPdfResourceIntercepted, request->url(), render_process_host_id, render_frame_id, info->GetWebContentsGetterForRequest())); diff --git a/atom/browser/browser_process_impl.cc b/atom/browser/browser_process_impl.cc index 37b62b56c9ca..1b3a0a16ae02 100644 --- a/atom/browser/browser_process_impl.cc +++ b/atom/browser/browser_process_impl.cc @@ -110,7 +110,7 @@ void BrowserProcessImpl::PreCreateThreads( } } // Initialize net log file exporter. - net_log_->net_export_file_writer()->Initialize(); + system_network_context_manager_->GetNetExportFileWriter()->Initialize(); // Manage global state of net and other IO thread related. io_thread_ = std::make_unique( diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index 02c3ebee3a68..b25014bbcdf4 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -31,6 +31,7 @@ #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" +#include "content/public/browser/file_select_listener.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" @@ -295,18 +296,21 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser( void CommonWebContentsDelegate::RunFileChooser( content::RenderFrameHost* render_frame_host, - const content::FileChooserParams& params) { + std::unique_ptr listener, + const blink::mojom::FileChooserParams& params) { if (!web_dialog_helper_) web_dialog_helper_.reset(new WebDialogHelper(owner_window(), offscreen_)); - web_dialog_helper_->RunFileChooser(render_frame_host, params); + web_dialog_helper_->RunFileChooser(render_frame_host, std::move(listener), + params); } -void CommonWebContentsDelegate::EnumerateDirectory(content::WebContents* guest, - int request_id, - const base::FilePath& path) { +void CommonWebContentsDelegate::EnumerateDirectory( + content::WebContents* guest, + std::unique_ptr listener, + const base::FilePath& path) { if (!web_dialog_helper_) web_dialog_helper_.reset(new WebDialogHelper(owner_window(), offscreen_)); - web_dialog_helper_->EnumerateDirectory(guest, request_id, path); + web_dialog_helper_->EnumerateDirectory(guest, std::move(listener), path); } void CommonWebContentsDelegate::EnterFullscreenModeForTab( diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h index d4729808ee8d..f575e9872de7 100644 --- a/atom/browser/common_web_contents_delegate.h +++ b/atom/browser/common_web_contents_delegate.h @@ -84,9 +84,10 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate, const std::vector& suggestions) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, - const content::FileChooserParams& params) override; + std::unique_ptr listener, + const blink::mojom::FileChooserParams& params) override; void EnumerateDirectory(content::WebContents* web_contents, - int request_id, + std::unique_ptr listener, const base::FilePath& path) override; void EnterFullscreenModeForTab( content::WebContents* source, diff --git a/atom/browser/lib/power_observer_linux.cc b/atom/browser/lib/power_observer_linux.cc index c0dd0f32b07c..ddaa19c116c8 100644 --- a/atom/browser/lib/power_observer_linux.cc +++ b/atom/browser/lib/power_observer_linux.cc @@ -9,7 +9,7 @@ #include #include "base/bind.h" -#include "device/bluetooth/dbus/dbus_thread_manager_linux.h" +#include "device/bluetooth/dbus/bluez_dbus_thread_manager.h" namespace { @@ -33,7 +33,7 @@ namespace atom { PowerObserverLinux::PowerObserverLinux() : lock_owner_name_(get_executable_basename()), weak_ptr_factory_(this) { - auto* bus = bluez::DBusThreadManagerLinux::Get()->GetSystemBus(); + auto* bus = bluez::BluezDBusThreadManager::Get()->GetSystemBus(); if (!bus) { LOG(WARNING) << "Failed to get system bus connection"; return; diff --git a/atom/browser/login_handler.cc b/atom/browser/login_handler.cc index 43cbdbbad581..a427185120ba 100644 --- a/atom/browser/login_handler.cc +++ b/atom/browser/login_handler.cc @@ -9,7 +9,9 @@ #include "atom/browser/browser.h" #include "atom/common/native_mate_converters/net_converter.h" +#include "base/task/post_task.h" #include "base/values.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "net/base/auth.h" @@ -37,8 +39,8 @@ LoginHandler::LoginHandler( web_contents_getter_ = resource_request_info->GetWebContentsGetterForRequest(); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&Browser::RequestLogin, base::Unretained(Browser::Get()), base::RetainedRef(this), std::move(request_details))); } @@ -49,8 +51,8 @@ void LoginHandler::Login(const base::string16& username, const base::string16& password) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&LoginHandler::DoLogin, weak_factory_.GetWeakPtr(), username, password)); } @@ -58,8 +60,8 @@ void LoginHandler::Login(const base::string16& username, void LoginHandler::CancelAuth() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&LoginHandler::DoCancelAuth, weak_factory_.GetWeakPtr())); } diff --git a/atom/browser/mac/atom_application.h b/atom/browser/mac/atom_application.h index 17eab87d8341..6a533dea4306 100644 --- a/atom/browser/mac/atom_application.h +++ b/atom/browser/mac/atom_application.h @@ -82,13 +82,6 @@ typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) { NSColor* unemphasizedSelectedTextColor API_AVAILABLE(macosx(10.14)); @end -extern "C" { -#if !defined(MAC_OS_X_VERSION_10_14) || \ - MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14 -BASE_EXPORT extern NSString* const NSAppearanceNameDarkAqua; -#endif // MAC_OS_X_VERSION_10_14 -} // extern "C" - @interface AtomApplication : NSApplication { diff --git a/atom/browser/mac/atom_application.mm b/atom/browser/mac/atom_application.mm index 35cab8b0f649..eb00a415bf24 100644 --- a/atom/browser/mac/atom_application.mm +++ b/atom/browser/mac/atom_application.mm @@ -11,11 +11,6 @@ #include "base/strings/sys_string_conversions.h" #include "content/public/browser/browser_accessibility_state.h" -#if !defined(MAC_OS_X_VERSION_10_14) || \ - MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14 -NSString* const NSAppearanceNameDarkAqua = @"NSAppearanceNameDarkAqua"; -#endif // MAC_OS_X_VERSION_10_14 - namespace { inline void dispatch_sync_main(dispatch_block_t block) { diff --git a/atom/browser/mac/in_app_purchase.mm b/atom/browser/mac/in_app_purchase.mm index c5568ba02692..1c10ceff10bd 100644 --- a/atom/browser/mac/in_app_purchase.mm +++ b/atom/browser/mac/in_app_purchase.mm @@ -6,6 +6,8 @@ #include "base/bind.h" #include "base/strings/sys_string_conversions.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #import @@ -117,8 +119,8 @@ */ - (void)runCallback:(bool)isProductValid { if (callback_) { - content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, - base::Bind(callback_, isProductValid)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, + base::Bind(callback_, isProductValid)); } // Release this delegate. [self release]; diff --git a/atom/browser/mac/in_app_purchase_observer.mm b/atom/browser/mac/in_app_purchase_observer.mm index 8192b6991cac..bec5966bbfca 100644 --- a/atom/browser/mac/in_app_purchase_observer.mm +++ b/atom/browser/mac/in_app_purchase_observer.mm @@ -6,6 +6,8 @@ #include "base/bind.h" #include "base/strings/sys_string_conversions.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #import @@ -71,8 +73,8 @@ using InAppTransactionCallback = base::RepeatingCallback @@ -78,8 +80,8 @@ } // Send the callback to the browser thread. - content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, - base::Bind(callback_, converted)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, + base::Bind(callback_, converted)); [self release]; } diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 3dd2dca16ef0..db1d61b568da 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -29,8 +29,8 @@ #include "ui/gfx/skia_util.h" #include "ui/gl/gpu_switching_manager.h" #include "ui/views/background.h" -#include "ui/views/cocoa/bridged_native_widget.h" #include "ui/views/widget/widget.h" +#include "ui/views_bridge_mac/bridged_native_widget_impl.h" // This view always takes the size of its superview. It is intended to be used // as a NSWindow's contentView. It is needed because NSWindow's implementation diff --git a/atom/browser/net/atom_cert_verifier.cc b/atom/browser/net/atom_cert_verifier.cc index 0d8dc25f48dc..b4d87d83c281 100644 --- a/atom/browser/net/atom_cert_verifier.cc +++ b/atom/browser/net/atom_cert_verifier.cc @@ -11,6 +11,8 @@ #include "atom/common/native_mate_converters/net_converter.h" #include "base/containers/linked_list.h" #include "base/memory/weak_ptr.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "net/base/net_errors.h" #include "net/cert/cert_verify_result.h" @@ -96,8 +98,8 @@ class CertVerifierRequest : public AtomCertVerifier::Request { request->certificate = params_.certificate(); auto response_callback = base::Bind(&CertVerifierRequest::OnResponseInUI, weak_ptr_factory_.GetWeakPtr()); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&CertVerifierRequest::OnVerifyRequestInUI, cert_verifier_->verify_proc(), std::move(request), response_callback)); @@ -112,8 +114,8 @@ class CertVerifierRequest : public AtomCertVerifier::Request { static void OnResponseInUI(base::WeakPtr self, int result) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&CertVerifierRequest::NotifyResponseInIO, self, result)); } diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index 7f24e3810d73..d1711a2e0c8d 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -14,6 +14,8 @@ #include "base/command_line.h" #include "base/stl_util.h" #include "base/strings/string_util.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/resource_request_info.h" @@ -397,14 +399,16 @@ net::NetworkDelegate::AuthRequiredResponse AtomNetworkDelegate::OnAuthRequired( } bool AtomNetworkDelegate::OnCanGetCookies(const net::URLRequest& request, - const net::CookieList& cookie_list) { + const net::CookieList& cookie_list, + bool allowed_from_caller) { return true; } bool AtomNetworkDelegate::OnCanSetCookie( const net::URLRequest& request, const net::CanonicalCookie& cookie_line, - net::CookieOptions* options) { + net::CookieOptions* options, + bool allowed_from_caller) { return true; } @@ -487,8 +491,8 @@ int AtomNetworkDelegate::HandleResponseEvent( ResponseCallback response = base::Bind(&AtomNetworkDelegate::OnListenerResultInUI, base::Unretained(this), request->identifier(), out); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(RunResponseListener, info.listener, std::move(details), render_process_id, render_frame_id, response)); return net::ERR_IO_PENDING; @@ -509,8 +513,8 @@ void AtomNetworkDelegate::HandleSimpleEvent(SimpleEvent type, content::ResourceRequestInfo::GetRenderFrameForRequest( request, &render_process_id, &render_frame_id); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(RunSimpleListener, info.listener, std::move(details), render_process_id, render_frame_id)); } @@ -538,8 +542,8 @@ void AtomNetworkDelegate::OnListenerResultInUI( const base::DictionaryValue& response) { auto copy = base::DictionaryValue::From( base::Value::ToUniquePtrValue(response.Clone())); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&AtomNetworkDelegate::OnListenerResultInIO, base::Unretained(this), id, out, std::move(copy))); } diff --git a/atom/browser/net/atom_network_delegate.h b/atom/browser/net/atom_network_delegate.h index 35b4e86b48f7..f5bf09482e38 100644 --- a/atom/browser/net/atom_network_delegate.h +++ b/atom/browser/net/atom_network_delegate.h @@ -118,10 +118,12 @@ class AtomNetworkDelegate : public net::NetworkDelegate { AuthCallback callback, net::AuthCredentials* credentials) override; bool OnCanGetCookies(const net::URLRequest& request, - const net::CookieList& cookie_list) override; + const net::CookieList& cookie_list, + bool allowed_from_caller) override; bool OnCanSetCookie(const net::URLRequest& request, const net::CanonicalCookie& cookie_line, - net::CookieOptions* options) override; + net::CookieOptions* options, + bool allowed_from_caller) override; bool OnCanAccessFile(const net::URLRequest& request, const base::FilePath& original_path, const base::FilePath& absolute_path) const override; diff --git a/atom/browser/net/atom_url_request.cc b/atom/browser/net/atom_url_request.cc index 0b51135b26fb..413f5387abfa 100644 --- a/atom/browser/net/atom_url_request.cc +++ b/atom/browser/net/atom_url_request.cc @@ -13,6 +13,8 @@ #include "atom/browser/atom_browser_context.h" #include "atom/browser/net/atom_url_request_job_factory.h" #include "base/callback.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "net/base/elements_upload_data_stream.h" #include "net/base/io_buffer.h" @@ -77,8 +79,8 @@ scoped_refptr AtomURLRequest::Create( browser_context->GetRequestContext()); DCHECK(request_context_getter); scoped_refptr atom_url_request(new AtomURLRequest(delegate)); - if (content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + if (base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoInitialize, atom_url_request, request_context_getter, method, url, redirect_policy))) { @@ -90,9 +92,8 @@ scoped_refptr AtomURLRequest::Create( void AtomURLRequest::Terminate() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); delegate_ = nullptr; - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::BindOnce(&AtomURLRequest::DoTerminate, this)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&AtomURLRequest::DoTerminate, this)); } void AtomURLRequest::DoInitialize( @@ -140,8 +141,8 @@ void AtomURLRequest::DoTerminate() { bool AtomURLRequest::Write(scoped_refptr buffer, bool is_last) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - return content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + return base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoWriteBuffer, this, buffer, is_last)); } @@ -156,30 +157,29 @@ void AtomURLRequest::SetChunkedUpload(bool is_chunked_upload) { void AtomURLRequest::Cancel() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::BindOnce(&AtomURLRequest::DoCancel, this)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&AtomURLRequest::DoCancel, this)); } void AtomURLRequest::FollowRedirect() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoFollowRedirect, this)); } void AtomURLRequest::SetExtraHeader(const std::string& name, const std::string& value) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoSetExtraHeader, this, name, value)); } void AtomURLRequest::RemoveExtraHeader(const std::string& name) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoRemoveExtraHeader, this, name)); } @@ -188,20 +188,20 @@ void AtomURLRequest::PassLoginInformation( const base::string16& password) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (username.empty() || password.empty()) { - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoCancelAuth, this)); } else { - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoSetAuth, this, username, password)); } } void AtomURLRequest::SetLoadFlags(int flags) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&AtomURLRequest::DoSetLoadFlags, this, flags)); } @@ -309,8 +309,8 @@ void AtomURLRequest::DoCancelAuth() const { void AtomURLRequest::DoCancelWithError(const std::string& error, bool isRequestError) { DoCancel(); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomURLRequest::InformDelegateErrorOccured, this, error, isRequestError)); } @@ -338,8 +338,8 @@ void AtomURLRequest::OnReceivedRedirect(net::URLRequest* request, *defer_redirect = true; scoped_refptr response_headers = request->response_headers(); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomURLRequest::InformDelegateReceivedRedirect, this, info.status_code, info.new_method, info.new_url, response_headers)); @@ -350,8 +350,8 @@ void AtomURLRequest::OnAuthRequired(net::URLRequest* request, net::AuthChallengeInfo* auth_info) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomURLRequest::InformDelegateAuthenticationRequired, this, scoped_refptr(auth_info))); } @@ -369,8 +369,8 @@ void AtomURLRequest::OnResponseStarted(net::URLRequest* request, const auto& status = request_->status(); if (status.is_success()) { // Success or pending trigger a Read. - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomURLRequest::InformDelegateResponseStarted, this, response_headers)); ReadResponse(); @@ -428,8 +428,8 @@ void AtomURLRequest::OnReadCompleted(net::URLRequest* request, int bytes_read) { if (response_error) { DoCancelWithError(net::ErrorToString(status.ToNetError()), false); } else if (data_ended) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomURLRequest::InformDelegateResponseCompleted, this)); DoTerminate(); } else if (data_transfer_error) { @@ -451,8 +451,8 @@ bool AtomURLRequest::CopyAndPostBuffer(int bytes_read) { auto buffer_copy = WrapRefCounted(new net::IOBufferWithSize(bytes_read)); memcpy(buffer_copy->data(), response_read_buffer_->data(), bytes_read); - return content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + return base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomURLRequest::InformDelegateResponseData, this, buffer_copy)); } diff --git a/atom/browser/net/system_network_context_manager.cc b/atom/browser/net/system_network_context_manager.cc index b98695147284..82069a2ea7a2 100644 --- a/atom/browser/net/system_network_context_manager.cc +++ b/atom/browser/net/system_network_context_manager.cc @@ -13,6 +13,7 @@ #include "base/lazy_instance.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h" +#include "components/net_log/net_export_file_writer.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/network_service_instance.h" #include "content/public/common/content_features.h" @@ -147,6 +148,14 @@ SystemNetworkContextManager::GetSharedURLLoaderFactory() { return shared_url_loader_factory_; } +net_log::NetExportFileWriter* +SystemNetworkContextManager::GetNetExportFileWriter() { + if (!net_export_file_writer_) { + net_export_file_writer_ = std::make_unique(); + } + return net_export_file_writer_.get(); +} + // static network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateDefaultNetworkContextParams() { diff --git a/atom/browser/net/system_network_context_manager.h b/atom/browser/net/system_network_context_manager.h index ea09d2d68721..2462dd445400 100644 --- a/atom/browser/net/system_network_context_manager.h +++ b/atom/browser/net/system_network_context_manager.h @@ -23,6 +23,10 @@ class URLLoaderFactory; class SharedURLLoaderFactory; } // namespace network +namespace net_log { +class NetExportFileWriter; +} + // Responsible for creating and managing access to the system NetworkContext. // Lives on the UI thread. The NetworkContext this owns is intended for requests // not associated with a session. It stores no data on disk, and has no HTTP @@ -71,6 +75,9 @@ class SystemNetworkContextManager { // that is backed by the SystemNetworkContext. scoped_refptr GetSharedURLLoaderFactory(); + // Returns a shared global NetExportFileWriter instance. + net_log::NetExportFileWriter* GetNetExportFileWriter(); + // Called when content creates a NetworkService. Creates the // SystemNetworkContext, if the network service is enabled. void OnNetworkServiceCreated(network::mojom::NetworkService* network_service); @@ -98,6 +105,9 @@ class SystemNetworkContextManager { scoped_refptr shared_url_loader_factory_; network::mojom::URLLoaderFactoryPtr url_loader_factory_; + // Initialized on first access. + std::unique_ptr net_export_file_writer_; + DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager); }; diff --git a/atom/browser/net/url_request_async_asar_job.cc b/atom/browser/net/url_request_async_asar_job.cc index bd6601219f1c..1f3bebe8b7d7 100644 --- a/atom/browser/net/url_request_async_asar_job.cc +++ b/atom/browser/net/url_request_async_asar_job.cc @@ -13,6 +13,7 @@ #include "atom/common/native_mate_converters/v8_value_converter.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" namespace atom { @@ -37,8 +38,8 @@ void BeforeStartInUI(base::WeakPtr job, error = net::ERR_NOT_IMPLEMENTED; } - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&URLRequestAsyncAsarJob::StartAsync, job, std::move(request_options), error)); } @@ -55,8 +56,8 @@ URLRequestAsyncAsarJob::~URLRequestAsyncAsarJob() = default; void URLRequestAsyncAsarJob::Start() { auto request_details = std::make_unique(); FillRequestDetails(request_details.get(), request()); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()), handler(), std::move(request_details), base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr()))); diff --git a/atom/browser/net/url_request_buffer_job.cc b/atom/browser/net/url_request_buffer_job.cc index 8f2f43f1e7d4..852e8d80bb9d 100644 --- a/atom/browser/net/url_request_buffer_job.cc +++ b/atom/browser/net/url_request_buffer_job.cc @@ -13,6 +13,8 @@ #include "atom/common/native_mate_converters/v8_value_converter.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "net/base/mime_util.h" #include "net/base/net_errors.h" @@ -47,10 +49,9 @@ void BeforeStartInUI(base::WeakPtr job, error = net::ERR_NOT_IMPLEMENTED; } - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::BindOnce(&URLRequestBufferJob::StartAsync, job, - std::move(request_options), error)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&URLRequestBufferJob::StartAsync, job, + std::move(request_options), error)); } } // namespace @@ -66,8 +67,8 @@ URLRequestBufferJob::~URLRequestBufferJob() = default; void URLRequestBufferJob::Start() { auto request_details = std::make_unique(); FillRequestDetails(request_details.get(), request()); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()), handler(), std::move(request_details), base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr()))); diff --git a/atom/browser/net/url_request_context_getter.cc b/atom/browser/net/url_request_context_getter.cc index a5d674ff3dc8..63af66713570 100644 --- a/atom/browser/net/url_request_context_getter.cc +++ b/atom/browser/net/url_request_context_getter.cc @@ -27,6 +27,7 @@ #include "chrome/common/pref_names.h" #include "components/network_session_configurator/common/network_switches.h" #include "components/prefs/value_map_pref_store.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_network_transaction_factory.h" #include "content/public/browser/network_service_instance.h" @@ -225,8 +226,8 @@ void URLRequestContextGetter::Handle::ShutdownOnUIThread() { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (main_request_context_getter_.get()) { if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&URLRequestContextGetter::NotifyContextShuttingDown, base::RetainedRef(main_request_context_getter_), std::move(resource_context_))); @@ -340,7 +341,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { scoped_refptr URLRequestContextGetter::GetNetworkTaskRunner() const { - return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); + return base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}); } } // namespace atom diff --git a/atom/browser/net/url_request_fetch_job.cc b/atom/browser/net/url_request_fetch_job.cc index 971c4bb3f720..0ed6b599fc59 100644 --- a/atom/browser/net/url_request_fetch_job.cc +++ b/atom/browser/net/url_request_fetch_job.cc @@ -16,6 +16,8 @@ #include "base/guid.h" #include "base/memory/ptr_util.h" #include "base/strings/string_util.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "native_mate/dictionary.h" #include "net/base/io_buffer.h" @@ -87,10 +89,9 @@ void BeforeStartInUI(base::WeakPtr job, mate::Dictionary options; if (!args->GetNext(&value) || !mate::ConvertFromV8(args->isolate(), value, &options)) { - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::BindOnce(&URLRequestFetchJob::OnError, job, - net::ERR_NOT_IMPLEMENTED)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&URLRequestFetchJob::OnError, job, + net::ERR_NOT_IMPLEMENTED)); return; } @@ -125,8 +126,8 @@ void BeforeStartInUI(base::WeakPtr job, JsAsker::IsErrorOptions(request_options.get(), &error); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&URLRequestFetchJob::StartAsync, job, base::RetainedRef(url_request_context_getter), base::RetainedRef(custom_browser_context), @@ -144,8 +145,8 @@ URLRequestFetchJob::~URLRequestFetchJob() = default; void URLRequestFetchJob::Start() { auto request_details = std::make_unique(); FillRequestDetails(request_details.get(), request()); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()), handler(), std::move(request_details), base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr()))); diff --git a/atom/browser/net/url_request_stream_job.cc b/atom/browser/net/url_request_stream_job.cc index aac30522964a..4f2fe0524418 100644 --- a/atom/browser/net/url_request_stream_job.cc +++ b/atom/browser/net/url_request_stream_job.cc @@ -16,7 +16,9 @@ #include "atom/common/node_includes.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" +#include "base/task/post_task.h" #include "base/time/time.h" +#include "content/public/browser/browser_task_traits.h" #include "native_mate/dictionary.h" #include "net/base/net_errors.h" #include "net/filter/gzip_source_stream.h" @@ -32,8 +34,8 @@ void BeforeStartInUI(base::WeakPtr job, bool ended = false; if (!args->GetNext(&value) || !value->IsObject()) { // Invalid opts. - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&URLRequestStreamJob::OnError, job, net::ERR_FAILED)); return; } @@ -65,8 +67,8 @@ void BeforeStartInUI(base::WeakPtr job, // "data" was explicitly passed as null or undefined, assume the user wants // to send an empty body. ended = true; - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&URLRequestStreamJob::StartAsync, job, nullptr, base::RetainedRef(response_headers), ended, error)); return; @@ -76,8 +78,8 @@ void BeforeStartInUI(base::WeakPtr job, if (!data.Get("on", &value) || !value->IsFunction() || !data.Get("removeListener", &value) || !value->IsFunction()) { // If data is passed but it is not a stream, signal an error. - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&URLRequestStreamJob::OnError, job, net::ERR_FAILED)); return; } @@ -85,8 +87,8 @@ void BeforeStartInUI(base::WeakPtr job, auto subscriber = std::make_unique( args->isolate(), data.GetHandle(), job); - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&URLRequestStreamJob::StartAsync, job, std::move(subscriber), base::RetainedRef(response_headers), ended, error)); @@ -113,8 +115,8 @@ URLRequestStreamJob::~URLRequestStreamJob() { void URLRequestStreamJob::Start() { auto request_details = std::make_unique(); FillRequestDetails(request_details.get(), request()); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()), handler(), std::move(request_details), base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr()))); diff --git a/atom/browser/net/url_request_string_job.cc b/atom/browser/net/url_request_string_job.cc index a96d595a3bb1..3ab4f5a2c44a 100644 --- a/atom/browser/net/url_request_string_job.cc +++ b/atom/browser/net/url_request_string_job.cc @@ -11,6 +11,8 @@ #include "atom/common/atom_constants.h" #include "atom/common/native_mate_converters/net_converter.h" #include "atom/common/native_mate_converters/v8_value_converter.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "net/base/net_errors.h" @@ -36,10 +38,9 @@ void BeforeStartInUI(base::WeakPtr job, error = net::ERR_NOT_IMPLEMENTED; } - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::BindOnce(&URLRequestStringJob::StartAsync, job, - std::move(request_options), error)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&URLRequestStringJob::StartAsync, job, + std::move(request_options), error)); } } // namespace @@ -54,8 +55,8 @@ URLRequestStringJob::~URLRequestStringJob() = default; void URLRequestStringJob::Start() { auto request_details = std::make_unique(); FillRequestDetails(request_details.get(), request()); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()), handler(), std::move(request_details), base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr()))); diff --git a/atom/browser/node_debugger.cc b/atom/browser/node_debugger.cc index 20fda27eb6cd..0a9e7d24f1bb 100644 --- a/atom/browser/node_debugger.cc +++ b/atom/browser/node_debugger.cc @@ -37,13 +37,13 @@ void NodeDebugger::Start() { #endif } - auto options = std::make_shared(); + node::DebugOptions options; std::vector exec_args; std::vector v8_args; std::vector errors; node::options_parser::DebugOptionsParser::instance.Parse( - &args, &exec_args, &v8_args, options.get(), + &args, &exec_args, &v8_args, &options, node::options_parser::kDisallowedInEnvironment, &errors); if (!errors.empty()) { @@ -54,13 +54,14 @@ void NodeDebugger::Start() { // Set process._debugWaitConnect if --inspect-brk was specified to stop // the debugger on the first line - if (options->wait_for_connect()) { + if (options.wait_for_connect()) { mate::Dictionary process(env_->isolate(), env_->process_object()); process.Set("_breakFirstLine", true); } const char* path = ""; - if (inspector->Start(path, options, true /* is_main */)) + if (inspector->Start(path, options, env_->inspector_host_port(), + true /* is_main */)) DCHECK(env_->inspector_agent()->IsListening()); } diff --git a/atom/browser/notifications/platform_notification_service.cc b/atom/browser/notifications/platform_notification_service.cc index 768278feec0e..2dda121b1c41 100644 --- a/atom/browser/notifications/platform_notification_service.cc +++ b/atom/browser/notifications/platform_notification_service.cc @@ -11,8 +11,8 @@ #include "base/strings/utf_string_conversions.h" #include "content/public/browser/notification_event_dispatcher.h" #include "content/public/browser/render_process_host.h" -#include "content/public/common/notification_resources.h" -#include "content/public/common/platform_notification_data.h" +#include "third_party/blink/public/common/notifications/notification_resources.h" +#include "third_party/blink/public/common/notifications/platform_notification_data.h" #include "third_party/skia/include/core/SkBitmap.h" namespace atom { @@ -21,7 +21,7 @@ namespace { void OnWebNotificationAllowed(base::WeakPtr notification, const SkBitmap& icon, - const content::PlatformNotificationData& data, + const blink::PlatformNotificationData& data, bool audio_muted, bool allowed) { if (!notification) @@ -82,8 +82,8 @@ void PlatformNotificationService::DisplayNotification( content::BrowserContext* browser_context, const std::string& notification_id, const GURL& origin, - const content::PlatformNotificationData& notification_data, - const content::NotificationResources& notification_resources) { + const blink::PlatformNotificationData& notification_data, + const blink::NotificationResources& notification_resources) { auto* presenter = browser_client_->GetNotificationPresenter(); if (!presenter) return; @@ -104,8 +104,8 @@ void PlatformNotificationService::DisplayPersistentNotification( const std::string& notification_id, const GURL& service_worker_scope, const GURL& origin, - const content::PlatformNotificationData& notification_data, - const content::NotificationResources& notification_resources) {} + const blink::PlatformNotificationData& notification_data, + const blink::NotificationResources& notification_resources) {} void PlatformNotificationService::ClosePersistentNotification( content::BrowserContext* browser_context, diff --git a/atom/browser/notifications/platform_notification_service.h b/atom/browser/notifications/platform_notification_service.h index d89c9e239416..aa485c2ad783 100644 --- a/atom/browser/notifications/platform_notification_service.h +++ b/atom/browser/notifications/platform_notification_service.h @@ -28,15 +28,15 @@ class PlatformNotificationService content::BrowserContext* browser_context, const std::string& notification_id, const GURL& origin, - const content::PlatformNotificationData& notification_data, - const content::NotificationResources& notification_resources) override; + const blink::PlatformNotificationData& notification_data, + const blink::NotificationResources& notification_resources) override; void DisplayPersistentNotification( content::BrowserContext* browser_context, const std::string& notification_id, const GURL& service_worker_scope, const GURL& origin, - const content::PlatformNotificationData& notification_data, - const content::NotificationResources& notification_resources) override; + const blink::PlatformNotificationData& notification_data, + const blink::NotificationResources& notification_resources) override; void ClosePersistentNotification(content::BrowserContext* browser_context, const std::string& notification_id) override; void CloseNotification(content::BrowserContext* browser_context, diff --git a/atom/browser/notifications/win/notification_presenter_win.cc b/atom/browser/notifications/win/notification_presenter_win.cc index df49b8ceba16..797c33a5df78 100644 --- a/atom/browser/notifications/win/notification_presenter_win.cc +++ b/atom/browser/notifications/win/notification_presenter_win.cc @@ -19,7 +19,6 @@ #include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "base/win/windows_version.h" -#include "content/public/common/platform_notification_data.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/png_codec.h" diff --git a/atom/browser/notifications/win/windows_toast_notification.cc b/atom/browser/notifications/win/windows_toast_notification.cc index c74326d75259..22353a1e8808 100644 --- a/atom/browser/notifications/win/windows_toast_notification.cc +++ b/atom/browser/notifications/win/windows_toast_notification.cc @@ -17,6 +17,8 @@ #include "atom/common/application_info.h" #include "base/environment.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" using ABI::Windows::Data::Xml::Dom::IXmlAttribute; @@ -411,8 +413,8 @@ ToastEventHandler::~ToastEventHandler() {} IFACEMETHODIMP ToastEventHandler::Invoke( ABI::Windows::UI::Notifications::IToastNotification* sender, IInspectable* args) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::Bind(&Notification::NotificationClicked, notification_)); if (IsDebuggingNotifications()) LOG(INFO) << "Notification clicked"; @@ -423,8 +425,8 @@ IFACEMETHODIMP ToastEventHandler::Invoke( IFACEMETHODIMP ToastEventHandler::Invoke( ABI::Windows::UI::Notifications::IToastNotification* sender, ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::Bind(&Notification::NotificationDismissed, notification_)); if (IsDebuggingNotifications()) LOG(INFO) << "Notification dismissed"; @@ -435,8 +437,8 @@ IFACEMETHODIMP ToastEventHandler::Invoke( IFACEMETHODIMP ToastEventHandler::Invoke( ABI::Windows::UI::Notifications::IToastNotification* sender, ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::Bind(&Notification::NotificationFailed, notification_)); if (IsDebuggingNotifications()) LOG(INFO) << "Notification failed"; diff --git a/atom/browser/osr/osr_render_widget_host_view.cc b/atom/browser/osr/osr_render_widget_host_view.cc index e80c553b9d06..9691bb6e6391 100644 --- a/atom/browser/osr/osr_render_widget_host_view.cc +++ b/atom/browser/osr/osr_render_widget_host_view.cc @@ -13,6 +13,7 @@ #include "base/location.h" #include "base/memory/ptr_util.h" #include "base/single_thread_task_runner.h" +#include "base/task/post_task.h" #include "base/time/time.h" #include "components/viz/common/features.h" #include "components/viz/common/frame_sinks/copy_output_request.h" @@ -23,6 +24,7 @@ #include "content/browser/renderer_host/render_widget_host_delegate.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/context_factory.h" #include "content/public/browser/render_process_host.h" @@ -168,8 +170,8 @@ class AtomCopyFrameGenerator { base::TimeDelta next_frame_in = next_frame_time_ - now; if (next_frame_in > frame_duration_ / 4) { next_frame_time_ += frame_duration_; - content::BrowserThread::PostDelayedTask( - content::BrowserThread::UI, FROM_HERE, + base::PostDelayedTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomCopyFrameGenerator::OnCopyFrameCaptureSuccess, weak_ptr_factory_.GetWeakPtr(), damage_rect, bitmap), next_frame_in); @@ -188,8 +190,8 @@ class AtomCopyFrameGenerator { const bool force_frame = (++frame_retry_count_ <= kFrameRetryLimit); if (force_frame) { // Retry with the same |damage_rect|. - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&AtomCopyFrameGenerator::GenerateCopyFrame, weak_ptr_factory_.GetWeakPtr(), damage_rect)); } @@ -222,8 +224,8 @@ class AtomBeginFrameTimer : public viz::DelayBasedTimeSourceClient { const base::Closure& callback) : callback_(callback) { time_source_.reset(new viz::DelayBasedTimeSource( - content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::UI) + base::CreateSingleThreadTaskRunnerWithTraits( + {content::BrowserThread::UI}) .get())); time_source_->SetTimebaseAndInterval( base::TimeTicks(), @@ -1005,8 +1007,8 @@ void OffScreenRenderWidgetHostView::ReleaseResize() { hold_resize_ = false; if (pending_resize_) { pending_resize_ = false; - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce( &OffScreenRenderWidgetHostView::SynchronizeVisualProperties, weak_ptr_factory_.GetWeakPtr())); @@ -1110,8 +1112,8 @@ void OffScreenRenderWidgetHostView::SendMouseWheelEvent( // Scrolling outside of the popup widget so destroy it. // Execute asynchronously to avoid deleting the widget from inside some // other callback. - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&OffScreenRenderWidgetHostView::CancelWidget, popup_host_view_->weak_ptr_factory_.GetWeakPtr())); } diff --git a/atom/browser/osr/osr_web_contents_view.cc b/atom/browser/osr/osr_web_contents_view.cc index 5cbbae37322f..d491f10e54e5 100644 --- a/atom/browser/osr/osr_web_contents_view.cc +++ b/atom/browser/osr/osr_web_contents_view.cc @@ -166,12 +166,6 @@ void OffScreenWebContentsView::RenderViewHostChanged( void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {} #if defined(OS_MACOSX) -void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {} - -bool OffScreenWebContentsView::GetAllowOtherViews() const { - return false; -} - bool OffScreenWebContentsView::IsEventTracking() const { return false; } diff --git a/atom/browser/osr/osr_web_contents_view.h b/atom/browser/osr/osr_web_contents_view.h index febae35bad25..68f47eb44f31 100644 --- a/atom/browser/osr/osr_web_contents_view.h +++ b/atom/browser/osr/osr_web_contents_view.h @@ -67,8 +67,6 @@ class OffScreenWebContentsView : public content::WebContentsView, void SetOverscrollControllerEnabled(bool enabled) override; #if defined(OS_MACOSX) - void SetAllowOtherViews(bool allow) override; - bool GetAllowOtherViews() const override; bool IsEventTracking() const override; void CloseTabAfterEventTracking() override; #endif diff --git a/atom/browser/printing/print_preview_message_handler.cc b/atom/browser/printing/print_preview_message_handler.cc index 4e3b0f4bc28f..27779f4cb3de 100644 --- a/atom/browser/printing/print_preview_message_handler.cc +++ b/atom/browser/printing/print_preview_message_handler.cc @@ -11,6 +11,7 @@ #include "base/memory/read_only_shared_memory_region.h" #include "base/memory/ref_counted.h" #include "base/memory/ref_counted_memory.h" +#include "base/task/post_task.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/printer_query.h" @@ -18,6 +19,7 @@ #include "components/printing/browser/print_manager_utils.h" #include "components/printing/common/print_messages.h" #include "components/services/pdf_compositor/public/cpp/pdf_service_mojo_types.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" @@ -38,24 +40,12 @@ void StopWorker(int document_cookie) { scoped_refptr printer_query = queue->PopPrinterQuery(document_cookie); if (printer_query.get()) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::BindOnce(&printing::PrinterQuery::StopWorker, printer_query)); } } -scoped_refptr GetDataFromHandle( - base::SharedMemoryHandle handle, - uint32_t data_size) { - auto shared_buf = std::make_unique(handle, true); - if (!shared_buf->Map(data_size)) { - return nullptr; - } - - return base::MakeRefCounted( - std::move(shared_buf), data_size); -} - } // namespace PrintPreviewMessageHandler::PrintPreviewMessageHandler( @@ -97,7 +87,7 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting( StopWorker(params.document_cookie); const PrintHostMsg_DidPrintContent_Params& content = params.content; - if (!content.metafile_data_handle.IsValid() || + if (!content.metafile_data_region.IsValid() || params.expected_pages_count <= 0) { RunPrintToPDFCallback(ids.request_id, nullptr); return; @@ -114,7 +104,8 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting( } else { RunPrintToPDFCallback( ids.request_id, - GetDataFromHandle(content.metafile_data_handle, content.data_size)); + base::RefCountedSharedMemoryMapping::CreateFromWholeRegion( + content.metafile_data_region)); } } diff --git a/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm b/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm index 69e83db80c0d..f61eb2bdafd9 100644 --- a/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm +++ b/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm @@ -77,18 +77,10 @@ auto* inspectable_web_contents = inspectableWebContentsView_->inspectable_web_contents(); - auto* webContents = inspectable_web_contents->GetWebContents(); auto* devToolsWebContents = inspectable_web_contents->GetDevToolsWebContents(); auto devToolsView = devToolsWebContents->GetNativeView(); - if (visible && devtools_docked_) { - webContents->SetAllowOtherViews(true); - devToolsWebContents->SetAllowOtherViews(true); - } else if (!inspectable_web_contents->IsGuest()) { - webContents->SetAllowOtherViews(false); - } - devtools_visible_ = visible; if (devtools_docked_) { if (visible) { diff --git a/atom/browser/ui/cocoa/atom_menu_controller.mm b/atom/browser/ui/cocoa/atom_menu_controller.mm index 518b1c0d2941..403e2fcf73b2 100644 --- a/atom/browser/ui/cocoa/atom_menu_controller.mm +++ b/atom/browser/ui/cocoa/atom_menu_controller.mm @@ -9,6 +9,8 @@ #include "base/logging.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/platform_accelerator_cocoa.h" @@ -124,7 +126,7 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; isMenuOpen_ = NO; model_->MenuWillClose(); if (!closeCallback.is_null()) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, closeCallback); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closeCallback); } } } @@ -335,7 +337,7 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; // Post async task so that itemSelected runs before the close callback // deletes the controller from the map which deallocates it if (!closeCallback.is_null()) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, closeCallback); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closeCallback); } } } diff --git a/atom/browser/ui/cocoa/atom_ns_window.h b/atom/browser/ui/cocoa/atom_ns_window.h index d708b5f5d8b8..8e82f3f663ba 100644 --- a/atom/browser/ui/cocoa/atom_ns_window.h +++ b/atom/browser/ui/cocoa/atom_ns_window.h @@ -6,8 +6,8 @@ #define ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_ #include "atom/browser/ui/cocoa/event_dispatching_window.h" -#include "ui/views/cocoa/native_widget_mac_nswindow.h" #include "ui/views/widget/native_widget_mac.h" +#include "ui/views_bridge_mac/native_widget_mac_nswindow.h" namespace atom { diff --git a/atom/browser/ui/cocoa/atom_ns_window_delegate.h b/atom/browser/ui/cocoa/atom_ns_window_delegate.h index ebd860316af8..32a37d06921b 100644 --- a/atom/browser/ui/cocoa/atom_ns_window_delegate.h +++ b/atom/browser/ui/cocoa/atom_ns_window_delegate.h @@ -7,7 +7,7 @@ #include -#include "ui/views/cocoa/views_nswindow_delegate.h" +#include "ui/views_bridge_mac/views_nswindow_delegate.h" namespace atom { class NativeWindowMac; diff --git a/atom/browser/ui/cocoa/atom_ns_window_delegate.mm b/atom/browser/ui/cocoa/atom_ns_window_delegate.mm index 6a039ad5ae91..dce3e6f81b89 100644 --- a/atom/browser/ui/cocoa/atom_ns_window_delegate.mm +++ b/atom/browser/ui/cocoa/atom_ns_window_delegate.mm @@ -9,8 +9,8 @@ #include "atom/browser/ui/cocoa/atom_preview_item.h" #include "atom/browser/ui/cocoa/atom_touch_bar.h" #include "base/mac/mac_util.h" -#include "ui/views/cocoa/bridged_native_widget.h" #include "ui/views/widget/native_widget_mac.h" +#include "ui/views_bridge_mac/bridged_native_widget_impl.h" @implementation AtomNSWindowDelegate @@ -21,9 +21,8 @@ // on the fly. // TODO(zcbenz): Add interface in NativeWidgetMac to allow overriding creating // window delegate. - views::BridgedNativeWidget* bridged_view = - views::NativeWidgetMac::GetBridgeForNativeWindow( - shell->GetNativeWindow()); + auto* bridged_view = views::BridgedNativeWidgetImpl::GetFromNativeWindow( + shell->GetNativeWindow()); if ((self = [super initWithBridgedNativeWidget:bridged_view])) { shell_ = shell; is_zooming_ = false; @@ -248,9 +247,8 @@ // Clears the delegate when window is going to be closed, since EL Capitan it // is possible that the methods of delegate would get called after the window // has been closed. - views::BridgedNativeWidget* bridged_view = - views::NativeWidgetMac::GetBridgeForNativeWindow( - shell_->GetNativeWindow()); + auto* bridged_view = views::BridgedNativeWidgetImpl::GetFromNativeWindow( + shell_->GetNativeWindow()); bridged_view->OnWindowWillClose(); } diff --git a/atom/browser/ui/devtools_manager_delegate.cc b/atom/browser/ui/devtools_manager_delegate.cc index 498ab5c5c9e7..5e827ed72678 100644 --- a/atom/browser/ui/devtools_manager_delegate.cc +++ b/atom/browser/ui/devtools_manager_delegate.cc @@ -22,7 +22,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" #include "content/public/common/user_agent.h" -#include "content/shell/grit/shell_resources.h" +#include "electron/grit/electron_resources.h" #include "net/base/net_errors.h" #include "net/socket/stream_socket.h" #include "net/socket/tcp_server_socket.h" diff --git a/atom/browser/ui/devtools_ui.cc b/atom/browser/ui/devtools_ui.cc index 47a989ec2245..8986eb9b6ee3 100644 --- a/atom/browser/ui/devtools_ui.cc +++ b/atom/browser/ui/devtools_ui.cc @@ -4,6 +4,7 @@ #include "atom/browser/ui/devtools_ui.h" +#include #include #include "base/memory/ref_counted_memory.h" @@ -56,6 +57,7 @@ std::string GetMimeTypeForPath(const std::string& path) { class BundledDataSource : public content::URLDataSource { public: BundledDataSource() {} + ~BundledDataSource() override {} // content::URLDataSource implementation. std::string GetSource() const override { return kChromeUIDevToolsHost; } @@ -104,7 +106,6 @@ class BundledDataSource : public content::URLDataSource { } private: - ~BundledDataSource() override {} DISALLOW_COPY_AND_ASSIGN(BundledDataSource); }; @@ -114,7 +115,8 @@ DevToolsUI::DevToolsUI(content::BrowserContext* browser_context, content::WebUI* web_ui) : WebUIController(web_ui) { web_ui->SetBindings(0); - content::URLDataSource::Add(browser_context, new BundledDataSource()); + content::URLDataSource::Add(browser_context, + std::make_unique()); } } // namespace atom diff --git a/atom/browser/ui/file_dialog_gtk.cc b/atom/browser/ui/file_dialog_gtk.cc index 0d970b34d3ba..1a323e55875a 100644 --- a/atom/browser/ui/file_dialog_gtk.cc +++ b/atom/browser/ui/file_dialog_gtk.cc @@ -11,8 +11,8 @@ #include "base/callback.h" #include "base/files/file_util.h" #include "base/strings/string_util.h" -#include "chrome/browser/ui/libgtkui/gtk_signal.h" #include "chrome/browser/ui/libgtkui/gtk_util.h" +#include "ui/base/glib/glib_signal.h" #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" namespace file_dialog { @@ -147,7 +147,11 @@ class FileChooserDialog { return paths; } - CHROMEGTK_CALLBACK_1(FileChooserDialog, void, OnFileDialogResponse, int); + CHROMEG_CALLBACK_1(FileChooserDialog, + void, + OnFileDialogResponse, + GtkWidget*, + int); GtkWidget* dialog() const { return dialog_; } diff --git a/atom/browser/ui/inspectable_web_contents_impl.cc b/atom/browser/ui/inspectable_web_contents_impl.cc index 4343175cd22f..6f29c9180b3c 100644 --- a/atom/browser/ui/inspectable_web_contents_impl.cc +++ b/atom/browser/ui/inspectable_web_contents_impl.cc @@ -20,12 +20,15 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" #include "base/values.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/file_select_listener.h" #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_frame_host.h" @@ -175,8 +178,8 @@ int ResponseWriter::Write(net::IOBuffer* buffer, base::Value* id = new base::Value(stream_id_); base::Value* chunk_value = new base::Value(chunk); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&InspectableWebContentsImpl::CallClientFunction, bindings_, "DevToolsAPI.streamWrite", base::Owned(id), base::Owned(chunk_value), nullptr)); @@ -426,7 +429,7 @@ void InspectableWebContentsImpl::ActivateWindow() { } void InspectableWebContentsImpl::CloseWindow() { - GetDevToolsWebContents()->DispatchBeforeUnload(); + GetDevToolsWebContents()->DispatchBeforeUnload(false /* auto_cancel */); } void InspectableWebContentsImpl::LoadCompleted() { @@ -801,19 +804,20 @@ content::ColorChooser* InspectableWebContentsImpl::OpenColorChooser( void InspectableWebContentsImpl::RunFileChooser( content::RenderFrameHost* render_frame_host, - const content::FileChooserParams& params) { + std::unique_ptr listener, + const blink::mojom::FileChooserParams& params) { auto* delegate = web_contents_->GetDelegate(); if (delegate) - delegate->RunFileChooser(render_frame_host, params); + delegate->RunFileChooser(render_frame_host, std::move(listener), params); } void InspectableWebContentsImpl::EnumerateDirectory( content::WebContents* source, - int request_id, + std::unique_ptr listener, const base::FilePath& path) { auto* delegate = web_contents_->GetDelegate(); if (delegate) - delegate->EnumerateDirectory(source, request_id, path); + delegate->EnumerateDirectory(source, std::move(listener), path); } void InspectableWebContentsImpl::OnWebContentsFocused( diff --git a/atom/browser/ui/inspectable_web_contents_impl.h b/atom/browser/ui/inspectable_web_contents_impl.h index 8e15b6191e3e..90bda6070bf2 100644 --- a/atom/browser/ui/inspectable_web_contents_impl.h +++ b/atom/browser/ui/inspectable_web_contents_impl.h @@ -191,9 +191,10 @@ class InspectableWebContentsImpl const std::vector& suggestions) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, - const content::FileChooserParams& params) override; + std::unique_ptr listener, + const blink::mojom::FileChooserParams& params) override; void EnumerateDirectory(content::WebContents* source, - int request_id, + std::unique_ptr listener, const base::FilePath& path) override; // net::URLFetcherDelegate: diff --git a/atom/browser/ui/message_box_gtk.cc b/atom/browser/ui/message_box_gtk.cc index 48c749dbbd39..5afdca58fe77 100644 --- a/atom/browser/ui/message_box_gtk.cc +++ b/atom/browser/ui/message_box_gtk.cc @@ -13,9 +13,9 @@ #include "base/callback.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/ui/libgtkui/gtk_signal.h" #include "chrome/browser/ui/libgtkui/gtk_util.h" #include "chrome/browser/ui/libgtkui/skia_utils_gtk.h" +#include "ui/base/glib/glib_signal.h" #include "ui/gfx/image/image_skia.h" #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" @@ -168,8 +168,8 @@ class GtkMessageBox : public NativeWindowObserver { parent_ = nullptr; } - CHROMEGTK_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, int); - CHROMEGTK_CALLBACK_0(GtkMessageBox, void, OnCheckboxToggled); + CHROMEG_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, GtkWidget*, int); + CHROMEG_CALLBACK_0(GtkMessageBox, void, OnCheckboxToggled, GtkWidget*); private: atom::UnresponsiveSuppressor unresponsive_suppressor_; diff --git a/atom/browser/ui/message_box_win.cc b/atom/browser/ui/message_box_win.cc index b0e73f550e1d..1e5795364537 100644 --- a/atom/browser/ui/message_box_win.cc +++ b/atom/browser/ui/message_box_win.cc @@ -17,8 +17,10 @@ #include "base/callback.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" #include "base/threading/thread.h" #include "base/win/scoped_gdi_object.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "ui/gfx/icon_util.h" #include "ui/gfx/image/image_skia.h" @@ -222,9 +224,8 @@ void RunMessageBoxInNewThread(base::Thread* thread, int result = ShowTaskDialogUTF8(parent, type, buttons, default_id, cancel_id, options, title, message, detail, checkbox_label, &checkbox_checked, icon); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::Bind(callback, result, checkbox_checked)); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, + base::Bind(callback, result, checkbox_checked)); content::BrowserThread::DeleteSoon(content::BrowserThread::UI, FROM_HERE, thread); } diff --git a/atom/browser/ui/views/autofill_popup_view.cc b/atom/browser/ui/views/autofill_popup_view.cc index 5f4aee2dbc8e..8a726916f452 100644 --- a/atom/browser/ui/views/autofill_popup_view.cc +++ b/atom/browser/ui/views/autofill_popup_view.cc @@ -201,7 +201,7 @@ void AutofillPopupView::DrawAutofillEntry(gfx::Canvas* canvas, canvas->DrawStringRectWithFlags( popup_->GetLabelAt(index), popup_->GetLabelFontListForRow(index), GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_ResultsTableNormalDimmedText), + ui::NativeTheme::kColorId_ResultsTableDimmedText), gfx::Rect(label_x_align_left, entry_rect.y(), label_width, entry_rect.height()), text_align); diff --git a/atom/browser/ui/views/menu_delegate.cc b/atom/browser/ui/views/menu_delegate.cc index 1b6330710da6..5d6c3e72ca30 100644 --- a/atom/browser/ui/views/menu_delegate.cc +++ b/atom/browser/ui/views/menu_delegate.cc @@ -6,6 +6,8 @@ #include "atom/browser/ui/views/menu_bar.h" #include "atom/browser/ui/views/menu_model_adapter.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "ui/views/controls/button/menu_button.h" #include "ui/views/controls/menu/menu_item_view.h" @@ -130,8 +132,8 @@ views::MenuItemView* MenuDelegate::GetSiblingMenu( button_to_open_ = button; // Switching menu asyncnously to avoid crash. if (!switch_in_progress) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::Bind(&views::MenuRunner::Cancel, base::Unretained(menu_runner_.get()))); } diff --git a/atom/browser/ui/webui/pdf_viewer_ui.cc b/atom/browser/ui/webui/pdf_viewer_ui.cc index 6d670af5f078..e364050f1f8f 100644 --- a/atom/browser/ui/webui/pdf_viewer_ui.cc +++ b/atom/browser/ui/webui/pdf_viewer_ui.cc @@ -14,12 +14,14 @@ #include "atom/common/api/api_messages.h" #include "atom/common/atom_constants.h" #include "base/sequenced_task_runner_helpers.h" +#include "base/task/post_task.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/loader/resource_request_info_impl.h" #include "content/browser/loader/stream_resource_handler.h" #include "content/browser/resource_context_impl.h" #include "content/browser/streams/stream.h" #include "content/browser/streams/stream_context.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" @@ -183,8 +185,8 @@ class PdfViewerUI::ResourceRequester new net::HttpResponseHeaders(headers->raw_headers()); stream_info_->mime_type = mime_type; - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::Bind(&CallMigrationCallback, base::Passed(&stream_response_cb_), base::Passed(&stream_info_))); @@ -243,8 +245,8 @@ void PdfViewerUI::RenderFrameCreated(content::RenderFrameHost* rfh) { auto callback = base::BindOnce(&PdfViewerUI::OnPdfStreamCreated, base::Unretained(this)); resource_requester_ = new ResourceRequester(std::move(callback)); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::Bind(&ResourceRequester::StartRequest, resource_requester_, GURL(src_), GURL(kPdfViewerUIOrigin), render_process_id, render_view_id, render_frame_id, resource_context)); diff --git a/atom/browser/web_dialog_helper.cc b/atom/browser/web_dialog_helper.cc index 74c8573d13f1..85ca079719cc 100644 --- a/atom/browser/web_dialog_helper.cc +++ b/atom/browser/web_dialog_helper.cc @@ -5,6 +5,7 @@ #include "atom/browser/web_dialog_helper.h" #include +#include #include #include "atom/browser/atom_browser_context.h" @@ -16,23 +17,29 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" +#include "content/public/browser/file_select_listener.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/file_chooser_file_info.h" -#include "content/public/common/file_chooser_params.h" #include "net/base/mime_util.h" #include "ui/shell_dialogs/selected_file_info.h" +using blink::mojom::FileChooserFileInfo; +using blink::mojom::FileChooserFileInfoPtr; +using blink::mojom::FileChooserParams; + namespace { class FileSelectHelper : public base::RefCounted, public content::WebContentsObserver { public: FileSelectHelper(content::RenderFrameHost* render_frame_host, - const content::FileChooserParams::Mode& mode) - : render_frame_host_(render_frame_host), mode_(mode) { + std::unique_ptr listener, + blink::mojom::FileChooserParams::Mode mode) + : render_frame_host_(render_frame_host), + listener_(std::move(listener)), + mode_(mode) { auto* web_contents = content::WebContents::FromRenderFrameHost(render_frame_host); content::WebContentsObserver::Observe(web_contents); @@ -61,13 +68,12 @@ class FileSelectHelper : public base::RefCounted, void OnOpenDialogDone(bool result, const std::vector& paths) #endif { - std::vector file_info; + std::vector file_info; if (result) { for (auto& path : paths) { - content::FileChooserFileInfo info; - info.file_path = path; - info.display_name = path.BaseName().value(); - file_info.push_back(info); + file_info.push_back(FileChooserFileInfo::NewNativeFile( + blink::mojom::NativeFileInfo::New( + path, path.BaseName().AsUTF16Unsafe()))); } if (render_frame_host_ && !paths.empty()) { @@ -77,7 +83,7 @@ class FileSelectHelper : public base::RefCounted, paths[0].DirName()); } } - OnFilesSelected(file_info); + OnFilesSelected(std::move(file_info)); } #if defined(MAS_BUILD) @@ -88,20 +94,22 @@ class FileSelectHelper : public base::RefCounted, void OnSaveDialogDone(bool result, const base::FilePath& path) #endif { - std::vector file_info; + std::vector file_info; if (result) { - content::FileChooserFileInfo info; - info.file_path = path; - info.display_name = path.BaseName().value(); - file_info.push_back(info); + file_info.push_back( + FileChooserFileInfo::NewNativeFile(blink::mojom::NativeFileInfo::New( + path, path.BaseName().AsUTF16Unsafe()))); } - OnFilesSelected(file_info); + OnFilesSelected(std::move(file_info)); } - void OnFilesSelected( - const std::vector& file_info) { - if (render_frame_host_) - render_frame_host_->FilesSelectedInChooser(file_info, mode_); + void OnFilesSelected(std::vector file_info) { + if (listener_) { + listener_->FileSelected(std::move(file_info), mode_); + listener_.reset(); + } + render_frame_host_ = nullptr; + Release(); } // content::WebContentsObserver: @@ -121,7 +129,8 @@ class FileSelectHelper : public base::RefCounted, void WebContentsDestroyed() override { render_frame_host_ = nullptr; } content::RenderFrameHost* render_frame_host_; - content::FileChooserParams::Mode mode_; + std::unique_ptr listener_; + blink::mojom::FileChooserParams::Mode mode_; }; file_dialog::Filters GetFileTypesFromAcceptType( @@ -201,31 +210,30 @@ WebDialogHelper::~WebDialogHelper() {} void WebDialogHelper::RunFileChooser( content::RenderFrameHost* render_frame_host, - const content::FileChooserParams& params) { - std::vector result; - + std::unique_ptr listener, + const blink::mojom::FileChooserParams& params) { file_dialog::DialogSettings settings; settings.force_detached = offscreen_; settings.filters = GetFileTypesFromAcceptType(params.accept_types); settings.parent_window = window_; settings.title = base::UTF16ToUTF8(params.title); - scoped_refptr file_select_helper( - new FileSelectHelper(render_frame_host, params.mode)); - if (params.mode == content::FileChooserParams::Save) { + scoped_refptr file_select_helper(new FileSelectHelper( + render_frame_host, std::move(listener), params.mode)); + if (params.mode == FileChooserParams::Mode::kSave) { settings.default_path = params.default_file_name; file_select_helper->ShowSaveDialog(settings); } else { int flags = file_dialog::FILE_DIALOG_CREATE_DIRECTORY; switch (params.mode) { - case content::FileChooserParams::OpenMultiple: + case FileChooserParams::Mode::kOpenMultiple: flags |= file_dialog::FILE_DIALOG_MULTI_SELECTIONS; FALLTHROUGH; - case content::FileChooserParams::Open: + case FileChooserParams::Mode::kOpen: flags |= file_dialog::FILE_DIALOG_OPEN_FILE; flags |= file_dialog::FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY; break; - case content::FileChooserParams::UploadFolder: + case FileChooserParams::Mode::kUploadFolder: flags |= file_dialog::FILE_DIALOG_OPEN_DIRECTORY; break; default: @@ -242,20 +250,23 @@ void WebDialogHelper::RunFileChooser( } } -void WebDialogHelper::EnumerateDirectory(content::WebContents* web_contents, - int request_id, - const base::FilePath& dir) { +void WebDialogHelper::EnumerateDirectory( + content::WebContents* web_contents, + std::unique_ptr listener, + const base::FilePath& dir) { int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES | base::FileEnumerator::INCLUDE_DOT_DOT; base::FileEnumerator file_enum(dir, false, types); base::FilePath path; - std::vector paths; - while (!(path = file_enum.Next()).empty()) - paths.push_back(path); + std::vector file_info; + while (!(path = file_enum.Next()).empty()) { + file_info.push_back(FileChooserFileInfo::NewNativeFile( + blink::mojom::NativeFileInfo::New(path, base::string16()))); + } - web_contents->GetRenderViewHost()->DirectoryEnumerationFinished(request_id, - paths); + listener->FileSelected(std::move(file_info), + FileChooserParams::Mode::kUploadFolder); } } // namespace atom diff --git a/atom/browser/web_dialog_helper.h b/atom/browser/web_dialog_helper.h index e08a1a915bc2..3574552d4a98 100644 --- a/atom/browser/web_dialog_helper.h +++ b/atom/browser/web_dialog_helper.h @@ -5,14 +5,17 @@ #ifndef ATOM_BROWSER_WEB_DIALOG_HELPER_H_ #define ATOM_BROWSER_WEB_DIALOG_HELPER_H_ +#include + #include "base/memory/weak_ptr.h" +#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" namespace base { class FilePath; } namespace content { -struct FileChooserParams; +class FileSelectListener; class RenderFrameHost; class WebContents; } // namespace content @@ -27,9 +30,10 @@ class WebDialogHelper { ~WebDialogHelper(); void RunFileChooser(content::RenderFrameHost* render_frame_host, - const content::FileChooserParams& params); + std::unique_ptr listener, + const blink::mojom::FileChooserParams& params); void EnumerateDirectory(content::WebContents* web_contents, - int request_id, + std::unique_ptr listener, const base::FilePath& path); private: diff --git a/atom/common/api/atom_api_asar.cc b/atom/common/api/atom_api_asar.cc index b915c64924b3..ed013b8dd608 100644 --- a/atom/common/api/atom_api_asar.cc +++ b/atom/common/api/atom_api_asar.cc @@ -15,7 +15,7 @@ #include "native_mate/wrappable.h" #include "atom/common/node_includes.h" -#include "atom_natives.h" // NOLINT: This file is generated with js2c. +#include "third_party/electron_node/src/node_native_module.h" namespace { @@ -122,23 +122,15 @@ void InitAsarSupport(v8::Isolate* isolate, v8::Local source, v8::Local require) { // Evaluate asar_init.js. - v8::Local context(isolate->GetCurrentContext()); - auto maybe_asar_init = v8::Script::Compile( - context, node::asar_init_value.ToStringChecked(isolate)); - v8::Local asar_init; - v8::Local result; - if (maybe_asar_init.ToLocal(&asar_init)) - result = asar_init->Run(context).ToLocalChecked(); + std::vector> asar_init_params = { + node::FIXED_ONE_BYTE_STRING(isolate, "source"), + node::FIXED_ONE_BYTE_STRING(isolate, "require")}; - // Initialize asar support. - DCHECK(result->IsFunction()); + std::vector> asar_init_args = {source, require}; - v8::Local args[] = { - source, - require, - node::asar_value.ToStringChecked(isolate), - }; - result.As()->Call(result, 3, args); + node::per_process::native_module_loader.CompileAndCall( + isolate->GetCurrentContext(), "electron/js2c/asar_init", + &asar_init_params, &asar_init_args, nullptr); } void Initialize(v8::Local exports, diff --git a/atom/common/api/atom_api_crash_reporter.cc b/atom/common/api/atom_api_crash_reporter.cc index 4aa48085d4d3..15271f4b8184 100644 --- a/atom/common/api/atom_api_crash_reporter.cc +++ b/atom/common/api/atom_api_crash_reporter.cc @@ -22,7 +22,9 @@ struct Converter { v8::Isolate* isolate, const CrashReporter::UploadReportResult& reports) { mate::Dictionary dict(isolate, v8::Object::New(isolate)); - dict.Set("date", v8::Date::New(isolate, reports.first * 1000.0)); + dict.Set("date", + v8::Date::New(isolate->GetCurrentContext(), reports.first * 1000.0) + .ToLocalChecked()); dict.Set("id", reports.second); return dict.GetHandle(); } diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index 38a937405564..9f70607badf2 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -273,7 +273,7 @@ v8::Local NativeImage::ToPNG(mate::Arguments* args) { } const SkBitmap bitmap = - image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap(); + image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap(); std::vector encoded; gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &encoded); const char* data = reinterpret_cast(encoded.data()); @@ -285,7 +285,7 @@ v8::Local NativeImage::ToBitmap(mate::Arguments* args) { float scale_factor = GetScaleFactorFromOptions(args); const SkBitmap bitmap = - image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap(); + image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap(); SkPixelRef* ref = bitmap.pixelRef(); if (!ref) return node::Buffer::New(args->isolate(), 0).ToLocalChecked(); @@ -317,14 +317,14 @@ std::string NativeImage::ToDataURL(mate::Arguments* args) { } return webui::GetBitmapDataUrl( - image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap()); + image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap()); } v8::Local NativeImage::GetBitmap(mate::Arguments* args) { float scale_factor = GetScaleFactorFromOptions(args); const SkBitmap bitmap = - image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap(); + image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap(); SkPixelRef* ref = bitmap.pixelRef(); if (!ref) return node::Buffer::New(args->isolate(), 0).ToLocalChecked(); diff --git a/atom/common/native_mate_converters/blink_converter.cc b/atom/common/native_mate_converters/blink_converter.cc index 80be52039cad..17469bac61b4 100644 --- a/atom/common/native_mate_converters/blink_converter.cc +++ b/atom/common/native_mate_converters/blink_converter.cc @@ -18,7 +18,6 @@ #include "third_party/blink/public/platform/web_mouse_event.h" #include "third_party/blink/public/platform/web_mouse_wheel_event.h" #include "third_party/blink/public/web/web_device_emulation_params.h" -#include "third_party/blink/public/web/web_find_options.h" #include "ui/base/clipboard/clipboard.h" #include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/keycodes/keyboard_code_conversion.h" @@ -368,19 +367,6 @@ bool Converter::FromV8( return true; } -bool Converter::FromV8(v8::Isolate* isolate, - v8::Local val, - blink::WebFindOptions* out) { - mate::Dictionary dict; - if (!ConvertFromV8(isolate, val, &dict)) - return false; - - dict.Get("forward", &out->forward); - dict.Get("matchCase", &out->match_case); - dict.Get("findNext", &out->find_next); - return true; -} - // static v8::Local Converter::ToV8( v8::Isolate* isolate, diff --git a/atom/common/native_mate_converters/blink_converter.h b/atom/common/native_mate_converters/blink_converter.h index ecec11f44549..bc00089414ee 100644 --- a/atom/common/native_mate_converters/blink_converter.h +++ b/atom/common/native_mate_converters/blink_converter.h @@ -15,7 +15,6 @@ class WebMouseEvent; class WebMouseWheelEvent; class WebKeyboardEvent; struct WebDeviceEmulationParams; -struct WebFindOptions; struct WebFloatPoint; struct WebPoint; struct WebSize; @@ -95,13 +94,6 @@ struct Converter { blink::WebDeviceEmulationParams* out); }; -template <> -struct Converter { - static bool FromV8(v8::Isolate* isolate, - v8::Local val, - blink::WebFindOptions* out); -}; - template <> struct Converter { static v8::Local ToV8( diff --git a/atom/common/node_includes.h b/atom/common/node_includes.h index 74225cf71926..ef40162e89de 100644 --- a/atom/common/node_includes.h +++ b/atom/common/node_includes.h @@ -30,7 +30,8 @@ #undef NO_RETURN #undef LIKELY #undef arraysize -#undef debug_string // This is defined in macOS SDK in AssertMacros.h. +#undef debug_string // This is defined in macOS SDK in AssertMacros.h. +#undef require_string // This is defined in macOS SDK in AssertMacros.h. #include "env-inl.h" #include "env.h" #include "node.h" diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index 4ec14086be65..3f1a89d1fc0b 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -19,6 +19,7 @@ #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" #include "third_party/blink/public/platform/web_cache.h" +#include "third_party/blink/public/web/web_custom_element.h" #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_element.h" #include "third_party/blink/public/web/web_frame_widget.h" @@ -188,13 +189,15 @@ void WebFrame::SetLayoutZoomLevelLimits(double min_level, double max_level) { web_frame_->View()->ZoomLimitsChanged(min_level, max_level); } -v8::Local WebFrame::RegisterEmbedderCustomElement( +void WebFrame::AllowGuestViewElementDefinition( v8::Local context, - const base::string16& name, - v8::Local options) { + v8::Local register_cb) { + v8::HandleScope handle_scope(isolate()); v8::Context::Scope context_scope(context->CreationContext()); - return web_frame_->GetDocument().RegisterEmbedderCustomElement( - blink::WebString::FromUTF16(name), options); + blink::WebCustomElement::EmbedderNamesAllowedScope embedder_names_scope; + web_frame_->RequestExecuteV8Function(context->CreationContext(), register_cb, + v8::Null(isolate()), 0, nullptr, + nullptr); } int WebFrame::GetWebFrameId(v8::Local content_window) { @@ -491,8 +494,8 @@ void WebFrame::BuildPrototype(v8::Isolate* isolate, &WebFrame::SetVisualZoomLevelLimits) .SetMethod("setLayoutZoomLevelLimits", &WebFrame::SetLayoutZoomLevelLimits) - .SetMethod("registerEmbedderCustomElement", - &WebFrame::RegisterEmbedderCustomElement) + .SetMethod("allowGuestViewElementDefinition", + &WebFrame::AllowGuestViewElementDefinition) .SetMethod("getWebFrameId", &WebFrame::GetWebFrameId) .SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider) .SetMethod("registerURLSchemeAsBypassingCSP", diff --git a/atom/renderer/api/atom_api_web_frame.h b/atom/renderer/api/atom_api_web_frame.h index 1c5b76ae569c..7ce8e88fc7ff 100644 --- a/atom/renderer/api/atom_api_web_frame.h +++ b/atom/renderer/api/atom_api_web_frame.h @@ -50,10 +50,8 @@ class WebFrame : public mate::Wrappable { void SetVisualZoomLevelLimits(double min_level, double max_level); void SetLayoutZoomLevelLimits(double min_level, double max_level); - v8::Local RegisterEmbedderCustomElement( - v8::Local context, - const base::string16& name, - v8::Local options); + void AllowGuestViewElementDefinition(v8::Local context, + v8::Local register_cb); int GetWebFrameId(v8::Local content_window); // Set the provider that will be used by SpellCheckClient for spell check. diff --git a/atom/renderer/atom_autofill_agent.cc b/atom/renderer/atom_autofill_agent.cc index 7316fdf0bd65..49390e685507 100644 --- a/atom/renderer/atom_autofill_agent.cc +++ b/atom/renderer/atom_autofill_agent.cc @@ -177,7 +177,8 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { } bool AutofillAgent::IsUserGesture() const { - return blink::WebUserGestureIndicator::IsProcessingUserGesture(); + return blink::WebUserGestureIndicator::IsProcessingUserGesture( + render_frame()->GetWebFrame()); } void AutofillAgent::HidePopup() { diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 88e470a2a7a7..a8e9f3c3499e 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -21,8 +21,7 @@ #include "third_party/blink/public/web/web_local_frame.h" #include "atom/common/node_includes.h" -#include "atom_natives.h" // NOLINT: This file is generated with js2c -#include "tracing/trace_event.h" +#include "third_party/electron_node/src/node_native_module.h" namespace atom { @@ -189,28 +188,20 @@ void AtomRendererClient::SetupMainWorldOverrides( v8::Handle context, content::RenderFrame* render_frame) { // Setup window overrides in the main world context - v8::Isolate* isolate = context->GetIsolate(); - v8::HandleScope handle_scope(isolate); - v8::Context::Scope context_scope(context); - // Wrap the bundle into a function that receives the isolatedWorld as // an argument. - std::string left = "(function (nodeProcess, isolatedWorld) {\n"; - std::string right = "\n})"; - auto source = v8::String::Concat( - isolate, mate::ConvertToV8(isolate, left)->ToString(isolate), - v8::String::Concat(isolate, - node::isolated_bundle_value.ToStringChecked(isolate), - mate::ConvertToV8(isolate, right)->ToString(isolate))); - auto result = RunScript(context, source); - DCHECK(result->IsFunction()); + auto* isolate = context->GetIsolate(); + std::vector> isolated_bundle_params = { + node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"), + node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld")}; - v8::Local args[] = { + std::vector> isolated_bundle_args = { GetEnvironment(render_frame)->process_object(), - GetContext(render_frame->GetWebFrame(), isolate)->Global(), - }; - ignore_result(result.As()->Call(context, v8::Null(isolate), - node::arraysize(args), args)); + GetContext(render_frame->GetWebFrame(), isolate)->Global()}; + + node::per_process::native_module_loader.CompileAndCall( + context, "electron/js2c/isolated_bundle", &isolated_bundle_params, + &isolated_bundle_args, nullptr); } node::Environment* AtomRendererClient::GetEnvironment( diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index 9e9e89d50334..e753e0bc22ae 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -14,7 +14,7 @@ namespace node { class Environment; -} +} // namespace node namespace atom { diff --git a/atom/renderer/atom_sandboxed_renderer_client.cc b/atom/renderer/atom_sandboxed_renderer_client.cc index 7c492714ace2..d2df5338642a 100644 --- a/atom/renderer/atom_sandboxed_renderer_client.cc +++ b/atom/renderer/atom_sandboxed_renderer_client.cc @@ -25,7 +25,8 @@ #include "third_party/blink/public/web/web_document.h" #include "atom/common/node_includes.h" -#include "atom_natives.h" // NOLINT: This file is generated with js2c +#include "third_party/electron_node/src/node_binding.h" +#include "third_party/electron_node/src/node_native_module.h" namespace atom { @@ -68,7 +69,7 @@ v8::Local GetBinding(v8::Isolate* isolate, return exports; } - auto* mod = node::get_builtin_module(module_key.c_str()); + auto* mod = node::binding::get_builtin_module(module_key.c_str()); if (!mod) { char errmsg[1024]; @@ -182,30 +183,21 @@ void AtomSandboxedRendererClient::DidCreateScriptContext( !IsDevToolsExtension(render_frame)) return; + // Wrap the bundle into a function that receives the binding object as + // argument. auto* isolate = context->GetIsolate(); - v8::HandleScope handle_scope(isolate); - v8::Context::Scope context_scope(context); - // Wrap the bundle into a function that receives the binding object and the - // preload script path as arguments. - std::string left = "(function(binding, require) {\n"; - std::string right = "\n})"; - // Compile the wrapper and run it to get the function object - auto source = v8::String::Concat( - isolate, mate::ConvertToV8(isolate, left)->ToString(isolate), - v8::String::Concat(isolate, - node::preload_bundle_value.ToStringChecked(isolate), - mate::ConvertToV8(isolate, right)->ToString(isolate))); - auto result = RunScript(context, source); - - DCHECK(result->IsFunction()); - // Create and initialize the binding object auto binding = v8::Object::New(isolate); InitializeBindings(binding, context); AddRenderBindings(isolate, binding); - v8::Local args[] = {binding}; - // Execute the function with proper arguments - ignore_result(result.As()->Call(context, v8::Null(isolate), - node::arraysize(args), args)); + + std::vector> preload_bundle_params = { + node::FIXED_ONE_BYTE_STRING(isolate, "binding")}; + + std::vector> preload_bundle_args = {binding}; + + node::per_process::native_module_loader.CompileAndCall( + isolate->GetCurrentContext(), "electron/js2c/preload_bundle", + &preload_bundle_params, &preload_bundle_args, nullptr); } void AtomSandboxedRendererClient::WillReleaseScriptContext( diff --git a/buildflags/buildflags.gni b/buildflags/buildflags.gni index 2425b927b389..2fdca8657493 100644 --- a/buildflags/buildflags.gni +++ b/buildflags/buildflags.gni @@ -8,7 +8,7 @@ declare_args() { # Allow running Electron as a node binary. enable_run_as_node = true - enable_osr = true + enable_osr = false enable_view_api = false diff --git a/chromium_src/chrome/browser/certificate_manager_model.cc b/chromium_src/chrome/browser/certificate_manager_model.cc index 227357b5ccc1..9ceae405e502 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.cc +++ b/chromium_src/chrome/browser/certificate_manager_model.cc @@ -9,7 +9,9 @@ #include "base/bind.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/resource_context.h" #include "crypto/nss_util.h" @@ -71,8 +73,8 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext( void CertificateManagerModel::Create(content::BrowserContext* browser_context, const CreationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::Bind(&CertificateManagerModel::GetCertDBOnIOThread, browser_context->GetResourceContext(), callback)); } @@ -144,8 +146,8 @@ void CertificateManagerModel::DidGetCertDBOnIOThread( DCHECK_CURRENTLY_ON(BrowserThread::IO); bool is_user_db_available = !!cert_db->GetPublicSlot(); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::Bind(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db, is_user_db_available, callback)); } diff --git a/chromium_src/chrome/browser/process_singleton_posix.cc b/chromium_src/chrome/browser/process_singleton_posix.cc index 42635e2ac0c4..f7132b4361c8 100644 --- a/chromium_src/chrome/browser/process_singleton_posix.cc +++ b/chromium_src/chrome/browser/process_singleton_posix.cc @@ -82,12 +82,14 @@ #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" #include "base/threading/platform_thread.h" #include "base/threading/thread_restrictions.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "build/build_config.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "net/base/network_interfaces.h" #include "ui/base/l10n/l10n_util.h" @@ -702,8 +704,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK( if (shutdown(fd_, SHUT_WR) < 0) PLOG(ERROR) << "shutdown() failed"; - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::Bind(&ProcessSingleton::LinuxWatcher::RemoveSocketReader, parent_, this)); // We will be deleted once the posted RemoveSocketReader task runs. @@ -882,8 +884,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() { void ProcessSingleton::StartListeningOnSocket() { watcher_ = new LinuxWatcher(this); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::IO}, base::Bind(&ProcessSingleton::LinuxWatcher::StartListening, watcher_, sock_)); } diff --git a/electron_paks.gni b/electron_paks.gni index 782774537f75..c71978b7a7c9 100644 --- a/electron_paks.gni +++ b/electron_paks.gni @@ -56,7 +56,6 @@ template("electron_extra_paks") { "$root_gen_dir/components/components_resources.pak", "$root_gen_dir/content/browser/tracing/tracing_resources.pak", "$root_gen_dir/content/content_resources.pak", - "$root_gen_dir/content/shell/shell_resources.pak", "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak", "$root_gen_dir/net/net_resources.pak", "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak", @@ -67,7 +66,6 @@ template("electron_extra_paks") { "//components/resources", "//content:resources", "//content/browser/tracing:resources", - "//content/shell:copy_shell_resources", "//electron:resources", "//mojo/public/js:resources", "//net:net_resources", diff --git a/electron_resources.grd b/electron_resources.grd index d0ce076c2613..73029b0419b4 100644 --- a/electron_resources.grd +++ b/electron_resources.grd @@ -19,6 +19,7 @@ + diff --git a/filenames.gni b/filenames.gni index 3b93b6f70dbb..19476915d2a8 100644 --- a/filenames.gni +++ b/filenames.gni @@ -1,9 +1,4 @@ filenames = { - js2c_sources = [ - "lib/common/asar.js", - "lib/common/asar_init.js", - ] - js_sources = [ "lib/browser/api/app.js", "lib/browser/api/auto-updater.js", @@ -74,9 +69,10 @@ filenames = { "lib/renderer/web-frame-init.js", "lib/renderer/window-setup.js", "lib/renderer/web-view/guest-view-internal.js", - "lib/renderer/web-view/web-view.js", "lib/renderer/web-view/web-view-attributes.js", "lib/renderer/web-view/web-view-constants.js", + "lib/renderer/web-view/web-view-element.js", + "lib/renderer/web-view/web-view-impl.js", "lib/renderer/api/exports/electron.js", "lib/renderer/api/crash-reporter.js", "lib/renderer/api/ipc-renderer.js", diff --git a/lib/common/asar_init.js b/lib/common/asar_init.js index f7fe012cab14..e525319455b1 100644 --- a/lib/common/asar_init.js +++ b/lib/common/asar_init.js @@ -1,20 +1,14 @@ 'use strict' -;(function () { // eslint-disable-line - return function (source, require, asarSource) { - // Expose fs module without asar support. +/* global source, require */ - // NB: Node's 'fs' and 'internal/fs/streams' have a lazy-loaded circular - // dependency. So to expose the unmodified Node 'fs' functionality here, - // we have to copy both 'fs' *and* 'internal/fs/streams' and modify the - // copies to depend on each other instead of on our asarified 'fs' code. - source['original-fs'] = source.fs.replace("require('internal/fs/streams')", "require('original-fs/streams')") - source['original-fs/streams'] = source['internal/fs/streams'].replace("require('fs')", "require('original-fs')") +// Expose fs module without asar support. +// NB: Node's 'fs' and 'internal/fs/streams' have a lazy-loaded circular +// dependency. So to expose the unmodified Node 'fs' functionality here, +// we have to copy both 'fs' *and* 'internal/fs/streams' and modify the +// copies to depend on each other instead of on our asarified 'fs' code. +source['original-fs'].replace("require('internal/fs/streams')", "require('original-fs/streams')") +source['original-fs/streams'].replace("require('fs')", "require('original-fs')") - // Make asar.js accessible via "require". - source.ELECTRON_ASAR = asarSource - - // Monkey-patch the fs module. - require('ELECTRON_ASAR').wrapFsWithAsar(require('fs')) - } -})() +// Monkey-patch the fs module. +require('electron/js2c/asar').wrapFsWithAsar(require('fs')) diff --git a/lib/isolated_renderer/init.js b/lib/isolated_renderer/init.js index 4df07b705c50..17dad47c1a24 100644 --- a/lib/isolated_renderer/init.js +++ b/lib/isolated_renderer/init.js @@ -5,12 +5,13 @@ // Note: Don't use "process", as it will be replaced by browserify's one. const v8Util = nodeProcess.atomBinding('v8_util') -const setupWebView = v8Util.getHiddenValue(isolatedWorld, 'setup-webview') -if (setupWebView) { - setupWebView(window) +const isolatedWorldArgs = v8Util.getHiddenValue(isolatedWorld, 'isolated-world-args') +const { webViewImpl, ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen } = isolatedWorldArgs + +if (webViewImpl) { + // Must setup the WebView element in main world. + const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') + setupWebView(v8Util, webViewImpl) } -const isolatedWorldArgs = v8Util.getHiddenValue(isolatedWorld, 'isolated-world-args') -const { ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen } = isolatedWorldArgs - require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen) diff --git a/lib/renderer/init.js b/lib/renderer/init.js index 1d283809d0ea..9cbe1c3d999c 100644 --- a/lib/renderer/init.js +++ b/lib/renderer/init.js @@ -50,17 +50,14 @@ const appPath = parseOption('app-path', null) const guestInstanceId = parseOption('guest-instance-id', null, value => parseInt(value)) const openerId = parseOption('opener-id', null, value => parseInt(value)) +// The arguments to be passed to isolated world. +const isolatedWorldArgs = { ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen } + // The webContents preload script is loaded after the session preload scripts. if (preloadScript) { preloadScripts.push(preloadScript) } -// Pass the arguments to isolatedWorld. -if (contextIsolation) { - const isolatedWorldArgs = { ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen } - v8Util.setHiddenValue(global, 'isolated-world-args', isolatedWorldArgs) -} - if (window.location.protocol === 'chrome-devtools:') { // Override some inspector APIs. require('@electron/internal/renderer/inspector') @@ -78,15 +75,21 @@ if (window.location.protocol === 'chrome-devtools:') { // Load webview tag implementation. if (webviewTag && guestInstanceId == null) { - const { setupWebView } = require('@electron/internal/renderer/web-view/web-view') + const webViewImpl = require('@electron/internal/renderer/web-view/web-view-impl') if (contextIsolation) { - v8Util.setHiddenValue(window, 'setup-webview', setupWebView) + Object.assign(isolatedWorldArgs, { webViewImpl }) } else { - setupWebView(window) + const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') + setupWebView(v8Util, webViewImpl) } } } +// Pass the arguments to isolatedWorld. +if (contextIsolation) { + v8Util.setHiddenValue(global, 'isolated-world-args', isolatedWorldArgs) +} + if (nodeIntegration) { // Export node bindings to global. global.require = require diff --git a/lib/renderer/web-view/web-view-attributes.js b/lib/renderer/web-view/web-view-attributes.js index 39d986e40073..2db7736632f1 100644 --- a/lib/renderer/web-view/web-view-attributes.js +++ b/lib/renderer/web-view/web-view-attributes.js @@ -1,7 +1,7 @@ 'use strict' const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') -const { WebViewImpl } = require('@electron/internal/renderer/web-view/web-view') +const { WebViewImpl } = require('@electron/internal/renderer/web-view/web-view-impl') const webViewConstants = require('@electron/internal/renderer/web-view/web-view-constants') const errorUtils = require('@electron/internal/common/error-utils') diff --git a/lib/renderer/web-view/web-view-element.js b/lib/renderer/web-view/web-view-element.js new file mode 100644 index 000000000000..beb0a34d0f88 --- /dev/null +++ b/lib/renderer/web-view/web-view-element.js @@ -0,0 +1,110 @@ +'use strict' + +// When using context isolation, the WebViewElement and the custom element +// methods have to be defined in the main world to be able to be registered. +// +// Note: The hidden values can only be read/set inside the same context, all +// methods that access the "internal" hidden value must be put in this file. +// +// Note: This file could be loaded in the main world of contextIsolation page, +// which runs in browserify environment instead of Node environment, all native +// modules must be passed from outside, all included files must be plain JS. + +const webViewConstants = require('@electron/internal/renderer/web-view/web-view-constants') + +// Return a WebViewElement class that is defined in this context. +const defineWebViewElement = (v8Util, webViewImpl) => { + const { guestViewInternal, WebViewImpl } = webViewImpl + return class WebViewElement extends HTMLElement { + static get observedAttributes () { + return [ + webViewConstants.ATTRIBUTE_PARTITION, + webViewConstants.ATTRIBUTE_SRC, + webViewConstants.ATTRIBUTE_HTTPREFERRER, + webViewConstants.ATTRIBUTE_USERAGENT, + webViewConstants.ATTRIBUTE_NODEINTEGRATION, + webViewConstants.ATTRIBUTE_PLUGINS, + webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, + webViewConstants.ATTRIBUTE_ALLOWPOPUPS, + webViewConstants.ATTRIBUTE_ENABLEREMOTEMODULE, + webViewConstants.ATTRIBUTE_PRELOAD, + webViewConstants.ATTRIBUTE_BLINKFEATURES, + webViewConstants.ATTRIBUTE_DISABLEBLINKFEATURES, + webViewConstants.ATTRIBUTE_WEBPREFERENCES + ] + } + + constructor () { + super() + v8Util.setHiddenValue(this, 'internal', new WebViewImpl(this)) + } + + connectedCallback () { + const internal = v8Util.getHiddenValue(this, 'internal') + if (!internal) { + return + } + if (!internal.elementAttached) { + guestViewInternal.registerEvents(internal, internal.viewInstanceId) + internal.elementAttached = true + internal.attributes[webViewConstants.ATTRIBUTE_SRC].parse() + } + } + + attributeChangedCallback (name, oldValue, newValue) { + const internal = v8Util.getHiddenValue(this, 'internal') + if (internal) { + internal.handleWebviewAttributeMutation(name, oldValue, newValue) + } + } + + disconnectedCallback () { + const internal = v8Util.getHiddenValue(this, 'internal') + if (!internal) { + return + } + guestViewInternal.deregisterEvents(internal.viewInstanceId) + internal.elementAttached = false + this.internalInstanceId = 0 + internal.reset() + } + } +} + +// Register custom element. +const registerWebViewElement = (v8Util, webViewImpl) => { + const WebViewElement = defineWebViewElement(v8Util, webViewImpl) + + webViewImpl.setupMethods(WebViewElement) + + // The customElements.define has to be called in a special scope. + webViewImpl.webFrame.allowGuestViewElementDefinition(window, () => { + window.customElements.define('webview', WebViewElement) + window.WebView = WebViewElement + + // Delete the callbacks so developers cannot call them and produce unexpected + // behavior. + delete WebViewElement.prototype.connectedCallback + delete WebViewElement.prototype.disconnectedCallback + delete WebViewElement.prototype.attributeChangedCallback + + // Now that |observedAttributes| has been retrieved, we can hide it from + // user code as well. + delete WebViewElement.observedAttributes + }) +} + +// Prepare to register the element. +const setupWebView = (v8Util, webViewImpl) => { + const useCapture = true + window.addEventListener('readystatechange', function listener (event) { + if (document.readyState === 'loading') { + return + } + webViewImpl.setupAttributes() + registerWebViewElement(v8Util, webViewImpl) + window.removeEventListener(event.type, listener, useCapture) + }, useCapture) +} + +module.exports = { setupWebView } diff --git a/lib/renderer/web-view/web-view.js b/lib/renderer/web-view/web-view-impl.js similarity index 81% rename from lib/renderer/web-view/web-view.js rename to lib/renderer/web-view/web-view-impl.js index eecf4a5c589c..ba0379cc1f9a 100644 --- a/lib/renderer/web-view/web-view.js +++ b/lib/renderer/web-view/web-view-impl.js @@ -20,7 +20,6 @@ const getNextId = function () { class WebViewImpl { constructor (webviewNode) { this.webviewNode = webviewNode - v8Util.setHiddenValue(this.webviewNode, 'internal', this) this.elementAttached = false this.beforeFirstNavigation = true this.hasFocus = false @@ -197,38 +196,25 @@ class WebViewImpl { } } -// Registers custom element. -const registerWebViewElement = (window) => { - const proto = Object.create(window.HTMLObjectElement.prototype) - proto.createdCallback = function () { - return new WebViewImpl(this) - } - proto.attributeChangedCallback = function (name, oldValue, newValue) { +const setupAttributes = () => { + require('@electron/internal/renderer/web-view/web-view-attributes') +} + +const setupMethods = (WebViewElement) => { + // WebContents associated with this webview. + WebViewElement.prototype.getWebContents = function () { + const { getRemote } = require('@electron/internal/renderer/remote') + const getGuestWebContents = getRemote('getGuestWebContents') const internal = v8Util.getHiddenValue(this, 'internal') - if (internal) { - internal.handleWebviewAttributeMutation(name, oldValue, newValue) + if (!internal.guestInstanceId) { + internal.createGuestSync() } + return getGuestWebContents(internal.guestInstanceId) } - proto.detachedCallback = function () { - const internal = v8Util.getHiddenValue(this, 'internal') - if (!internal) { - return - } - guestViewInternal.deregisterEvents(internal.viewInstanceId) - internal.elementAttached = false - this.internalInstanceId = 0 - internal.reset() - } - proto.attachedCallback = function () { - const internal = v8Util.getHiddenValue(this, 'internal') - if (!internal) { - return - } - if (!internal.elementAttached) { - guestViewInternal.registerEvents(internal, internal.viewInstanceId) - internal.elementAttached = true - internal.attributes[webViewConstants.ATTRIBUTE_SRC].parse() - } + + // Focusing the webview should move page focus to the underlying iframe. + WebViewElement.prototype.focus = function () { + this.contentWindow.focus() } const getGuestInstanceId = function (self) { @@ -251,7 +237,7 @@ const registerWebViewElement = (window) => { } } for (const method of syncMethods) { - proto[method] = createBlockHandler(method) + WebViewElement.prototype[method] = createBlockHandler(method) } const createNonBlockHandler = function (method) { @@ -269,48 +255,8 @@ const registerWebViewElement = (window) => { } } for (const method of asyncMethods) { - proto[method] = createNonBlockHandler(method) + WebViewElement.prototype[method] = createNonBlockHandler(method) } - - // WebContents associated with this webview. - proto.getWebContents = function () { - const { getRemote } = require('@electron/internal/renderer/remote') - const getGuestWebContents = getRemote('getGuestWebContents') - const internal = v8Util.getHiddenValue(this, 'internal') - if (!internal.guestInstanceId) { - internal.createGuestSync() - } - return getGuestWebContents(internal.guestInstanceId) - } - - // Focusing the webview should move page focus to the underlying iframe. - proto.focus = function () { - this.contentWindow.focus() - } - - window.WebView = webFrame.registerEmbedderCustomElement(window, 'webview', { - prototype: proto - }) - - // Delete the callbacks so developers cannot call them and produce unexpected - // behavior. - delete proto.createdCallback - delete proto.attachedCallback - delete proto.detachedCallback - delete proto.attributeChangedCallback } -const setupWebView = (window) => { - require('@electron/internal/renderer/web-view/web-view-attributes') - - const useCapture = true - window.addEventListener('readystatechange', function listener (event) { - if (document.readyState === 'loading') { - return - } - registerWebViewElement(window) - window.removeEventListener(event.type, listener, useCapture) - }, useCapture) -} - -module.exports = { setupWebView, WebViewImpl } +module.exports = { setupAttributes, setupMethods, guestViewInternal, webFrame, WebViewImpl } diff --git a/lib/sandboxed_renderer/init.js b/lib/sandboxed_renderer/init.js index 4f219ff59b66..e5a99b516cbb 100644 --- a/lib/sandboxed_renderer/init.js +++ b/lib/sandboxed_renderer/init.js @@ -125,9 +125,11 @@ if (binding.guestInstanceId) { process.guestInstanceId = parseInt(binding.guestInstanceId) } +// Don't allow recursive ``. if (!process.guestInstanceId && isWebViewTagEnabled) { - // don't allow recursive `` - require('@electron/internal/renderer/web-view/web-view').setupWebView(window) + const webViewImpl = require('@electron/internal/renderer/web-view/web-view-impl') + const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') + setupWebView(v8Util, webViewImpl) } // Wrap the script into a function executed in global scope. It won't have diff --git a/patches/common/boringssl/.patches b/patches/common/boringssl/.patches index eb67e3c35a07..ba4d3c3fe9a3 100644 --- a/patches/common/boringssl/.patches +++ b/patches/common/boringssl/.patches @@ -1 +1,3 @@ implement_ssl_get_tlsext_status_type.patch +add_ec_group_order_bits_for_openssl_compatibility.patch +add_ec_key_key2buf_for_openssl_compatibility.patch diff --git a/patches/common/boringssl/add_ec_group_order_bits_for_openssl_compatibility.patch b/patches/common/boringssl/add_ec_group_order_bits_for_openssl_compatibility.patch new file mode 100644 index 000000000000..1db5350f5cfc --- /dev/null +++ b/patches/common/boringssl/add_ec_group_order_bits_for_openssl_compatibility.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Wed, 19 Dec 2018 14:42:26 -0800 +Subject: Add EC_GROUP_order_bits for OpenSSL compatibility + +Change-Id: I37149fa4274357d84befff85728ce2337131afa7 +Reviewed-on: https://boringssl-review.googlesource.com/c/33804 +Commit-Queue: Adam Langley +Reviewed-by: Adam Langley + +diff --git a/crypto/fipsmodule/ec/ec.c b/crypto/fipsmodule/ec/ec.c +index 908e35e9d04e657c13ba61c8ea5bf4a4519228c5..43e170b9190bf1813216b10863bbaf6402331161 100644 +--- a/crypto/fipsmodule/ec/ec.c ++++ b/crypto/fipsmodule/ec/ec.c +@@ -605,6 +605,10 @@ int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) { + return 1; + } + ++int EC_GROUP_order_bits(const EC_GROUP *group) { ++ return BN_num_bits(&group->order); ++} ++ + int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, + BN_CTX *ctx) { + // All |EC_GROUP|s have cofactor 1. +diff --git a/include/openssl/ec.h b/include/openssl/ec.h +index 41a9c34c5ad1bbfdff8e37c1e245ac7fac7a3869..e4195fc15a26e61ef1e74ac7054ddabb256ae9a3 100644 +--- a/include/openssl/ec.h ++++ b/include/openssl/ec.h +@@ -133,6 +133,9 @@ OPENSSL_EXPORT const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); + // |group| that specifies the order of the group. + OPENSSL_EXPORT const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); + ++// EC_GROUP_order_bits returns the number of bits of the order of |group|. ++OPENSSL_EXPORT int EC_GROUP_order_bits(const EC_GROUP *group); ++ + // EC_GROUP_get_cofactor sets |*cofactor| to the cofactor of |group| using + // |ctx|, if it's not NULL. It returns one on success and zero otherwise. + OPENSSL_EXPORT int EC_GROUP_get_cofactor(const EC_GROUP *group, diff --git a/patches/common/boringssl/add_ec_key_key2buf_for_openssl_compatibility.patch b/patches/common/boringssl/add_ec_key_key2buf_for_openssl_compatibility.patch new file mode 100644 index 000000000000..aa8f3d7ec320 --- /dev/null +++ b/patches/common/boringssl/add_ec_key_key2buf_for_openssl_compatibility.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Wed, 19 Dec 2018 14:46:14 -0800 +Subject: Add EC_KEY_key2buf for OpenSSL compatibility + +Change-Id: If45ef3a9bb757bd0c7f592f40ececaf4aa2f607d +Reviewed-on: https://boringssl-review.googlesource.com/c/33824 +Reviewed-by: Adam Langley +Commit-Queue: Adam Langley + +diff --git a/crypto/fipsmodule/ec/ec_key.c b/crypto/fipsmodule/ec/ec_key.c +index a6d469767adfad1c9095cc58c567b10c71e95cfa..ba69e83cb8f49c70a98c8fd68fd7fa4b122da5cd 100644 +--- a/crypto/fipsmodule/ec/ec_key.c ++++ b/crypto/fipsmodule/ec/ec_key.c +@@ -394,6 +394,33 @@ err: + return ok; + } + ++size_t EC_KEY_key2buf(EC_KEY *key, point_conversion_form_t form, ++ unsigned char **out_buf, BN_CTX *ctx) { ++ if (key == NULL || key->pub_key == NULL || key->group == NULL) { ++ return 0; ++ } ++ ++ const size_t len = ++ EC_POINT_point2oct(key->group, key->pub_key, form, NULL, 0, ctx); ++ if (len == 0) { ++ return 0; ++ } ++ ++ uint8_t *buf = OPENSSL_malloc(len); ++ if (buf == NULL) { ++ return 0; ++ } ++ ++ if (EC_POINT_point2oct(key->group, key->pub_key, form, buf, len, ctx) != ++ len) { ++ OPENSSL_free(buf); ++ return 0; ++ } ++ ++ *out_buf = buf; ++ return len; ++} ++ + int EC_KEY_generate_key(EC_KEY *key) { + if (key == NULL || key->group == NULL) { + OPENSSL_PUT_ERROR(EC, ERR_R_PASSED_NULL_PARAMETER); +diff --git a/include/openssl/ec_key.h b/include/openssl/ec_key.h +index 9bc788758b26bb4883626a80f3e0b8c8d6eb7974..3b1a5666fa1f2071212393a3f5c8d5394c32efeb 100644 +--- a/include/openssl/ec_key.h ++++ b/include/openssl/ec_key.h +@@ -177,6 +177,12 @@ OPENSSL_EXPORT int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, + BIGNUM *x, + BIGNUM *y); + ++// EC_KEY_key2buf encodes the public key in |key| to an allocated octet string ++// and sets |*out_buf| to point to it. It returns the length of the encoded ++// octet string or zero if an error occurred. ++OPENSSL_EXPORT size_t EC_KEY_key2buf(EC_KEY *key, point_conversion_form_t form, ++ unsigned char **out_buf, BN_CTX *ctx); ++ + + // Key generation. + diff --git a/patches/common/boringssl/implement_ssl_get_tlsext_status_type.patch b/patches/common/boringssl/implement_ssl_get_tlsext_status_type.patch index 1dab9c66d8c0..f552ab39c6bd 100644 --- a/patches/common/boringssl/implement_ssl_get_tlsext_status_type.patch +++ b/patches/common/boringssl/implement_ssl_get_tlsext_status_type.patch @@ -14,7 +14,7 @@ Commit-Queue: David Benjamin CQ-Verified: CQ bot account: commit-bot@chromium.org diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h -index ae8b8385fc73701a4346202f213b5974af4e2aed..0f3d1747173ffb09eafd5c7d5d692ae3c35c9874 100644 +index c0d44ce2820fb20273b453def0b5bcb5ddcc14e9..f0d9dd45e2c41968a84c8a3f31a8c9e4f621f018 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -4268,6 +4268,14 @@ OPENSSL_EXPORT int OPENSSL_init_ssl(uint64_t opts, diff --git a/patches/common/chromium/.patches b/patches/common/chromium/.patches index cbddb766ba8e..60404c0c5bc6 100644 --- a/patches/common/chromium/.patches +++ b/patches/common/chromium/.patches @@ -52,7 +52,6 @@ allow_nested_error_trackers.patch blink_initialization_order.patch disable_detach_webview_frame.patch ssl_security_state_tab_helper.patch -leveldb_ssize_t.patch exclude-a-few-test-files-from-build.patch expose-net-observer-api.patch desktop_media_list.patch diff --git a/patches/common/chromium/accelerator.patch b/patches/common/chromium/accelerator.patch index 5e806b7e932c..7c311e88c04e 100644 --- a/patches/common/chromium/accelerator.patch +++ b/patches/common/chromium/accelerator.patch @@ -5,7 +5,7 @@ Subject: accelerator.patch diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc -index 7e55ef366ac8320f730cdcb268453b1fa2710887..9b000ab1dfb85c097e879eacbfe69dc052960766 100644 +index d56e87be04cb4d765d0aa0eae1af86a9f562b222..9364ac4b75debc61e201e0da7eaef104acea770d 100644 --- a/ui/base/accelerators/accelerator.cc +++ b/ui/base/accelerators/accelerator.cc @@ -11,6 +11,7 @@ @@ -42,7 +42,7 @@ index 7e55ef366ac8320f730cdcb268453b1fa2710887..9b000ab1dfb85c097e879eacbfe69dc0 #if defined(OS_WIN) // Our fallback is to try translate the key code to a regular character // unless it is one of digits (VK_0 to VK_9). Some keyboard -@@ -148,18 +155,14 @@ base::string16 Accelerator::GetShortcutText() const { +@@ -156,18 +163,14 @@ base::string16 Accelerator::GetShortcutText() const { // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the // default zoom level), we leave VK_[0-9] alone without translation. wchar_t key; @@ -67,7 +67,7 @@ index 7e55ef366ac8320f730cdcb268453b1fa2710887..9b000ab1dfb85c097e879eacbfe69dc0 } // Checking whether the character used for the accelerator is alphanumeric. -@@ -223,7 +226,7 @@ base::string16 Accelerator::ApplyLongFormModifiers( +@@ -231,7 +234,7 @@ base::string16 Accelerator::ApplyLongFormModifiers( // more information. if (IsCtrlDown()) shortcut = ApplyModifierToAcceleratorString(shortcut, IDS_APP_CTRL_KEY); diff --git a/patches/common/chromium/add_realloc.patch b/patches/common/chromium/add_realloc.patch index 360170f21473..a59c75f35ba9 100644 --- a/patches/common/chromium/add_realloc.patch +++ b/patches/common/chromium/add_realloc.patch @@ -12,7 +12,7 @@ when we override ReallocateBufferMemory, so we therefore need to implement Realloc on the v8 side and correspondingly in gin. diff --git a/gin/array_buffer.cc b/gin/array_buffer.cc -index f84934bfd712dbad0e85d908165a5a4033bff170..fc23fef68b6fb9a4cccdf99bc427078faed2f62e 100644 +index a02797e94f61e8c71428633a4585a625dc5aadbd..305b7d307d233af699e3f495f85de0f8097ff311 100644 --- a/gin/array_buffer.cc +++ b/gin/array_buffer.cc @@ -43,6 +43,10 @@ void* ArrayBufferAllocator::AllocateUninitialized(size_t length) { @@ -39,10 +39,10 @@ index 2aef366ac8194aa261cbca6abc051f7da8a988d3..3c7d66c81032636abcca4f1538ce9b7f GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index de5c4b11829141913784fc3c7190ab86368cf675..f88a404c95c12ab5647bf88bd7be2504699b7ff7 100644 +index 5db87633802ccc7efbd6b673505cd5c00deabf6e..235be280c4d9e54bcc2e3f60fc10036ad3b08356 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -671,6 +671,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { +@@ -660,6 +660,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { size, WTF::ArrayBufferContents::kDontInitialize); } @@ -54,10 +54,10 @@ index de5c4b11829141913784fc3c7190ab86368cf675..f88a404c95c12ab5647bf88bd7be2504 WTF::ArrayBufferContents::FreeMemory(data); } diff --git a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc -index 83133e1a836d0c3b25e931e0c19ebcdb987173cf..2c64bd4d5cf3ecd71ee0711cecd1c149e8795797 100644 +index 127d6d39d5b089f3a91edc100be24b046c4da4fe..5ee94712c0fbf0a16eeca7aadd1a5be187bcf49e 100644 --- a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc +++ b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc -@@ -121,6 +121,11 @@ void* ArrayBufferContents::AllocateMemoryOrNull(size_t size, +@@ -122,6 +122,11 @@ void* ArrayBufferContents::AllocateMemoryOrNull(size_t size, return AllocateMemoryWithFlags(size, policy, base::PartitionAllocReturnNull); } @@ -70,10 +70,10 @@ index 83133e1a836d0c3b25e931e0c19ebcdb987173cf..2c64bd4d5cf3ecd71ee0711cecd1c149 Partitions::ArrayBufferPartition()->Free(data); } diff --git a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h -index a87a02bdaf4b7050752f05984ff1c0170f64a203..cf7f2940d48b03c51b997729fc7ea033dc0d1bfe 100644 +index 19ae6eb4a08c3499674f906c53164fa9194e5cf2..2f75c4b46c361f411c41242c406358da974ff7e4 100644 --- a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h +++ b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h -@@ -187,6 +187,7 @@ class WTF_EXPORT ArrayBufferContents { +@@ -134,6 +134,7 @@ class WTF_EXPORT ArrayBufferContents { void CopyTo(ArrayBufferContents& other); static void* AllocateMemoryOrNull(size_t, InitializationPolicy); diff --git a/patches/common/chromium/allow_webview_file_url.patch b/patches/common/chromium/allow_webview_file_url.patch index 237420740d31..9c14fa42ebb2 100644 --- a/patches/common/chromium/allow_webview_file_url.patch +++ b/patches/common/chromium/allow_webview_file_url.patch @@ -6,10 +6,10 @@ Subject: allow_webview_file_url.patch Allow webview to load non-web URLs. diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc -index 2ed617dbab85dc45184cc0883669f9b5401d5766..6830ea9a0c18affb54ecab7cead5059a7e27bbed 100644 +index 8f33f39eb1d4bcae2e1d78890ee5e9e2d88b1e75..7645b12dbccf5a714e32c74c437216fdca9ac286 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc -@@ -1459,6 +1459,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( +@@ -1480,6 +1480,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( !policy->IsWebSafeScheme(info.common_params.url.scheme()) && !is_external_protocol; diff --git a/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch b/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch index 1b3bc89ac3fb..6ef24d86ad6a 100644 --- a/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch +++ b/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch @@ -5,7 +5,7 @@ Subject: blink-worker-enable-csp-in-file-scheme.patch diff --git a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -index fae3bbccaf04ae653b52b484334a1b402a127b76..5a13426281adb0d51a5259346c1f588a67a78e07 100644 +index 4bc3d11ba0270bb4bba863724688ee5b6bc063d2..4f9accd65348b9c8f23f3e2d160e836c7841420b 100644 --- a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc +++ b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc @@ -261,7 +261,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( diff --git a/patches/common/chromium/blink_file_path.patch b/patches/common/chromium/blink_file_path.patch index 3dc35c0d9868..715d0c6ade6f 100644 --- a/patches/common/chromium/blink_file_path.patch +++ b/patches/common/chromium/blink_file_path.patch @@ -21,11 +21,11 @@ index 39831f1902c6ab85a0a4cac61a614931ee050ed6..fddb013aa122049de7142bca624d7d07 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs long long lastModified() const; diff --git a/third_party/blink/renderer/core/fileapi/file.idl b/third_party/blink/renderer/core/fileapi/file.idl -index a74beceda3e769aaf5673cabc6663bb883f54705..7196fd5f5f9e51616d49c09142247c8382e83cc0 100644 +index 940f8e62ce228beaf71f5a4be88539a431415ab1..0cf315636afe0e5e1533b3372cdfe2c09ec581e1 100644 --- a/third_party/blink/renderer/core/fileapi/file.idl +++ b/third_party/blink/renderer/core/fileapi/file.idl -@@ -32,6 +32,7 @@ - Exposed=(Window,Worker) +@@ -33,6 +33,7 @@ + Serializable ] interface File : Blob { readonly attribute DOMString name; + readonly attribute DOMString path; diff --git a/patches/common/chromium/blink_local_frame.patch b/patches/common/chromium/blink_local_frame.patch index 366280fb38e1..5e0ccbd3f9d4 100644 --- a/patches/common/chromium/blink_local_frame.patch +++ b/patches/common/chromium/blink_local_frame.patch @@ -14,10 +14,10 @@ when there is code doing that. This patch reverts the change to fix the crash in Electron. diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index a7ddc156c2b13acaaf9295df98dfa3955e9a015b..d684cbcaf2a82f1d7423522bf4cc48713a13dead 100644 +index 19862e24a7f5aa9ae85a7731803aaedd56109354..9cd8833ae9b40a2bf9a875fb357459e858f2b180 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -340,10 +340,6 @@ void LocalFrame::Detach(FrameDetachType type) { +@@ -394,10 +394,6 @@ void LocalFrame::DetachImpl(FrameDetachType type) { } CHECK(!view_ || !view_->IsAttached()); @@ -28,7 +28,7 @@ index a7ddc156c2b13acaaf9295df98dfa3955e9a015b..d684cbcaf2a82f1d7423522bf4cc4871 if (!Client()) return; -@@ -361,6 +357,10 @@ void LocalFrame::Detach(FrameDetachType type) { +@@ -415,6 +411,10 @@ void LocalFrame::DetachImpl(FrameDetachType type) { // Notify ScriptController that the frame is closing, since its cleanup ends // up calling back to LocalFrameClient via WindowProxy. GetScriptController().ClearForClose(); diff --git a/patches/common/chromium/blink_world_context.patch b/patches/common/chromium/blink_world_context.patch index 6f8c6b0569c3..3590532e39ac 100644 --- a/patches/common/chromium/blink_world_context.patch +++ b/patches/common/chromium/blink_world_context.patch @@ -5,10 +5,10 @@ Subject: blink_world_context.patch diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h -index e2f071b74c17c4d8854a66c461e6f3fa34ee5eaf..03f725429382a3b2ebc9e73600dc1b92168592b1 100644 +index 68b3ae21865f7c23072e2783e6c474cd0d96b806..6318eb4bac9ac38185f3192c73489966d6918a9b 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h -@@ -466,6 +466,9 @@ class WebLocalFrame : public WebFrame { +@@ -441,6 +441,9 @@ class WebLocalFrame : public WebFrame { // be calling this API. virtual v8::Local MainWorldScriptContext() const = 0; @@ -19,10 +19,10 @@ index e2f071b74c17c4d8854a66c461e6f3fa34ee5eaf..03f725429382a3b2ebc9e73600dc1b92 // that the script evaluated to with callback. Script execution can be // suspend. diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index fbadba8e0f240ce48ba26ad01573a97203a123ab..ac062b3967e61def6484bb266b55e6006bb0fcdd 100644 +index a7c0e79100e18fe02469a8453c84713ee68d5019..2f71ed674e4cb41e42b320e7bb0373dfb01df519 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -885,6 +885,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { +@@ -891,6 +891,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { return MainWorldScriptContext()->Global(); } @@ -37,10 +37,10 @@ index fbadba8e0f240ce48ba26ad01573a97203a123ab..ac062b3967e61def6484bb266b55e600 return BindingSecurity::ShouldAllowAccessToFrame( CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()), diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h -index 9b07d3bc3e50775225fafc020f6264c6b3f4cd15..8420f56040c87643365d40bd17ff6071e81eb4f8 100644 +index e857ff94ca93d44b67b2b850516fc6a93ac344e4..69ad8c4e747ac1ee311135371d932cf0b15b377c 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h -@@ -146,6 +146,8 @@ class CORE_EXPORT WebLocalFrameImpl final +@@ -148,6 +148,8 @@ class CORE_EXPORT WebLocalFrameImpl final int argc, v8::Local argv[]) override; v8::Local MainWorldScriptContext() const override; diff --git a/patches/common/chromium/boringssl_build_gn.patch b/patches/common/chromium/boringssl_build_gn.patch index 338a81118f6a..ae34d92c8c75 100644 --- a/patches/common/chromium/boringssl_build_gn.patch +++ b/patches/common/chromium/boringssl_build_gn.patch @@ -7,7 +7,7 @@ Build BoringSSL with some extra functions that nodejs needs. Only affects the GN build; with the GYP build, nodejs is still built with OpenSSL. diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn -index d31a9f29fa9c12e753708b2a1e75c33b70924300..dea5a6403f4c32f94bb58198c467bc7cc87a8217 100644 +index f57824f04d044b7180c0fc41df616a22174fe367..37735a7c2cad0a75aa609bac4e855cc564a7b2eb 100644 --- a/third_party/boringssl/BUILD.gn +++ b/third_party/boringssl/BUILD.gn @@ -46,6 +46,13 @@ config("no_asm_config") { diff --git a/patches/common/chromium/browser_compositor_mac.patch b/patches/common/chromium/browser_compositor_mac.patch index 2467a5e3be96..be0aac1378e6 100644 --- a/patches/common/chromium/browser_compositor_mac.patch +++ b/patches/common/chromium/browser_compositor_mac.patch @@ -5,7 +5,7 @@ Subject: browser_compositor_mac.patch diff --git a/content/browser/renderer_host/browser_compositor_view_mac.h b/content/browser/renderer_host/browser_compositor_view_mac.h -index 7dc490ea5607bc61344d763d73b008c9be43280a..df136ec5c30db5146e5d1dd34e2f5ff55377af59 100644 +index 71a9e1024b6055b1b1cc1e51d898a030e7f72111..479110fef40183c0d5d301686c1e8ae754317b29 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.h +++ b/content/browser/renderer_host/browser_compositor_view_mac.h @@ -60,6 +60,8 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient, @@ -26,7 +26,7 @@ index 7dc490ea5607bc61344d763d73b008c9be43280a..df136ec5c30db5146e5d1dd34e2f5ff5 viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink); void OnDidNotProduceFrame(const viz::BeginFrameAck& ack); diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm -index fb23caccdd1dc0280ba2039937222679b6b460d8..d1739539e7bf5240c70aece8bcc84bc093ebde3a 100644 +index 65670cccb50312a7cf0895ae39db01bc19d42d3d..235303a210fadd7ecfa7d1878df9fc93f2655b38 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.mm +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm @@ -79,6 +79,12 @@ diff --git a/patches/common/chromium/can_create_window.patch b/patches/common/chromium/can_create_window.patch index 1df23c9cedf1..a3df054a418f 100644 --- a/patches/common/chromium/can_create_window.patch +++ b/patches/common/chromium/can_create_window.patch @@ -5,10 +5,10 @@ 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 c5e56bc15cfbf95f7564cc4d080243c48e585f20..30b945c417d04106a05a0d3dcb86e5df87845c0c 100644 +index a17ae7ca0c070aeb1e741f3db80f3bc71f36308d..86560af1b9e3861dbe4455403cf3af0f183fd6c7 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc -@@ -3163,6 +3163,38 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -3333,6 +3333,38 @@ void RenderFrameHostImpl::CreateNewWindow( "frame_tree_node", frame_tree_node_->frame_tree_node_id(), "url", params->target_url.possibly_invalid_spec()); @@ -47,7 +47,7 @@ index c5e56bc15cfbf95f7564cc4d080243c48e585f20..30b945c417d04106a05a0d3dcb86e5df bool no_javascript_access = false; // Filter out URLs to which navigation is disallowed from this context. -@@ -3191,6 +3223,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -3361,6 +3393,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_.GetURL(), params->window_container_type, params->target_url, params->referrer, params->frame_name, params->disposition, *params->features, @@ -56,10 +56,10 @@ index c5e56bc15cfbf95f7564cc4d080243c48e585f20..30b945c417d04106a05a0d3dcb86e5df &no_javascript_access); diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc -index e9cb49ebc81d7b9babe25a0a9c9ddfdf1db843d9..23776e0911f2315b60451d132ddd3cd002a241a2 100644 +index 82af60872317fdaf16561c9f9adecb79ce82f610..bf72f1adf22e71ebcae50dd9fb1b88e8178a7767 100644 --- a/content/browser/security_exploit_browsertest.cc +++ b/content/browser/security_exploit_browsertest.cc -@@ -300,6 +300,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, +@@ -357,6 +357,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); params->target_url = GURL("about:blank"); @@ -68,7 +68,7 @@ index e9cb49ebc81d7b9babe25a0a9c9ddfdf1db843d9..23776e0911f2315b60451d132ddd3cd0 std::move(params), base::BindOnce([](mojom::CreateNewWindowStatus, mojom::CreateNewWindowReplyPtr) {})); diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index c2ce967c17ac6a61b3aeb6e26f88212211f7a9f4..8c8d149b9c0de26e050b196a1a2a1bf6e953f121 100644 +index 25346dc852e799a2562386a6207d2de31077695f..908a8676daeb753c1580f98e8babf203cfa5b719 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom @@ -12,6 +12,8 @@ import "content/public/common/resource_type.mojom"; @@ -80,7 +80,7 @@ index c2ce967c17ac6a61b3aeb6e26f88212211f7a9f4..8c8d149b9c0de26e050b196a1a2a1bf6 import "mojo/public/mojom/base/string16.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/network/public/mojom/url_loader.mojom"; -@@ -168,6 +170,24 @@ interface FrameFactory { +@@ -178,6 +180,24 @@ interface FrameFactory { CreateFrame(int32 frame_routing_id, Frame& frame); }; @@ -105,7 +105,7 @@ index c2ce967c17ac6a61b3aeb6e26f88212211f7a9f4..8c8d149b9c0de26e050b196a1a2a1bf6 struct CreateNewWindowParams { // True if this open request came in the context of a user gesture. // -@@ -207,6 +227,10 @@ struct CreateNewWindowParams { +@@ -217,6 +237,10 @@ struct CreateNewWindowParams { // The window features to use for the new window. blink.mojom.WindowFeatures features; @@ -117,10 +117,10 @@ index c2ce967c17ac6a61b3aeb6e26f88212211f7a9f4..8c8d149b9c0de26e050b196a1a2a1bf6 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 8e652e4b66f08ff86c3184adf0ef9704fab0d11c..12411003ad4d54576117cc719bff804da1706170 100644 +index 6ed69effde7e7b269191788bedd4f98e3d778d67..abfb6afec00a691ea2ff27e7797921e3eb25d8ea 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -453,6 +453,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -460,6 +460,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -130,7 +130,7 @@ index 8e652e4b66f08ff86c3184adf0ef9704fab0d11c..12411003ad4d54576117cc719bff804d bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index bc2b501331e9d628c5285eee003ca3b55f3cb98f..89674a18276e34eebc0038e588ea4629a4eaca6c 100644 +index b33545b865e4677ee2e9a909d259df171c12d985..eb2f9a8f240f8805e4bcbde0465ec445dd7539e7 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -169,6 +169,7 @@ class RenderFrameHost; @@ -141,7 +141,7 @@ index bc2b501331e9d628c5285eee003ca3b55f3cb98f..89674a18276e34eebc0038e588ea4629 class ServiceManagerConnection; class SiteInstance; class SpeechRecognitionManagerDelegate; -@@ -734,6 +735,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -757,6 +758,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -151,10 +151,10 @@ index bc2b501331e9d628c5285eee003ca3b55f3cb98f..89674a18276e34eebc0038e588ea4629 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index 215c4a750f046939cb59ba8f53059eb4c3e35ef6..0e6199a8f594fd6c7384147c541e6c06a263f51e 100644 +index bc72fadb307f801d9f1b6c90189596c36d7203e7..a95a89178cf80dc1f6efb15e0ea7ce92d1fd26ed 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc -@@ -78,6 +78,7 @@ +@@ -76,6 +76,7 @@ #include "content/renderer/ime_event_guard.h" #include "content/renderer/internal_document_state_data.h" #include "content/renderer/loader/request_extra_data.h" @@ -162,7 +162,7 @@ index 215c4a750f046939cb59ba8f53059eb4c3e35ef6..0e6199a8f594fd6c7384147c541e6c06 #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" -@@ -1421,6 +1422,46 @@ WebView* RenderViewImpl::CreateView(WebLocalFrame* creator, +@@ -1379,6 +1380,46 @@ WebView* RenderViewImpl::CreateView(WebLocalFrame* creator, } params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); @@ -210,10 +210,10 @@ index 215c4a750f046939cb59ba8f53059eb4c3e35ef6..0e6199a8f594fd6c7384147c541e6c06 // moved on send. bool is_background_tab = diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.cc b/content/shell/browser/layout_test/layout_test_content_browser_client.cc -index 7da9182635afa02226a0848d35d7ec372f4fc785..048e1126a31cf5bcaf9e0203af4a0c449db190f5 100644 +index 1c7ae733b09ed16183d9772c1954f6f190866d26..c7e4faf01f5f2d4dc110588c16bb67417c51bbf9 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.cc +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.cc -@@ -279,6 +279,8 @@ bool LayoutTestContentBrowserClient::CanCreateWindow( +@@ -282,6 +282,8 @@ bool LayoutTestContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -223,7 +223,7 @@ index 7da9182635afa02226a0848d35d7ec372f4fc785..048e1126a31cf5bcaf9e0203af4a0c44 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.h b/content/shell/browser/layout_test/layout_test_content_browser_client.h -index c601d6e4b28dfb4216b2d7072ba1ac9dd7345f42..00bbd237ff8afd6567218363423538b9e38ae1b0 100644 +index 76d53623ff698bec66dba4342e9384685ffb753e..d8b8e17dc22b96f083336cd3dcd888f89173eea1 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.h +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.h @@ -66,6 +66,8 @@ class LayoutTestContentBrowserClient : public ShellContentBrowserClient { diff --git a/patches/common/chromium/chrome_key_systems.patch b/patches/common/chromium/chrome_key_systems.patch index c17ee41cedfc..346f0dd25672 100644 --- a/patches/common/chromium/chrome_key_systems.patch +++ b/patches/common/chromium/chrome_key_systems.patch @@ -7,7 +7,7 @@ Disable persiste licence support check for widevine cdm, as its not supported in the current version of chrome. diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc -index 7826495469120f46d1bd8529139f7567f45138ef..166e5a31d5f36876b339c5cf66527fc88e7c26af 100644 +index bcf7d3a812ef8d105d6ffb5bc72432e15a98f10c..5d63d3824e53ec5b704b93b95e70ea1d5e5627b1 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc @@ -15,7 +15,9 @@ @@ -20,7 +20,7 @@ index 7826495469120f46d1bd8529139f7567f45138ef..166e5a31d5f36876b339c5cf66527fc8 #include "components/cdm/renderer/external_clear_key_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h" #include "content/public/renderer/render_thread.h" -@@ -187,12 +189,14 @@ static SupportedCodecs GetSupportedCodecs( +@@ -189,12 +191,14 @@ static SupportedCodecs GetSupportedCodecs( // Returns persistent-license session support. static EmeSessionTypeSupport GetPersistentLicenseSupport( bool supported_by_the_cdm) { diff --git a/patches/common/chromium/color_chooser.patch b/patches/common/chromium/color_chooser.patch index 9883d290a917..257dae3a12b2 100644 --- a/patches/common/chromium/color_chooser.patch +++ b/patches/common/chromium/color_chooser.patch @@ -15,7 +15,7 @@ code was around 2012-2013, and this is purely UI, I don't think they have automated tests for it). diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h -index c0c7c21131c3dd8d197ad1808142915704406d9d..43b5e57e91a451e79c3f77450d99cffc222842fd 100644 +index f68bd5a7bf50eea701410779ed982db045f652a7..1c31eca5aaed470960e64f760c4328c0c155310f 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h @@ -4,7 +4,7 @@ @@ -57,7 +57,7 @@ index c0c7c21131c3dd8d197ad1808142915704406d9d..43b5e57e91a451e79c3f77450d99cffc #if defined(OS_MACOSX) // Bridging methods that show/hide the toolkit-views based Task Manager on Mac. -@@ -310,13 +312,13 @@ void ShowChromeCleanerRebootPrompt( +@@ -311,13 +313,13 @@ void ShowChromeCleanerRebootPrompt( safe_browsing::ChromeCleanerRebootDialogController* dialog_controller); #endif // OS_WIN diff --git a/patches/common/chromium/compositor_delegate.patch b/patches/common/chromium/compositor_delegate.patch index 57ff8d3d8565..2d3a7f0a992d 100644 --- a/patches/common/chromium/compositor_delegate.patch +++ b/patches/common/chromium/compositor_delegate.patch @@ -5,10 +5,10 @@ Subject: compositor_delegate.patch diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc -index 642fff3b4367f0fe684d99cdcd4aee7d1a21cb40..45faeed249c0d92d8e146290fefddd5cf8f4f643 100644 +index e8741caf69a8d3770905dcf1d466e7f01ddf69ba..b62009feb2e97362d90c6c917305f91cae27d790 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc -@@ -493,10 +493,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( +@@ -492,10 +492,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( // surfaces as they are not following the correct mode. DisableGpuCompositing(compositor.get()); } @@ -32,10 +32,10 @@ index 642fff3b4367f0fe684d99cdcd4aee7d1a21cb40..45faeed249c0d92d8e146290fefddd5c } else { DCHECK(context_provider); diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index a1b6716fc79f06216edf150a4e34f678a0da1518..89a1c426e9a48504082a3119f837e3d5f22d45a3 100644 +index b3905bdfa6500f02328552b7c2402797a71758be..490722c20c25f752e37ac3b481f8d2aa616408a4 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include "components/viz/common/surfaces/frame_sink_id.h" #include "components/viz/common/surfaces/local_surface_id.h" #include "components/viz/host/host_frame_sink_client.h" @@ -43,7 +43,7 @@ index a1b6716fc79f06216edf150a4e34f678a0da1518..89a1c426e9a48504082a3119f837e3d5 #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkMatrix44.h" #include "ui/compositor/compositor_animation_observer.h" -@@ -200,6 +201,15 @@ class COMPOSITOR_EXPORT ContextFactory { +@@ -198,6 +199,15 @@ class COMPOSITOR_EXPORT ContextFactory { virtual bool SyncTokensRequiredForDisplayCompositor() = 0; }; @@ -59,7 +59,7 @@ index a1b6716fc79f06216edf150a4e34f678a0da1518..89a1c426e9a48504082a3119f837e3d5 // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final // displayable form of pixels comprising a single widget's contents. It draws an -@@ -240,6 +250,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -237,6 +247,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -69,7 +69,7 @@ index a1b6716fc79f06216edf150a4e34f678a0da1518..89a1c426e9a48504082a3119f837e3d5 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -463,6 +476,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -448,6 +461,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, ui::ContextFactory* context_factory_; ui::ContextFactoryPrivate* context_factory_private_; diff --git a/patches/common/chromium/content_allow_embedder_to_prevent_locking_scheme_registry.patch b/patches/common/chromium/content_allow_embedder_to_prevent_locking_scheme_registry.patch index e3b571a61c69..8a316a7d1650 100644 --- a/patches/common/chromium/content_allow_embedder_to_prevent_locking_scheme_registry.patch +++ b/patches/common/chromium/content_allow_embedder_to_prevent_locking_scheme_registry.patch @@ -11,12 +11,11 @@ is ready, but after the //content layer has already locked the registry. Without this patch, calling `registerStandardSchemes` during initialization when in debug mode will cause a DCHECK to fire. - diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 034fdcad958cb25780c304d184b2fbb721a13200..c2090368f6678950690463e0b90620cb9fdf5f41 100644 +index 6ed770290b1f18791c1a38a0e8e4dc0f670c29cf..37668b3e74c4031417c5ff91376a20aa56e15c07 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc -@@ -808,7 +808,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { +@@ -739,7 +739,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { #endif RegisterPathProvider(); @@ -26,10 +25,10 @@ index 034fdcad958cb25780c304d184b2fbb721a13200..c2090368f6678950690463e0b90620cb #if defined(OS_ANDROID) && (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE) int icudata_fd = g_fds->MaybeGet(kAndroidICUDataDescriptor); diff --git a/content/public/app/content_main_delegate.cc b/content/public/app/content_main_delegate.cc -index c4bdfd36ad0c34b3a91b59502414bc98c091ccee..d7ac740d0088c002bee98238faea1ef9593eee92 100644 +index cf3c71fe0edc7fd9b788e5ca06cedcd5f9dfa369..877642228966170f3c6bbf4faf80af66bbac387e 100644 --- a/content/public/app/content_main_delegate.cc +++ b/content/public/app/content_main_delegate.cc -@@ -63,6 +63,10 @@ bool ContentMainDelegate::ShouldEnableProfilerRecording() { +@@ -59,6 +59,10 @@ bool ContentMainDelegate::ShouldEnableProfilerRecording() { return false; } @@ -41,10 +40,10 @@ index c4bdfd36ad0c34b3a91b59502414bc98c091ccee..d7ac740d0088c002bee98238faea1ef9 return service_manager::ProcessType::kDefault; } diff --git a/content/public/app/content_main_delegate.h b/content/public/app/content_main_delegate.h -index 979e25d1c1b9ff4b16adbab28cb44d8473f8232a..7aca113058ed111a98e396df57ebc36c06e3b896 100644 +index d55f5050c8c3cb15c549dd3ae90d00f1455d34c8..f00266ce4f93bea585f191512226cc40e1f46545 100644 --- a/content/public/app/content_main_delegate.h +++ b/content/public/app/content_main_delegate.h -@@ -101,6 +101,9 @@ class CONTENT_EXPORT ContentMainDelegate { +@@ -93,6 +93,9 @@ class CONTENT_EXPORT ContentMainDelegate { // Returns whether or not profiler recording should be enabled. virtual bool ShouldEnableProfilerRecording(); diff --git a/patches/common/chromium/content_browser_main_loop.patch b/patches/common/chromium/content_browser_main_loop.patch index 187f1745fe62..005ec26f1302 100644 --- a/patches/common/chromium/content_browser_main_loop.patch +++ b/patches/common/chromium/content_browser_main_loop.patch @@ -8,10 +8,10 @@ run before shutdown. This is required to cleanup WebContents asynchronously in atom::CommonWebContentsDelegate::ResetManageWebContents. diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc -index 5cea69cfba0058041766ff25b32afbe6cfb6d59d..0d427b35f0f4762fc74f5aceac3923f98a2134f7 100644 +index 20471ef5ccae66fb8c09eb4da25a67304d7626c2..bcaf20bdf3cf78d6ffb3eacb57653f5139ebf41d 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc -@@ -1582,7 +1582,7 @@ void BrowserMainLoop::MainMessageLoopRun() { +@@ -1527,7 +1527,7 @@ void BrowserMainLoop::MainMessageLoopRun() { } base::RunLoop run_loop; diff --git a/patches/common/chromium/cross_site_document_resource_handler.patch b/patches/common/chromium/cross_site_document_resource_handler.patch index de284a575a06..6943f6223b23 100644 --- a/patches/common/chromium/cross_site_document_resource_handler.patch +++ b/patches/common/chromium/cross_site_document_resource_handler.patch @@ -8,10 +8,10 @@ this patch can be removed once we switch to network service, where the embedders have a chance to design their URLLoaders. diff --git a/content/browser/loader/cross_site_document_resource_handler.cc b/content/browser/loader/cross_site_document_resource_handler.cc -index 907922701280b589bf11691342de0ec95cdec6a1..eaf8bac18f8e3a2735ce7ded606199092a3746d3 100644 +index be1724e19eeb0186dc20dad48e0d604ff87918e5..3dea6a89eb12dc6be157c39787358cd86810da16 100644 --- a/content/browser/loader/cross_site_document_resource_handler.cc +++ b/content/browser/loader/cross_site_document_resource_handler.cc -@@ -593,6 +593,9 @@ bool CrossSiteDocumentResourceHandler::ShouldBlockBasedOnHeaders( +@@ -619,6 +619,9 @@ bool CrossSiteDocumentResourceHandler::ShouldBlockBasedOnHeaders( return false; } @@ -22,10 +22,10 @@ index 907922701280b589bf11691342de0ec95cdec6a1..eaf8bac18f8e3a2735ce7ded60619909 } diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index f713d0cfbf90665d921f56f4d828887ad1f7842c..4fe21468aee93a7cb3783220ebfe8dd100a3d1d5 100644 +index ae4bfc6553f347ad5a7e5327d64155e700e6584e..e279ded9407bbfda6d76072cd6fa2c8a06379e9f 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -57,6 +57,10 @@ ContentBrowserClient::SiteInstanceForNavigationType ContentBrowserClient::Should +@@ -59,6 +59,10 @@ ContentBrowserClient::SiteInstanceForNavigationType ContentBrowserClient::Should return SiteInstanceForNavigationType::ASK_CHROMIUM; } @@ -37,10 +37,10 @@ index f713d0cfbf90665d921f56f4d828887ad1f7842c..4fe21468aee93a7cb3783220ebfe8dd1 const MainFunctionParams& parameters) { return nullptr; diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 4bf6b2b5f8110f539adc61858cfdc8f77f7ed08b..94454812e27d4d357eeee27cfc1e185386ea2003 100644 +index 5f6fdb2d66acfa73c895cac18714d0998eed2ab2..836851cfcbc94becdf3d4af682dbe3e098172c25 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -225,6 +225,9 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -233,6 +233,9 @@ class CONTENT_EXPORT ContentBrowserClient { content::RenderFrameHost* rfh, content::SiteInstance* pending_site_instance){}; diff --git a/patches/common/chromium/customizable_app_indicator_id_prefix.patch b/patches/common/chromium/customizable_app_indicator_id_prefix.patch index 3deacc46b06b..8dceffca12c8 100644 --- a/patches/common/chromium/customizable_app_indicator_id_prefix.patch +++ b/patches/common/chromium/customizable_app_indicator_id_prefix.patch @@ -14,7 +14,7 @@ Reviewed-by: Scott Violet Cr-Commit-Position: refs/heads/master@{#605435} diff --git a/chrome/browser/ui/libgtkui/gtk_ui.cc b/chrome/browser/ui/libgtkui/gtk_ui.cc -index 3e2f37380b1d23d2eaec82ca532843775b2f61d6..082162ce707bc575d7a0491471b430db041371da 100644 +index 3a829df4099f5223d0862c33a6ffc61b107b20b7..3b86e178d4c83f07231649360c8b65ca83143408 100644 --- a/chrome/browser/ui/libgtkui/gtk_ui.cc +++ b/chrome/browser/ui/libgtkui/gtk_ui.cc @@ -234,11 +234,6 @@ typedef std::unique_ptr ScopedGIcon; @@ -29,7 +29,7 @@ index 3e2f37380b1d23d2eaec82ca532843775b2f61d6..082162ce707bc575d7a0491471b430db // Number of app indicators used (used as part of app-indicator id). int indicators_count; -@@ -600,7 +595,8 @@ bool GtkUi::IsStatusIconSupported() const { +@@ -545,7 +540,8 @@ bool GtkUi::IsStatusIconSupported() const { std::unique_ptr GtkUi::CreateLinuxStatusIcon( const gfx::ImageSkia& image, @@ -39,7 +39,7 @@ index 3e2f37380b1d23d2eaec82ca532843775b2f61d6..082162ce707bc575d7a0491471b430db #if GTK_CHECK_VERSION(3, 90, 0) NOTIMPLEMENTED(); return nullptr; -@@ -608,8 +604,8 @@ std::unique_ptr GtkUi::CreateLinuxStatusIcon( +@@ -553,8 +549,8 @@ std::unique_ptr GtkUi::CreateLinuxStatusIcon( if (AppIndicatorIcon::CouldOpen()) { ++indicators_count; return std::unique_ptr(new AppIndicatorIcon( @@ -51,10 +51,10 @@ index 3e2f37380b1d23d2eaec82ca532843775b2f61d6..082162ce707bc575d7a0491471b430db return std::unique_ptr( new GtkStatusIcon(image, tool_tip)); diff --git a/chrome/browser/ui/libgtkui/gtk_ui.h b/chrome/browser/ui/libgtkui/gtk_ui.h -index 6f4899402ec5d7b8107c9dc2c43bd040492fd8dd..c52874dd745463d3a1b1e798992ac17e64937ea2 100644 +index 1c626d1cafd1ec979be8dd5ef6ddbbc9d1b29bc2..2c98c1990419eb5276c01553caad559cf60714ad 100644 --- a/chrome/browser/ui/libgtkui/gtk_ui.h +++ b/chrome/browser/ui/libgtkui/gtk_ui.h -@@ -92,7 +92,8 @@ class GtkUi : public views::LinuxUI { +@@ -90,7 +90,8 @@ class GtkUi : public views::LinuxUI { bool IsStatusIconSupported() const override; std::unique_ptr CreateLinuxStatusIcon( const gfx::ImageSkia& image, @@ -93,10 +93,10 @@ index eed6bb2eaf756189be016c382673e23eb7ca18e0..4694a9a920b1f9150399e183038f04ac return base::WrapUnique( new StatusIconLinuxWrapper(std::move(status_icon))); diff --git a/ui/views/linux_ui/linux_ui.h b/ui/views/linux_ui/linux_ui.h -index 86a3c0a78cb748f679e2313db569ac0029c8da0f..bd01febaf6e0b3712e86183f7a56122d7f1ee666 100644 +index 759d4ab03f02a338f5e89bf971a423f6b42814ed..208c9a5ac7eb5441110f34b3f7859945c591df21 100644 --- a/ui/views/linux_ui/linux_ui.h +++ b/ui/views/linux_ui/linux_ui.h -@@ -132,10 +132,12 @@ class VIEWS_EXPORT LinuxUI : public ui::LinuxInputMethodContextFactory, +@@ -130,10 +130,12 @@ class VIEWS_EXPORT LinuxUI : public ui::LinuxInputMethodContextFactory, // Checks for platform support for status icons. virtual bool IsStatusIconSupported() const = 0; diff --git a/patches/common/chromium/dcheck.patch b/patches/common/chromium/dcheck.patch index 732c35725ebf..42b54050a059 100644 --- a/patches/common/chromium/dcheck.patch +++ b/patches/common/chromium/dcheck.patch @@ -17,7 +17,7 @@ only one or two specific checks fail. Then it's better to simply comment out the failing checks and allow the rest of the target to have them enabled. diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc -index d8aca9e2cbffdfd0bbb0bd67e8adfb53547132bb..86224ab7a3c5637422559da25bc8c1040a03e937 100644 +index bd5221ce36f87e4f54cbf71268bbffa692701517..6c6a22fdea951662a63c88e6939404878afc45ab 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc @@ -995,8 +995,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( diff --git a/patches/common/chromium/desktop_media_list.patch b/patches/common/chromium/desktop_media_list.patch index 3fea4d5ab553..693c554c9d26 100644 --- a/patches/common/chromium/desktop_media_list.patch +++ b/patches/common/chromium/desktop_media_list.patch @@ -36,10 +36,10 @@ index 8e02a8a95eb07516162eacdf5b361231d3a02975..3497b85428a52c6019cfb5d30229071f virtual content::DesktopMediaID::Type GetMediaListType() const = 0; }; diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.cc b/chrome/browser/media/webrtc/desktop_media_list_base.cc -index 43dd95ef72f5b35b91471950cc114800d54945ab..d4662708f64934372422b853673eaaf8f05e4baf 100644 +index 727d1f564dc943026a4b10ab2584f9269bb2ae4a..66789680d51e74e533bfb9c6c99e5b9e0844b1d9 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.cc +++ b/chrome/browser/media/webrtc/desktop_media_list_base.cc -@@ -18,6 +18,11 @@ DesktopMediaListBase::DesktopMediaListBase(base::TimeDelta update_period) +@@ -20,6 +20,11 @@ DesktopMediaListBase::DesktopMediaListBase(base::TimeDelta update_period) DesktopMediaListBase::~DesktopMediaListBase() {} @@ -51,7 +51,7 @@ index 43dd95ef72f5b35b91471950cc114800d54945ab..d4662708f64934372422b853673eaaf8 void DesktopMediaListBase::SetUpdatePeriod(base::TimeDelta period) { DCHECK(!observer_); update_period_ = period; -@@ -31,10 +36,7 @@ void DesktopMediaListBase::SetViewDialogWindowId(DesktopMediaID dialog_id) { +@@ -33,10 +38,7 @@ void DesktopMediaListBase::SetViewDialogWindowId(DesktopMediaID dialog_id) { view_dialog_id_ = dialog_id; } @@ -63,7 +63,7 @@ index 43dd95ef72f5b35b91471950cc114800d54945ab..d4662708f64934372422b853673eaaf8 Refresh(); } -@@ -49,6 +51,11 @@ const DesktopMediaList::Source& DesktopMediaListBase::GetSource( +@@ -51,6 +53,11 @@ const DesktopMediaList::Source& DesktopMediaListBase::GetSource( return sources_[index]; } @@ -75,7 +75,7 @@ index 43dd95ef72f5b35b91471950cc114800d54945ab..d4662708f64934372422b853673eaaf8 DesktopMediaID::Type DesktopMediaListBase::GetMediaListType() const { return type_; } -@@ -60,6 +67,12 @@ DesktopMediaListBase::SourceDescription::SourceDescription( +@@ -62,6 +69,12 @@ DesktopMediaListBase::SourceDescription::SourceDescription( void DesktopMediaListBase::UpdateSourcesList( const std::vector& new_sources) { @@ -88,15 +88,15 @@ index 43dd95ef72f5b35b91471950cc114800d54945ab..d4662708f64934372422b853673eaaf8 typedef std::set SourceSet; SourceSet new_source_set; for (size_t i = 0; i < new_sources.size(); ++i) { -@@ -132,6 +145,8 @@ void DesktopMediaListBase::UpdateSourceThumbnail(DesktopMediaID id, +@@ -134,6 +147,8 @@ void DesktopMediaListBase::UpdateSourceThumbnail(DesktopMediaID id, } void DesktopMediaListBase::ScheduleNextRefresh() { + if (!observer_->ShouldScheduleNextRefresh(this)) + return; - BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(&DesktopMediaListBase::Refresh, - weak_factory_.GetWeakPtr()), + base::PostDelayedTaskWithTraits(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&DesktopMediaListBase::Refresh, + weak_factory_.GetWeakPtr()), diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.h b/chrome/browser/media/webrtc/desktop_media_list_base.h index 746df1210aa92af5c9d4703112b4bd6c09b94fdf..461e0edf8509569d05c86f466c02b5035183d0df 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.h @@ -133,10 +133,10 @@ index 47401abc984e6fe26c7f4c5399aa565c687060b0..ca6a527ffac877c27aac94337ec5a7b5 protected: virtual ~DesktopMediaListObserver() {} diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc -index f5f62407f0d6dbeb91db4d446b0260ecb5c66f28..818d2fee48c793b2ece7f761d7835a9077bf2e70 100644 +index 5eac54ba5336d51b15da1e084df0fc7f6dc09deb..e7c2478850d5231e258fb4c54dd57db555273efc 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc -@@ -6,13 +6,14 @@ +@@ -6,14 +6,15 @@ #include "base/hash.h" #include "base/single_thread_task_runner.h" @@ -147,6 +147,7 @@ index f5f62407f0d6dbeb91db4d446b0260ecb5c66f28..818d2fee48c793b2ece7f761d7835a90 #include "build/build_config.h" #include "chrome/browser/media/webrtc/desktop_media_list_observer.h" -#include "chrome/grit/generated_resources.h" + #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "electron/grit/electron_resources.h" #include "media/base/video_util.h" diff --git a/patches/common/chromium/disable-redraw-lock.patch b/patches/common/chromium/disable-redraw-lock.patch index ff8fa6ac65d5..61334700d366 100644 --- a/patches/common/chromium/disable-redraw-lock.patch +++ b/patches/common/chromium/disable-redraw-lock.patch @@ -15,7 +15,7 @@ the redraw locking mechanism, which fixes these issues. The electron issue can be found at https://github.com/electron/electron/issues/1821 diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 54eb0fcd0bf79bef4c7bfbd07bea27b005e73f61..90a11451be65a152f7bcc77eef360b1b41e41a28 100644 +index 9afbcf6ca30a6282cfa0ade76fe07467d497ac2e..2945f4fe3744b0d8ae56393d935125e3118189b4 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -282,6 +282,10 @@ const int kSynthesizedMouseMessagesTimeDifference = 500; diff --git a/patches/common/chromium/disable_detach_webview_frame.patch b/patches/common/chromium/disable_detach_webview_frame.patch index a9ea4a98be6e..defdf42c0c9b 100644 --- a/patches/common/chromium/disable_detach_webview_frame.patch +++ b/patches/common/chromium/disable_detach_webview_frame.patch @@ -10,10 +10,10 @@ We should revisit this bug after upgrading to newer versions of Chrome, this patch was introduced in Chrome 66. diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc -index bad4c9fc4ebb19e6155ef7aeb3dfea3416611500..a08cbd5b2d5aa5e6ce903b75ef919084ad5a6135 100644 +index 80d51c9baf63ab1dc005e44854f4eca497d8b7dd..f5bec5d54dd0ee826cbf6559fbbc0fece1398118 100644 --- a/content/browser/frame_host/render_frame_proxy_host.cc +++ b/content/browser/frame_host/render_frame_proxy_host.cc -@@ -260,6 +260,12 @@ void RenderFrameProxyHost::SetDestructionCallback( +@@ -259,6 +259,12 @@ void RenderFrameProxyHost::SetDestructionCallback( void RenderFrameProxyHost::OnDetach() { if (frame_tree_node_->render_manager()->ForInnerDelegate()) { diff --git a/patches/common/chromium/disable_hidden.patch b/patches/common/chromium/disable_hidden.patch index 87d6c9392516..79319ab6bffd 100644 --- a/patches/common/chromium/disable_hidden.patch +++ b/patches/common/chromium/disable_hidden.patch @@ -5,10 +5,10 @@ Subject: disable_hidden.patch diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 437b43ade73d0a154be0bf4aa14c29a9081b04d0..70e985b7b13031c760d2e791930b1361586a1707 100644 +index 807466aeeda0b504098a5455bf6e5e0aab9735f0..85be4a6900632f336868f9b585ca735468ce12eb 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -718,6 +718,9 @@ void RenderWidgetHostImpl::WasHidden() { +@@ -685,6 +685,9 @@ void RenderWidgetHostImpl::WasHidden() { if (is_hidden_) return; @@ -19,10 +19,10 @@ index 437b43ade73d0a154be0bf4aa14c29a9081b04d0..70e985b7b13031c760d2e791930b1361 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::WasHidden"); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index c2d8cd562433ebdbb3372cae530c8967edb37225..c1e59acbfb0392833ddbcc4da60664c3eb51c7d6 100644 +index dba7b4276f5e6c0543a8e65b2bb01ad714fe0c79..f0126b89fffaad13ab44732062c435d18bda0e4e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -154,6 +154,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl +@@ -153,6 +153,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl // RenderWidgetHostImpl. static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); diff --git a/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch b/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch index e9fe2025d7ed..c8991d963307 100644 --- a/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch +++ b/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch @@ -6,10 +6,10 @@ Subject: disable_user_gesture_requirement_for_beforeunload_dialogs.patch See https://github.com/electron/electron/issues/10754 diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc -index e628c1ab8242d5c2fd63617e3a0816b14b2fef90..a2311194b1bbfc8e6d0d768c199b6f19a02f0fe9 100644 +index 7ba01ff026e3da711ee3e291385cb5c1086a2f08..eb2e3288c761957975ab9b5b8b43f3fee3337afa 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc -@@ -3592,7 +3592,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client, +@@ -3644,7 +3644,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client, "frame that never had a user gesture since its load. " "https://www.chromestatus.com/feature/5082396709879808"; Intervention::GenerateReport(frame_, "BeforeUnloadNoGesture", message); diff --git a/patches/common/chromium/dom_storage_limits.patch b/patches/common/chromium/dom_storage_limits.patch index 7cd7ec2d334c..a708c1c6a7f7 100644 --- a/patches/common/chromium/dom_storage_limits.patch +++ b/patches/common/chromium/dom_storage_limits.patch @@ -32,36 +32,36 @@ for a given `BrowserWindow` via a `webPreferences` option, similar to [`nodeIntegration`](https://electronjs.org/docs/tutorial/security#2-disable-nodejs-integration-for-remote-content). diff --git a/content/common/dom_storage/dom_storage_map.cc b/content/common/dom_storage/dom_storage_map.cc -index fd088fb170be..b90b6cf9132d 100644 +index fd088fb170bead6452ded14016f21f0c29659e03..b90b6cf9132d16bc3b2076c3fa313916e2b5ea7d 100644 --- a/content/common/dom_storage/dom_storage_map.cc +++ b/content/common/dom_storage/dom_storage_map.cc @@ -185,10 +185,12 @@ bool DOMStorageMap::SetItemInternal(MapType* map_type, size_t new_item_size = size_in_storage(key, value); size_t new_storage_used = storage_used_ - old_item_size + new_item_size; - + +#if 0 // Only check quota if the size is increasing, this allows // shrinking changes to pre-existing files that are over budget. if (new_item_size > old_item_size && new_storage_used > quota_) return false; +#endif - + (*map_type)[key] = value; ResetKeyIterator(); diff --git a/content/common/dom_storage/dom_storage_types.h b/content/common/dom_storage/dom_storage_types.h -index e87afe5b8ee0..61c9a0dfff60 100644 +index e87afe5b8ee07f7038a7cc9c40832b6cd27884da..61c9a0dfff60f79c7b36ff5c7d741c06dca03ada 100644 --- a/content/common/dom_storage/dom_storage_types.h +++ b/content/common/dom_storage/dom_storage_types.h @@ -21,6 +21,7 @@ typedef std::map DOMStorageValuesMap; - + // The quota for each storage area. // This value is enforced in renderer processes and the browser process. +// However, Electron's dom_storage_limits.patch removes the code that checks this limit. const size_t kPerStorageAreaQuota = 10 * 1024 * 1024; - + // In the browser process we allow some overage to diff --git a/content/renderer/dom_storage/dom_storage_cached_area.cc b/content/renderer/dom_storage/dom_storage_cached_area.cc -index 402c27727ff1..f5908a1c55f9 100644 +index a7cdf900661bff52e1d3d9bc98d68e6a457c3fa7..ce302dcbece11880b5b6da4b6d5d807ba9dc09c9 100644 --- a/content/renderer/dom_storage/dom_storage_cached_area.cc +++ b/content/renderer/dom_storage/dom_storage_cached_area.cc @@ -53,11 +53,13 @@ bool DOMStorageCachedArea::SetItem(int connection_id, @@ -75,14 +75,14 @@ index 402c27727ff1..f5908a1c55f9 100644 kPerStorageAreaQuota) return false; +#endif - + PrimeIfNeeded(connection_id); base::NullableString16 old_value; diff --git a/content/renderer/dom_storage/local_storage_cached_area.cc b/content/renderer/dom_storage/local_storage_cached_area.cc -index ffa21c9200d0..0edbd6152292 100644 +index c04e0e8bff1a7a41a1e18aca5403aed16a80aead..d63cec971f0a98f7b8ff30c1f6a0fa843efbecfa 100644 --- a/content/renderer/dom_storage/local_storage_cached_area.cc +++ b/content/renderer/dom_storage/local_storage_cached_area.cc -@@ -141,11 +141,13 @@ bool LocalStorageCachedArea::SetItem(const base::string16& key, +@@ -142,11 +142,13 @@ bool LocalStorageCachedArea::SetItem(const base::string16& key, const base::string16& value, const GURL& page_url, const std::string& storage_area_id) { @@ -93,6 +93,6 @@ index ffa21c9200d0..0edbd6152292 100644 kPerStorageAreaQuota) return false; +#endif - + EnsureLoaded(); bool result = false; diff --git a/patches/common/chromium/enable_widevine.patch b/patches/common/chromium/enable_widevine.patch index c58dbbd75681..6e4e3e4ad900 100644 --- a/patches/common/chromium/enable_widevine.patch +++ b/patches/common/chromium/enable_widevine.patch @@ -8,15 +8,18 @@ Electron needs that flag to be enabled on those paltforms, but there's no way to conditionally set it during a `gn gen` call. diff --git a/third_party/widevine/cdm/widevine.gni b/third_party/widevine/cdm/widevine.gni -index 82a93622585a424f56c3567050f9ba4822de6c1e..cbd10bed9f3bdbeb61ec5daa2f8d0e158549b7fd 100644 +index e10d9b9b8d2975a731adfee2eb0086afd7975f97..844320dc66cd5781e218d5ca8084f5185a5e331d 100644 --- a/third_party/widevine/cdm/widevine.gni +++ b/third_party/widevine/cdm/widevine.gni -@@ -7,7 +7,7 @@ import("//media/media_options.gni") +@@ -6,9 +6,8 @@ import("//build/config/chrome_build.gni") + import("//media/media_options.gni") declare_args() { - # Allow Widevine key system support in Chromium. -- enable_widevine = false +- # Enables Widevine key system support. Enabled by default in Google Chrome or +- # on Android. Can be optionally enabled in Chromium. +- enable_widevine = is_chrome_branded || is_android ++ # Allow Widevine key system support in Chromium. + enable_widevine = is_mac || is_win } - enable_widevine_cdm_host_verification = + # Widevine CDM is available as a library CDM on the following platforms and diff --git a/patches/common/chromium/exclude-a-few-test-files-from-build.patch b/patches/common/chromium/exclude-a-few-test-files-from-build.patch index 2a8ed5817ce5..e932974d73f6 100644 --- a/patches/common/chromium/exclude-a-few-test-files-from-build.patch +++ b/patches/common/chromium/exclude-a-few-test-files-from-build.patch @@ -7,15 +7,15 @@ Compilation of those files fails with the Chromium 68. Remove the patch during the Chromium 69 upgrade. diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 7b47402ebe6a27215b54853182b21abfddf67af8..68bf39ea6aed6f84825b2d850d3e5375e8cc2923 100644 +index 1f0518e9cc2456d9299b16437be36041c98e8a92..e492c7fe90504314f1116607c1f543e68ddf2ad8 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1726,7 +1726,7 @@ jumbo_source_set("blink_platform_unittests_sources") { +@@ -1729,7 +1729,7 @@ jumbo_source_set("blink_platform_unittests_sources") { "graphics/paint/drawing_display_item_test.cc", "graphics/paint/drawing_recorder_test.cc", "graphics/paint/float_clip_rect_test.cc", - "graphics/paint/geometry_mapper_test.cc", + #"graphics/paint/geometry_mapper_test.cc", + "graphics/paint/geometry_mapper_transform_cache_test.cc", "graphics/paint/paint_chunk_test.cc", "graphics/paint/paint_chunker_test.cc", - "graphics/paint/paint_controller_test.cc", diff --git a/patches/common/chromium/fix_trackpad_scrolling.patch b/patches/common/chromium/fix_trackpad_scrolling.patch index 08ef24ad99d5..59bd6d75d08f 100644 --- a/patches/common/chromium/fix_trackpad_scrolling.patch +++ b/patches/common/chromium/fix_trackpad_scrolling.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao -Date: Mon Nov 26 09:32:14 2018 +0900 +Date: Mon, 26 Nov 2018 09:32:14 +0900 Subject: fix_trackpad_scrolling.patch Backport https://chromium-review.googlesource.com/c/chromium/src/+/1299342. @@ -226,10 +226,10 @@ index c11202b12da8fc540a78c3b13f731fc33d2d63b3..2b29fc641a810d2b521fa14e40da5bff HWND parent_window_; HWND window_; diff --git a/gpu/ipc/service/direct_composition_surface_win.cc b/gpu/ipc/service/direct_composition_surface_win.cc -index da05d806bfa7e8710833eec7a2d85dfaeb9ed37a..761384364cb2544bc984f391b7c433e12fae1c33 100644 +index faf9e3a2ab0c1e11bf25803084dc1c4213143ab8..1e667e04605de6e105bcd485f3c84c444546b044 100644 --- a/gpu/ipc/service/direct_composition_surface_win.cc +++ b/gpu/ipc/service/direct_composition_surface_win.cc -@@ -1573,8 +1573,6 @@ gfx::SwapResult DirectCompositionSurfaceWin::SwapBuffers( +@@ -1674,8 +1674,6 @@ gfx::SwapResult DirectCompositionSurfaceWin::SwapBuffers( gl::GLSurfacePresentationHelper::ScopedSwapBuffers scoped_swap_buffers( presentation_helper_.get(), callback); diff --git a/patches/common/chromium/fix_zoom_display.patch b/patches/common/chromium/fix_zoom_display.patch deleted file mode 100644 index d384fb53e422..000000000000 --- a/patches/common/chromium/fix_zoom_display.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Web Oct 31 00:00:00 2001 -From: Shelley Vohr -Date: Web, 31 Oct 2018 09:08:02 -0700 -Subject: fix_zoom_display.patch - -This patch was released in 70.0.3512.0. - -diff --git a/ui/base/accelerators/platform_accelerator_cocoa.mm b/ui/base/accelerators/platform_accelerator_cocoa.mm -index 9786168be893..3c177060453a 100644 ---- a/ui/base/accelerators/platform_accelerator_cocoa.mm -+++ b/ui/base/accelerators/platform_accelerator_cocoa.mm -@@ -25,9 +25,16 @@ void GetKeyEquivalentAndModifierMaskFromAccelerator( - if (accelerator.IsCmdDown()) - cocoa_modifiers |= NSEventModifierFlagCommand; - unichar shifted_character; -+ unichar character; - int result = ui::MacKeyCodeForWindowsKeyCode( -- accelerator.key_code(), cocoa_modifiers, &shifted_character, nullptr); -- DCHECK(result != -1); -+ accelerator.key_code(), cocoa_modifiers, &shifted_character, &character); -+ DCHECK_NE(result, -1); -+ -+ // If the key equivalent is itself shifted, then drop Shift from the modifier -+ // flags, otherwise Shift will be required. E.g., curly braces and plus are -+ // both inherently shifted, so the key equivalents shouldn't require Shift. -+ if (shifted_character != character) -+ cocoa_modifiers &= ~NSEventModifierFlagShift; - *key_equivalent = [NSString stringWithFormat:@"%C", shifted_character]; - *modifier_mask = cocoa_modifiers; - } diff --git a/patches/common/chromium/frame_host_manager.patch b/patches/common/chromium/frame_host_manager.patch index d2ad29ae7628..732e55429bc5 100644 --- a/patches/common/chromium/frame_host_manager.patch +++ b/patches/common/chromium/frame_host_manager.patch @@ -4,16 +4,16 @@ Date: Wed, 14 Nov 2018 20:38:46 +0530 Subject: frame_host_manager.patch Allows embedder to intercept site instances chosen by chromium -and respond with custom instance. +and respond with custom instance. diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc -index 872e4609c94f1e052d623ae57c1279c72eb2c3f4..39d26adb60c50f88d19e824846519338083dc166 100644 +index 69913022bb1955a22d93acabbdda84e8090de29d..20db3861e67290787fd8c45e5dbeb7507064bdf9 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc -@@ -1960,6 +1960,17 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( - bool was_server_redirect = request.navigation_handle() && - request.navigation_handle()->WasServerRedirect(); - +@@ -1933,6 +1933,16 @@ bool RenderFrameHostManager::InitRenderView( + scoped_refptr + RenderFrameHostManager::GetSiteInstanceForNavigationRequest( + const NavigationRequest& request) { + BrowserContext* browser_context = + delegate_->GetControllerForRenderManager().GetBrowserContext(); + // If the navigation can swap SiteInstances, compute the SiteInstance it @@ -24,12 +24,11 @@ index 872e4609c94f1e052d623ae57c1279c72eb2c3f4..39d26adb60c50f88d19e824846519338 + speculative_render_frame_host_ + ? speculative_render_frame_host_->GetSiteInstance() + : nullptr; -+ - if (frame_tree_node_->IsMainFrame()) { - // Renderer-initiated main frame navigations that may require a - // SiteInstance swap are sent to the browser via the OpenURL IPC and are -@@ -1979,6 +1990,51 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( - request.common_params().url)); + // First, check if the navigation can switch SiteInstances. If not, the + // navigation should use the current SiteInstance. + SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); +@@ -1965,6 +1975,51 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( + request.common_params().url); no_renderer_swap_allowed |= request.from_begin_navigation() && !can_renderer_initiate_transfer; + @@ -80,8 +79,8 @@ index 872e4609c94f1e052d623ae57c1279c72eb2c3f4..39d26adb60c50f88d19e824846519338 } else { // Subframe navigations will use the current renderer, unless specifically // allowed to swap processes. -@@ -1990,23 +2046,17 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( - if (no_renderer_swap_allowed) +@@ -1976,23 +2031,17 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( + if (no_renderer_swap_allowed && !should_swap_for_error_isolation) return scoped_refptr(current_site_instance); - // If the navigation can swap SiteInstances, compute the SiteInstance it @@ -109,10 +108,10 @@ index 872e4609c94f1e052d623ae57c1279c72eb2c3f4..39d26adb60c50f88d19e824846519338 } diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index bb54b89bef5c6f32e7b4a056336c85494e2a04de..f713d0cfbf90665d921f56f4d828887ad1f7842c 100644 +index abfb6afec00a691ea2ff27e7797921e3eb25d8ea..ae4bfc6553f347ad5a7e5327d64155e700e6584e 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -47,6 +47,16 @@ void OverrideOnBindInterface(const service_manager::BindSourceInfo& remote_info, +@@ -49,6 +49,16 @@ void OverrideOnBindInterface(const service_manager::BindSourceInfo& remote_info, handle); } @@ -130,10 +129,10 @@ index bb54b89bef5c6f32e7b4a056336c85494e2a04de..f713d0cfbf90665d921f56f4d828887a const MainFunctionParams& parameters) { return nullptr; diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 3be31602689cb93b965729cc4e35cf6d23a8ec2f..4bf6b2b5f8110f539adc61858cfdc8f77f7ed08b 100644 +index eb2f9a8f240f8805e4bcbde0465ec445dd7539e7..5f6fdb2d66acfa73c895cac18714d0998eed2ab2 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -194,8 +194,37 @@ CONTENT_EXPORT void OverrideOnBindInterface( +@@ -202,8 +202,37 @@ CONTENT_EXPORT void OverrideOnBindInterface( // the observer interfaces.) class CONTENT_EXPORT ContentBrowserClient { public: diff --git a/patches/common/chromium/gin_enable_disable_v8_platform.patch b/patches/common/chromium/gin_enable_disable_v8_platform.patch index b0db722fb61b..605e54ac3404 100644 --- a/patches/common/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/common/chromium/gin_enable_disable_v8_platform.patch @@ -22,10 +22,10 @@ index 4491b392412caac052bf9e41c70a28086ada8a17..8ec7775b78b3645dbac5ee518404ca9a g_reference_table = reference_table; } diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index 6945a60181c420106b1a1defe2a2149b70a80d82..535b0caa02f89f8a0fde841057d35e3834ea087f 100644 +index 8cb2646bdd7dc3f5013d197f4b76e8707afb6817..95844885e478e460b1f03a7d98942bffe263e3d0 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h -@@ -97,7 +97,8 @@ class GIN_EXPORT IsolateHolder { +@@ -98,7 +98,8 @@ class GIN_EXPORT IsolateHolder { static void Initialize(ScriptMode mode, V8ExtrasMode v8_extras_mode, v8::ArrayBuffer::Allocator* allocator, @@ -36,10 +36,10 @@ index 6945a60181c420106b1a1defe2a2149b70a80d82..535b0caa02f89f8a0fde841057d35e38 v8::Isolate* isolate() { return isolate_; } diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc -index cf51b27dd999391e28a3d69c2694d90d61ea214f..50ba87af55fd69dcf0ade1a1736e89ae13b4482f 100644 +index 48116401c0be193261811e14db31844727f980fb..3ae68bdd35f386292de218985a5ab6890fd73c83 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc -@@ -236,12 +236,14 @@ LoadV8FileResult MapOpenedFile(const OpenedFileMap::mapped_type& file_region, +@@ -205,12 +205,14 @@ enum LoadV8FileResult { // static void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, @@ -57,7 +57,7 @@ index cf51b27dd999391e28a3d69c2694d90d61ea214f..50ba87af55fd69dcf0ade1a1736e89ae if (!base::FeatureList::IsEnabled(features::kV8OptimizeJavascript)) { // We avoid explicitly passing --opt if kV8OptimizeJavascript is enabled diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h -index 6f3265ba4d06e70930630432bf739f89847d0b3c..29f28bebbdcde5a7f1c7b31a625d30f1b8079c39 100644 +index a749ccbecfc8b82217d4ed48dcf8a5d9ceba052c..00b21585e65b2fcb2401d28d425f7db2e5dec389 100644 --- a/gin/v8_initializer.h +++ b/gin/v8_initializer.h @@ -21,7 +21,8 @@ class GIN_EXPORT V8Initializer { diff --git a/patches/common/chromium/gritsettings_resource_ids.patch b/patches/common/chromium/gritsettings_resource_ids.patch index 11584abbda43..9aab9357476d 100644 --- a/patches/common/chromium/gritsettings_resource_ids.patch +++ b/patches/common/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids -index 4d9d81bcc3fdd37a7d45fafa4a1fdf85528d6f91..637d6f842d08ec92b9dcddc0722cef8254cd8f87 100644 +index 0d621a15e32b9d354bf21af92f4d4cf8bfdeec67..a6f2e9e76eb82b1b45e3cd8b0662211904dc70ae 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids -@@ -420,6 +420,11 @@ +@@ -424,6 +424,11 @@ "includes": [28900], }, diff --git a/patches/common/chromium/isolate_holder.patch b/patches/common/chromium/isolate_holder.patch index c7ee808f1427..1d9b6273d088 100644 --- a/patches/common/chromium/isolate_holder.patch +++ b/patches/common/chromium/isolate_holder.patch @@ -35,10 +35,10 @@ index 8ec7775b78b3645dbac5ee518404ca9a70122153..c82ca4d00398cb01ffea20b8d8d93732 new PerIsolateData(isolate_, allocator, access_mode_, task_runner)); if (isolate_creation_mode == IsolateCreationMode::kCreateSnapshot) { diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index 535b0caa02f89f8a0fde841057d35e3834ea087f..c68d45722b50654fb92efeea28f5a0d4c9018b49 100644 +index 95844885e478e460b1f03a7d98942bffe263e3d0..fd739ab416b8df71cf192ac178ebf217a5d7816c 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h -@@ -80,7 +80,8 @@ class GIN_EXPORT IsolateHolder { +@@ -81,7 +81,8 @@ class GIN_EXPORT IsolateHolder { AccessMode access_mode, AllowAtomicsWaitMode atomics_wait_mode, IsolateType isolate_type, diff --git a/patches/common/chromium/leveldb_ssize_t.patch b/patches/common/chromium/leveldb_ssize_t.patch deleted file mode 100644 index fe76f1f712b7..000000000000 --- a/patches/common/chromium/leveldb_ssize_t.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jeremy Apthorp -Date: Thu, 20 Sep 2018 17:50:38 -0700 -Subject: leveldb_ssize_t.patch - -Fix conflict between leveldb & node's definition of ssize_t on -Windows by preventing leveldb from re-defining the type if it's -already defined. - -diff --git a/third_party/leveldatabase/port/port_chromium.h b/third_party/leveldatabase/port/port_chromium.h -index a7c449eba19c3e3f46eec9c428fb497f6b1a7852..acbce7efd582e226419054cf80e1c27f4919b2fb 100644 ---- a/third_party/leveldatabase/port/port_chromium.h -+++ b/third_party/leveldatabase/port/port_chromium.h -@@ -26,7 +26,11 @@ - #endif - - #if defined(OS_WIN) -+# if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) - typedef SSIZE_T ssize_t; -+# define _SSIZE_T_ -+# define _SSIZE_T_DEFINED -+# endif - #endif - - namespace leveldb { diff --git a/patches/common/chromium/libgtkui_export.patch b/patches/common/chromium/libgtkui_export.patch index e2a4babb026a..9b5afc876e08 100644 --- a/patches/common/chromium/libgtkui_export.patch +++ b/patches/common/chromium/libgtkui_export.patch @@ -6,7 +6,7 @@ Subject: libgtkui_export.patch Export libgtkui symbols for the GN component build. diff --git a/chrome/browser/ui/libgtkui/gtk_util.h b/chrome/browser/ui/libgtkui/gtk_util.h -index 1efb064df26488d9d893e1e58cb17110c10501f3..f89015361652803962d1b4198848fb24573beae5 100644 +index 32b0a390255dd39a7d02f094c0e59b205b00dabd..afa2d250beca30f50dbb1684d5217330c4d60bbb 100644 --- a/chrome/browser/ui/libgtkui/gtk_util.h +++ b/chrome/browser/ui/libgtkui/gtk_util.h @@ -11,6 +11,7 @@ @@ -17,9 +17,9 @@ index 1efb064df26488d9d893e1e58cb17110c10501f3..f89015361652803962d1b4198848fb24 namespace aura { class Window; -@@ -55,10 +56,10 @@ SkColor NormalURLColor(SkColor foreground); - // saturation than to look exactly like the foreground color. - SkColor SelectedURLColor(SkColor foreground, SkColor background); +@@ -33,10 +34,10 @@ namespace libgtkui { + + extern const color_utils::HSL kDefaultTintFrameIncognito; -void GtkInitFromCommandLine(const base::CommandLine& command_line); +LIBGTKUI_EXPORT void GtkInitFromCommandLine(const base::CommandLine& command_line); @@ -30,16 +30,16 @@ index 1efb064df26488d9d893e1e58cb17110c10501f3..f89015361652803962d1b4198848fb24 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator); -@@ -73,7 +74,7 @@ void TurnButtonBlue(GtkWidget* button); +@@ -51,7 +52,7 @@ void TurnButtonBlue(GtkWidget* button); // Sets |dialog| as transient for |parent|, which will keep it on top and center // it above |parent|. Do nothing if |parent| is nullptr. -void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); +LIBGTKUI_EXPORT void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); - // Parses |button_string| into |leading_buttons| and - // |trailing_buttons|. The string is of the format -@@ -173,7 +174,7 @@ void ApplyCssToContext(GtkStyleContext* context, const std::string& css); + // Gets the transient parent aura window for |dialog|. + aura::Window* GetAuraTransientParent(GtkWidget* dialog); +@@ -157,7 +158,7 @@ void ApplyCssToContext(GtkStyleContext* context, const std::string& css); // Get the 'color' property from the style context created by // GetStyleContextFromCss(|css_selector|). @@ -48,7 +48,7 @@ index 1efb064df26488d9d893e1e58cb17110c10501f3..f89015361652803962d1b4198848fb24 ScopedCssProvider GetCssProvider(const std::string& css); -@@ -186,7 +187,7 @@ void RenderBackground(const gfx::Size& size, +@@ -170,7 +171,7 @@ void RenderBackground(const gfx::Size& size, // Renders a background from the style context created by // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and // returns the average color. diff --git a/patches/common/chromium/mas-audiodeviceduck.patch b/patches/common/chromium/mas-audiodeviceduck.patch index 43158e508f0e..171ad7a2c946 100644 --- a/patches/common/chromium/mas-audiodeviceduck.patch +++ b/patches/common/chromium/mas-audiodeviceduck.patch @@ -6,10 +6,10 @@ Subject: mas-audiodeviceduck.patch Removes usage of the AudioDeviceDuck private API. diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc -index c0579e95374a12c5fd19f8c32c85ef0aab365ea1..5a619362fef5f03b448c5a35b5106f6f50bf8ff5 100644 +index b7bcfa7b01dd5072685aaa1176d6277405742d94..df34137985d36ea2a48b2afe45c3cc253d4aa95b 100644 --- a/media/audio/mac/audio_low_latency_input_mac.cc +++ b/media/audio/mac/audio_low_latency_input_mac.cc -@@ -32,19 +32,23 @@ +@@ -33,19 +33,23 @@ namespace { extern "C" { diff --git a/patches/common/chromium/mas-cgdisplayusesforcetogray.patch b/patches/common/chromium/mas-cgdisplayusesforcetogray.patch index 48e44811aa14..24d71635f77a 100644 --- a/patches/common/chromium/mas-cgdisplayusesforcetogray.patch +++ b/patches/common/chromium/mas-cgdisplayusesforcetogray.patch @@ -6,7 +6,7 @@ Subject: mas-cgdisplayusesforcetogray.patch Removes usage of the CGDisplayUsesForceToGray private API. diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index 99a128511250d594cdac79ebf9b291823db18962..7200a5df74e168b817f7e7598b7fce8b41c6515c 100644 +index ec1fc4edf55d8b5893dece146ddb0d39231f547d..05d8c811b913d88b71017a91eb3f2f993ccadd74 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm @@ -106,7 +106,17 @@ Display BuildDisplayForScreen(NSScreen* screen) { diff --git a/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch b/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch index a9a5df1ab2fc..19abd49b8f7f 100644 --- a/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch +++ b/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch @@ -7,10 +7,10 @@ Removes usage of the _LSSetApplicationLaunchServicesServerConnectionStatus private API. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index f589d015d71e486bad5f9d267b1f779b0b53d28b..2397d722c12d1f57d75d38045b198813d578ea78 100644 +index 8397889b61e20febeee1dd3c0fe8732186e29b28..13e6da203846de6c93ab656b6c9e0399bce24110 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -273,8 +273,10 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -274,8 +274,10 @@ int GpuMain(const MainFunctionParams& parameters) { std::unique_ptr pump(new base::MessagePumpNSRunLoop()); main_message_loop.reset(new base::MessageLoop(std::move(pump))); diff --git a/patches/common/chromium/mas_no_private_api.patch b/patches/common/chromium/mas_no_private_api.patch index c82286cf9ee3..8e008294e983 100644 --- a/patches/common/chromium/mas_no_private_api.patch +++ b/patches/common/chromium/mas_no_private_api.patch @@ -38,7 +38,7 @@ index 44c85b5ad571c39c4580cb9d0cdf08f694c1dfb4..1714c403edf21092e43192f25cf0c19f // is concerned. @property(nonatomic, readonly) NSString* subrole; diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm -index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964bba90d0c 100644 +index ec60dd6b8f2500ac812654817f76cef26636d911..4c8c2cca0a15ad27c655fad98a6c395228d33e4e 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.mm +++ b/content/browser/accessibility/browser_accessibility_cocoa.mm @@ -135,6 +135,7 @@ @@ -85,7 +85,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 {NSAccessibilitySizeAttribute, @"size"}, {NSAccessibilitySortDirectionAttribute, @"sortDirection"}, {NSAccessibilitySubroleAttribute, @"subrole"}, -@@ -1116,6 +1124,7 @@ - (NSNumber*)enabled { +@@ -1117,6 +1125,7 @@ - (NSNumber*)enabled { ax::mojom::Restriction::kDisabled]; } @@ -93,7 +93,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 // Returns a text marker that points to the last character in the document that // can be selected with VoiceOver. - (id)endTextMarker { -@@ -1126,6 +1135,7 @@ - (id)endTextMarker { +@@ -1127,6 +1136,7 @@ - (id)endTextMarker { BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtEndOfAnchor()); } @@ -101,7 +101,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 - (NSNumber*)expanded { if (![self instanceActive]) -@@ -2034,6 +2044,7 @@ - (NSValue*)selectedTextRange { +@@ -2036,6 +2046,7 @@ - (NSValue*)selectedTextRange { return [NSValue valueWithRange:NSMakeRange(selStart, selLength)]; } @@ -109,7 +109,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 - (id)selectedTextMarkerRange { if (![self instanceActive]) return nil; -@@ -2066,6 +2077,7 @@ - (id)selectedTextMarkerRange { +@@ -2068,6 +2079,7 @@ - (id)selectedTextMarkerRange { anchorAffinity, *focusObject, focusOffset, focusAffinity)); } @@ -117,7 +117,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 - (NSValue*)size { if (![self instanceActive]) -@@ -2098,6 +2110,7 @@ - (NSString*)sortDirection { +@@ -2100,6 +2112,7 @@ - (NSString*)sortDirection { return nil; } @@ -125,7 +125,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 // Returns a text marker that points to the first character in the document that // can be selected with VoiceOver. - (id)startTextMarker { -@@ -2108,6 +2121,7 @@ - (id)startTextMarker { +@@ -2110,6 +2123,7 @@ - (id)startTextMarker { BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtStartOfAnchor()); } @@ -133,7 +133,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 // Returns a subrole based upon the role. - (NSString*) subrole { -@@ -2413,12 +2427,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range { +@@ -2418,12 +2432,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range { NSMutableAttributedString* attributedValue = [[[NSMutableAttributedString alloc] initWithString:value] autorelease]; @@ -148,7 +148,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 return [attributedValue attributedSubstringFromRange:range]; } -@@ -2535,6 +2551,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2540,6 +2556,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return nil; } @@ -156,7 +156,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) { BrowserAccessibilityPositionInstance position = CreatePositionFromTextMarker(parameter); -@@ -2712,6 +2729,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2717,6 +2734,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute NSString* text = GetTextForTextMarkerRange(parameter); return [NSNumber numberWithInt:[text length]]; } @@ -164,7 +164,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 if ([attribute isEqualToString: NSAccessibilityBoundsForRangeParameterizedAttribute]) { -@@ -2749,6 +2767,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2754,6 +2772,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return nil; } @@ -172,7 +172,7 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 if ([attribute isEqualToString: NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) { BrowserAccessibilityPositionInstance position = -@@ -2828,6 +2847,7 @@ AXPlatformRange range(position->CreatePreviousLineStartPosition( +@@ -2833,6 +2852,7 @@ AXPlatformRange range(position->CreatePreviousLineStartPosition( return @(child->GetIndexInParent()); } @@ -181,10 +181,10 @@ index 06db282cd7415e21d91f4209a51b96f408475c75..980e2387756ea8e01396b84d95844964 return nil; } diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm -index 09cb7f8a55d1d85abbe88a2bfe76ff4b9c8f253b..18e262218fe657cde910e4b3eee7a8b524b7b5e8 100644 +index ace4792b6861452555e819a2412303e3495c2018..b258a8302e85e8eee04b23106616a825b344e32f 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm -@@ -459,6 +459,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -462,6 +462,7 @@ void PostAnnouncementNotification(NSString* announcement) { [user_info setObject:native_focus_object forKey:NSAccessibilityTextChangeElement]; @@ -192,7 +192,7 @@ index 09cb7f8a55d1d85abbe88a2bfe76ff4b9c8f253b..18e262218fe657cde910e4b3eee7a8b5 id selected_text = [native_focus_object selectedTextMarkerRange]; if (selected_text) { NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute = -@@ -466,6 +467,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -469,6 +470,7 @@ void PostAnnouncementNotification(NSString* announcement) { [user_info setObject:selected_text forKey:NSAccessibilitySelectedTextMarkerRangeAttribute]; } @@ -201,32 +201,31 @@ index 09cb7f8a55d1d85abbe88a2bfe76ff4b9c8f253b..18e262218fe657cde910e4b3eee7a8b5 } diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm -index e2122fb5fe931c911f92e709d1a643cd575972f3..da6847eea755a0b564fcd7daa36c4badc014c7f3 100644 +index b7142c2871faf4a0ba8be79266e9515d81585bdd..3d80c332e9af280a166612f6be54b6f767d729a1 100644 --- a/content/renderer/renderer_main_platform_delegate_mac.mm +++ b/content/renderer/renderer_main_platform_delegate_mac.mm -@@ -23,10 +23,12 @@ +@@ -23,9 +23,11 @@ #include "sandbox/mac/system_services.h" #include "services/service_manager/sandbox/mac/sandbox_mac.h" +#ifndef MAS_BUILD extern "C" { - void CGSSetDenyWindowServerConnections(bool); - void CGSShutdownServerConnections(); + CGError CGSSetDenyWindowServerConnections(bool); }; +#endif namespace content { @@ -35,6 +37,7 @@ - // This disconnects from the window server, and then indicates that Chrome - // should continue execution without access to launchservicesd. - void DisconnectWindowServer() { + // verifies there are no existing open connections), and then indicates that + // Chrome should continue execution without access to launchservicesd. + void DisableSystemServices() { +#ifndef MAS_BUILD - // Now disconnect from WindowServer, after all objects have been warmed up. - // Shutting down the connection requires connecting to WindowServer, - // so do this before actually engaging the sandbox. This may cause two log -@@ -43,6 +46,7 @@ void DisconnectWindowServer() { - CGSShutdownServerConnections(); + // Tell the WindowServer that we don't want to make any future connections. + // This will return Success as long as there are no open connections, which + // is what we want. +@@ -42,6 +45,7 @@ void DisableSystemServices() { + CHECK_EQ(result, kCGErrorSuccess); sandbox::DisableLaunchServices(); +#endif @@ -278,7 +277,7 @@ index 24a63be8a4be4f74f78fec810490d16cffaf43c1..414423de009d14ac6ac7bab2a260b3e0 void BluetoothAdapterMac::RemovePairingDelegateInternal( diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index 6b7eccaf55c1b81a8db03c96f9c4353716fa8eed..7011139d73253a9f6771f0be4e6c8827493a64ea 100644 +index 38e7bb1d7f4ac8ddede73fcb2d64ff3ea25205d7..c1a9026b1fb8610546b682b4d677871482327e63 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn @@ -202,6 +202,12 @@ source_set("audio") { @@ -295,7 +294,7 @@ index 6b7eccaf55c1b81a8db03c96f9c4353716fa8eed..7011139d73253a9f6771f0be4e6c8827 "AudioToolbox.framework", "AudioUnit.framework", diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc -index 74dd21d45b4ff8da203ef7d759bbccf05033f862..d7dd95b4d461981c36061d1031c932fcb6f2e31b 100644 +index 31f593c59087969c3879b1da5a3de1eedcffc3a3..3bc29f5a5560b4436ebe70924bf10354e0b6be99 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc @@ -868,7 +868,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( @@ -308,10 +307,10 @@ index 74dd21d45b4ff8da203ef7d759bbccf05033f862..d7dd95b4d461981c36061d1031c932fc } diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc -index 06e9d7969c0f21726de216cd670e4752c8aff6ab..6fc766e981fdc59fcbb3c0780fde87c5cd953e2d 100644 +index 1b947c5b63564ac87cc3fb5a0d060e41a5407b4a..2bf92efa3c77ac13383dd904ba2a24081deccd04 100644 --- a/net/dns/dns_config_service_posix.cc +++ b/net/dns/dns_config_service_posix.cc -@@ -242,6 +242,7 @@ class DnsConfigServicePosix::Watcher { +@@ -243,6 +243,7 @@ class DnsConfigServicePosix::Watcher { bool Watch() { bool success = true; @@ -319,7 +318,7 @@ index 06e9d7969c0f21726de216cd670e4752c8aff6ab..6fc766e981fdc59fcbb3c0780fde87c5 if (!config_watcher_.Watch(base::Bind(&Watcher::OnConfigChanged, base::Unretained(this)))) { LOG(ERROR) << "DNS config watch failed to start."; -@@ -263,6 +264,7 @@ class DnsConfigServicePosix::Watcher { +@@ -264,6 +265,7 @@ class DnsConfigServicePosix::Watcher { DNS_CONFIG_WATCH_MAX); } #endif // !defined(OS_ANDROID) && !defined(OS_IOS) diff --git a/patches/common/chromium/no_cache_storage_check.patch b/patches/common/chromium/no_cache_storage_check.patch index bc274672ad0c..3f0ce6e8a8d1 100644 --- a/patches/common/chromium/no_cache_storage_check.patch +++ b/patches/common/chromium/no_cache_storage_check.patch @@ -7,15 +7,15 @@ Do not check for unique origin in CacheStorage, in Electron we may have scripts running without an origin. diff --git a/content/browser/cache_storage/cache_storage.cc b/content/browser/cache_storage/cache_storage.cc -index 78508c8b6f1cd0b66f89337a60e3c4daabbe6513..e3f7d339a7c1b75d2d0fecd81b1c238da2233f80 100644 +index 5371daf3c552d4ad506439ba6e37b80a353b1036..bd5a480552fd420d5d15f97a39b08e693edff22d 100644 --- a/content/browser/cache_storage/cache_storage.cc +++ b/content/browser/cache_storage/cache_storage.cc -@@ -132,7 +132,7 @@ class CacheStorage::CacheLoader { +@@ -133,7 +133,7 @@ class CacheStorage::CacheLoader { cache_storage_(cache_storage), origin_(origin), owner_(owner) { -- DCHECK(!origin_.unique()); -+ // DCHECK(!origin_.unique()); +- DCHECK(!origin_.opaque()); ++ // DCHECK(!origin_.opaque()); } virtual ~CacheLoader() {} diff --git a/patches/common/chromium/notification_provenance.patch b/patches/common/chromium/notification_provenance.patch index 06141c6ba9b1..7906f97e367e 100644 --- a/patches/common/chromium/notification_provenance.patch +++ b/patches/common/chromium/notification_provenance.patch @@ -6,10 +6,10 @@ Subject: pass RenderProcessHost through to PlatformNotificationService this is so Electron can identify which renderer a notification came from diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc -index 73c5d6b436e0a842d9e18f65d6174ff1ce736deb..85dc547425bbe7b1e2c4575ff8b10d18989d9ad1 100644 +index 2a4592f1565b99db37e91e090b5478fd1ad6e1a7..8a4144153789f4174763e3b23d47080521b0c20e 100644 --- a/content/browser/notifications/blink_notification_service_impl.cc +++ b/content/browser/notifications/blink_notification_service_impl.cc -@@ -40,9 +40,11 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( +@@ -48,9 +48,11 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( PlatformNotificationContextImpl* notification_context, BrowserContext* browser_context, scoped_refptr service_worker_context, @@ -21,7 +21,7 @@ index 73c5d6b436e0a842d9e18f65d6174ff1ce736deb..85dc547425bbe7b1e2c4575ff8b10d18 browser_context_(browser_context), service_worker_context_(std::move(service_worker_context)), origin_(origin), -@@ -99,7 +101,7 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( +@@ -110,7 +112,7 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( notification_id, std::move(event_listener_ptr)); GetNotificationService()->DisplayNotification( @@ -31,10 +31,10 @@ index 73c5d6b436e0a842d9e18f65d6174ff1ce736deb..85dc547425bbe7b1e2c4575ff8b10d18 } diff --git a/content/browser/notifications/blink_notification_service_impl.h b/content/browser/notifications/blink_notification_service_impl.h -index 193f5d241c314e9921048d592602e5caa362f198..3cfcc6b86ae10102a1cc9e9abb27c529a57511cb 100644 +index 1ae12ca955024b85296449eb33f18af7f7bea37d..6d1df92efe1aec0a51cdb90a7731b187a3433154 100644 --- a/content/browser/notifications/blink_notification_service_impl.h +++ b/content/browser/notifications/blink_notification_service_impl.h -@@ -33,6 +33,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl +@@ -36,6 +36,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl PlatformNotificationContextImpl* notification_context, BrowserContext* browser_context, scoped_refptr service_worker_context, @@ -42,7 +42,7 @@ index 193f5d241c314e9921048d592602e5caa362f198..3cfcc6b86ae10102a1cc9e9abb27c529 const url::Origin& origin, mojo::InterfaceRequest request); ~BlinkNotificationServiceImpl() override; -@@ -94,6 +95,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl +@@ -104,6 +105,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl // The notification context that owns this service instance. PlatformNotificationContextImpl* notification_context_; @@ -51,23 +51,23 @@ index 193f5d241c314e9921048d592602e5caa362f198..3cfcc6b86ae10102a1cc9e9abb27c529 scoped_refptr service_worker_context_; diff --git a/content/browser/notifications/blink_notification_service_impl_unittest.cc b/content/browser/notifications/blink_notification_service_impl_unittest.cc -index 618c7bd88cde563eaaf93914039b5fb6d81db514..be08e89b5c6d57abf6b61ed9ee4b1c536a6ca134 100644 +index 9985cfee820e4bb536813e39ebdca9b45574d6cf..e0636fde3c97bb4fce19b6042344cb432d96427c 100644 --- a/content/browser/notifications/blink_notification_service_impl_unittest.cc +++ b/content/browser/notifications/blink_notification_service_impl_unittest.cc -@@ -113,7 +113,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test { - blink::mojom::NotificationServicePtr notification_service_ptr; +@@ -126,7 +126,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test { + notification_service_ = std::make_unique( notification_context_.get(), &browser_context_, - embedded_worker_helper_->context_wrapper(), + embedded_worker_helper_->context_wrapper(), nullptr, url::Origin::Create(GURL(kTestOrigin)), - mojo::MakeRequest(¬ification_service_ptr)); + mojo::MakeRequest(¬ification_service_ptr_)); diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc -index 13ece81608b6eddd3350c8aef870aa71abd4c7c8..0d7f7731609d690f30da205ff267a0728d00e778 100644 +index 9b31e66db71ad167d593dd037bcecf4151b1452e..d01fe86c8f1ad8c9610b4b66f7b2b14bd819e359 100644 --- a/content/browser/notifications/platform_notification_context_impl.cc +++ b/content/browser/notifications/platform_notification_context_impl.cc -@@ -126,12 +126,13 @@ void PlatformNotificationContextImpl::ShutdownOnIO() { +@@ -127,12 +127,13 @@ void PlatformNotificationContextImpl::ShutdownOnIO() { } void PlatformNotificationContextImpl::CreateService( @@ -106,10 +106,10 @@ index 653f487b0b0e01de7cdda8483f081550a9077e98..da9e5f53d07eaaf11525efd996be9420 // Removes |service| from the list of owned services, for example because the diff --git a/content/browser/renderer_interface_binders.cc b/content/browser/renderer_interface_binders.cc -index c3a8bdc572de68e824756f71b1386f2b2058bc01..2a340aa0f629f581ec400c89bea7e706fd73d79b 100644 +index 5a6e7ed16110e5d34d5e4f6e37f59ff84094a994..63af4bd1d17aca55229960422082643f2926d705 100644 --- a/content/browser/renderer_interface_binders.cc +++ b/content/browser/renderer_interface_binders.cc -@@ -168,7 +168,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { +@@ -176,7 +176,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { RenderProcessHost* host, const url::Origin& origin) { static_cast(host->GetStoragePartition()) ->GetPlatformNotificationContext() @@ -119,18 +119,18 @@ index c3a8bdc572de68e824756f71b1386f2b2058bc01..2a340aa0f629f581ec400c89bea7e706 parameterized_binder_registry_.AddInterface( base::BindRepeating(&BackgroundFetchServiceImpl::CreateForWorker)); diff --git a/content/public/browser/platform_notification_service.h b/content/public/browser/platform_notification_service.h -index 0e9ce4383087415d8cd77e5b5e196492845a93cc..672df69c849b0ecbe46a08e9d8b0b34b375d5588 100644 +index 80ffd8d426c2380d57172a951a8cd15a0393bf88..0cf9ee3a44647f44bcd89351931c162370ebfe29 100644 --- a/content/public/browser/platform_notification_service.h +++ b/content/public/browser/platform_notification_service.h -@@ -22,6 +22,7 @@ class GURL; +@@ -27,6 +27,7 @@ struct PlatformNotificationData; namespace content { class BrowserContext; +class RenderProcessHost; - struct NotificationResources; - struct PlatformNotificationData; -@@ -39,6 +40,7 @@ class CONTENT_EXPORT PlatformNotificationService { + // The service using which notifications can be presented to the user. There + // should be a unique instance of the PlatformNotificationService depending +@@ -42,6 +43,7 @@ class CONTENT_EXPORT PlatformNotificationService { // Displays the notification described in |notification_data| to the user. // This method must be called on the UI thread. virtual void DisplayNotification( @@ -139,10 +139,10 @@ index 0e9ce4383087415d8cd77e5b5e196492845a93cc..672df69c849b0ecbe46a08e9d8b0b34b const std::string& notification_id, const GURL& origin, diff --git a/content/test/mock_platform_notification_service.cc b/content/test/mock_platform_notification_service.cc -index b345a7442d2c64b814548dbfaf88d944a434122e..93b6962c5cac6fd915fbfbc7566fa77d836b45c5 100644 +index 0246db2c6d249843867d26d7ae6eb77f781e30a8..bc232b2684652e0febef9f3fe2f5e5e97719f06b 100644 --- a/content/test/mock_platform_notification_service.cc +++ b/content/test/mock_platform_notification_service.cc -@@ -20,6 +20,7 @@ MockPlatformNotificationService::MockPlatformNotificationService() = default; +@@ -22,6 +22,7 @@ MockPlatformNotificationService::MockPlatformNotificationService() = default; MockPlatformNotificationService::~MockPlatformNotificationService() = default; void MockPlatformNotificationService::DisplayNotification( @@ -151,10 +151,10 @@ index b345a7442d2c64b814548dbfaf88d944a434122e..93b6962c5cac6fd915fbfbc7566fa77d const std::string& notification_id, const GURL& origin, diff --git a/content/test/mock_platform_notification_service.h b/content/test/mock_platform_notification_service.h -index 8741d95ee8b01ff2fe0448d77f1c4fa8fa476376..d7f5fc10a654e87d17e383ae68bfb10740337468 100644 +index 1d38db3e3d141b32b237c0f4ebe6abc80751225c..4f6dcf2c72493b1c29751ec5f7b16bf96946f4a5 100644 --- a/content/test/mock_platform_notification_service.h +++ b/content/test/mock_platform_notification_service.h -@@ -43,6 +43,7 @@ class MockPlatformNotificationService : public PlatformNotificationService { +@@ -45,6 +45,7 @@ class MockPlatformNotificationService : public PlatformNotificationService { // PlatformNotificationService implementation. void DisplayNotification( diff --git a/patches/common/chromium/out_of_process_instance.patch b/patches/common/chromium/out_of_process_instance.patch index 70c99ecf5651..a9ef675dcac1 100644 --- a/patches/common/chromium/out_of_process_instance.patch +++ b/patches/common/chromium/out_of_process_instance.patch @@ -5,10 +5,10 @@ Subject: out_of_process_instance.patch diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc -index 0358d15fb45bb57111ee2af0f791cd99f6f27f70..101763db35d129097bda50af1bfa9f6fb54b2228 100644 +index 788082cd637aaf75f6ecc0a7d10977939f2b3e18..1a831ae135084f8cd04c2df62288300070585959 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc -@@ -455,7 +455,9 @@ bool OutOfProcessInstance::Init(uint32_t argc, +@@ -468,7 +468,9 @@ bool OutOfProcessInstance::Init(uint32_t argc, std::string document_url = document_url_var.AsString(); base::StringPiece document_url_piece(document_url); is_print_preview_ = IsPrintPreviewUrl(document_url_piece); diff --git a/patches/common/chromium/pepper_flash.patch b/patches/common/chromium/pepper_flash.patch index 525499ac23d8..c276d7b044d1 100644 --- a/patches/common/chromium/pepper_flash.patch +++ b/patches/common/chromium/pepper_flash.patch @@ -28,13 +28,13 @@ index 735da93c3cabb8c6139971295740ba14a30d1b69..533f53fbc42397608e3762e370cc935c // Non-owning pointer to the filter must outlive this class. explicit ChromeBrowserPepperHostFactory(content::BrowserPpapiHost* host); diff --git a/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc -index f4f1741a8ecfdb570e3fe77d39146329c0677c13..103238cdd53f8f103de55e199162979c6ace948c 100644 +index 83cedb4c9e1323259afd041e571240cd971e1241..3686ae2fab5f400cf119a54aea547a72655c2b0a 100644 --- a/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc +++ b/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc -@@ -6,10 +6,12 @@ - +@@ -7,10 +7,12 @@ #include + #include "base/task/post_task.h" +#if 0 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/profile.h" @@ -42,9 +42,9 @@ index f4f1741a8ecfdb570e3fe77d39146329c0677c13..103238cdd53f8f103de55e199162979c #include "components/content_settings/core/common/content_settings.h" +#endif #include "content/public/browser/browser_ppapi_host.h" + #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" - #include "content/public/browser/render_process_host.h" -@@ -57,6 +59,7 @@ int32_t PepperBrokerMessageFilter::OnIsAllowed( +@@ -59,6 +61,7 @@ int32_t PepperBrokerMessageFilter::OnIsAllowed( RenderProcessHost::FromID(render_process_id_); if (!render_process_host) return PP_ERROR_FAILED; @@ -52,7 +52,7 @@ index f4f1741a8ecfdb570e3fe77d39146329c0677c13..103238cdd53f8f103de55e199162979c Profile* profile = Profile::FromBrowserContext(render_process_host->GetBrowserContext()); HostContentSettingsMap* content_settings = -@@ -68,5 +71,6 @@ int32_t PepperBrokerMessageFilter::OnIsAllowed( +@@ -70,5 +73,6 @@ int32_t PepperBrokerMessageFilter::OnIsAllowed( std::string()); if (setting == CONTENT_SETTING_ALLOW) return PP_OK; @@ -61,11 +61,11 @@ index f4f1741a8ecfdb570e3fe77d39146329c0677c13..103238cdd53f8f103de55e199162979c + return PP_OK; } diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc b/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc -index 1c1844a9eb71fe0d75cf8e3cef833fa5ffb13608..2c9834b11d34f6311f445c3ef8b62b907ab695c0 100644 +index 1ecf64b2068a9c4a234c3ef075a5b22dfc61669a..fa58a62346de7e57f6473ebce23d771509ccccee 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc -@@ -6,9 +6,11 @@ - +@@ -7,9 +7,11 @@ + #include "base/task/post_task.h" #include "base/time/time.h" #include "build/build_config.h" +#if 0 @@ -75,8 +75,8 @@ index 1c1844a9eb71fe0d75cf8e3cef833fa5ffb13608..2c9834b11d34f6311f445c3ef8b62b90 +#endif #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_ppapi_host.h" - #include "content/public/browser/browser_thread.h" -@@ -40,6 +42,7 @@ using content::ServiceManagerConnection; + #include "content/public/browser/browser_task_traits.h" +@@ -42,6 +44,7 @@ using content::ServiceManagerConnection; namespace { @@ -84,7 +84,7 @@ index 1c1844a9eb71fe0d75cf8e3cef833fa5ffb13608..2c9834b11d34f6311f445c3ef8b62b90 // Get the CookieSettings on the UI thread for the given render process ID. scoped_refptr GetCookieSettings( int render_process_id) { -@@ -53,6 +56,7 @@ scoped_refptr GetCookieSettings( +@@ -55,6 +58,7 @@ scoped_refptr GetCookieSettings( } return NULL; } @@ -92,7 +92,7 @@ index 1c1844a9eb71fe0d75cf8e3cef833fa5ffb13608..2c9834b11d34f6311f445c3ef8b62b90 void PepperBindConnectorRequest( service_manager::mojom::ConnectorRequest connector_request) { -@@ -70,7 +74,9 @@ PepperFlashBrowserHost::PepperFlashBrowserHost(BrowserPpapiHost* host, +@@ -72,7 +76,9 @@ PepperFlashBrowserHost::PepperFlashBrowserHost(BrowserPpapiHost* host, PP_Instance instance, PP_Resource resource) : ResourceHost(host->GetPpapiHost(), instance, resource), @@ -102,7 +102,7 @@ index 1c1844a9eb71fe0d75cf8e3cef833fa5ffb13608..2c9834b11d34f6311f445c3ef8b62b90 delay_timer_(FROM_HERE, base::TimeDelta::FromSeconds(45), this, &PepperFlashBrowserHost::OnDelayTimerFired), weak_factory_(this) { -@@ -122,6 +128,7 @@ int32_t PepperFlashBrowserHost::OnGetLocalTimeZoneOffset( +@@ -124,6 +130,7 @@ int32_t PepperFlashBrowserHost::OnGetLocalTimeZoneOffset( int32_t PepperFlashBrowserHost::OnGetLocalDataRestrictions( ppapi::host::HostMessageContext* context) { @@ -111,7 +111,7 @@ index 1c1844a9eb71fe0d75cf8e3cef833fa5ffb13608..2c9834b11d34f6311f445c3ef8b62b90 // belong to the profile which lives on the UI thread. We lazily initialize // |cookie_settings_| by grabbing the reference from the UI thread and then @@ -144,9 +151,11 @@ int32_t PepperFlashBrowserHost::OnGetLocalDataRestrictions( - document_url, + context->MakeReplyMessageContext(), document_url, plugin_url)); } - return PP_OK_COMPLETIONPENDING; @@ -179,10 +179,10 @@ index 154120ce5156d77dd302b85cb17e2f14fb69cc2d..5152fd847c012fc2f40017687db426fa DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHost); diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc -index e267746783bde72ff4f9d8a4ec706c25a039432f..bc84b44ceb276b57700be1300d5e860f482c4d20 100644 +index 1644f1233e2ae3142f7c9b450b0af97ae7325abc..bac25204c3afa7b87ed9e2861f96b5168b3e8aa6 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc -@@ -18,6 +18,7 @@ +@@ -20,6 +20,7 @@ #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_frame_host.h" #include "content/public/common/pepper_plugin_info.h" @@ -190,7 +190,7 @@ index e267746783bde72ff4f9d8a4ec706c25a039432f..bc84b44ceb276b57700be1300d5e860f #include "ppapi/c/pp_errors.h" #include "ppapi/host/dispatch_host_message.h" #include "ppapi/host/host_message_context.h" -@@ -127,7 +128,9 @@ PepperFlashDRMHost::PepperFlashDRMHost(BrowserPpapiHost* host, +@@ -128,7 +129,9 @@ PepperFlashDRMHost::PepperFlashDRMHost(BrowserPpapiHost* host, content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( render_process_id, voucher_file); @@ -200,7 +200,7 @@ index e267746783bde72ff4f9d8a4ec706c25a039432f..bc84b44ceb276b57700be1300d5e860f monitor_finder_ = new MonitorFinder(render_process_id, render_frame_id); monitor_finder_->GetMonitor(); } -@@ -150,12 +153,18 @@ int32_t PepperFlashDRMHost::OnResourceMessageReceived( +@@ -151,12 +154,18 @@ int32_t PepperFlashDRMHost::OnResourceMessageReceived( int32_t PepperFlashDRMHost::OnHostMsgGetDeviceID( ppapi::host::HostMessageContext* context) { @@ -220,7 +220,7 @@ index e267746783bde72ff4f9d8a4ec706c25a039432f..bc84b44ceb276b57700be1300d5e860f } int32_t PepperFlashDRMHost::OnHostMsgGetHmonitor( -@@ -184,6 +193,7 @@ int32_t PepperFlashDRMHost::OnHostMsgMonitorIsExternal( +@@ -185,6 +194,7 @@ int32_t PepperFlashDRMHost::OnHostMsgMonitorIsExternal( return PP_OK; } @@ -228,7 +228,7 @@ index e267746783bde72ff4f9d8a4ec706c25a039432f..bc84b44ceb276b57700be1300d5e860f void PepperFlashDRMHost::GotDeviceID( ppapi::host::ReplyMessageContext reply_context, const std::string& id, -@@ -196,3 +206,4 @@ void PepperFlashDRMHost::GotDeviceID( +@@ -197,3 +207,4 @@ void PepperFlashDRMHost::GotDeviceID( host()->SendReply(reply_context, PpapiPluginMsg_FlashDRM_GetDeviceIDReply(id)); } @@ -258,13 +258,13 @@ index aa4433cccff4bc637ce5e71039de3c4352e7cd6b..d9630fdf6b87e11fb9657814895dff36 base::WeakPtrFactory weak_factory_; diff --git a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc -index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6d0478394 100644 +index d266f41233ff676539438d7cdd3799d83129e242..1cd381fd576fedd4ee382b33282ecd991d1f9ea7 100644 --- a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc +++ b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc -@@ -7,16 +7,20 @@ - #include +@@ -8,17 +8,21 @@ #include "base/macros.h" + #include "base/task/post_task.h" +#if 0 #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" @@ -273,6 +273,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 #include "chrome/common/pepper_permission_util.h" +#endif #include "content/public/browser/browser_ppapi_host.h" + #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_view_host.h" @@ -282,7 +283,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 #include "ppapi/c/pp_errors.h" #include "ppapi/host/dispatch_host_message.h" #include "ppapi/host/host_message_context.h" -@@ -25,12 +29,11 @@ +@@ -27,12 +31,11 @@ #include "ppapi/shared_impl/file_system_util.h" #include "storage/browser/fileapi/isolated_context.h" @@ -296,7 +297,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 namespace { -@@ -40,6 +43,7 @@ const char* kPredefinedAllowedCrxFsOrigins[] = { +@@ -42,6 +45,7 @@ const char* kPredefinedAllowedCrxFsOrigins[] = { }; } // namespace @@ -304,7 +305,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 // static PepperIsolatedFileSystemMessageFilter* -@@ -67,8 +71,10 @@ PepperIsolatedFileSystemMessageFilter::PepperIsolatedFileSystemMessageFilter( +@@ -69,8 +73,10 @@ PepperIsolatedFileSystemMessageFilter::PepperIsolatedFileSystemMessageFilter( profile_directory_(profile_directory), document_url_(document_url), ppapi_host_(ppapi_host) { @@ -315,7 +316,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 } PepperIsolatedFileSystemMessageFilter:: -@@ -94,6 +100,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnResourceMessageReceived( +@@ -96,6 +102,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnResourceMessageReceived( return PP_ERROR_FAILED; } @@ -323,7 +324,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); ProfileManager* profile_manager = g_browser_process->profile_manager(); -@@ -120,6 +127,7 @@ std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem( +@@ -122,6 +129,7 @@ std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem( return std::string(); #endif } @@ -331,7 +332,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( ppapi::host::HostMessageContext* context, -@@ -128,7 +136,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( +@@ -130,7 +138,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID: break; case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX: @@ -340,7 +341,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE: return OpenPluginPrivateFileSystem(context); } -@@ -138,6 +146,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( +@@ -140,6 +148,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( return PP_ERROR_FAILED; } @@ -348,7 +349,7 @@ index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6 int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem( ppapi::host::HostMessageContext* context) { #if BUILDFLAG(ENABLE_EXTENSIONS) -@@ -176,6 +185,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem( +@@ -178,6 +187,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem( return PP_ERROR_NOTSUPPORTED; #endif } diff --git a/patches/common/chromium/printing.patch b/patches/common/chromium/printing.patch index 964fdfda16a3..08f5db620460 100644 --- a/patches/common/chromium/printing.patch +++ b/patches/common/chromium/printing.patch @@ -9,20 +9,25 @@ majority of changes originally come from these PRs: * https://github.com/electron/electron/pull/8596 diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc -index 1065e808e621c087bde9320abe019f05292f977c..6cf33877d21a6bf06532f7f9d79804c744f1ad83 100644 +index 1e2d43fb562522f7ebe50a8acc47645495f02436..1a04e1fff488dfde1cf8089ac9ba1b5acc646803 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc -@@ -20,7 +20,7 @@ +@@ -21,12 +21,12 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/printing/print_job.h" -#include "chrome/grit/generated_resources.h" -+#include "electron/grit/electron_resources.h" + #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_frame_host.h" + #include "content/public/browser/web_contents.h" ++#include "electron/grit/electron_resources.h" + #include "printing/print_job_constants.h" + #include "printing/printed_document.h" + #include "printing/printing_utils.h" diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc -index 169bfefa0e442ddc0aa51ac4e98b48fc24d8a805..12cede4509e88c12daf3a53ae40204f945b9172f 100644 +index 620c8907653c5757c7ab88d7f1c599a876800313..1ed8551cd851f04b59a0d517a8b0f15bad85a33d 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -27,10 +27,7 @@ @@ -61,7 +66,7 @@ index 169bfefa0e442ddc0aa51ac4e98b48fc24d8a805..12cede4509e88c12daf3a53ae40204f9 } #if BUILDFLAG(ENABLE_PRINT_PREVIEW) -@@ -111,12 +112,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) +@@ -110,12 +111,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) queue_(g_browser_process->print_job_manager()->queue()), weak_ptr_factory_(this) { DCHECK(queue_); @@ -76,7 +81,7 @@ index 169bfefa0e442ddc0aa51ac4e98b48fc24d8a805..12cede4509e88c12daf3a53ae40204f9 } PrintViewManagerBase::~PrintViewManagerBase() { -@@ -124,12 +127,14 @@ PrintViewManagerBase::~PrintViewManagerBase() { +@@ -123,12 +126,14 @@ PrintViewManagerBase::~PrintViewManagerBase() { DisconnectFromCurrentPrintJob(); } @@ -94,7 +99,7 @@ index 169bfefa0e442ddc0aa51ac4e98b48fc24d8a805..12cede4509e88c12daf3a53ae40204f9 } #if BUILDFLAG(ENABLE_PRINT_PREVIEW) -@@ -245,9 +250,9 @@ void PrintViewManagerBase::StartLocalPrintJob( +@@ -244,9 +249,9 @@ void PrintViewManagerBase::StartLocalPrintJob( void PrintViewManagerBase::UpdatePrintingEnabled() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // The Unretained() is safe because ForEachFrame() is synchronous. @@ -107,7 +112,7 @@ index 169bfefa0e442ddc0aa51ac4e98b48fc24d8a805..12cede4509e88c12daf3a53ae40204f9 } void PrintViewManagerBase::NavigationStopped() { -@@ -339,7 +344,7 @@ void PrintViewManagerBase::OnPrintingFailed(int cookie) { +@@ -338,7 +343,7 @@ void PrintViewManagerBase::OnPrintingFailed(int cookie) { PrintManager::OnPrintingFailed(cookie); #if BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -116,7 +121,7 @@ index 169bfefa0e442ddc0aa51ac4e98b48fc24d8a805..12cede4509e88c12daf3a53ae40204f9 #endif ReleasePrinterQuery(); -@@ -587,6 +592,9 @@ void PrintViewManagerBase::ReleasePrintJob() { +@@ -586,6 +591,9 @@ void PrintViewManagerBase::ReleasePrintJob() { content::RenderFrameHost* rfh = printing_rfh_; printing_rfh_ = nullptr; @@ -127,7 +132,7 @@ index 169bfefa0e442ddc0aa51ac4e98b48fc24d8a805..12cede4509e88c12daf3a53ae40204f9 return; diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h -index 542d061efc80b536867ff51cb5f211d15a6ea199..be27c20f2fe8d1e666e9a35b3835a62b8234a2c5 100644 +index fa8d5a178aee2399c05d4f31b42edbc563883355..a6d1430c74e6d52abf3ceaf95678fef0135f566a 100644 --- a/chrome/browser/printing/print_view_manager_base.h +++ b/chrome/browser/printing/print_view_manager_base.h @@ -39,6 +39,8 @@ class PrintJob; @@ -150,7 +155,7 @@ index 542d061efc80b536867ff51cb5f211d15a6ea199..be27c20f2fe8d1e666e9a35b3835a62b #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Prints the document in |print_data| with settings specified in -@@ -196,6 +200,9 @@ class PrintViewManagerBase : public content::NotificationObserver, +@@ -198,6 +202,9 @@ class PrintViewManagerBase : public content::NotificationObserver, // The current RFH that is printing with a system printing dialog. content::RenderFrameHost* printing_rfh_; @@ -161,18 +166,18 @@ index 542d061efc80b536867ff51cb5f211d15a6ea199..be27c20f2fe8d1e666e9a35b3835a62b bool printing_succeeded_; diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc -index 67079421bf44c832fdc98c8d2c75875e95e0a81c..1896a57f3228e724d9817b25bfd3bd3b94bc10c0 100644 +index b21042ead358362267d81dc0c5a76ab35dccd9b8..2db39f368950b73a8df9dc7127b7d3d93d9a7dd0 100644 --- a/chrome/browser/printing/printing_message_filter.cc +++ b/chrome/browser/printing/printing_message_filter.cc -@@ -20,6 +20,7 @@ - #include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h" +@@ -22,6 +22,7 @@ #include "components/printing/browser/print_manager_utils.h" #include "components/printing/common/print_messages.h" + #include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/child_process_host.h" -@@ -94,20 +95,23 @@ PrintViewManager* GetPrintViewManager(int render_process_id, +@@ -96,20 +97,23 @@ PrintViewManager* GetPrintViewManager(int render_process_id, } // namespace @@ -194,12 +199,12 @@ index 67079421bf44c832fdc98c8d2c75875e95e0a81c..1896a57f3228e724d9817b25bfd3bd3b +#if 0 is_printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs()); is_printing_enabled_.MoveToThread( - BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); + base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})); +#endif } PrintingMessageFilter::~PrintingMessageFilter() { -@@ -188,11 +192,13 @@ void PrintingMessageFilter::OnTempFileForPrintingWritten(int render_frame_id, +@@ -190,11 +194,13 @@ void PrintingMessageFilter::OnTempFileForPrintingWritten(int render_frame_id, void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { DCHECK_CURRENTLY_ON(BrowserThread::IO); scoped_refptr printer_query; @@ -213,7 +218,7 @@ index 67079421bf44c832fdc98c8d2c75875e95e0a81c..1896a57f3228e724d9817b25bfd3bd3b printer_query = queue_->PopPrinterQuery(0); if (!printer_query.get()) { printer_query = -@@ -301,11 +307,13 @@ void PrintingMessageFilter::OnUpdatePrintSettings( +@@ -303,11 +309,13 @@ void PrintingMessageFilter::OnUpdatePrintSettings( std::unique_ptr new_settings(job_settings.DeepCopy()); scoped_refptr printer_query; @@ -227,7 +232,7 @@ index 67079421bf44c832fdc98c8d2c75875e95e0a81c..1896a57f3228e724d9817b25bfd3bd3b printer_query = queue_->PopPrinterQuery(document_cookie); if (!printer_query.get()) { printer_query = queue_->CreatePrinterQuery( -@@ -364,7 +372,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply( +@@ -366,7 +374,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply( #if BUILDFLAG(ENABLE_PRINT_PREVIEW) void PrintingMessageFilter::OnCheckForCancel(const PrintHostMsg_PreviewIds& ids, bool* cancel) { @@ -262,10 +267,10 @@ index a881a853bfb0b46d0e074b7e86121429a5a761a3..0b41890bb9b5f10765c12158f6e8b7d3 // content::BrowserMessageFilter methods. void OverrideThreadForMessage(const IPC::Message& message, diff --git a/components/printing/common/print_messages.h b/components/printing/common/print_messages.h -index e3c11e1302ff0d1a9cca4cb575a6c8bccfde243d..97dcb7f84ccc8bf367c1a5ee4eb59d945d1c03ba 100644 +index 7dd892feb181293d3c52fb6a3fd9600c899ee2d3..1ca51744e1046e5dfbedf5af8c6f75358e84acb7 100644 --- a/components/printing/common/print_messages.h +++ b/components/printing/common/print_messages.h -@@ -363,7 +363,10 @@ IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu) +@@ -368,7 +368,10 @@ IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu) #if BUILDFLAG(ENABLE_PRINTING) // Tells the RenderFrame to switch the CSS to print media type, renders every // requested pages and switch back the CSS to display media type. @@ -278,10 +283,10 @@ index e3c11e1302ff0d1a9cca4cb575a6c8bccfde243d..97dcb7f84ccc8bf367c1a5ee4eb59d94 // Like PrintMsg_PrintPages, but using the print preview document's frame/node. IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog) diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef2d6da400 100644 +index c888622c024fe3629705d136def7f8ef4cdc0cbf..d238b12d8409de01a7208c6bf404fc08f762f9be 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc -@@ -1030,7 +1030,9 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1045,7 +1045,9 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { web_frame->DispatchBeforePrintEvent(); if (!weak_this) return; @@ -292,7 +297,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef if (weak_this) web_frame->DispatchAfterPrintEvent(); } -@@ -1078,7 +1080,10 @@ void PrintRenderFrameHelper::OnDestruct() { +@@ -1093,7 +1095,10 @@ void PrintRenderFrameHelper::OnDestruct() { delete this; } @@ -304,7 +309,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef if (ipc_nesting_level_ > 1) return; -@@ -1091,7 +1096,8 @@ void PrintRenderFrameHelper::OnPrintPages() { +@@ -1106,7 +1111,8 @@ void PrintRenderFrameHelper::OnPrintPages() { // If we are printing a PDF extension frame, find the plugin node and print // that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -314,7 +319,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef if (weak_this) frame->DispatchAfterPrintEvent(); // WARNING: |this| may be gone at this point. Do not do any more work here and -@@ -1107,7 +1113,8 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() { +@@ -1122,7 +1128,8 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() { return; } auto weak_this = weak_ptr_factory_.GetWeakPtr(); @@ -324,7 +329,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef if (weak_this) frame->DispatchAfterPrintEvent(); // WARNING: |this| may be gone at this point. Do not do any more work here and -@@ -1143,6 +1150,8 @@ void PrintRenderFrameHelper::OnPrintPreview( +@@ -1158,6 +1165,8 @@ void PrintRenderFrameHelper::OnPrintPreview( if (ipc_nesting_level_ > 1) return; @@ -333,7 +338,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef print_preview_context_.OnPrintPreview(); UMA_HISTOGRAM_ENUMERATION("PrintPreview.PreviewEvent", -@@ -1525,7 +1534,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -1543,7 +1552,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { auto self = weak_ptr_factory_.GetWeakPtr(); Print(duplicate_node.GetDocument().GetFrame(), duplicate_node, @@ -344,7 +349,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef // Check if |this| is still valid. if (!self) return; -@@ -1536,7 +1547,10 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -1554,7 +1565,10 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, @@ -356,7 +361,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef // If still not finished with earlier print request simply ignore. if (prep_frame_view_) return; -@@ -1544,7 +1558,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -1562,7 +1576,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, FrameReference frame_ref(frame); int expected_page_count = 0; @@ -365,7 +370,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef DidFinishPrinting(FAIL_PRINT_INIT); return; // Failed to init print page settings. } -@@ -1564,8 +1578,9 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -1582,8 +1596,9 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, PrintMsg_PrintPages_Params print_settings; auto self = weak_ptr_factory_.GetWeakPtr(); @@ -377,7 +382,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef // Check if |this| is still valid. if (!self) return; -@@ -1575,6 +1590,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -1593,6 +1608,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, ? blink::kWebPrintScalingOptionSourceSize : scaling_option; SetPrintPagesParams(print_settings); @@ -385,7 +390,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef if (print_settings.params.dpi.IsEmpty() || !print_settings.params.document_cookie) { DidFinishPrinting(OK); // Release resources and fail silently on failure. -@@ -1762,10 +1778,24 @@ std::vector PrintRenderFrameHelper::GetPrintedPages( +@@ -1781,10 +1797,24 @@ std::vector PrintRenderFrameHelper::GetPrintedPages( return printed_pages; } @@ -413,7 +418,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef // Check if the printer returned any settings, if the settings is empty, we // can safely assume there are no printer drivers configured. So we safely // terminate. -@@ -1785,12 +1815,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) { +@@ -1804,12 +1834,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) { return result; } @@ -433,7 +438,7 @@ index 86a68c361f06bf26d980ee8730f7d759982dfffa..b67affdf12f45d190777b1ad16d33cef Send(new PrintHostMsg_ShowInvalidPrinterSettingsError(routing_id())); return false; diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h -index d09db4d500ca3cfa9716114e679bcf428c76c085..a0436373990dafa38c226160d967687b21c021e7 100644 +index ff6423d51151ce84c291ed31a8e99c1c6effcd4f..e4d3b382877318775554f1ffaf8885de1c21aade 100644 --- a/components/printing/renderer/print_render_frame_helper.h +++ b/components/printing/renderer/print_render_frame_helper.h @@ -187,7 +187,9 @@ class PrintRenderFrameHelper diff --git a/patches/common/chromium/proxy_config_monitor.patch b/patches/common/chromium/proxy_config_monitor.patch index d32c49301f31..095d4bfec9ec 100644 --- a/patches/common/chromium/proxy_config_monitor.patch +++ b/patches/common/chromium/proxy_config_monitor.patch @@ -6,16 +6,12 @@ Subject: proxy_config_monitor.patch Allow monitoring proxy config changes for a pref service. diff --git a/chrome/browser/net/proxy_config_monitor.cc b/chrome/browser/net/proxy_config_monitor.cc -index 90a8b0895f10d59ade41cf156e3887c526123b29..26c1bc0e5859e832d03be7215d067312e2d691c0 100644 +index 2d08d23e04008415f04b4d45d46c0aa6ed4dfee8..6207b646b0041628653532b014500e9990cc5e78 100644 --- a/chrome/browser/net/proxy_config_monitor.cc +++ b/chrome/browser/net/proxy_config_monitor.cc -@@ -5,9 +5,13 @@ - #include "chrome/browser/net/proxy_config_monitor.h" - +@@ -8,7 +8,9 @@ #include "build/build_config.h" -+#if 0 #include "chrome/browser/browser_process.h" -+#endif #include "chrome/browser/net/proxy_service_factory.h" +#if 0 #include "chrome/browser/profiles/profile.h" @@ -23,47 +19,60 @@ index 90a8b0895f10d59ade41cf156e3887c526123b29..26c1bc0e5859e832d03be7215d067312 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" #include "content/public/browser/browser_thread.h" #include "mojo/public/cpp/bindings/associated_interface_ptr.h" -@@ -15,7 +19,7 @@ - #if defined(OS_CHROMEOS) +@@ -17,12 +19,13 @@ #include "chrome/browser/chromeos/profiles/profile_helper.h" #endif // defined(OS_CHROMEOS) -- + +-#if BUILDFLAG(ENABLE_EXTENSIONS) ++#if 0 + #include "chrome/browser/extensions/api/proxy/proxy_api.h" + #endif + + using content::BrowserThread; + +#if 0 ProxyConfigMonitor::ProxyConfigMonitor(Profile* profile) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(profile); -@@ -41,14 +45,13 @@ ProxyConfigMonitor::ProxyConfigMonitor(Profile* profile) { +@@ -52,6 +55,7 @@ ProxyConfigMonitor::ProxyConfigMonitor(Profile* profile) { proxy_config_service_->AddObserver(this); } +#endif --ProxyConfigMonitor::ProxyConfigMonitor() { -+ProxyConfigMonitor::ProxyConfigMonitor(PrefService* local_prefs) { + ProxyConfigMonitor::ProxyConfigMonitor(PrefService* local_state) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || +@@ -132,9 +136,11 @@ void ProxyConfigMonitor::OnLazyProxyConfigPoll() { + void ProxyConfigMonitor::OnPACScriptError(int32_t line_number, + const std::string& details) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); -- - pref_proxy_config_tracker_.reset( - ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( -- g_browser_process->local_state())); -- -+ local_prefs)); - proxy_config_service_ = ProxyServiceFactory::CreateProxyConfigService( - pref_proxy_config_tracker_.get()); ++#if 0 + extensions::ProxyEventRouter::GetInstance()->OnPACScriptError( + g_browser_process->extension_event_router_forwarder(), profile_, + line_number, base::UTF8ToUTF16(details)); ++#endif + } + void ProxyConfigMonitor::OnRequestMaybeFailedDueToProxySettings( +@@ -148,9 +154,10 @@ void ProxyConfigMonitor::OnRequestMaybeFailedDueToProxySettings( + // controlled. + return; + } +- ++#if 0 + extensions::ProxyEventRouter::GetInstance()->OnProxyError( + g_browser_process->extension_event_router_forwarder(), profile_, + net_error); ++#endif + } + #endif diff --git a/chrome/browser/net/proxy_config_monitor.h b/chrome/browser/net/proxy_config_monitor.h -index b783ab18d2d77cb2d443eed36a508f1eac77c04d..4475b58756dbf686cf78f6e317e55bc1df783e8d 100644 +index 172e71b085a58ff3060a3c90e7e3b9f3ef6df199..30764a251b9a09defaca86c2ac80877914dd1fe9 100644 --- a/chrome/browser/net/proxy_config_monitor.h +++ b/chrome/browser/net/proxy_config_monitor.h -@@ -20,22 +20,24 @@ class ProxyConfigWithAnnotation; +@@ -37,11 +37,12 @@ class ProxyConfigMonitor : public net::ProxyConfigService::Observer, - class Profile; - class PrefProxyConfigTracker; -+class PrefService; - - // Tracks the ProxyConfig to use, and passes any updates to a NetworkContext's - // ProxyConfigClient. - class ProxyConfigMonitor : public net::ProxyConfigService::Observer, - public network::mojom::ProxyConfigPollerClient { + { public: +#if 0 // Creates a ProxyConfigMonitor that gets proxy settings from |profile| and @@ -73,19 +82,13 @@ index b783ab18d2d77cb2d443eed36a508f1eac77c04d..4475b58756dbf686cf78f6e317e55bc1 - +#endif // Creates a ProxyConfigMonitor that gets proxy settings from the - // BrowserProcess's |local_state_|, for use with NetworkContexts not - // assocaited with a profile. Must be destroyed before the BrowserProcess's - // |local_state_|. -- ProxyConfigMonitor(); -+ explicit ProxyConfigMonitor(PrefService* local_prefs); + // |local_state|, for use with NetworkContexts not + // associated with a profile. Must be destroyed before |local_state|. +@@ -88,7 +89,6 @@ class ProxyConfigMonitor : public net::ProxyConfigService::Observer, - ~ProxyConfigMonitor() override; + #if BUILDFLAG(ENABLE_EXTENSIONS) + mojo::BindingSet error_binding_set_; +- Profile* profile_ = nullptr; + #endif -@@ -63,7 +65,6 @@ class ProxyConfigMonitor : public net::ProxyConfigService::Observer, - std::unique_ptr proxy_config_service_; - // Monitors global and Profile prefs related to proxy configuration. - std::unique_ptr pref_proxy_config_tracker_; -- - mojo::BindingSet binding_set_; - - mojo::InterfacePtrSet + DISALLOW_COPY_AND_ASSIGN(ProxyConfigMonitor); diff --git a/patches/common/chromium/render_widget_host_view_base.patch b/patches/common/chromium/render_widget_host_view_base.patch index 3b17692c16b7..2cc58b77925d 100644 --- a/patches/common/chromium/render_widget_host_view_base.patch +++ b/patches/common/chromium/render_widget_host_view_base.patch @@ -5,10 +5,10 @@ Subject: render_widget_host_view_base.patch diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc -index fae4c74c977bb32836bf315c3cf77cfe3499af7a..06030ddb6db221c52e665ddb86e71189e95f72a6 100644 +index e155153ec1eec9d28242e9ab95c9d75a0d3f40d7..fab1bcd2d8176cdd7163e329552a0a848c601290 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc -@@ -582,6 +582,15 @@ viz::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( +@@ -656,6 +656,15 @@ viz::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( return frame_sink_id.is_valid() ? frame_sink_id : GetFrameSinkId(); } @@ -25,7 +25,7 @@ index fae4c74c977bb32836bf315c3cf77cfe3499af7a..06030ddb6db221c52e665ddb86e71189 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 08454f68a01d204902d4023ac321793431ef4e0e..3dec5957125b68990bb3d539cb2a05a26e8d26d6 100644 +index c48b0aa86d8acea34dfece9212da4e7b11ffdb64..115b5647dfc13eb14e4d560c1fb71b926b5af829 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -22,8 +22,10 @@ @@ -50,9 +50,9 @@ index 08454f68a01d204902d4023ac321793431ef4e0e..3dec5957125b68990bb3d539cb2a05a2 class WebContentsAccessibility; +class WebContentsView; class WebCursor; + class DelegatedFrameHost; struct TextInputState; - -@@ -144,6 +148,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase +@@ -145,6 +149,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase TouchSelectionControllerClientManager* GetTouchSelectionControllerClientManager() override; @@ -62,7 +62,7 @@ index 08454f68a01d204902d4023ac321793431ef4e0e..3dec5957125b68990bb3d539cb2a05a2 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. gfx::PointF TransformPointToRootCoordSpaceF( -@@ -358,6 +365,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase +@@ -369,6 +376,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency); diff --git a/patches/common/chromium/render_widget_host_view_mac.patch b/patches/common/chromium/render_widget_host_view_mac.patch index fa5106226b97..e671c26288d4 100644 --- a/patches/common/chromium/render_widget_host_view_mac.patch +++ b/patches/common/chromium/render_widget_host_view_mac.patch @@ -5,10 +5,10 @@ Subject: render_widget_host_view_mac.patch diff --git a/content/browser/renderer_host/render_widget_host_view_cocoa.mm b/content/browser/renderer_host/render_widget_host_view_cocoa.mm -index 92f940ef0239b2bb3d2df3ddd2f9c33327f95031..04924fbac7ec3f5d23f85b70fa7ff61c23c9cbfc 100644 +index ee6cde8137b105e0951098b1aba0196398e935d3..5b0a6dd36810fae8ca2e055bafe736cb964b9cef 100644 --- a/content/browser/renderer_host/render_widget_host_view_cocoa.mm +++ b/content/browser/renderer_host/render_widget_host_view_cocoa.mm -@@ -181,6 +181,11 @@ void ExtractUnderlines(NSAttributedString* string, +@@ -106,6 +106,11 @@ void ExtractUnderlines(NSAttributedString* string, } // namespace @@ -20,7 +20,7 @@ index 92f940ef0239b2bb3d2df3ddd2f9c33327f95031..04924fbac7ec3f5d23f85b70fa7ff61c // These are not documented, so use only after checking -respondsToSelector:. @interface NSApplication (UndocumentedSpeechMethods) - (void)speakString:(NSString*)string; -@@ -364,6 +369,9 @@ - (BOOL)acceptsMouseEventsWhenInactive { +@@ -284,6 +289,9 @@ - (BOOL)acceptsMouseEventsWhenInactive { } - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { @@ -30,7 +30,7 @@ index 92f940ef0239b2bb3d2df3ddd2f9c33327f95031..04924fbac7ec3f5d23f85b70fa7ff61c return [self acceptsMouseEventsWhenInactive]; } -@@ -726,6 +734,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { +@@ -647,6 +655,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { eventType == NSKeyDown && !(modifierFlags & NSCommandKeyMask); @@ -40,8 +40,8 @@ index 92f940ef0239b2bb3d2df3ddd2f9c33327f95031..04924fbac7ec3f5d23f85b70fa7ff61c + // We only handle key down events and just simply forward other events. if (eventType != NSKeyDown) { - localClient_->ForwardKeyboardEvent(event, latency_info); -@@ -1498,9 +1510,11 @@ - (id)accessibilityFocusedUIElement { + clientHelper_->ForwardKeyboardEvent(event, latency_info); +@@ -1419,9 +1431,11 @@ - (id)accessibilityFocusedUIElement { // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -53,7 +53,7 @@ index 92f940ef0239b2bb3d2df3ddd2f9c33327f95031..04924fbac7ec3f5d23f85b70fa7ff61c - (NSArray*)validAttributesForMarkedText { // This code is just copied from WebKit except renaming variables. -@@ -1509,7 +1523,10 @@ - (NSArray*)validAttributesForMarkedText { +@@ -1430,7 +1444,10 @@ - (NSArray*)validAttributesForMarkedText { initWithObjects:NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName, NSMarkedClauseSegmentAttributeName, @@ -66,10 +66,10 @@ index 92f940ef0239b2bb3d2df3ddd2f9c33327f95031..04924fbac7ec3f5d23f85b70fa7ff61c return validAttributesForMarkedText_.get(); } diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 7e3a9aa6adc3ce0e3989279d2cc54f3dcb7eb40c..87705f669e022722f4e718532b44fad7780b1862 100644 +index 94d6e79377d354bc8c3041d4e9ffa21a29caea0c..38574877ab366c45a86e635adb4f39bcb7e05acb 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -54,6 +54,7 @@ +@@ -55,6 +55,7 @@ #include "ui/events/keycodes/dom/dom_keyboard_layout_map.h" #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/mac/coordinate_conversion.h" diff --git a/patches/common/chromium/resource_file_conflict.patch b/patches/common/chromium/resource_file_conflict.patch index fc7965c357ee..3989610bb77b 100644 --- a/patches/common/chromium/resource_file_conflict.patch +++ b/patches/common/chromium/resource_file_conflict.patch @@ -38,7 +38,6 @@ patch, GN refuses to generate the ninja files: action(_repack_target_name) { ^---------------------------- - Some alternatives to this patch: 1. Refactor upstream in such a way that the "chrome" pak names were @@ -49,14 +48,14 @@ Some alternatives to this patch: `electron_{100,200}_percent.pak`. 3. Initialize the resource bundle with DO_NOT_LOAD_COMMON_RESOURCES and load the paks ourselves. - + None of these options seems like a substantial maintainability win over this patch to me (@nornagon). diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 4865a69fe984b428c4b6591d11d778e6c2669d2d..e8795d76f895580a398f748724b55eb5848a3528 100644 +index abbab2664254c9be1ec5074463722c1365590cd0..03c3df58fb407a490ce3438cdc2f4168f3013a8f 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1638,6 +1638,11 @@ if (is_chrome_branded && !is_android) { +@@ -1646,6 +1646,11 @@ if (is_chrome_branded && !is_android) { } } @@ -68,7 +67,7 @@ index 4865a69fe984b428c4b6591d11d778e6c2669d2d..e8795d76f895580a398f748724b55eb5 chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1659,6 +1664,7 @@ chrome_paks("packed_resources") { +@@ -1667,6 +1672,7 @@ chrome_paks("packed_resources") { ] } } diff --git a/patches/common/chromium/scroll_bounce_flag.patch b/patches/common/chromium/scroll_bounce_flag.patch index f2868c935b52..962256d61094 100644 --- a/patches/common/chromium/scroll_bounce_flag.patch +++ b/patches/common/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index b36daaee097a56a5180cc79a6dcf730bc22afdce..2ec1bd2b81d64874fba60b4994c2dd215f4ddc42 100644 +index f2d704c09e6eb90409d6e8119fe1b7d65f2fbabd..db731036430048f6299c2d735e44a4bccc151579 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1610,7 +1610,7 @@ bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { +@@ -1528,7 +1528,7 @@ bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/common/chromium/ssl_security_state_tab_helper.patch b/patches/common/chromium/ssl_security_state_tab_helper.patch index ad567a557be4..4c380d589078 100644 --- a/patches/common/chromium/ssl_security_state_tab_helper.patch +++ b/patches/common/chromium/ssl_security_state_tab_helper.patch @@ -6,7 +6,7 @@ Subject: ssl_security_state_tab_helper.patch Allows populating security tab info for devtools in Electron. diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc -index c88e2729738d28ba626e14dd95924522bca2c336..a017ea4b37a39f6d65636f3c1aecc43838b80d4f 100644 +index aebdb130ba687e0d0c0aa45a08b1820b67d3c25c..fdbeb9cd398eac5659b1dac4af9094c5a5d531f4 100644 --- a/chrome/browser/ssl/security_state_tab_helper.cc +++ b/chrome/browser/ssl/security_state_tab_helper.cc @@ -13,17 +13,23 @@ @@ -119,7 +119,7 @@ index c88e2729738d28ba626e14dd95924522bca2c336..a017ea4b37a39f6d65636f3c1aecc438 return secure_origin_whitelist::ParseWhitelist(origins_str); } diff --git a/chrome/common/secure_origin_whitelist.cc b/chrome/common/secure_origin_whitelist.cc -index 3319df136d4d32aad066fe98bfadacfb3c05322a..fbc6eea480d23e7158bbbfb8dc77926824b94c3d 100644 +index b70d6ced887d2a2ecb576b20d79e7fc4272e2054..5a75fe115c3c77f4a9edf7913b47341a757d1b42 100644 --- a/chrome/common/secure_origin_whitelist.cc +++ b/chrome/common/secure_origin_whitelist.cc @@ -13,7 +13,9 @@ diff --git a/patches/common/chromium/sysroot.patch b/patches/common/chromium/sysroot.patch index 52539dcf8e0f..3b5d88a225ec 100644 --- a/patches/common/chromium/sysroot.patch +++ b/patches/common/chromium/sysroot.patch @@ -7,7 +7,7 @@ Make chrome's install-sysroot scripts point to our custom sysroot builds, which include extra deps that Electron needs (e.g. libnotify) diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py -index 58f09950d844f4fa4f8d46718852c4f2c490c391..55dd50187714b596e6ded4f2b302fb497af53ad0 100755 +index 115dce4e23ae2a8dd771b73ddbcd1a5b12bcbf9b..12f944a95ad49842d2a53cdbe8eb157e7605b621 100755 --- a/build/linux/sysroot_scripts/install-sysroot.py +++ b/build/linux/sysroot_scripts/install-sysroot.py @@ -30,9 +30,11 @@ import sys diff --git a/patches/common/chromium/tts.patch b/patches/common/chromium/tts.patch index 92c6fc9a831a..fb103b93e867 100644 --- a/patches/common/chromium/tts.patch +++ b/patches/common/chromium/tts.patch @@ -10,10 +10,10 @@ Subject: tts.patch destruction from content layer. diff --git a/chrome/browser/speech/tts_controller_impl.cc b/chrome/browser/speech/tts_controller_impl.cc -index 2ca56c3a247e674ee15b0a0ee30e6c2941aa93d3..f58e33b3c0198e4333f98cd1928c8f6d9be45738 100644 +index 46ea4689a38d1986055058c8bdeef088e732cf79..6156ddb10fba7fe8a1550f45bb364005bd225811 100644 --- a/chrome/browser/speech/tts_controller_impl.cc +++ b/chrome/browser/speech/tts_controller_impl.cc -@@ -624,12 +624,14 @@ const PrefService* TtsControllerImpl::GetPrefService( +@@ -607,12 +607,14 @@ const PrefService* TtsControllerImpl::GetPrefService( const Utterance* utterance) { const PrefService* prefs = nullptr; // The utterance->browser_context() is null in tests. @@ -29,12 +29,12 @@ index 2ca56c3a247e674ee15b0a0ee30e6c2941aa93d3..f58e33b3c0198e4333f98cd1928c8f6d } diff --git a/chrome/browser/speech/tts_message_filter.cc b/chrome/browser/speech/tts_message_filter.cc -index 013c7a9c60f95475d63701c4f6848cb00dac19d9..73a244a726e3e1a1b5b52ca0e8e3b209aaf432ff 100644 +index 84d2dc145ece4d26c39a338b9a6fcf83a9a3a2da..ab911e1b7d29d675868d1476302d9b6dde7de288 100644 --- a/chrome/browser/speech/tts_message_filter.cc +++ b/chrome/browser/speech/tts_message_filter.cc -@@ -9,14 +9,40 @@ - #include "base/bind.h" +@@ -10,8 +10,11 @@ #include "base/logging.h" + #include "base/task/post_task.h" #include "chrome/browser/chrome_notification_types.h" +#if 0 #include "chrome/browser/profiles/profile.h" @@ -42,8 +42,9 @@ index 013c7a9c60f95475d63701c4f6848cb00dac19d9..73a244a726e3e1a1b5b52ca0e8e3b209 #include "chrome/common/tts_messages.h" +#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h" #include "content/public/browser/browser_context.h" + #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/notification_service.h" - #include "content/public/browser/render_process_host.h" +@@ -19,6 +22,29 @@ using content::BrowserThread; @@ -73,7 +74,7 @@ index 013c7a9c60f95475d63701c4f6848cb00dac19d9..73a244a726e3e1a1b5b52ca0e8e3b209 TtsMessageFilter::TtsMessageFilter(content::BrowserContext* browser_context) : BrowserMessageFilter(TtsMsgStart), browser_context_(browser_context), -@@ -24,28 +50,27 @@ TtsMessageFilter::TtsMessageFilter(content::BrowserContext* browser_context) +@@ -26,28 +52,27 @@ TtsMessageFilter::TtsMessageFilter(content::BrowserContext* browser_context) CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); TtsController::GetInstance()->AddVoicesChangedDelegate(this); @@ -116,7 +117,7 @@ index 013c7a9c60f95475d63701c4f6848cb00dac19d9..73a244a726e3e1a1b5b52ca0e8e3b209 } } -@@ -207,10 +232,8 @@ void TtsMessageFilter::Cleanup() { +@@ -209,10 +234,8 @@ void TtsMessageFilter::Cleanup() { TtsController::GetInstance()->RemoveUtteranceEventDelegate(this); } diff --git a/patches/common/chromium/web_contents.patch b/patches/common/chromium/web_contents.patch index 443f2054f591..d597afa28427 100644 --- a/patches/common/chromium/web_contents.patch +++ b/patches/common/chromium/web_contents.patch @@ -5,10 +5,10 @@ Subject: web_contents.patch diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 499c8c0a2e899d9c2a35be461cc8d247f42a6f17..a9e95f9b18bbd5327536499c58362167fa01a583 100644 +index c9d8ca8da4934497ee71a2c4261a04e0a32d86c5..b50572db02fdd3def70d8c892b043f5db47cafe9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -1940,6 +1940,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1993,6 +1993,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -21,7 +21,7 @@ index 499c8c0a2e899d9c2a35be461cc8d247f42a6f17..a9e95f9b18bbd5327536499c58362167 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -1955,6 +1961,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2008,6 +2014,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { &render_view_host_delegate_view_); } } @@ -30,10 +30,10 @@ index 499c8c0a2e899d9c2a35be461cc8d247f42a6f17..a9e95f9b18bbd5327536499c58362167 CHECK(view_.get()); diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc -index 12f6817499eff069f4bc52a775fe1275a332881c..f20fe106c4cb443be8cf4311e531418eb4c80b5c 100644 +index 5de4d7cf8a7a812ad3f6383cd60acbd39135924d..dca9ec76b44be34124a12f453d3c6ecbb1509b9f 100644 --- a/content/browser/web_contents/web_contents_view_guest.cc +++ b/content/browser/web_contents/web_contents_view_guest.cc -@@ -67,21 +67,27 @@ gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const { +@@ -69,19 +69,26 @@ gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const { void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { #if defined(USE_AURA) @@ -44,27 +44,25 @@ index 12f6817499eff069f4bc52a775fe1275a332881c..f20fe106c4cb443be8cf4311e531418e // view hierarchy. We add this view as embedder's child here. // This would go in WebContentsViewGuest::CreateView, but that is too early to // access embedder_web_contents(). Therefore, we do it here. - if (!features::IsUsingWindowService()) -- parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView()); -+ if (parent_view->GetNativeView() != platform_view_->GetNativeView()) -+ parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView()); +- if (!features::IsMultiProcessMash()) ++ if (!features::IsMultiProcessMash() && ++ parent_view->GetNativeView() != platform_view_->GetNativeView()) { + parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView()); ++ } #endif // defined(USE_AURA) } void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) { #if defined(USE_AURA) +- if (!features::IsMultiProcessMash()) { + if (!platform_view_->GetNativeView()) + return; - if (!features::IsUsingWindowService()) { -- old_parent_view->GetNativeView()->RemoveChild( -- platform_view_->GetNativeView()); -+ if (old_parent_view->GetNativeView() != platform_view_->GetNativeView()) -+ old_parent_view->GetNativeView()->RemoveChild( -+ platform_view_->GetNativeView()); ++ if (!features::IsMultiProcessMash() && ++ old_parent_view->GetNativeView() != platform_view_->GetNativeView()) { + old_parent_view->GetNativeView()->RemoveChild( + platform_view_->GetNativeView()); } - #endif // defined(USE_AURA) - } -@@ -144,11 +150,22 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( +@@ -136,11 +143,22 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( render_widget_host->GetView()); } @@ -90,12 +88,12 @@ index 12f6817499eff069f4bc52a775fe1275a332881c..f20fe106c4cb443be8cf4311e531418e + return guest_view; } - RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget( + RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForChildWidget( diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 786eecfcb70cd5145a29f9dc89765930739e0d63..0916329b2bf483381065476108978683ec2e6bf9 100644 +index f26f7e50166310d52fd1c1e45b3d956c28e63074..52735286515c5332c64bca8bf332ae8d65bc7e5c 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -77,9 +77,12 @@ class BrowserPluginGuestDelegate; +@@ -74,9 +74,12 @@ class BrowserPluginGuestDelegate; class InterstitialPage; class RenderFrameHost; class RenderViewHost; @@ -108,7 +106,7 @@ index 786eecfcb70cd5145a29f9dc89765930739e0d63..0916329b2bf483381065476108978683 struct CustomContextMenuContext; struct DropData; struct MHTMLGenerationParams; -@@ -216,6 +219,10 @@ class WebContents : public PageNavigator, +@@ -213,6 +216,10 @@ class WebContents : public PageNavigator, kInitializeAndWarmupRendererProcess, } desired_renderer_state; diff --git a/patches/common/chromium/webgl_context_attributes.patch b/patches/common/chromium/webgl_context_attributes.patch index 28dbd5dbd18e..289238d5b033 100644 --- a/patches/common/chromium/webgl_context_attributes.patch +++ b/patches/common/chromium/webgl_context_attributes.patch @@ -5,10 +5,10 @@ Subject: webgl_context_attributes.patch diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 4a594bd98bcdd9d13bee61011883075de2d23495..a91f06ffb8782630714a88d1d3d00eca0c2c0f7f 100644 +index 907fd2f4f8567b828f1a45caa32cbd4dafdcac4e..8eb8b5a763c58da80ab826f629aa33e0d782ad14 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -1040,8 +1040,10 @@ RendererBlinkPlatformImpl::CreateOffscreenGraphicsContext3DProvider( +@@ -1029,8 +1029,10 @@ RendererBlinkPlatformImpl::CreateOffscreenGraphicsContext3DProvider( attributes.sample_buffers = 0; attributes.bind_generates_resource = false; attributes.enable_raster_interface = web_attributes.enable_raster_interface; @@ -22,10 +22,10 @@ index 4a594bd98bcdd9d13bee61011883075de2d23495..a91f06ffb8782630714a88d1d3d00eca attributes.fail_if_major_perf_caveat = web_attributes.fail_if_major_performance_caveat; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 3e8fae9161252cf0cfb95f81596996822026f514..362a2978452e758c8f74739bb5c635e8be9b834f 100644 +index 2f57bdd1ef3ee4f81d248fffc6e1e512ed83bb27..f016cfb6d31d0feeb32800fe6bc1c0421bad66e0 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -531,6 +531,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -550,6 +550,7 @@ class BLINK_PLATFORM_EXPORT Platform { kWebGPUContextType, // WebGPU context }; struct ContextAttributes { @@ -34,19 +34,19 @@ index 3e8fae9161252cf0cfb95f81596996822026f514..362a2978452e758c8f74739bb5c635e8 ContextType context_type = kGLES2ContextType; // Offscreen contexts usually share a surface for the default frame buffer diff --git a/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h b/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h -index 03da0840b0e398fa0826fb36b55ff41bd95af77d..9551675de44d1475714726d9b58f4d1b7863d98f 100644 +index a6f46ede75f84294d34ad042a1fb103d106a0543..c62399bde32c6296d7bdede710e63f30cef50833 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h @@ -30,6 +30,7 @@ class CORE_EXPORT CanvasContextCreationAttributesCore { - String pixel_format = "8-8-8-8"; + String pixel_format = "uint8"; bool premultiplied_alpha = true; bool preserve_drawing_buffer = false; + String power_preference = "default"; bool stencil = false; - // This attribute is of type XRDevice, defined in modules/xr/XRDevice.h + // This attribute is of type XRDevice, defined in modules/xr/xr_device.h diff --git a/third_party/blink/renderer/modules/canvas/htmlcanvas/canvas_context_creation_attributes_module.idl b/third_party/blink/renderer/modules/canvas/htmlcanvas/canvas_context_creation_attributes_module.idl -index 7b655dd12a77d701453988d949295ead0b7dbf4d..8969eb7d98f3a7bf2e431a398a2156499d1be326 100644 +index 98875e974f51ea77a0adf6f6f304ff97f1f62102..36739547ce2ffda7e6f243f50dab5a63a1fc6a4f 100644 --- a/third_party/blink/renderer/modules/canvas/htmlcanvas/canvas_context_creation_attributes_module.idl +++ b/third_party/blink/renderer/modules/canvas/htmlcanvas/canvas_context_creation_attributes_module.idl @@ -28,6 +28,12 @@ enum CanvasPixelFormat { @@ -71,7 +71,7 @@ index 7b655dd12a77d701453988d949295ead0b7dbf4d..8969eb7d98f3a7bf2e431a398a215649 [OriginTrialEnabled=WebXR] XRDevice compatibleXRDevice = null; }; diff --git a/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc b/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc -index 3846b2a179d963a99c3785c4b9b41f346403eeb2..bf7c63a8139152c4e6a01f52965da09f6ed0b48e 100644 +index 26b4610c87c2a2c38e45e0c3d26b5b52ef1097e4..fa6923ed17aee8d85f4d1d7e27dd17fae619da85 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc @@ -18,6 +18,7 @@ WebGLContextAttributes ToWebGLContextAttributes( @@ -82,7 +82,7 @@ index 3846b2a179d963a99c3785c4b9b41f346403eeb2..bf7c63a8139152c4e6a01f52965da09f result.setFailIfMajorPerformanceCaveat( attrs.fail_if_major_performance_caveat); result.setCompatibleXRDevice( -@@ -30,6 +31,7 @@ Platform::ContextAttributes ToPlatformContextAttributes( +@@ -31,6 +32,7 @@ Platform::ContextAttributes ToPlatformContextAttributes( Platform::ContextType context_type, bool support_own_offscreen_surface) { Platform::ContextAttributes result; @@ -91,7 +91,7 @@ index 3846b2a179d963a99c3785c4b9b41f346403eeb2..bf7c63a8139152c4e6a01f52965da09f attrs.fail_if_major_performance_caveat; result.context_type = context_type; diff --git a/third_party/blink/renderer/modules/webgl/webgl_context_attributes.idl b/third_party/blink/renderer/modules/webgl/webgl_context_attributes.idl -index 38ca0f6b6a0c4bcb042887cd168ba8040435875d..90cfe8497daf2db6c3022826b5f1ab4e854e9955 100644 +index 39092f2acab0996dc4f29c3687f92fcd4b8b090f..256beda2da43bf02391943c6ca337fed141bc2a3 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_context_attributes.idl +++ b/third_party/blink/renderer/modules/webgl/webgl_context_attributes.idl @@ -26,6 +26,12 @@ @@ -114,4 +114,4 @@ index 38ca0f6b6a0c4bcb042887cd168ba8040435875d..90cfe8497daf2db6c3022826b5f1ab4e + WebGLPowerPreference powerPreference = "default"; boolean failIfMajorPerformanceCaveat = false; [OriginTrialEnabled=WebXR] XRDevice compatibleXRDevice = null; - }; + // TODO(crbug.com/788439): remove OriginTrialEnabled. diff --git a/patches/common/chromium/webview_cross_drag.patch b/patches/common/chromium/webview_cross_drag.patch index 7204f32729ba..82401c436173 100644 --- a/patches/common/chromium/webview_cross_drag.patch +++ b/patches/common/chromium/webview_cross_drag.patch @@ -5,10 +5,10 @@ Subject: webview_cross_drag.patch diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc -index e471459007af1b03f477f6df8c963cc0916b1a66..3df843acdba8470352f90829e502ad10e1616dfe 100644 +index ce5602b1cc38b29aee3ff4c997a00a144ff06789..80c325a98ca749f36752978bf825eca047dc361b 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc -@@ -622,6 +622,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { +@@ -620,6 +620,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { bool WebContentsViewAura::IsValidDragTarget( RenderWidgetHostImpl* target_rwh) const { diff --git a/patches/common/chromium/worker_context_will_destroy.patch b/patches/common/chromium/worker_context_will_destroy.patch index 1b34cea99b26..5dfc66106a99 100644 --- a/patches/common/chromium/worker_context_will_destroy.patch +++ b/patches/common/chromium/worker_context_will_destroy.patch @@ -5,10 +5,10 @@ Subject: worker_context_will_destroy.patch diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index f1c9cc5997cb5e285bd552d58434de7a4b1d2467..86f2215b9d78374569572c6d087a2102506d3dcb 100644 +index 3166cbe259daafc8644b0b1a8941160205638046..b8a81f37db6a979cfbda8743fe4db435ad92dc40 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -383,6 +383,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -392,6 +392,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} @@ -21,10 +21,10 @@ index f1c9cc5997cb5e285bd552d58434de7a4b1d2467..86f2215b9d78374569572c6d087a2102 // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index a91f06ffb8782630714a88d1d3d00eca0c2c0f7f..291081cf0d428cbef12f99e9296e4b52ce89eca4 100644 +index 8eb8b5a763c58da80ab826f629aa33e0d782ad14..09d638e7e74835b032bfbfb15f9ebbf6f7b7cec7 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -1187,6 +1187,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -1176,6 +1176,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -38,10 +38,10 @@ index a91f06ffb8782630714a88d1d3d00eca0c2c0f7f..291081cf0d428cbef12f99e9296e4b52 const v8::Local& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index b3bde113adbd7a7586981c42c28da5a939ed688f..892f1e653a656ebdab3fda066af0814c991842c3 100644 +index 4ec814fd92c5accf70627d37f4966e3e5270b660..aa405311a4588ad4903f637fc07713bd18b34e68 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -208,6 +208,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -207,6 +207,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; @@ -50,10 +50,10 @@ index b3bde113adbd7a7586981c42c28da5a939ed688f..892f1e653a656ebdab3fda066af0814c // Disables the WebSandboxSupport implementation for testing. // Tests that do not set up a full sandbox environment should call diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 362a2978452e758c8f74739bb5c635e8be9b834f..9730bc3d13721a12ee490d38213c753b130b6d07 100644 +index f016cfb6d31d0feeb32800fe6bc1c0421bad66e0..19761866164e9a20221ce552af7683c77a21f551 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -673,6 +673,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -692,6 +692,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} @@ -62,10 +62,10 @@ index 362a2978452e758c8f74739bb5c635e8be9b834f..9730bc3d13721a12ee490d38213c753b return false; } diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc -index 0e1ce1e2ffc9283fa2d23bb7d74b96fbfbf7bf2e..e6789645fb05645d0328685f1e544f0f981d747c 100644 +index a231d079da2dc70a1054ea6cd4335bad8b2a0253..9343e83988a5bfd7f83ead484be61ac8c17b1196 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc -@@ -529,6 +529,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { +@@ -528,6 +528,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { SetExitCode(ExitCode::kGracefullyTerminated); } @@ -75,6 +75,6 @@ index 0e1ce1e2ffc9283fa2d23bb7d74b96fbfbf7bf2e..e6789645fb05645d0328685f1e544f0f + GlobalScope()->ScriptController()->GetContext()); + } + - GetWorkerReportingProxy().WillDestroyWorkerGlobalScope(); + if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::From(GetIsolate())) + debugger->WorkerThreadDestroyed(this); - probe::AllAsyncTasksCanceled(GlobalScope()); diff --git a/patches/common/v8/.patches b/patches/common/v8/.patches index 8841e9b399d7..ca9e67147b2a 100644 --- a/patches/common/v8/.patches +++ b/patches/common/v8/.patches @@ -1,5 +1,4 @@ deps_backport_detailed_line_info_for_cpu_profiler.patch -deps_cherry-pick_2363cdf_from_upstream_v8.patch add_realloc.patch build_gn.patch array_buffer.patch @@ -10,5 +9,8 @@ disable-warning-win.patch expose_mksnapshot.patch build-torque-with-x64-toolchain-on-arm.patch do_not_run_arm_arm64_mksnapshot_binaries.patch -deps_revert_9136dd8088a9_from_upstream_v8.patch deps_provide_more_v8_backwards_compatibility.patch +0001-deps-cherry-pick-0483e9a-from-upstream-V8.patch +0002-deps-cherry-pick-b87d408-from-upstream-V8.patch +0003-deps-cherry-pick-073073b-from-upstream-V8.patch +0004-deps-cherry-pick-88f8fe1-from-upstream-V8.patch diff --git a/patches/common/v8/0001-deps-cherry-pick-0483e9a-from-upstream-V8.patch b/patches/common/v8/0001-deps-cherry-pick-0483e9a-from-upstream-V8.patch new file mode 100644 index 000000000000..518b2d6e4d15 --- /dev/null +++ b/patches/common/v8/0001-deps-cherry-pick-0483e9a-from-upstream-V8.patch @@ -0,0 +1,112 @@ +From 0e090768de1844c493013d5e99bd903928aff2ab Mon Sep 17 00:00:00 2001 +From: Joyee Cheung +Date: Tue, 6 Nov 2018 18:05:48 +0800 +Subject: [PATCH 1/4] deps: cherry-pick 0483e9a from upstream V8 + +Original commit message: + + [api] Allow embedder to construct an Array from Local* + + Currently to obtain a v8::Array out of a C array or a std::vector, + one needs to loop through the elements and call array->Set() multiple + times, and these calls go into v8::Object::Set() which can be slow. + This patch adds a new Array::New overload that converts a + Local* with known size into a Local. + + Change-Id: I0a768f0e18eec51e78d58be455482ec6425ca188 + Reviewed-on: https://chromium-review.googlesource.com/c/1317049 + Reviewed-by: Yang Guo + Reviewed-by: Adam Klein + Commit-Queue: Joyee Cheung + Cr-Commit-Position: refs/heads/master@{#57261} + +Refs: https://github.com/v8/v8/commit/0483e9a9abe77a73632fd85b9c0cd608efa9aa0d + +PR-URL: https://github.com/nodejs/node/pull/24125 +Reviewed-By: Anna Henningsen +Reviewed-By: Yang Guo +Reviewed-By: Gus Caplan +Reviewed-By: Colin Ihrig +Reviewed-By: Ben Noordhuis +Reviewed-By: Refael Ackermann +--- + include/v8.h | 6 ++++++ + src/api.cc | 17 +++++++++++++++++ + test/cctest/test-api.cc | 16 ++++++++++++++++ + 3 files changed, 39 insertions(+) + +diff --git a/include/v8.h b/include/v8.h +index a4bbe1b0c4..9b7be9fb93 100644 +--- a/include/v8.h ++++ b/include/v8.h +@@ -3680,6 +3680,12 @@ class V8_EXPORT Array : public Object { + */ + static Local New(Isolate* isolate, int length = 0); + ++ /** ++ * Creates a JavaScript array out of a Local array in C++ ++ * with a known length. ++ */ ++ static Local New(Isolate* isolate, Local* elements, ++ size_t length); + V8_INLINE static Array* Cast(Value* obj); + private: + Array(); +diff --git a/src/api.cc b/src/api.cc +index 3f62a23d43..4e233d96dc 100644 +--- a/src/api.cc ++++ b/src/api.cc +@@ -6911,6 +6911,23 @@ Local v8::Array::New(Isolate* isolate, int length) { + return Utils::ToLocal(obj); + } + ++Local v8::Array::New(Isolate* isolate, Local* elements, ++ size_t length) { ++ i::Isolate* i_isolate = reinterpret_cast(isolate); ++ i::Factory* factory = i_isolate->factory(); ++ LOG_API(i_isolate, Array, New); ++ ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); ++ int len = static_cast(length); ++ ++ i::Handle result = factory->NewFixedArray(len); ++ for (int i = 0; i < len; i++) { ++ i::Handle element = Utils::OpenHandle(*elements[i]); ++ result->set(i, *element); ++ } ++ ++ return Utils::ToLocal( ++ factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, len)); ++} + + uint32_t v8::Array::Length() const { + i::Handle obj = Utils::OpenHandle(this); +diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc +index 9eb73fab7e..0d92508d24 100644 +--- a/test/cctest/test-api.cc ++++ b/test/cctest/test-api.cc +@@ -5225,6 +5225,22 @@ THREADED_TEST(Array) { + CHECK_EQ(27u, array->Length()); + array = v8::Array::New(context->GetIsolate(), -27); + CHECK_EQ(0u, array->Length()); ++ ++ std::vector> vector = {v8_num(1), v8_num(2), v8_num(3)}; ++ array = v8::Array::New(context->GetIsolate(), vector.data(), vector.size()); ++ CHECK_EQ(vector.size(), array->Length()); ++ CHECK_EQ(1, arr->Get(context.local(), 0) ++ .ToLocalChecked() ++ ->Int32Value(context.local()) ++ .FromJust()); ++ CHECK_EQ(2, arr->Get(context.local(), 1) ++ .ToLocalChecked() ++ ->Int32Value(context.local()) ++ .FromJust()); ++ CHECK_EQ(3, arr->Get(context.local(), 2) ++ .ToLocalChecked() ++ ->Int32Value(context.local()) ++ .FromJust()); + } + + +-- +2.14.3 (Apple Git-98) + diff --git a/patches/common/v8/0002-deps-cherry-pick-b87d408-from-upstream-V8.patch b/patches/common/v8/0002-deps-cherry-pick-b87d408-from-upstream-V8.patch new file mode 100644 index 000000000000..275421ed5a48 --- /dev/null +++ b/patches/common/v8/0002-deps-cherry-pick-b87d408-from-upstream-V8.patch @@ -0,0 +1,136 @@ +From e36e9dde38caf3517890da2265e6dd9f127abe72 Mon Sep 17 00:00:00 2001 +From: Peter Marshall +Date: Fri, 9 Nov 2018 13:06:07 +0100 +Subject: [PATCH 2/4] deps: cherry-pick b87d408 from upstream V8 + +Original commit message: + + [heap-profiler] Fix a use-after-free when snapshots are deleted + + If a caller starts the sampling heap profiler and takes a snapshot, + and then deletes the snapshot before the sampling has completed, a + use-after-free will occur on the StringsStorage pointer. + + The same issue applies for StartTrackingHeapObjects which shares the + same StringsStorage object. + + Bug: v8:8373 + Change-Id: I5d69d60d3f9465f9dd3b3bef107c204e0fda0643 + Reviewed-on: https://chromium-review.googlesource.com/c/1301477 + Commit-Queue: Peter Marshall + Reviewed-by: Alexei Filippov + Cr-Commit-Position: refs/heads/master@{#57114} + +PR-URL: https://github.com/nodejs/node/pull/24272 +Refs: +https://github.com/v8/v8/commit/b87d408f65b9ab49a4d199e850d2358995deaeb2 +Reviewed-By: Colin Ihrig +Reviewed-By: Daniel Bevenius +--- + src/profiler/heap-profiler.cc | 9 ++++++++- + src/profiler/heap-profiler.h | 2 ++ + test/cctest/test-heap-profiler.cc | 42 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 52 insertions(+), 1 deletion(-) + +diff --git a/src/profiler/heap-profiler.cc b/src/profiler/heap-profiler.cc +index 0978e76cff..58a8f3851f 100644 +--- a/src/profiler/heap-profiler.cc ++++ b/src/profiler/heap-profiler.cc +@@ -23,9 +23,14 @@ HeapProfiler::~HeapProfiler() = default; + + void HeapProfiler::DeleteAllSnapshots() { + snapshots_.clear(); +- names_.reset(new StringsStorage()); ++ MaybeClearStringsStorage(); + } + ++void HeapProfiler::MaybeClearStringsStorage() { ++ if (snapshots_.empty() && !sampling_heap_profiler_ && !allocation_tracker_) { ++ names_.reset(new StringsStorage()); ++ } ++} + + void HeapProfiler::RemoveSnapshot(HeapSnapshot* snapshot) { + snapshots_.erase( +@@ -126,6 +131,7 @@ bool HeapProfiler::StartSamplingHeapProfiler( + + void HeapProfiler::StopSamplingHeapProfiler() { + sampling_heap_profiler_.reset(); ++ MaybeClearStringsStorage(); + } + + +@@ -159,6 +165,7 @@ void HeapProfiler::StopHeapObjectsTracking() { + ids_->StopHeapObjectsTracking(); + if (allocation_tracker_) { + allocation_tracker_.reset(); ++ MaybeClearStringsStorage(); + heap()->RemoveHeapObjectAllocationTracker(this); + } + } +diff --git a/src/profiler/heap-profiler.h b/src/profiler/heap-profiler.h +index acbdc6aa7a..1e3527765e 100644 +--- a/src/profiler/heap-profiler.h ++++ b/src/profiler/heap-profiler.h +@@ -92,6 +92,8 @@ class HeapProfiler : public HeapObjectAllocationTracker { + v8::PersistentValueVector* objects); + + private: ++ void MaybeClearStringsStorage(); ++ + Heap* heap() const; + + // Mapping from HeapObject addresses to objects' uids. +diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc +index 257ef1c723..f3c545fd83 100644 +--- a/test/cctest/test-heap-profiler.cc ++++ b/test/cctest/test-heap-profiler.cc +@@ -3875,3 +3875,45 @@ TEST(WeakReference) { + const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); + CHECK(ValidateSnapshot(snapshot)); + } ++ ++TEST(Bug8373_1) { ++ LocalContext env; ++ v8::HandleScope scope(env->GetIsolate()); ++ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); ++ ++ heap_profiler->StartSamplingHeapProfiler(100); ++ ++ heap_profiler->TakeHeapSnapshot(); ++ // Causes the StringsStorage to be deleted. ++ heap_profiler->DeleteAllHeapSnapshots(); ++ ++ // Triggers an allocation sample that tries to use the StringsStorage. ++ for (int i = 0; i < 2 * 1024; ++i) { ++ CompileRun( ++ "new Array(64);" ++ "new Uint8Array(16);"); ++ } ++ ++ heap_profiler->StopSamplingHeapProfiler(); ++} ++ ++TEST(Bug8373_2) { ++ LocalContext env; ++ v8::HandleScope scope(env->GetIsolate()); ++ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); ++ ++ heap_profiler->StartTrackingHeapObjects(true); ++ ++ heap_profiler->TakeHeapSnapshot(); ++ // Causes the StringsStorage to be deleted. ++ heap_profiler->DeleteAllHeapSnapshots(); ++ ++ // Triggers an allocations that try to use the StringsStorage. ++ for (int i = 0; i < 2 * 1024; ++i) { ++ CompileRun( ++ "new Array(64);" ++ "new Uint8Array(16);"); ++ } ++ ++ heap_profiler->StopTrackingHeapObjects(); ++} +-- +2.14.3 (Apple Git-98) + diff --git a/patches/common/v8/0003-deps-cherry-pick-073073b-from-upstream-V8.patch b/patches/common/v8/0003-deps-cherry-pick-073073b-from-upstream-V8.patch new file mode 100644 index 000000000000..1da5bd057896 --- /dev/null +++ b/patches/common/v8/0003-deps-cherry-pick-073073b-from-upstream-V8.patch @@ -0,0 +1,180 @@ +From d08800799f487c2ab02cf567dca2e4ecfb589b63 Mon Sep 17 00:00:00 2001 +From: Yang Guo +Date: Tue, 20 Nov 2018 09:16:23 +0100 +Subject: [PATCH 3/4] deps: cherry-pick 073073b from upstream V8 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Original commit message: + + [profiler] introduce API to enable detailed source positions + + This allows Node.js to enable detailed source positions for optimized code + early on, without having to pass a flag string. + + R=petermarshall@chromium.org + + Change-Id: Ie74ea41f600cf6e31acbe802116df4976ccf1c75 + Reviewed-on: https://chromium-review.googlesource.com/c/1319757 + Commit-Queue: Yang Guo + Reviewed-by: Peter Marshall + Cr-Commit-Position: refs/heads/master@{#57380} + +Refs: https://github.com/v8/v8/commit/073073b4f12b683fc0406cd15b3cb284633fe18e + +PR-URL: https://github.com/nodejs/node/pull/24515 +Refs: https://github.com/nodejs/node/pull/24274 +Refs: https://github.com/nodejs/node/pull/24394 +Refs: https://github.com/nodejs/node/issues/24393 +Reviewed-By: Michaël Zasso +Reviewed-By: Joyee Cheung +Reviewed-By: Peter Marshall +Reviewed-By: James M Snell +Reviewed-By: Refael Ackermann +--- + include/v8-profiler.h | 6 +++++ + src/api.cc | 5 ++++ + src/isolate.cc | 3 ++- + src/isolate.h | 3 ++- + test/cctest/test-cpu-profiler.cc | 56 ++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 71 insertions(+), 2 deletions(-) + +diff --git a/include/v8-profiler.h b/include/v8-profiler.h +index c034518def..f30688582d 100644 +--- a/include/v8-profiler.h ++++ b/include/v8-profiler.h +@@ -341,6 +341,12 @@ class V8_EXPORT CpuProfiler { + V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.", + void SetIdle(bool is_idle)); + ++ /** ++ * Generate more detailed source positions to code objects. This results in ++ * better results when mapping profiling samples to script source. ++ */ ++ static void UseDetailedSourcePositionsForProfiling(Isolate* isolate); ++ + private: + CpuProfiler(); + ~CpuProfiler(); +diff --git a/src/api.cc b/src/api.cc +index 4e233d96dc..161538638b 100644 +--- a/src/api.cc ++++ b/src/api.cc +@@ -10112,6 +10112,11 @@ void CpuProfiler::SetIdle(bool is_idle) { + isolate->SetIdle(is_idle); + } + ++void CpuProfiler::UseDetailedSourcePositionsForProfiling(Isolate* isolate) { ++ reinterpret_cast(isolate) ++ ->set_detailed_source_positions_for_profiling(true); ++} ++ + uintptr_t CodeEvent::GetCodeStartAddress() { + return reinterpret_cast(this)->code_start_address; + } +diff --git a/src/isolate.cc b/src/isolate.cc +index 94033f446b..e6a9e95a2f 100644 +--- a/src/isolate.cc ++++ b/src/isolate.cc +@@ -3461,7 +3461,8 @@ bool Isolate::use_optimizer() { + } + + bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const { +- return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info; ++ return NeedsSourcePositionsForProfiling() || ++ detailed_source_positions_for_profiling(); + } + + bool Isolate::NeedsSourcePositionsForProfiling() const { +diff --git a/src/isolate.h b/src/isolate.h +index ad124586cc..c25f143cf8 100644 +--- a/src/isolate.h ++++ b/src/isolate.h +@@ -540,7 +540,8 @@ typedef std::vector DebugObjectCache; + V(int, last_console_context_id, 0) \ + V(v8_inspector::V8Inspector*, inspector, nullptr) \ + V(bool, next_v8_call_is_safe_for_termination, false) \ +- V(bool, only_terminate_in_safe_scope, false) ++ V(bool, only_terminate_in_safe_scope, false) \ ++ V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info) + + #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ + inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ +diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc +index 75af3f6d98..e08bec375e 100644 +--- a/test/cctest/test-cpu-profiler.cc ++++ b/test/cctest/test-cpu-profiler.cc +@@ -40,6 +40,7 @@ + #include "src/objects-inl.h" + #include "src/profiler/cpu-profiler-inl.h" + #include "src/profiler/profiler-listener.h" ++#include "src/source-position-table.h" + #include "src/utils.h" + #include "test/cctest/cctest.h" + #include "test/cctest/profiler-extension.h" +@@ -2544,6 +2545,61 @@ TEST(MultipleProfilers) { + profiler2->StopProfiling("2"); + } + ++int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source) { ++ i::Handle function = i::Handle::cast( ++ v8::Utils::OpenHandle(*CompileRun(source))); ++ if (function->IsInterpreted()) return -1; ++ i::Handle code(function->code(), isolate); ++ i::SourcePositionTableIterator iterator( ++ ByteArray::cast(code->source_position_table())); ++ int count = 0; ++ while (!iterator.done()) { ++ count++; ++ iterator.Advance(); ++ } ++ return count; ++} ++ ++UNINITIALIZED_TEST(DetailedSourcePositionAPI) { ++ i::FLAG_detailed_line_info = false; ++ i::FLAG_allow_natives_syntax = true; ++ v8::Isolate::CreateParams create_params; ++ create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); ++ v8::Isolate* isolate = v8::Isolate::New(create_params); ++ ++ const char* source = ++ "function fib(i) {" ++ " if (i <= 1) return 1; " ++ " return fib(i - 1) +" ++ " fib(i - 2);" ++ "}" ++ "fib(5);" ++ "%OptimizeFunctionOnNextCall(fib);" ++ "fib(5);" ++ "fib"; ++ { ++ v8::Isolate::Scope isolate_scope(isolate); ++ v8::HandleScope handle_scope(isolate); ++ v8::Local context = v8::Context::New(isolate); ++ v8::Context::Scope context_scope(context); ++ i::Isolate* i_isolate = reinterpret_cast(isolate); ++ ++ CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo()); ++ ++ int non_detailed_positions = GetSourcePositionEntryCount(i_isolate, source); ++ ++ v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); ++ CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo()); ++ ++ int detailed_positions = GetSourcePositionEntryCount(i_isolate, source); ++ ++ CHECK((non_detailed_positions == -1 && detailed_positions == -1) || ++ non_detailed_positions < detailed_positions); ++ } ++ ++ isolate->Dispose(); ++} ++ + } // namespace test_cpu_profiler + } // namespace internal + } // namespace v8 +-- +2.14.3 (Apple Git-98) + diff --git a/patches/common/v8/0004-deps-cherry-pick-88f8fe1-from-upstream-V8.patch b/patches/common/v8/0004-deps-cherry-pick-88f8fe1-from-upstream-V8.patch new file mode 100644 index 000000000000..ba162d994d68 --- /dev/null +++ b/patches/common/v8/0004-deps-cherry-pick-88f8fe1-from-upstream-V8.patch @@ -0,0 +1,352 @@ +From 3d6d9749c273d8bbd19508a9f294cfedf44d01e2 Mon Sep 17 00:00:00 2001 +From: Yang Guo +Date: Tue, 20 Nov 2018 08:59:38 +0100 +Subject: [PATCH 4/4] deps: cherry-pick 88f8fe1 from upstream V8 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Original commit message: + + Fix collection iterator preview with deleted entries + + We used to assume that we know the remaining entries returned by the + iterator based on the current index. However, that is not accurate, + since entries skipped by the current index could be deleted. + + In the new approach, we allocate conservatively and shrink the result. + + R=neis@chromium.org + + Bug: v8:8433 + Change-Id: I38a3004dc3af292daabb454bb76f38d65ef437e8 + Reviewed-on: https://chromium-review.googlesource.com/c/1325966 + Commit-Queue: Yang Guo + Reviewed-by: Georg Neis + Cr-Commit-Position: refs/heads/master@{#57360} + +Refs: https://github.com/v8/v8/commit/88f8fe19a863c6392bd296faf86c06eff2a41bc1 + +PR-URL: https://github.com/nodejs/node/pull/24514 +Refs: https://github.com/nodejs/node/issues/24053 +Reviewed-By: Michaël Zasso +Reviewed-By: Anna Henningsen +Reviewed-By: Gus Caplan +Reviewed-By: Joyee Cheung +--- + src/api.cc | 52 ++++++------ + test/cctest/test-api.cc | 214 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 241 insertions(+), 25 deletions(-) + +diff --git a/src/api.cc b/src/api.cc +index 161538638b..64676f06c1 100644 +--- a/src/api.cc ++++ b/src/api.cc +@@ -7033,30 +7033,30 @@ i::Handle MapAsArray(i::Isolate* isolate, i::Object* table_obj, + i::Factory* factory = isolate->factory(); + i::Handle table(i::OrderedHashMap::cast(table_obj), + isolate); +- if (offset >= table->NumberOfElements()) return factory->NewJSArray(0); +- int length = (table->NumberOfElements() - offset) * +- (kind == MapAsArrayKind::kEntries ? 2 : 1); +- i::Handle result = factory->NewFixedArray(length); ++ const bool collect_keys = ++ kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kKeys; ++ const bool collect_values = ++ kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kValues; ++ int capacity = table->UsedCapacity(); ++ int max_length = ++ (capacity - offset) * ((collect_keys && collect_values) ? 2 : 1); ++ i::Handle result = factory->NewFixedArray(max_length); + int result_index = 0; + { + i::DisallowHeapAllocation no_gc; +- int capacity = table->UsedCapacity(); + i::Oddball* the_hole = i::ReadOnlyRoots(isolate).the_hole_value(); +- for (int i = 0; i < capacity; ++i) { ++ for (int i = offset; i < capacity; ++i) { + i::Object* key = table->KeyAt(i); + if (key == the_hole) continue; +- if (offset-- > 0) continue; +- if (kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kKeys) { +- result->set(result_index++, key); +- } +- if (kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kValues) { +- result->set(result_index++, table->ValueAt(i)); +- } ++ if (collect_keys) result->set(result_index++, key); ++ if (collect_values) result->set(result_index++, table->ValueAt(i)); + } + } +- DCHECK_EQ(result_index, result->length()); +- DCHECK_EQ(result_index, length); +- return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, length); ++ DCHECK_GE(max_length, result_index); ++ if (result_index == 0) return factory->NewJSArray(0); ++ result->Shrink(isolate, result_index); ++ return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, ++ result_index); + } + + } // namespace +@@ -7141,24 +7141,26 @@ i::Handle SetAsArray(i::Isolate* isolate, i::Object* table_obj, + i::Factory* factory = isolate->factory(); + i::Handle table(i::OrderedHashSet::cast(table_obj), + isolate); +- int length = table->NumberOfElements() - offset; +- if (length <= 0) return factory->NewJSArray(0); +- i::Handle result = factory->NewFixedArray(length); ++ // Elements skipped by |offset| may already be deleted. ++ int capacity = table->UsedCapacity(); ++ int max_length = capacity - offset; ++ if (max_length == 0) return factory->NewJSArray(0); ++ i::Handle result = factory->NewFixedArray(max_length); + int result_index = 0; + { + i::DisallowHeapAllocation no_gc; +- int capacity = table->UsedCapacity(); + i::Oddball* the_hole = i::ReadOnlyRoots(isolate).the_hole_value(); +- for (int i = 0; i < capacity; ++i) { ++ for (int i = offset; i < capacity; ++i) { + i::Object* key = table->KeyAt(i); + if (key == the_hole) continue; +- if (offset-- > 0) continue; + result->set(result_index++, key); + } + } +- DCHECK_EQ(result_index, result->length()); +- DCHECK_EQ(result_index, length); +- return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, length); ++ DCHECK_GE(max_length, result_index); ++ if (result_index == 0) return factory->NewJSArray(0); ++ result->Shrink(isolate, result_index); ++ return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, ++ result_index); + } + } // namespace + +diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc +index 0d92508d24..9bf7870f75 100644 +--- a/test/cctest/test-api.cc ++++ b/test/cctest/test-api.cc +@@ -28852,3 +28852,217 @@ TEST(TestGetEmbeddedCodeRange) { + CHECK_EQ(0, builtins_range.length_in_bytes); + } + } ++ ++TEST(PreviewSetIteratorEntriesWithDeleted) { ++ LocalContext env; ++ v8::HandleScope handle_scope(env->GetIsolate()); ++ v8::Local context = env.local(); ++ ++ { ++ // Create set, delete entry, create iterator, preview. ++ v8::Local iterator = ++ CompileRun("var set = new Set([1,2,3]); set.delete(1); set.keys()") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(2, entries->Length()); ++ CHECK_EQ(2, entries->Get(context, 0) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ CHECK_EQ(3, entries->Get(context, 1) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ { ++ // Create set, create iterator, delete entry, preview. ++ v8::Local iterator = ++ CompileRun("var set = new Set([1,2,3]); set.keys()") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("set.delete(1);"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(2, entries->Length()); ++ CHECK_EQ(2, entries->Get(context, 0) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ CHECK_EQ(3, entries->Get(context, 1) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ { ++ // Create set, create iterator, delete entry, iterate, preview. ++ v8::Local iterator = ++ CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("set.delete(1); it.next();"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(1, entries->Length()); ++ CHECK_EQ(3, entries->Get(context, 0) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ { ++ // Create set, create iterator, delete entry, iterate until empty, preview. ++ v8::Local iterator = ++ CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("set.delete(1); it.next(); it.next();"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(0, entries->Length()); ++ } ++ { ++ // Create set, create iterator, delete entry, iterate, trigger rehash, ++ // preview. ++ v8::Local iterator = ++ CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("set.delete(1); it.next();"); ++ CompileRun("for (var i = 4; i < 20; i++) set.add(i);"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(17, entries->Length()); ++ for (uint32_t i = 0; i < 17; i++) { ++ CHECK_EQ(i + 3, entries->Get(context, i) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ } ++} ++ ++TEST(PreviewMapIteratorEntriesWithDeleted) { ++ LocalContext env; ++ v8::HandleScope handle_scope(env->GetIsolate()); ++ v8::Local context = env.local(); ++ ++ { ++ // Create map, delete entry, create iterator, preview. ++ v8::Local iterator = CompileRun( ++ "var map = new Map();" ++ "var key = {}; map.set(key, 1);" ++ "map.set({}, 2); map.set({}, 3);" ++ "map.delete(key);" ++ "map.values()") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(2, entries->Length()); ++ CHECK_EQ(2, entries->Get(context, 0) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ CHECK_EQ(3, entries->Get(context, 1) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ { ++ // Create map, create iterator, delete entry, preview. ++ v8::Local iterator = CompileRun( ++ "var map = new Map();" ++ "var key = {}; map.set(key, 1);" ++ "map.set({}, 2); map.set({}, 3);" ++ "map.values()") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("map.delete(key);"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(2, entries->Length()); ++ CHECK_EQ(2, entries->Get(context, 0) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ CHECK_EQ(3, entries->Get(context, 1) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ { ++ // Create map, create iterator, delete entry, iterate, preview. ++ v8::Local iterator = CompileRun( ++ "var map = new Map();" ++ "var key = {}; map.set(key, 1);" ++ "map.set({}, 2); map.set({}, 3);" ++ "var it = map.values(); it") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("map.delete(key); it.next();"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(1, entries->Length()); ++ CHECK_EQ(3, entries->Get(context, 0) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ { ++ // Create map, create iterator, delete entry, iterate until empty, preview. ++ v8::Local iterator = CompileRun( ++ "var map = new Map();" ++ "var key = {}; map.set(key, 1);" ++ "map.set({}, 2); map.set({}, 3);" ++ "var it = map.values(); it") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("map.delete(key); it.next(); it.next();"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(0, entries->Length()); ++ } ++ { ++ // Create map, create iterator, delete entry, iterate, trigger rehash, ++ // preview. ++ v8::Local iterator = CompileRun( ++ "var map = new Map();" ++ "var key = {}; map.set(key, 1);" ++ "map.set({}, 2); map.set({}, 3);" ++ "var it = map.values(); it") ++ ->ToObject(context) ++ .ToLocalChecked(); ++ CompileRun("map.delete(key); it.next();"); ++ CompileRun("for (var i = 4; i < 20; i++) map.set({}, i);"); ++ bool is_key; ++ v8::Local entries = ++ iterator->PreviewEntries(&is_key).ToLocalChecked(); ++ CHECK(!is_key); ++ CHECK_EQ(17, entries->Length()); ++ for (uint32_t i = 0; i < 17; i++) { ++ CHECK_EQ(i + 3, entries->Get(context, i) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust()); ++ } ++ } ++} +-- +2.14.3 (Apple Git-98) + diff --git a/patches/common/v8/add_realloc.patch b/patches/common/v8/add_realloc.patch index 5c72147d8075..d94e918690c3 100644 --- a/patches/common/v8/add_realloc.patch +++ b/patches/common/v8/add_realloc.patch @@ -12,10 +12,10 @@ when we override ReallocateBufferMemory, so we therefore need to implement Realloc on the v8 side. diff --git a/include/v8.h b/include/v8.h -index a83305560c2ea33d4a6247d76655e83c7a14b0ca..fa3a4dd82c0deeaddba0a84e8bf2841e04bc8483 100644 +index a4bbe1b0c43d665a6b6c4e6c46205c32eac9548b..b2301cd8d07c1ef57e77cedab920a43f0b498597 100644 --- a/include/v8.h +++ b/include/v8.h -@@ -4604,6 +4604,13 @@ class V8_EXPORT ArrayBuffer : public Object { +@@ -4486,6 +4486,13 @@ class V8_EXPORT ArrayBuffer : public Object { */ virtual void* AllocateUninitialized(size_t length) = 0; @@ -30,10 +30,10 @@ index a83305560c2ea33d4a6247d76655e83c7a14b0ca..fa3a4dd82c0deeaddba0a84e8bf2841e * Free the memory block of size |length|, pointed to by |data|. * That memory is guaranteed to be previously allocated by |Allocate|. diff --git a/src/api.cc b/src/api.cc -index 4eb31a447c3d2dbce8ddaffb777b799ec28c2f8c..809bbe52178a3f8cbcf0b6eb81fba0910c1fb0e6 100644 +index 3f62a23d43c1c82c273e379e78fd0a4292cf4a20..2863b73e0677b666040766fef638abbc6fc95b8c 100644 --- a/src/api.cc +++ b/src/api.cc -@@ -508,6 +508,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { +@@ -488,6 +488,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { i::V8::SetSnapshotBlob(snapshot_blob); } diff --git a/patches/common/v8/array_buffer.patch b/patches/common/v8/array_buffer.patch index 07b22192a8d8..45a6abd017d5 100644 --- a/patches/common/v8/array_buffer.patch +++ b/patches/common/v8/array_buffer.patch @@ -5,10 +5,10 @@ Subject: array_buffer.patch diff --git a/include/v8.h b/include/v8.h -index fa3a4dd82c0deeaddba0a84e8bf2841e04bc8483..3070f4aa50eed8722805feaf8d9b9db0d68fbbbf 100644 +index b2301cd8d07c1ef57e77cedab920a43f0b498597..6934a9c3838641446fa96a8ab48abed4cfc1841c 100644 --- a/include/v8.h +++ b/include/v8.h -@@ -7737,6 +7737,9 @@ class V8_EXPORT Isolate { +@@ -7653,6 +7653,9 @@ class V8_EXPORT Isolate { */ void SetIdle(bool is_idle); @@ -19,10 +19,10 @@ index fa3a4dd82c0deeaddba0a84e8bf2841e04bc8483..3070f4aa50eed8722805feaf8d9b9db0 bool InContext(); diff --git a/src/api.cc b/src/api.cc -index 809bbe52178a3f8cbcf0b6eb81fba0910c1fb0e6..c1f863d148243d3988a70959fd91a37788137393 100644 +index 2863b73e0677b666040766fef638abbc6fc95b8c..8d83474bcd0ed257b8f387d7996085c605326236 100644 --- a/src/api.cc +++ b/src/api.cc -@@ -8107,6 +8107,13 @@ void Isolate::SetIdle(bool is_idle) { +@@ -7984,6 +7984,13 @@ void Isolate::SetIdle(bool is_idle) { isolate->SetIdle(is_idle); } diff --git a/patches/common/v8/build-torque-with-x64-toolchain-on-arm.patch b/patches/common/v8/build-torque-with-x64-toolchain-on-arm.patch index 771f0f7b6894..acde23279bd4 100644 --- a/patches/common/v8/build-torque-with-x64-toolchain-on-arm.patch +++ b/patches/common/v8/build-torque-with-x64-toolchain-on-arm.patch @@ -1,28 +1,37 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aleksei Kuzmin -Date: Mon, 22 Oct 2018 10:47:13 -0700 +From: deepak1556 +Date: Fri, 4 Jan 2019 15:50:24 +0530 Subject: build-torque-with-x64-toolchain-on-arm.patch torque binary has to be run during the build. diff --git a/BUILD.gn b/BUILD.gn -index c1b08958b500da1910a8067198cdec7650534f20..78e672e18eff27a3777bd0c0adc94e88a6eb126a 100644 +index d40848056235b9a8307533c8b1e238aecf18207d..d8db6363b8560b5c4a1595437e59edf1c6ec3974 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -914,7 +914,8 @@ action("run_torque") { - # is the target toolchain and, hence, can't be used. - v8_torque_toolchain = v8_snapshot_toolchain - if (host_cpu == "x64" && -- (v8_current_cpu == "mips" || v8_current_cpu == "mips64")) { -+ (v8_current_cpu == "mips" || v8_current_cpu == "mips64" || -+ v8_current_cpu == "arm" || v8_current_cpu == "arm64")) { - v8_torque_toolchain = "//build/toolchain/linux:clang_x64" - } - -@@ -3256,7 +3257,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { +@@ -170,7 +170,8 @@ declare_args() { + + v8_generator_toolchain = v8_snapshot_toolchain + if (host_cpu == "x64" && +- (v8_current_cpu == "mips" || v8_current_cpu == "mips64")) { ++ (v8_current_cpu == "mips" || v8_current_cpu == "mips64" || ++ v8_current_cpu == "arm" || v8_current_cpu == "arm64")) { + v8_generator_toolchain = "//build/toolchain/linux:clang_x64" + } + +@@ -3340,7 +3341,7 @@ if (v8_monolithic) { + # Executables + # + +-if (current_toolchain == v8_generator_toolchain) { ++if (current_toolchain == current_toolchain) { + v8_executable("bytecode_builtins_list_generator") { + visibility = [ ":*" ] # Only targets in this file can depend on this. + +@@ -3384,7 +3385,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { } } - + -if (current_toolchain == v8_snapshot_toolchain) { +if (current_toolchain == current_toolchain) { v8_executable("torque") { diff --git a/patches/common/v8/build_gn.patch b/patches/common/v8/build_gn.patch index 6b9329d31933..1d3a821235e3 100644 --- a/patches/common/v8/build_gn.patch +++ b/patches/common/v8/build_gn.patch @@ -5,10 +5,10 @@ Subject: build_gn.patch diff --git a/BUILD.gn b/BUILD.gn -index c6a58776cd6a81cf5653b94a8db1a04dd7e54045..ac74cdec115b6cc54d05817f063153628cf5e9fe 100644 +index 83f1fdb0bf75dd5f7efa490cd5bd1221e31748ed..5489b943f1d8bb8ffc02cabf4e0a15788c7d4e48 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -221,7 +221,7 @@ config("internal_config") { +@@ -226,7 +226,7 @@ config("internal_config") { defines = [] @@ -17,7 +17,7 @@ index c6a58776cd6a81cf5653b94a8db1a04dd7e54045..ac74cdec115b6cc54d05817f06315362 defines += [ "BUILDING_V8_SHARED" ] } } -@@ -3245,6 +3245,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { +@@ -3363,6 +3363,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { configs = [ ":internal_config" ] diff --git a/patches/common/v8/dcheck.patch b/patches/common/v8/dcheck.patch index 966c4cb9d9bd..b40447c82870 100644 --- a/patches/common/v8/dcheck.patch +++ b/patches/common/v8/dcheck.patch @@ -5,10 +5,10 @@ Subject: dcheck.patch diff --git a/src/api.cc b/src/api.cc -index c1f863d148243d3988a70959fd91a37788137393..8dca7ec88e59c775da5cf7e30721d064f349c634 100644 +index 8d83474bcd0ed257b8f387d7996085c605326236..9be405b6c4822da81e48daf96169450be3e4356f 100644 --- a/src/api.cc +++ b/src/api.cc -@@ -8649,7 +8649,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -8540,7 +8540,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { void Isolate::RunMicrotasks() { @@ -18,10 +18,10 @@ index c1f863d148243d3988a70959fd91a37788137393..8dca7ec88e59c775da5cf7e30721d064 } diff --git a/src/heap/heap.cc b/src/heap/heap.cc -index 2ec30635be2b75fe1e308068b6e16b9568472ead..7058396f3009fec5635a01961368ab14c287d882 100644 +index b509d211425fc755f8cecd4727c050d47d7f87f7..36e5023a77b46305b70196cf3c25a8c625dae96b 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc -@@ -5035,9 +5035,9 @@ void Heap::TearDown() { +@@ -4696,9 +4696,9 @@ void Heap::TearDown() { void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type, void* data) { DCHECK_NOT_NULL(callback); diff --git a/patches/common/v8/deps_backport_detailed_line_info_for_cpu_profiler.patch b/patches/common/v8/deps_backport_detailed_line_info_for_cpu_profiler.patch index 27e2bf92c8aa..0346893291ea 100644 --- a/patches/common/v8/deps_backport_detailed_line_info_for_cpu_profiler.patch +++ b/patches/common/v8/deps_backport_detailed_line_info_for_cpu_profiler.patch @@ -20,10 +20,10 @@ Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater diff --git a/src/flag-definitions.h b/src/flag-definitions.h -index 69ec7472bba0f9a04b32c1ce135083cc82456b0a..4f8b5780c832d2faf27340cffe32b298e3b0b04d 100644 +index 170a777c724e9daca0aee44b63455ade724426e9..5a7664474f15fa9a466c536d2ac554e8f485b32d 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h -@@ -1267,7 +1267,7 @@ DEFINE_BOOL(log_function_events, false, +@@ -1266,7 +1266,7 @@ DEFINE_BOOL(log_function_events, false, DEFINE_BOOL(prof, false, "Log statistical profiling information (implies --log-code).") diff --git a/patches/common/v8/deps_cherry-pick_2363cdf_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_2363cdf_from_upstream_v8.patch deleted file mode 100644 index 0a8cce1de5cd..000000000000 --- a/patches/common/v8/deps_cherry-pick_2363cdf_from_upstream_v8.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ali Ijaz Sheikh -Date: Tue, 11 Sep 2018 15:40:28 -0700 -Subject: deps: cherry-pick 2363cdf from upstream V8 - -Original commit message: - - [tracing] do not add traces when disabled - - https://github.com/nodejs/node/issues/21038 - - Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8 - Reviewed-on: https://chromium-review.googlesource.com/1217726 - Commit-Queue: Ali Ijaz Sheikh - Reviewed-by: Yang Guo - Cr-Commit-Position: refs/heads/master@{#55809} - -Refs: https://github.com/v8/v8/commit/2363cdfefeb643285cbe8593b7c17d80e5d06cd9 -PR-URL: https://github.com/nodejs/node/pull/22812 -Reviewed-By: Refael Ackermann -Reviewed-By: James M Snell -Reviewed-By: Anna Henningsen -Reviewed-By: Eugene Ostroukhov - -diff --git a/src/libplatform/tracing/tracing-controller.cc b/src/libplatform/tracing/tracing-controller.cc -index daaebc291a5a3f566fcd65cfcced0f5c3725fe08..aa8789fa07c167ecce97dd787782ce684d3a7c38 100644 ---- a/src/libplatform/tracing/tracing-controller.cc -+++ b/src/libplatform/tracing/tracing-controller.cc -@@ -77,13 +77,15 @@ uint64_t TracingController::AddTraceEvent( - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags) { -- uint64_t handle; -- TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); -- if (trace_object) { -- trace_object->Initialize( -- phase, category_enabled_flag, name, scope, id, bind_id, num_args, -- arg_names, arg_types, arg_values, arg_convertables, flags, -- CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds()); -+ uint64_t handle = 0; -+ if (mode_ != DISABLED) { -+ TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); -+ if (trace_object) { -+ trace_object->Initialize( -+ phase, category_enabled_flag, name, scope, id, bind_id, num_args, -+ arg_names, arg_types, arg_values, arg_convertables, flags, -+ CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds()); -+ } - } - return handle; - } -@@ -95,13 +97,15 @@ uint64_t TracingController::AddTraceEventWithTimestamp( - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags, int64_t timestamp) { -- uint64_t handle; -- TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); -- if (trace_object) { -- trace_object->Initialize(phase, category_enabled_flag, name, scope, id, -- bind_id, num_args, arg_names, arg_types, -- arg_values, arg_convertables, flags, timestamp, -- CurrentCpuTimestampMicroseconds()); -+ uint64_t handle = 0; -+ if (mode_ != DISABLED) { -+ TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); -+ if (trace_object) { -+ trace_object->Initialize(phase, category_enabled_flag, name, scope, id, -+ bind_id, num_args, arg_names, arg_types, -+ arg_values, arg_convertables, flags, timestamp, -+ CurrentCpuTimestampMicroseconds()); -+ } - } - return handle; - } diff --git a/patches/common/v8/deps_provide_more_v8_backwards_compatibility.patch b/patches/common/v8/deps_provide_more_v8_backwards_compatibility.patch index ef2c9ad31843..a51af7ce0be1 100644 --- a/patches/common/v8/deps_provide_more_v8_backwards_compatibility.patch +++ b/patches/common/v8/deps_provide_more_v8_backwards_compatibility.patch @@ -22,10 +22,10 @@ Reviewed-By: Yang Guo Reviewed-By: Michaël Zasso diff --git a/include/v8.h b/include/v8.h -index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbbadb1e3210 100644 +index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0bf000585f 100644 --- a/include/v8.h +++ b/include/v8.h -@@ -1123,6 +1123,10 @@ class V8_EXPORT PrimitiveArray { +@@ -999,6 +999,10 @@ class V8_EXPORT PrimitiveArray { public: static Local New(Isolate* isolate, int length); int Length() const; @@ -36,7 +36,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba void Set(Isolate* isolate, int index, Local item); Local Get(Isolate* isolate, int index); }; -@@ -1829,6 +1833,8 @@ class V8_EXPORT StackTrace { +@@ -1710,6 +1714,8 @@ class V8_EXPORT StackTrace { /** * Returns a StackFrame at a particular index. */ @@ -45,7 +45,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba Local GetFrame(Isolate* isolate, uint32_t index) const; /** -@@ -2537,6 +2543,13 @@ class V8_EXPORT Value : public Data { +@@ -2423,6 +2429,13 @@ class V8_EXPORT Value : public Data { V8_DEPRECATE_SOON("Use maybe version", Local ToInt32(Isolate* isolate) const); @@ -59,7 +59,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba /** * Attempts to convert a string to an array index. * Returns an empty handle if the conversion fails. -@@ -2552,7 +2565,14 @@ class V8_EXPORT Value : public Data { +@@ -2442,7 +2455,14 @@ class V8_EXPORT Value : public Data { Local context) const; V8_WARN_UNUSED_RESULT Maybe Int32Value(Local context) const; @@ -74,7 +74,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba V8_WARN_UNUSED_RESULT Maybe Equals(Local context, Local that) const; bool StrictEquals(Local that) const; -@@ -2659,6 +2679,8 @@ class V8_EXPORT String : public Name { +@@ -2549,6 +2569,8 @@ class V8_EXPORT String : public Name { * Returns the number of bytes in the UTF-8 encoded * representation of this string. */ @@ -83,7 +83,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba int Utf8Length(Isolate* isolate) const; /** -@@ -2715,12 +2737,23 @@ class V8_EXPORT String : public Name { +@@ -2605,12 +2627,23 @@ class V8_EXPORT String : public Name { // 16-bit character codes. int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, int options = NO_OPTIONS) const; @@ -99,15 +99,15 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba + const); // UTF-8 encoded characters. int WriteUtf8(Isolate* isolate, char* buffer, int length = -1, - int* nchars_ref = NULL, int options = NO_OPTIONS) const; + int* nchars_ref = nullptr, int options = NO_OPTIONS) const; + V8_DEPRECATED("Use Isolate* version", + int WriteUtf8(char* buffer, int length = -1, -+ int* nchars_ref = NULL, ++ int* nchars_ref = nullptr, + int options = NO_OPTIONS) const); /** * A zero length string. -@@ -2884,6 +2917,9 @@ class V8_EXPORT String : public Name { +@@ -2812,6 +2845,9 @@ class V8_EXPORT String : public Name { */ static Local Concat(Isolate* isolate, Local left, Local right); @@ -117,7 +117,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba /** * Creates a new external string using the data defined in the given -@@ -2952,6 +2988,8 @@ class V8_EXPORT String : public Name { +@@ -2880,6 +2916,8 @@ class V8_EXPORT String : public Name { */ class V8_EXPORT Utf8Value { public: @@ -126,7 +126,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba Utf8Value(Isolate* isolate, Local obj); ~Utf8Value(); char* operator*() { return str_; } -@@ -2975,6 +3013,7 @@ class V8_EXPORT String : public Name { +@@ -2903,6 +2941,7 @@ class V8_EXPORT String : public Name { */ class V8_EXPORT Value { public: @@ -134,7 +134,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba Value(Isolate* isolate, Local obj); ~Value(); uint16_t* operator*() { return str_; } -@@ -5224,6 +5263,8 @@ class V8_EXPORT BooleanObject : public Object { +@@ -5140,6 +5179,8 @@ class V8_EXPORT BooleanObject : public Object { class V8_EXPORT StringObject : public Object { public: static Local New(Isolate* isolate, Local value); @@ -143,7 +143,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba Local ValueOf() const; -@@ -10226,6 +10267,30 @@ template Value* Value::Cast(T* value) { +@@ -9999,6 +10040,30 @@ template Value* Value::Cast(T* value) { } @@ -175,10 +175,10 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba #ifdef V8_ENABLE_CHECKS CheckCast(value); diff --git a/src/api.cc b/src/api.cc -index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ededb6a30a 100644 +index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0ee576616 100644 --- a/src/api.cc +++ b/src/api.cc -@@ -2161,6 +2161,10 @@ int PrimitiveArray::Length() const { +@@ -2162,6 +2162,10 @@ int PrimitiveArray::Length() const { return array->length(); } @@ -189,7 +189,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed void PrimitiveArray::Set(Isolate* v8_isolate, int index, Local item) { i::Isolate* isolate = reinterpret_cast(v8_isolate); -@@ -2174,6 +2178,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index, +@@ -2175,6 +2179,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index, array->set(index, *i_item); } @@ -200,7 +200,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed Local PrimitiveArray::Get(Isolate* v8_isolate, int index) { i::Isolate* isolate = reinterpret_cast(v8_isolate); i::Handle array = Utils::OpenHandle(this); -@@ -2904,6 +2912,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { +@@ -2909,6 +2917,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { // --- S t a c k T r a c e --- @@ -211,7 +211,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed Local StackTrace::GetFrame(Isolate* v8_isolate, uint32_t index) const { i::Isolate* isolate = reinterpret_cast(v8_isolate); -@@ -3880,6 +3892,36 @@ void v8::RegExp::CheckCast(v8::Value* that) { +@@ -3888,6 +3900,36 @@ void v8::RegExp::CheckCast(v8::Value* that) { } @@ -248,7 +248,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed Maybe Value::BooleanValue(Local context) const { i::Isolate* isolate = reinterpret_cast(context->GetIsolate()); return Just(Utils::OpenHandle(this)->BooleanValue(isolate)); -@@ -3968,6 +4010,12 @@ MaybeLocal Value::ToArrayIndex(Local context) const { +@@ -3976,6 +4018,12 @@ MaybeLocal Value::ToArrayIndex(Local context) const { } @@ -261,7 +261,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed Maybe Value::Equals(Local context, Local that) const { i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate(); auto self = Utils::OpenHandle(this); -@@ -5299,6 +5347,10 @@ bool String::ContainsOnlyOneByte() const { +@@ -5312,6 +5360,10 @@ bool String::ContainsOnlyOneByte() const { return helper.Check(*str); } @@ -272,7 +272,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed int String::Utf8Length(Isolate* isolate) const { i::Handle str = Utils::OpenHandle(this); str = i::String::Flatten(reinterpret_cast(isolate), str); -@@ -5522,6 +5574,14 @@ static bool RecursivelySerializeToUtf8(i::String* current, +@@ -5535,6 +5587,14 @@ static bool RecursivelySerializeToUtf8(i::String* current, return true; } @@ -287,7 +287,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity, int* nchars_ref, int options) const { i::Handle str = Utils::OpenHandle(this); -@@ -5589,6 +5649,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string, +@@ -5602,6 +5662,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string, } @@ -306,7 +306,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, int length, int options) const { return WriteHelper(reinterpret_cast(isolate), this, buffer, -@@ -6536,6 +6608,11 @@ MaybeLocal String::NewFromTwoByte(Isolate* isolate, +@@ -6549,6 +6621,11 @@ MaybeLocal String::NewFromTwoByte(Isolate* isolate, return result; } @@ -318,7 +318,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed Local v8::String::Concat(Isolate* v8_isolate, Local left, Local right) { i::Isolate* isolate = reinterpret_cast(v8_isolate); -@@ -6762,6 +6839,11 @@ bool v8::BooleanObject::ValueOf() const { +@@ -6774,6 +6851,11 @@ bool v8::BooleanObject::ValueOf() const { } @@ -330,7 +330,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed Local v8::StringObject::New(Isolate* v8_isolate, Local value) { i::Handle string = Utils::OpenHandle(*value); -@@ -8904,6 +8986,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) { +@@ -8915,6 +8997,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) { return isolate->IsRunningMicrotasks(); } @@ -340,7 +340,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local obj) : str_(nullptr), length_(0) { if (obj.IsEmpty()) return; -@@ -8923,6 +9008,9 @@ String::Utf8Value::~Utf8Value() { +@@ -8934,6 +9019,9 @@ String::Utf8Value::~Utf8Value() { i::DeleteArray(str_); } diff --git a/patches/common/v8/deps_revert_9136dd8088a9_from_upstream_v8.patch b/patches/common/v8/deps_revert_9136dd8088a9_from_upstream_v8.patch deleted file mode 100644 index 45aa32c86a94..000000000000 --- a/patches/common/v8/deps_revert_9136dd8088a9_from_upstream_v8.patch +++ /dev/null @@ -1,409 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anna Henningsen -Date: Thu, 4 Oct 2018 14:38:59 -0700 -Subject: deps: revert 9136dd8088a9 from upstream V8 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Reverting this enables us to provide slower, but longer-lasting -replacements for the deprecated APIs. - -Original commit message: - - Put back deleted V8_DEPRECATE_SOON methods - - This partially reverts - https://chromium-review.googlesource.com/c/v8/v8/+/1177861, - which deleted many V8_DEPRECATE_SOON methods rather than moving them to - V8_DEPRECATED first. This puts them back and marks them V8_DEPRECATED. - - Note V8_DEPRECATED that were deleted in the same CL stay deleted. - - NOTRY=true - NOPRESUBMIT=true - NOTREECHECKS=true - - Bug: v8:7786, v8:8240 - Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng - Change-Id: I00330036d957f98dab403465b25e30d8382aac22 - Reviewed-on: https://chromium-review.googlesource.com/1251422 - Commit-Queue: Dan Elphick - Reviewed-by: Yang Guo - Reviewed-by: Michael Hablich - Cr-Commit-Position: refs/branch-heads/7.0@{#49} - Cr-Branched-From: 6e2adae6f7f8e891cfd01f3280482b20590427a6-refs/heads/7.0.276@{#1} - Cr-Branched-From: bc08a8624cbbea7a2d30071472bc73ad9544eadf-refs/heads/master@{#55424} - -Refs: https://github.com/v8/v8/commit/9136dd8088a95484b059a0301b25235510fc2882 -Refs: https://github.com/nodejs/node/issues/23122 - -PR-URL: https://github.com/nodejs/node/pull/23158 -Reviewed-By: Yang Guo -Reviewed-By: Michaël Zasso - -diff --git a/include/v8.h b/include/v8.h -index 3070f4aa50eed8722805feaf8d9b9db0d68fbbbf..784e1830edeebaf2b15eaad4230f318f91acad5f 100644 ---- a/include/v8.h -+++ b/include/v8.h -@@ -1125,10 +1125,6 @@ class V8_EXPORT PrimitiveArray { - int Length() const; - void Set(Isolate* isolate, int index, Local item); - Local Get(Isolate* isolate, int index); -- -- V8_DEPRECATED("Use Isolate version", -- void Set(int index, Local item)); -- V8_DEPRECATED("Use Isolate version", Local Get(int index)); - }; - - /** -@@ -1833,8 +1829,6 @@ class V8_EXPORT StackTrace { - /** - * Returns a StackFrame at a particular index. - */ -- V8_DEPRECATED("Use Isolate version", -- Local GetFrame(uint32_t index) const); - Local GetFrame(Isolate* isolate, uint32_t index) const; - - /** -@@ -2543,11 +2537,6 @@ class V8_EXPORT Value : public Data { - V8_DEPRECATE_SOON("Use maybe version", - Local ToInt32(Isolate* isolate) const); - -- inline V8_DEPRECATED("Use maybe version", Local ToBoolean() const); -- inline V8_DEPRECATED("Use maybe version", Local ToString() const); -- inline V8_DEPRECATED("Use maybe version", Local ToObject() const); -- inline V8_DEPRECATED("Use maybe version", Local ToInteger() const); -- - /** - * Attempts to convert a string to an array index. - * Returns an empty handle if the conversion fails. -@@ -2563,14 +2552,7 @@ class V8_EXPORT Value : public Data { - Local context) const; - V8_WARN_UNUSED_RESULT Maybe Int32Value(Local context) const; - -- V8_DEPRECATED("Use maybe version", bool BooleanValue() const); -- V8_DEPRECATED("Use maybe version", double NumberValue() const); -- V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const); -- V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const); -- V8_DEPRECATED("Use maybe version", int32_t Int32Value() const); -- - /** JS == */ -- V8_DEPRECATED("Use maybe version", bool Equals(Local that) const); - V8_WARN_UNUSED_RESULT Maybe Equals(Local context, - Local that) const; - bool StrictEquals(Local that) const; -@@ -2677,8 +2659,6 @@ class V8_EXPORT String : public Name { - * Returns the number of bytes in the UTF-8 encoded - * representation of this string. - */ -- V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const); -- - int Utf8Length(Isolate* isolate) const; - - /** -@@ -2735,23 +2715,12 @@ class V8_EXPORT String : public Name { - // 16-bit character codes. - int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, - int options = NO_OPTIONS) const; -- V8_DEPRECATED("Use Isolate* version", -- int Write(uint16_t* buffer, int start = 0, int length = -1, -- int options = NO_OPTIONS) const); - // One byte characters. - int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0, - int length = -1, int options = NO_OPTIONS) const; -- V8_DEPRECATED("Use Isolate* version", -- int WriteOneByte(uint8_t* buffer, int start = 0, -- int length = -1, int options = NO_OPTIONS) -- const); - // UTF-8 encoded characters. - int WriteUtf8(Isolate* isolate, char* buffer, int length = -1, - int* nchars_ref = NULL, int options = NO_OPTIONS) const; -- V8_DEPRECATED("Use Isolate* version", -- int WriteUtf8(char* buffer, int length = -1, -- int* nchars_ref = NULL, int options = NO_OPTIONS) -- const); - - /** - * A zero length string. -@@ -2915,9 +2884,6 @@ class V8_EXPORT String : public Name { - */ - static Local Concat(Isolate* isolate, Local left, - Local right); -- static V8_DEPRECATED("Use Isolate* version", -- Local Concat(Local left, -- Local right)); - - /** - * Creates a new external string using the data defined in the given -@@ -5258,8 +5224,6 @@ class V8_EXPORT BooleanObject : public Object { - class V8_EXPORT StringObject : public Object { - public: - static Local New(Isolate* isolate, Local value); -- static V8_DEPRECATED("Use Isolate* version", -- Local New(Local value)); - - Local ValueOf() const; - -@@ -10261,25 +10225,6 @@ template Value* Value::Cast(T* value) { - return static_cast(value); - } - --Local Value::ToBoolean() const { -- return ToBoolean(Isolate::GetCurrent()->GetCurrentContext()) -- .FromMaybe(Local()); --} -- --Local Value::ToString() const { -- return ToString(Isolate::GetCurrent()->GetCurrentContext()) -- .FromMaybe(Local()); --} -- --Local Value::ToObject() const { -- return ToObject(Isolate::GetCurrent()->GetCurrentContext()) -- .FromMaybe(Local()); --} -- --Local Value::ToInteger() const { -- return ToInteger(Isolate::GetCurrent()->GetCurrentContext()) -- .FromMaybe(Local()); --} - - Boolean* Boolean::Cast(v8::Value* value) { - #ifdef V8_ENABLE_CHECKS -diff --git a/src/api.cc b/src/api.cc -index 8dca7ec88e59c775da5cf7e30721d064f349c634..7a53cc1370cf30c858fd87156e2eb75d4b57a60b 100644 ---- a/src/api.cc -+++ b/src/api.cc -@@ -219,28 +219,6 @@ Local ContextFromNeverReadOnlySpaceObject( - return reinterpret_cast(obj->GetIsolate())->GetCurrentContext(); - } - --// TODO(delphick): Remove this completely when the deprecated functions that use --// it are removed. --// DO NOT USE THIS IN NEW CODE! --i::Isolate* UnsafeIsolateFromHeapObject(i::Handle obj) { -- // Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to -- // temporarily allow isolate access from read-only space objects. -- i::MemoryChunk* chunk = i::MemoryChunk::FromHeapObject(*obj); -- return chunk->heap()->isolate(); --} -- --// TODO(delphick): Remove this completely when the deprecated functions that use --// it are removed. --// DO NOT USE THIS IN NEW CODE! --Local UnsafeContextFromHeapObject(i::Handle obj) { -- // Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to -- // temporarily allow isolate access from read-only space objects. -- i::MemoryChunk* chunk = -- i::MemoryChunk::FromHeapObject(i::HeapObject::cast(*obj)); -- return reinterpret_cast(chunk->heap()->isolate()) -- ->GetCurrentContext(); --} -- - class InternalEscapableScope : public v8::EscapableHandleScope { - public: - explicit inline InternalEscapableScope(i::Isolate* isolate) -@@ -2196,12 +2174,6 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index, - array->set(index, *i_item); - } - --void PrimitiveArray::Set(int index, Local item) { -- i::Handle array = Utils::OpenHandle(this); -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(array); -- Set(reinterpret_cast(isolate), index, item); --} -- - Local PrimitiveArray::Get(Isolate* v8_isolate, int index) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - i::Handle array = Utils::OpenHandle(this); -@@ -2214,12 +2186,6 @@ Local PrimitiveArray::Get(Isolate* v8_isolate, int index) { - return ToApiHandle(i_item); - } - --Local PrimitiveArray::Get(int index) { -- i::Handle array = Utils::OpenHandle(this); -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(array); -- return Get(reinterpret_cast(isolate), index); --} -- - Module::Status Module::GetStatus() const { - i::Handle self = Utils::OpenHandle(this); - switch (self->status()) { -@@ -2948,11 +2914,6 @@ Local StackTrace::GetFrame(Isolate* v8_isolate, - return scope.Escape(Utils::StackFrameToLocal(info)); - } - --Local StackTrace::GetFrame(uint32_t index) const { -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this)); -- return GetFrame(reinterpret_cast(isolate), index); --} -- - int StackTrace::GetFrameCount() const { - return Utils::OpenHandle(this)->length(); - } -@@ -3924,14 +3885,6 @@ Maybe Value::BooleanValue(Local context) const { - return Just(Utils::OpenHandle(this)->BooleanValue(isolate)); - } - --bool Value::BooleanValue() const { -- auto obj = Utils::OpenHandle(this); -- if (obj->IsSmi()) return *obj != i::Smi::kZero; -- DCHECK(obj->IsHeapObject()); -- i::Isolate* isolate = -- UnsafeIsolateFromHeapObject(i::Handle::cast(obj)); -- return obj->BooleanValue(isolate); --} - - Maybe Value::NumberValue(Local context) const { - auto obj = Utils::OpenHandle(this); -@@ -3945,12 +3898,6 @@ Maybe Value::NumberValue(Local context) const { - return Just(num->Number()); - } - --double Value::NumberValue() const { -- auto obj = Utils::OpenHandle(this); -- if (obj->IsNumber()) return obj->Number(); -- return NumberValue(UnsafeContextFromHeapObject(obj)) -- .FromMaybe(std::numeric_limits::quiet_NaN()); --} - - Maybe Value::IntegerValue(Local context) const { - auto obj = Utils::OpenHandle(this); -@@ -3966,17 +3913,6 @@ Maybe Value::IntegerValue(Local context) const { - return Just(NumberToInt64(*num)); - } - --int64_t Value::IntegerValue() const { -- auto obj = Utils::OpenHandle(this); -- if (obj->IsNumber()) { -- if (obj->IsSmi()) { -- return i::Smi::ToInt(*obj); -- } else { -- return static_cast(obj->Number()); -- } -- } -- return IntegerValue(UnsafeContextFromHeapObject(obj)).FromMaybe(0); --} - - Maybe Value::Int32Value(Local context) const { - auto obj = Utils::OpenHandle(this); -@@ -3991,11 +3927,6 @@ Maybe Value::Int32Value(Local context) const { - : static_cast(num->Number())); - } - --int32_t Value::Int32Value() const { -- auto obj = Utils::OpenHandle(this); -- if (obj->IsNumber()) return NumberToInt32(*obj); -- return Int32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0); --} - - Maybe Value::Uint32Value(Local context) const { - auto obj = Utils::OpenHandle(this); -@@ -4010,11 +3941,6 @@ Maybe Value::Uint32Value(Local context) const { - : static_cast(num->Number())); - } - --uint32_t Value::Uint32Value() const { -- auto obj = Utils::OpenHandle(this); -- if (obj->IsNumber()) return NumberToUint32(*obj); -- return Uint32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0); --} - - MaybeLocal Value::ToArrayIndex(Local context) const { - auto self = Utils::OpenHandle(this); -@@ -4049,19 +3975,6 @@ Maybe Value::Equals(Local context, Local that) const { - return i::Object::Equals(isolate, self, other); - } - --bool Value::Equals(Local that) const { -- auto self = Utils::OpenHandle(this); -- auto other = Utils::OpenHandle(*that); -- if (self->IsSmi() && other->IsSmi()) { -- return self->Number() == other->Number(); -- } -- if (self->IsJSObject() && other->IsJSObject()) { -- return *self == *other; -- } -- auto heap_object = self->IsSmi() ? other : self; -- auto context = UnsafeContextFromHeapObject(heap_object); -- return Equals(context, that).FromMaybe(false); --} - - bool Value::StrictEquals(Local that) const { - auto self = Utils::OpenHandle(this); -@@ -5386,11 +5299,6 @@ bool String::ContainsOnlyOneByte() const { - return helper.Check(*str); - } - --int String::Utf8Length() const { -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this)); -- return Utf8Length(reinterpret_cast(isolate)); --} -- - int String::Utf8Length(Isolate* isolate) const { - i::Handle str = Utils::OpenHandle(this); - str = i::String::Flatten(reinterpret_cast(isolate), str); -@@ -5659,14 +5567,6 @@ int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity, - return writer.CompleteWrite(write_null, nchars_ref); - } - --int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref, -- int options) const { -- i::Handle str = Utils::OpenHandle(this); -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(str); -- return WriteUtf8(reinterpret_cast(isolate), buffer, capacity, -- nchars_ref, options); --} -- - template - static inline int WriteHelper(i::Isolate* isolate, const String* string, - CharType* buffer, int start, int length, -@@ -5688,11 +5588,6 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string, - return end - start; - } - --int String::WriteOneByte(uint8_t* buffer, int start, int length, -- int options) const { -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this)); -- return WriteHelper(isolate, this, buffer, start, length, options); --} - - int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, - int length, int options) const { -@@ -5700,10 +5595,6 @@ int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, - start, length, options); - } - --int String::Write(uint16_t* buffer, int start, int length, int options) const { -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this)); -- return WriteHelper(isolate, this, buffer, start, length, options); --} - - int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length, - int options) const { -@@ -6662,12 +6553,6 @@ Local v8::String::Concat(Isolate* v8_isolate, Local left, - return Utils::ToLocal(result); - } - --Local v8::String::Concat(Local left, Local right) { -- i::Handle left_string = Utils::OpenHandle(*left); -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(left_string); -- return Concat(reinterpret_cast(isolate), left, right); --} -- - MaybeLocal v8::String::NewExternalTwoByte( - Isolate* isolate, v8::String::ExternalStringResource* resource) { - CHECK(resource && resource->data()); -@@ -6876,11 +6761,6 @@ bool v8::BooleanObject::ValueOf() const { - return jsvalue->value()->IsTrue(isolate); - } - --Local v8::StringObject::New(Local value) { -- i::Handle string = Utils::OpenHandle(*value); -- i::Isolate* isolate = UnsafeIsolateFromHeapObject(string); -- return New(reinterpret_cast(isolate), value); --} - - Local v8::StringObject::New(Isolate* v8_isolate, - Local value) { diff --git a/patches/common/v8/do_not_run_arm_arm64_mksnapshot_binaries.patch b/patches/common/v8/do_not_run_arm_arm64_mksnapshot_binaries.patch index a9e58cd7f3b1..83e68fbb6857 100644 --- a/patches/common/v8/do_not_run_arm_arm64_mksnapshot_binaries.patch +++ b/patches/common/v8/do_not_run_arm_arm64_mksnapshot_binaries.patch @@ -4,16 +4,16 @@ Date: Mon, 19 Nov 2018 18:33:56 -0500 Subject: Do not run arm/arm64 mksnapshot binaries For arm and arm64 target_arches, Chromium builds mksnapshot as an x64 binary and -as part of that build mksnapshot is executed to produce snapshot_blob.bin. -Chromium does not build native arm and arm64 binaries of mksnapshot, but -Electron does, so this patch makes sure that the build doesn't try to run +as part of that build mksnapshot is executed to produce snapshot_blob.bin. +Chromium does not build native arm and arm64 binaries of mksnapshot, but +Electron does, so this patch makes sure that the build doesn't try to run the mksnapshot binary if it was built for arm or arm64. diff --git a/BUILD.gn b/BUILD.gn -index b1194e4b828e66d8d09fac57481efe313031f3ac..c256945650c24324c28a2e17fb299a1d0c2dcd19 100644 +index 1f9dd022ac804e58263f527af5a47768c882de40..d40848056235b9a8307533c8b1e238aecf18207d 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -1247,9 +1247,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) { +@@ -1286,9 +1286,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) { ] public_deps = [ ":natives_blob", diff --git a/patches/common/v8/export_platform.patch b/patches/common/v8/export_platform.patch index 05c444bac635..e0cf08d5d466 100644 --- a/patches/common/v8/export_platform.patch +++ b/patches/common/v8/export_platform.patch @@ -6,7 +6,7 @@ Subject: export_platform.patch v8::Platform::SystemClockTimeMillis must be exported so that node::NodePlatform can call it diff --git a/include/v8-platform.h b/include/v8-platform.h -index cfeb13b65829f9e0bad2518b8c4b03a645b6223c..2b38e24e233b5ba7061fd4a3d5e49063b0165f11 100644 +index d983c30249591bd05b760dbae6a1afb413c7d021..183d77e55619970644868747fab26d250f790c3c 100644 --- a/include/v8-platform.h +++ b/include/v8-platform.h @@ -11,6 +11,7 @@ @@ -17,7 +17,7 @@ index cfeb13b65829f9e0bad2518b8c4b03a645b6223c..2b38e24e233b5ba7061fd4a3d5e49063 #include "v8config.h" // NOLINT(build/include) namespace v8 { -@@ -387,7 +388,7 @@ class Platform { +@@ -394,7 +395,7 @@ class Platform { * since epoch. Useful for implementing |CurrentClockTimeMillis| if * nothing special needed. */ diff --git a/patches/common/v8/expose_mksnapshot.patch b/patches/common/v8/expose_mksnapshot.patch index 3d9da0057396..6244457746ea 100644 --- a/patches/common/v8/expose_mksnapshot.patch +++ b/patches/common/v8/expose_mksnapshot.patch @@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch Needed in order to build mksnapshot on arm. diff --git a/BUILD.gn b/BUILD.gn -index ac74cdec115b6cc54d05817f063153628cf5e9fe..c1b08958b500da1910a8067198cdec7650534f20 100644 +index 5489b943f1d8bb8ffc02cabf4e0a15788c7d4e48..1f9dd022ac804e58263f527af5a47768c882de40 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -3237,8 +3237,6 @@ if (v8_monolithic) { +@@ -3355,8 +3355,6 @@ if (current_toolchain == v8_generator_toolchain) { if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { v8_executable("mksnapshot") { diff --git a/patches/common/v8/ostreams.patch b/patches/common/v8/ostreams.patch index ccc467d0e299..82b48e3fb4a6 100644 --- a/patches/common/v8/ostreams.patch +++ b/patches/common/v8/ostreams.patch @@ -5,10 +5,10 @@ Subject: ostreams.patch diff --git a/src/ostreams.h b/src/ostreams.h -index c6b64a1cd95b92ed37abe56d71dd6132c4ff9db4..236a73d01800f58a4f37c8abdd8df346d8fcf2c5 100644 +index 189f5384b99438f3dad1d77a0836ceb45f6ed938..83a5930d4bd690dde01749bcd88acb11d75aa0cb 100644 --- a/src/ostreams.h +++ b/src/ostreams.h -@@ -32,7 +32,7 @@ class OFStreamBase : public std::streambuf { +@@ -32,7 +32,7 @@ class V8_EXPORT_PRIVATE OFStreamBase : public std::streambuf { }; // An output stream writing to a file. @@ -16,4 +16,4 @@ index c6b64a1cd95b92ed37abe56d71dd6132c4ff9db4..236a73d01800f58a4f37c8abdd8df346 +class V8_EXPORT_PRIVATE OFStream : public NON_EXPORTED_BASE(std::ostream) { public: explicit OFStream(FILE* f); - virtual ~OFStream(); + ~OFStream() override = default; diff --git a/script/bump-version.js b/script/bump-version.js index 7354793f3667..733169ec773d 100644 --- a/script/bump-version.js +++ b/script/bump-version.js @@ -105,7 +105,7 @@ async function nextVersion (bumpType, version) { // update VERSION file with latest release info async function updateVersion (version) { - const versionPath = path.resolve(__dirname, '..', 'VERSION') + const versionPath = path.resolve(__dirname, '..', 'ELECTRON_VERSION') await writeFile(versionPath, version, 'utf8') } diff --git a/script/lib/util.py b/script/lib/util.py index f6d125f32794..391f043af69f 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -181,7 +181,7 @@ def get_electron_branding(): def get_electron_version(): SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..')) - version_file = os.path.join(SOURCE_ROOT, 'VERSION') + version_file = os.path.join(SOURCE_ROOT, 'ELECTRON_VERSION') with open(version_file) as f: return 'v' + f.read().strip() diff --git a/script/lib/version-utils.js b/script/lib/version-utils.js index ce843f329037..afebf2b6a9f7 100644 --- a/script/lib/version-utils.js +++ b/script/lib/version-utils.js @@ -51,7 +51,7 @@ async function nextBeta (v) { } async function getElectronVersion () { - const versionPath = path.join(__dirname, '..', '..', 'VERSION') + const versionPath = path.join(__dirname, '..', '..', 'ELECTRON_VERSION') const version = await readFile(versionPath, 'utf8') return version.trim() } diff --git a/script/sysroots.json b/script/sysroots.json index 1c8e3f3e1a40..b892ba4de5d1 100644 --- a/script/sysroots.json +++ b/script/sysroots.json @@ -1,37 +1,31 @@ { "sid_amd64": { - "Revision": "227023dae63c074376c4399a6039f93ae3dd426d", - "Sha1Sum": "6da2a26a1c64d93e6702e771699558049e1532e5", + "Sha1Sum": "b1b67071a9850ecba2ee8de0762e0edc0981a1cb", "SysrootDir": "debian_sid_amd64-sysroot", "Tarball": "debian_sid_amd64_sysroot.tar.xz" }, "sid_arm": { - "Revision": "227023dae63c074376c4399a6039f93ae3dd426d", - "Sha1Sum": "25f744e0c4feec7b9a401cee221c90777a9c0086", + "Sha1Sum": "947372fe8669d2ceb4560550b13a99761b40772b", "SysrootDir": "debian_sid_arm-sysroot", "Tarball": "debian_sid_arm_sysroot.tar.xz" }, "sid_arm64": { - "Revision": "227023dae63c074376c4399a6039f93ae3dd426d", - "Sha1Sum": "ac0c62353c6c480e9e8a2cf526000c39b82d1c1b", + "Sha1Sum": "2961cef580d6be189c506843e3b585216394a7c2", "SysrootDir": "debian_sid_arm64-sysroot", "Tarball": "debian_sid_arm64_sysroot.tar.xz" }, "sid_i386": { - "Revision": "227023dae63c074376c4399a6039f93ae3dd426d", - "Sha1Sum": "7f1130ab0c0b1b931c12104a36554c6a19a75622", + "Sha1Sum": "87c33fef40aa9d7b35961eecb489ecee83e2dc39", "SysrootDir": "debian_sid_i386-sysroot", "Tarball": "debian_sid_i386_sysroot.tar.xz" }, "sid_mips": { - "Revision": "227023dae63c074376c4399a6039f93ae3dd426d", - "Sha1Sum": "141d07172ff7307cc9461f05b9c57a2a3fb300d8", + "Sha1Sum": "436fc9638e2a435fa824d2f27dacc9e39d5ba667", "SysrootDir": "debian_sid_mips-sysroot", "Tarball": "debian_sid_mips_sysroot.tar.xz" }, "sid_mips64el": { - "Revision": "227023dae63c074376c4399a6039f93ae3dd426d", - "Sha1Sum": "e8a5355554eddac7cf1c9ea9ab83de2f15d6a45c", + "Sha1Sum": "4dce782d88fa115c9503944f5d3af649ce35a593", "SysrootDir": "debian_sid_mips64el-sysroot", "Tarball": "debian_sid_mips64el_sysroot.tar.xz" } diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index 5c7c9080f0d0..69d57bde58df 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -587,7 +587,7 @@ describe('session module', () => { server.listen(0, '127.0.0.1', () => { const config = { pacScript: `http://127.0.0.1:${server.address().port}` } customSession.setProxy(config, () => { - customSession.resolveProxy('http://localhost', (proxy) => { + customSession.resolveProxy('https://google.com', (proxy) => { assert.strictEqual(proxy, 'PROXY myproxy:8132') done() }) @@ -609,7 +609,10 @@ describe('session module', () => { }) }) - describe('ses.getBlobData(identifier, callback)', () => { + // FIXME: Disabled with C71 upgrade + // Re-enable with new api from + // https://github.com/electron/electron/tree/webframe-scheme-api + xdescribe('ses.getBlobData(identifier, callback)', () => { it('returns blob data for uuid', (done) => { const scheme = 'temp' const protocol = session.defaultSession.protocol diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index 461389fb054c..9ef8a7a05c0f 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -1005,19 +1005,11 @@ describe('chromium feature', () => { }) it('cannot access localStorage', (done) => { - contents.on('crashed', (event, killed) => { - // Site isolation ON: process is killed for trying to access resources without permission. - if (process.platform !== 'win32') { - // Chromium on Windows does not set this flag correctly. - assert.strictEqual(killed, true, 'Process should\'ve been killed') - } - done() - }) ipcMain.once('local-storage-response', (event, message) => { - // Site isolation OFF: access is refused. assert.strictEqual( message, 'Failed to read the \'localStorage\' property from \'Window\': Access is denied for this document.') + done() }) contents.loadURL(protocolName + '://host/localStorage') }) @@ -1036,7 +1028,7 @@ describe('chromium feature', () => { ipcMain.once('web-sql-response', (event, error) => { assert.strictEqual( error, - 'An attempt was made to break through the security policy of the user agent.') + 'Failed to execute \'openDatabase\' on \'Window\': Access to the WebDatabase API is denied in this context.') done() }) contents.loadURL(`${protocolName}://host/WebSQL`) @@ -1044,15 +1036,19 @@ describe('chromium feature', () => { it('cannot access indexedDB', (done) => { ipcMain.once('indexed-db-response', (event, error) => { - assert.strictEqual(error, 'The user denied permission to access the database.') + assert.strictEqual( + error, + 'Failed to execute \'open\' on \'IDBFactory\': access to the Indexed Database API is denied in this context.') done() }) contents.loadURL(`${protocolName}://host/indexedDB`) }) it('cannot access cookie', (done) => { - ipcMain.once('cookie-response', (event, cookie) => { - assert(!cookie) + ipcMain.once('cookie-response', (event, error) => { + assert.strictEqual( + error, + 'Failed to set the \'cookie\' property on \'Document\': Access is denied for this document.') done() }) contents.loadURL(`${protocolName}://host/cookie`) diff --git a/spec/fixtures/api/native-window-open-native-addon.html b/spec/fixtures/api/native-window-open-native-addon.html index 9a3f20468c73..27c24a60b755 100644 --- a/spec/fixtures/api/native-window-open-native-addon.html +++ b/spec/fixtures/api/native-window-open-native-addon.html @@ -3,19 +3,19 @@ diff --git a/spec/fixtures/module/echo-renamed.js b/spec/fixtures/module/echo-renamed.js new file mode 100644 index 000000000000..80718356038d --- /dev/null +++ b/spec/fixtures/module/echo-renamed.js @@ -0,0 +1,7 @@ +let echo +try { + echo = require('echo') +} catch (e) { + process.exit(1) +} +process.exit(echo(0)) diff --git a/spec/fixtures/module/runas.js b/spec/fixtures/module/echo.js similarity index 60% rename from spec/fixtures/module/runas.js rename to spec/fixtures/module/echo.js index 6422fce052a8..55283b9b392e 100644 --- a/spec/fixtures/module/runas.js +++ b/spec/fixtures/module/echo.js @@ -2,5 +2,5 @@ process.on('uncaughtException', function (err) { process.send(err.message) }) -require('runas') -process.send('ok') +const echo = require('echo') +process.send(echo('ok')) diff --git a/spec/fixtures/module/runas-renamed.js b/spec/fixtures/module/runas-renamed.js deleted file mode 100644 index 98b3dd89faa4..000000000000 --- a/spec/fixtures/module/runas-renamed.js +++ /dev/null @@ -1,6 +0,0 @@ -try { - require('runas') -} catch (e) { - process.exit(1) -} -process.exit(0) diff --git a/spec/fixtures/native-addon/echo/binding.cc b/spec/fixtures/native-addon/echo/binding.cc new file mode 100644 index 000000000000..d1dddd9789af --- /dev/null +++ b/spec/fixtures/native-addon/echo/binding.cc @@ -0,0 +1,38 @@ +#include +#include + +namespace { + +napi_value Print(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + napi_status status; + + status = napi_get_cb_info(env, info, &argc, args, NULL, NULL); + if (status != napi_ok) + return NULL; + + if (argc > 1) { + napi_throw_error(env, NULL, + "Wrong number of arguments, expected single argument"); + } + + return args[0]; +} + +napi_value Init(napi_env env, napi_value exports) { + napi_status status; + napi_property_descriptor descriptors[] = { + {"Print", NULL, Print, NULL, NULL, NULL, napi_default, NULL}}; + + status = napi_define_properties( + env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors); + if (status != napi_ok) + return NULL; + + return exports; +} + +} // namespace + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) diff --git a/spec/fixtures/native-addon/echo/binding.gyp b/spec/fixtures/native-addon/echo/binding.gyp new file mode 100644 index 000000000000..642567ad5229 --- /dev/null +++ b/spec/fixtures/native-addon/echo/binding.gyp @@ -0,0 +1,10 @@ +{ + "targets": [ + { + "target_name": "echo", + "sources": [ + "binding.cc" + ] + } + ] +} diff --git a/spec/fixtures/native-addon/echo/lib/echo.js b/spec/fixtures/native-addon/echo/lib/echo.js new file mode 100644 index 000000000000..8c2c673b4b04 --- /dev/null +++ b/spec/fixtures/native-addon/echo/lib/echo.js @@ -0,0 +1 @@ +module.exports = require('../build/Release/echo.node').Print diff --git a/spec/fixtures/native-addon/echo/package.json b/spec/fixtures/native-addon/echo/package.json new file mode 100644 index 000000000000..650586e32612 --- /dev/null +++ b/spec/fixtures/native-addon/echo/package.json @@ -0,0 +1,6 @@ + +{ + "main": "./lib/echo.js", + "name": "echo", + "version": "0.0.1" +} diff --git a/spec/fixtures/pages/native-module.html b/spec/fixtures/pages/native-module.html index a0ae0fe7592d..6d6bb821b302 100644 --- a/spec/fixtures/pages/native-module.html +++ b/spec/fixtures/pages/native-module.html @@ -2,7 +2,7 @@ diff --git a/spec/fixtures/pages/storage/cookie.html b/spec/fixtures/pages/storage/cookie.html index dc6a425f42e5..bae0969478a4 100644 --- a/spec/fixtures/pages/storage/cookie.html +++ b/spec/fixtures/pages/storage/cookie.html @@ -1,5 +1,8 @@ diff --git a/spec/fixtures/pages/storage/indexed_db.html b/spec/fixtures/pages/storage/indexed_db.html index 1515489ba001..789553c6fb39 100644 --- a/spec/fixtures/pages/storage/indexed_db.html +++ b/spec/fixtures/pages/storage/indexed_db.html @@ -1,7 +1,8 @@ diff --git a/spec/fixtures/pages/storage/local_storage.html b/spec/fixtures/pages/storage/local_storage.html index 523ef2085183..fc9bab009084 100644 --- a/spec/fixtures/pages/storage/local_storage.html +++ b/spec/fixtures/pages/storage/local_storage.html @@ -1,11 +1,8 @@ diff --git a/spec/modules-spec.js b/spec/modules-spec.js index dee65565d581..01fb8708cb26 100644 --- a/spec/modules-spec.js +++ b/spec/modules-spec.js @@ -13,9 +13,9 @@ describe('modules support', () => { const fixtures = path.join(__dirname, 'fixtures') describe('third-party module', () => { - (nativeModulesEnabled ? describe : describe.skip)('runas', () => { + (nativeModulesEnabled ? describe : describe.skip)('echo', () => { it('can be required in renderer', () => { - require('runas') + require('echo') }) it('can be required in node binary', function (done) { @@ -24,8 +24,8 @@ describe('modules support', () => { done() } - const runas = path.join(fixtures, 'module', 'runas.js') - const child = require('child_process').fork(runas) + const echo = path.join(fixtures, 'module', 'echo.js') + const child = require('child_process').fork(echo) child.on('message', (msg) => { assert.strictEqual(msg, 'ok') done() @@ -38,9 +38,9 @@ describe('modules support', () => { const testExecPath = path.join(path.dirname(execPath), 'test.exe') fs.copyFileSync(execPath, testExecPath) try { - const runasFixture = path.join(fixtures, 'module', 'runas-renamed.js') - assert.ok(fs.existsSync(runasFixture)) - const child = require('child_process').spawnSync(testExecPath, [runasFixture]) + const fixture = path.join(fixtures, 'module', 'echo-renamed.js') + assert.ok(fs.existsSync(fixture)) + const child = require('child_process').spawnSync(testExecPath, [fixture]) assert.strictEqual(child.status, 0) } finally { fs.unlinkSync(testExecPath) diff --git a/spec/node-spec.js b/spec/node-spec.js index d0fe246b8e66..c0d0b56c5091 100644 --- a/spec/node-spec.js +++ b/spec/node-spec.js @@ -158,10 +158,15 @@ describe('node feature', () => { const listeners = process.listeners('uncaughtException') process.removeAllListeners('uncaughtException') process.on('uncaughtException', (thrown) => { - expect(thrown).to.equal(error) - process.removeAllListeners('uncaughtException') - listeners.forEach((listener) => process.on('uncaughtException', listener)) - done() + try { + expect(thrown).to.equal(error) + done() + } catch (e) { + done(e) + } finally { + process.removeAllListeners('uncaughtException') + listeners.forEach((listener) => process.on('uncaughtException', listener)) + } }) fs.readFile(__filename, () => { throw error diff --git a/spec/package-lock.json b/spec/package-lock.json index 2717758d64ae..58422598ab23 100644 --- a/spec/package-lock.json +++ b/spec/package-lock.json @@ -362,6 +362,10 @@ "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, + "echo": { + "version": "file:fixtures/native-addon/echo", + "dev": true + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -629,9 +633,9 @@ "dev": true }, "is-valid-window": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/is-valid-window/-/is-valid-window-0.0.3.tgz", - "integrity": "sha512-7JkdRuLfEEYhb3eMcMeivn0UYpiXqwFoKxAefCfqRItCsElu4MGTnGtwqcMA3LwKhpCzcuYOLLcUH4PdEbW8fQ==", + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/is-valid-window/-/is-valid-window-0.0.4.tgz", + "integrity": "sha512-/Z3hrdhXnqwRvUnUxCfRsTmuv6IBpxNdQ9ad0gLUpX0K2hp0BdDJi10g4dy4rbDfd1NjKTkULxx/6nbPoKjsmw==", "dev": true, "requires": { "nan": "2.x" @@ -1149,15 +1153,6 @@ "prebuild-install": "^2.1.1" } }, - "runas": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/runas/-/runas-3.1.1.tgz", - "integrity": "sha1-Ut1TjbDkF0U5lTWjRwkbpFzA6rA=", - "dev": true, - "requires": { - "nan": "2.x" - } - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", diff --git a/spec/package.json b/spec/package.json index 4f1f998b6ec0..49b471857e02 100644 --- a/spec/package.json +++ b/spec/package.json @@ -14,15 +14,15 @@ "coffee-script": "1.12.7", "dbus-native": "^0.2.5", "dirty-chai": "^2.0.1", + "echo": "file:fixtures/native-addon/echo", "graceful-fs": "^4.1.11", - "is-valid-window": "^0.0.3", + "is-valid-window": "^0.0.4", "mkdirp": "^0.5.1", "mocha": "^5.2.0", "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7", "multiparty": "^4.1.4", "q": "^1.5.1", - "runas": "3.x", "send": "^0.16.2", "temp": "^0.8.3", "walkdir": "0.0.12", diff --git a/tools/js2c.py b/tools/js2c.py index ecd39e6c68af..dac5b3cb8c46 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -1,54 +1,38 @@ #!/usr/bin/env python -import contextlib -import glob import os import subprocess import sys - -SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) - TEMPLATE = """ -#ifndef ATOM_NATIVES_H_ -#define ATOM_NATIVES_H_ +#include "node_native_module.h" +#include "node_internals.h" namespace node {{ +namespace native_module {{ + {definitions} +void NativeModuleLoader::LoadEmbedderJavaScriptSource() {{ + {initializers} +}} + +}} // namespace native_module + }} // namespace node - -#endif // ATOM_NATIVES_H_ """ - def main(): node_path = os.path.abspath(sys.argv[1]) natives = os.path.abspath(sys.argv[2]) - js_source_files = glob.glob('{0}/*.js'.format(sys.argv[3])) + js_source_files = sys.argv[3:] - call_js2c(node_path, natives, js_source_files) - - -def call_js2c(node_path, natives, js_source_files): js2c = os.path.join(node_path, 'tools', 'js2c.py') - src_dir = os.path.dirname(js_source_files[0]) - with scoped_cwd(src_dir): - subprocess.check_call( - [sys.executable, js2c, natives] + - [os.path.basename(source) for source in js_source_files] + - ['-t', TEMPLATE]) - - -@contextlib.contextmanager -def scoped_cwd(path): - cwd = os.getcwd() - os.chdir(path) - try: - yield - finally: - os.chdir(cwd) + subprocess.check_call( + [sys.executable, js2c, natives] + + js_source_files + + ['-t', TEMPLATE]) if __name__ == '__main__':