From 335e9f68b768b34d63ae1550a12d4f140669609c Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 24 Oct 2018 11:24:11 -0700 Subject: [PATCH] chore: deprecate apply-patches in favour of git-{import,export}-patches (#15300) --- DEPS | 4 +- patches/common/boringssl/.patches | 1 + patches/common/boringssl/.patches.yaml | 8 - ...implement-SSL_get_tlsext_status_type.patch | 18 +- patches/common/chromium/.patches | 79 + patches/common/chromium/.patches.yaml | 513 --- patches/common/chromium/accelerator.patch | 4 +- ...dependencies_even_for_sysroot_builds.patch | 4 +- patches/common/chromium/add_realloc.patch | 12 +- .../allow_nested_error_trackers.patch | 4 +- .../chromium/allow_webview_file_url.patch | 4 +- .../chromium/app_indicator_icon_menu.patch | 4 +- ...ink-worker-enable-csp-in-file-scheme.patch | 4 +- patches/common/chromium/blink_file_path.patch | 6 +- .../chromium/blink_fix_prototype_assert.patch | 4 +- .../chromium/blink_initialization_order.patch | 4 +- .../common/chromium/blink_local_frame.patch | 4 +- .../common/chromium/blink_world_context.patch | 8 +- .../common/chromium/boringssl_build_gn.patch | 4 +- .../chromium/browser_compositor_mac.patch | 6 +- .../chromium/browser_plugin_guest.patch | 4 +- .../chromium/browser_plugin_wheel.patch | 4 +- patches/common/chromium/build_gn.patch | 4 +- .../common/chromium/can_create_window.patch | 18 +- .../common/chromium/chrome_key_systems.patch | 4 +- patches/common/chromium/color_chooser.patch | 23 +- .../common/chromium/command-ismediakey.patch | 10 +- .../common/chromium/compositor_delegate.patch | 6 +- .../chromium/content_browser_main_loop.patch | 14 +- .../chromium/crashpad_http_status.patch | 30 +- patches/common/chromium/dcheck.patch | 77 +- .../common/chromium/desktop_media_list.patch | 25 +- .../common/chromium/disable-redraw-lock.patch | 8 +- .../disable_detach_webview_frame.patch | 4 +- patches/common/chromium/disable_hidden.patch | 6 +- ...requirement_for_beforeunload_dialogs.patch | 4 +- patches/common/chromium/dom_storage_map.patch | 4 +- patches/common/chromium/dump_syms.patch | 14 +- .../chromium/enable_osr_components.patch | 4 +- patches/common/chromium/enable_widevine.patch | 4 +- .../exclude-a-few-test-files-from-build.patch | 8 +- .../chromium/expose-net-observer-api.patch | 12 +- .../common/chromium/frame_host_manager.patch | 6 +- .../gin_enable_disable_v8_platform.patch | 10 +- .../chromium/gritsettings_resource_ids.patch | 12 +- patches/common/chromium/gtk_visibility.patch | 2 +- patches/common/chromium/ignore_rc_check.patch | 4 +- patches/common/chromium/isolate_holder.patch | 16 +- patches/common/chromium/leveldb_ssize_t.patch | 4 +- patches/common/chromium/libgtkui_export.patch | 16 +- .../common/chromium/mas-audiodeviceduck.patch | 4 +- patches/common/chromium/mas-cfisobjc.patch | 4 +- .../mas-cgdisplayusesforcetogray.patch | 4 +- ...launchservicesserverconnectionstatus.patch | 4 +- .../chromium/mas_blink_no_private_api.patch | 6 +- .../common/chromium/mas_no_private_api.patch | 26 +- .../common/chromium/net_url_request_job.patch | 4 +- .../chromium/no_cache_storage_check.patch | 4 +- .../common/chromium/no_stack_dumping.patch | 4 +- .../chromium/notification_provenance.patch | 20 +- .../chromium/out_of_process_instance.patch | 4 +- patches/common/chromium/pepper_flash.patch | 24 +- patches/common/chromium/printing.patch | 217 +- .../chromium/proxy_config_monitor.patch | 14 +- .../render_widget_host_view_base.patch | 6 +- .../render_widget_host_view_mac.patch | 6 +- .../chromium/resource_file_conflict.patch | 4 +- .../chromium/scoped_clipboard_writer.patch | 6 +- .../common/chromium/scroll_bounce_flag.patch | 4 +- .../ssl_security_state_tab_helper.patch | 6 +- .../chromium/stream_resource_handler.patch | 4 +- patches/common/chromium/sysroot.patch | 31 +- .../common/chromium/thread_capabilities.patch | 4 +- patches/common/chromium/tts.patch | 20 +- .../chromium/use_transparent_window.patch | 6 +- .../v8_context_snapshot_generator.patch | 4 +- .../verbose_generate_breakpad_symbols.patch | 21 +- patches/common/chromium/web_contents.patch | 8 +- patches/common/chromium/web_preferences.patch | 17 +- .../chromium/webgl_context_attributes.patch | 14 +- .../common/chromium/webui_in_subframes.patch | 2 +- .../common/chromium/webview_cross_drag.patch | 6 +- .../common/chromium/webview_reattach.patch | 4 +- .../common/chromium/windows_cc_wrapper.patch | 4 +- .../worker_context_will_destroy.patch | 12 +- patches/common/ffmpeg/.patches | 2 + patches/common/ffmpeg/.patches.yaml | 15 - patches/common/ffmpeg/build_gn.patch | 16 +- .../ffmpeg/fix_build_on_linux_x86.patch | 12 +- patches/common/skia/.patches | 1 + patches/common/skia/.patches.yaml | 9 - patches/common/skia/fix_font_thickness.patch | 30 +- patches/common/v8/.patches | 20 + patches/common/v8/.patches.yaml | 72 - patches/common/v8/README.md | 27 + patches/common/v8/add_realloc.patch | 24 +- patches/common/v8/array_buffer.patch | 17 +- ...ild-torque-with-x64-toolchain-on-arm.patch | 15 +- patches/common/v8/build_gn.patch | 11 +- patches/common/v8/dcheck.patch | 17 +- ...ing_handlescope_in_fieldtype_printto.patch | 27 + ..._detailed_line_info_for_cpu_profiler.patch | 79 + ...cherry-pick_09bca09_from_upstream_v8.patch | 65 + ...cherry-pick_0dd3390_from_upstream_v8.patch | 498 +++ ...cherry-pick_2363cdf_from_upstream_v8.patch | 77 + ...cherry-pick_a8f6869_from_upstream_v8.patch | 306 ++ ...cherry-pick_ba752ea_from_upstream_v8.patch | 711 ++++ ...cherry-pick_bf5ea81_from_upstream_v8.patch | 72 + ...cherry-pick_c608122_from_upstream_v8.patch | 308 ++ ...cherry-pick_dbfcc48_from_upstream_v8.patch | 757 ++++ ...cherry-pick_e1a7699_from_upstream_v8.patch | 367 ++ patches/common/v8/disable-warning-win.patch | 12 +- patches/common/v8/export_platform.patch | 14 +- patches/common/v8/expose_mksnapshot.patch | 14 +- patches/common/v8/node_v8_patches.patch | 3363 ----------------- patches/common/v8/ostreams.patch | 11 +- script/apply-patches | 69 - script/apply_all_patches.py | 36 + script/git-export-patches | 126 + script/git-import-patches | 28 + script/lib/git.py | 55 +- script/lib/patches.py | 188 +- script/patch.py | 97 - 123 files changed, 4368 insertions(+), 4780 deletions(-) create mode 100644 patches/common/boringssl/.patches delete mode 100644 patches/common/boringssl/.patches.yaml create mode 100644 patches/common/chromium/.patches delete mode 100644 patches/common/chromium/.patches.yaml create mode 100644 patches/common/ffmpeg/.patches delete mode 100644 patches/common/ffmpeg/.patches.yaml create mode 100644 patches/common/skia/.patches delete mode 100644 patches/common/skia/.patches.yaml create mode 100644 patches/common/v8/.patches delete mode 100644 patches/common/v8/.patches.yaml create mode 100644 patches/common/v8/README.md create mode 100644 patches/common/v8/deps_add_missing_handlescope_in_fieldtype_printto.patch create mode 100644 patches/common/v8/deps_backport_detailed_line_info_for_cpu_profiler.patch create mode 100644 patches/common/v8/deps_cherry-pick_09bca09_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_0dd3390_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_2363cdf_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_a8f6869_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_ba752ea_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_bf5ea81_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_c608122_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_dbfcc48_from_upstream_v8.patch create mode 100644 patches/common/v8/deps_cherry-pick_e1a7699_from_upstream_v8.patch delete mode 100644 patches/common/v8/node_v8_patches.patch delete mode 100755 script/apply-patches create mode 100644 script/apply_all_patches.py create mode 100755 script/git-export-patches create mode 100755 script/git-import-patches delete mode 100755 script/patch.py diff --git a/DEPS b/DEPS index 98ae7f32d7..5a48bfaa8b 100644 --- a/DEPS +++ b/DEPS @@ -83,9 +83,7 @@ hooks = [ 'pattern': 'src/electron', 'action': [ 'python', - 'src/electron/script/apply-patches', - '--project-root=.', - '--commit', + 'src/electron/script/apply_all_patches.py', ], }, { diff --git a/patches/common/boringssl/.patches b/patches/common/boringssl/.patches new file mode 100644 index 0000000000..ceec4586db --- /dev/null +++ b/patches/common/boringssl/.patches @@ -0,0 +1 @@ +implement-SSL_get_tlsext_status_type.patch diff --git a/patches/common/boringssl/.patches.yaml b/patches/common/boringssl/.patches.yaml deleted file mode 100644 index d96351eade..0000000000 --- a/patches/common/boringssl/.patches.yaml +++ /dev/null @@ -1,8 +0,0 @@ -repo: src/third_party/boringssl/src -patches: -- - author: Aleksei Kuzmin - file: implement-SSL_get_tlsext_status_type.patch - description: | - BoringSSL doesn't implement `SSL_get_tlsext_status_type()`, - but Node.js expects it to be present cause OpenSSL has it. 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 e89fb0c328..da67e2363d 100644 --- a/patches/common/boringssl/implement-SSL_get_tlsext_status_type.patch +++ b/patches/common/boringssl/implement-SSL_get_tlsext_status_type.patch @@ -1,8 +1,16 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Mon, 22 Oct 2018 10:46:33 -0700 +Subject: implement-SSL_get_tlsext_status_type.patch + +BoringSSL doesn't implement `SSL_get_tlsext_status_type()`, +but Node.js expects it to be present cause OpenSSL has it. + diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h -index d04390df..0b8677ce 100644 +index f693030a8a7c4bf79dd791e1abd0e94f8e97a292..59c1881b34289401e6c998cd266cb1e2fb8f7cc9 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h -@@ -4120,6 +4120,8 @@ extern "C++" OPENSSL_EXPORT void SSL_CTX_sess_set_get_cb( +@@ -4293,6 +4293,8 @@ OPENSSL_EXPORT int OPENSSL_init_ssl(uint64_t opts, // Use |SSL_enable_ocsp_stapling| instead. OPENSSL_EXPORT int SSL_set_tlsext_status_type(SSL *ssl, int type); @@ -12,10 +20,10 @@ index d04390df..0b8677ce 100644 // success and zero on error. On success, |ssl| takes ownership of |resp|, which // must have been allocated by |OPENSSL_malloc|. diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc -index 0c004fd4..6c849b5b 100644 +index c68968a514b76717d4c42448ef4b9c440c330fb2..c82ffeaa37268e54c6b142b31706d478ba93ff63 100644 --- a/ssl/ssl_lib.cc +++ b/ssl/ssl_lib.cc -@@ -2723,6 +2723,14 @@ int SSL_set_tlsext_status_type(SSL *ssl, int type) { +@@ -2896,6 +2896,14 @@ int SSL_set_tlsext_status_type(SSL *ssl, int type) { return 1; } @@ -30,3 +38,5 @@ index 0c004fd4..6c849b5b 100644 int SSL_set_tlsext_status_ocsp_resp(SSL *ssl, uint8_t *resp, size_t resp_len) { if (SSL_set_ocsp_response(ssl, resp, resp_len)) { OPENSSL_free(resp); +-- +2.17.0 diff --git a/patches/common/chromium/.patches b/patches/common/chromium/.patches new file mode 100644 index 0000000000..5ed16f1fdf --- /dev/null +++ b/patches/common/chromium/.patches @@ -0,0 +1,79 @@ +add_realloc.patch +build_gn.patch +dcheck.patch +accelerator.patch +app_indicator_icon_menu.patch +blink_file_path.patch +blink_local_frame.patch +blink_world_context.patch +browser_compositor_mac.patch +browser_plugin_wheel.patch +can_create_window.patch +compositor_delegate.patch +disable_hidden.patch +dom_storage_map.patch +frame_host_manager.patch +net_url_request_job.patch +no_stack_dumping.patch +out_of_process_instance.patch +render_widget_host_view_base.patch +render_widget_host_view_mac.patch +scoped_clipboard_writer.patch +stream_resource_handler.patch +thread_capabilities.patch +use_transparent_window.patch +web_contents.patch +webgl_context_attributes.patch +webview_cross_drag.patch +worker_context_will_destroy.patch +webui_in_subframes.patch +browser_plugin_guest.patch +disable_user_gesture_requirement_for_beforeunload_dialogs.patch +add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch +gin_enable_disable_v8_platform.patch +blink-worker-enable-csp-in-file-scheme.patch +disable-redraw-lock.patch +v8_context_snapshot_generator.patch +boringssl_build_gn.patch +pepper_flash.patch +no_cache_storage_check.patch +blink_fix_prototype_assert.patch +libgtkui_export.patch +gtk_visibility.patch +sysroot.patch +mas_blink_no_private_api.patch +mas_no_private_api.patch +resource_file_conflict.patch +scroll_bounce_flag.patch +webview_reattach.patch +mas-cfisobjc.patch +mas-cgdisplayusesforcetogray.patch +mas-audiodeviceduck.patch +mas-lssetapplicationlaunchservicesserverconnectionstatus.patch +allow_webview_file_url.patch +windows_cc_wrapper.patch +enable_osr_components.patch +ignore_rc_check.patch +enable_widevine.patch +chrome_key_systems.patch +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 +crashpad_http_status.patch +expose-net-observer-api.patch +desktop_media_list.patch +proxy_config_monitor.patch +gritsettings_resource_ids.patch +isolate_holder.patch +notification_provenance.patch +content_browser_main_loop.patch +dump_syms.patch +command-ismediakey.patch +tts.patch +color_chooser.patch +printing.patch +verbose_generate_breakpad_symbols.patch +web_preferences.patch diff --git a/patches/common/chromium/.patches.yaml b/patches/common/chromium/.patches.yaml deleted file mode 100644 index 982ed3d83a..0000000000 --- a/patches/common/chromium/.patches.yaml +++ /dev/null @@ -1,513 +0,0 @@ -repo: src -patches: -- - author: Shelley Vohr - file: add_realloc.patch - description: | - Blink overrides ArrayBuffer's allocator with its own one, while Node simply - uses malloc and free, so we need to use v8's allocator in Node. As part of the - 10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator - argument in its constructor, and override ReallocateBufferMemory and - FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy - when we override ReallocateBufferMemory, so we therefore need to implement - Realloc on the v8 side and correspondingly in gin. -- - author: Ales Pergl - file: build_gn.patch - description: null -- - author: deepak1556 - file: dcheck.patch - description: | - This disables some debug checks which currently fail when running the Electron - test suite. In general there should be sustained effort to have all debug checks - enabled. If you want to help, choose one of the diffs below and remove it. Then - build Electron (debug configuration) and make sure all tests pass on the CI - systems. Unfortunately the tests don't always cover the check failures, so it's - good to also run some non-trivial Electron app to verify. - - Apart from getting rid of a whole diff, you may also be able to replace one diff - with another which enables at least some of the previously disabled checks. For - example, the checks might be disabled for a whole build target, but actually - 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. - - Please keep the following lists updated. - - The ELECTRON_NO_DCHECK build flag disables debug checks universally. - This patch applies the flag to the following GN targets: - - third_party/blink/renderer/core/loader:loader - url:url - - These files have debug checks explicitly commented out: - - base/process/kill_win.cc - components/viz/service/display/program_binding.h - content/browser/frame_host/navigation_controller_impl.cc - content/browser/frame_host/render_frame_host_impl.cc - content/browser/renderer_host/render_widget_host_view_mac.mm - ppapi/host/ppapi_host.cc - third_party/blink/renderer/core/dom/node.cc - third_party/blink/renderer/platform/wtf/text/string_impl.cc - ui/base/clipboard/clipboard_win.cc -- - author: Cheng Zhao - file: accelerator.patch - description: null -- - author: null - file: app_indicator_icon_menu.patch - description: null -- - author: Cheng Zhao - file: blink_file_path.patch - description: | - This is used by editors to obtain the filesystem path from a dragged file. See - documentation at https://electronjs.org/docs/api/file-object -- - author: Cheng Zhao - file: blink_local_frame.patch - description: | - According to electron/electron#3699, it is unreliable to use |unload| - event for process.exit('exit'), so we have to do that in - willReleaseScriptContext. - - However Chromium then disallowed scripting in willReleaseScriptContext - in https://codereview.chromium.org/1657583002, and crash will happen - when there is code doing that. - - This patch reverts the change to fix the crash in Electron. -- - author: null - file: blink_world_context.patch - description: null -- - author: Cheng Zhao - file: browser_compositor_mac.patch - description: null -- - author: null - file: browser_plugin_wheel.patch - description: null -- - author: Cheng Zhao - file: can_create_window.patch - description: null -- - author: null - file: compositor_delegate.patch - description: null -- - author: Cheng Zhao - file: disable_hidden.patch - description: null -- - author: Cheng Zhao - file: dom_storage_map.patch - description: null -- - author: deepak1556 - file: frame_host_manager.patch - description: null -- - author: Cheng Zhao - file: net_url_request_job.patch - description: null -- - author: Aleksei Kuzmin - file: no_stack_dumping.patch - description: null -- - author: deepak1556 - file: out_of_process_instance.patch - description: null -- - author: null - file: render_widget_host_view_base.patch - description: null -- - author: Cheng Zhao - file: render_widget_host_view_mac.patch - description: null -- - author: null - file: scoped_clipboard_writer.patch - description: null -- - author: deepak1556 - file: stream_resource_handler.patch - description: null -- - author: null - file: thread_capabilities.patch - description: | - Chromium automatically drops all capabilities of renderer threads in - Linux, which may cause issues in a context like Electron, where the main - and renderer threads are supposed to keep inherited permissions over the - system. - - See https://github.com/atom/electron/issues/3666 -- - author: Cheng Zhao - file: use_transparent_window.patch - description: null -- - author: null - file: web_contents.patch - description: null -- - author: Milan Burda - file: webgl_context_attributes.patch - description: null -- - author: null - file: webview_cross_drag.patch - description: null -- - author: Cheng Zhao - file: worker_context_will_destroy.patch - description: null -- - author: null - file: webui_in_subframes.patch - description: null -- - author: Tomas Rycl - file: browser_plugin_guest.patch - description: null -- - author: Aleksei Kuzmin - file: disable_user_gesture_requirement_for_beforeunload_dialogs.patch - description: See https://github.com/electron/electron/issues/10754 -- - author: Aleksei Kuzmin - file: add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch - description: null -- - author: Cheng Zhao - file: gin_enable_disable_v8_platform.patch - description: null -- - author: deepak1556 - file: blink-worker-enable-csp-in-file-scheme.patch - description: null -- - author: Heilig Benedek - file: disable-redraw-lock.patch - description: | - Chromium uses a custom window titlebar implementation on Windows when DWM - is disabled (Windows 7 and earlier, non Aero theme). The native titlebar - sometimes painted over this custom titlebar, so a workaround was put in - place to lock redraws in reaction to certain events if DWM is disabled, - since the code assumes that in that case, the custom titlebar is painted. - Electron forces the use of the native titlebar, which the workaround doesn't - take into account, and still locks redraws, causing weird repainting issues - in electron (and other applications). This patch provides a way to disable - the redraw locking mechanism, which fixes these issues. The electron issue - can be found at https://github.com/electron/electron/issues/1821 -- - author: Nitish Sakhawalkar - file: v8_context_snapshot_generator.patch - description: | - v8_context_snapshot_generator is a build time executable. - The patch adds the config. -- - author: Jeremy Apthorp - file: boringssl_build_gn.patch - description: | - Build BoringSSL with some extra functions that nodejs needs. Only affects - the GN build; with the GYP build, nodejs is still built with OpenSSL. -- - author: deepak1556 - file: pepper_flash.patch - description: | - Allows building chrome pepper flash integration for Electron. -- - author: Cheng Zhao - file: no_cache_storage_check.patch - description: | - Do not check for unique origin in CacheStorage, in Electron we may have - scripts running without an origin. -- - author: Cheng Zhao - file: blink_fix_prototype_assert.patch - description: | - A recent Chromium change has accidentally added assertion for the case when - a new window object may not have a prototype attached. In Electron it may - happen when preventDefault for a native new-window event. - https://chromium.googlesource.com/chromium/src/+/f47b361887a31cccf42a6e21a82bccf28372bdaa%5E%21 - In the long term we should investigate why it happened, and take a more - formal fix. But for now I'm just make this assertion silently pass away. -- - author: Jeremy Apthorp - file: libgtkui_export.patch - description: | - Export libgtkui symbols for the GN component build. -- - author: Jeremy Apthorp - file: gtk_visibility.patch - description: | - Allow electron to depend on GTK in the GN build. -- - author: Jeremy Apthorp - file: sysroot.patch - description: | - Make chrome's install-sysroot scripts point to our custom sysroot builds, - which include extra deps that Electron needs (e.g. libnotify) -- - author: Cheng Zhao - file: mas_blink_no_private_api.patch - description: | - Guard usages in chromium code of private Mac APIs by MAS_BUILD, so they can - be excluded for people who want to submit their apps to the Mac App store. -- - author: Cheng Zhao - file: mas_no_private_api.patch - description: | - Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be - excluded for people who want to submit their apps to the Mac App store. -- - author: Jeremy Apthorp - file: resource_file_conflict.patch - description: | - Resolve conflict between //chrome's .pak files and //electron's. The paths - that chrome code hardcodes require that we generate resources at these - paths, but GN throws errors if there are multiple targets that generate the - same files. -- - author: Cheng Zhao - file: scroll_bounce_flag.patch - description: | - Patch to make scrollBounce option work. -- - author: Cheng Zhao - file: webview_reattach.patch - description: | - Backports https://chromium-review.googlesource.com/c/chromium/src/+/1161391 - Fixes webview not working after renderer process restarted. -- - author: Jeremy Apthorp - file: mas-cfisobjc.patch - description: | - Removes usage of the _CFIsObjC private API. -- - author: Jeremy Apthorp - file: mas-cgdisplayusesforcetogray.patch - description: | - Removes usage of the CGDisplayUsesForceToGray private API. -- - author: Jeremy Apthorp - file: mas-audiodeviceduck.patch - description: | - Removes usage of the AudioDeviceDuck private API. -- - author: Jeremy Apthorp - file: mas-lssetapplicationlaunchservicesserverconnectionstatus.patch - description: | - Removes usage of the _LSSetApplicationLaunchServicesServerConnectionStatus - private API. -- - author: Cheng Zhao - file: allow_webview_file_url.patch - description: | - Allow webview to load non-web URLs. -- - author: John Kleinschmidt - file: windows_cc_wrapper.patch - description: | - Allow use of cc_wrapper (eg sccache). -- - author: Shelley Vohr - file: enable_osr_components.patch - description: | - Add MouseWheelPhaseHandler for OSR. -- - author: Zac Walker - file: ignore_rc_check.patch - description: | - Dont compare RC.exe and RC.py output. - FIXME: It has to be reverted once the script is fixed. -- - author: Aleksei Kuzmin - file: enable_widevine.patch - description: | - Turns `enable_widevine` flag on by default on Mac and Windows. - Electron needs that flag to be enabled on those paltforms, - but there's no way to conditionally set it during a `gn gen` call. -- - author: deepak1556 - file: chrome_key_systems.patch - description: | - Disable persiste licence support check for widevine cdm, - as its not supported in the current version of chrome. -- - author: Charles Kerr - file: allow_nested_error_trackers.patch - description: | - Only one X11ErrorTracker should exist at a time, but upstream has a bug - where two can exist if running in headless mode -- - ui::(anonymous namespace)::SupportsEWMH() [inner tracker is created] - ui::WmSupportsHint() - ui::IsX11WindowFullScreen() - ui::ScreensaverWindowFinder::IsScreensaverWindow() - ui::ScreensaverWindowFinder::ShouldStopIterating() - ui::EnumerateTopLevelWindows() - ui::ScreensaverWindowFinder::ScreensaverWindowExists() [outer tracker created] - ui::CheckIdleStateIsLocked() - ui::CalculateIdleState() - Removal of either tracker could have side-effects in some code paths, - so this is probably better handled upstream. This patch tries to do the - least harm in the interim by removing the check that prevents more than - one tracker from existing at a time. -- - author: Samuel Attard - file: blink_initialization_order.patch - description: | - Backport of https://chromium-review.googlesource.com/c/chromium/src/+/1030530 - to fix the order of V8 and Blink initialization. Also fixes order - of DidCreateScriptContext notification with initialization of window globals - to fix electron/electron#13787. The backport landed in Chromium 67 but the - DidCreateScriptContext re-ordering needs to be upstreamed or kept indefinitely -- - author: zcbenz - file: disable_detach_webview_frame.patch - description: | - Don't detach the frame for webview, we will manage the WebContents - manually. - This is part of the fixes for https://github.com/electron/electron/issues/14211. - We should revisit this bug after upgrading to newer versions of Chrome, - this patch was introduced in Chrome 66. -- - author: deepak1556 - file: ssl_security_state_tab_helper.patch - description: | - Allows populating security tab info for devtools in Electron. -- - author: Jeremy Apthorp - file: leveldb_ssize_t.patch - description: | - 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. -- - author: Aleksei Kuzmin - file: exclude-a-few-test-files-from-build.patch - description: | - Compilation of those files fails with the Chromium 68. - Remove the patch during the Chromium 69 upgrade. -- - author: Jeremy Apthorp - file: crashpad_http_status.patch - description: backport of crashpad f540abb506 -- - author: Jeremy Apthorp - file: expose-net-observer-api.patch - description: | - Expose URLRequestContextGetter::{Add,Remove}Observer. - This patch should be removed once we switch to using the net service (cc @robo) -- - author: deepak1556 - file: desktop_media_list.patch - description: | - * Adds a new observer method to DesktopMediaListObserver for - desktop capture api. - * Backports https://chromium-review.googlesource.com/c/chromium/src/+/1199806 - that fixes crash with screen capturer, can be removed in 71.0.3539.0 -- - author: deepak1556 - file: proxy_config_monitor.patch - description: | - Allow monitoring proxy config changes for a pref service. -- - author: deepak1556 - file: gritsettings_resource_ids.patch - description: | - Add electron resources file to the list of resource ids generation. -- - author: Samuel Attard - file: isolate_holder.patch - description: | - Pass pre allocated isolate for initialization, node platform - needs to register on an isolate so that it can be used later - down in the initialization process of an isolate. -- - author: Jeremy Apthorp - file: notification_provenance.patch - description: | - Pass RenderProcessHost through to PlatformNotificationService. - - This is so Electron can identify which renderer a notification came from. -- - author: deepak1556 - file: content_browser_main_loop.patch - description: | - Pass idle quit closure for main message loop, so that pending tasks are - run before shutdown. This is required to cleanup WebContents asynchronously - in atom::CommonWebContentsDelegate::ResetManageWebContents. -- - author: Samuel Attard - file: dump_syms.patch - description: | - dylib currently fails to resolve Squirrel.framework on OSX, we need to fix - this but it is not a blocker for releasing Electron. This patch removes - the hard fail on dylib resolve failure from dump_syms -- - author: Jeremy Apthorp - file: command-ismediakey.patch - description: | - define Command::IsMediaKey on mac - - the definition is copied from //chrome/common/extensions/command.cc, - which also defines a bunch of other stuff that depends on extensions. - since we only need IsMediaKey, and we don't want the extensions stuff - (and aren't compiling command.cc), it's safe to duplicate the - definition. A candidate for upstreaming would be to move the IsMediaKey - function into //ui. -- - author: Heilig Benedek - file: tts.patch - description: | - * Adds patch in //chrome/browser/speech/tts_controller_impl.cc - to disable calls using chrome profile class. - * Adds patch in //chrome/browser/speech/tts_message_filter.cc - to remove reference to browser context when its signaled for - destruction from content layer. -- - author: Heilig Benedek - file: color_chooser.patch - description: | - Removes a couple of stuff from the chromium implementation of ColorChooser - to decouple it from dependencies. - - Most of the stuff removed is actually related to other dialog types that - we don't currently support, but chrome/browser/ui/browser_dialogs.h has - a function for them to create them. Also disables a DCHECK that crashes - the ColorChooser on Windows, that DCHECK most likely is an artifact that - remained in chromium from a long time ago (last update of that part of the - code was around 2012-2013, and this is purely UI, I don't think they have - automated tests for it). -- - author: Heilig Benedek - file: printing.patch - description: | - Add changeset that was previously applied to sources in chromium_src. The - majority of changes originally come from these PRs: - * https://github.com/electron/electron/pull/1835 - * https://github.com/electron/electron/pull/8596 - -- - author: John Kleinschmidt - file: verbose_generate_breakpad_symbols.patch - description: | - Temporarily add additional debugging statements to - generate_breakpad_symbols.py to determine why it is hanging. -- - author: zcbenz - file: web_preferences.patch - description: | - Add a node_integration field to WebPreferences so we can determine whether - a frame has node integration in renderer process. - - This is required by the nativeWindowOpen option, which put multiple main - frames in one renderer process. diff --git a/patches/common/chromium/accelerator.patch b/patches/common/chromium/accelerator.patch index 20b0d45cc3..167911ef32 100644 --- a/patches/common/chromium/accelerator.patch +++ b/patches/common/chromium/accelerator.patch @@ -1,11 +1,11 @@ -From 61cd6b5bc2068a3740313d7f4680ef3fcaaacb1a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 4 Oct 2018 14:57:02 -0700 Subject: accelerator.patch diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc -index 7e55ef366ac8..c3fb98b426cd 100644 +index 7e55ef366ac8320f730cdcb268453b1fa2710887..c3fb98b426cd7c12f66eaaf358f4ff184628bba1 100644 --- a/ui/base/accelerators/accelerator.cc +++ b/ui/base/accelerators/accelerator.cc @@ -11,6 +11,7 @@ diff --git a/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch b/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch index 09b6f92d39..266f7fc967 100644 --- a/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch +++ b/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch @@ -1,11 +1,11 @@ -From e686584a3758c1954f31e107746b40c6a63ad776 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Thu, 20 Sep 2018 17:47:36 -0700 Subject: add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch diff --git a/base/BUILD.gn b/base/BUILD.gn -index 7fb93868d6e0..53c5744953da 100644 +index 7fb93868d6e009323eceb2ba0f1ff9c506dc5f3b..53c5744953da460c02b43de1bfd184cd92489167 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1248,7 +1248,7 @@ jumbo_component("base") { diff --git a/patches/common/chromium/add_realloc.patch b/patches/common/chromium/add_realloc.patch index 8195b89f57..87676f0482 100644 --- a/patches/common/chromium/add_realloc.patch +++ b/patches/common/chromium/add_realloc.patch @@ -1,4 +1,4 @@ -From 0e2864c50cb039dd2f8d9b9cc88ae26f5bd62581 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 20 Sep 2018 17:44:26 -0700 Subject: 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 f84934bfd712..fc23fef68b6f 100644 +index f84934bfd712dbad0e85d908165a5a4033bff170..fc23fef68b6fb9a4cccdf99bc427078faed2f62e 100644 --- a/gin/array_buffer.cc +++ b/gin/array_buffer.cc @@ -43,6 +43,10 @@ void* ArrayBufferAllocator::AllocateUninitialized(size_t length) { @@ -27,7 +27,7 @@ index f84934bfd712..fc23fef68b6f 100644 free(data); } diff --git a/gin/array_buffer.h b/gin/array_buffer.h -index 2aef366ac819..3c7d66c81032 100644 +index 2aef366ac8194aa261cbca6abc051f7da8a988d3..3c7d66c81032636abcca4f1538ce9b7f4ddb2de2 100644 --- a/gin/array_buffer.h +++ b/gin/array_buffer.h @@ -21,6 +21,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { @@ -39,7 +39,7 @@ index 2aef366ac819..3c7d66c81032 100644 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 83a6639306a9..8511e7d594ce 100644 +index 83a6639306a9a2c907b478a974628cc89e2de97c..8511e7d594ce5116f19619fa89115e24422e419c 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -665,6 +665,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { @@ -54,7 +54,7 @@ index 83a6639306a9..8511e7d594ce 100644 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 053babce1051..e33d6d4ceb5a 100644 +index 053babce10512d9967546f2e547f826c9ad1b158..e33d6d4ceb5a10ffbe853dc87cad8a1145992154 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, @@ -70,7 +70,7 @@ index 053babce1051..e33d6d4ceb5a 100644 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 809229caa872..6248ad32d6b0 100644 +index 809229caa872789345218538d945f3ed6a871adc..6248ad32d6b045fbd4c863cbdbeb859a3ecde3a5 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 @@ -178,6 +178,7 @@ class WTF_EXPORT ArrayBufferContents { diff --git a/patches/common/chromium/allow_nested_error_trackers.patch b/patches/common/chromium/allow_nested_error_trackers.patch index bdcef9c69c..2743889e80 100644 --- a/patches/common/chromium/allow_nested_error_trackers.patch +++ b/patches/common/chromium/allow_nested_error_trackers.patch @@ -1,4 +1,4 @@ -From 602c08e90102a25894a4d48d236258cae6b982c6 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 20 Sep 2018 17:50:17 -0700 Subject: allow_nested_error_trackers.patch @@ -20,7 +20,7 @@ least harm in the interim by removing the check that prevents more than one tracker from existing at a time. diff --git a/ui/gfx/x/x11_error_tracker.cc b/ui/gfx/x/x11_error_tracker.cc -index af031de356c5..2a5c18dc473a 100644 +index af031de356c5e0938fd3b84a494e48dc9a0e0476..2a5c18dc473a4f88fc0427bec69142917159bbd9 100644 --- a/ui/gfx/x/x11_error_tracker.cc +++ b/ui/gfx/x/x11_error_tracker.cc @@ -24,7 +24,7 @@ namespace gfx { diff --git a/patches/common/chromium/allow_webview_file_url.patch b/patches/common/chromium/allow_webview_file_url.patch index 2b3266ed45..9b37522190 100644 --- a/patches/common/chromium/allow_webview_file_url.patch +++ b/patches/common/chromium/allow_webview_file_url.patch @@ -1,4 +1,4 @@ -From 0556b9d98cbc0b786e0a47681bea1593b65660a7 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:49:42 -0700 Subject: allow_webview_file_url.patch @@ -6,7 +6,7 @@ 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 061ad189c46d..d64ba4f20d49 100644 +index 061ad189c46d5f0f1afb09052cc21aeb7e60a744..d64ba4f20d49a57b29e1ad5bc7ac53616974efc9 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc @@ -1488,6 +1488,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( diff --git a/patches/common/chromium/app_indicator_icon_menu.patch b/patches/common/chromium/app_indicator_icon_menu.patch index 27b7590ac0..cbac8b5afb 100644 --- a/patches/common/chromium/app_indicator_icon_menu.patch +++ b/patches/common/chromium/app_indicator_icon_menu.patch @@ -1,11 +1,11 @@ -From acf81b764b448b2979792e5d3d97f248030b49bc Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:44:52 -0700 Subject: app_indicator_icon_menu.patch diff --git a/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc b/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc -index 40399a35f8d2..1d3a0da948dc 100644 +index 40399a35f8d2c70827adec732c898a5be09cf69b..1d3a0da948dca3fef3af53256d23e8ae2bd23bfa 100644 --- a/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc +++ b/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc @@ -116,7 +116,7 @@ void AppIndicatorIconMenu::OnMenuItemActivated(GtkWidget* menu_item) { 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 04ac8b5572..6206094b8d 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 @@ -1,11 +1,11 @@ -From 439ba549807dab957a49a3959dccded956fc1b6b Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:47:47 -0700 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 6e803af108f3..94a72b37ae8e 100644 +index 6e803af108f310b6df0ff0f3e2f0ddb0cce3cae3..94a72b37ae8ebf7f142b5dfdd02261220b6eeb99 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 @@ -244,7 +244,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( diff --git a/patches/common/chromium/blink_file_path.patch b/patches/common/chromium/blink_file_path.patch index 72193c8fbc..53b6c4f491 100644 --- a/patches/common/chromium/blink_file_path.patch +++ b/patches/common/chromium/blink_file_path.patch @@ -1,4 +1,4 @@ -From 50f9d1164c07306d128d9860be5a4891310ef495 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:00 -0700 Subject: blink_file_path.patch @@ -7,7 +7,7 @@ This is used by editors to obtain the filesystem path from a dragged file. See documentation at https://electronjs.org/docs/api/file-object diff --git a/third_party/blink/renderer/core/fileapi/file.h b/third_party/blink/renderer/core/fileapi/file.h -index 39831f1902c6..fddb013aa122 100644 +index 39831f1902c6ab85a0a4cac61a614931ee050ed6..fddb013aa122049de7142bca624d7d0749b58372 100644 --- a/third_party/blink/renderer/core/fileapi/file.h +++ b/third_party/blink/renderer/core/fileapi/file.h @@ -168,6 +168,9 @@ class CORE_EXPORT File final : public Blob { @@ -21,7 +21,7 @@ index 39831f1902c6..fddb013aa122 100644 // 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 a74beceda3e7..7196fd5f5f9e 100644 +index a74beceda3e769aaf5673cabc6663bb883f54705..7196fd5f5f9e51616d49c09142247c8382e83cc0 100644 --- a/third_party/blink/renderer/core/fileapi/file.idl +++ b/third_party/blink/renderer/core/fileapi/file.idl @@ -32,6 +32,7 @@ diff --git a/patches/common/chromium/blink_fix_prototype_assert.patch b/patches/common/chromium/blink_fix_prototype_assert.patch index 9ca6edfd51..ebd1bcc7ed 100644 --- a/patches/common/chromium/blink_fix_prototype_assert.patch +++ b/patches/common/chromium/blink_fix_prototype_assert.patch @@ -1,4 +1,4 @@ -From 3ac191f7b549fb23471d357294a84836520d7373 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:48:19 -0700 Subject: blink_fix_prototype_assert.patch @@ -11,7 +11,7 @@ In the long term we should investigate why it happened, and take a more formal fix. But for now I'm just make this assertion silently pass away. diff --git a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc b/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc -index 87f2176ce897..ce3d9ce19bff 100644 +index 87f2176ce897583b6682e8f49d1e4cac1392aacb..ce3d9ce19bff686640be08776a7dc5736e9bd83a 100644 --- a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc +++ b/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc @@ -98,8 +98,10 @@ v8::Local V8ObjectConstructor::CreateInterfaceObject( diff --git a/patches/common/chromium/blink_initialization_order.patch b/patches/common/chromium/blink_initialization_order.patch index 6c3286d85b..234f19601e 100644 --- a/patches/common/chromium/blink_initialization_order.patch +++ b/patches/common/chromium/blink_initialization_order.patch @@ -1,4 +1,4 @@ -From d3439444d4aa219c6d3ebacb241bff165a76cf22 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 20 Sep 2018 17:50:24 -0700 Subject: blink_initialization_order.patch @@ -10,7 +10,7 @@ to fix electron/electron#13787. The backport landed in Chromium 67 but the DidCreateScriptContext re-ordering needs to be upstreamed or kept indefinitely diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc -index cbd9f811d978..160e5bc7d57a 100644 +index cbd9f811d97855e8bf083cbb2dd9ebcbcab0a1a5..160e5bc7d57ad18619a4c912d57b6b07b790ddf5 100644 --- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc +++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc @@ -177,11 +177,10 @@ void LocalWindowProxy::Initialize() { diff --git a/patches/common/chromium/blink_local_frame.patch b/patches/common/chromium/blink_local_frame.patch index 8be99725f3..7795e9b5df 100644 --- a/patches/common/chromium/blink_local_frame.patch +++ b/patches/common/chromium/blink_local_frame.patch @@ -1,4 +1,4 @@ -From 791d604902bb958ca62522ce3a50aa496c3f713b Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:03 -0700 Subject: blink_local_frame.patch @@ -14,7 +14,7 @@ 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 52810bba03b0..65575d432df5 100644 +index 52810bba03b0c2916ae84d5b1642740cc2d7a2e6..65575d432df5e8e27f8285dcf6dd77e48e2ea1ec 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -392,10 +392,6 @@ void LocalFrame::Detach(FrameDetachType type) { diff --git a/patches/common/chromium/blink_world_context.patch b/patches/common/chromium/blink_world_context.patch index 2df7061f67..f5d6ac9305 100644 --- a/patches/common/chromium/blink_world_context.patch +++ b/patches/common/chromium/blink_world_context.patch @@ -1,11 +1,11 @@ -From 026d3f1ce69e4b94b5168422018c744103437e72 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:45:11 -0700 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 437e8b22c0f5..0ff6b21fd5a9 100644 +index 437e8b22c0f589df3eb41ba8628092c3146b1f8c..0ff6b21fd5a9e49254f283dcbab0b2be9668b296 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h @@ -438,6 +438,9 @@ class WebLocalFrame : public WebFrame { @@ -19,7 +19,7 @@ index 437e8b22c0f5..0ff6b21fd5a9 100644 // 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 082b055a570c..345d97f888b5 100644 +index 082b055a570c9d6ec944b3310f54934e65fbe6a0..345d97f888b522c17c755f48e43e7a699ca78472 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 @@ -874,6 +874,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { @@ -37,7 +37,7 @@ index 082b055a570c..345d97f888b5 100644 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 feb4b14bc8e5..95d1cc2c91ca 100644 +index feb4b14bc8e52c8335e93d133506ecd6226c051d..95d1cc2c91ca01ec95dc3f63aa5f2546a7074095 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 @@ -145,6 +145,8 @@ class CORE_EXPORT WebLocalFrameImpl final diff --git a/patches/common/chromium/boringssl_build_gn.patch b/patches/common/chromium/boringssl_build_gn.patch index 768b2ad5b2..002e243c1d 100644 --- a/patches/common/chromium/boringssl_build_gn.patch +++ b/patches/common/chromium/boringssl_build_gn.patch @@ -1,4 +1,4 @@ -From 1e77d2109d61aea5270d1026a7df5fb44e639568 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:48:05 -0700 Subject: 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 d31a9f29fa9c..dea5a6403f4c 100644 +index d31a9f29fa9c12e753708b2a1e75c33b70924300..dea5a6403f4c32f94bb58198c467bc7cc87a8217 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 f69199fbde..5628427b19 100644 --- a/patches/common/chromium/browser_compositor_mac.patch +++ b/patches/common/chromium/browser_compositor_mac.patch @@ -1,11 +1,11 @@ -From 4b6fd85950701d177879f3a239b19f08c9ff3a66 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:14 -0700 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 46be85eea4b5..4c816b7021f8 100644 +index 46be85eea4b52b191d9e717fd34408a6c2445199..4c816b7021f87873a524e0dc2384146193b86e3c 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.h +++ b/content/browser/renderer_host/browser_compositor_view_mac.h @@ -59,6 +59,8 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient, @@ -26,7 +26,7 @@ index 46be85eea4b5..4c816b7021f8 100644 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 92afcc779106..42bd6fd7c169 100644 +index 92afcc77910610e53378f55adc003cc1bdf3109a..42bd6fd7c169de36c775471c68b456f1386ff666 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.mm +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm @@ -81,6 +81,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { diff --git a/patches/common/chromium/browser_plugin_guest.patch b/patches/common/chromium/browser_plugin_guest.patch index 60dbc90f9a..91f09b5e32 100644 --- a/patches/common/chromium/browser_plugin_guest.patch +++ b/patches/common/chromium/browser_plugin_guest.patch @@ -1,11 +1,11 @@ -From 402d52b4cf68772c493920f9e4977132918d9b48 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tomas Rycl Date: Thu, 20 Sep 2018 17:47:25 -0700 Subject: browser_plugin_guest.patch diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc -index f56ce93c3d5b..19c302c2714f 100644 +index f56ce93c3d5b1b46b706800a12a21f29cabafb33..19c302c2714fb8ce89b261dd44d9939d3345a803 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -206,8 +206,11 @@ void BrowserPluginGuest::Init() { diff --git a/patches/common/chromium/browser_plugin_wheel.patch b/patches/common/chromium/browser_plugin_wheel.patch index d2c471445f..ba8c507e6d 100644 --- a/patches/common/chromium/browser_plugin_wheel.patch +++ b/patches/common/chromium/browser_plugin_wheel.patch @@ -1,11 +1,11 @@ -From 4032ed30d0df7f78fde3da3725f8aa3759493e4c Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:45:21 -0700 Subject: browser_plugin_wheel.patch diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc -index 4d8251069ae9..fbd5cc809962 100644 +index 4d8251069ae9a45e1be22fa03f23b3196116b612..fbd5cc8099629971d670d087fdee89204e3137e3 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc @@ -656,15 +656,11 @@ blink::WebInputEventResult BrowserPlugin::HandleInputEvent( diff --git a/patches/common/chromium/build_gn.patch b/patches/common/chromium/build_gn.patch index 3294a3deab..267a84c1f8 100644 --- a/patches/common/chromium/build_gn.patch +++ b/patches/common/chromium/build_gn.patch @@ -1,11 +1,11 @@ -From aca453bd9e35003bc70adfc77a576492f05c5954 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ales Pergl Date: Thu, 20 Sep 2018 17:44:29 -0700 Subject: build_gn.patch diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index fcc00ee0e49f..3232a0360e94 100644 +index fcc00ee0e49f101cb1b10629747c4c4fa521776d..3232a0360e94e78621f7f672e3de4bdcc5f7b8d5 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { diff --git a/patches/common/chromium/can_create_window.patch b/patches/common/chromium/can_create_window.patch index fe8d314ded..9c295c32c7 100644 --- a/patches/common/chromium/can_create_window.patch +++ b/patches/common/chromium/can_create_window.patch @@ -1,11 +1,11 @@ -From 0809b4654f69adbc8912ad8922465f46b2d3be18 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:32 -0700 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 520dcffb5353..783dc705f748 100644 +index 520dcffb53534e76d739cff74ea58d49bdfb682a..783dc705f748bc6c9d3b8630ce12ad39ff2fd7d2 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -3142,6 +3142,38 @@ void RenderFrameHostImpl::CreateNewWindow( @@ -56,7 +56,7 @@ index 520dcffb5353..783dc705f748 100644 &no_javascript_access); diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc -index e3b04edb5a30..254f94016b97 100644 +index e3b04edb5a301115d894190a64e734eb2c8b3499..254f94016b97620cfbc102cbbc7677cfcfe38e22 100644 --- a/content/browser/security_exploit_browsertest.cc +++ b/content/browser/security_exploit_browsertest.cc @@ -313,6 +313,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, @@ -68,7 +68,7 @@ index e3b04edb5a30..254f94016b97 100644 std::move(params), base::BindOnce([](mojom::CreateNewWindowStatus, mojom::CreateNewWindowReplyPtr) {})); diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index fb4732e6e666..804086522994 100644 +index fb4732e6e666044233716fc3ae629dedad7b2618..804086522994b038c86a31e7acdcffc1e039c260 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom @@ -12,6 +12,8 @@ import "content/public/common/resource_type.mojom"; @@ -117,7 +117,7 @@ index fb4732e6e666..804086522994 100644 // 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 2a896c7072ca..bb54b89bef5c 100644 +index 2a896c7072caae655be1902b536d9172448abddb..bb54b89bef5c6f32e7b4a056336c85494e2a04de 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -435,6 +435,8 @@ bool ContentBrowserClient::CanCreateWindow( @@ -130,7 +130,7 @@ index 2a896c7072ca..bb54b89bef5c 100644 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 fd5d62fee117..3be31602689c 100644 +index fd5d62fee1172b07a692fcf6ce06a30096d25b03..3be31602689cb93b965729cc4e35cf6d23a8ec2f 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -162,6 +162,7 @@ class RenderFrameHost; @@ -151,7 +151,7 @@ index fd5d62fee117..3be31602689c 100644 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index 03d9cda9f95d..edad9fc3198c 100644 +index 03d9cda9f95daa369101b6f922e0978061e0225f..edad9fc3198ca12bd326c9f407a62866373e3b29 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -79,6 +79,7 @@ @@ -210,7 +210,7 @@ index 03d9cda9f95d..edad9fc3198c 100644 // 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 fe0e3720ea5d..4a31617b5a89 100644 +index fe0e3720ea5d60d65ecbbc3836bc87785997a513..4a31617b5a898b0f6d7e25cc05992d36862678a0 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 @@ -276,6 +276,8 @@ bool LayoutTestContentBrowserClient::CanCreateWindow( @@ -223,7 +223,7 @@ index fe0e3720ea5d..4a31617b5a89 100644 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 fa458cf0c92d..cdd95a1d88e5 100644 +index fa458cf0c92d6f75ecd71e296ba1af88ace400dc..cdd95a1d88e582a31aca43cd2fc9001113dcde1c 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 7aa3b9981d..7f704793b4 100644 --- a/patches/common/chromium/chrome_key_systems.patch +++ b/patches/common/chromium/chrome_key_systems.patch @@ -1,4 +1,4 @@ -From 63fb1abe3afa2b19ac0640b462658e6f286b3c6c Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:50:13 -0700 Subject: 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 5c38d0b1ce7c..4ffaf2a3301e 100644 +index 5c38d0b1ce7c6d395126b6cc428467d31bb3c0a5..4ffaf2a3301eec188b1b40b06b2152f17b4c7641 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc @@ -15,7 +15,9 @@ diff --git a/patches/common/chromium/color_chooser.patch b/patches/common/chromium/color_chooser.patch index 48674830b5..db0c4c4c23 100644 --- a/patches/common/chromium/color_chooser.patch +++ b/patches/common/chromium/color_chooser.patch @@ -1,5 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Heilig Benedek +Date: Thu, 18 Oct 2018 17:08:13 -0700 +Subject: color_chooser.patch + +Removes a couple of stuff from the chromium implementation of ColorChooser +to decouple it from dependencies. + +Most of the stuff removed is actually related to other dialog types that +we don't currently support, but chrome/browser/ui/browser_dialogs.h has +a function for them to create them. Also disables a DCHECK that crashes +the ColorChooser on Windows, that DCHECK most likely is an artifact that +remained in chromium from a long time ago (last update of that part of the +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 f57c1ded416a..59fdd948c3c5 100644 +index f57c1ded416a7a642bdf8502daeb40afe539903b..59fdd948c3c5e57374beef801b96f5bfd1343b1c 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h @@ -4,7 +4,7 @@ @@ -60,7 +76,7 @@ index f57c1ded416a..59fdd948c3c5 100644 +#endif #endif // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ diff --git a/chrome/browser/ui/views/color_chooser_win.cc b/chrome/browser/ui/views/color_chooser_win.cc -index 06381ef0e5ca..acb3a6e9e647 100644 +index 06381ef0e5ca34d141363213a846e5a9baa5fd8a..acb3a6e9e6476d9d2e3f445237246e6ae32e1764 100644 --- a/chrome/browser/ui/views/color_chooser_win.cc +++ b/chrome/browser/ui/views/color_chooser_win.cc @@ -91,7 +91,7 @@ void ColorChooserWin::OnColorChooserDialogClosed() { @@ -72,3 +88,6 @@ index 06381ef0e5ca..acb3a6e9e647 100644 current_color_chooser_ = NULL; if (web_contents_) web_contents_->DidEndColorChooser(); +-- +2.17.0 + diff --git a/patches/common/chromium/command-ismediakey.patch b/patches/common/chromium/command-ismediakey.patch index c479d9e911..3b768ea05e 100644 --- a/patches/common/chromium/command-ismediakey.patch +++ b/patches/common/chromium/command-ismediakey.patch @@ -1,4 +1,4 @@ -From 2d028f727b68a0aa7f83cc069e1df4d13a9e173e Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 10 Oct 2018 15:07:34 -0700 Subject: define Command::IsMediaKey on mac @@ -15,7 +15,7 @@ and electron/electron@d2368d2d3b3de9eec4cc32b6aaf035cc89921bf1 as patches. diff --git a/chrome/browser/extensions/global_shortcut_listener_mac.mm b/chrome/browser/extensions/global_shortcut_listener_mac.mm -index f612ba2fb795..77c2c68e6f9b 100644 +index f612ba2fb7952654663cbce596c43b0b65d5ea29..77c2c68e6f9bfec3fc887e2119243cee1321cd17 100644 --- a/chrome/browser/extensions/global_shortcut_listener_mac.mm +++ b/chrome/browser/extensions/global_shortcut_listener_mac.mm @@ -20,6 +20,26 @@ using extensions::GlobalShortcutListenerMac; @@ -46,7 +46,7 @@ index f612ba2fb795..77c2c68e6f9b 100644 GlobalShortcutListener* GlobalShortcutListener::GetInstance() { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/extensions/global_shortcut_listener_win.cc b/chrome/browser/extensions/global_shortcut_listener_win.cc -index 65b244d55441..a217f0a1ad96 100644 +index 65b244d55441b07f55e61c7b634d6cec57f2b1e7..a217f0a1ad965331502dc01fde9ff0a2d0399326 100644 --- a/chrome/browser/extensions/global_shortcut_listener_win.cc +++ b/chrome/browser/extensions/global_shortcut_listener_win.cc @@ -63,6 +63,8 @@ void GlobalShortcutListenerWin::OnWndProc(HWND hwnd, @@ -68,7 +68,7 @@ index 65b244d55441..a217f0a1ad96 100644 bool success = !!RegisterHotKey( gfx::SingletonHwnd::GetInstance()->hwnd(), diff --git a/chrome/browser/extensions/global_shortcut_listener_x11.cc b/chrome/browser/extensions/global_shortcut_listener_x11.cc -index 362811063a42..fc407da7047b 100644 +index 362811063a426c27993563f236b0aa8b7034aa3f..fc407da7047b6d1b57db44eca65da6e1d743431f 100644 --- a/chrome/browser/extensions/global_shortcut_listener_x11.cc +++ b/chrome/browser/extensions/global_shortcut_listener_x11.cc @@ -38,6 +38,7 @@ int GetNativeModifiers(const ui::Accelerator& accelerator) { @@ -89,7 +89,7 @@ index 362811063a42..fc407da7047b 100644 ui::Accelerator accelerator( ui::KeyboardCodeFromXKeyEvent(x_event), modifiers); diff --git a/ui/base/accelerators/media_keys_listener_mac.mm b/ui/base/accelerators/media_keys_listener_mac.mm -index cd595b0c017d..941c1a76a1c3 100644 +index cd595b0c017d6e36a5d94f7c99fe0a098a52b067..941c1a76a1c3ebe542aebcc9dc301d19bab47057 100644 --- a/ui/base/accelerators/media_keys_listener_mac.mm +++ b/ui/base/accelerators/media_keys_listener_mac.mm @@ -30,6 +30,12 @@ ui::KeyboardCode MediaKeyCodeToKeyboardCode(int key_code) { diff --git a/patches/common/chromium/compositor_delegate.patch b/patches/common/chromium/compositor_delegate.patch index 2876c832fc..fffe69d174 100644 --- a/patches/common/chromium/compositor_delegate.patch +++ b/patches/common/chromium/compositor_delegate.patch @@ -1,11 +1,11 @@ -From df47eeaea5e574c7af03eed15d384ad9cad58fb1 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:45:36 -0700 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 511d805187b1..5fb01fee0378 100644 +index 511d805187b15325f72c574ad37fb43e4e5e2df6..5fb01fee0378ac807ee4fde6d4bea8d76db75d42 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -494,10 +494,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( @@ -32,7 +32,7 @@ index 511d805187b1..5fb01fee0378 100644 } else { DCHECK(context_provider); diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index e0ec33400b17..29ba88a504c3 100644 +index e0ec33400b179a600d95501fb93826075ffc52eb..29ba88a504c33d850c7a3425bd7d874ac3323fe1 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -24,6 +24,7 @@ diff --git a/patches/common/chromium/content_browser_main_loop.patch b/patches/common/chromium/content_browser_main_loop.patch index 0c53f391db..05821434a7 100644 --- a/patches/common/chromium/content_browser_main_loop.patch +++ b/patches/common/chromium/content_browser_main_loop.patch @@ -1,5 +1,14 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 18 Oct 2018 17:07:42 -0700 +Subject: content_browser_main_loop.patch + +Pass idle quit closure for main message loop, so that pending tasks are +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 eb942391306e..9111cf18b7fc 100644 +index eb942391306e86e8ee8dc2584c63440b10ec76bd..9111cf18b7fc8fb67e7ee65e3cd76bd1e713aee8 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -1571,7 +1571,7 @@ void BrowserMainLoop::MainMessageLoopRun() { @@ -11,3 +20,6 @@ index eb942391306e..9111cf18b7fc 100644 run_loop.Run(); #endif } +-- +2.17.0 + diff --git a/patches/common/chromium/crashpad_http_status.patch b/patches/common/chromium/crashpad_http_status.patch index e6a8ad9354..38bb28ddcc 100644 --- a/patches/common/chromium/crashpad_http_status.patch +++ b/patches/common/chromium/crashpad_http_status.patch @@ -1,8 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 18 Oct 2018 17:06:46 -0700 +Subject: crashpad_http_status.patch + +backport of crashpad f540abb506 + diff --git a/third_party/crashpad/crashpad/util/net/http_transport.h b/third_party/crashpad/crashpad/util/net/http_transport.h -index f91a556..acd4e44 100644 +index f91a55612a2ffc2f4a78ff48ceba6174adc58cbf..acd4e442462b031dd304f303cdaa3664f5cffb64 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport.h +++ b/third_party/crashpad/crashpad/util/net/http_transport.h -@@ -90,7 +90,7 @@ +@@ -90,7 +90,7 @@ class HTTPTransport { //! if the response body is not required. //! //! \return Whether or not the request was successful, defined as returning @@ -12,10 +19,10 @@ index f91a556..acd4e44 100644 protected: diff --git a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm -index 8d5f78c..a433bb3 100644 +index 8d5f78cc6efc8b8e349958f51c78921a8c163c4e..a433bb357da5865144ade7d3663b1c9b36199f8e 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm +++ b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm -@@ -293,7 +293,7 @@ +@@ -293,7 +293,7 @@ bool HTTPTransportMac::ExecuteSynchronously(std::string* response_body) { return false; } NSInteger http_status = [http_response statusCode]; @@ -25,7 +32,7 @@ index 8d5f78c..a433bb3 100644 implicit_cast(http_status)); return false; diff --git a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc -index f0e2dc14a8a4..34d8deeb5c25 100644 +index f0e2dc14a8a487b5960d700be57100c9bed4f271..34d8deeb5c25f6b49fd0acadce67a3816869d3da 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc @@ -457,10 +457,18 @@ bool ReadResponseLine(Stream* stream) { @@ -49,13 +56,13 @@ index f0e2dc14a8a4..34d8deeb5c25 100644 + &http_status) && + http_status >= 200 && http_status <= 203; } - + bool ReadResponseHeaders(Stream* stream, HTTPHeaders* headers) { diff --git a/third_party/crashpad/crashpad/util/net/http_transport_test.cc b/third_party/crashpad/crashpad/util/net/http_transport_test.cc -index 7b5f41d..d73dc99 100644 +index 7b5f41dfd1e18b212d7dd349cff8f4396e20dbc3..d73dc99217e08f7c84ded50868cbef02141a6b9b 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_test.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_test.cc -@@ -137,7 +137,7 @@ +@@ -137,7 +137,7 @@ class HTTPTransportTestFixture : public MultiprocessExec { std::string response_body; bool success = transport->ExecuteSynchronously(&response_body); @@ -65,10 +72,10 @@ index 7b5f41d..d73dc99 100644 std::string expect_response_body = random_string + "\r\n"; EXPECT_EQ(response_body, expect_response_body); diff --git a/third_party/crashpad/crashpad/util/net/http_transport_win.cc b/third_party/crashpad/crashpad/util/net/http_transport_win.cc -index 18d343c..2919bc1 100644 +index 18d343ccef0396ee6679f4b5fd8316c3109003f4..2919bc11d0ba4bf84a11e146bf2961b830db35fe 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_win.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_win.cc -@@ -375,7 +375,7 @@ +@@ -375,7 +375,7 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) { return false; } @@ -77,3 +84,6 @@ index 18d343c..2919bc1 100644 LOG(ERROR) << base::StringPrintf("HTTP status %lu", status_code); return false; } +-- +2.17.0 + diff --git a/patches/common/chromium/dcheck.patch b/patches/common/chromium/dcheck.patch index 66456e942d..959d6e94bc 100644 --- a/patches/common/chromium/dcheck.patch +++ b/patches/common/chromium/dcheck.patch @@ -1,4 +1,4 @@ -From 0a8757b6650df0e762cc4ec400ecb7ee8ca7be4a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:44:38 -0700 Subject: dcheck.patch @@ -39,25 +39,25 @@ These files have debug checks explicitly commented out: ui/base/clipboard/clipboard_win.cc diff --git a/base/logging.h b/base/logging.h -index 08c1f0fc5967..7a758ce3ef90 100644 +index 08c1f0fc59672b2134c634e081f0c4df4d261b75..7a758ce3ef90145d2b68e07e17f00fc30cfb30a6 100644 --- a/base/logging.h +++ b/base/logging.h @@ -874,7 +874,7 @@ const LogSeverity LOG_DCHECK = LOG_FATAL; - + #else // !(defined(_PREFAST_) && defined(OS_WIN)) - + -#if DCHECK_IS_ON() +#if DCHECK_IS_ON() && !defined(ELECTRON_NO_DCHECK) - + #define DCHECK(condition) \ LAZY_STREAM(LOG_STREAM(DCHECK), !ANALYZER_ASSUME_TRUE(condition)) \ diff --git a/base/memory/weak_ptr.cc b/base/memory/weak_ptr.cc -index c993fcb8a13a..80a5b708d259 100644 +index c993fcb8a13a156c1ba6fc1979d8d18fbedd9059..80a5b708d2597bbda53826dac4175fe9788bf154 100644 --- a/base/memory/weak_ptr.cc +++ b/base/memory/weak_ptr.cc @@ -25,8 +25,8 @@ void WeakReference::Flag::Invalidate() { } - + bool WeakReference::Flag::IsValid() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_) - << "WeakPtrs must be checked on the same sequenced thread."; @@ -65,22 +65,22 @@ index c993fcb8a13a..80a5b708d259 100644 + // << "WeakPtrs must be checked on the same sequenced thread."; return !invalidated_.IsSet(); } - + diff --git a/base/process/kill_win.cc b/base/process/kill_win.cc -index 7a664429bcd3..26f49dc3d1e7 100644 +index 7a664429bcd305b10da8c7317700f9124742f3b8..26f49dc3d1e782e69e74f2d177535b80a54b2433 100644 --- a/base/process/kill_win.cc +++ b/base/process/kill_win.cc @@ -23,7 +23,7 @@ TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code) { DWORD tmp_exit_code = 0; - + if (!::GetExitCodeProcess(handle, &tmp_exit_code)) { - DPLOG(FATAL) << "GetExitCodeProcess() failed"; + // DPLOG(FATAL) << "GetExitCodeProcess() failed"; - + // This really is a random number. We haven't received any // information about the exit code, presumably because this diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc -index 18ef58a725c3..239f319c8b4c 100644 +index 18ef58a725c3a87a30413a4676044533f1751c7c..239f319c8b4cf52c115acd6173a15978f6ff3386 100644 --- a/base/process/process_metrics_win.cc +++ b/base/process/process_metrics_win.cc @@ -153,10 +153,9 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const { @@ -98,7 +98,7 @@ index 18ef58a725c3..239f319c8b4c 100644 } } diff --git a/components/viz/service/display/program_binding.h b/components/viz/service/display/program_binding.h -index 2a8fb9f54847..2c318b310b2a 100644 +index 2a8fb9f5484768f88ec6d383639da2d42fd777fd..2c318b310b2aeb39a1256feb612e19dc0fd53a72 100644 --- a/components/viz/service/display/program_binding.h +++ b/components/viz/service/display/program_binding.h @@ -434,7 +434,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase { @@ -109,37 +109,37 @@ index 2a8fb9f54847..2c318b310b2a 100644 + // DCHECK(IsContextLost(context_provider->ContextGL())); return; } - + @@ -446,7 +446,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase { - + // Link after binding uniforms if (!Link(context_provider->ContextGL())) { - DCHECK(IsContextLost(context_provider->ContextGL())); + // DCHECK(IsContextLost(context_provider->ContextGL())); return; } - + diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc -index d8aca9e2cbff..86224ab7a3c5 100644 +index d8aca9e2cbffdfd0bbb0bd67e8adfb53547132bb..86224ab7a3c5637422559da25bc8c1040a03e937 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( return NAVIGATION_TYPE_NEW_SUBFRAME; } - + - // We only clear the session history when navigating to a new page. - DCHECK(!params.history_list_was_cleared); + // Electron does its own book keeping of navigation entries and we + // expect content to not track any, by clearing history list for + // all navigations. + // DCHECK(!params.history_list_was_cleared); - + if (rfh->GetParent()) { // All manual subframes would be did_create_new_entry and handled above, so @@ -1233,7 +1235,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon(); } - + - DCHECK(!params.history_list_was_cleared || !replace_entry); + // Electron does its own book keeping of navigation entries and we + // expect content to not track any, by clearing history list for @@ -149,12 +149,12 @@ index d8aca9e2cbff..86224ab7a3c5 100644 // navigation. Now we know that the renderer has updated its state accordingly // and it is safe to also clear the browser side history. diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc -index 8e5af3e3b9c5..520dcffb5353 100644 +index 8e5af3e3b9c5b9e5c7a2462600fb2c9582df0c7c..520dcffb53534e76d739cff74ea58d49bdfb682a 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -2416,8 +2416,10 @@ void RenderFrameHostImpl::AllowBindings(int bindings_flags) { } - + enabled_bindings_ |= bindings_flags; - if (GetParent()) - DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings()); @@ -162,28 +162,28 @@ index 8e5af3e3b9c5..520dcffb5353 100644 + // Fix this when we use OOPIF in Electron. + // if (GetParent()) + // DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings()); - + if (render_frame_created_) { if (!frame_bindings_control_) diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc -index 3f80e73535c8..bf40b94ad24c 100644 +index 3f80e73535c8b4a2bcff08821e3585306f691c8b..bf40b94ad24c0621cbe093002c3355693219ebc4 100644 --- a/ppapi/host/ppapi_host.cc +++ b/ppapi/host/ppapi_host.cc @@ -238,7 +238,7 @@ void PpapiHost::OnHostMsgResourceCreated( CreateResourceHost(params.pp_resource(), instance, nested_msg); - + if (!resource_host.get()) { - NOTREACHED(); + // NOTREACHED(); return; } - + diff --git a/third_party/blink/renderer/core/dom/node.cc b/third_party/blink/renderer/core/dom/node.cc -index 5629f8170851..bc773ac9b1e4 100644 +index 5629f8170851f0b58069e2cd0c14ebe093d89d00..bc773ac9b1e462385dcbb8bef2fc4c2d7e6c7b06 100644 --- a/third_party/blink/renderer/core/dom/node.cc +++ b/third_party/blink/renderer/core/dom/node.cc @@ -2568,7 +2568,7 @@ StaticNodeList* Node::getDestinationInsertionPoints() { - + HTMLSlotElement* Node::AssignedSlot() const { // assignedSlot doesn't need to call updateDistribution(). - DCHECK(!IsPseudoElement()); @@ -192,7 +192,7 @@ index 5629f8170851..bc773ac9b1e4 100644 return root->AssignedSlotFor(*this); return nullptr; diff --git a/third_party/blink/renderer/core/loader/BUILD.gn b/third_party/blink/renderer/core/loader/BUILD.gn -index 49b4ead3dc52..0083e5c8efb7 100644 +index 49b4ead3dc521796bf3c6a207a072ff5eeff1849..0083e5c8efb71cf2cb097944174dcad8eff1cc3e 100644 --- a/third_party/blink/renderer/core/loader/BUILD.gn +++ b/third_party/blink/renderer/core/loader/BUILD.gn @@ -135,4 +135,11 @@ blink_core_sources("loader") { @@ -208,12 +208,12 @@ index 49b4ead3dc52..0083e5c8efb7 100644 + } } diff --git a/third_party/blink/renderer/platform/wtf/text/string_impl.h b/third_party/blink/renderer/platform/wtf/text/string_impl.h -index 0e7c40b732ec..7c513d95a586 100644 +index 0e7c40b732ec283e006b2e3517c42e699d7e3102..7c513d95a586d8ac80e691aa89abaf49793e9a18 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_impl.h +++ b/third_party/blink/renderer/platform/wtf/text/string_impl.h @@ -258,21 +258,21 @@ class WTF_EXPORT StringImpl { } - + ALWAYS_INLINE bool HasOneRef() const { -#if DCHECK_IS_ON() +#if 0 @@ -221,7 +221,7 @@ index 0e7c40b732ec..7c513d95a586 100644 #endif return ref_count_ == 1; } - + ALWAYS_INLINE void AddRef() const { -#if DCHECK_IS_ON() +#if 0 @@ -229,7 +229,7 @@ index 0e7c40b732ec..7c513d95a586 100644 #endif ++ref_count_; } - + ALWAYS_INLINE void Release() const { -#if DCHECK_IS_ON() +#if 0 @@ -237,12 +237,12 @@ index 0e7c40b732ec..7c513d95a586 100644 << AsciiForDebugging() << " " << CurrentThread(); #endif diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc -index e49dd8c81270..9e61c901cd2d 100644 +index e49dd8c81270cdd9794ddee11bad036c2f444af5..9e61c901cd2df168520b83a8522ca8c032f4c0ae 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc @@ -905,9 +905,9 @@ void ClipboardWin::WriteBitmapFromHandle(HBITMAP source_hbitmap, } - + void ClipboardWin::WriteToClipboard(unsigned int format, HANDLE handle) { - DCHECK(clipboard_owner_->hwnd() != NULL); + // DCHECK(clipboard_owner_->hwnd() != NULL); @@ -253,7 +253,7 @@ index e49dd8c81270..9e61c901cd2d 100644 } } diff --git a/url/BUILD.gn b/url/BUILD.gn -index 57bbe16c15ea..07725187c595 100644 +index 57bbe16c15ea442963a53f89b009e2c99c7b090a..07725187c595784d9e5f49d45a8835da78144830 100644 --- a/url/BUILD.gn +++ b/url/BUILD.gn @@ -98,6 +98,10 @@ component("url") { @@ -265,7 +265,8 @@ index 57bbe16c15ea..07725187c595 100644 + defines += [ "ELECTRON_NO_DCHECK" ] + } } - + if (is_android) { --- +-- 2.17.0 + diff --git a/patches/common/chromium/desktop_media_list.patch b/patches/common/chromium/desktop_media_list.patch index 2e70a2c987..00523bddfa 100644 --- a/patches/common/chromium/desktop_media_list.patch +++ b/patches/common/chromium/desktop_media_list.patch @@ -1,5 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 18 Oct 2018 17:07:01 -0700 +Subject: desktop_media_list.patch + +* Adds a new observer method to DesktopMediaListObserver for + desktop capture api. +* Backports https://chromium-review.googlesource.com/c/chromium/src/+/1199806 + that fixes crash with screen capturer, can be removed in 71.0.3539.0 + diff --git a/chrome/browser/media/webrtc/desktop_media_list.h b/chrome/browser/media/webrtc/desktop_media_list.h -index 8e02a8a95eb0..3497b85428a5 100644 +index 8e02a8a95eb07516162eacdf5b361231d3a02975..3497b85428a52c6019cfb5d30229071f99ecfb20 100644 --- a/chrome/browser/media/webrtc/desktop_media_list.h +++ b/chrome/browser/media/webrtc/desktop_media_list.h @@ -32,6 +32,9 @@ class DesktopMediaList { @@ -26,7 +36,7 @@ index 8e02a8a95eb0..3497b85428a5 100644 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 43dd95ef72f5..d4662708f649 100644 +index 43dd95ef72f5b35b91471950cc114800d54945ab..d4662708f64934372422b853673eaaf8f05e4baf 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) @@ -88,7 +98,7 @@ index 43dd95ef72f5..d4662708f649 100644 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 746df1210aa9..461e0edf8509 100644 +index 746df1210aa92af5c9d4703112b4bd6c09b94fdf..461e0edf8509569d05c86f466c02b5035183d0df 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.h +++ b/chrome/browser/media/webrtc/desktop_media_list_base.h @@ -24,12 +24,14 @@ class DesktopMediaListBase : public DesktopMediaList { @@ -108,7 +118,7 @@ index 746df1210aa9..461e0edf8509 100644 static uint32_t GetImageHash(const gfx::Image& image); diff --git a/chrome/browser/media/webrtc/desktop_media_list_observer.h b/chrome/browser/media/webrtc/desktop_media_list_observer.h -index 47401abc984e..ca6a527ffac8 100644 +index 47401abc984e6fe26c7f4c5399aa565c687060b0..ca6a527ffac877c27aac94337ec5a7b546e09768 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_observer.h +++ b/chrome/browser/media/webrtc/desktop_media_list_observer.h @@ -18,6 +18,10 @@ class DesktopMediaListObserver { @@ -123,7 +133,7 @@ index 47401abc984e..ca6a527ffac8 100644 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 0c9ba953cb3c..c2482774f074 100644 +index 0c9ba953cb3c268930fb101105c22416ed3cae08..c2482774f0747a0300d72d7ef05ed429caaf7d19 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc @@ -5,11 +5,15 @@ @@ -262,7 +272,7 @@ index 0c9ba953cb3c..c2482774f074 100644 base::Unretained(worker_.get()), native_ids, thumbnail_size_)); diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.h b/chrome/browser/media/webrtc/native_desktop_media_list.h -index e6f0e17b05ee..75c9ca04ce48 100644 +index e6f0e17b05ee4dc45827dc2dd00d484201f74646..75c9ca04ce481ab79615515da948c29d449865dc 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.h +++ b/chrome/browser/media/webrtc/native_desktop_media_list.h @@ -8,7 +8,7 @@ @@ -288,3 +298,6 @@ index e6f0e17b05ee..75c9ca04ce48 100644 std::unique_ptr worker_; #if defined(USE_AURA) +-- +2.17.0 + diff --git a/patches/common/chromium/disable-redraw-lock.patch b/patches/common/chromium/disable-redraw-lock.patch index 9867649185..fee303f83f 100644 --- a/patches/common/chromium/disable-redraw-lock.patch +++ b/patches/common/chromium/disable-redraw-lock.patch @@ -1,4 +1,4 @@ -From 2067d5a31905f889d7537c4a4ab680577bb5e75f Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Thu, 20 Sep 2018 17:47:54 -0700 Subject: 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 d5f442f71da7..a8f39b060115 100644 +index d5f442f71da7ad3b7087af40967d6df0579803f5..a8f39b0601157dc75d35460eccff67f36bc07941 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -281,6 +281,10 @@ const int kSynthesizedMouseMessagesTimeDifference = 500; @@ -49,7 +49,7 @@ index d5f442f71da7..a8f39b060115 100644 // HWNDMessageHandler, gfx::WindowImpl overrides: diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h -index 91afedec8e29..fa514d102538 100644 +index 91afedec8e2951e3f0176fce2e84261a3846d218..fa514d102538e141f48ff6af5f5c8fc4d6da17b0 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h @@ -181,6 +181,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, @@ -62,7 +62,7 @@ index 91afedec8e29..fa514d102538 100644 HICON GetDefaultWindowIcon() const override; HICON GetSmallWindowIcon() const override; diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h -index 1b2d98a85738..dd080180aebd 100644 +index 1b2d98a857385d31b5f401d685fd9524da228726..dd080180aebda193ef885bf7f41587802787a3c6 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h @@ -46,6 +46,8 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { diff --git a/patches/common/chromium/disable_detach_webview_frame.patch b/patches/common/chromium/disable_detach_webview_frame.patch index 51dc6ba2a9..79ab84b3cf 100644 --- a/patches/common/chromium/disable_detach_webview_frame.patch +++ b/patches/common/chromium/disable_detach_webview_frame.patch @@ -1,4 +1,4 @@ -From 4d1fb504c014998e2cc80b63db3a820dd73adbec Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: zcbenz Date: Thu, 20 Sep 2018 17:50:27 -0700 Subject: disable_detach_webview_frame.patch @@ -10,7 +10,7 @@ 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 b06a4b9242d3..b7793aaa094a 100644 +index b06a4b9242d30869f9b37fee1dc3ecbe7dcc06d4..b7793aaa094ad342fa15491653baac268a89d524 100644 --- a/content/browser/frame_host/render_frame_proxy_host.cc +++ b/content/browser/frame_host/render_frame_proxy_host.cc @@ -286,6 +286,12 @@ void RenderFrameProxyHost::SetDestructionCallback( diff --git a/patches/common/chromium/disable_hidden.patch b/patches/common/chromium/disable_hidden.patch index 34a6b1d6a7..7b0fe1534c 100644 --- a/patches/common/chromium/disable_hidden.patch +++ b/patches/common/chromium/disable_hidden.patch @@ -1,11 +1,11 @@ -From 624474e13fd8533e9e1f69e3d9b2d551c8fb807a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:47 -0700 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 9ab96c3f933b..28879dc5e9bb 100644 +index 9ab96c3f933b7ca0c8a7da396bd6015e620f2e81..28879dc5e9bb3f391513da6a7ad829244b39799d 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -712,6 +712,9 @@ void RenderWidgetHostImpl::WasHidden() { @@ -19,7 +19,7 @@ index 9ab96c3f933b..28879dc5e9bb 100644 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 4af5870e7c40..f2e19fe92e56 100644 +index 4af5870e7c40056b98e67f71c2c037490f2634f2..f2e19fe92e56d5d98a3ea0491a719c899b0cdcfe 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 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 25d57762e3..b4b0dad4e7 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 @@ -1,4 +1,4 @@ -From 1294052a41b0f304e45e5bea986b194bee511d49 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Thu, 20 Sep 2018 17:47:33 -0700 Subject: disable_user_gesture_requirement_for_beforeunload_dialogs.patch @@ -6,7 +6,7 @@ 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 5bfe30b8b880..70129284e60b 100644 +index 5bfe30b8b88073b83c8128b889298bd9af5938f3..70129284e60b20258b2e5d3506f93600a2628fc2 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc @@ -3508,7 +3508,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client, diff --git a/patches/common/chromium/dom_storage_map.patch b/patches/common/chromium/dom_storage_map.patch index 8b9acfc1bf..2bd6e554f4 100644 --- a/patches/common/chromium/dom_storage_map.patch +++ b/patches/common/chromium/dom_storage_map.patch @@ -1,11 +1,11 @@ -From 71828a0d7703c56120f127ca42f097fda647ef1c Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:55 -0700 Subject: dom_storage_map.patch diff --git a/content/common/dom_storage/dom_storage_map.cc b/content/common/dom_storage/dom_storage_map.cc -index fd088fb170be..a9e4b3375e9b 100644 +index fd088fb170bead6452ded14016f21f0c29659e03..a9e4b3375e9b614ed1e8b737a30f4436adb12c37 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, diff --git a/patches/common/chromium/dump_syms.patch b/patches/common/chromium/dump_syms.patch index 626cd02a67..836a9f6966 100644 --- a/patches/common/chromium/dump_syms.patch +++ b/patches/common/chromium/dump_syms.patch @@ -1,5 +1,14 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Attard +Date: Thu, 18 Oct 2018 17:07:47 -0700 +Subject: dump_syms.patch + +dylib currently fails to resolve Squirrel.framework on OSX, we need to fix +this but it is not a blocker for releasing Electron. This patch removes +the hard fail on dylib resolve failure from dump_syms + diff --git a/components/crash/content/tools/generate_breakpad_symbols.py b/components/crash/content/tools/generate_breakpad_symbols.py -index 2032f1991ada..58646a10591a 100755 +index 2032f1991ada8669a393838c57b2fd054a81a3e1..58646a10591a1d3e7c2dd1782c3642b9cbe06738 100755 --- a/components/crash/content/tools/generate_breakpad_symbols.py +++ b/components/crash/content/tools/generate_breakpad_symbols.py @@ -159,7 +159,7 @@ def GetSharedLibraryDependenciesMac(binary, exe_path): @@ -11,3 +20,6 @@ index 2032f1991ada..58646a10591a 100755 return deps +-- +2.17.0 + diff --git a/patches/common/chromium/enable_osr_components.patch b/patches/common/chromium/enable_osr_components.patch index 8de9b89cfa..365294f301 100644 --- a/patches/common/chromium/enable_osr_components.patch +++ b/patches/common/chromium/enable_osr_components.patch @@ -1,4 +1,4 @@ -From dab99d95ea1d84d1bb263029096a23634b795a94 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 20 Sep 2018 17:49:52 -0700 Subject: enable_osr_components.patch @@ -6,7 +6,7 @@ Subject: enable_osr_components.patch Add MouseWheelPhaseHandler for OSR. diff --git a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h -index 305095fc420e..f5ca4eda4a66 100644 +index 305095fc420e1732bdf089dfeee7672f69d85167..f5ca4eda4a663b9297ce69e6a455d7554f1fbe5c 100644 --- a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h +++ b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h @@ -7,6 +7,7 @@ diff --git a/patches/common/chromium/enable_widevine.patch b/patches/common/chromium/enable_widevine.patch index 2a4bde7d5c..bf62490bc2 100644 --- a/patches/common/chromium/enable_widevine.patch +++ b/patches/common/chromium/enable_widevine.patch @@ -1,4 +1,4 @@ -From 40198545a62b90741d1adf0e1f61e1fb43b4b73a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Thu, 20 Sep 2018 17:50:03 -0700 Subject: enable_widevine.patch @@ -8,7 +8,7 @@ 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 82a93622585a..cbd10bed9f3b 100644 +index 82a93622585a424f56c3567050f9ba4822de6c1e..cbd10bed9f3bdbeb61ec5daa2f8d0e158549b7fd 100644 --- a/third_party/widevine/cdm/widevine.gni +++ b/third_party/widevine/cdm/widevine.gni @@ -7,7 +7,7 @@ import("//media/media_options.gni") 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 ed3de41bcd..0a4e3c711b 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 @@ -1,13 +1,13 @@ -From 2f416aedbe6580b1ef07a2f76c22bcd9d1ef5942 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Thu, 20 Sep 2018 17:50:45 -0700 Subject: exclude-a-few-test-files-from-build.patch -Compilation of those files fails with the Chromium 67. -Remove the patch during the Chromium 68 upgrade. +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 d5d8e48305ba..070c6be426f4 100644 +index d5d8e48305ba20926415a3e94f8732baf327a14b..070c6be426f4affcfb3a08199f8f1bd71ebd5f52 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn @@ -1790,7 +1790,7 @@ jumbo_source_set("blink_platform_unittests_sources") { diff --git a/patches/common/chromium/expose-net-observer-api.patch b/patches/common/chromium/expose-net-observer-api.patch index 1cc8369379..1a13da2201 100644 --- a/patches/common/chromium/expose-net-observer-api.patch +++ b/patches/common/chromium/expose-net-observer-api.patch @@ -1,11 +1,13 @@ -From f9178257245c16180336ff06debc6778d80b0975 Mon Sep 17 00:00:00 2001 -From: Jeremy Apthorp -Date: Mon, 1 Oct 2018 12:16:41 -0700 -Subject: Expose URLRequestContextGetter::{Add,Remove}Observer +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 18 Oct 2018 17:06:56 -0700 +Subject: expose-net-observer-api.patch +Expose URLRequestContextGetter::{Add,Remove}Observer. +This patch should be removed once we switch to using the net service (cc @robo) diff --git a/net/url_request/url_request_context_getter.h b/net/url_request/url_request_context_getter.h -index 7a2dcd9de423..494526c843b9 100644 +index 7a2dcd9de423cca8e39f84e7f6839eefd86c11ae..494526c843b9e39eba46785618960c3e94d06866 100644 --- a/net/url_request/url_request_context_getter.h +++ b/net/url_request/url_request_context_getter.h @@ -79,11 +79,16 @@ class NET_EXPORT URLRequestContextGetter diff --git a/patches/common/chromium/frame_host_manager.patch b/patches/common/chromium/frame_host_manager.patch index d54153076e..8b56cfc662 100644 --- a/patches/common/chromium/frame_host_manager.patch +++ b/patches/common/chromium/frame_host_manager.patch @@ -1,11 +1,11 @@ -From 4730f77f43c648f6168db58897b4569326a75627 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:45:59 -0700 Subject: frame_host_manager.patch diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc -index 872e4609c94f..a59676004f24 100644 +index 872e4609c94f1e052d623ae57c1279c72eb2c3f4..a59676004f2411631418bf12e2978623b9b27b53 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc @@ -1960,6 +1960,18 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( @@ -68,7 +68,7 @@ index 872e4609c94f..a59676004f24 100644 request.state() == NavigationRequest::FAILED, request.restore_type() != RestoreType::NONE, request.is_view_source(), diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 3be31602689c..2c22cb1cfe0d 100644 +index 3be31602689cb93b965729cc4e35cf6d23a8ec2f..2c22cb1cfe0dddc97c00e5f4ff89de6b18bc232f 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -196,6 +196,15 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/common/chromium/gin_enable_disable_v8_platform.patch b/patches/common/chromium/gin_enable_disable_v8_platform.patch index 2188279d5b..aa43e0e846 100644 --- a/patches/common/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/common/chromium/gin_enable_disable_v8_platform.patch @@ -1,11 +1,11 @@ -From eaf64921a97d513151d48ab01975b5ac966a7e34 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:47:44 -0700 Subject: gin_enable_disable_v8_platform.patch diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc -index e3a23cf30e42..e099fd3f03e5 100644 +index e3a23cf30e42e11da1880c4ef13daf254b931d4b..e099fd3f03e56bbbf3ceab45edb8f4b8eb0b2b0f 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc @@ -116,9 +116,10 @@ IsolateHolder::~IsolateHolder() { @@ -22,7 +22,7 @@ index e3a23cf30e42..e099fd3f03e5 100644 g_reference_table = reference_table; } diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index a70ad1ce51a9..84cf66e6e9cd 100644 +index a70ad1ce51a9e1ba3f4152bde9f1bb097ffe6341..84cf66e6e9cdbfcdc3d8f0a1f0c122e5994ef1c2 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h @@ -83,7 +83,8 @@ class GIN_EXPORT IsolateHolder { @@ -36,7 +36,7 @@ index a70ad1ce51a9..84cf66e6e9cd 100644 v8::Isolate* isolate() { return isolate_; } diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc -index be2b9149e440..816e56aa4f6b 100644 +index be2b9149e4407a7a946aa9fd240781fe25e9a51e..816e56aa4f6becbc8840ca567b30e874d72825fb 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc @@ -236,12 +236,14 @@ LoadV8FileResult MapOpenedFile(const OpenedFileMap::mapped_type& file_region, @@ -57,7 +57,7 @@ index be2b9149e440..816e56aa4f6b 100644 if (base::FeatureList::IsEnabled(features::kV8OptimizeJavascript)) { static const char optimize[] = "--opt"; diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h -index 6f3265ba4d06..29f28bebbdcd 100644 +index 6f3265ba4d06e70930630432bf739f89847d0b3c..29f28bebbdcde5a7f1c7b31a625d30f1b8079c39 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 b43cec35a3..0362830bd1 100644 --- a/patches/common/chromium/gritsettings_resource_ids.patch +++ b/patches/common/chromium/gritsettings_resource_ids.patch @@ -1,5 +1,12 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 18 Oct 2018 17:07:17 -0700 +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 efa6e5c90b88..a40476bb9c87 100644 +index efa6e5c90b88c25f412ad4e49c94f82a87f0f456..a40476bb9c8794f1db05b930e80ad483759a3508 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids @@ -407,6 +407,11 @@ @@ -14,3 +21,6 @@ index efa6e5c90b88..a40476bb9c87 100644 # END "everything else" section. # Everything but chrome/, components/, content/, and ios/ +-- +2.17.0 + diff --git a/patches/common/chromium/gtk_visibility.patch b/patches/common/chromium/gtk_visibility.patch index eb6cfefa3c..8a6fca125d 100644 --- a/patches/common/chromium/gtk_visibility.patch +++ b/patches/common/chromium/gtk_visibility.patch @@ -1,4 +1,4 @@ -From cac9e74e69a7f46b9e1f7b719b17e9a7167d3836 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:48:38 -0700 Subject: gtk_visibility.patch diff --git a/patches/common/chromium/ignore_rc_check.patch b/patches/common/chromium/ignore_rc_check.patch index 4c426024a9..d8e0e43bc4 100644 --- a/patches/common/chromium/ignore_rc_check.patch +++ b/patches/common/chromium/ignore_rc_check.patch @@ -1,4 +1,4 @@ -From 6b31ce372295634832d0c2aa28534c8f4cc885f3 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zac Walker Date: Thu, 20 Sep 2018 17:49:55 -0700 Subject: ignore_rc_check.patch @@ -7,7 +7,7 @@ Dont compare RC.exe and RC.py output. FIXME: It has to be reverted once the script is fixed. diff --git a/build/toolchain/win/tool_wrapper.py b/build/toolchain/win/tool_wrapper.py -index ee21eb4b194b..ab98a033a61c 100644 +index cb0393ecd507b865169e9d7c3037d7d5523ae30e..34eebb06295b38dfa0b567f66780ce144b6b5f34 100644 --- a/build/toolchain/win/tool_wrapper.py +++ b/build/toolchain/win/tool_wrapper.py @@ -231,7 +231,11 @@ class WinTool(object): diff --git a/patches/common/chromium/isolate_holder.patch b/patches/common/chromium/isolate_holder.patch index 86a2bb0077..339a46d4d0 100644 --- a/patches/common/chromium/isolate_holder.patch +++ b/patches/common/chromium/isolate_holder.patch @@ -1,5 +1,14 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Attard +Date: Thu, 18 Oct 2018 17:07:27 -0700 +Subject: isolate_holder.patch + +Pass pre allocated isolate for initialization, node platform +needs to register on an isolate so that it can be used later +down in the initialization process of an isolate. + diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc -index e099fd3f03e5..4b362843e4f8 100644 +index e099fd3f03e56bbbf3ceab45edb8f4b8eb0b2b0f..4b362843e4f8f3a1e2abfa152a51554b1d36dd96 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc @@ -46,7 +46,8 @@ IsolateHolder::IsolateHolder( @@ -26,7 +35,7 @@ index e099fd3f03e5..4b362843e4f8 100644 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 84cf66e6e9cd..cc0d65e4e4be 100644 +index 84cf66e6e9cdbfcdc3d8f0a1f0c122e5994ef1c2..cc0d65e4e4be5818d526c0a46a60e1165697cac0 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h @@ -66,7 +66,8 @@ class GIN_EXPORT IsolateHolder { @@ -39,3 +48,6 @@ index 84cf66e6e9cd..cc0d65e4e4be 100644 ~IsolateHolder(); // Should be invoked once before creating IsolateHolder instances to +-- +2.17.0 + diff --git a/patches/common/chromium/leveldb_ssize_t.patch b/patches/common/chromium/leveldb_ssize_t.patch index 5782d7bd52..b9572c2b1f 100644 --- a/patches/common/chromium/leveldb_ssize_t.patch +++ b/patches/common/chromium/leveldb_ssize_t.patch @@ -1,4 +1,4 @@ -From 070bbbe44c20c52f5e12b04b01fc101a42633119 Mon Sep 17 00:00:00 2001 +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 @@ -8,7 +8,7 @@ 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 a7c449eba19c..acbce7efd582 100644 +index a7c449eba19c3e3f46eec9c428fb497f6b1a7852..acbce7efd582e226419054cf80e1c27f4919b2fb 100644 --- a/third_party/leveldatabase/port/port_chromium.h +++ b/third_party/leveldatabase/port/port_chromium.h @@ -26,7 +26,11 @@ diff --git a/patches/common/chromium/libgtkui_export.patch b/patches/common/chromium/libgtkui_export.patch index 18de1df0e6..fe4f999ba5 100644 --- a/patches/common/chromium/libgtkui_export.patch +++ b/patches/common/chromium/libgtkui_export.patch @@ -1,4 +1,4 @@ -From 4eacd7975250d8954e461f880d6bb97dcb4b003d Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:48:31 -0700 Subject: 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/app_indicator_icon.h b/chrome/browser/ui/libgtkui/app_indicator_icon.h -index 7815fbb2cea8..f17a5c59e64b 100644 +index 7815fbb2cea8d3c3434287fa32c57e095199c217..f17a5c59e64b22ef0b864c3b8dd2dcb8b17d0c84 100644 --- a/chrome/browser/ui/libgtkui/app_indicator_icon.h +++ b/chrome/browser/ui/libgtkui/app_indicator_icon.h @@ -12,6 +12,7 @@ @@ -27,7 +27,7 @@ index 7815fbb2cea8..f17a5c59e64b 100644 // The id uniquely identifies the new status icon from other chrome status // icons. diff --git a/chrome/browser/ui/libgtkui/gtk_status_icon.h b/chrome/browser/ui/libgtkui/gtk_status_icon.h -index e4e0da40981c..af028715ada9 100644 +index e4e0da40981ca58964dfdcbd3fc0f730c9c09ec1..af028715ada9b8023f0ff7cf60e0f7e7acd6c042 100644 --- a/chrome/browser/ui/libgtkui/gtk_status_icon.h +++ b/chrome/browser/ui/libgtkui/gtk_status_icon.h @@ -10,6 +10,7 @@ @@ -48,7 +48,7 @@ index e4e0da40981c..af028715ada9 100644 Gtk2StatusIcon(const gfx::ImageSkia& image, const base::string16& tool_tip); ~Gtk2StatusIcon() override; diff --git a/chrome/browser/ui/libgtkui/gtk_util.h b/chrome/browser/ui/libgtkui/gtk_util.h -index d9f245070249..56cce5fa3e0b 100644 +index d9f245070249f5f153bd8fe11e0a5e718c7d3629..a0f033c3e3f7f3996897f5f969b2a209d7d5cf3f 100644 --- a/chrome/browser/ui/libgtkui/gtk_util.h +++ b/chrome/browser/ui/libgtkui/gtk_util.h @@ -11,6 +11,7 @@ @@ -81,17 +81,17 @@ index d9f245070249..56cce5fa3e0b 100644 // Gets the transient parent aura window for |dialog|. aura::Window* GetAuraTransientParent(GtkWidget* dialog); -@@ -190,7 +190,7 @@ void RenderBackground(const gfx::Size& size, +@@ -193,7 +194,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. -SkColor GetBgColor(const std::string& css_selector); +LIBGTKUI_EXPORT SkColor GetBgColor(const std::string& css_selector); - + // Renders the border from the style context created by // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and diff --git a/chrome/browser/ui/libgtkui/skia_utils_gtk.h b/chrome/browser/ui/libgtkui/skia_utils_gtk.h -index e05fbe9d8b2f..3afca9a72ab6 100644 +index e05fbe9d8b2fe537a5eecbd3642dcc9eb848f3d7..3afca9a72ab69fed0144cfff8159aff5a480c4f5 100644 --- a/chrome/browser/ui/libgtkui/skia_utils_gtk.h +++ b/chrome/browser/ui/libgtkui/skia_utils_gtk.h @@ -7,6 +7,7 @@ @@ -112,7 +112,7 @@ index e05fbe9d8b2f..3afca9a72ab6 100644 } // namespace libgtkui diff --git a/chrome/browser/ui/libgtkui/unity_service.h b/chrome/browser/ui/libgtkui/unity_service.h -index 8d67e1460837..95fbb27b6a81 100644 +index 8d67e1460837c7f8adb151adea131cc6440659a3..95fbb27b6a81e4d73d239e94f5105078a936b5af 100644 --- a/chrome/browser/ui/libgtkui/unity_service.h +++ b/chrome/browser/ui/libgtkui/unity_service.h @@ -5,18 +5,20 @@ diff --git a/patches/common/chromium/mas-audiodeviceduck.patch b/patches/common/chromium/mas-audiodeviceduck.patch index 16b5466801..06dc4350bf 100644 --- a/patches/common/chromium/mas-audiodeviceduck.patch +++ b/patches/common/chromium/mas-audiodeviceduck.patch @@ -1,4 +1,4 @@ -From 2a1f4c039a4522620daea2898870c220318d539a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:49:31 -0700 Subject: mas-audiodeviceduck.patch @@ -6,7 +6,7 @@ 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 53586b888d82..c1d750dbf32d 100644 +index 53586b888d82b9602e3f76b84072a1e6a7df1ec0..c1d750dbf32d9c56d557e5bf5ff5d63a3abe12ef 100644 --- a/media/audio/mac/audio_low_latency_input_mac.cc +++ b/media/audio/mac/audio_low_latency_input_mac.cc @@ -31,19 +31,23 @@ diff --git a/patches/common/chromium/mas-cfisobjc.patch b/patches/common/chromium/mas-cfisobjc.patch index 364e1b49ec..b929641fde 100644 --- a/patches/common/chromium/mas-cfisobjc.patch +++ b/patches/common/chromium/mas-cfisobjc.patch @@ -1,4 +1,4 @@ -From 715baf9c695bdfffc525cc2984306768bfa7140e Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:49:20 -0700 Subject: mas-cfisobjc.patch @@ -6,7 +6,7 @@ Subject: mas-cfisobjc.patch Removes usage of the _CFIsObjC private API. diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm -index 15fc15ba307e..7ca4e0ec5ca8 100644 +index 15fc15ba307e18f438852f00f41b2f5ecf7ff85f..7ca4e0ec5ca87f34e0baa22ba0b704e25fe7ca21 100644 --- a/base/mac/foundation_util.mm +++ b/base/mac/foundation_util.mm @@ -26,7 +26,6 @@ CFTypeID SecKeyGetTypeID(); diff --git a/patches/common/chromium/mas-cgdisplayusesforcetogray.patch b/patches/common/chromium/mas-cgdisplayusesforcetogray.patch index 19f170999e..710a0602c7 100644 --- a/patches/common/chromium/mas-cgdisplayusesforcetogray.patch +++ b/patches/common/chromium/mas-cgdisplayusesforcetogray.patch @@ -1,4 +1,4 @@ -From a767540b22c787e0ec6809f275e7cba5f9048792 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:49:24 -0700 Subject: 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 99a128511250..7200a5df74e1 100644 +index 99a128511250d594cdac79ebf9b291823db18962..7200a5df74e168b817f7e7598b7fce8b41c6515c 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 cccf386a10..e5f3c41ec8 100644 --- a/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch +++ b/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch @@ -1,4 +1,4 @@ -From c7042021cfd9d4e50b107e372225a14f7492bce5 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:49:34 -0700 Subject: mas-lssetapplicationlaunchservicesserverconnectionstatus.patch @@ -7,7 +7,7 @@ Removes usage of the _LSSetApplicationLaunchServicesServerConnectionStatus private API. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index f14c045d47ad..9c8751a6fe0b 100644 +index f14c045d47add3159e9099a8bdb511b233a2911b..9c8751a6fe0bcd0c69cc47dbbcf4fcc8a5c6684f 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc @@ -274,8 +274,10 @@ int GpuMain(const MainFunctionParams& parameters) { diff --git a/patches/common/chromium/mas_blink_no_private_api.patch b/patches/common/chromium/mas_blink_no_private_api.patch index e59aac3521..6b067ae242 100644 --- a/patches/common/chromium/mas_blink_no_private_api.patch +++ b/patches/common/chromium/mas_blink_no_private_api.patch @@ -1,4 +1,4 @@ -From b75117921e735e5d892a7320e1ebec84a2c2fd1a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:48:49 -0700 Subject: mas_blink_no_private_api.patch @@ -7,7 +7,7 @@ Guard usages in chromium code of private Mac APIs by MAS_BUILD, so they can be excluded for people who want to submit their apps to the Mac App store. diff --git a/third_party/blink/renderer/core/editing/kill_ring_mac.mm b/third_party/blink/renderer/core/editing/kill_ring_mac.mm -index 94afefcee81b..2ec7f04c7182 100644 +index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d33e833a8 100644 --- a/third_party/blink/renderer/core/editing/kill_ring_mac.mm +++ b/third_party/blink/renderer/core/editing/kill_ring_mac.mm @@ -27,6 +27,7 @@ @@ -73,7 +73,7 @@ index 94afefcee81b..2ec7f04c7182 100644 } // namespace blink diff --git a/third_party/blink/renderer/core/paint/theme_painter_mac.mm b/third_party/blink/renderer/core/paint/theme_painter_mac.mm -index 7a1260db0a13..bf9cf7046e2f 100644 +index 7a1260db0a139f9f3f8a823af2c220f36162812a..bf9cf7046e2fc9cdfee5b92f2a348185cc00b944 100644 --- a/third_party/blink/renderer/core/paint/theme_painter_mac.mm +++ b/third_party/blink/renderer/core/paint/theme_painter_mac.mm @@ -42,6 +42,7 @@ diff --git a/patches/common/chromium/mas_no_private_api.patch b/patches/common/chromium/mas_no_private_api.patch index ef6e0553e8..ed25af25a7 100644 --- a/patches/common/chromium/mas_no_private_api.patch +++ b/patches/common/chromium/mas_no_private_api.patch @@ -1,4 +1,4 @@ -From c353972f86d7c8afea19128dd404f4532b3ac9c1 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 9 Oct 2018 10:36:20 -0700 Subject: mas_no_private_api.patch @@ -7,7 +7,7 @@ Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be excluded for people who want to submit their apps to the Mac App store. diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h -index 44c85b5ad571..1714c403edf2 100644 +index 44c85b5ad571c39c4580cb9d0cdf08f694c1dfb4..1714c403edf21092e43192f25cf0c19f50dd8486 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.h +++ b/content/browser/accessibility/browser_accessibility_cocoa.h @@ -111,7 +111,9 @@ struct AXTextEdit { @@ -38,7 +38,7 @@ index 44c85b5ad571..1714c403edf2 100644 // 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 07e9862b76a9..efa52aa9de2f 100644 +index 07e9862b76a920438a779f22d67d3a45ab39abf7..efa52aa9de2f819f28109978c8cef518325ef70a 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.mm +++ b/content/browser/accessibility/browser_accessibility_cocoa.mm @@ -135,6 +135,7 @@ NSDictionary* attributeToMethodNameMap = nil; @@ -181,7 +181,7 @@ index 07e9862b76a9..efa52aa9de2f 100644 return nil; } diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm -index 8e32a0822607..93bb7273684f 100644 +index 8e32a08226079c6d7515b8e784babacb3226ecd6..93bb7273684fa529bdc6049af2ed379f8b059397 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm @@ -437,6 +437,7 @@ NSDictionary* BrowserAccessibilityManagerMac:: @@ -201,7 +201,7 @@ index 8e32a0822607..93bb7273684f 100644 } diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm -index 1e2cc38d3868..daa934c345e2 100644 +index 1e2cc38d3868ceccf8e45f5f82f57bcaa478f982..daa934c345e2686fd2174b7721d0f69a2d094692 100644 --- a/content/renderer/renderer_main_platform_delegate_mac.mm +++ b/content/renderer/renderer_main_platform_delegate_mac.mm @@ -22,6 +22,7 @@ @@ -237,7 +237,7 @@ index 1e2cc38d3868..daa934c345e2 100644 // You are about to read a pretty disgusting hack. In a static initializer, diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm -index 8b2092ec78f9..4f2ee8e28097 100644 +index 8b2092ec78f9f6bc1bd4c8af21ada74538f54d29..4f2ee8e2809790df68aedcee0946263143c7e758 100644 --- a/device/bluetooth/bluetooth_adapter_mac.mm +++ b/device/bluetooth/bluetooth_adapter_mac.mm @@ -34,6 +34,7 @@ @@ -281,7 +281,7 @@ index 8b2092ec78f9..4f2ee8e28097 100644 void BluetoothAdapterMac::RemovePairingDelegateInternal( diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index 585ad87c6cb4..4305c2e67dcc 100644 +index 585ad87c6cb45d199bec8ed6e2430139546c83c2..4305c2e67dccb94a6cacd0664783906473f219e9 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn @@ -196,6 +196,12 @@ source_set("audio") { @@ -298,7 +298,7 @@ index 585ad87c6cb4..4305c2e67dcc 100644 "AudioToolbox.framework", "AudioUnit.framework", diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc -index 74dd21d45b4f..d7dd95b4d461 100644 +index 74dd21d45b4ff8da203ef7d759bbccf05033f862..d7dd95b4d461981c36061d1031c932fcb6f2e31b 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc @@ -868,7 +868,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( @@ -311,7 +311,7 @@ index 74dd21d45b4f..d7dd95b4d461 100644 } diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc -index 06e9d7969c0f..6fc766e981fd 100644 +index 06e9d7969c0f21726de216cd670e4752c8aff6ab..6fc766e981fdc59fcbb3c0780fde87c5cd953e2d 100644 --- a/net/dns/dns_config_service_posix.cc +++ b/net/dns/dns_config_service_posix.cc @@ -242,6 +242,7 @@ class DnsConfigServicePosix::Watcher { @@ -331,7 +331,7 @@ index 06e9d7969c0f..6fc766e981fd 100644 } diff --git a/sandbox/mac/sandbox_compiler.cc b/sandbox/mac/sandbox_compiler.cc -index e524aa7b8510..718d3f963da5 100644 +index e524aa7b851022abed1edac39e18d8d92e5349b4..718d3f963da5c1a15a1bdb0e6043f89bc0f940f8 100644 --- a/sandbox/mac/sandbox_compiler.cc +++ b/sandbox/mac/sandbox_compiler.cc @@ -28,6 +28,7 @@ bool SandboxCompiler::InsertStringParam(const std::string& key, @@ -351,7 +351,7 @@ index e524aa7b8510..718d3f963da5 100644 } diff --git a/sandbox/mac/seatbelt.cc b/sandbox/mac/seatbelt.cc -index dfba0bded9e3..876f96999f53 100644 +index dfba0bded9e34be276ed111cbab44210a95b9875..876f96999f53b4666508f783a33cea245d1bc03e 100644 --- a/sandbox/mac/seatbelt.cc +++ b/sandbox/mac/seatbelt.cc @@ -64,7 +64,11 @@ void Seatbelt::FreeError(char* errorbuf) { @@ -367,7 +367,7 @@ index dfba0bded9e3..876f96999f53 100644 } // namespace sandbox diff --git a/sandbox/mac/seatbelt_extension.cc b/sandbox/mac/seatbelt_extension.cc -index 9073364142e8..2356add74dfa 100644 +index 9073364142e8f98c8872d9b5509f92f433e06624..2356add74dfae98299a4e2b207aa26fc109f47f3 100644 --- a/sandbox/mac/seatbelt_extension.cc +++ b/sandbox/mac/seatbelt_extension.cc @@ -8,6 +8,7 @@ @@ -423,7 +423,7 @@ index 9073364142e8..2356add74dfa 100644 NOTREACHED(); return nullptr; diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm -index 69c5f1f44d7e..8841b59f6b70 100644 +index 69c5f1f44d7e39e8480319b3da02725b5cb89eea..8841b59f6b70ac4687adfde61a1fba1424e57e48 100644 --- a/ui/views/cocoa/bridged_native_widget.mm +++ b/ui/views/cocoa/bridged_native_widget.mm @@ -43,6 +43,7 @@ diff --git a/patches/common/chromium/net_url_request_job.patch b/patches/common/chromium/net_url_request_job.patch index 55c42175af..05e5cf35cb 100644 --- a/patches/common/chromium/net_url_request_job.patch +++ b/patches/common/chromium/net_url_request_job.patch @@ -1,11 +1,11 @@ -From 49270a5ff41a1808c33e61e832e251979670f6f7 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:46:06 -0700 Subject: net_url_request_job.patch diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h -index 7a2239587510..08a3940915c6 100644 +index 7a223958751012b2042a91edf85578b00702d565..08a3940915c61746c7bf80d24400875099f9686c 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h @@ -292,6 +292,7 @@ class NET_EXPORT URLRequestJob : public base::PowerObserver { diff --git a/patches/common/chromium/no_cache_storage_check.patch b/patches/common/chromium/no_cache_storage_check.patch index b501de811b..9ee1907224 100644 --- a/patches/common/chromium/no_cache_storage_check.patch +++ b/patches/common/chromium/no_cache_storage_check.patch @@ -1,4 +1,4 @@ -From 528adce1472de7f07de909d451c215c474f9c646 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:48:16 -0700 Subject: no_cache_storage_check.patch @@ -7,7 +7,7 @@ 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 d91b54a4d2a1..7f946a5a04c9 100644 +index d91b54a4d2a15f4d48f6e82488e0c27c68c5abdb..7f946a5a04c97635f783aeecebc13fc20b26631e 100644 --- a/content/browser/cache_storage/cache_storage.cc +++ b/content/browser/cache_storage/cache_storage.cc @@ -132,7 +132,7 @@ class CacheStorage::CacheLoader { diff --git a/patches/common/chromium/no_stack_dumping.patch b/patches/common/chromium/no_stack_dumping.patch index ba4e0c6f13..0e8daabe8a 100644 --- a/patches/common/chromium/no_stack_dumping.patch +++ b/patches/common/chromium/no_stack_dumping.patch @@ -1,11 +1,11 @@ -From 643954ec09f12c4d97767cbfcfb24e92fbcd5230 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Thu, 20 Sep 2018 17:46:10 -0700 Subject: no_stack_dumping.patch diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 8d789ef1b9f7..034fdcad958c 100644 +index 8d789ef1b9f76aacbf1bc8c13b79de04618b9141..034fdcad958cb25780c304d184b2fbb721a13200 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc @@ -835,7 +835,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { diff --git a/patches/common/chromium/notification_provenance.patch b/patches/common/chromium/notification_provenance.patch index 177db460b2..d2e0374e9e 100644 --- a/patches/common/chromium/notification_provenance.patch +++ b/patches/common/chromium/notification_provenance.patch @@ -1,4 +1,4 @@ -From 5c9dd74385e37830bff8918b54868ac37042c513 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Fri, 5 Oct 2018 14:22:06 -0700 Subject: pass RenderProcessHost through to PlatformNotificationService @@ -6,7 +6,7 @@ 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 cbcd2b5369fc..1b4066649d92 100644 +index cbcd2b5369fc513bed8190a83431826cba4e7637..1b4066649d926f18c0f1286243bfde848d80f1e3 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( @@ -31,7 +31,7 @@ index cbcd2b5369fc..1b4066649d92 100644 } diff --git a/content/browser/notifications/blink_notification_service_impl.h b/content/browser/notifications/blink_notification_service_impl.h -index 193f5d241c31..3cfcc6b86ae1 100644 +index 193f5d241c314e9921048d592602e5caa362f198..3cfcc6b86ae10102a1cc9e9abb27c529a57511cb 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 @@ -51,7 +51,7 @@ index 193f5d241c31..3cfcc6b86ae1 100644 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 618c7bd88cde..f528be53cffe 100644 +index 618c7bd88cde563eaaf93914039b5fb6d81db514..be08e89b5c6d57abf6b61ed9ee4b1c536a6ca134 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 { @@ -64,7 +64,7 @@ index 618c7bd88cde..f528be53cffe 100644 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 627e8dbd251d..48c290470e48 100644 +index 627e8dbd251d952f1567847775d8147e78e697b9..48c290470e4854a5e17c70bbfe178a34ffe7d73f 100644 --- a/content/browser/notifications/platform_notification_context_impl.cc +++ b/content/browser/notifications/platform_notification_context_impl.cc @@ -122,12 +122,13 @@ void PlatformNotificationContextImpl::ShutdownOnIO() { @@ -84,7 +84,7 @@ index 627e8dbd251d..48c290470e48 100644 void PlatformNotificationContextImpl::RemoveService( diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h -index 7ea92b626202..faa3a1d8069f 100644 +index 7ea92b626202fcc3c1a830e74549ef87c206c4cd..faa3a1d8069f2d87c22cb40f98bc1d96db557464 100644 --- a/content/browser/notifications/platform_notification_context_impl.h +++ b/content/browser/notifications/platform_notification_context_impl.h @@ -21,6 +21,7 @@ @@ -106,7 +106,7 @@ index 7ea92b626202..faa3a1d8069f 100644 // 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 896f1b27ded7..20a1f86a36fd 100644 +index 896f1b27ded7a73c62ec16d11418dacb0631d976..20a1f86a36fdefe3eeeb56a56eff874e2d6422fd 100644 --- a/content/browser/renderer_interface_binders.cc +++ b/content/browser/renderer_interface_binders.cc @@ -168,7 +168,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { @@ -119,7 +119,7 @@ index 896f1b27ded7..20a1f86a36fd 100644 parameterized_binder_registry_.AddInterface( base::BindRepeating(&BackgroundFetchServiceImpl::Create)); diff --git a/content/public/browser/platform_notification_service.h b/content/public/browser/platform_notification_service.h -index 228fc30240c5..fd3e20c5335a 100644 +index 228fc30240c5251c0a4182f085b41c189e28365d..fd3e20c5335a09ba5bae31a76cc4a2cc3ad0a2f0 100644 --- a/content/public/browser/platform_notification_service.h +++ b/content/public/browser/platform_notification_service.h @@ -21,6 +21,7 @@ class GURL; @@ -139,7 +139,7 @@ index 228fc30240c5..fd3e20c5335a 100644 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 28dc2651a326..646817070e7f 100644 +index 28dc2651a3269a4e7483d7e84a25d85f98083fcf..646817070e7fd831eb6caff5a369357dce2cccec 100644 --- a/content/test/mock_platform_notification_service.cc +++ b/content/test/mock_platform_notification_service.cc @@ -20,6 +20,7 @@ MockPlatformNotificationService::MockPlatformNotificationService() = default; @@ -151,7 +151,7 @@ index 28dc2651a326..646817070e7f 100644 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 baf24f9effc9..98a128e5d249 100644 +index baf24f9effc9569f070757832681a82e62322d30..98a128e5d24933fbf98a5cfdda90b0611fce63d8 100644 --- a/content/test/mock_platform_notification_service.h +++ b/content/test/mock_platform_notification_service.h @@ -42,6 +42,7 @@ class MockPlatformNotificationService : public PlatformNotificationService { diff --git a/patches/common/chromium/out_of_process_instance.patch b/patches/common/chromium/out_of_process_instance.patch index 7001607746..85afb1da18 100644 --- a/patches/common/chromium/out_of_process_instance.patch +++ b/patches/common/chromium/out_of_process_instance.patch @@ -1,11 +1,11 @@ -From 2c3fe795d68b12828a1891c062b77a9b3cddf017 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:46:17 -0700 Subject: out_of_process_instance.patch diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc -index 0358d15fb45b..101763db35d1 100644 +index 0358d15fb45bb57111ee2af0f791cd99f6f27f70..101763db35d129097bda50af1bfa9f6fb54b2228 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, diff --git a/patches/common/chromium/pepper_flash.patch b/patches/common/chromium/pepper_flash.patch index cc16764e1b..e9294d535c 100644 --- a/patches/common/chromium/pepper_flash.patch +++ b/patches/common/chromium/pepper_flash.patch @@ -1,4 +1,4 @@ -From 9d163de412e3c578003f946641b9f840edfc45a4 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:48:09 -0700 Subject: pepper_flash.patch @@ -6,7 +6,7 @@ Subject: pepper_flash.patch Allows building chrome pepper flash integration for Electron. diff --git a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h -index 735da93c3cab..533f53fbc423 100644 +index 735da93c3cabb8c6139971295740ba14a30d1b69..533f53fbc42397608e3762e370cc935c045ce3f1 100644 --- a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h +++ b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h @@ -5,6 +5,7 @@ @@ -28,7 +28,7 @@ index 735da93c3cab..533f53fbc423 100644 // 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 f4f1741a8ecf..103238cdd53f 100644 +index f4f1741a8ecfdb570e3fe77d39146329c0677c13..103238cdd53f8f103de55e199162979c6ace948c 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 @@ @@ -61,7 +61,7 @@ index f4f1741a8ecf..103238cdd53f 100644 + 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 1c1844a9eb71..2c9834b11d34 100644 +index 1c1844a9eb71fe0d75cf8e3cef833fa5ffb13608..2c9834b11d34f6311f445c3ef8b62b907ab695c0 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 @@ @@ -132,7 +132,7 @@ index 1c1844a9eb71..2c9834b11d34 100644 device::mojom::WakeLock* PepperFlashBrowserHost::GetWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h b/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h -index 154120ce5156..5152fd847c01 100644 +index 154120ce5156d77dd302b85cb17e2f14fb69cc2d..5152fd847c012fc2f40017687db426fab955a905 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h +++ b/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h @@ -23,9 +23,11 @@ namespace content { @@ -179,7 +179,7 @@ index 154120ce5156..5152fd847c01 100644 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 e267746783bd..bc84b44ceb27 100644 +index e267746783bde72ff4f9d8a4ec706c25a039432f..bc84b44ceb276b57700be1300d5e860f482c4d20 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 @@ @@ -234,7 +234,7 @@ index e267746783bd..bc84b44ceb27 100644 } +#endif diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h -index aa4433cccff4..d9630fdf6b87 100644 +index aa4433cccff4bc637ce5e71039de3c4352e7cd6b..d9630fdf6b87e11fb9657814895dff36b04ccea8 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h +++ b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h @@ -11,7 +11,9 @@ @@ -258,7 +258,7 @@ index aa4433cccff4..d9630fdf6b87 100644 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 5599a2d3d62f..84e12cf5d273 100644 +index 5599a2d3d62f8511655a7bc1fa88e39187451fe8..84e12cf5d2731a8a7b0ba0396ba14db6d0478394 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 @@ @@ -357,7 +357,7 @@ index 5599a2d3d62f..84e12cf5d273 100644 int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem( ppapi::host::HostMessageContext* context) { diff --git a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h -index ca7f87b973e6..f73b596ce78e 100644 +index ca7f87b973e6e060db2123929da6a3b9fc0ae5a4..f73b596ce78eff9c14ac27699d5ecbd9ff69a0a0 100644 --- a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h +++ b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h @@ -19,7 +19,9 @@ @@ -403,7 +403,7 @@ index ca7f87b973e6..f73b596ce78e 100644 DISALLOW_COPY_AND_ASSIGN(PepperIsolatedFileSystemMessageFilter); }; diff --git a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc -index d63e90b6c507..c98a7bd07ddd 100644 +index d63e90b6c5079ab3237c4bad3d5e63ce2f99c657..c98a7bd07ddd9527fc67b05b24463ed4b05ec316 100644 --- a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc +++ b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc @@ -10,8 +10,10 @@ @@ -434,7 +434,7 @@ index d63e90b6c507..c98a7bd07ddd 100644 return nullptr; } diff --git a/chrome/renderer/pepper/pepper_flash_renderer_host.cc b/chrome/renderer/pepper/pepper_flash_renderer_host.cc -index 66a532e2cb41..e776d0e96c4a 100644 +index 66a532e2cb41cdbae83410dad95984cf02de4a67..e776d0e96c4a5e6523161a66a5c9a1c0e4ad2132 100644 --- a/chrome/renderer/pepper/pepper_flash_renderer_host.cc +++ b/chrome/renderer/pepper/pepper_flash_renderer_host.cc @@ -13,7 +13,9 @@ @@ -470,7 +470,7 @@ index 66a532e2cb41..e776d0e96c4a 100644 + return PP_ERROR_FAILED; } diff --git a/chrome/renderer/pepper/pepper_helper.h b/chrome/renderer/pepper/pepper_helper.h -index e021c964da3d..e035f0fb9e2b 100644 +index e021c964da3d467530775164a67d5cadaf6dc741..e035f0fb9e2baa6a9148b43765b09c52bc45599b 100644 --- a/chrome/renderer/pepper/pepper_helper.h +++ b/chrome/renderer/pepper/pepper_helper.h @@ -6,12 +6,14 @@ diff --git a/patches/common/chromium/printing.patch b/patches/common/chromium/printing.patch index 7adf7bf579..c98eaec5db 100644 --- a/patches/common/chromium/printing.patch +++ b/patches/common/chromium/printing.patch @@ -1,5 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Heilig Benedek +Date: Thu, 18 Oct 2018 17:08:18 -0700 +Subject: printing.patch + +Add changeset that was previously applied to sources in chromium_src. The +majority of changes originally come from these PRs: + * https://github.com/electron/electron/pull/1835 + * 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 1065e808e621..13715870097b 100644 +index 1065e808e621c087bde9320abe019f05292f977c..13715870097b4f47ae164c12deb2bf783049ca6a 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -20,12 +20,13 @@ @@ -26,7 +36,7 @@ index 1065e808e621..13715870097b 100644 + const base::string16& device_name) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); DCHECK_EQ(page_number_, PageNumber::npos()); - + @@ -200,6 +202,12 @@ void PrintJobWorker::GetSettings(bool ask_user_for_settings, base::BindOnce(&PrintJobWorker::GetSettingsWithUI, base::Unretained(this), document_page_count, @@ -43,7 +53,7 @@ index 1065e808e621..13715870097b 100644 @@ -316,6 +324,14 @@ void PrintJobWorker::UseDefaultSettings() { GetSettingsDone(result); } - + +void PrintJobWorker::InitWithDeviceName(const base::string16& device_name) { + const auto& settings = printing_context_->settings(); + std::unique_ptr dic(new base::DictionaryValue); @@ -54,9 +64,9 @@ index 1065e808e621..13715870097b 100644 + void PrintJobWorker::StartPrinting(PrintedDocument* new_document) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); - + diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h -index 182f7563e0c7..eed2230627d6 100644 +index 182f7563e0c7d6486a5d2843d86f66524c02cb10..eed2230627d6b35486081f628a2ee97895bf16cf 100644 --- a/chrome/browser/printing/print_job_worker.h +++ b/chrome/browser/printing/print_job_worker.h @@ -54,7 +54,8 @@ class PrintJobWorker { @@ -66,21 +76,21 @@ index 182f7563e0c7..eed2230627d6 100644 - bool is_modifiable); + bool is_modifiable, + const base::string16& device_name); - + // Set the new print settings from a dictionary value. void SetSettings(std::unique_ptr new_settings); @@ -155,6 +156,9 @@ class PrintJobWorker { // systems. void UseDefaultSettings(); - + + // set the printer name + void InitWithDeviceName(const base::string16& device_name); + // Printing context delegate. const std::unique_ptr printing_context_delegate_; - + diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc -index e1613a9b52ad..db62078f2c08 100644 +index e1613a9b52ad65afc8290498e8d9877ec58a0a10..db62078f2c084bb20681f7ef5ccccbceafd4f0b1 100644 --- a/chrome/browser/printing/print_preview_message_handler.cc +++ b/chrome/browser/printing/print_preview_message_handler.cc @@ -57,7 +57,7 @@ void StopWorker(int document_cookie) { @@ -97,11 +107,11 @@ index e1613a9b52ad..db62078f2c08 100644 std::move(shared_buf), data_size); } +#endif - + } // namespace - + @@ -81,7 +82,7 @@ PrintPreviewMessageHandler::PrintPreviewMessageHandler( - + PrintPreviewMessageHandler::~PrintPreviewMessageHandler() { } - @@ -114,7 +124,7 @@ index e1613a9b52ad..db62078f2c08 100644 } } +#endif - + void PrintPreviewMessageHandler::OnMetafileReadyForPrinting( content::RenderFrameHost* render_frame_host, @@ -171,7 +173,8 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting( @@ -146,7 +156,7 @@ index e1613a9b52ad..db62078f2c08 100644 @@ -318,15 +322,19 @@ void PrintPreviewMessageHandler::OnCompositePdfDocumentDone( base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(region)); } - + +#endif + bool PrintPreviewMessageHandler::OnMessageReceived( @@ -164,7 +174,7 @@ index e1613a9b52ad..db62078f2c08 100644 OnMetafileReadyForPrinting) IPC_MESSAGE_UNHANDLED(handled = false) @@ -336,10 +344,13 @@ bool PrintPreviewMessageHandler::OnMessageReceived( - + handled = true; IPC_BEGIN_MESSAGE_MAP(PrintPreviewMessageHandler, message) +#if 0 @@ -186,11 +196,11 @@ index e1613a9b52ad..db62078f2c08 100644 IPC_END_MESSAGE_MAP() return handled; diff --git a/chrome/browser/printing/print_preview_message_handler.h b/chrome/browser/printing/print_preview_message_handler.h -index 6356792f29e8..5592de3c097f 100644 +index 6356792f29e82182c12118825949fe869cc80f9b..5592de3c097fd5d13fb0183fd3627cbb229d57b2 100644 --- a/chrome/browser/printing/print_preview_message_handler.h +++ b/chrome/browser/printing/print_preview_message_handler.h @@ -37,8 +37,7 @@ struct PageSizeMargins; - + // Manages the print preview handling for a WebContents. class PrintPreviewMessageHandler - : public content::WebContentsObserver, @@ -198,16 +208,16 @@ index 6356792f29e8..5592de3c097f 100644 + : public content::WebContentsObserver { public: ~PrintPreviewMessageHandler() override; - + @@ -46,10 +45,11 @@ class PrintPreviewMessageHandler bool OnMessageReceived(const IPC::Message& message, content::RenderFrameHost* render_frame_host) override; - + - private: + protected: explicit PrintPreviewMessageHandler(content::WebContents* web_contents); friend class content::WebContentsUserData; - + +#if 0 // Gets the print preview dialog associated with the WebContents being // observed. @@ -235,11 +245,11 @@ index 6356792f29e8..5592de3c097f 100644 mojom::PdfCompositor::Status status, base::ReadOnlySharedMemoryRegion region); +#endif - + base::WeakPtrFactory weak_ptr_factory_; - + diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc -index 9b0c15b3c501..388994072186 100644 +index 9b0c15b3c5016707788476295d53ab9d8a80e338..388994072186d1ba7b831f004983d5e087adf891 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -30,7 +30,7 @@ @@ -253,7 +263,7 @@ index 9b0c15b3c501..388994072186 100644 #include "components/printing/browser/print_manager_utils.h" @@ -67,6 +67,8 @@ using PrintSettingsCallback = base::OnceCallback)>; - + void ShowWarningMessageBox(const base::string16& message) { + LOG(ERROR) << "Invalid printer settings " << message; +#if 0 @@ -262,11 +272,11 @@ index 9b0c15b3c501..388994072186 100644 if (is_dialog_shown) @@ -75,6 +77,7 @@ void ShowWarningMessageBox(const base::string16& message) { base::AutoReset auto_reset(&is_dialog_shown, true); - + chrome::ShowWarningMessageBox(nullptr, base::string16(), message); +#endif } - + #if BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -112,12 +115,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) queue_(g_browser_process->print_job_manager()->queue()), @@ -281,26 +291,26 @@ index 9b0c15b3c501..388994072186 100644 weak_ptr_factory_.GetWeakPtr())); +#endif } - + PrintViewManagerBase::~PrintViewManagerBase() { @@ -125,12 +130,16 @@ PrintViewManagerBase::~PrintViewManagerBase() { DisconnectFromCurrentPrintJob(); } - + -bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { +bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh, + bool silent, + bool print_background, + const base::string16& device_name) { DisconnectFromCurrentPrintJob(); - + SetPrintingRFH(rfh); int32_t id = rfh->GetRoutingID(); - return PrintNowInternal(rfh, std::make_unique(id)); + return PrintNowInternal(rfh, std::make_unique( + id, silent, print_background, device_name)); } - + #if BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -249,7 +258,7 @@ void PrintViewManagerBase::UpdatePrintingEnabled() { // The Unretained() is safe because ForEachFrame() is synchronous. @@ -309,38 +319,38 @@ index 9b0c15b3c501..388994072186 100644 - printing_enabled_.GetValue())); + true)); } - + void PrintViewManagerBase::NavigationStopped() { @@ -341,8 +350,10 @@ void PrintViewManagerBase::OnDidPrintDocument( void PrintViewManagerBase::OnPrintingFailed(int cookie) { PrintManager::OnPrintingFailed(cookie); - + +#if 0 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) ShowPrintErrorDialog(); +#endif #endif - + ReleasePrinterQuery(); @@ -592,6 +603,10 @@ void PrintViewManagerBase::ReleasePrintJob() { content::RenderFrameHost* rfh = printing_rfh_; printing_rfh_ = nullptr; - + + if (!callback.is_null()) { + callback.Run(printing_succeeded_ && print_job_); + } + if (!print_job_) return; - + diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h -index fe0e0b5b065c..6670fc8abd2d 100644 +index fe0e0b5b065cdcc4edd04665271db14b1bf935e3..6670fc8abd2dabe601581cf43e51bb59f5ce577f 100644 --- a/chrome/browser/printing/print_view_manager_base.h +++ b/chrome/browser/printing/print_view_manager_base.h @@ -7,6 +7,7 @@ - + #include - + +#include "base/callback.h" #include "base/macros.h" #include "base/memory/read_only_shared_memory_region.h" @@ -354,41 +364,41 @@ index fe0e0b5b065c..6670fc8abd2d 100644 + bool silent, + bool print_background, + const base::string16& device_name); - + #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Prints the document in |print_data| with settings specified in @@ -72,6 +76,8 @@ class PrintViewManagerBase : public content::NotificationObserver, - + base::string16 RenderSourceName(); - + + void SetCallback(const base::Callback& cb) { callback = cb; }; + protected: explicit PrintViewManagerBase(content::WebContents* web_contents); - + @@ -208,6 +214,8 @@ class PrintViewManagerBase : public content::NotificationObserver, - + scoped_refptr queue_; - + + base::Callback callback; + base::WeakPtrFactory weak_ptr_factory_; - + DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); diff --git a/chrome/browser/printing/print_view_manager_common.cc b/chrome/browser/printing/print_view_manager_common.cc -index 3d36b0b972b6..3400f4a3470b 100644 +index 3d36b0b972b681c861c4e5273b3371eeabda1bce..3400f4a3470bda3ebf002417837592a12be4d55a 100644 --- a/chrome/browser/printing/print_view_manager_common.cc +++ b/chrome/browser/printing/print_view_manager_common.cc @@ -11,12 +11,12 @@ #include "printing/buildflags/buildflags.h" #include "url/gurl.h" - + -#if BUILDFLAG(ENABLE_EXTENSIONS) +#if 0 #include "components/guest_view/browser/guest_view_manager.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" #endif // BUILDFLAG(ENABLE_EXTENSIONS) - + -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) +#if 0 #include "chrome/browser/printing/print_view_manager.h" @@ -396,7 +406,7 @@ index 3d36b0b972b6..3400f4a3470b 100644 #include "chrome/browser/printing/print_view_manager_basic.h" @@ -25,7 +25,7 @@ namespace printing { - + namespace { -#if BUILDFLAG(ENABLE_EXTENSIONS) +#if 0 @@ -435,26 +445,26 @@ index 3d36b0b972b6..3400f4a3470b 100644 } #endif // ENABLE_PRINT_PREVIEW +#endif - + - print_view_manager->PrintNow(rfh_to_use); + print_view_manager->PrintNow(rfh_to_use, false, true, base::string16()); } - + void StartBasicPrint(content::WebContents* contents) { +#if 0 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) content::WebContents* contents_to_use = GetWebContentsToUse(contents); PrintViewManager* print_view_manager = @@ -111,6 +114,7 @@ void StartBasicPrint(content::WebContents* contents) { - + print_view_manager->BasicPrint(rfh_to_use); #endif // ENABLE_PRINT_PREVIEW +#endif } - + content::RenderFrameHost* GetFrameToPrint(content::WebContents* contents) { diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc -index cc2368731367..159ec3a04502 100644 +index cc236873136797d90f3f5132726b34e7a3d7a989..159ec3a04502a4462bafbe31e39f58c6104c7e11 100644 --- a/chrome/browser/printing/printer_query.cc +++ b/chrome/browser/printing/printer_query.cc @@ -94,7 +94,31 @@ void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings, @@ -488,16 +498,16 @@ index cc2368731367..159ec3a04502 100644 + has_selection, margin_type, is_scripted, is_modifiable, + device_name)); } - + void PrinterQuery::SetSettings( diff --git a/chrome/browser/printing/printer_query.h b/chrome/browser/printing/printer_query.h -index 64db84f9f853..0e12adfe7957 100644 +index 64db84f9f8532e2e53c07206f6d1505cc162df58..0e12adfe7957b071a71e377861a2ea0cf1a57b5e 100644 --- a/chrome/browser/printing/printer_query.h +++ b/chrome/browser/printing/printer_query.h @@ -59,6 +59,15 @@ class PrinterQuery : public base::RefCountedThreadSafe { bool is_modifiable, base::OnceClosure callback); - + + void GetSettings(GetSettingsAskParam ask_user_for_settings, + int expected_page_count, + bool has_selection, @@ -511,13 +521,13 @@ index 64db84f9f853..0e12adfe7957 100644 virtual void SetSettings(std::unique_ptr new_settings, base::OnceClosure callback); diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc -index 54866fdcdb64..40d6bd62706c 100644 +index 54866fdcdb64f4ffd2414c8637ffa2f8fb10c024..40d6bd62706c1b47aff9ce32df713a47d203538f 100644 --- a/chrome/browser/printing/printing_message_filter.cc +++ b/chrome/browser/printing/printing_message_filter.cc @@ -94,12 +94,12 @@ PrintViewManager* GetPrintViewManager(int render_process_id, - + } // namespace - + -PrintingMessageFilter::PrintingMessageFilter(int render_process_id, - Profile* profile) +PrintingMessageFilter::PrintingMessageFilter(int render_process_id) @@ -535,10 +545,10 @@ index 54866fdcdb64..40d6bd62706c 100644 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); +#endif } - + PrintingMessageFilter::~PrintingMessageFilter() { @@ -116,7 +117,9 @@ PrintingMessageFilter::~PrintingMessageFilter() { - + void PrintingMessageFilter::ShutdownOnUIThread() { DCHECK_CURRENTLY_ON(BrowserThread::UI); +#if 0 @@ -546,7 +556,7 @@ index 54866fdcdb64..40d6bd62706c 100644 +#endif printing_shutdown_notifier_.reset(); } - + @@ -145,6 +148,8 @@ bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) { #endif IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings, @@ -568,7 +578,7 @@ index 54866fdcdb64..40d6bd62706c 100644 @@ -208,6 +213,26 @@ void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { printer_query, reply_msg)); } - + +void PrintingMessageFilter::OnInitSettingWithDeviceName( + const base::string16& device_name, + IPC::Message* reply_msg) { @@ -594,7 +604,7 @@ index 54866fdcdb64..40d6bd62706c 100644 IPC::Message* reply_msg) { @@ -301,7 +326,7 @@ void PrintingMessageFilter::OnUpdatePrintSettings( std::unique_ptr new_settings(job_settings.DeepCopy()); - + scoped_refptr printer_query; - if (!is_printing_enabled_.GetValue()) { + if (false) { @@ -604,7 +614,7 @@ index 54866fdcdb64..40d6bd62706c 100644 @@ -361,10 +386,13 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply( } } - + + #if BUILDFLAG(ENABLE_PRINT_PREVIEW) void PrintingMessageFilter::OnCheckForCancel(const PrintHostMsg_PreviewIds& ids, @@ -614,9 +624,9 @@ index 54866fdcdb64..40d6bd62706c 100644 +#endif } #endif - + diff --git a/chrome/browser/printing/printing_message_filter.h b/chrome/browser/printing/printing_message_filter.h -index a881a853bfb0..46ebeede1955 100644 +index a881a853bfb0b46d0e074b7e86121429a5a761a3..46ebeede19557c718bf14b7feb81cf1acf3ca00a 100644 --- a/chrome/browser/printing/printing_message_filter.h +++ b/chrome/browser/printing/printing_message_filter.h @@ -38,7 +38,7 @@ class PrinterQuery; @@ -625,11 +635,11 @@ index a881a853bfb0..46ebeede1955 100644 public: - PrintingMessageFilter(int render_process_id, Profile* profile); + PrintingMessageFilter(int render_process_id); - + // content::BrowserMessageFilter methods. void OverrideThreadForMessage(const IPC::Message& message, @@ -73,6 +73,11 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { - + // Get the default print setting. void OnGetDefaultPrintSettings(IPC::Message* reply_msg); + @@ -639,15 +649,15 @@ index a881a853bfb0..46ebeede1955 100644 + void OnGetDefaultPrintSettingsReply(scoped_refptr printer_query, IPC::Message* reply_msg); - + diff --git a/chrome/renderer/printing/chrome_print_render_frame_helper_delegate.cc b/chrome/renderer/printing/chrome_print_render_frame_helper_delegate.cc -index 38fd116aa096..62fcfaa00084 100644 +index 38fd116aa096b00266b6015f3196c3f432d23a9e..62fcfaa00084332ba07ff123e5136df606bb8168 100644 --- a/chrome/renderer/printing/chrome_print_render_frame_helper_delegate.cc +++ b/chrome/renderer/printing/chrome_print_render_frame_helper_delegate.cc @@ -19,7 +19,7 @@ #include "third_party/blink/public/web/web_element.h" #include "third_party/blink/public/web/web_local_frame.h" - + -#if BUILDFLAG(ENABLE_EXTENSIONS) +#if 0 #include "chrome/common/extensions/extension_constants.h" @@ -663,16 +673,16 @@ index 38fd116aa096..62fcfaa00084 100644 bool inside_print_preview = url.GetOrigin() == chrome::kChromeUIPrintURL; bool inside_pdf_extension = @@ -71,7 +71,7 @@ bool ChromePrintRenderFrameHelperDelegate::IsPrintPreviewEnabled() { - + bool ChromePrintRenderFrameHelperDelegate::OverridePrint( blink::WebLocalFrame* frame) { -#if BUILDFLAG(ENABLE_EXTENSIONS) +#if 0 if (!frame->GetDocument().IsPluginDocument()) return false; - + diff --git a/components/printing/common/print_messages.h b/components/printing/common/print_messages.h -index d29bb6aedecd..bb0bd7bfa494 100644 +index d29bb6aedecd228e4bc02c84b86cce7151f33746..bb0bd7bfa494f813c30b47e84b78d2e0a951a321 100644 --- a/components/printing/common/print_messages.h +++ b/components/printing/common/print_messages.h @@ -367,7 +367,10 @@ IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu) @@ -684,13 +694,13 @@ index d29bb6aedecd..bb0bd7bfa494 100644 + bool /* silent print */, + bool /* print page's background */, + base::string16 /* device name*/) - + // Like PrintMsg_PrintPages, but using the print preview document's frame/node. IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog) @@ -425,6 +428,11 @@ IPC_MESSAGE_ROUTED2(PrintHostMsg_DidPrintFrameContent, IPC_SYNC_MESSAGE_ROUTED0_1(PrintHostMsg_GetDefaultPrintSettings, PrintMsg_Print_Params /* default_settings */) - + +// you can set the printer +IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_InitSettingWithDeviceName, + base::string16, /* device name */ @@ -700,20 +710,20 @@ index d29bb6aedecd..bb0bd7bfa494 100644 // |job_settings|. IPC_SYNC_MESSAGE_ROUTED2_2(PrintHostMsg_UpdatePrintSettings, diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index c7ea5cf76aa6..1c3177e679ff 100644 +index c7ea5cf76aa629b8feaf99ff6e289140de1d35bd..1c3177e679ff6a3bbaa10cf74b9d538af7e5a588 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -1093,7 +1093,9 @@ void PrintRenderFrameHelper::OnDestruct() { delete this; } - + -void PrintRenderFrameHelper::OnPrintPages() { +void PrintRenderFrameHelper::OnPrintPages(bool silent, + bool print_background, + const base::string16& device_name) { if (ipc_nesting_level_ > 1) return; - + @@ -1106,7 +1108,7 @@ void PrintRenderFrameHelper::OnPrintPages() { // If we are printing a PDF extension frame, find the plugin node and print // that instead. @@ -726,14 +736,14 @@ index c7ea5cf76aa6..1c3177e679ff 100644 @@ -1158,6 +1160,8 @@ void PrintRenderFrameHelper::OnPrintPreview( if (ipc_nesting_level_ > 1) return; - + + blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); + print_preview_context_.InitWithFrame(frame); print_preview_context_.OnPrintPreview(); - + UMA_HISTOGRAM_ENUMERATION("PrintPreview.PreviewEvent", @@ -1552,7 +1556,10 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { - + void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, - bool is_scripted) { @@ -746,7 +756,7 @@ index c7ea5cf76aa6..1c3177e679ff 100644 return; @@ -1560,7 +1567,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, FrameReference frame_ref(frame); - + int expected_page_count = 0; - if (!CalculateNumberOfPages(frame, node, &expected_page_count)) { + if (!CalculateNumberOfPages(frame, node, &expected_page_count, device_name)) { @@ -754,7 +764,7 @@ index c7ea5cf76aa6..1c3177e679ff 100644 return; // Failed to init print page settings. } @@ -1580,8 +1587,9 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, - + PrintMsg_PrintPages_Params print_settings; auto self = weak_ptr_factory_.GetWeakPtr(); - GetPrintSettingsFromUser(frame_ref.GetFrame(), node, expected_page_count, @@ -774,7 +784,7 @@ index c7ea5cf76aa6..1c3177e679ff 100644 !print_settings.params.document_cookie) { DidFinishPrinting(OK); // Release resources and fail silently on failure. @@ -1600,7 +1609,6 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, - + // Render Pages for printing. if (!RenderPagesForPrint(frame_ref.GetFrame(), node)) { - LOG(ERROR) << "RenderPagesForPrint failed"; @@ -784,7 +794,7 @@ index c7ea5cf76aa6..1c3177e679ff 100644 @@ -1778,10 +1786,17 @@ std::vector PrintRenderFrameHelper::GetPrintedPages( return printed_pages; } - + -bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) { +bool PrintRenderFrameHelper::InitPrintSettings( + bool fit_to_paper_size, @@ -801,7 +811,7 @@ index c7ea5cf76aa6..1c3177e679ff 100644 // can safely assume there are no printer drivers configured. So we safely // terminate. @@ -1803,10 +1818,11 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) { - + bool PrintRenderFrameHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, const blink::WebNode& node, - int* number_of_pages) { @@ -817,7 +827,7 @@ index c7ea5cf76aa6..1c3177e679ff 100644 @@ -1885,11 +1901,13 @@ bool PrintRenderFrameHelper::UpdatePrintSettings( return false; } - + +#if 0 if (!job_settings->GetInteger(kPreviewUIID, &settings.params.preview_ui_id)) { NOTREACHED(); @@ -825,16 +835,16 @@ index c7ea5cf76aa6..1c3177e679ff 100644 return false; } +#endif - + // Validate expected print preview settings. if (!job_settings->GetInteger(kPreviewRequestID, diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h -index 6e2d7e1467b7..0e6e8ea770f5 100644 +index 6e2d7e1467b7bc179b1a0fc30dd656de612708cb..0e6e8ea770f52e5ddfb9f3e2d5793ad8184e8359 100644 --- a/components/printing/renderer/print_render_frame_helper.h +++ b/components/printing/renderer/print_render_frame_helper.h @@ -186,7 +186,9 @@ class PrintRenderFrameHelper bool OnMessageReceived(const IPC::Message& message) override; - + // Message handlers --------------------------------------------------------- - void OnPrintPages(); + void OnPrintPages(bool silent, @@ -852,17 +862,17 @@ index 6e2d7e1467b7..0e6e8ea770f5 100644 + bool silent = false, + bool print_background = false, + const base::string16& device_name = base::string16()); - + // Notification when printing is done - signal tear-down/free resources. void DidFinishPrinting(PrintingResult result); @@ -247,12 +252,15 @@ class PrintRenderFrameHelper - + // Initialize print page settings with default settings. // Used only for native printing workflow. - bool InitPrintSettings(bool fit_to_paper_size); + bool InitPrintSettings(bool fit_to_paper_size, + const base::string16& device_name = base::string16()); - + // Calculate number of pages in source document. - bool CalculateNumberOfPages(blink::WebLocalFrame* frame, - const blink::WebNode& node, @@ -872,17 +882,17 @@ index 6e2d7e1467b7..0e6e8ea770f5 100644 + const blink::WebNode& node, + int* number_of_pages, + const base::string16& device_name = base::string16()); - + #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Set options for print preset from source PDF document. diff --git a/printing/print_settings_conversion.cc b/printing/print_settings_conversion.cc -index a4c9f49d65e0..b26eb4186880 100644 +index a4c9f49d65e0f6bccee7d49465cbba5a28785a22..b26eb4186880d869bd7466d1ad7f368aeefb175d 100644 --- a/printing/print_settings_conversion.cc +++ b/printing/print_settings_conversion.cc @@ -42,6 +42,19 @@ void GetCustomMarginsFromJobSettings(const base::DictionaryValue& settings, } } - + +void SetCustomMarginsToJobSettings(const PageSizeMargins& page_size_margins, + base::DictionaryValue* settings) { + std::unique_ptr custom_margins( @@ -902,7 +912,7 @@ index a4c9f49d65e0..b26eb4186880 100644 @@ -224,6 +237,72 @@ bool PrintSettingsFromJobSettings(const base::DictionaryValue& job_settings, return true; } - + +void PrintSettingsToJobSettings(const PrintSettings& settings, + base::DictionaryValue* job_settings) { + // header footer @@ -973,13 +983,13 @@ index a4c9f49d65e0..b26eb4186880 100644 base::DictionaryValue* job_settings) { job_settings->SetBoolean(kSettingHeaderFooterEnabled, diff --git a/printing/print_settings_conversion.h b/printing/print_settings_conversion.h -index 283c0ff81954..231873a45644 100644 +index 283c0ff81954bb9e777b1e0007a735ec0ad4901e..231873a456442856c43d643e41c1bb22f4203a5c 100644 --- a/printing/print_settings_conversion.h +++ b/printing/print_settings_conversion.h @@ -21,6 +21,10 @@ PRINTING_EXPORT bool PrintSettingsFromJobSettings( const base::DictionaryValue& job_settings, PrintSettings* print_settings); - + +PRINTING_EXPORT void PrintSettingsToJobSettings( + const PrintSettings& settings, + base::DictionaryValue* job_settings); @@ -987,3 +997,6 @@ index 283c0ff81954..231873a45644 100644 // Use for debug only, because output is not completely consistent with format // of |PrintSettingsFromJobSettings| input. void PrintSettingsToJobSettingsDebug(const PrintSettings& settings, +-- +2.17.0 + diff --git a/patches/common/chromium/proxy_config_monitor.patch b/patches/common/chromium/proxy_config_monitor.patch index 134cd47da0..35495257a6 100644 --- a/patches/common/chromium/proxy_config_monitor.patch +++ b/patches/common/chromium/proxy_config_monitor.patch @@ -1,5 +1,12 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 18 Oct 2018 17:07:12 -0700 +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 90a8b0895f10..26c1bc0e5859 100644 +index 90a8b0895f10d59ade41cf156e3887c526123b29..26c1bc0e5859e832d03be7215d067312e2d691c0 100644 --- a/chrome/browser/net/proxy_config_monitor.cc +++ b/chrome/browser/net/proxy_config_monitor.cc @@ -5,9 +5,13 @@ @@ -44,7 +51,7 @@ index 90a8b0895f10..26c1bc0e5859 100644 pref_proxy_config_tracker_.get()); diff --git a/chrome/browser/net/proxy_config_monitor.h b/chrome/browser/net/proxy_config_monitor.h -index b783ab18d2d7..4475b58756db 100644 +index b783ab18d2d77cb2d443eed36a508f1eac77c04d..4475b58756dbf686cf78f6e317e55bc1df783e8d 100644 --- a/chrome/browser/net/proxy_config_monitor.h +++ b/chrome/browser/net/proxy_config_monitor.h @@ -20,22 +20,24 @@ class ProxyConfigWithAnnotation; @@ -82,3 +89,6 @@ index b783ab18d2d7..4475b58756db 100644 mojo::BindingSet binding_set_; mojo::InterfacePtrSet +-- +2.17.0 + diff --git a/patches/common/chromium/render_widget_host_view_base.patch b/patches/common/chromium/render_widget_host_view_base.patch index b4764130f7..c832dc0db5 100644 --- a/patches/common/chromium/render_widget_host_view_base.patch +++ b/patches/common/chromium/render_widget_host_view_base.patch @@ -1,11 +1,11 @@ -From 22107b997c8c2437e90aeccf4ea795682ebc402a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:46:21 -0700 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 5561b7a1f386..913b24cff3b2 100644 +index 5561b7a1f3863a0e5b8d02c886bd9bd563095fa9..913b24cff3b2d41545e1d607f45762b8e884fd20 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc @@ -567,6 +567,15 @@ viz::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( @@ -25,7 +25,7 @@ index 5561b7a1f386..913b24cff3b2 100644 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 8ed6ffd3a284..dd7fdbbdee59 100644 +index 8ed6ffd3a284fe58fe5e80a473f6d22f6b5bf8f7..dd7fdbbdee59658d674f93d3a5b769b6081d1813 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 @@ diff --git a/patches/common/chromium/render_widget_host_view_mac.patch b/patches/common/chromium/render_widget_host_view_mac.patch index 424b044342..5f905e6dd6 100644 --- a/patches/common/chromium/render_widget_host_view_mac.patch +++ b/patches/common/chromium/render_widget_host_view_mac.patch @@ -1,11 +1,11 @@ -From 7c728945a2edf66fc4c795b6b61634b30c76bd1e Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:46:28 -0700 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 8b84322baa80..70d244e01b75 100644 +index 8b84322baa808f66044361d1033ec63805856227..70d244e01b75f98a6ed580475710d7405cae8eee 100644 --- a/content/browser/renderer_host/render_widget_host_view_cocoa.mm +++ b/content/browser/renderer_host/render_widget_host_view_cocoa.mm @@ -174,6 +174,11 @@ void ExtractUnderlines(NSAttributedString* string, @@ -66,7 +66,7 @@ index 8b84322baa80..70d244e01b75 100644 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 0703dd02c901..7186a054cf55 100644 +index 0703dd02c90106a541acf173ec770e18e01c8841..7186a054cf559c64bb6ed410adcba724284d5735 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 @@ diff --git a/patches/common/chromium/resource_file_conflict.patch b/patches/common/chromium/resource_file_conflict.patch index 09b712a627..cd1c57fbf3 100644 --- a/patches/common/chromium/resource_file_conflict.patch +++ b/patches/common/chromium/resource_file_conflict.patch @@ -1,4 +1,4 @@ -From a6b7144643673ce4e04f377f4321a4f750f8ffe4 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 20 Sep 2018 17:48:59 -0700 Subject: resource_file_conflict.patch @@ -9,7 +9,7 @@ paths, but GN throws errors if there are multiple targets that generate the same files. diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index a47af42a5a5a..db8311121e75 100644 +index a47af42a5a5afc1560f11ee0ccfa5fc177745caa..db8311121e755eb955ff05dee61a9706ae747977 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -1640,6 +1640,11 @@ if (is_chrome_branded && !is_android) { diff --git a/patches/common/chromium/scoped_clipboard_writer.patch b/patches/common/chromium/scoped_clipboard_writer.patch index 9aa070d740..3e68f64b37 100644 --- a/patches/common/chromium/scoped_clipboard_writer.patch +++ b/patches/common/chromium/scoped_clipboard_writer.patch @@ -1,11 +1,11 @@ -From 691dce7bf41c6fbc8ce3bf9fc3fb4ec0ef0cca21 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:46:32 -0700 Subject: scoped_clipboard_writer.patch diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc -index 12680a66d17c..6b95e46e3558 100644 +index 12680a66d17c56aa72edcd7cdf48eb68ff864cf3..6b95e46e35584843c75dae5d784cb606ed31754a 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.cc +++ b/ui/base/clipboard/scoped_clipboard_writer.cc @@ -103,17 +103,16 @@ void ScopedClipboardWriter::WriteImage(const SkBitmap& bitmap) { @@ -46,7 +46,7 @@ index 12680a66d17c..6b95e46e3558 100644 objects_.clear(); bitmap_.reset(); diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h -index 385900eb67de..cf1f803ec123 100644 +index 385900eb67dee499afc8591e6acf0c6b5957df7e..cf1f803ec1233c173d11295be05ba0859cae4844 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.h +++ b/ui/base/clipboard/scoped_clipboard_writer.h @@ -57,6 +57,11 @@ class UI_BASE_EXPORT ScopedClipboardWriter { diff --git a/patches/common/chromium/scroll_bounce_flag.patch b/patches/common/chromium/scroll_bounce_flag.patch index 5f2bbac974..8648bab867 100644 --- a/patches/common/chromium/scroll_bounce_flag.patch +++ b/patches/common/chromium/scroll_bounce_flag.patch @@ -1,4 +1,4 @@ -From cc50dccf546c8bd730fb42e912e0cd231c9b1f84 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:49:03 -0700 Subject: scroll_bounce_flag.patch @@ -6,7 +6,7 @@ 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 c078565cef71..5c31ab7654d0 100644 +index c078565cef71d6a27f276b7a34dd9d060ea079d4..5c31ab7654d0168d232e9974105573fa01543aed 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -1610,7 +1610,7 @@ bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { diff --git a/patches/common/chromium/ssl_security_state_tab_helper.patch b/patches/common/chromium/ssl_security_state_tab_helper.patch index d647be7420..5c989f2744 100644 --- a/patches/common/chromium/ssl_security_state_tab_helper.patch +++ b/patches/common/chromium/ssl_security_state_tab_helper.patch @@ -1,4 +1,4 @@ -From 87f31d450894df2b00c6a2d6fb7eb2639b595756 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:50:34 -0700 Subject: 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 58066f3a532b..a1643c6492e3 100644 +index 58066f3a532bf227f0445fe0d04a092e4ba6a4ff..a1643c6492e30b81a01105cc0c52483c6400f535 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 58066f3a532b..a1643c6492e3 100644 return secure_origin_whitelist::ParseWhitelist(origins_str); } diff --git a/chrome/common/secure_origin_whitelist.cc b/chrome/common/secure_origin_whitelist.cc -index 3319df136d4d..fbc6eea480d2 100644 +index 3319df136d4d32aad066fe98bfadacfb3c05322a..fbc6eea480d23e7158bbbfb8dc77926824b94c3d 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/stream_resource_handler.patch b/patches/common/chromium/stream_resource_handler.patch index 6572b88017..e89eeaaa1f 100644 --- a/patches/common/chromium/stream_resource_handler.patch +++ b/patches/common/chromium/stream_resource_handler.patch @@ -1,11 +1,11 @@ -From 62bf8be2412ea4b7fef28d0a6fc2a8baecc8980e Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 20 Sep 2018 17:46:39 -0700 Subject: stream_resource_handler.patch diff --git a/content/browser/loader/stream_resource_handler.h b/content/browser/loader/stream_resource_handler.h -index b6f51bba48cd..1ee88dfacee3 100644 +index b6f51bba48cd145d6bccaff649d7875cf0520b7d..1ee88dfacee3e9bf3e4393a32ebd719251709fb3 100644 --- a/content/browser/loader/stream_resource_handler.h +++ b/content/browser/loader/stream_resource_handler.h @@ -11,6 +11,7 @@ diff --git a/patches/common/chromium/sysroot.patch b/patches/common/chromium/sysroot.patch index 8a2c87a9a7..c038cb59ea 100644 --- a/patches/common/chromium/sysroot.patch +++ b/patches/common/chromium/sysroot.patch @@ -1,10 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 18 Oct 2018 17:03:57 -0700 +Subject: sysroot.patch + +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 58f09950d844..53500a0853a6 100755 +index 58f09950d844f4fa4f8d46718852c4f2c490c391..55dd50187714b596e6ded4f2b302fb497af53ad0 100755 --- a/build/linux/sysroot_scripts/install-sysroot.py +++ b/build/linux/sysroot_scripts/install-sysroot.py -@@ -31,8 +31,8 @@ import urllib2 +@@ -30,9 +30,11 @@ import sys + import urllib2 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) ++SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPT_DIR))) ++SYSTOORS_CONFIG_DIR = os.path.join(SRC_DIR, 'electron', 'script') -URL_PREFIX = 'https://commondatastorage.googleapis.com' -URL_PATH = 'chrome-linux-sysroot/toolchain' @@ -13,19 +24,6 @@ index 58f09950d844..53500a0853a6 100755 VALID_ARCHS = ('arm', 'arm64', 'i386', 'amd64', 'mips', 'mips64el') -diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py -index 53500a0853a6..f38f9a732856 100755 ---- a/build/linux/sysroot_scripts/install-sysroot.py -+++ b/build/linux/sysroot_scripts/install-sysroot.py -@@ -30,6 +30,8 @@ import sys - import urllib2 - - SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) -+SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPT_DIR))) -+SYSTOORS_CONFIG_DIR = os.path.join(SRC_DIR, 'electron', 'script') - - URL_PREFIX = 'http://s3.amazonaws.com' - URL_PATH = 'gh-contractor-zcbenz/toolchain' @@ -96,7 +98,7 @@ def GetSysrootDict(target_platform, target_arch): if target_arch not in VALID_ARCHS: raise Error('Unknown architecture: %s' % target_arch) @@ -35,3 +33,6 @@ index 53500a0853a6..f38f9a732856 100755 sysroots = json.load(open(sysroots_file)) sysroot_key = '%s_%s' % (target_platform, target_arch) if sysroot_key not in sysroots: +-- +2.17.0 + diff --git a/patches/common/chromium/thread_capabilities.patch b/patches/common/chromium/thread_capabilities.patch index f8e33a33ad..c310a06ac0 100644 --- a/patches/common/chromium/thread_capabilities.patch +++ b/patches/common/chromium/thread_capabilities.patch @@ -1,4 +1,4 @@ -From 47f675c132ac4d4234f14f0c1ffb7aea407a60f7 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:46:43 -0700 Subject: thread_capabilities.patch @@ -11,7 +11,7 @@ system. See https://github.com/atom/electron/issues/3666 diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc -index ad0714a7f5ed..1406e1d53f2f 100644 +index ad0714a7f5edad1784d5e055a392519f750973cc..1406e1d53f2f13bbbcc5b96a1681b9ec18c3e49c 100644 --- a/sandbox/linux/services/credentials.cc +++ b/sandbox/linux/services/credentials.cc @@ -348,8 +348,10 @@ pid_t Credentials::ForkAndDropCapabilitiesInChild() { diff --git a/patches/common/chromium/tts.patch b/patches/common/chromium/tts.patch index 47829396a6..af7e819211 100644 --- a/patches/common/chromium/tts.patch +++ b/patches/common/chromium/tts.patch @@ -1,5 +1,16 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Heilig Benedek +Date: Thu, 18 Oct 2018 17:08:03 -0700 +Subject: tts.patch + +* Adds patch in //chrome/browser/speech/tts_controller_impl.cc + to disable calls using chrome profile class. +* Adds patch in //chrome/browser/speech/tts_message_filter.cc + to remove reference to browser context when its signaled for + destruction from content layer. + diff --git a/chrome/browser/speech/tts_controller_impl.cc b/chrome/browser/speech/tts_controller_impl.cc -index 2ca56c3a247e..f58e33b3c019 100644 +index 2ca56c3a247e674ee15b0a0ee30e6c2941aa93d3..f58e33b3c0198e4333f98cd1928c8f6d9be45738 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( @@ -18,7 +29,7 @@ index 2ca56c3a247e..f58e33b3c019 100644 } diff --git a/chrome/browser/speech/tts_message_filter.cc b/chrome/browser/speech/tts_message_filter.cc -index 013c7a9c60f9..73a244a726e3 100644 +index 013c7a9c60f95475d63701c4f6848cb00dac19d9..73a244a726e3e1a1b5b52ca0e8e3b209aaf432ff 100644 --- a/chrome/browser/speech/tts_message_filter.cc +++ b/chrome/browser/speech/tts_message_filter.cc @@ -9,14 +9,40 @@ @@ -120,7 +131,7 @@ index 013c7a9c60f9..73a244a726e3 100644 + browser_context_shutdown_notifier_.reset(); } diff --git a/chrome/browser/speech/tts_message_filter.h b/chrome/browser/speech/tts_message_filter.h -index cc9e2806b5c3..d21fb42f1aca 100644 +index cc9e2806b5c3942472785bf3a3a32e23d859971d..d21fb42f1aca2906b8d8968bd1a46721fbc55edb 100644 --- a/chrome/browser/speech/tts_message_filter.h +++ b/chrome/browser/speech/tts_message_filter.h @@ -9,10 +9,9 @@ @@ -162,3 +173,6 @@ index cc9e2806b5c3..d21fb42f1aca 100644 DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter); }; +-- +2.17.0 + diff --git a/patches/common/chromium/use_transparent_window.patch b/patches/common/chromium/use_transparent_window.patch index 27f03be9b3..e4c471266c 100644 --- a/patches/common/chromium/use_transparent_window.patch +++ b/patches/common/chromium/use_transparent_window.patch @@ -1,11 +1,11 @@ -From 808f3b08bf415b980b6e47573ca178c333c9c344 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:46:50 -0700 Subject: use_transparent_window.patch diff --git a/ui/gl/gpu_switching_manager.cc b/ui/gl/gpu_switching_manager.cc -index be7156465809..4529866b0864 100644 +index be715646580966ddadb762940efd8c627e7a1e65..4529866b08645691e3aa901c57890b11ce2bd829 100644 --- a/ui/gl/gpu_switching_manager.cc +++ b/ui/gl/gpu_switching_manager.cc @@ -4,6 +4,12 @@ @@ -39,7 +39,7 @@ index be7156465809..4529866b0864 100644 GpuSwitchingManager::~GpuSwitchingManager() {} diff --git a/ui/gl/gpu_switching_manager.h b/ui/gl/gpu_switching_manager.h -index 4308bbed9398..a7cafcfccdff 100644 +index 4308bbed939898323f26a747330937b7009f11b4..a7cafcfccdffd1b63858d2fc7650eba7d6ec418e 100644 --- a/ui/gl/gpu_switching_manager.h +++ b/ui/gl/gpu_switching_manager.h @@ -18,6 +18,9 @@ class GL_EXPORT GpuSwitchingManager { diff --git a/patches/common/chromium/v8_context_snapshot_generator.patch b/patches/common/chromium/v8_context_snapshot_generator.patch index 3ca23ecea2..305cf55f57 100644 --- a/patches/common/chromium/v8_context_snapshot_generator.patch +++ b/patches/common/chromium/v8_context_snapshot_generator.patch @@ -1,4 +1,4 @@ -From e51d8c2a477d55c279c5935c02dab83ef34f3392 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Nitish Sakhawalkar Date: Thu, 20 Sep 2018 17:47:58 -0700 Subject: v8_context_snapshot_generator.patch @@ -7,7 +7,7 @@ v8_context_snapshot_generator is a build time executable. The patch adds the config. diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn -index b119ec095c7b..47df8af5ef68 100644 +index b119ec095c7b1b55277a8d6784be35508ac37094..47df8af5ef68bf8e3fb4fa4f22f7d008c4921dd5 100644 --- a/tools/v8_context_snapshot/BUILD.gn +++ b/tools/v8_context_snapshot/BUILD.gn @@ -114,6 +114,7 @@ if (use_v8_context_snapshot) { diff --git a/patches/common/chromium/verbose_generate_breakpad_symbols.patch b/patches/common/chromium/verbose_generate_breakpad_symbols.patch index e8811dbb89..b1db1f573e 100644 --- a/patches/common/chromium/verbose_generate_breakpad_symbols.patch +++ b/patches/common/chromium/verbose_generate_breakpad_symbols.patch @@ -1,5 +1,13 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Thu, 18 Oct 2018 17:08:28 -0700 +Subject: verbose_generate_breakpad_symbols.patch + +Temporarily add additional debugging statements to +generate_breakpad_symbols.py to determine why it is hanging. + diff --git a/components/crash/content/tools/generate_breakpad_symbols.py b/components/crash/content/tools/generate_breakpad_symbols.py -index 58646a1..8bf830b 100755 +index 58646a10591a1d3e7c2dd1782c3642b9cbe06738..0ae9c3c8ae27ca5684ebcb4f6a87f014c0e512b5 100755 --- a/components/crash/content/tools/generate_breakpad_symbols.py +++ b/components/crash/content/tools/generate_breakpad_symbols.py @@ -59,7 +59,10 @@ def Resolve(path, exe_path, loader_path, rpaths): @@ -8,7 +16,7 @@ index 58646a1..8bf830b 100755 -def GetSharedLibraryDependenciesLinux(binary): +def GetSharedLibraryDependenciesLinux(binary, options): -+ if options.verbose: ++ if options.verbose: + print "GetSharedLibraryDependencies for %s" % binary + """Return absolute paths to all shared library dependecies of the binary. @@ -18,8 +26,8 @@ index 58646a1..8bf830b 100755 m = lib_re.match(line) if m: result.append(m.group(1)) -+ if options.verbose: -+ print "Done GetSharedLibraryDependencies for %s" % binary ++ if options.verbose: ++ print "Done GetSharedLibraryDependencies for %s" % binary + print result return result @@ -38,7 +46,7 @@ index 58646a1..8bf830b 100755 def GenerateSymbols(options, binaries): """Dumps the symbols of binary and places them in the given directory.""" - -+ if options.verbose: ++ if options.verbose: + print "Generating symbols for %s " % (' '.join(binaries)) queue = Queue.Queue() print_lock = threading.Lock() @@ -74,3 +82,6 @@ index 58646a1..8bf830b 100755 if symbol_info == binary_info: mkdir_p(os.path.dirname(output_path)) shutil.copyfile(potential_symbol_file, output_path) +-- +2.17.0 + diff --git a/patches/common/chromium/web_contents.patch b/patches/common/chromium/web_contents.patch index 919bfceb3a..499077276b 100644 --- a/patches/common/chromium/web_contents.patch +++ b/patches/common/chromium/web_contents.patch @@ -1,11 +1,11 @@ -From 3fae422b46dec513879ec6d4fd8c8dd4c4cdcd0f Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:46:53 -0700 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 26384f823b51..64ad6ca91d93 100644 +index 26384f823b511ca720ae474e950d75fd19b65111..64ad6ca91d9331a09d09f7e29b7c24a0c12852a2 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -1931,6 +1931,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { @@ -30,7 +30,7 @@ index 26384f823b51..64ad6ca91d93 100644 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 44c68ed25b66..c7b0c747fa41 100644 +index 44c68ed25b664b40b12dd843a18f7fe18d9cdfa9..c7b0c747fa4132a076719f7a4b3aad84f526aee3 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 { @@ -92,7 +92,7 @@ index 44c68ed25b66..c7b0c747fa41 100644 RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget( diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 0f82f91e437c..0deb4d93fffb 100644 +index 0f82f91e437c495b92662c9816225687430ec8a4..0deb4d93fffbd7392cc1a391d9503946434ad1ba 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -76,9 +76,12 @@ class BrowserPluginGuestDelegate; diff --git a/patches/common/chromium/web_preferences.patch b/patches/common/chromium/web_preferences.patch index ea6b198615..84a26c786f 100644 --- a/patches/common/chromium/web_preferences.patch +++ b/patches/common/chromium/web_preferences.patch @@ -1,5 +1,16 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: zcbenz +Date: Thu, 18 Oct 2018 17:08:33 -0700 +Subject: web_preferences.patch + +Add a node_integration field to WebPreferences so we can determine whether +a frame has node integration in renderer process. + +This is required by the nativeWindowOpen option, which put multiple main +frames in one renderer process. + diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h -index 57f03dc..7c4409e 100644 +index 57f03dc1ed38f0f7f644615dc7eb7a6f9e568760..7c4409e6e9abf4d02e50c31d480c3e3792e9e655 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h @@ -198,6 +198,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) @@ -11,7 +22,7 @@ index 57f03dc..7c4409e 100644 IPC_STRUCT_TRAITS_MEMBER(text_autosizing_enabled) IPC_STRUCT_TRAITS_MEMBER(double_tap_to_zoom_enabled) diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h -index 78cbf5f..b33ac28 100644 +index 78cbf5f3db8624ad3a346406da47d0ec1a2b4e53..b33ac2894c7c305a7e303f323db22caf64d30468 100644 --- a/content/public/common/web_preferences.h +++ b/content/public/common/web_preferences.h @@ -222,6 +222,9 @@ struct CONTENT_EXPORT WebPreferences { @@ -24,3 +35,5 @@ index 78cbf5f..b33ac28 100644 bool immersive_mode_enabled; bool text_autosizing_enabled; +-- +2.17.0 diff --git a/patches/common/chromium/webgl_context_attributes.patch b/patches/common/chromium/webgl_context_attributes.patch index cd3e3bfdeb..78a8d21fa3 100644 --- a/patches/common/chromium/webgl_context_attributes.patch +++ b/patches/common/chromium/webgl_context_attributes.patch @@ -1,11 +1,11 @@ -From 2ece85392855af0ea2c9406f98922a869d335bcd Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Thu, 20 Sep 2018 17:47:01 -0700 Subject: webgl_context_attributes.patch diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index a9b86c68fe50..46931503ec2b 100644 +index a9b86c68fe5098be3f2b2c902dccd38f893c8800..46931503ec2bdeed0667defaee7593249d887bbf 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc @@ -997,8 +997,10 @@ RendererBlinkPlatformImpl::CreateOffscreenGraphicsContext3DProvider( @@ -22,7 +22,7 @@ index a9b86c68fe50..46931503ec2b 100644 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 f927253a7e0b..12ada20ec3a3 100644 +index f927253a7e0b2ddb2fbcc0958634e7a41b988be9..12ada20ec3a3c9cffb9c95d56d379b93efe38580 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h @@ -500,6 +500,7 @@ class BLINK_PLATFORM_EXPORT Platform { @@ -34,7 +34,7 @@ index f927253a7e0b..12ada20ec3a3 100644 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 03da0840b0e3..9551675de44d 100644 +index 03da0840b0e398fa0826fb36b55ff41bd95af77d..9551675de44d1475714726d9b58f4d1b7863d98f 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 { @@ -46,7 +46,7 @@ index 03da0840b0e3..9551675de44d 100644 // This attribute is of type XRDevice, defined in modules/xr/XRDevice.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 7b655dd12a77..8969eb7d98f3 100644 +index 7b655dd12a77d701453988d949295ead0b7dbf4d..8969eb7d98f3a7bf2e431a398a2156499d1be326 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 7b655dd12a77..8969eb7d98f3 100644 [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 3846b2a179d9..bf7c63a81391 100644 +index 3846b2a179d963a99c3785c4b9b41f346403eeb2..bf7c63a8139152c4e6a01f52965da09f6ed0b48e 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( @@ -91,7 +91,7 @@ index 3846b2a179d9..bf7c63a81391 100644 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 38ca0f6b6a0c..90cfe8497daf 100644 +index 38ca0f6b6a0c4bcb042887cd168ba8040435875d..90cfe8497daf2db6c3022826b5f1ab4e854e9955 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 @@ diff --git a/patches/common/chromium/webui_in_subframes.patch b/patches/common/chromium/webui_in_subframes.patch index f762390154..3bc3682543 100644 --- a/patches/common/chromium/webui_in_subframes.patch +++ b/patches/common/chromium/webui_in_subframes.patch @@ -1,4 +1,4 @@ -From 8154c4c74afebf8f2918cf18179b6c8eda632af6 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:47:15 -0700 Subject: webui_in_subframes.patch diff --git a/patches/common/chromium/webview_cross_drag.patch b/patches/common/chromium/webview_cross_drag.patch index 9b52d51863..5d32953962 100644 --- a/patches/common/chromium/webview_cross_drag.patch +++ b/patches/common/chromium/webview_cross_drag.patch @@ -1,11 +1,11 @@ -From 27c9f8e5be435006424d885985f4e017602402fe Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 20 Sep 2018 17:47:04 -0700 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 713b17948ef7..cd2d022ff53e 100644 +index 713b17948ef79d8d6a2980e647078a215e023339..cd2d022ff53e9976ee350b67988e4f7a82a51915 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -609,6 +609,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { @@ -17,7 +17,7 @@ index 713b17948ef7..cd2d022ff53e 100644 GetRenderViewHostID(web_contents_->GetRenderViewHost()) != drag_start_view_id_; diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm -index cec3bd8a97b8..7a2b4462bd44 100644 +index cec3bd8a97b8b9bcab176a9bd2c296ec12aba838..7a2b4462bd44176e8e8389499f8c3d5fea647fa0 100644 --- a/content/browser/web_contents/web_drag_dest_mac.mm +++ b/content/browser/web_contents/web_drag_dest_mac.mm @@ -348,6 +348,7 @@ GetRenderWidgetHostAtPoint:(const NSPoint&)viewPoint diff --git a/patches/common/chromium/webview_reattach.patch b/patches/common/chromium/webview_reattach.patch index 2b5ae2f77d..63fd46a63a 100644 --- a/patches/common/chromium/webview_reattach.patch +++ b/patches/common/chromium/webview_reattach.patch @@ -1,4 +1,4 @@ -From e97c5ed19320a2fc34e8b71ef838d176db8bd5b0 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:49:13 -0700 Subject: webview_reattach.patch @@ -7,7 +7,7 @@ Backports https://chromium-review.googlesource.com/c/chromium/src/+/1161391 Fixes webview not working after renderer process restarted. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 88211169a7d7..7b2715aea2af 100644 +index 64ad6ca91d9331a09d09f7e29b7c24a0c12852a2..ec3d1ccbad7e3e4184205f87b6b3fb7dcd4c07f2 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4906,6 +4906,12 @@ void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host, diff --git a/patches/common/chromium/windows_cc_wrapper.patch b/patches/common/chromium/windows_cc_wrapper.patch index bb3991a9cc..06dcbeb585 100644 --- a/patches/common/chromium/windows_cc_wrapper.patch +++ b/patches/common/chromium/windows_cc_wrapper.patch @@ -1,4 +1,4 @@ -From 8fda73933a1a6d1a25b6160bc3629132ba075bfd Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 20 Sep 2018 17:49:45 -0700 Subject: windows_cc_wrapper.patch @@ -6,7 +6,7 @@ Subject: windows_cc_wrapper.patch Allow use of cc_wrapper (eg sccache). diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn -index fdffcdbdbbfe..0b7487e1d288 100644 +index eb3e2b2b377dde31e062be46837bf509ecab0325..5c014b190e121619056aa2eb7301887d47490d57 100644 --- a/build/toolchain/win/BUILD.gn +++ b/build/toolchain/win/BUILD.gn @@ -6,6 +6,7 @@ import("//build/config/clang/clang.gni") diff --git a/patches/common/chromium/worker_context_will_destroy.patch b/patches/common/chromium/worker_context_will_destroy.patch index 376c12bce7..2784d5c6b2 100644 --- a/patches/common/chromium/worker_context_will_destroy.patch +++ b/patches/common/chromium/worker_context_will_destroy.patch @@ -1,11 +1,11 @@ -From d822ef159744a681bee4f1ca8e1a7776a76e6d5e Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:47:12 -0700 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 a2dc7a811e75..5cbfe0e0bef3 100644 +index a2dc7a811e7511e272b58662e2339d77308489a9..5cbfe0e0bef3bf70994c443548f81eb9b9d60e4b 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -377,6 +377,11 @@ class CONTENT_EXPORT ContentRendererClient { @@ -21,7 +21,7 @@ index a2dc7a811e75..5cbfe0e0bef3 100644 // 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 46931503ec2b..1c2ae4550384 100644 +index 46931503ec2bdeed0667defaee7593249d887bbf..1c2ae455038483d9b492723e43d4d66b65c57577 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc @@ -1108,6 +1108,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { @@ -38,7 +38,7 @@ index 46931503ec2b..1c2ae4550384 100644 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 bebcd933b8ce..49d981cc18ea 100644 +index bebcd933b8ce52892be3c083c838de846ae72377..49d981cc18eaceeae0bc5760996651f995cc7837 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h @@ -201,6 +201,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { @@ -50,7 +50,7 @@ index bebcd933b8ce..49d981cc18ea 100644 // 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 12ada20ec3a3..0e1555e5a3c9 100644 +index 12ada20ec3a3c9cffb9c95d56d379b93efe38580..0e1555e5a3c94dc5323f4d6644e69a9ec011aaea 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h @@ -626,6 +626,7 @@ class BLINK_PLATFORM_EXPORT Platform { @@ -62,7 +62,7 @@ index 12ada20ec3a3..0e1555e5a3c9 100644 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 6b4a2ce05520..2ba97d5ec53a 100644 +index 6b4a2ce05520c19c77fa3ddf135e83ef8783b3be..2ba97d5ec53ac4693024bb047e6c256dff0a99be 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc @@ -514,6 +514,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { diff --git a/patches/common/ffmpeg/.patches b/patches/common/ffmpeg/.patches new file mode 100644 index 0000000000..6a5badd7d0 --- /dev/null +++ b/patches/common/ffmpeg/.patches @@ -0,0 +1,2 @@ +build_gn.patch +fix_build_on_linux_x86.patch diff --git a/patches/common/ffmpeg/.patches.yaml b/patches/common/ffmpeg/.patches.yaml deleted file mode 100644 index 38e2a5a806..0000000000 --- a/patches/common/ffmpeg/.patches.yaml +++ /dev/null @@ -1,15 +0,0 @@ -repo: src/third_party/ffmpeg -patches: -- - author: Ales Pergl - file: build_gn.patch - description: | - Chromium's Mac toolchain sets the "install_name" linker parameter only - when "is_component_build" is true, but we want to set even if it's false, - because we are making a dylib which will be distributed inside a bundle. -- - author: Aleksei Kuzmin - file: fix_build_on_linux_x86.patch - description: | - Builds on Linux x86 fail with a clang error. See https://crbug.com/796379. - Once it's fixed the patch can be removed. diff --git a/patches/common/ffmpeg/build_gn.patch b/patches/common/ffmpeg/build_gn.patch index b67cff2ad6..16cd85cfdb 100644 --- a/patches/common/ffmpeg/build_gn.patch +++ b/patches/common/ffmpeg/build_gn.patch @@ -1,8 +1,17 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ales Pergl +Date: Mon, 22 Oct 2018 10:45:25 -0700 +Subject: build_gn.patch + +Chromium's Mac toolchain sets the "install_name" linker parameter only +when "is_component_build" is true, but we want to set even if it's false, +because we are making a dylib which will be distributed inside a bundle. + diff --git a/BUILD.gn b/BUILD.gn -index 5439b39693..6783292c3b 100755 +index 494d33fc041c05acc6698e1bfe26cc3f8820bb6b..947deba96107c931582007ce89917f8896923a6f 100755 --- a/BUILD.gn +++ b/BUILD.gn -@@ -393,6 +393,10 @@ if (is_component_ffmpeg) { +@@ -390,6 +390,10 @@ if (is_component_ffmpeg) { # So we can append below and assume they're defined. ldflags = [] @@ -13,3 +22,6 @@ index 5439b39693..6783292c3b 100755 if (is_fuchsia || (is_posix && !is_mac)) { # Fixes warnings PIC relocation when building as component. ldflags += [ +-- +2.17.0 + diff --git a/patches/common/ffmpeg/fix_build_on_linux_x86.patch b/patches/common/ffmpeg/fix_build_on_linux_x86.patch index 060b190ea1..d4b10ef5ca 100644 --- a/patches/common/ffmpeg/fix_build_on_linux_x86.patch +++ b/patches/common/ffmpeg/fix_build_on_linux_x86.patch @@ -1,5 +1,13 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Mon, 22 Oct 2018 10:45:25 -0700 +Subject: fix_build_on_linux_x86.patch + +Builds on Linux x86 fail with a clang error. See https://crbug.com/796379. +Once it's fixed the patch can be removed. + diff --git a/BUILD.gn b/BUILD.gn -index 494d33fc04..249f3700f3 100755 +index 947deba96107c931582007ce89917f8896923a6f..7afd535cb5e43762a14c51dd7b3b163571958d9c 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -239,7 +239,7 @@ target(link_target_type, "ffmpeg_internal") { @@ -11,3 +19,5 @@ index 494d33fc04..249f3700f3 100755 defines += [ "HAVE_EBP_AVAILABLE=0" ] } else { defines += [ "HAVE_EBP_AVAILABLE=1" ] +-- +2.17.0 diff --git a/patches/common/skia/.patches b/patches/common/skia/.patches new file mode 100644 index 0000000000..e359749029 --- /dev/null +++ b/patches/common/skia/.patches @@ -0,0 +1 @@ +fix_font_thickness.patch diff --git a/patches/common/skia/.patches.yaml b/patches/common/skia/.patches.yaml deleted file mode 100644 index 39c8a05e20..0000000000 --- a/patches/common/skia/.patches.yaml +++ /dev/null @@ -1,9 +0,0 @@ -repo: src/third_party/skia -patches: -- - author: Shelley Vohr - file: fix_font_thickness.patch - description: | - Backports https://skia-review.googlesource.com/c/157566/ to - fix an issue whereby font rendering weight was too thin compared - to other fonts present on MacOS Mojave. diff --git a/patches/common/skia/fix_font_thickness.patch b/patches/common/skia/fix_font_thickness.patch index 858a03747e..f521acd9b9 100644 --- a/patches/common/skia/fix_font_thickness.patch +++ b/patches/common/skia/fix_font_thickness.patch @@ -1,8 +1,17 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Mon, 22 Oct 2018 10:45:53 -0700 +Subject: fix_font_thickness.patch + +Backports https://skia-review.googlesource.com/c/157566/ to +fix an issue whereby font rendering weight was too thin compared +to other fonts present on MacOS Mojave. + diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp -index 3cc51d43f6..c0b606c004 100644 +index 18d09b4ec06a23f8c046d4f08a51296b77e37d8b..fc3902156b65b5875d231ff52101764d7b068f91 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp -@@ -377,17 +377,28 @@ static constexpr const uint8_t kSpiderSymbol_ttf[] = { +@@ -380,17 +380,28 @@ static constexpr const uint8_t kSpiderSymbol_ttf[] = { 0x00, 0x02, 0x00, 0x00 }; @@ -36,7 +45,7 @@ index 3cc51d43f6..c0b606c004 100644 UniqueCFRef data( CGDataProviderCreateWithData(nullptr, kSpiderSymbol_ttf, -@@ -398,31 +409,39 @@ static bool supports_LCD() { +@@ -401,31 +412,39 @@ static bool supports_LCD() { CTFontCreateWithGraphicsFont(cgFont.get(), 16, nullptr, nullptr)); SkASSERT(ctFont); @@ -61,10 +70,9 @@ index 3cc51d43f6..c0b606c004 100644 // For debugging. - //UniqueCFRef image(CGBitmapContextCreateImage(cgContext.get())); -- + //UniqueCFRef image(CGBitmapContextCreateImage(noSmoothContext())); + //UniqueCFRef image(CGBitmapContextCreateImage(smoothContext())); -+ + + SmoothBehavior smoothBehavior = SmoothBehavior::none; for (int x = 0; x < 16; ++x) { for (int y = 0; y < 16; ++y) { @@ -90,7 +98,7 @@ index 3cc51d43f6..c0b606c004 100644 } class Offscreen { -@@ -1005,7 +1024,7 @@ CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph& +@@ -1008,7 +1027,7 @@ CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph& if (!fRGBSpace) { //It doesn't appear to matter what color space is specified. //Regular blends and antialiased text are always (s*a + d*(1-a)) @@ -99,7 +107,7 @@ index 3cc51d43f6..c0b606c004 100644 fRGBSpace.reset(CGColorSpaceCreateDeviceRGB()); } -@@ -1260,7 +1279,7 @@ static constexpr uint8_t sk_pow2_table(size_t i) { +@@ -1264,7 +1283,7 @@ static constexpr uint8_t sk_pow2_table(size_t i) { * This will invert the gamma applied by CoreGraphics, so we can get linear * values. * @@ -108,7 +116,7 @@ index 3cc51d43f6..c0b606c004 100644 * The color space used does not appear to affect this choice. */ static constexpr auto gLinearCoverageFromCGLCDValue = SkMakeArray<256>(sk_pow2_table); -@@ -1350,18 +1369,20 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { +@@ -1354,18 +1373,20 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { CGGlyph cgGlyph = SkTo(glyph.getGlyphID()); // FIXME: lcd smoothed un-hinted rasterization unsupported. @@ -132,7 +140,7 @@ index 3cc51d43f6..c0b606c004 100644 { const uint8_t* linear = gLinearCoverageFromCGLCDValue.data(); -@@ -2257,14 +2278,14 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { +@@ -2261,14 +2282,14 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { rec->fFlags &= ~flagsWeDontSupport; @@ -149,7 +157,7 @@ index 3cc51d43f6..c0b606c004 100644 hinting = SkPaint::kNo_Hinting; } else if (SkPaint::kFull_Hinting == hinting) { hinting = SkPaint::kNormal_Hinting; -@@ -2291,12 +2312,15 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { +@@ -2295,12 +2316,15 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { // [LCD][yes-hint]: generate LCD using CoreGraphic's LCD output. if (rec->fMaskFormat == SkMask::kLCD16_Format) { @@ -166,3 +174,5 @@ index 3cc51d43f6..c0b606c004 100644 } } +-- +2.17.0 diff --git a/patches/common/v8/.patches b/patches/common/v8/.patches new file mode 100644 index 0000000000..df872b2d7e --- /dev/null +++ b/patches/common/v8/.patches @@ -0,0 +1,20 @@ +deps_cherry-pick_0dd3390_from_upstream_v8.patch +deps_cherry-pick_09bca09_from_upstream_v8.patch +deps_cherry-pick_c608122_from_upstream_v8.patch +deps_cherry-pick_e1a7699_from_upstream_v8.patch +deps_cherry-pick_ba752ea_from_upstream_v8.patch +deps_cherry-pick_bf5ea81_from_upstream_v8.patch +deps_cherry-pick_a8f6869_from_upstream_v8.patch +deps_backport_detailed_line_info_for_cpu_profiler.patch +deps_cherry-pick_2363cdf_from_upstream_v8.patch +deps_cherry-pick_dbfcc48_from_upstream_v8.patch +deps_add_missing_handlescope_in_fieldtype_printto.patch +add_realloc.patch +build_gn.patch +array_buffer.patch +ostreams.patch +export_platform.patch +dcheck.patch +disable-warning-win.patch +expose_mksnapshot.patch +build-torque-with-x64-toolchain-on-arm.patch diff --git a/patches/common/v8/.patches.yaml b/patches/common/v8/.patches.yaml deleted file mode 100644 index e52d9156f4..0000000000 --- a/patches/common/v8/.patches.yaml +++ /dev/null @@ -1,72 +0,0 @@ -repo: src/v8 -patches: -- - author: null - file: node_v8_patches.patch - description: | - Patches that node applies to v8. - Generated with - - $ cd third_party/electron_node - $ CURRENT_NODE_VERSION=vX.Y.Z - # Find the last commit with the message "deps: update V8 to " - # This commit corresponds to node resetting V8 to its pristine upstream - # state at the stated version. - $ LAST_V8_UPDATE="$(git log --grep='^deps: update V8' --format='%H' -1 deps/v8)" - # This creates a patch file containing all changes in deps/v8 from - # $LAST_V8_UPDATE up to the current node version, formatted in a way that - # it will apply cleanly to the V8 repository (i.e. with `deps/v8` - # stripped off the path and excluding the v8/gypfiles directory, which - # isn't present in V8. - $ git format-patch \ - --relative=deps/v8 \ - $LAST_V8_UPDATE..$CURRENT_NODE_VERSION \ - deps/v8 \ - ':(exclude)deps/v8/gypfiles' \ - --stdout -- - author: Shelley Vohr - file: add_realloc.patch - description: | - Blink overrides ArrayBuffer's allocator with its own one, while Node simply - uses malloc and free, so we need to use v8's allocator in Node. As part of the - 10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator - argument in its constructor, and override ReallocateBufferMemory and - FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy - when we override ReallocateBufferMemory, so we therefore need to implement - Realloc on the v8 side. -- - author: Ales Pergl - file: build_gn.patch - description: null -- - author: Cheng Zhao - file: array_buffer.patch - description: null -- - author: Cheng Zhao - file: ostreams.patch - description: null -- - author: Aleksei Kuzmin - file: export_platform.patch - description: | - v8::Platform::SystemClockTimeMillis must be exported so that node::NodePlatform can call it -- - author: Ales Pergl - file: dcheck.patch - description: null -- - author: Nitish Sakhawalkar - file: disable-warning-win.patch - description: - Disable unit test windows build warning -- - author: Shelley Vohr - file: expose_mksnapshot.patch - description: Needed in order to build mksnapshot on arm. -- - author: Aleksei Kuzmin - file: build-torque-with-x64-toolchain-on-arm.patch - description: | - torque binary has to be run during the build. diff --git a/patches/common/v8/README.md b/patches/common/v8/README.md new file mode 100644 index 0000000000..8bd3c2fe12 --- /dev/null +++ b/patches/common/v8/README.md @@ -0,0 +1,27 @@ +### Exporting node's patches to v8 + +``` +$ cd third_party/electron_node +$ CURRENT_NODE_VERSION=vX.Y.Z # e.g. v10.11.0 + +# Find the last commit with the message "deps: update V8 to " +# This commit corresponds to node resetting V8 to its pristine upstream +# state at the stated version. +$ LAST_V8_UPDATE="$(git log --grep='^deps: update V8' --format='%H' -1 deps/v8)" + +# This creates a patch file containing all changes in deps/v8 from +# $LAST_V8_UPDATE up to the current node version, formatted in a way that +# it will apply cleanly to the V8 repository (i.e. with `deps/v8` +# stripped off the path and excluding the v8/gypfiles directory, which +# isn't present in V8. +$ git format-patch \ + --relative=deps/v8 \ + $LAST_V8_UPDATE..$CURRENT_NODE_VERSION \ + deps/v8 \ + ':(exclude)deps/v8/gypfiles' \ + --stdout +``` + +When upgrading to a new version of node, make sure to match node's patches to +v8 by removing all the `deps_*` patches and re-exporting node's v8 patches +using the process above. diff --git a/patches/common/v8/add_realloc.patch b/patches/common/v8/add_realloc.patch index 4480357af3..3df2aafd9a 100644 --- a/patches/common/v8/add_realloc.patch +++ b/patches/common/v8/add_realloc.patch @@ -1,8 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Mon, 22 Oct 2018 10:47:11 -0700 +Subject: add_realloc.patch + +Blink overrides ArrayBuffer's allocator with its own one, while Node simply +uses malloc and free, so we need to use v8's allocator in Node. As part of the +10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator +argument in its constructor, and override ReallocateBufferMemory and +FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy +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 573e80176d..5eefe26fe9 100644 +index 20a65afcbc61c31360874e45adc03eeda02e9a81..6bba7a177e72b54084b2a52e413c5de6edb26b01 100644 --- a/include/v8.h +++ b/include/v8.h -@@ -4318,6 +4318,13 @@ class V8_EXPORT ArrayBuffer : public Object { +@@ -4618,6 +4618,13 @@ class V8_EXPORT ArrayBuffer : public Object { */ virtual void* AllocateUninitialized(size_t length) = 0; @@ -17,10 +30,10 @@ index 573e80176d..5eefe26fe9 100644 * 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 8b177d041d..e06ca2a207 100644 +index 6155cbb32579effc500b5c475cd478e77b3ecdf4..9fe5268aa5e615fee058d430b6a137dd40fc9226 100644 --- a/src/api.cc +++ b/src/api.cc -@@ -460,6 +460,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { +@@ -505,6 +505,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { i::V8::SetSnapshotBlob(snapshot_blob); } @@ -31,3 +44,6 @@ index 8b177d041d..e06ca2a207 100644 namespace { class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { +-- +2.17.0 + diff --git a/patches/common/v8/array_buffer.patch b/patches/common/v8/array_buffer.patch index 28d3c9488c..2004a70b5a 100644 --- a/patches/common/v8/array_buffer.patch +++ b/patches/common/v8/array_buffer.patch @@ -1,8 +1,14 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Mon, 22 Oct 2018 10:47:12 -0700 +Subject: array_buffer.patch + + diff --git a/include/v8.h b/include/v8.h -index 573e80176d..80bfd1d22a 100644 +index 6bba7a177e72b54084b2a52e413c5de6edb26b01..b1e192dc009b33484148817be0b0b6bb4dc1bf4b 100644 --- a/include/v8.h +++ b/include/v8.h -@@ -7337,6 +7337,9 @@ class V8_EXPORT Isolate { +@@ -7766,6 +7766,9 @@ class V8_EXPORT Isolate { */ void SetIdle(bool is_idle); @@ -13,10 +19,10 @@ index 573e80176d..80bfd1d22a 100644 bool InContext(); diff --git a/src/api.cc b/src/api.cc -index 8b177d041d..f58a350f0f 100644 +index 9fe5268aa5e615fee058d430b6a137dd40fc9226..5c1f2410bbab4a0d9f4fcd99f19530ba999a66a2 100644 --- a/src/api.cc +++ b/src/api.cc -@@ -8139,6 +8139,13 @@ void Isolate::SetIdle(bool is_idle) { +@@ -8290,6 +8290,13 @@ void Isolate::SetIdle(bool is_idle) { isolate->SetIdle(is_idle); } @@ -30,3 +36,6 @@ index 8b177d041d..f58a350f0f 100644 bool Isolate::InContext() { i::Isolate* isolate = reinterpret_cast(this); return isolate->context() != nullptr; +-- +2.17.0 + 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 df7119dc63..64411b3b23 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,8 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Mon, 22 Oct 2018 10:47:13 -0700 +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 456a318..af803ff 100644 +index b5eb09cfcb8add19f4de985cbe7b9777c51c4bd3..dbe4338c3a733cb806e420a9bb0b4bcc65cf333b 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -870,7 +870,8 @@ action("run_torque") { +@@ -899,7 +899,8 @@ action("run_torque") { # is the target toolchain and, hence, can't be used. v8_torque_toolchain = v8_snapshot_toolchain if (host_cpu == "x64" && @@ -12,7 +19,7 @@ index 456a318..af803ff 100644 v8_torque_toolchain = "//build/toolchain/linux:clang_x64" } -@@ -3079,7 +3080,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { +@@ -3149,7 +3150,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { } } @@ -21,3 +28,5 @@ index 456a318..af803ff 100644 v8_executable("torque") { visibility = [ ":*" ] # Only targets in this file can depend on this. +-- +2.17.0 diff --git a/patches/common/v8/build_gn.patch b/patches/common/v8/build_gn.patch index c8e70fae66..6999d2d9fb 100644 --- a/patches/common/v8/build_gn.patch +++ b/patches/common/v8/build_gn.patch @@ -1,5 +1,11 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ales Pergl +Date: Mon, 22 Oct 2018 10:47:12 -0700 +Subject: build_gn.patch + + diff --git a/BUILD.gn b/BUILD.gn -index 443694d880..d0ba5ed04e 100644 +index 443694d88075d59d6e8db7fa4bedc3a812fdafc4..d0ba5ed04e7126deae4a0ab9ee8943cda5ea42e3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -212,7 +212,7 @@ config("internal_config") { @@ -20,3 +26,6 @@ index 443694d880..d0ba5ed04e 100644 deps = [ ":v8_base", ":v8_init", +-- +2.17.0 + diff --git a/patches/common/v8/dcheck.patch b/patches/common/v8/dcheck.patch index a5cd0ae26d..cc69376284 100644 --- a/patches/common/v8/dcheck.patch +++ b/patches/common/v8/dcheck.patch @@ -1,8 +1,14 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ales Pergl +Date: Mon, 22 Oct 2018 10:47:12 -0700 +Subject: dcheck.patch + + diff --git a/src/api.cc b/src/api.cc -index 8531cd5c05..47254c9f5c 100644 +index 5c1f2410bbab4a0d9f4fcd99f19530ba999a66a2..b464a2187c162bac00620f65e9c94deeaf3d6c95 100644 --- a/src/api.cc +++ b/src/api.cc -@@ -8598,7 +8604,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -8851,7 +8851,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { void Isolate::RunMicrotasks() { @@ -12,10 +18,10 @@ index 8531cd5c05..47254c9f5c 100644 } diff --git a/src/heap/heap.cc b/src/heap/heap.cc -index 62a5856f34..c59dfad2c8 100644 +index 6830a90482173174266faa0e9a95618c67fad811..78991a26de6d97e3ee14b66913fc079a795b299d 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc -@@ -5963,9 +5963,9 @@ void Heap::TearDown() { +@@ -5006,9 +5006,9 @@ void Heap::TearDown() { void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type, void* data) { DCHECK_NOT_NULL(callback); @@ -28,3 +34,6 @@ index 62a5856f34..c59dfad2c8 100644 gc_prologue_callbacks_.emplace_back(callback, gc_type, data); } +-- +2.17.0 + diff --git a/patches/common/v8/deps_add_missing_handlescope_in_fieldtype_printto.patch b/patches/common/v8/deps_add_missing_handlescope_in_fieldtype_printto.patch new file mode 100644 index 0000000000..db71f13c74 --- /dev/null +++ b/patches/common/v8/deps_add_missing_handlescope_in_fieldtype_printto.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yang Guo +Date: Mon, 17 Sep 2018 07:43:46 +0200 +Subject: deps: add missing HandleScope in FieldType::PrintTo + +Refs: https://github.com/nodejs/node/issues/22775 + +PR-URL: https://github.com/nodejs/node/pull/22890 +Reviewed-By: Ruben Bridgewater +Reviewed-By: Anna Henningsen +Reviewed-By: Refael Ackermann + +diff --git a/src/field-type.cc b/src/field-type.cc +index 3b51095323c06bf8883ce484566fd263249390ac..2eebebe3d616ea786ed60cd0e9bea853ea764c7b 100644 +--- a/src/field-type.cc ++++ b/src/field-type.cc +@@ -78,6 +78,7 @@ void FieldType::PrintTo(std::ostream& os) { + os << "None"; + } else { + DCHECK(IsClass()); ++ HandleScope scope(Map::cast(this)->GetIsolate()); + os << "Class(" << static_cast(*AsClass()) << ")"; + } + } +-- +2.17.0 + 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 new file mode 100644 index 0000000000..4056e6ae43 --- /dev/null +++ b/patches/common/v8/deps_backport_detailed_line_info_for_cpu_profiler.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Marshall +Date: Tue, 4 Sep 2018 15:48:15 +0200 +Subject: deps: backport detailed line info for CPU profiler + +[cpu-profiler] Add flag to always generate accurate line info. +https://chromium.googlesource.com/v8/v8/+/ +56baf56790de439b3f69e887e94beb3b301ed77c + +[cpu-profiler] Turn on detailed line info for optimized code +https://chromium.googlesource.com/v8/v8/+/ +84894ce6d2af7feb9e1f5574409355120887326c + +[cpu-profiler] Separate the flags for generating extra line information +https://chromium.googlesource.com/v8/v8/+/ +30ff6719db441cc7ef220d449970cc169067e256 + +PR-URL: https://github.com/nodejs/node/pull/22688 +Reviewed-By: James M Snell +Reviewed-By: Ruben Bridgewater + +diff --git a/src/flag-definitions.h b/src/flag-definitions.h +index 052869f3081ed662ced727778fefe11231aae6e5..4d5aa6f885465865e0b29c0cd26bcca41571f0bd 100644 +--- a/src/flag-definitions.h ++++ b/src/flag-definitions.h +@@ -1243,6 +1243,9 @@ DEFINE_BOOL(log_function_events, false, + DEFINE_BOOL(prof, false, + "Log statistical profiling information (implies --log-code).") + ++DEFINE_BOOL(detailed_line_info, true, ++ "Always generate detailed line information for CPU profiling.") ++ + #if defined(ANDROID) + // Phones and tablets have processors that are much slower than desktop + // and laptop computers for which current heuristics are tuned. +diff --git a/src/isolate.cc b/src/isolate.cc +index b0a970305e9d4df8257d1e2a29c79d134896b220..b33b713672a6d471652a1b9c1fc508f15278e1cb 100644 +--- a/src/isolate.cc ++++ b/src/isolate.cc +@@ -3247,6 +3247,10 @@ bool Isolate::use_optimizer() { + !is_precise_count_code_coverage() && !is_block_count_code_coverage(); + } + ++bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const { ++ return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info; ++} ++ + bool Isolate::NeedsSourcePositionsForProfiling() const { + return FLAG_trace_deopt || FLAG_trace_turbo || FLAG_trace_turbo_graph || + FLAG_turbo_profiling || FLAG_perf_prof || is_profiling() || +diff --git a/src/isolate.h b/src/isolate.h +index 09aaf996849017c8626118a2cae8adec1ca18c2d..d94c0fde147f50764171c5a2896921c9811fd0b3 100644 +--- a/src/isolate.h ++++ b/src/isolate.h +@@ -1044,6 +1044,8 @@ class Isolate : private HiddenFactory { + + bool NeedsSourcePositionsForProfiling() const; + ++ bool NeedsDetailedOptimizedCodeLineInfo() const; ++ + bool is_best_effort_code_coverage() const { + return code_coverage_mode() == debug::Coverage::kBestEffort; + } +diff --git a/src/optimized-compilation-info.cc b/src/optimized-compilation-info.cc +index 09b8a0edeae734d5ad9df8666c2bee4cdcebb3f1..77730919f14dc2545b88d140478d7ac05e6db0b0 100644 +--- a/src/optimized-compilation-info.cc ++++ b/src/optimized-compilation-info.cc +@@ -38,7 +38,7 @@ OptimizedCompilationInfo::OptimizedCompilationInfo( + // Collect source positions for optimized code when profiling or if debugger + // is active, to be able to get more precise source positions at the price of + // more memory consumption. +- if (isolate->NeedsSourcePositionsForProfiling()) { ++ if (isolate->NeedsDetailedOptimizedCodeLineInfo()) { + MarkAsSourcePositionsEnabled(); + } + +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_09bca09_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_09bca09_from_upstream_v8.patch new file mode 100644 index 0000000000..eadf3d926b --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_09bca09_from_upstream_v8.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matheus Marchini +Date: Wed, 1 Aug 2018 15:09:51 -0300 +Subject: deps: cherry-pick 09bca09 from upstream V8 + +Original commit message: + + [postmortem] add ScopeInfo and Context types + + The metadata introduced in this patch will be useful for postmortem + tools to inspect Contexts and ScopeInfos (see + https://github.com/nodejs/llnode/issues/211). + + R=bmeurer@google.com, yangguo@google.com + + Change-Id: I927fcab4014d128bd782046c1ecb9ee045723e95 + Reviewed-on: https://chromium-review.googlesource.com/1153858 + Reviewed-by: Yang Guo + Commit-Queue: Yang Guo + Cr-Commit-Position: refs/heads/master@{#54768} + +Refs: https://github.com/v8/v8/commit/09bca095e38d6e4770ae48e174f59d33c + +PR-URL: https://github.com/nodejs/node/pull/22068 +Reviewed-By: James M Snell +Reviewed-By: Ruben Bridgewater + +diff --git a/BUILD.gn b/BUILD.gn +index 4c8c8acd593c8151798a5187c44f56fee3f07977..443694d88075d59d6e8db7fa4bedc3a812fdafc4 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -852,6 +852,7 @@ action("postmortem-metadata") { + "src/objects/js-regexp-string-iterator.h", + "src/objects/map.h", + "src/objects/map-inl.h", ++ "src/objects/scope-info.h", + "src/objects/script.h", + "src/objects/script-inl.h", + "src/objects/shared-function-info.h", +diff --git a/tools/gen-postmortem-metadata.py b/tools/gen-postmortem-metadata.py +index d8ef7b4a158a9c6d5d157169defb47bb82683023..8191c8152f5942858cc3a305bdee72d74c4e55e9 100644 +--- a/tools/gen-postmortem-metadata.py ++++ b/tools/gen-postmortem-metadata.py +@@ -58,6 +58,9 @@ consts_misc = [ + { 'name': 'APIObjectType', 'value': 'JS_API_OBJECT_TYPE' }, + { 'name': 'SpecialAPIObjectType', 'value': 'JS_SPECIAL_API_OBJECT_TYPE' }, + ++ { 'name': 'FirstContextType', 'value': 'FIRST_CONTEXT_TYPE' }, ++ { 'name': 'LastContextType', 'value': 'LAST_CONTEXT_TYPE' }, ++ + { 'name': 'IsNotStringMask', 'value': 'kIsNotStringMask' }, + { 'name': 'StringTag', 'value': 'kStringTag' }, + +@@ -282,7 +285,7 @@ extras_accessors = [ + expected_classes = [ + 'ConsString', 'FixedArray', 'HeapNumber', 'JSArray', 'JSFunction', + 'JSObject', 'JSRegExp', 'JSValue', 'Map', 'Oddball', 'Script', +- 'SeqOneByteString', 'SharedFunctionInfo' ++ 'SeqOneByteString', 'SharedFunctionInfo', 'ScopeInfo' + ]; + + +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_0dd3390_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_0dd3390_from_upstream_v8.patch new file mode 100644 index 0000000000..e307b17a9e --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_0dd3390_from_upstream_v8.patch @@ -0,0 +1,498 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= +Date: Wed, 25 Jul 2018 20:03:35 +0200 +Subject: deps: cherry-pick 0dd3390 from upstream V8 + +Original commit message: + + Reland "[builtins] Add %IsTraceCategoryEnabled and %Trace builtins" + + This is a reland of 8d4572a22b5d2fa0547195bcc40baa18b7565386 + + Original change's description: + > [builtins] Add %IsTraceCategoryEnabled and %Trace builtins + > + > Adds the builtin Trace and IsTraceCategoryEnabled functions + > exposed via extra bindings. These are intended to use by + > embedders to allow basic trace event support from JavaScript. + > + > ```js + > isTraceCategoryEnabled('v8.some-category') + > + > trace('e'.charCodeAt(0), 'v8.some-category', + > 'Foo', 0, { abc: 'xyz'}) + > ``` + > + > Bug: v8:7851 + > Change-Id: I7bfb9bb059efdf87d92a56a0aae326650730c250 + > Reviewed-on: https://chromium-review.googlesource.com/1103294 + > Commit-Queue: Yang Guo + > Reviewed-by: Yang Guo + > Reviewed-by: Fadi Meawad + > Reviewed-by: Camillo Bruni + > Reviewed-by: Benedikt Meurer + > Cr-Commit-Position: refs/heads/master@{#54121} + + TBR=cbruni@chromium.org + + Bug: v8:7851 + Change-Id: Id063754b2834b3b6a2b2654e76e8637bcd6aa5f8 + Reviewed-on: https://chromium-review.googlesource.com/1137071 + Commit-Queue: Yang Guo + Reviewed-by: Yang Guo + Reviewed-by: Camillo Bruni + Reviewed-by: Benedikt Meurer + Cr-Commit-Position: refs/heads/master@{#54532} + +Refs: https://github.com/v8/v8/commit/0dd33901a16c7c64290b7e7ddf13945b773c5d79 + +PR-URL: https://github.com/nodejs/node/pull/21983 +Reviewed-By: Refael Ackermann +Reviewed-By: Gus Caplan +Reviewed-By: Ujjwal Sharma +Reviewed-By: Matteo Collina + +diff --git a/AUTHORS b/AUTHORS +index b9391a0d28499985ae6a5b93394c6d5afc9ea1cd..3873f0ca6816ef28dbbaf63944d66f278c9aff4b 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -87,6 +87,7 @@ Jan de Mooij + Jan Krems + Jay Freeman + James Pike ++James M Snell + Jianghua Yang + Joel Stanley + Johan Bergström +diff --git a/BUILD.gn b/BUILD.gn +index 1e31acb2771e6e4137524ff4ae6a9e962092cd90..4c8c8acd593c8151798a5187c44f56fee3f07977 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -1588,6 +1588,7 @@ v8_source_set("v8_base") { + "src/builtins/builtins-sharedarraybuffer.cc", + "src/builtins/builtins-string.cc", + "src/builtins/builtins-symbol.cc", ++ "src/builtins/builtins-trace.cc", + "src/builtins/builtins-typed-array.cc", + "src/builtins/builtins-utils.h", + "src/builtins/builtins.cc", +diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc +index 6723f3d5d463327cada8477626562a3c27c3e69f..656650cd6498dd82de02e583f5b83ae04a58b0e7 100644 +--- a/src/bootstrapper.cc ++++ b/src/bootstrapper.cc +@@ -5077,6 +5077,15 @@ bool Genesis::InstallExtraNatives() { + + Handle extras_binding = + factory()->NewJSObject(isolate()->object_function()); ++ ++ // binding.isTraceCategoryEnabled(category) ++ SimpleInstallFunction(isolate(), extras_binding, "isTraceCategoryEnabled", ++ Builtins::kIsTraceCategoryEnabled, 1, true); ++ ++ // binding.trace(phase, category, name, id, data) ++ SimpleInstallFunction(isolate(), extras_binding, "trace", Builtins::kTrace, 5, ++ true); ++ + native_context()->set_extras_binding_object(*extras_binding); + + for (int i = ExtraNatives::GetDebuggerCount(); +diff --git a/src/builtins/builtins-definitions.h b/src/builtins/builtins-definitions.h +index 46b02d88d817199620f02afdac753f12f4829e8f..2d7c780c709c55da93797e45e4352598745d0fd0 100644 +--- a/src/builtins/builtins-definitions.h ++++ b/src/builtins/builtins-definitions.h +@@ -1308,7 +1308,11 @@ namespace internal { + ASM(CallApiGetter) \ + ASM(DoubleToI) \ + TFC(GetProperty, GetProperty, 1) \ +- ASM(MathPowInternal) ++ ASM(MathPowInternal) \ ++ \ ++ /* Trace */ \ ++ CPP(IsTraceCategoryEnabled) \ ++ CPP(Trace) + + #ifdef V8_INTL_SUPPORT + #define BUILTIN_LIST(CPP, API, TFJ, TFC, TFS, TFH, ASM) \ +diff --git a/src/builtins/builtins-trace.cc b/src/builtins/builtins-trace.cc +new file mode 100644 +index 0000000000000000000000000000000000000000..cd0f5a77d0a6177069bfa0bd83515f9ded92b491 +--- /dev/null ++++ b/src/builtins/builtins-trace.cc +@@ -0,0 +1,191 @@ ++// Copyright 2018 the V8 project authors. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "src/api.h" ++#include "src/builtins/builtins-utils.h" ++#include "src/builtins/builtins.h" ++#include "src/counters.h" ++#include "src/json-stringifier.h" ++#include "src/objects-inl.h" ++ ++namespace v8 { ++namespace internal { ++ ++namespace { ++ ++using v8::tracing::TracedValue; ++ ++#define MAX_STACK_LENGTH 100 ++ ++class MaybeUtf8 { ++ public: ++ explicit MaybeUtf8(Isolate* isolate, Handle string) : buf_(data_) { ++ string = String::Flatten(isolate, string); ++ int len; ++ if (string->IsOneByteRepresentation()) { ++ // Technically this allows unescaped latin1 characters but the trace ++ // events mechanism currently does the same and the current consuming ++ // tools are tolerant of it. A more correct approach here would be to ++ // escape non-ascii characters but this is easier and faster. ++ len = string->length(); ++ AllocateSufficientSpace(len); ++ if (len > 0) { ++ // Why copy? Well, the trace event mechanism requires null-terminated ++ // strings, the bytes we get from SeqOneByteString are not. buf_ is ++ // guaranteed to be null terminated. ++ memcpy(buf_, Handle::cast(string)->GetChars(), len); ++ } ++ } else { ++ Local local = Utils::ToLocal(string); ++ len = local->Utf8Length(); ++ AllocateSufficientSpace(len); ++ if (len > 0) { ++ local->WriteUtf8(reinterpret_cast(buf_)); ++ } ++ } ++ buf_[len] = 0; ++ } ++ const char* operator*() const { return reinterpret_cast(buf_); } ++ ++ private: ++ void AllocateSufficientSpace(int len) { ++ if (len + 1 > MAX_STACK_LENGTH) { ++ allocated_.reset(new uint8_t[len + 1]); ++ buf_ = allocated_.get(); ++ } ++ } ++ ++ // In the most common cases, the buffer here will be stack allocated. ++ // A heap allocation will only occur if the data is more than MAX_STACK_LENGTH ++ // Given that this is used primarily for trace event categories and names, ++ // the MAX_STACK_LENGTH should be more than enough. ++ uint8_t* buf_; ++ uint8_t data_[MAX_STACK_LENGTH]; ++ std::unique_ptr allocated_; ++}; ++ ++class JsonTraceValue : public ConvertableToTraceFormat { ++ public: ++ explicit JsonTraceValue(Isolate* isolate, Handle object) { ++ // object is a JSON string serialized using JSON.stringify() from within ++ // the BUILTIN(Trace) method. This may (likely) contain UTF8 values so ++ // to grab the appropriate buffer data we have to serialize it out. We ++ // hold on to the bits until the AppendAsTraceFormat method is called. ++ MaybeUtf8 data(isolate, object); ++ data_ = *data; ++ } ++ ++ void AppendAsTraceFormat(std::string* out) const override { *out += data_; } ++ ++ private: ++ std::string data_; ++}; ++ ++const uint8_t* GetCategoryGroupEnabled(Isolate* isolate, ++ Handle string) { ++ MaybeUtf8 category(isolate, string); ++ return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(*category); ++} ++ ++#undef MAX_STACK_LENGTH ++ ++} // namespace ++ ++// Builins::kIsTraceCategoryEnabled(category) : bool ++BUILTIN(IsTraceCategoryEnabled) { ++ HandleScope scope(isolate); ++ Handle category = args.atOrUndefined(isolate, 1); ++ if (!category->IsString()) { ++ THROW_NEW_ERROR_RETURN_FAILURE( ++ isolate, NewTypeError(MessageTemplate::kTraceEventCategoryError)); ++ } ++ return isolate->heap()->ToBoolean( ++ *GetCategoryGroupEnabled(isolate, Handle::cast(category))); ++} ++ ++// Builtins::kTrace(phase, category, name, id, data) : bool ++BUILTIN(Trace) { ++ HandleScope handle_scope(isolate); ++ ++ Handle phase_arg = args.atOrUndefined(isolate, 1); ++ Handle category = args.atOrUndefined(isolate, 2); ++ Handle name_arg = args.atOrUndefined(isolate, 3); ++ Handle id_arg = args.atOrUndefined(isolate, 4); ++ Handle data_arg = args.atOrUndefined(isolate, 5); ++ ++ const uint8_t* category_group_enabled = ++ GetCategoryGroupEnabled(isolate, Handle::cast(category)); ++ ++ // Exit early if the category group is not enabled. ++ if (!*category_group_enabled) { ++ return ReadOnlyRoots(isolate).false_value(); ++ } ++ ++ if (!phase_arg->IsNumber()) { ++ THROW_NEW_ERROR_RETURN_FAILURE( ++ isolate, NewTypeError(MessageTemplate::kTraceEventPhaseError)); ++ } ++ if (!category->IsString()) { ++ THROW_NEW_ERROR_RETURN_FAILURE( ++ isolate, NewTypeError(MessageTemplate::kTraceEventCategoryError)); ++ } ++ if (!name_arg->IsString()) { ++ THROW_NEW_ERROR_RETURN_FAILURE( ++ isolate, NewTypeError(MessageTemplate::kTraceEventNameError)); ++ } ++ ++ uint32_t flags = TRACE_EVENT_FLAG_COPY; ++ int32_t id = 0; ++ if (!id_arg->IsNullOrUndefined(isolate)) { ++ if (!id_arg->IsNumber()) { ++ THROW_NEW_ERROR_RETURN_FAILURE( ++ isolate, NewTypeError(MessageTemplate::kTraceEventIDError)); ++ } ++ flags |= TRACE_EVENT_FLAG_HAS_ID; ++ id = DoubleToInt32(id_arg->Number()); ++ } ++ ++ Handle name_str = Handle::cast(name_arg); ++ if (name_str->length() == 0) { ++ THROW_NEW_ERROR_RETURN_FAILURE( ++ isolate, NewTypeError(MessageTemplate::kTraceEventNameLengthError)); ++ } ++ MaybeUtf8 name(isolate, name_str); ++ ++ // We support passing one additional trace event argument with the ++ // name "data". Any JSON serializable value may be passed. ++ static const char* arg_name = "data"; ++ int32_t num_args = 0; ++ uint8_t arg_type; ++ uint64_t arg_value; ++ ++ if (!data_arg->IsUndefined(isolate)) { ++ // Serializes the data argument as a JSON string, which is then ++ // copied into an object. This eliminates duplicated code but ++ // could have perf costs. It is also subject to all the same ++ // limitations as JSON.stringify() as it relates to circular ++ // references and value limitations (e.g. BigInt is not supported). ++ JsonStringifier stringifier(isolate); ++ Handle result; ++ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ++ isolate, result, ++ stringifier.Stringify(data_arg, isolate->factory()->undefined_value(), ++ isolate->factory()->undefined_value())); ++ std::unique_ptr traced_value; ++ traced_value.reset( ++ new JsonTraceValue(isolate, Handle::cast(result))); ++ tracing::SetTraceValue(std::move(traced_value), &arg_type, &arg_value); ++ num_args++; ++ } ++ ++ TRACE_EVENT_API_ADD_TRACE_EVENT( ++ static_cast(DoubleToInt32(phase_arg->Number())), ++ category_group_enabled, *name, tracing::kGlobalScope, id, tracing::kNoId, ++ num_args, &arg_name, &arg_type, &arg_value, flags); ++ ++ return ReadOnlyRoots(isolate).true_value(); ++} ++ ++} // namespace internal ++} // namespace v8 +diff --git a/src/debug/debug-evaluate.cc b/src/debug/debug-evaluate.cc +index 0dd23037723ff4ebf1158f7ecd4f813ed53e18e0..d263fa45a9a4ea3f2604f8c47085a39963c12a91 100644 +--- a/src/debug/debug-evaluate.cc ++++ b/src/debug/debug-evaluate.cc +@@ -567,6 +567,9 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) { + case Builtins::kArrayMap: + case Builtins::kArrayReduce: + case Builtins::kArrayReduceRight: ++ // Trace builtins. ++ case Builtins::kIsTraceCategoryEnabled: ++ case Builtins::kTrace: + // TypedArray builtins. + case Builtins::kTypedArrayConstructor: + case Builtins::kTypedArrayPrototypeBuffer: +diff --git a/src/messages.h b/src/messages.h +index 1d1a07d7b696f32e7c7d56fceda4739bdf30b8ea..68078bb3736023e688a764709566bbc334e77791 100644 +--- a/src/messages.h ++++ b/src/messages.h +@@ -757,7 +757,14 @@ class ErrorUtils : public AllStatic { + T(DataCloneDeserializationError, "Unable to deserialize cloned data.") \ + T(DataCloneDeserializationVersionError, \ + "Unable to deserialize cloned data due to invalid or unsupported " \ +- "version.") ++ "version.") \ ++ /* Builtins-Trace Errors */ \ ++ T(TraceEventCategoryError, "Trace event category must be a string.") \ ++ T(TraceEventNameError, "Trace event name must be a string.") \ ++ T(TraceEventNameLengthError, \ ++ "Trace event name must not be an empty string.") \ ++ T(TraceEventPhaseError, "Trace event phase must be a number.") \ ++ T(TraceEventIDError, "Trace event id must be a number.") + + class MessageTemplate { + public: +diff --git a/test/cctest/test-trace-event.cc b/test/cctest/test-trace-event.cc +index 7b736b907dd9aebc8c0c505ce5a6542b79050c69..47545af37f89c0fcd648293a5bb1c70a5e6360b0 100644 +--- a/test/cctest/test-trace-event.cc ++++ b/test/cctest/test-trace-event.cc +@@ -75,7 +75,7 @@ class MockTracingController : public v8::TracingController { + const char* name, uint64_t handle) override {} + + const uint8_t* GetCategoryGroupEnabled(const char* name) override { +- if (strcmp(name, "v8-cat")) { ++ if (strncmp(name, "v8-cat", 6)) { + static uint8_t no = 0; + return &no; + } else { +@@ -282,3 +282,135 @@ TEST(TestEventWithTimestamp) { + CHECK_EQ(20683, GET_TRACE_OBJECT(3)->timestamp); + CHECK_EQ(32832, GET_TRACE_OBJECT(4)->timestamp); + } ++ ++TEST(BuiltinsIsTraceCategoryEnabled) { ++ CcTest::InitializeVM(); ++ MockTracingPlatform platform; ++ ++ v8::Isolate* isolate = CcTest::isolate(); ++ v8::HandleScope handle_scope(isolate); ++ LocalContext env; ++ ++ v8::Local binding = env->GetExtrasBindingObject(); ++ CHECK(!binding.IsEmpty()); ++ ++ auto undefined = v8::Undefined(isolate); ++ auto isTraceCategoryEnabled = ++ binding->Get(env.local(), v8_str("isTraceCategoryEnabled")) ++ .ToLocalChecked() ++ .As(); ++ ++ { ++ // Test with an enabled category ++ v8::Local argv[] = {v8_str("v8-cat")}; ++ auto result = isTraceCategoryEnabled->Call(env.local(), undefined, 1, argv) ++ .ToLocalChecked() ++ .As(); ++ ++ CHECK(result->BooleanValue()); ++ } ++ ++ { ++ // Test with a disabled category ++ v8::Local argv[] = {v8_str("cat")}; ++ auto result = isTraceCategoryEnabled->Call(env.local(), undefined, 1, argv) ++ .ToLocalChecked() ++ .As(); ++ ++ CHECK(!result->BooleanValue()); ++ } ++ ++ { ++ // Test with an enabled utf8 category ++ v8::Local argv[] = {v8_str("v8-cat\u20ac")}; ++ auto result = isTraceCategoryEnabled->Call(env.local(), undefined, 1, argv) ++ .ToLocalChecked() ++ .As(); ++ ++ CHECK(result->BooleanValue()); ++ } ++} ++ ++TEST(BuiltinsTrace) { ++ CcTest::InitializeVM(); ++ MockTracingPlatform platform; ++ ++ v8::Isolate* isolate = CcTest::isolate(); ++ v8::HandleScope handle_scope(isolate); ++ LocalContext env; ++ ++ v8::Local binding = env->GetExtrasBindingObject(); ++ CHECK(!binding.IsEmpty()); ++ ++ auto undefined = v8::Undefined(isolate); ++ auto trace = binding->Get(env.local(), v8_str("trace")) ++ .ToLocalChecked() ++ .As(); ++ ++ // Test with disabled category ++ { ++ v8::Local category = v8_str("cat"); ++ v8::Local name = v8_str("name"); ++ v8::Local argv[] = { ++ v8::Integer::New(isolate, 'b'), // phase ++ category, name, v8::Integer::New(isolate, 0), // id ++ undefined // data ++ }; ++ auto result = trace->Call(env.local(), undefined, 5, argv) ++ .ToLocalChecked() ++ .As(); ++ ++ CHECK(!result->BooleanValue()); ++ CHECK_EQ(0, GET_TRACE_OBJECTS_LIST->size()); ++ } ++ ++ // Test with enabled category ++ { ++ v8::Local category = v8_str("v8-cat"); ++ v8::Local name = v8_str("name"); ++ v8::Local context = isolate->GetCurrentContext(); ++ v8::Local data = v8::Object::New(isolate); ++ data->Set(context, v8_str("foo"), v8_str("bar")).FromJust(); ++ v8::Local argv[] = { ++ v8::Integer::New(isolate, 'b'), // phase ++ category, name, v8::Integer::New(isolate, 123), // id ++ data // data arg ++ }; ++ auto result = trace->Call(env.local(), undefined, 5, argv) ++ .ToLocalChecked() ++ .As(); ++ ++ CHECK(result->BooleanValue()); ++ CHECK_EQ(1, GET_TRACE_OBJECTS_LIST->size()); ++ ++ CHECK_EQ(123, GET_TRACE_OBJECT(0)->id); ++ CHECK_EQ('b', GET_TRACE_OBJECT(0)->phase); ++ CHECK_EQ("name", GET_TRACE_OBJECT(0)->name); ++ CHECK_EQ(1, GET_TRACE_OBJECT(0)->num_args); ++ } ++ ++ // Test with enabled utf8 category ++ { ++ v8::Local category = v8_str("v8-cat\u20ac"); ++ v8::Local name = v8_str("name\u20ac"); ++ v8::Local context = isolate->GetCurrentContext(); ++ v8::Local data = v8::Object::New(isolate); ++ data->Set(context, v8_str("foo"), v8_str("bar")).FromJust(); ++ v8::Local argv[] = { ++ v8::Integer::New(isolate, 'b'), // phase ++ category, name, v8::Integer::New(isolate, 123), // id ++ data // data arg ++ }; ++ auto result = trace->Call(env.local(), undefined, 5, argv) ++ .ToLocalChecked() ++ .As(); ++ ++ CHECK(result->BooleanValue()); ++ CHECK_EQ(2, GET_TRACE_OBJECTS_LIST->size()); ++ ++ CHECK_EQ(123, GET_TRACE_OBJECT(1)->id); ++ CHECK_EQ('b', GET_TRACE_OBJECT(1)->phase); ++ CHECK_EQ("name\u20ac", GET_TRACE_OBJECT(1)->name); ++ CHECK_EQ(1, GET_TRACE_OBJECT(1)->num_args); ++ } ++} +-- +2.17.0 + 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 new file mode 100644 index 0000000000..a149accf72 --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_2363cdf_from_upstream_v8.patch @@ -0,0 +1,77 @@ +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 b4aa7baf724d4f29b4df08f3b57fdc018f6a32a7..e0a6a1234c597071b327d051c7da1d2b784529e5 100644 +--- a/src/libplatform/tracing/tracing-controller.cc ++++ b/src/libplatform/tracing/tracing-controller.cc +@@ -63,13 +63,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; + } +@@ -81,13 +83,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; + } +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_a8f6869_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_a8f6869_from_upstream_v8.patch new file mode 100644 index 0000000000..5f6dd772fd --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_a8f6869_from_upstream_v8.patch @@ -0,0 +1,306 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= +Date: Tue, 4 Sep 2018 21:24:34 +0200 +Subject: deps: cherry-pick a8f6869 from upstream V8 + +Original commit message: + + [debug] Fully implement Debug::ArchiveDebug and Debug::RestoreDebug. + + I have a project that embeds V8 and uses a single `Isolate` from multiple + threads. The program runs just fine, but sometimes the inspector doesn't + stop on the correct line after stepping over a statement that switches + threads behind the scenes, even though the original thread is restored by + the time the next statement is executed. + + After some digging, I discovered that the `Debug::ArchiveDebug` and + `Debug::RestoreDebug` methods, which should be responsible for + saving/restoring this `ThreadLocal` information when switching threads, + currently don't do anything. + + This commit implements those methods using MemCopy, in the style of other + Archive/Restore methods in the V8 codebase. + + Related: https://groups.google.com/forum/#!topic/v8-users/_Qf2rwljRk8 + + Note: I believe my employer, Meteor Development Group, has previously + signed the CLA using the group email address google-contrib@meteor.com. + + R=yangguo@chromium.org,jgruber@chromium.org + CC=info@bnoordhuis.nl + + Bug: v8:7230 + Change-Id: Id517c873eb81cd53f7216c7efd441b956cf7f943 + Reviewed-on: https://chromium-review.googlesource.com/833260 + Commit-Queue: Yang Guo + Reviewed-by: Yang Guo + Cr-Commit-Position: refs/heads/master@{#54902} + +Refs: https://github.com/v8/v8/commit/a8f6869177685cfb9c199c454a86f4698c260515 + +PR-URL: https://github.com/nodejs/node/pull/21983 +Reviewed-By: Refael Ackermann +Reviewed-By: Gus Caplan +Reviewed-By: Ujjwal Sharma +Reviewed-By: Matteo Collina + +diff --git a/AUTHORS b/AUTHORS +index 3873f0ca6816ef28dbbaf63944d66f278c9aff4b..6179e2230d8011025fa3202327071c5b05fee86f 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -32,6 +32,7 @@ Facebook, Inc. <*@fb.com> + Facebook, Inc. <*@oculus.com> + Vewd Software AS <*@vewd.com> + Groupon <*@groupon.com> ++Meteor Development Group <*@meteor.com> + Cloudflare, Inc. <*@cloudflare.com> + + Aaron Bieber +@@ -49,6 +50,7 @@ Andrei Kashcha + Anna Henningsen + Bangfu Tao + Ben Coe ++Ben Newman + Ben Noordhuis + Benjamin Tan + Bert Belder +diff --git a/src/debug/debug.cc b/src/debug/debug.cc +index 47de9523a50f84bdcf88d35bed7a3602a160b6cd..3877f156efac34279a9f55c0d335468330867380 100644 +--- a/src/debug/debug.cc ++++ b/src/debug/debug.cc +@@ -355,19 +355,31 @@ void Debug::ThreadInit() { + + + char* Debug::ArchiveDebug(char* storage) { +- // Simply reset state. Don't archive anything. +- ThreadInit(); ++ MemCopy(storage, reinterpret_cast(&thread_local_), ++ ArchiveSpacePerThread()); + return storage + ArchiveSpacePerThread(); + } + +- + char* Debug::RestoreDebug(char* storage) { +- // Simply reset state. Don't restore anything. +- ThreadInit(); ++ MemCopy(reinterpret_cast(&thread_local_), storage, ++ ArchiveSpacePerThread()); ++ ++ // Enter the debugger. ++ DebugScope debug_scope(this); ++ ++ // Clear any one-shot breakpoints that may have been set by the other ++ // thread, and reapply breakpoints for this thread. ++ ClearOneShot(); ++ ++ if (thread_local_.last_step_action_ != StepNone) { ++ // Reset the previous step action for this thread. ++ PrepareStep(thread_local_.last_step_action_); ++ } ++ + return storage + ArchiveSpacePerThread(); + } + +-int Debug::ArchiveSpacePerThread() { return 0; } ++int Debug::ArchiveSpacePerThread() { return sizeof(ThreadLocal); } + + void Debug::Iterate(RootVisitor* v) { + v->VisitRootPointer(Root::kDebug, nullptr, &thread_local_.return_value_); +diff --git a/src/debug/debug.h b/src/debug/debug.h +index 31881fe10696abdfc01b4503f78e3778e6297392..13844769c1434955b8c65b762cce771a360cc7f5 100644 +--- a/src/debug/debug.h ++++ b/src/debug/debug.h +@@ -314,6 +314,7 @@ class Debug { + static int ArchiveSpacePerThread(); + void FreeThreadResources() { } + void Iterate(RootVisitor* v); ++ void InitThread(const ExecutionAccess& lock) { ThreadInit(); } + + bool CheckExecutionState() { return is_active() && break_id() != 0; } + +diff --git a/src/v8threads.cc b/src/v8threads.cc +index db927010ef174916921d5ee03b1f2d1df3269e8a..0fb333c1f37572e688560aa7de7f6e478364b6b6 100644 +--- a/src/v8threads.cc ++++ b/src/v8threads.cc +@@ -45,7 +45,7 @@ void Locker::Initialize(v8::Isolate* isolate) { + } else { + internal::ExecutionAccess access(isolate_); + isolate_->stack_guard()->ClearThread(access); +- isolate_->stack_guard()->InitThread(access); ++ isolate_->thread_manager()->InitThread(access); + } + } + DCHECK(isolate_->thread_manager()->IsLockedByCurrentThread()); +@@ -95,6 +95,10 @@ Unlocker::~Unlocker() { + + namespace internal { + ++void ThreadManager::InitThread(const ExecutionAccess& lock) { ++ isolate_->stack_guard()->InitThread(lock); ++ isolate_->debug()->InitThread(lock); ++} + + bool ThreadManager::RestoreThread() { + DCHECK(IsLockedByCurrentThread()); +@@ -127,7 +131,7 @@ bool ThreadManager::RestoreThread() { + isolate_->FindPerThreadDataForThisThread(); + if (per_thread == nullptr || per_thread->thread_state() == nullptr) { + // This is a new thread. +- isolate_->stack_guard()->InitThread(access); ++ InitThread(access); + return false; + } + ThreadState* state = per_thread->thread_state(); +diff --git a/src/v8threads.h b/src/v8threads.h +index bb87afea7d849766e913fbd137142d0d0144ad55..7fde0c9ec494e77dbbcf8bdbeb3817ab1a9d4c00 100644 +--- a/src/v8threads.h ++++ b/src/v8threads.h +@@ -67,6 +67,7 @@ class ThreadManager { + void Lock(); + void Unlock(); + ++ void InitThread(const ExecutionAccess&); + void ArchiveThread(); + bool RestoreThread(); + void FreeThreadResources(); +diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc +index d3c10822ffe49f46ab829aa0ab1e035c4393fa1e..7430fbf06b802e54233edfb94196a806e2b68d6b 100644 +--- a/test/cctest/test-debug.cc ++++ b/test/cctest/test-debug.cc +@@ -3717,6 +3717,133 @@ TEST(DebugBreakOffThreadTerminate) { + CHECK(try_catch.HasTerminated()); + } + ++class ArchiveRestoreThread : public v8::base::Thread, ++ public v8::debug::DebugDelegate { ++ public: ++ ArchiveRestoreThread(v8::Isolate* isolate, int spawn_count) ++ : Thread(Options("ArchiveRestoreThread")), ++ isolate_(isolate), ++ debug_(reinterpret_cast(isolate_)->debug()), ++ spawn_count_(spawn_count), ++ break_count_(0) {} ++ ++ virtual void Run() { ++ v8::Locker locker(isolate_); ++ isolate_->Enter(); ++ ++ v8::HandleScope scope(isolate_); ++ v8::Local context = v8::Context::New(isolate_); ++ v8::Context::Scope context_scope(context); ++ ++ v8::Local test = CompileFunction(isolate_, ++ "function test(n) {\n" ++ " debugger;\n" ++ " return n + 1;\n" ++ "}\n", ++ "test"); ++ ++ debug_->SetDebugDelegate(this); ++ v8::internal::DisableBreak enable_break(debug_, false); ++ ++ v8::Local args[1] = {v8::Integer::New(isolate_, spawn_count_)}; ++ ++ int result = test->Call(context, context->Global(), 1, args) ++ .ToLocalChecked() ++ ->Int32Value(context) ++ .FromJust(); ++ ++ // Verify that test(spawn_count_) returned spawn_count_ + 1. ++ CHECK_EQ(spawn_count_ + 1, result); ++ ++ isolate_->Exit(); ++ } ++ ++ void BreakProgramRequested(v8::Local context, ++ const std::vector&) { ++ auto stack_traces = v8::debug::StackTraceIterator::Create(isolate_); ++ if (!stack_traces->Done()) { ++ v8::debug::Location location = stack_traces->GetSourceLocation(); ++ ++ i::PrintF("ArchiveRestoreThread #%d hit breakpoint at line %d\n", ++ spawn_count_, location.GetLineNumber()); ++ ++ switch (location.GetLineNumber()) { ++ case 1: // debugger; ++ CHECK_EQ(break_count_, 0); ++ ++ // Attempt to stop on the next line after the first debugger ++ // statement. If debug->{Archive,Restore}Debug() improperly reset ++ // thread-local debug information, the debugger will fail to stop ++ // before the test function returns. ++ debug_->PrepareStep(StepNext); ++ ++ // Spawning threads while handling the current breakpoint verifies ++ // that the parent thread correctly archived and restored the ++ // state necessary to stop on the next line. If not, then control ++ // will simply continue past the `return n + 1` statement. ++ MaybeSpawnChildThread(); ++ ++ break; ++ ++ case 2: // return n + 1; ++ CHECK_EQ(break_count_, 1); ++ break; ++ ++ default: ++ CHECK(false); ++ } ++ } ++ ++ ++break_count_; ++ } ++ ++ void MaybeSpawnChildThread() { ++ if (spawn_count_ > 1) { ++ v8::Unlocker unlocker(isolate_); ++ ++ // Spawn a thread that spawns a thread that spawns a thread (and so ++ // on) so that the ThreadManager is forced to archive and restore ++ // the current thread. ++ ArchiveRestoreThread child(isolate_, spawn_count_ - 1); ++ child.Start(); ++ child.Join(); ++ ++ // The child thread sets itself as the debug delegate, so we need to ++ // usurp it after the child finishes, or else future breakpoints ++ // will be delegated to a destroyed ArchiveRestoreThread object. ++ debug_->SetDebugDelegate(this); ++ ++ // This is the most important check in this test, since ++ // child.GetBreakCount() will return 1 if the debugger fails to stop ++ // on the `return n + 1` line after the grandchild thread returns. ++ CHECK_EQ(child.GetBreakCount(), 2); ++ } ++ } ++ ++ int GetBreakCount() { return break_count_; } ++ ++ private: ++ v8::Isolate* isolate_; ++ v8::internal::Debug* debug_; ++ const int spawn_count_; ++ int break_count_; ++}; ++ ++TEST(DebugArchiveRestore) { ++ v8::Isolate::CreateParams create_params; ++ create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); ++ v8::Isolate* isolate = v8::Isolate::New(create_params); ++ ++ ArchiveRestoreThread thread(isolate, 5); ++ // Instead of calling thread.Start() and thread.Join() here, we call ++ // thread.Run() directly, to make sure we exercise archive/restore ++ // logic on the *current* thread as well as other threads. ++ thread.Run(); ++ CHECK_EQ(thread.GetBreakCount(), 2); ++ ++ isolate->Dispose(); ++} ++ + class DebugEventExpectNoException : public v8::debug::DebugDelegate { + public: + void ExceptionThrown(v8::Local paused_context, +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_ba752ea_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_ba752ea_from_upstream_v8.patch new file mode 100644 index 0000000000..b4ab6c042e --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_ba752ea_from_upstream_v8.patch @@ -0,0 +1,711 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= +Date: Tue, 4 Sep 2018 21:22:51 +0200 +Subject: deps: cherry-pick ba752ea from upstream V8 + +Original commit message: + + [cpu-profiler] Use instruction start as the key for the CodeMap + + Previously we used the start address of the AbstractCode object. This + doesn't make sense for off-heap builtins, where the code isn't contained + in the object itself. It also hides other potential problems - sometimes + the sample.pc is inside the AbstractCode object header - this is + never valid. + + There were a few changes necessary to make this happen: + - Change the interface of CodeMoveEvent. Now 'to' and 'from' are both + AbstractCode objects, which is nice because many users were taking + 'to' and adding the header offset to it to try and find the + instruction start address. This isn't valid for off-heap builtins. + - Fix a bug in CodeMap::MoveCode where we didn't update the CodeEntry + object to reflect the new instruction_start. + - Rename the 'start' field in all of the CodeEventRecord sub-classes + to make it clear that this is the address of the first instruction. + - Fix the confusion in RecordTickSample between 'tos' and 'pc' which + caused pc_offset to be calculated incorrectly. + + Bug: v8:7983 + Change-Id: I3e9dddf74e4b2e96a5f031d216ef7008d6f184d1 + Reviewed-on: https://chromium-review.googlesource.com/1148457 + Commit-Queue: Peter Marshall + Reviewed-by: Jakob Gruber + Reviewed-by: Michael Lippautz + Cr-Commit-Position: refs/heads/master@{#54749} + +Refs: https://github.com/v8/v8/commit/ba752ea4c50713dff1e94f45a79db3ba968a8d66 + +PR-URL: https://github.com/nodejs/node/pull/21983 +Reviewed-By: Refael Ackermann +Reviewed-By: Gus Caplan +Reviewed-By: Ujjwal Sharma +Reviewed-By: Matteo Collina + +diff --git a/src/code-events.h b/src/code-events.h +index 09cd5a62e00beb4320e3e9cb05e07f019f26ab37..ec07a2e107917bce4a3ea3d1f9973ef54f28a2f0 100644 +--- a/src/code-events.h ++++ b/src/code-events.h +@@ -83,7 +83,7 @@ class CodeEventListener { + virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; + virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; + virtual void RegExpCodeCreateEvent(AbstractCode* code, String* source) = 0; +- virtual void CodeMoveEvent(AbstractCode* from, Address to) = 0; ++ virtual void CodeMoveEvent(AbstractCode* from, AbstractCode* to) = 0; + virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; + virtual void CodeMovingGCEvent() = 0; + virtual void CodeDisableOptEvent(AbstractCode* code, +@@ -154,7 +154,7 @@ class CodeEventDispatcher { + void RegExpCodeCreateEvent(AbstractCode* code, String* source) { + CODE_EVENT_DISPATCH(RegExpCodeCreateEvent(code, source)); + } +- void CodeMoveEvent(AbstractCode* from, Address to) { ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) { + CODE_EVENT_DISPATCH(CodeMoveEvent(from, to)); + } + void SharedFunctionInfoMoveEvent(Address from, Address to) { +diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc +index 48ae74bc5d472a7136ee660af6f100f1f6858bad..2170568e261cbc927bbf217fb67c65dd9e9f191c 100644 +--- a/src/heap/mark-compact.cc ++++ b/src/heap/mark-compact.cc +@@ -1149,7 +1149,7 @@ class ProfilingMigrationObserver final : public MigrationObserver { + int size) final { + if (dest == CODE_SPACE || (dest == OLD_SPACE && dst->IsBytecodeArray())) { + PROFILE(heap_->isolate(), +- CodeMoveEvent(AbstractCode::cast(src), dst->address())); ++ CodeMoveEvent(AbstractCode::cast(src), AbstractCode::cast(dst))); + } + heap_->OnMoveEvent(dst, src, size); + } +diff --git a/src/log.cc b/src/log.cc +index 77d68ef94eb6d5f41e881d434e815a28c121410c..f19897b27b14e3cd96e4b8e91d729981cd09113d 100644 +--- a/src/log.cc ++++ b/src/log.cc +@@ -270,7 +270,7 @@ class PerfBasicLogger : public CodeEventLogger { + explicit PerfBasicLogger(Isolate* isolate); + ~PerfBasicLogger() override; + +- void CodeMoveEvent(AbstractCode* from, Address to) override {} ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override {} + void CodeDisableOptEvent(AbstractCode* code, + SharedFunctionInfo* shared) override {} + +@@ -496,7 +496,7 @@ class LowLevelLogger : public CodeEventLogger { + LowLevelLogger(Isolate* isolate, const char* file_name); + ~LowLevelLogger() override; + +- void CodeMoveEvent(AbstractCode* from, Address to) override; ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; + void CodeDisableOptEvent(AbstractCode* code, + SharedFunctionInfo* shared) override {} + void SnapshotPositionEvent(HeapObject* obj, int pos); +@@ -615,11 +615,10 @@ void LowLevelLogger::LogRecordedBuffer(const wasm::WasmCode* code, + code->instructions().length()); + } + +-void LowLevelLogger::CodeMoveEvent(AbstractCode* from, Address to) { ++void LowLevelLogger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { + CodeMoveStruct event; + event.from_address = from->InstructionStart(); +- size_t header_size = from->InstructionStart() - from->address(); +- event.to_address = to + header_size; ++ event.to_address = to->InstructionStart(); + LogWriteStruct(event); + } + +@@ -641,7 +640,7 @@ class JitLogger : public CodeEventLogger { + public: + JitLogger(Isolate* isolate, JitCodeEventHandler code_event_handler); + +- void CodeMoveEvent(AbstractCode* from, Address to) override; ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; + void CodeDisableOptEvent(AbstractCode* code, + SharedFunctionInfo* shared) override {} + void AddCodeLinePosInfoEvent(void* jit_handler_data, int pc_offset, +@@ -700,7 +699,7 @@ void JitLogger::LogRecordedBuffer(const wasm::WasmCode* code, const char* name, + code_event_handler_(&event); + } + +-void JitLogger::CodeMoveEvent(AbstractCode* from, Address to) { ++void JitLogger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { + base::LockGuard guard(&logger_mutex_); + + JitCodeEvent event; +@@ -709,12 +708,7 @@ void JitLogger::CodeMoveEvent(AbstractCode* from, Address to) { + from->IsCode() ? JitCodeEvent::JIT_CODE : JitCodeEvent::BYTE_CODE; + event.code_start = reinterpret_cast(from->InstructionStart()); + event.code_len = from->InstructionSize(); +- +- // Calculate the header size. +- const size_t header_size = from->InstructionStart() - from->address(); +- +- // Calculate the new start address of the instructions. +- event.new_code_start = reinterpret_cast(to + header_size); ++ event.new_code_start = reinterpret_cast(to->InstructionStart()); + event.isolate = reinterpret_cast(isolate_); + + code_event_handler_(&event); +@@ -1431,9 +1425,10 @@ void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { + msg.WriteToLogFile(); + } + +-void Logger::CodeMoveEvent(AbstractCode* from, Address to) { ++void Logger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { + if (!is_listening_to_code_events()) return; +- MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), to); ++ MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), ++ to->address()); + } + + namespace { +diff --git a/src/log.h b/src/log.h +index 485de0f4d17db71cbbe4170dff0155c4eac0105a..3bc54a5926d35cca6b1544c4f7fce52ae96bca95 100644 +--- a/src/log.h ++++ b/src/log.h +@@ -222,7 +222,7 @@ class Logger : public CodeEventListener { + // Emits a code create event for a RegExp. + void RegExpCodeCreateEvent(AbstractCode* code, String* source); + // Emits a code move event. +- void CodeMoveEvent(AbstractCode* from, Address to); ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to); + // Emits a code line info record event. + void CodeLinePosInfoRecordEvent(Address code_start, + ByteArray* source_position_table); +@@ -486,7 +486,7 @@ class ExternalCodeEventListener : public CodeEventListener { + void GetterCallbackEvent(Name* name, Address entry_point) override {} + void SetterCallbackEvent(Name* name, Address entry_point) override {} + void SharedFunctionInfoMoveEvent(Address from, Address to) override {} +- void CodeMoveEvent(AbstractCode* from, Address to) override {} ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override {} + void CodeDisableOptEvent(AbstractCode* code, + SharedFunctionInfo* shared) override {} + void CodeMovingGCEvent() override {} +diff --git a/src/perf-jit.cc b/src/perf-jit.cc +index 3aaa36bc12f4ecdbeeab97f4f73adb482ef14211..f6b2cf401a719fd1696f1ac327bcf04b0800092a 100644 +--- a/src/perf-jit.cc ++++ b/src/perf-jit.cc +@@ -420,7 +420,7 @@ void PerfJitLogger::LogWriteUnwindingInfo(Code* code) { + LogWriteBytes(padding_bytes, static_cast(padding_size)); + } + +-void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) { ++void PerfJitLogger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { + // We may receive a CodeMove event if a BytecodeArray object moves. Otherwise + // code relocation is not supported. + CHECK(from->IsBytecodeArray()); +diff --git a/src/perf-jit.h b/src/perf-jit.h +index d08f4b91ab26ef10a55043c84f4694bd1466496a..3b11cf30c23a7027f356c4ab299f88a5efb8dcc9 100644 +--- a/src/perf-jit.h ++++ b/src/perf-jit.h +@@ -41,7 +41,7 @@ class PerfJitLogger : public CodeEventLogger { + explicit PerfJitLogger(Isolate* isolate); + virtual ~PerfJitLogger(); + +- void CodeMoveEvent(AbstractCode* from, Address to) override; ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; + void CodeDisableOptEvent(AbstractCode* code, + SharedFunctionInfo* shared) override {} + +@@ -120,7 +120,7 @@ class PerfJitLogger : public CodeEventLogger { + public: + explicit PerfJitLogger(Isolate* isolate) : CodeEventLogger(isolate) {} + +- void CodeMoveEvent(AbstractCode* from, Address to) override { ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override { + UNIMPLEMENTED(); + } + +diff --git a/src/profiler/cpu-profiler-inl.h b/src/profiler/cpu-profiler-inl.h +index f6eaa8f8a33e72ca28bf7431747607e0c3764b92..9274bc03c66d860bb0754bf46f4692622861ed0c 100644 +--- a/src/profiler/cpu-profiler-inl.h ++++ b/src/profiler/cpu-profiler-inl.h +@@ -16,17 +16,17 @@ namespace v8 { + namespace internal { + + void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { +- code_map->AddCode(start, entry, size); ++ code_map->AddCode(instruction_start, entry, instruction_size); + } + + + void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { +- code_map->MoveCode(from, to); ++ code_map->MoveCode(from_instruction_start, to_instruction_start); + } + + + void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) { +- CodeEntry* entry = code_map->FindEntry(start); ++ CodeEntry* entry = code_map->FindEntry(instruction_start); + if (entry != nullptr) { + entry->set_bailout_reason(bailout_reason); + } +@@ -34,7 +34,7 @@ void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) { + + + void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) { +- CodeEntry* entry = code_map->FindEntry(start); ++ CodeEntry* entry = code_map->FindEntry(instruction_start); + if (entry == nullptr) return; + std::vector frames_vector( + deopt_frames, deopt_frames + deopt_frame_count); +@@ -44,7 +44,7 @@ void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) { + + + void ReportBuiltinEventRecord::UpdateCodeMap(CodeMap* code_map) { +- CodeEntry* entry = code_map->FindEntry(start); ++ CodeEntry* entry = code_map->FindEntry(instruction_start); + if (!entry) { + // Code objects for builtins should already have been added to the map but + // some of them have been filtered out by CpuProfiler. +diff --git a/src/profiler/cpu-profiler.cc b/src/profiler/cpu-profiler.cc +index 463a30f1842c24a1545b198cb230d99199a33374..555c47f2f4e418b2511c6352b2ef639bee1305f6 100644 +--- a/src/profiler/cpu-profiler.cc ++++ b/src/profiler/cpu-profiler.cc +@@ -426,7 +426,7 @@ void CpuProfiler::LogBuiltins() { + CodeEventsContainer evt_rec(CodeEventRecord::REPORT_BUILTIN); + ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; + Builtins::Name id = static_cast(i); +- rec->start = builtins->builtin(id)->address(); ++ rec->instruction_start = builtins->builtin(id)->InstructionStart(); + rec->builtin_id = id; + processor_->Enqueue(evt_rec); + } +diff --git a/src/profiler/cpu-profiler.h b/src/profiler/cpu-profiler.h +index febc15480215b7406a4453b74e0106d9885ee537..78bb3b4a25f4807dbefe22c7a226969b476a21ba 100644 +--- a/src/profiler/cpu-profiler.h ++++ b/src/profiler/cpu-profiler.h +@@ -53,9 +53,9 @@ class CodeEventRecord { + + class CodeCreateEventRecord : public CodeEventRecord { + public: +- Address start; ++ Address instruction_start; + CodeEntry* entry; +- unsigned size; ++ unsigned instruction_size; + + V8_INLINE void UpdateCodeMap(CodeMap* code_map); + }; +@@ -63,8 +63,8 @@ class CodeCreateEventRecord : public CodeEventRecord { + + class CodeMoveEventRecord : public CodeEventRecord { + public: +- Address from; +- Address to; ++ Address from_instruction_start; ++ Address to_instruction_start; + + V8_INLINE void UpdateCodeMap(CodeMap* code_map); + }; +@@ -72,7 +72,7 @@ class CodeMoveEventRecord : public CodeEventRecord { + + class CodeDisableOptEventRecord : public CodeEventRecord { + public: +- Address start; ++ Address instruction_start; + const char* bailout_reason; + + V8_INLINE void UpdateCodeMap(CodeMap* code_map); +@@ -81,7 +81,7 @@ class CodeDisableOptEventRecord : public CodeEventRecord { + + class CodeDeoptEventRecord : public CodeEventRecord { + public: +- Address start; ++ Address instruction_start; + const char* deopt_reason; + int deopt_id; + Address pc; +@@ -95,7 +95,7 @@ class CodeDeoptEventRecord : public CodeEventRecord { + + class ReportBuiltinEventRecord : public CodeEventRecord { + public: +- Address start; ++ Address instruction_start; + Builtins::Name builtin_id; + + V8_INLINE void UpdateCodeMap(CodeMap* code_map); +diff --git a/src/profiler/profile-generator.cc b/src/profiler/profile-generator.cc +index 92619f2fbf3cf52c75b812cb97d4ed4e270fd983..845fe97b6473f2b7d3009964e01f81ff042780e0 100644 +--- a/src/profiler/profile-generator.cc ++++ b/src/profiler/profile-generator.cc +@@ -529,6 +529,8 @@ void CodeMap::AddCode(Address addr, CodeEntry* entry, unsigned size) { + ClearCodesInRange(addr, addr + size); + unsigned index = AddCodeEntry(addr, entry); + code_map_.emplace(addr, CodeEntryMapInfo{index, size}); ++ DCHECK(entry->instruction_start() == kNullAddress || ++ addr == entry->instruction_start()); + } + + void CodeMap::ClearCodesInRange(Address start, Address end) { +@@ -550,8 +552,14 @@ CodeEntry* CodeMap::FindEntry(Address addr) { + auto it = code_map_.upper_bound(addr); + if (it == code_map_.begin()) return nullptr; + --it; +- Address end_address = it->first + it->second.size; +- return addr < end_address ? entry(it->second.index) : nullptr; ++ Address start_address = it->first; ++ Address end_address = start_address + it->second.size; ++ CodeEntry* ret = addr < end_address ? entry(it->second.index) : nullptr; ++ if (ret && ret->instruction_start() != kNullAddress) { ++ DCHECK_EQ(start_address, ret->instruction_start()); ++ DCHECK(addr >= start_address && addr < end_address); ++ } ++ return ret; + } + + void CodeMap::MoveCode(Address from, Address to) { +@@ -563,6 +571,9 @@ void CodeMap::MoveCode(Address from, Address to) { + DCHECK(from + info.size <= to || to + info.size <= from); + ClearCodesInRange(to, to + info.size); + code_map_.emplace(to, info); ++ ++ CodeEntry* entry = code_entries_[info.index].entry; ++ entry->set_instruction_start(to); + } + + unsigned CodeMap::AddCodeEntry(Address start, CodeEntry* entry) { +@@ -693,26 +704,29 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) { + if (sample.pc != nullptr) { + if (sample.has_external_callback && sample.state == EXTERNAL) { + // Don't use PC when in external callback code, as it can point +- // inside callback's code, and we will erroneously report ++ // inside a callback's code, and we will erroneously report + // that a callback calls itself. + stack_trace.push_back( + {FindEntry(reinterpret_cast
(sample.external_callback_entry)), + no_line_info}); + } else { +- CodeEntry* pc_entry = FindEntry(reinterpret_cast
(sample.pc)); +- // If there is no pc_entry we're likely in native code. +- // Find out, if top of stack was pointing inside a JS function +- // meaning that we have encountered a frameless invocation. ++ Address attributed_pc = reinterpret_cast
(sample.pc); ++ CodeEntry* pc_entry = FindEntry(attributed_pc); ++ // If there is no pc_entry, we're likely in native code. Find out if the ++ // top of the stack (the return address) was pointing inside a JS ++ // function, meaning that we have encountered a frameless invocation. + if (!pc_entry && !sample.has_external_callback) { +- pc_entry = FindEntry(reinterpret_cast
(sample.tos)); ++ attributed_pc = reinterpret_cast
(sample.tos); ++ pc_entry = FindEntry(attributed_pc); + } + // If pc is in the function code before it set up stack frame or after the +- // frame was destroyed SafeStackFrameIterator incorrectly thinks that +- // ebp contains return address of the current function and skips caller's +- // frame. Check for this case and just skip such samples. ++ // frame was destroyed, SafeStackFrameIterator incorrectly thinks that ++ // ebp contains the return address of the current function and skips the ++ // caller's frame. Check for this case and just skip such samples. + if (pc_entry) { +- int pc_offset = static_cast(reinterpret_cast
(sample.pc) - +- pc_entry->instruction_start()); ++ int pc_offset = ++ static_cast(attributed_pc - pc_entry->instruction_start()); ++ DCHECK_GE(pc_offset, 0); + src_line = pc_entry->GetSourceLine(pc_offset); + if (src_line == v8::CpuProfileNode::kNoLineNumberInfo) { + src_line = pc_entry->line_number(); +@@ -744,6 +758,7 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) { + // Find out if the entry has an inlining stack associated. + int pc_offset = + static_cast(stack_pos - entry->instruction_start()); ++ DCHECK_GE(pc_offset, 0); + const std::vector>* inline_stack = + entry->GetInlineStack(pc_offset); + if (inline_stack) { +diff --git a/src/profiler/profile-generator.h b/src/profiler/profile-generator.h +index 3e301a40829ea1acbbd8283bed0d3e43dee679e9..8eef05bcdb382600e987608bdcb9270e3307e998 100644 +--- a/src/profiler/profile-generator.h ++++ b/src/profiler/profile-generator.h +@@ -108,7 +108,9 @@ class CodeEntry { + const std::vector>* GetInlineStack( + int pc_offset) const; + ++ void set_instruction_start(Address start) { instruction_start_ = start; } + Address instruction_start() const { return instruction_start_; } ++ + CodeEventListener::LogEventsAndTags tag() const { + return TagField::decode(bit_field_); + } +diff --git a/src/profiler/profiler-listener.cc b/src/profiler/profiler-listener.cc +index 9c29da9ec7972ac9a5fb2a6be8065fe30d7dddd1..f90a2e11d3f3a247fdec39abbb1a04e4d86204e5 100644 +--- a/src/profiler/profiler-listener.cc ++++ b/src/profiler/profiler-listener.cc +@@ -24,9 +24,9 @@ ProfilerListener::~ProfilerListener() = default; + void ProfilerListener::CallbackEvent(Name* name, Address entry_point) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = entry_point; ++ rec->instruction_start = entry_point; + rec->entry = NewCodeEntry(CodeEventListener::CALLBACK_TAG, GetName(name)); +- rec->size = 1; ++ rec->instruction_size = 1; + DispatchCodeEvent(evt_rec); + } + +@@ -34,13 +34,13 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, + AbstractCode* code, const char* name) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = code->address(); ++ rec->instruction_start = code->InstructionStart(); + rec->entry = NewCodeEntry(tag, GetName(name), CodeEntry::kEmptyResourceName, + CpuProfileNode::kNoLineNumberInfo, + CpuProfileNode::kNoColumnNumberInfo, nullptr, + code->InstructionStart()); + RecordInliningInfo(rec->entry, code); +- rec->size = code->ExecutableSize(); ++ rec->instruction_size = code->InstructionSize(); + DispatchCodeEvent(evt_rec); + } + +@@ -48,13 +48,13 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, + AbstractCode* code, Name* name) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = code->address(); ++ rec->instruction_start = code->InstructionStart(); + rec->entry = NewCodeEntry(tag, GetName(name), CodeEntry::kEmptyResourceName, + CpuProfileNode::kNoLineNumberInfo, + CpuProfileNode::kNoColumnNumberInfo, nullptr, + code->InstructionStart()); + RecordInliningInfo(rec->entry, code); +- rec->size = code->ExecutableSize(); ++ rec->instruction_size = code->InstructionSize(); + DispatchCodeEvent(evt_rec); + } + +@@ -64,7 +64,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, + Name* script_name) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = code->address(); ++ rec->instruction_start = code->InstructionStart(); + rec->entry = NewCodeEntry(tag, GetName(shared->DebugName()), + GetName(InferScriptName(script_name, shared)), + CpuProfileNode::kNoLineNumberInfo, +@@ -72,7 +72,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, + code->InstructionStart()); + RecordInliningInfo(rec->entry, code); + rec->entry->FillFunctionInfo(shared); +- rec->size = code->ExecutableSize(); ++ rec->instruction_size = code->InstructionSize(); + DispatchCodeEvent(evt_rec); + } + +@@ -83,7 +83,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, + int column) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = abstract_code->address(); ++ rec->instruction_start = abstract_code->InstructionStart(); + std::unique_ptr line_table; + if (shared->script()->IsScript()) { + Script* script = Script::cast(shared->script()); +@@ -105,7 +105,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, + std::move(line_table), abstract_code->InstructionStart()); + RecordInliningInfo(rec->entry, abstract_code); + rec->entry->FillFunctionInfo(shared); +- rec->size = abstract_code->ExecutableSize(); ++ rec->instruction_size = abstract_code->InstructionSize(); + DispatchCodeEvent(evt_rec); + } + +@@ -114,20 +114,20 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, + wasm::WasmName name) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = code->instruction_start(); ++ rec->instruction_start = code->instruction_start(); + rec->entry = NewCodeEntry( + tag, GetName(name.start()), CodeEntry::kWasmResourceNamePrefix, + CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo, + nullptr, code->instruction_start()); +- rec->size = code->instructions().length(); ++ rec->instruction_size = code->instructions().length(); + DispatchCodeEvent(evt_rec); + } + +-void ProfilerListener::CodeMoveEvent(AbstractCode* from, Address to) { ++void ProfilerListener::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_MOVE); + CodeMoveEventRecord* rec = &evt_rec.CodeMoveEventRecord_; +- rec->from = from->address(); +- rec->to = to; ++ rec->from_instruction_start = from->InstructionStart(); ++ rec->to_instruction_start = to->InstructionStart(); + DispatchCodeEvent(evt_rec); + } + +@@ -135,7 +135,7 @@ void ProfilerListener::CodeDisableOptEvent(AbstractCode* code, + SharedFunctionInfo* shared) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT); + CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_; +- rec->start = code->address(); ++ rec->instruction_start = code->InstructionStart(); + rec->bailout_reason = GetBailoutReason(shared->disable_optimization_reason()); + DispatchCodeEvent(evt_rec); + } +@@ -145,7 +145,7 @@ void ProfilerListener::CodeDeoptEvent(Code* code, DeoptimizeKind kind, + CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT); + CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_; + Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc); +- rec->start = code->address(); ++ rec->instruction_start = code->InstructionStart(); + rec->deopt_reason = DeoptimizeReasonToString(info.deopt_reason); + rec->deopt_id = info.deopt_id; + rec->pc = pc; +@@ -160,10 +160,10 @@ void ProfilerListener::CodeDeoptEvent(Code* code, DeoptimizeKind kind, + void ProfilerListener::GetterCallbackEvent(Name* name, Address entry_point) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = entry_point; ++ rec->instruction_start = entry_point; + rec->entry = + NewCodeEntry(CodeEventListener::CALLBACK_TAG, GetConsName("get ", name)); +- rec->size = 1; ++ rec->instruction_size = 1; + DispatchCodeEvent(evt_rec); + } + +@@ -171,23 +171,22 @@ void ProfilerListener::RegExpCodeCreateEvent(AbstractCode* code, + String* source) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = code->address(); ++ rec->instruction_start = code->InstructionStart(); + rec->entry = NewCodeEntry( + CodeEventListener::REG_EXP_TAG, GetConsName("RegExp: ", source), + CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, +- CpuProfileNode::kNoColumnNumberInfo, nullptr, +- code->raw_instruction_start()); +- rec->size = code->ExecutableSize(); ++ CpuProfileNode::kNoColumnNumberInfo, nullptr, code->InstructionStart()); ++ rec->instruction_size = code->InstructionSize(); + DispatchCodeEvent(evt_rec); + } + + void ProfilerListener::SetterCallbackEvent(Name* name, Address entry_point) { + CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); + CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; +- rec->start = entry_point; ++ rec->instruction_start = entry_point; + rec->entry = + NewCodeEntry(CodeEventListener::CALLBACK_TAG, GetConsName("set ", name)); +- rec->size = 1; ++ rec->instruction_size = 1; + DispatchCodeEvent(evt_rec); + } + +diff --git a/src/profiler/profiler-listener.h b/src/profiler/profiler-listener.h +index 5cff7cc11d1e91ed773f8e1633b4f4363ba1246b..51fba18a60960f8a65115516401952b46ebb5d71 100644 +--- a/src/profiler/profiler-listener.h ++++ b/src/profiler/profiler-listener.h +@@ -44,7 +44,7 @@ class ProfilerListener : public CodeEventListener { + wasm::WasmName name) override; + + void CodeMovingGCEvent() override {} +- void CodeMoveEvent(AbstractCode* from, Address to) override; ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; + void CodeDisableOptEvent(AbstractCode* code, + SharedFunctionInfo* shared) override; + void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc, +diff --git a/src/snapshot/serializer.h b/src/snapshot/serializer.h +index 6a5d1a4aacae64930066405855e079c4d98dacb0..658d37f286c5a103738ebfe22c84d68ea6c7b222 100644 +--- a/src/snapshot/serializer.h ++++ b/src/snapshot/serializer.h +@@ -28,8 +28,8 @@ class CodeAddressMap : public CodeEventLogger { + isolate_->logger()->RemoveCodeEventListener(this); + } + +- void CodeMoveEvent(AbstractCode* from, Address to) override { +- address_to_name_map_.Move(from->address(), to); ++ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override { ++ address_to_name_map_.Move(from->address(), to->address()); + } + + void CodeDisableOptEvent(AbstractCode* code, +diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc +index 4e7a70c76f28b1404f03ffb5ad771227425ac43e..f74bdf1ede87f53b4f396bb85f0a792895f8a40a 100644 +--- a/test/cctest/test-cpu-profiler.cc ++++ b/test/cctest/test-cpu-profiler.cc +@@ -176,27 +176,29 @@ TEST(CodeEvents) { + "comment"); + profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, + "comment2"); +- profiler_listener.CodeMoveEvent(comment2_code, moved_code->address()); ++ profiler_listener.CodeMoveEvent(comment2_code, moved_code); + + // Enqueue a tick event to enable code events processing. +- EnqueueTickSampleEvent(processor, aaa_code->address()); ++ EnqueueTickSampleEvent(processor, aaa_code->InstructionStart()); + + isolate->logger()->RemoveCodeEventListener(&profiler_listener); + processor->StopSynchronously(); + + // Check the state of profile generator. +- CodeEntry* aaa = generator->code_map()->FindEntry(aaa_code->address()); ++ CodeEntry* aaa = ++ generator->code_map()->FindEntry(aaa_code->InstructionStart()); + CHECK(aaa); + CHECK_EQ(0, strcmp(aaa_str, aaa->name())); + + CodeEntry* comment = +- generator->code_map()->FindEntry(comment_code->address()); ++ generator->code_map()->FindEntry(comment_code->InstructionStart()); + CHECK(comment); + CHECK_EQ(0, strcmp("comment", comment->name())); + +- CHECK(!generator->code_map()->FindEntry(comment2_code->address())); ++ CHECK(!generator->code_map()->FindEntry(comment2_code->InstructionStart())); + +- CodeEntry* comment2 = generator->code_map()->FindEntry(moved_code->address()); ++ CodeEntry* comment2 = ++ generator->code_map()->FindEntry(moved_code->InstructionStart()); + CHECK(comment2); + CHECK_EQ(0, strcmp("comment2", comment2->name())); + } +@@ -298,11 +300,11 @@ TEST(Issue1398) { + profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); + + v8::TickSample* sample = processor->StartTickSample(); +- sample->pc = reinterpret_cast(code->address()); ++ sample->pc = reinterpret_cast(code->InstructionStart()); + sample->tos = nullptr; + sample->frames_count = v8::TickSample::kMaxFramesCount; + for (unsigned i = 0; i < sample->frames_count; ++i) { +- sample->stack[i] = reinterpret_cast(code->address()); ++ sample->stack[i] = reinterpret_cast(code->InstructionStart()); + } + processor->FinishTickSample(); + +diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc +index 0b13a7e6607cc45ab824725cff38a963b10feca8..1dfa22b4cc6f53972b18f14346a9703fe48bf8a0 100644 +--- a/test/cctest/test-log.cc ++++ b/test/cctest/test-log.cc +@@ -751,7 +751,7 @@ TEST(Issue539892) { + explicit FakeCodeEventLogger(i::Isolate* isolate) + : CodeEventLogger(isolate) {} + +- void CodeMoveEvent(i::AbstractCode* from, Address to) override {} ++ void CodeMoveEvent(i::AbstractCode* from, i::AbstractCode* to) override {} + void CodeDisableOptEvent(i::AbstractCode* code, + i::SharedFunctionInfo* shared) override {} + +diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc +index 9b2d7e3ab2fe9dcc273c0946589a4714768bb86d..b53bf148e615e45581a653438af77d9d3af93909 100644 +--- a/test/cctest/test-profile-generator.cc ++++ b/test/cctest/test-profile-generator.cc +@@ -676,7 +676,8 @@ int GetFunctionLineNumber(CpuProfiler& profiler, LocalContext& env, + i::Handle func = i::Handle::cast( + v8::Utils::OpenHandle(*v8::Local::Cast( + env->Global()->Get(env.local(), v8_str(name)).ToLocalChecked()))); +- CodeEntry* func_entry = code_map->FindEntry(func->abstract_code()->address()); ++ CodeEntry* func_entry = ++ code_map->FindEntry(func->abstract_code()->InstructionStart()); + if (!func_entry) FATAL("%s", name); + return func_entry->line_number(); + } +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_bf5ea81_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_bf5ea81_from_upstream_v8.patch new file mode 100644 index 0000000000..9d3f9bc95e --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_bf5ea81_from_upstream_v8.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= +Date: Tue, 4 Sep 2018 21:24:03 +0200 +Subject: deps: cherry-pick bf5ea81 from upstream V8 + +Original commit message: + + [tracing] allow dynamic control of tracing + + If the trace_buffer_ was null, we were returning a pointer to a static + flag back that permanently disabled that particular trace point. + + This implied an assumption that tracing will be statically enabled at + process startup, and once it is disabled, it will never be enabled + again. On Node.js side we want to dynamically enable/disable tracing as per + programmer intent. + + Change-Id: Ic7a7839b8450ab5c356d85e8e0826f42824907f4 + Reviewed-on: https://chromium-review.googlesource.com/1161518 + Reviewed-by: Yang Guo + Commit-Queue: Ali Ijaz Sheikh + Cr-Commit-Position: refs/heads/master@{#54903} + +Refs: https://github.com/v8/v8/commit/bf5ea8138c0726613c9d722a3ccb552a8f477992 + +PR-URL: https://github.com/nodejs/node/pull/21983 +Reviewed-By: Refael Ackermann +Reviewed-By: Gus Caplan +Reviewed-By: Ujjwal Sharma +Reviewed-By: Matteo Collina + +diff --git a/src/libplatform/tracing/tracing-controller.cc b/src/libplatform/tracing/tracing-controller.cc +index 647306d62790af5f977c3a74ec272f446f3acabf..b4aa7baf724d4f29b4df08f3b57fdc018f6a32a7 100644 +--- a/src/libplatform/tracing/tracing-controller.cc ++++ b/src/libplatform/tracing/tracing-controller.cc +@@ -24,18 +24,17 @@ namespace tracing { + // convert internally to determine the category name from the char enabled + // pointer. + const char* g_category_groups[MAX_CATEGORY_GROUPS] = { +- "toplevel", "tracing already shutdown", ++ "toplevel", + "tracing categories exhausted; must increase MAX_CATEGORY_GROUPS", + "__metadata"}; + + // The enabled flag is char instead of bool so that the API can be used from C. + unsigned char g_category_group_enabled[MAX_CATEGORY_GROUPS] = {0}; + // Indexes here have to match the g_category_groups array indexes above. +-const int g_category_already_shutdown = 1; +-const int g_category_categories_exhausted = 2; ++const int g_category_categories_exhausted = 1; + // Metadata category not used in V8. +-// const int g_category_metadata = 3; +-const int g_num_builtin_categories = 4; ++// const int g_category_metadata = 2; ++const int g_num_builtin_categories = 3; + + // Skip default categories. + v8::base::AtomicWord g_category_index = g_num_builtin_categories; +@@ -103,10 +102,6 @@ void TracingController::UpdateTraceEventDuration( + + const uint8_t* TracingController::GetCategoryGroupEnabled( + const char* category_group) { +- if (!trace_buffer_) { +- DCHECK(!g_category_group_enabled[g_category_already_shutdown]); +- return &g_category_group_enabled[g_category_already_shutdown]; +- } + return GetCategoryGroupEnabledInternal(category_group); + } + +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_c608122_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_c608122_from_upstream_v8.patch new file mode 100644 index 0000000000..77989669e4 --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_c608122_from_upstream_v8.patch @@ -0,0 +1,308 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= +Date: Sun, 19 Aug 2018 21:53:40 +0200 +Subject: deps: cherry-pick c608122 from upstream V8 + +Original commit message: + + [api][keys] Allow skipping indices for Proxies with GetPropertyNames + + Bug: v8:7942 + Change-Id: I7b3740b04cbcaa56dc809150900ab8d821b054ce + Reviewed-on: https://chromium-review.googlesource.com/1156544 + Reviewed-by: Toon Verwaest + Commit-Queue: Camillo Bruni + Cr-Commit-Position: refs/heads/master@{#54821} + +Refs: https://github.com/v8/v8/commit/c608122b85238397a43910246f5ff218eb43fb24 + +PR-URL: https://github.com/nodejs/node/pull/21983 +Reviewed-By: Refael Ackermann +Reviewed-By: Gus Caplan +Reviewed-By: Ujjwal Sharma +Reviewed-By: Matteo Collina + +diff --git a/src/keys.cc b/src/keys.cc +index 8ecbe0a1d7b2ad09a12b5c826db4f24efa222bcb..689f4ac3dfeb8d3980946884c57237778724e132 100644 +--- a/src/keys.cc ++++ b/src/keys.cc +@@ -38,10 +38,10 @@ static bool ContainsOnlyValidKeys(Handle array) { + // static + MaybeHandle KeyAccumulator::GetKeys( + Handle object, KeyCollectionMode mode, PropertyFilter filter, +- GetKeysConversion keys_conversion, bool is_for_in) { ++ GetKeysConversion keys_conversion, bool is_for_in, bool skip_indices) { + Isolate* isolate = object->GetIsolate(); +- FastKeyAccumulator accumulator(isolate, object, mode, filter); +- accumulator.set_is_for_in(is_for_in); ++ FastKeyAccumulator accumulator(isolate, object, mode, filter, is_for_in, ++ skip_indices); + return accumulator.GetKeys(keys_conversion); + } + +@@ -355,7 +355,8 @@ Handle GetFastEnumPropertyKeys(Isolate* isolate, + template + MaybeHandle GetOwnKeysWithElements(Isolate* isolate, + Handle object, +- GetKeysConversion convert) { ++ GetKeysConversion convert, ++ bool skip_indices) { + Handle keys; + ElementsAccessor* accessor = object->GetElementsAccessor(); + if (fast_properties) { +@@ -364,8 +365,14 @@ MaybeHandle GetOwnKeysWithElements(Isolate* isolate, + // TODO(cbruni): preallocate big enough array to also hold elements. + keys = KeyAccumulator::GetOwnEnumPropertyKeys(isolate, object); + } +- MaybeHandle result = +- accessor->PrependElementIndices(object, keys, convert, ONLY_ENUMERABLE); ++ ++ MaybeHandle result; ++ if (skip_indices) { ++ result = keys; ++ } else { ++ result = ++ accessor->PrependElementIndices(object, keys, convert, ONLY_ENUMERABLE); ++ } + + if (FLAG_trace_for_in_enumerate) { + PrintF("| strings=%d symbols=0 elements=%u || prototypes>=1 ||\n", +@@ -403,7 +410,8 @@ MaybeHandle FastKeyAccumulator::GetKeysFast( + + // Do not try to use the enum-cache for dict-mode objects. + if (map->is_dictionary_map()) { +- return GetOwnKeysWithElements(isolate_, object, keys_conversion); ++ return GetOwnKeysWithElements(isolate_, object, keys_conversion, ++ skip_indices_); + } + int enum_length = receiver_->map()->EnumLength(); + if (enum_length == kInvalidEnumCacheSentinel) { +@@ -421,7 +429,8 @@ MaybeHandle FastKeyAccumulator::GetKeysFast( + } + // The properties-only case failed because there were probably elements on the + // receiver. +- return GetOwnKeysWithElements(isolate_, object, keys_conversion); ++ return GetOwnKeysWithElements(isolate_, object, keys_conversion, ++ skip_indices_); + } + + MaybeHandle +@@ -450,6 +459,7 @@ MaybeHandle FastKeyAccumulator::GetKeysSlow( + GetKeysConversion keys_conversion) { + KeyAccumulator accumulator(isolate_, mode_, filter_); + accumulator.set_is_for_in(is_for_in_); ++ accumulator.set_skip_indices(skip_indices_); + accumulator.set_last_non_empty_prototype(last_non_empty_prototype_); + + MAYBE_RETURN(accumulator.CollectKeys(receiver_, receiver_), +@@ -699,13 +709,15 @@ Maybe KeyAccumulator::CollectOwnPropertyNames(Handle receiver, + Maybe KeyAccumulator::CollectAccessCheckInterceptorKeys( + Handle access_check_info, Handle receiver, + Handle object) { +- MAYBE_RETURN((CollectInterceptorKeysInternal( +- receiver, object, +- handle(InterceptorInfo::cast( +- access_check_info->indexed_interceptor()), +- isolate_), +- this, kIndexed)), +- Nothing()); ++ if (!skip_indices_) { ++ MAYBE_RETURN((CollectInterceptorKeysInternal( ++ receiver, object, ++ handle(InterceptorInfo::cast( ++ access_check_info->indexed_interceptor()), ++ isolate_), ++ this, kIndexed)), ++ Nothing()); ++ } + MAYBE_RETURN( + (CollectInterceptorKeysInternal( + receiver, object, +@@ -942,9 +954,9 @@ Maybe KeyAccumulator::CollectOwnJSProxyTargetKeys( + Handle keys; + ASSIGN_RETURN_ON_EXCEPTION_VALUE( + isolate_, keys, +- KeyAccumulator::GetKeys(target, KeyCollectionMode::kOwnOnly, +- ALL_PROPERTIES, +- GetKeysConversion::kConvertToString, is_for_in_), ++ KeyAccumulator::GetKeys( ++ target, KeyCollectionMode::kOwnOnly, ALL_PROPERTIES, ++ GetKeysConversion::kConvertToString, is_for_in_, skip_indices_), + Nothing()); + Maybe result = AddKeysFromJSProxy(proxy, keys); + return result; +diff --git a/src/keys.h b/src/keys.h +index 649d6a95999fc70358f48bb18ec71687f3de8e75..5abbaac5cd0e5af2d9dca0d41d927b4b72c626ec 100644 +--- a/src/keys.h ++++ b/src/keys.h +@@ -40,7 +40,7 @@ class KeyAccumulator final BASE_EMBEDDED { + static MaybeHandle GetKeys( + Handle object, KeyCollectionMode mode, PropertyFilter filter, + GetKeysConversion keys_conversion = GetKeysConversion::kKeepNumbers, +- bool is_for_in = false); ++ bool is_for_in = false, bool skip_indices = false); + + Handle GetKeys( + GetKeysConversion convert = GetKeysConversion::kKeepNumbers); +@@ -128,14 +128,19 @@ class KeyAccumulator final BASE_EMBEDDED { + class FastKeyAccumulator { + public: + FastKeyAccumulator(Isolate* isolate, Handle receiver, +- KeyCollectionMode mode, PropertyFilter filter) +- : isolate_(isolate), receiver_(receiver), mode_(mode), filter_(filter) { ++ KeyCollectionMode mode, PropertyFilter filter, ++ bool is_for_in = false, bool skip_indices = false) ++ : isolate_(isolate), ++ receiver_(receiver), ++ mode_(mode), ++ filter_(filter), ++ is_for_in_(is_for_in), ++ skip_indices_(skip_indices) { + Prepare(); + } + + bool is_receiver_simple_enum() { return is_receiver_simple_enum_; } + bool has_empty_prototype() { return has_empty_prototype_; } +- void set_is_for_in(bool value) { is_for_in_ = value; } + + MaybeHandle GetKeys( + GetKeysConversion convert = GetKeysConversion::kKeepNumbers); +@@ -153,6 +158,7 @@ class FastKeyAccumulator { + KeyCollectionMode mode_; + PropertyFilter filter_; + bool is_for_in_ = false; ++ bool skip_indices_ = false; + bool is_receiver_simple_enum_ = false; + bool has_empty_prototype_ = false; + +diff --git a/src/runtime/runtime-forin.cc b/src/runtime/runtime-forin.cc +index 5df16faf46faca09d446a700633917fb76fc02b2..ed1e2260602f42d1dba93d0f26357a30a19bc29f 100644 +--- a/src/runtime/runtime-forin.cc ++++ b/src/runtime/runtime-forin.cc +@@ -26,8 +26,7 @@ MaybeHandle Enumerate(Isolate* isolate, + JSObject::MakePrototypesFast(receiver, kStartAtReceiver, isolate); + FastKeyAccumulator accumulator(isolate, receiver, + KeyCollectionMode::kIncludePrototypes, +- ENUMERABLE_STRINGS); +- accumulator.set_is_for_in(true); ++ ENUMERABLE_STRINGS, true); + // Test if we have an enum cache for {receiver}. + if (!accumulator.is_receiver_simple_enum()) { + Handle keys; +diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc +index d5d1ae101b38c22036fb92d4af09f53f9a556649..a018e12853199aaff9d4aa914429baa03501a830 100644 +--- a/test/cctest/test-api.cc ++++ b/test/cctest/test-api.cc +@@ -15360,14 +15360,107 @@ THREADED_TEST(PropertyEnumeration2) { + } + } + +-THREADED_TEST(PropertyNames) { ++THREADED_TEST(GetPropertyNames) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope scope(isolate); + v8::Local result = CompileRun( + "var result = {0: 0, 1: 1, a: 2, b: 3};" + "result[Symbol('symbol')] = true;" +- "result.__proto__ = {2: 4, 3: 5, c: 6, d: 7};" ++ "result.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};" ++ "result;"); ++ v8::Local object = result.As(); ++ v8::PropertyFilter default_filter = ++ static_cast(v8::ONLY_ENUMERABLE | v8::SKIP_SYMBOLS); ++ v8::PropertyFilter include_symbols_filter = v8::ONLY_ENUMERABLE; ++ ++ v8::Local properties = ++ object->GetPropertyNames(context.local()).ToLocalChecked(); ++ const char* expected_properties1[] = {"0", "1", "a", "b", "2", "3", "c", "d"}; ++ CheckStringArray(isolate, properties, 8, expected_properties1); ++ ++ properties = ++ object ++ ->GetPropertyNames(context.local(), ++ v8::KeyCollectionMode::kIncludePrototypes, ++ default_filter, v8::IndexFilter::kIncludeIndices) ++ .ToLocalChecked(); ++ CheckStringArray(isolate, properties, 8, expected_properties1); ++ ++ properties = object ++ ->GetPropertyNames(context.local(), ++ v8::KeyCollectionMode::kIncludePrototypes, ++ include_symbols_filter, ++ v8::IndexFilter::kIncludeIndices) ++ .ToLocalChecked(); ++ const char* expected_properties1_1[] = {"0", "1", "a", "b", nullptr, ++ "2", "3", "c", "d"}; ++ CheckStringArray(isolate, properties, 9, expected_properties1_1); ++ CheckIsSymbolAt(isolate, properties, 4, "symbol"); ++ ++ properties = ++ object ++ ->GetPropertyNames(context.local(), ++ v8::KeyCollectionMode::kIncludePrototypes, ++ default_filter, v8::IndexFilter::kSkipIndices) ++ .ToLocalChecked(); ++ const char* expected_properties2[] = {"a", "b", "c", "d"}; ++ CheckStringArray(isolate, properties, 4, expected_properties2); ++ ++ properties = object ++ ->GetPropertyNames(context.local(), ++ v8::KeyCollectionMode::kIncludePrototypes, ++ include_symbols_filter, ++ v8::IndexFilter::kSkipIndices) ++ .ToLocalChecked(); ++ const char* expected_properties2_1[] = {"a", "b", nullptr, "c", "d"}; ++ CheckStringArray(isolate, properties, 5, expected_properties2_1); ++ CheckIsSymbolAt(isolate, properties, 2, "symbol"); ++ ++ properties = ++ object ++ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly, ++ default_filter, v8::IndexFilter::kIncludeIndices) ++ .ToLocalChecked(); ++ const char* expected_properties3[] = {"0", "1", "a", "b"}; ++ CheckStringArray(isolate, properties, 4, expected_properties3); ++ ++ properties = object ++ ->GetPropertyNames( ++ context.local(), v8::KeyCollectionMode::kOwnOnly, ++ include_symbols_filter, v8::IndexFilter::kIncludeIndices) ++ .ToLocalChecked(); ++ const char* expected_properties3_1[] = {"0", "1", "a", "b", nullptr}; ++ CheckStringArray(isolate, properties, 5, expected_properties3_1); ++ CheckIsSymbolAt(isolate, properties, 4, "symbol"); ++ ++ properties = ++ object ++ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly, ++ default_filter, v8::IndexFilter::kSkipIndices) ++ .ToLocalChecked(); ++ const char* expected_properties4[] = {"a", "b"}; ++ CheckStringArray(isolate, properties, 2, expected_properties4); ++ ++ properties = object ++ ->GetPropertyNames( ++ context.local(), v8::KeyCollectionMode::kOwnOnly, ++ include_symbols_filter, v8::IndexFilter::kSkipIndices) ++ .ToLocalChecked(); ++ const char* expected_properties4_1[] = {"a", "b", nullptr}; ++ CheckStringArray(isolate, properties, 3, expected_properties4_1); ++ CheckIsSymbolAt(isolate, properties, 2, "symbol"); ++} ++ ++THREADED_TEST(ProxyGetPropertyNames) { ++ LocalContext context; ++ v8::Isolate* isolate = context->GetIsolate(); ++ v8::HandleScope scope(isolate); ++ v8::Local result = CompileRun( ++ "var target = {0: 0, 1: 1, a: 2, b: 3};" ++ "target[Symbol('symbol')] = true;" ++ "target.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};" ++ "var result = new Proxy(target, {});" + "result;"); + v8::Local object = result.As(); + v8::PropertyFilter default_filter = +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_dbfcc48_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_dbfcc48_from_upstream_v8.patch new file mode 100644 index 0000000000..d2624d804a --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_dbfcc48_from_upstream_v8.patch @@ -0,0 +1,757 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Kozyatinskiy +Date: Fri, 10 Aug 2018 13:09:49 -0700 +Subject: deps: cherry-pick dbfcc48 from upstream V8 + +Original commit message: +``` +[inspector] added V8InspectorClient::resourceNameToUrl + +Some clients (see Node.js) use platform path as ScriptOrigin. +Reporting platform path in protocol makes using protocol much harder. +This CL introduced V8InspectorClient::resourceNameToUrl method that +is called for any reported using protocol url. +V8Inspector uses url internally as well so protocol client may generate +pattern for blackboxing with file urls only and does not need to build +complicated regexp that covers files urls and platform paths on +different platforms. + +R=lushnikov@chromium.org +TBR=yangguo@chromium.org + +Bug: none +Change-Id: Iff302e7441df922fa5d689fe510f5a9bfd470b9b +Reviewed-on: https://chromium-review.googlesource.com/1164624 +Commit-Queue: Aleksey Kozyatinskiy +Reviewed-by: Alexei Filippov +Cr-Commit-Position: refs/heads/master@{#55029} +``` +Refs: https://github.com/v8/v8/commit/dbfcc48 +PR-URL: https://github.com/nodejs/node/pull/22251 +Reviewed-By: Eugene Ostroukhov +Reviewed-By: Tiancheng "Timothy" Gu + +diff --git a/include/v8-inspector.h b/include/v8-inspector.h +index d879a94373e427892bb6921eafff5139e05509b0..ad04d01bd212583c3ae9c3911c5dcfd0ef07cd79 100644 +--- a/include/v8-inspector.h ++++ b/include/v8-inspector.h +@@ -215,6 +215,11 @@ class V8_EXPORT V8InspectorClient { + virtual bool canExecuteScripts(int contextGroupId) { return true; } + + virtual void maxAsyncCallStackDepthChanged(int depth) {} ++ ++ virtual std::unique_ptr resourceNameToUrl( ++ const StringView& resourceName) { ++ return nullptr; ++ } + }; + + // These stack trace ids are intended to be passed between debuggers and be +diff --git a/src/inspector/v8-debugger-agent-impl.cc b/src/inspector/v8-debugger-agent-impl.cc +index e4e6492b67a0c5a2200875340dca4f3e8f3ab1b7..d9cb49b1d4d2ef354fd2478623a4046cd7c25354 100644 +--- a/src/inspector/v8-debugger-agent-impl.cc ++++ b/src/inspector/v8-debugger-agent-impl.cc +@@ -1396,7 +1396,7 @@ void V8DebuggerAgentImpl::didParseSource( + protocol::StringUtil::parseJSON(inspected->auxData())); + } + bool isLiveEdit = script->isLiveEdit(); +- bool hasSourceURL = script->hasSourceURL(); ++ bool hasSourceURLComment = script->hasSourceURLComment(); + bool isModule = script->isModule(); + String16 scriptId = script->scriptId(); + String16 scriptURL = script->sourceURL(); +@@ -1416,7 +1416,8 @@ void V8DebuggerAgentImpl::didParseSource( + Maybe executionContextAuxDataParam( + std::move(executionContextAuxData)); + const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; +- const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; ++ const bool* hasSourceURLParam = ++ hasSourceURLComment ? &hasSourceURLComment : nullptr; + const bool* isModuleParam = isModule ? &isModule : nullptr; + std::unique_ptr stack = + V8StackTraceImpl::capture(m_inspector->debugger(), contextGroupId, 1); +diff --git a/src/inspector/v8-debugger-script.cc b/src/inspector/v8-debugger-script.cc +index c40477ae2af74dfea6a950bc7be6e5b4efa42fe8..d861265e148559a16e27b20b371c4d7bba364add 100644 +--- a/src/inspector/v8-debugger-script.cc ++++ b/src/inspector/v8-debugger-script.cc +@@ -6,6 +6,7 @@ + + #include "src/inspector/inspected-context.h" + #include "src/inspector/string-util.h" ++#include "src/inspector/v8-inspector-impl.h" + #include "src/inspector/wasm-translation.h" + #include "src/utils.h" + +@@ -110,9 +111,9 @@ class ActualScript : public V8DebuggerScript { + + public: + ActualScript(v8::Isolate* isolate, v8::Local script, +- bool isLiveEdit) ++ bool isLiveEdit, V8InspectorClient* client) + : V8DebuggerScript(isolate, String16::fromInteger(script->Id()), +- GetNameOrSourceUrl(script)), ++ GetScriptURL(script, client)), + m_isLiveEdit(isLiveEdit) { + Initialize(script); + } +@@ -218,10 +219,18 @@ class ActualScript : public V8DebuggerScript { + } + + private: +- String16 GetNameOrSourceUrl(v8::Local script) { +- v8::Local name; +- if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) +- return toProtocolString(name); ++ String16 GetScriptURL(v8::Local script, ++ V8InspectorClient* client) { ++ v8::Local sourceURL; ++ if (script->SourceURL().ToLocal(&sourceURL) && sourceURL->Length() > 0) ++ return toProtocolString(sourceURL); ++ v8::Local v8Name; ++ if (script->Name().ToLocal(&v8Name) && v8Name->Length() > 0) { ++ String16 name = toProtocolString(v8Name); ++ std::unique_ptr url = ++ client->resourceNameToUrl(toStringView(name)); ++ return url ? toString16(url->string()) : name; ++ } + return String16(); + } + +@@ -231,7 +240,8 @@ class ActualScript : public V8DebuggerScript { + + void Initialize(v8::Local script) { + v8::Local tmp; +- if (script->SourceURL().ToLocal(&tmp)) m_sourceURL = toProtocolString(tmp); ++ m_hasSourceURLComment = ++ script->SourceURL().ToLocal(&tmp) && tmp->Length() > 0; + if (script->SourceMappingURL().ToLocal(&tmp)) + m_sourceMappingURL = toProtocolString(tmp); + m_startLine = script->LineOffset(); +@@ -398,9 +408,9 @@ class WasmVirtualScript : public V8DebuggerScript { + + std::unique_ptr V8DebuggerScript::Create( + v8::Isolate* isolate, v8::Local scriptObj, +- bool isLiveEdit) { ++ bool isLiveEdit, V8InspectorClient* client) { + return std::unique_ptr( +- new ActualScript(isolate, scriptObj, isLiveEdit)); ++ new ActualScript(isolate, scriptObj, isLiveEdit, client)); + } + + std::unique_ptr V8DebuggerScript::CreateWasm( +@@ -418,12 +428,11 @@ V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate, String16 id, + + V8DebuggerScript::~V8DebuggerScript() {} + +-const String16& V8DebuggerScript::sourceURL() const { +- return m_sourceURL.isEmpty() ? m_url : m_sourceURL; +-} +- + void V8DebuggerScript::setSourceURL(const String16& sourceURL) { +- m_sourceURL = sourceURL; ++ if (sourceURL.length() > 0) { ++ m_hasSourceURLComment = true; ++ m_url = sourceURL; ++ } + } + + bool V8DebuggerScript::setBreakpoint(const String16& condition, +@@ -431,5 +440,4 @@ bool V8DebuggerScript::setBreakpoint(const String16& condition, + v8::HandleScope scope(m_isolate); + return script()->SetBreakpoint(toV8String(m_isolate, condition), loc, id); + } +- + } // namespace v8_inspector +diff --git a/src/inspector/v8-debugger-script.h b/src/inspector/v8-debugger-script.h +index e0e7d93b20275221e873f026a9d44e663fad2e30..38e6448f48d8e8dcdde0935c516b45ddc7cf4db5 100644 +--- a/src/inspector/v8-debugger-script.h ++++ b/src/inspector/v8-debugger-script.h +@@ -40,13 +40,14 @@ + namespace v8_inspector { + + // Forward declaration. ++class V8InspectorClient; + class WasmTranslation; + + class V8DebuggerScript { + public: + static std::unique_ptr Create( + v8::Isolate* isolate, v8::Local script, +- bool isLiveEdit); ++ bool isLiveEdit, V8InspectorClient* client); + static std::unique_ptr CreateWasm( + v8::Isolate* isolate, WasmTranslation* wasmTranslation, + v8::Local underlyingScript, String16 id, +@@ -55,9 +56,9 @@ class V8DebuggerScript { + virtual ~V8DebuggerScript(); + + const String16& scriptId() const { return m_id; } +- const String16& url() const { return m_url; } +- bool hasSourceURL() const { return !m_sourceURL.isEmpty(); } +- const String16& sourceURL() const; ++ bool hasSourceURLComment() const { return m_hasSourceURLComment; } ++ const String16& sourceURL() const { return m_url; } ++ + virtual const String16& sourceMappingURL() const = 0; + virtual const String16& source() const = 0; + virtual const String16& hash() const = 0; +@@ -95,7 +96,7 @@ class V8DebuggerScript { + + String16 m_id; + String16 m_url; +- String16 m_sourceURL; ++ bool m_hasSourceURLComment = false; + int m_executionContextId = 0; + + v8::Isolate* m_isolate; +diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc +index 1ceb4210f7f476ddbc1fc795239d6b2153788a55..7d1f7cefd15db3f5482e27fa47880bb6227bb322 100644 +--- a/src/inspector/v8-debugger.cc ++++ b/src/inspector/v8-debugger.cc +@@ -226,13 +226,15 @@ void V8Debugger::getCompiledScripts( + v8::Local script = scripts.Get(i); + if (!script->WasCompiled()) continue; + if (script->IsEmbedded()) { +- result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); ++ result.push_back(V8DebuggerScript::Create(m_isolate, script, false, ++ m_inspector->client())); + continue; + } + int contextId; + if (!script->ContextId().To(&contextId)) continue; + if (m_inspector->contextGroupId(contextId) != contextGroupId) continue; +- result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); ++ result.push_back(V8DebuggerScript::Create(m_isolate, script, false, ++ m_inspector->client())); + } + } + +@@ -585,13 +587,14 @@ void V8Debugger::ScriptCompiled(v8::Local script, + }); + } else if (m_ignoreScriptParsedEventsCounter == 0) { + v8::Isolate* isolate = m_isolate; ++ V8InspectorClient* client = m_inspector->client(); + m_inspector->forEachSession( + m_inspector->contextGroupId(contextId), +- [&isolate, &script, &has_compile_error, +- &is_live_edited](V8InspectorSessionImpl* session) { ++ [&isolate, &script, &has_compile_error, &is_live_edited, ++ &client](V8InspectorSessionImpl* session) { + if (!session->debuggerAgent()->enabled()) return; + session->debuggerAgent()->didParseSource( +- V8DebuggerScript::Create(isolate, script, is_live_edited), ++ V8DebuggerScript::Create(isolate, script, is_live_edited, client), + !has_compile_error); + }); + } +diff --git a/src/inspector/v8-profiler-agent-impl.cc b/src/inspector/v8-profiler-agent-impl.cc +index 59a99d79d54c2fb8dee1ff3e950a1c995889a8ac..f14815fdc4b031c640795ce10fb4b963310656be 100644 +--- a/src/inspector/v8-profiler-agent-impl.cc ++++ b/src/inspector/v8-profiler-agent-impl.cc +@@ -7,6 +7,7 @@ + #include + + #include "src/base/atomicops.h" ++#include "src/debug/debug-interface.h" + #include "src/flags.h" // TODO(jgruber): Remove include and DEPS entry. + #include "src/inspector/protocol/Protocol.h" + #include "src/inspector/string-util.h" +@@ -31,6 +32,15 @@ static const char typeProfileStarted[] = "typeProfileStarted"; + + namespace { + ++String16 resourceNameToUrl(V8InspectorImpl* inspector, ++ v8::Local v8Name) { ++ String16 name = toProtocolString(v8Name); ++ if (!inspector) return name; ++ std::unique_ptr url = ++ inspector->client()->resourceNameToUrl(toStringView(name)); ++ return url ? toString16(url->string()) : name; ++} ++ + std::unique_ptr> + buildInspectorObjectForPositionTicks(const v8::CpuProfileNode* node) { + unsigned lineCount = node->GetHitLineCount(); +@@ -51,13 +61,14 @@ buildInspectorObjectForPositionTicks(const v8::CpuProfileNode* node) { + } + + std::unique_ptr buildInspectorObjectFor( +- v8::Isolate* isolate, const v8::CpuProfileNode* node) { ++ V8InspectorImpl* inspector, const v8::CpuProfileNode* node) { ++ v8::Isolate* isolate = inspector->isolate(); + v8::HandleScope handleScope(isolate); + auto callFrame = + protocol::Runtime::CallFrame::create() + .setFunctionName(toProtocolString(node->GetFunctionName())) + .setScriptId(String16::fromInteger(node->GetScriptId())) +- .setUrl(toProtocolString(node->GetScriptResourceName())) ++ .setUrl(resourceNameToUrl(inspector, node->GetScriptResourceName())) + .setLineNumber(node->GetLineNumber() - 1) + .setColumnNumber(node->GetColumnNumber() - 1) + .build(); +@@ -107,18 +118,19 @@ std::unique_ptr> buildInspectorObjectForTimestamps( + return array; + } + +-void flattenNodesTree(v8::Isolate* isolate, const v8::CpuProfileNode* node, ++void flattenNodesTree(V8InspectorImpl* inspector, ++ const v8::CpuProfileNode* node, + protocol::Array* list) { +- list->addItem(buildInspectorObjectFor(isolate, node)); ++ list->addItem(buildInspectorObjectFor(inspector, node)); + const int childrenCount = node->GetChildrenCount(); + for (int i = 0; i < childrenCount; i++) +- flattenNodesTree(isolate, node->GetChild(i), list); ++ flattenNodesTree(inspector, node->GetChild(i), list); + } + + std::unique_ptr createCPUProfile( +- v8::Isolate* isolate, v8::CpuProfile* v8profile) { ++ V8InspectorImpl* inspector, v8::CpuProfile* v8profile) { + auto nodes = protocol::Array::create(); +- flattenNodesTree(isolate, v8profile->GetTopDownRoot(), nodes.get()); ++ flattenNodesTree(inspector, v8profile->GetTopDownRoot(), nodes.get()); + return protocol::Profiler::Profile::create() + .setNodes(std::move(nodes)) + .setStartTime(static_cast(v8profile->GetStartTime())) +@@ -320,7 +332,7 @@ std::unique_ptr createCoverageRange( + } + + Response coverageToProtocol( +- v8::Isolate* isolate, const v8::debug::Coverage& coverage, ++ V8InspectorImpl* inspector, const v8::debug::Coverage& coverage, + std::unique_ptr>* + out_result) { + std::unique_ptr> result = +@@ -361,8 +373,10 @@ Response coverageToProtocol( + } + String16 url; + v8::Local name; +- if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) { ++ if (script->SourceURL().ToLocal(&name) && name->Length()) { + url = toProtocolString(name); ++ } else if (script->Name().ToLocal(&name) && name->Length()) { ++ url = resourceNameToUrl(inspector, name); + } + result->addItem(protocol::Profiler::ScriptCoverage::create() + .setScriptId(String16::fromInteger(script->Id())) +@@ -384,7 +398,7 @@ Response V8ProfilerAgentImpl::takePreciseCoverage( + } + v8::HandleScope handle_scope(m_isolate); + v8::debug::Coverage coverage = v8::debug::Coverage::CollectPrecise(m_isolate); +- return coverageToProtocol(m_isolate, coverage, out_result); ++ return coverageToProtocol(m_session->inspector(), coverage, out_result); + } + + Response V8ProfilerAgentImpl::getBestEffortCoverage( +@@ -393,12 +407,12 @@ Response V8ProfilerAgentImpl::getBestEffortCoverage( + v8::HandleScope handle_scope(m_isolate); + v8::debug::Coverage coverage = + v8::debug::Coverage::CollectBestEffort(m_isolate); +- return coverageToProtocol(m_isolate, coverage, out_result); ++ return coverageToProtocol(m_session->inspector(), coverage, out_result); + } + + namespace { + std::unique_ptr> +-typeProfileToProtocol(v8::Isolate* isolate, ++typeProfileToProtocol(V8InspectorImpl* inspector, + const v8::debug::TypeProfile& type_profile) { + std::unique_ptr> + result = protocol::Array::create(); +@@ -426,8 +440,10 @@ typeProfileToProtocol(v8::Isolate* isolate, + } + String16 url; + v8::Local name; +- if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) { ++ if (script->SourceURL().ToLocal(&name) && name->Length()) { + url = toProtocolString(name); ++ } else if (script->Name().ToLocal(&name) && name->Length()) { ++ url = resourceNameToUrl(inspector, name); + } + result->addItem(protocol::Profiler::ScriptTypeProfile::create() + .setScriptId(String16::fromInteger(script->Id())) +@@ -462,7 +478,7 @@ Response V8ProfilerAgentImpl::takeTypeProfile( + v8::HandleScope handle_scope(m_isolate); + v8::debug::TypeProfile type_profile = + v8::debug::TypeProfile::Collect(m_isolate); +- *out_result = typeProfileToProtocol(m_isolate, type_profile); ++ *out_result = typeProfileToProtocol(m_session->inspector(), type_profile); + return Response::OK(); + } + +@@ -491,7 +507,7 @@ std::unique_ptr V8ProfilerAgentImpl::stopProfiling( + m_profiler->StopProfiling(toV8String(m_isolate, title)); + std::unique_ptr result; + if (profile) { +- if (serialize) result = createCPUProfile(m_isolate, profile); ++ if (serialize) result = createCPUProfile(m_session->inspector(), profile); + profile->Delete(); + } + --m_startedProfilesCount; +diff --git a/src/inspector/v8-stack-trace-impl.cc b/src/inspector/v8-stack-trace-impl.cc +index 75293c59afee8e09f05a33d8aa806ee79bd01e99..9be0d4fa385f2a02da6ba9865f7d658ac1912a5e 100644 +--- a/src/inspector/v8-stack-trace-impl.cc ++++ b/src/inspector/v8-stack-trace-impl.cc +@@ -7,6 +7,7 @@ + #include + + #include "src/inspector/v8-debugger.h" ++#include "src/inspector/v8-inspector-impl.h" + #include "src/inspector/wasm-translation.h" + + namespace v8_inspector { +@@ -73,7 +74,10 @@ std::unique_ptr buildInspectorObjectCommon( + std::unique_ptr> + inspectorFrames = protocol::Array::create(); + for (size_t i = 0; i < frames.size(); i++) { +- inspectorFrames->addItem(frames[i]->buildInspectorObject()); ++ V8InspectorClient* client = nullptr; ++ if (debugger && debugger->inspector()) ++ client = debugger->inspector()->client(); ++ inspectorFrames->addItem(frames[i]->buildInspectorObject(client)); + } + std::unique_ptr stackTrace = + protocol::Runtime::StackTrace::create() +@@ -117,7 +121,9 @@ StackFrame::StackFrame(v8::Local v8Frame) + m_scriptId(String16::fromInteger(v8Frame->GetScriptId())), + m_sourceURL(toProtocolString(v8Frame->GetScriptNameOrSourceURL())), + m_lineNumber(v8Frame->GetLineNumber() - 1), +- m_columnNumber(v8Frame->GetColumn() - 1) { ++ m_columnNumber(v8Frame->GetColumn() - 1), ++ m_hasSourceURLComment(v8Frame->GetScriptName() != ++ v8Frame->GetScriptNameOrSourceURL()) { + DCHECK_NE(v8::Message::kNoLineNumberInfo, m_lineNumber + 1); + DCHECK_NE(v8::Message::kNoColumnInfo, m_columnNumber + 1); + } +@@ -137,12 +143,20 @@ int StackFrame::lineNumber() const { return m_lineNumber; } + + int StackFrame::columnNumber() const { return m_columnNumber; } + +-std::unique_ptr StackFrame::buildInspectorObject() +- const { ++std::unique_ptr StackFrame::buildInspectorObject( ++ V8InspectorClient* client) const { ++ String16 frameUrl = m_sourceURL; ++ if (client && !m_hasSourceURLComment && frameUrl.length() > 0) { ++ std::unique_ptr url = ++ client->resourceNameToUrl(toStringView(m_sourceURL)); ++ if (url) { ++ frameUrl = toString16(url->string()); ++ } ++ } + return protocol::Runtime::CallFrame::create() + .setFunctionName(m_functionName) + .setScriptId(m_scriptId) +- .setUrl(m_sourceURL) ++ .setUrl(frameUrl) + .setLineNumber(m_lineNumber) + .setColumnNumber(m_columnNumber) + .build(); +diff --git a/src/inspector/v8-stack-trace-impl.h b/src/inspector/v8-stack-trace-impl.h +index a8f23c48b67231f6015d1004ec14995c65967239..019fd469cdd72e1fd03ed7a0ab8554e054fb8498 100644 +--- a/src/inspector/v8-stack-trace-impl.h ++++ b/src/inspector/v8-stack-trace-impl.h +@@ -33,7 +33,8 @@ class StackFrame { + const String16& sourceURL() const; + int lineNumber() const; // 0-based. + int columnNumber() const; // 0-based. +- std::unique_ptr buildInspectorObject() const; ++ std::unique_ptr buildInspectorObject( ++ V8InspectorClient* client) const; + bool isEqual(StackFrame* frame) const; + + private: +@@ -42,6 +43,7 @@ class StackFrame { + String16 m_sourceURL; + int m_lineNumber; // 0-based. + int m_columnNumber; // 0-based. ++ bool m_hasSourceURLComment; + }; + + class V8StackTraceImpl : public V8StackTrace { +diff --git a/test/inspector/debugger/resource-name-to-url-expected.txt b/test/inspector/debugger/resource-name-to-url-expected.txt +new file mode 100644 +index 0000000000000000000000000000000000000000..0ecd0b82ef239072ab20a4d8844fa48b4b477586 +--- /dev/null ++++ b/test/inspector/debugger/resource-name-to-url-expected.txt +@@ -0,0 +1,122 @@ ++Tests V8InspectorClient::resourceNameToUrl. ++Check script with url: ++{ ++ method : Debugger.scriptParsed ++ params : { ++ endColumn : 16 ++ endLine : 0 ++ executionContextId : ++ hasSourceURL : false ++ hash : 033b33d191ed51ed823355d865eb871d811403e2 ++ isLiveEdit : false ++ isModule : false ++ length : 16 ++ scriptId : ++ sourceMapURL : ++ startColumn : 0 ++ startLine : 0 ++ url : prefix://url ++ } ++} ++Check script with sourceURL comment: ++{ ++ method : Debugger.scriptParsed ++ params : { ++ endColumn : 37 ++ endLine : 0 ++ executionContextId : ++ hasSourceURL : true ++ hash : 06c136ce206c5f505f32af524e6ec71b5baa0bbb ++ isLiveEdit : false ++ isModule : false ++ length : 37 ++ scriptId : ++ sourceMapURL : ++ startColumn : 0 ++ startLine : 0 ++ url : foo.js ++ } ++} ++Check script failed to parse: ++{ ++ method : Debugger.scriptFailedToParse ++ params : { ++ endColumn : 15 ++ endLine : 0 ++ executionContextId : ++ hasSourceURL : false ++ hash : 033b33d191ed51ed1f44cd0465eb871d811403e2 ++ isModule : false ++ length : 15 ++ scriptId : ++ sourceMapURL : ++ startColumn : 0 ++ startLine : 0 ++ url : prefix://url ++ } ++} ++Check script failed to parse with sourceURL comment: ++{ ++ method : Debugger.scriptFailedToParse ++ params : { ++ endColumn : 36 ++ endLine : 0 ++ executionContextId : ++ hasSourceURL : true ++ hash : 23a2885951475580023e2a742563d78876d8f05e ++ isModule : false ++ length : 36 ++ scriptId : ++ sourceMapURL : ++ startColumn : 0 ++ startLine : 0 ++ url : foo.js ++ } ++} ++Test runtime stack trace: ++{ ++ method : Runtime.consoleAPICalled ++ params : { ++ args : [ ++ [0] : { ++ description : 42 ++ type : number ++ value : 42 ++ } ++ ] ++ executionContextId : ++ stackTrace : { ++ callFrames : [ ++ [0] : { ++ columnNumber : 14 ++ functionName : foo ++ lineNumber : 2 ++ scriptId : ++ url : prefix://url ++ } ++ [1] : { ++ columnNumber : 0 ++ functionName : ++ lineNumber : 0 ++ scriptId : ++ url : boo.js ++ } ++ [2] : { ++ columnNumber : 4 ++ functionName : ++ lineNumber : 4 ++ scriptId : ++ url : prefix://url ++ } ++ ] ++ } ++ timestamp : ++ type : log ++ } ++} ++Test debugger stack trace: ++[ ++ [0] : prefix://url ++ [1] : boo.js ++ [2] : prefix://url ++] +diff --git a/test/inspector/debugger/resource-name-to-url.js b/test/inspector/debugger/resource-name-to-url.js +new file mode 100644 +index 0000000000000000000000000000000000000000..620c7a2864b406539fc7fc0e4b5a89b06a0847f3 +--- /dev/null ++++ b/test/inspector/debugger/resource-name-to-url.js +@@ -0,0 +1,49 @@ ++// Copyright 2018 the V8 project authors. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++let {session, contextGroup, Protocol} = InspectorTest.start( ++ 'Tests V8InspectorClient::resourceNameToUrl.'); ++ ++(async function test(){ ++ Protocol.Runtime.enable(); ++ await Protocol.Debugger.enable(); ++ contextGroup.addScript(`inspector.setResourceNamePrefix('prefix://')`); ++ await Protocol.Debugger.onceScriptParsed(); ++ ++ InspectorTest.log('Check script with url:'); ++ contextGroup.addScript('function foo(){}', 0, 0, 'url'); ++ InspectorTest.logMessage(await Protocol.Debugger.onceScriptParsed()); ++ ++ InspectorTest.log('Check script with sourceURL comment:'); ++ contextGroup.addScript('function foo(){} //# sourceURL=foo.js', 0, 0, 'url'); ++ InspectorTest.logMessage(await Protocol.Debugger.onceScriptParsed()); ++ ++ InspectorTest.log('Check script failed to parse:'); ++ contextGroup.addScript('function foo(){', 0, 0, 'url'); ++ InspectorTest.logMessage(await Protocol.Debugger.onceScriptFailedToParse()); ++ ++ InspectorTest.log('Check script failed to parse with sourceURL comment:'); ++ contextGroup.addScript('function foo(){ //# sourceURL=foo.js', 0, 0, 'url'); ++ InspectorTest.logMessage(await Protocol.Debugger.onceScriptFailedToParse()); ++ ++ InspectorTest.log('Test runtime stack trace:'); ++ contextGroup.addScript(` ++ function foo() { ++ console.log(42); ++ } ++ eval('foo(); //# sourceURL=boo.js'); ++ `, 0, 0, 'url'); ++ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); ++ ++ InspectorTest.log('Test debugger stack trace:'); ++ contextGroup.addScript(` ++ function foo() { ++ debugger; ++ } ++ eval('foo(); //# sourceURL=boo.js'); ++ `, 0, 0, 'url'); ++ const {params:{callFrames}} = await Protocol.Debugger.oncePaused(); ++ InspectorTest.logMessage(callFrames.map(frame => frame.url)); ++ InspectorTest.completeTest(); ++})(); +diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc +index 668a9463d5b9cf7db0981b6907e303425df6c25c..93a8b1d3f2188015aa153cdc15b3b369d1f353d9 100644 +--- a/test/inspector/inspector-test.cc ++++ b/test/inspector/inspector-test.cc +@@ -712,6 +712,9 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { + ToV8String(isolate, "setAllowCodeGenerationFromStrings"), + v8::FunctionTemplate::New( + isolate, &InspectorExtension::SetAllowCodeGenerationFromStrings)); ++ inspector->Set(ToV8String(isolate, "setResourceNamePrefix"), ++ v8::FunctionTemplate::New( ++ isolate, &InspectorExtension::SetResourceNamePrefix)); + global->Set(ToV8String(isolate, "inspector"), inspector); + } + +@@ -973,6 +976,18 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { + args.GetIsolate()->GetCurrentContext()->AllowCodeGenerationFromStrings( + args[0].As()->Value()); + } ++ ++ static void SetResourceNamePrefix( ++ const v8::FunctionCallbackInfo& args) { ++ if (args.Length() != 1 || !args[0]->IsString()) { ++ fprintf(stderr, "Internal error: setResourceNamePrefix('prefix')."); ++ Exit(); ++ } ++ v8::Isolate* isolate = args.GetIsolate(); ++ v8::Local context = isolate->GetCurrentContext(); ++ IsolateData* data = IsolateData::FromContext(context); ++ data->SetResourceNamePrefix(v8::Local::Cast(args[0])); ++ } + }; + + bool RunExtraCode(v8::Isolate* isolate, v8::Local context, +diff --git a/test/inspector/isolate-data.cc b/test/inspector/isolate-data.cc +index 15eee89a61faa25d6f635b6983d81bdea943c8e1..a669cc41a1f26a2c6a76c59eb081c8ca0a83bfdd 100644 +--- a/test/inspector/isolate-data.cc ++++ b/test/inspector/isolate-data.cc +@@ -423,3 +423,32 @@ void IsolateData::maxAsyncCallStackDepthChanged(int depth) { + if (!log_max_async_call_stack_depth_changed_) return; + fprintf(stdout, "maxAsyncCallStackDepthChanged: %d\n", depth); + } ++ ++void IsolateData::SetResourceNamePrefix(v8::Local prefix) { ++ resource_name_prefix_.Reset(v8::Isolate::GetCurrent(), prefix); ++} ++ ++namespace { ++class StringBufferImpl : public v8_inspector::StringBuffer { ++ public: ++ StringBufferImpl(v8::Isolate* isolate, v8::Local string) ++ : data_(ToVector(string)), ++ view_(data_.start(), data_.length()) {} ++ const v8_inspector::StringView& string() override { return view_; } ++ ++ private: ++ v8::internal::Vector data_; ++ v8_inspector::StringView view_; ++}; ++} // anonymous namespace ++ ++std::unique_ptr IsolateData::resourceNameToUrl( ++ const v8_inspector::StringView& resourceName) { ++ if (resource_name_prefix_.IsEmpty()) return nullptr; ++ v8::Isolate* isolate = v8::Isolate::GetCurrent(); ++ v8::HandleScope handle_scope(isolate); ++ v8::Local name = ToString(isolate, resourceName); ++ v8::Local prefix = resource_name_prefix_.Get(isolate); ++ v8::Local url = v8::String::Concat(prefix, name); ++ return std::unique_ptr(new StringBufferImpl(isolate, url)); ++} +diff --git a/test/inspector/isolate-data.h b/test/inspector/isolate-data.h +index 5eb9803a7416fb67937283960c90269681403c1f..d0a263e573827c3b22810d70b0cf4f0c6f9243f3 100644 +--- a/test/inspector/isolate-data.h ++++ b/test/inspector/isolate-data.h +@@ -76,6 +76,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { + void FireContextCreated(v8::Local context, int context_group_id); + void FireContextDestroyed(v8::Local context); + void FreeContext(v8::Local context); ++ void SetResourceNamePrefix(v8::Local prefix); + + private: + struct VectorCompare { +@@ -114,6 +115,8 @@ class IsolateData : public v8_inspector::V8InspectorClient { + v8_inspector::V8StackTrace*) override; + bool isInspectableHeapObject(v8::Local) override; + void maxAsyncCallStackDepthChanged(int depth) override; ++ std::unique_ptr resourceNameToUrl( ++ const v8_inspector::StringView& resourceName) override; + + // The isolate gets deleted by its {Dispose} method, not by the default + // deleter. Therefore we have to define a custom deleter for the unique_ptr to +@@ -141,6 +144,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { + bool log_console_api_message_calls_ = false; + bool log_max_async_call_stack_depth_changed_ = false; + v8::Global not_inspectable_private_; ++ v8::Global resource_name_prefix_; + + DISALLOW_COPY_AND_ASSIGN(IsolateData); + }; +-- +2.17.0 + diff --git a/patches/common/v8/deps_cherry-pick_e1a7699_from_upstream_v8.patch b/patches/common/v8/deps_cherry-pick_e1a7699_from_upstream_v8.patch new file mode 100644 index 0000000000..48a58612f6 --- /dev/null +++ b/patches/common/v8/deps_cherry-pick_e1a7699_from_upstream_v8.patch @@ -0,0 +1,367 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Camillo Bruni +Date: Sat, 18 Aug 2018 13:41:51 -0400 +Subject: deps: cherry-pick e1a7699 from upstream V8 + +Original commit message: + + [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration + + - Explicitly allows construction of + {Named,Indexed}PropertyHandlerConfiguration with all the members filled. + + Bug: v8:7612 + Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng + Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded + Reviewed-on: https://chromium-review.googlesource.com/1163882 + Reviewed-by: Toon Verwaest + Reviewed-by: Adam Klein + Commit-Queue: Camillo Bruni + Cr-Commit-Position: refs/heads/master@{#55142} + +PR-URL: https://github.com/nodejs/node/pull/22390 +Fixes: https://github.com/nodejs/node/issues/17480 +Fixes: https://github.com/nodejs/node/issues/17481 +Refs: https://github.com/v8/v8/commit/e1a76995ef311eb3ca66e12ef1941ed596034d59 +Reviewed-By: Anna Henningsen +Reviewed-By: Gus Caplan +Reviewed-By: James M Snell + +diff --git a/include/v8.h b/include/v8.h +index 23d5ba36db97dab2bb706ab90930ee1403a68104..20a65afcbc61c31360874e45adc03eeda02e9a81 100644 +--- a/include/v8.h ++++ b/include/v8.h +@@ -5994,6 +5994,26 @@ enum class PropertyHandlerFlags { + }; + + struct NamedPropertyHandlerConfiguration { ++ NamedPropertyHandlerConfiguration( ++ GenericNamedPropertyGetterCallback getter, ++ GenericNamedPropertySetterCallback setter, ++ GenericNamedPropertyQueryCallback query, ++ GenericNamedPropertyDeleterCallback deleter, ++ GenericNamedPropertyEnumeratorCallback enumerator, ++ GenericNamedPropertyDefinerCallback definer, ++ GenericNamedPropertyDescriptorCallback descriptor, ++ Local data = Local(), ++ PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) ++ : getter(getter), ++ setter(setter), ++ query(query), ++ deleter(deleter), ++ enumerator(enumerator), ++ definer(definer), ++ descriptor(descriptor), ++ data(data), ++ flags(flags) {} ++ + NamedPropertyHandlerConfiguration( + /** Note: getter is required */ + GenericNamedPropertyGetterCallback getter = 0, +@@ -6045,6 +6065,25 @@ struct NamedPropertyHandlerConfiguration { + + + struct IndexedPropertyHandlerConfiguration { ++ IndexedPropertyHandlerConfiguration( ++ IndexedPropertyGetterCallback getter, ++ IndexedPropertySetterCallback setter, IndexedPropertyQueryCallback query, ++ IndexedPropertyDeleterCallback deleter, ++ IndexedPropertyEnumeratorCallback enumerator, ++ IndexedPropertyDefinerCallback definer, ++ IndexedPropertyDescriptorCallback descriptor, ++ Local data = Local(), ++ PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) ++ : getter(getter), ++ setter(setter), ++ query(query), ++ deleter(deleter), ++ enumerator(enumerator), ++ definer(definer), ++ descriptor(descriptor), ++ data(data), ++ flags(flags) {} ++ + IndexedPropertyHandlerConfiguration( + /** Note: getter is required */ + IndexedPropertyGetterCallback getter = 0, +diff --git a/src/api.cc b/src/api.cc +index 7c569e3a9f0824e1c61b665236589e3b7c1cc464..6155cbb32579effc500b5c475cd478e77b3ecdf4 100644 +--- a/src/api.cc ++++ b/src/api.cc +@@ -1879,10 +1879,6 @@ static i::Handle CreateInterceptorInfo( + i::Isolate* isolate, Getter getter, Setter setter, Query query, + Descriptor descriptor, Deleter remover, Enumerator enumerator, + Definer definer, Local data, PropertyHandlerFlags flags) { +- // Either intercept attributes or descriptor. +- DCHECK(query == nullptr || descriptor == nullptr); +- // Only use descriptor callback with definer callback. +- DCHECK(query == nullptr || definer == nullptr); + auto obj = i::Handle::cast( + isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE, i::TENURED)); + obj->set_flags(0); +diff --git a/src/objects.cc b/src/objects.cc +index 01421bacc4495150fe9dc05469e216c66d513c64..0aac39d30427e0a02b8c99b0b08ea40712ab1dad 100644 +--- a/src/objects.cc ++++ b/src/objects.cc +@@ -7817,41 +7817,42 @@ Maybe GetPropertyDescriptorWithInterceptor(LookupIterator* it, + } + } + +- if (it->state() == LookupIterator::INTERCEPTOR) { +- Isolate* isolate = it->isolate(); +- Handle interceptor = it->GetInterceptor(); +- if (!interceptor->descriptor()->IsUndefined(isolate)) { +- Handle result; +- Handle holder = it->GetHolder(); ++ if (it->state() != LookupIterator::INTERCEPTOR) return Just(false); + +- Handle receiver = it->GetReceiver(); +- if (!receiver->IsJSReceiver()) { +- ASSIGN_RETURN_ON_EXCEPTION_VALUE( +- isolate, receiver, Object::ConvertReceiver(isolate, receiver), +- Nothing()); +- } ++ Isolate* isolate = it->isolate(); ++ Handle interceptor = it->GetInterceptor(); ++ if (interceptor->descriptor()->IsUndefined(isolate)) return Just(false); + +- PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, +- *holder, kDontThrow); +- if (it->IsElement()) { +- result = args.CallIndexedDescriptor(interceptor, it->index()); +- } else { +- result = args.CallNamedDescriptor(interceptor, it->name()); +- } +- if (!result.is_null()) { +- // Request successfully intercepted, try to set the property +- // descriptor. +- Utils::ApiCheck( +- PropertyDescriptor::ToPropertyDescriptor(isolate, result, desc), +- it->IsElement() ? "v8::IndexedPropertyDescriptorCallback" +- : "v8::NamedPropertyDescriptorCallback", +- "Invalid property descriptor."); ++ Handle result; ++ Handle holder = it->GetHolder(); + +- return Just(true); +- } +- it->Next(); +- } ++ Handle receiver = it->GetReceiver(); ++ if (!receiver->IsJSReceiver()) { ++ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, ++ Object::ConvertReceiver(isolate, receiver), ++ Nothing()); ++ } ++ ++ PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, ++ *holder, kDontThrow); ++ if (it->IsElement()) { ++ result = args.CallIndexedDescriptor(interceptor, it->index()); ++ } else { ++ result = args.CallNamedDescriptor(interceptor, it->name()); + } ++ if (!result.is_null()) { ++ // Request successfully intercepted, try to set the property ++ // descriptor. ++ Utils::ApiCheck( ++ PropertyDescriptor::ToPropertyDescriptor(isolate, result, desc), ++ it->IsElement() ? "v8::IndexedPropertyDescriptorCallback" ++ : "v8::NamedPropertyDescriptorCallback", ++ "Invalid property descriptor."); ++ ++ return Just(true); ++ } ++ ++ it->Next(); + return Just(false); + } + } // namespace +diff --git a/test/unittests/api/interceptor-unittest.cc b/test/unittests/api/interceptor-unittest.cc +index 2f9f0e459e6fed4c688fc0ee7389593cf86e07c8..b13384f18adfefe69dc5be232a5f620a7efd8ba7 100644 +--- a/test/unittests/api/interceptor-unittest.cc ++++ b/test/unittests/api/interceptor-unittest.cc +@@ -29,4 +29,180 @@ TEST_F(InterceptorTest, FreezeApiObjectWithInterceptor) { + } + + } // namespace ++ ++namespace internal { ++namespace { ++ ++class InterceptorLoggingTest : public TestWithNativeContext { ++ public: ++ InterceptorLoggingTest() {} ++ ++ static const int kTestIndex = 0; ++ ++ static void NamedPropertyGetter(Local name, ++ const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "named getter"); ++ } ++ ++ static void NamedPropertySetter(Local name, Local value, ++ const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "named setter"); ++ } ++ ++ static void NamedPropertyQuery( ++ Local name, const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "named query"); ++ } ++ ++ static void NamedPropertyDeleter( ++ Local name, const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "named deleter"); ++ } ++ ++ static void NamedPropertyEnumerator( ++ const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "named enumerator"); ++ } ++ ++ static void NamedPropertyDefiner( ++ Local name, const v8::PropertyDescriptor& desc, ++ const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "named definer"); ++ } ++ ++ static void NamedPropertyDescriptor( ++ Local name, const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "named descriptor"); ++ } ++ ++ static void IndexedPropertyGetter( ++ uint32_t index, const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "indexed getter"); ++ } ++ ++ static void IndexedPropertySetter( ++ uint32_t index, Local value, ++ const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "indexed setter"); ++ } ++ ++ static void IndexedPropertyQuery( ++ uint32_t index, const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "indexed query"); ++ } ++ ++ static void IndexedPropertyDeleter( ++ uint32_t index, const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "indexed deleter"); ++ } ++ ++ static void IndexedPropertyEnumerator( ++ const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "indexed enumerator"); ++ } ++ ++ static void IndexedPropertyDefiner( ++ uint32_t index, const v8::PropertyDescriptor& desc, ++ const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "indexed definer"); ++ } ++ ++ static void IndexedPropertyDescriptor( ++ uint32_t index, const v8::PropertyCallbackInfo& info) { ++ LogCallback(info, "indexed descriptor"); ++ } ++ ++ template ++ static void LogCallback(const v8::PropertyCallbackInfo& info, ++ const char* callback_name) { ++ InterceptorLoggingTest* test = reinterpret_cast( ++ info.This()->GetAlignedPointerFromInternalField(kTestIndex)); ++ test->Log(callback_name); ++ } ++ ++ void Log(const char* callback_name) { ++ if (log_is_empty_) { ++ log_is_empty_ = false; ++ } else { ++ log_ << ", "; ++ } ++ log_ << callback_name; ++ } ++ ++ protected: ++ void SetUp() override { ++ // Set up the object that supports full interceptors. ++ v8::Local templ = v8::ObjectTemplate::New(v8_isolate()); ++ templ->SetInternalFieldCount(1); ++ templ->SetHandler(v8::NamedPropertyHandlerConfiguration( ++ NamedPropertyGetter, NamedPropertySetter, NamedPropertyQuery, ++ NamedPropertyDeleter, NamedPropertyEnumerator, NamedPropertyDefiner, ++ NamedPropertyDescriptor)); ++ templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( ++ IndexedPropertyGetter, IndexedPropertySetter, IndexedPropertyQuery, ++ IndexedPropertyDeleter, IndexedPropertyEnumerator, ++ IndexedPropertyDefiner, IndexedPropertyDescriptor)); ++ v8::Local instance = ++ templ->NewInstance(context()).ToLocalChecked(); ++ instance->SetAlignedPointerInInternalField(kTestIndex, this); ++ SetGlobalProperty("obj", instance); ++ } ++ ++ std::string Run(const char* script) { ++ log_is_empty_ = true; ++ log_.str(std::string()); ++ log_.clear(); ++ ++ RunJS(script); ++ return log_.str(); ++ } ++ ++ private: ++ bool log_is_empty_ = false; ++ std::stringstream log_; ++}; ++ ++TEST_F(InterceptorLoggingTest, DispatchTest) { ++ EXPECT_EQ(Run("for (var p in obj) {}"), ++ "indexed enumerator, named enumerator"); ++ EXPECT_EQ(Run("Object.keys(obj)"), "indexed enumerator, named enumerator"); ++ ++ EXPECT_EQ(Run("obj.foo"), "named getter"); ++ EXPECT_EQ(Run("obj[42]"), "indexed getter"); ++ ++ EXPECT_EQ(Run("obj.foo = null"), "named setter"); ++ EXPECT_EQ(Run("obj[42] = null"), "indexed setter"); ++ ++ EXPECT_EQ(Run("Object.getOwnPropertyDescriptor(obj, 'foo')"), ++ "named descriptor"); ++ ++ EXPECT_EQ(Run("Object.getOwnPropertyDescriptor(obj, 42)"), ++ "indexed descriptor"); ++ ++ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {value: 42})"), ++ "named descriptor, named definer, named setter"); ++ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {get(){} })"), ++ "named descriptor, named definer"); ++ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {set(value){}})"), ++ "named descriptor, named definer"); ++ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {get(){}, set(value){}})"), ++ "named descriptor, named definer"); ++ ++ EXPECT_EQ(Run("Object.defineProperty(obj, 42, {value: 'foo'})"), ++ "indexed descriptor, " ++ // then attempt definer first and fallback to setter. ++ "indexed definer, indexed setter"); ++ ++ EXPECT_EQ(Run("Object.prototype.propertyIsEnumerable.call(obj, 'a')"), ++ "named query"); ++ EXPECT_EQ(Run("Object.prototype.propertyIsEnumerable.call(obj, 42)"), ++ "indexed query"); ++ ++ EXPECT_EQ(Run("Object.prototype.hasOwnProperty.call(obj, 'a')"), ++ "named query"); ++ // TODO(cbruni): Fix once hasOnwProperty is fixed (https://crbug.com/872628) ++ EXPECT_EQ(Run("Object.prototype.hasOwnProperty.call(obj, '42')"), ""); ++} ++} // namespace ++} // namespace internal + } // namespace v8 +-- +2.17.0 + diff --git a/patches/common/v8/disable-warning-win.patch b/patches/common/v8/disable-warning-win.patch index b0755916f4..6990bd75e3 100644 --- a/patches/common/v8/disable-warning-win.patch +++ b/patches/common/v8/disable-warning-win.patch @@ -1,5 +1,12 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nitish Sakhawalkar +Date: Mon, 22 Oct 2018 10:47:12 -0700 +Subject: disable-warning-win.patch + +Disable unit test windows build warning + diff --git a/test/unittests/base/bits-unittest.cc b/test/unittests/base/bits-unittest.cc -index 45fb921797..8c9f249609 100644 +index 6f787eb72783570812f7cbda57b836df56b5f2cb..c36dfcc836d6351d11d2178a8e6c3556b3ff3422 100644 --- a/test/unittests/base/bits-unittest.cc +++ b/test/unittests/base/bits-unittest.cc @@ -13,7 +13,9 @@ @@ -13,3 +20,6 @@ index 45fb921797..8c9f249609 100644 namespace v8 { namespace base { namespace bits { +-- +2.17.0 + diff --git a/patches/common/v8/export_platform.patch b/patches/common/v8/export_platform.patch index 9541dc7822..185680c8df 100644 --- a/patches/common/v8/export_platform.patch +++ b/patches/common/v8/export_platform.patch @@ -1,5 +1,12 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Mon, 22 Oct 2018 10:47:12 -0700 +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 ddc200abab..046de4e257 100644 +index cfeb13b65829f9e0bad2518b8c4b03a645b6223c..2b38e24e233b5ba7061fd4a3d5e49063b0165f11 100644 --- a/include/v8-platform.h +++ b/include/v8-platform.h @@ -11,6 +11,7 @@ @@ -10,7 +17,7 @@ index ddc200abab..046de4e257 100644 #include "v8config.h" // NOLINT(build/include) namespace v8 { -@@ -465,7 +466,7 @@ class Platform { +@@ -387,7 +388,7 @@ class Platform { * since epoch. Useful for implementing |CurrentClockTimeMillis| if * nothing special needed. */ @@ -19,3 +26,6 @@ index ddc200abab..046de4e257 100644 }; } // namespace v8 +-- +2.17.0 + diff --git a/patches/common/v8/expose_mksnapshot.patch b/patches/common/v8/expose_mksnapshot.patch index b2357d0d4a..f595c4dcd5 100644 --- a/patches/common/v8/expose_mksnapshot.patch +++ b/patches/common/v8/expose_mksnapshot.patch @@ -1,8 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Mon, 22 Oct 2018 10:47:13 -0700 +Subject: expose_mksnapshot.patch + +Needed in order to build mksnapshot on arm. + diff --git a/BUILD.gn b/BUILD.gn -index 30e9ec34cf..fea543df9c 100644 +index d0ba5ed04e7126deae4a0ab9ee8943cda5ea42e3..b5eb09cfcb8add19f4de985cbe7b9777c51c4bd3 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -2904,8 +2904,6 @@ if (v8_monolithic) { +@@ -3130,8 +3130,6 @@ if (v8_monolithic) { if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { v8_executable("mksnapshot") { @@ -11,3 +18,6 @@ index 30e9ec34cf..fea543df9c 100644 sources = [ "src/snapshot/mksnapshot.cc", ] +-- +2.17.0 + diff --git a/patches/common/v8/node_v8_patches.patch b/patches/common/v8/node_v8_patches.patch deleted file mode 100644 index dae860f464..0000000000 --- a/patches/common/v8/node_v8_patches.patch +++ /dev/null @@ -1,3363 +0,0 @@ -From 5bb985d3312191d67490f9d826fd13cdbda610e9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Wed, 25 Jul 2018 20:03:35 +0200 -Subject: [PATCH 01/11] deps: cherry-pick 0dd3390 from upstream V8 - -Original commit message: - - Reland "[builtins] Add %IsTraceCategoryEnabled and %Trace builtins" - - This is a reland of 8d4572a22b5d2fa0547195bcc40baa18b7565386 - - Original change's description: - > [builtins] Add %IsTraceCategoryEnabled and %Trace builtins - > - > Adds the builtin Trace and IsTraceCategoryEnabled functions - > exposed via extra bindings. These are intended to use by - > embedders to allow basic trace event support from JavaScript. - > - > ```js - > isTraceCategoryEnabled('v8.some-category') - > - > trace('e'.charCodeAt(0), 'v8.some-category', - > 'Foo', 0, { abc: 'xyz'}) - > ``` - > - > Bug: v8:7851 - > Change-Id: I7bfb9bb059efdf87d92a56a0aae326650730c250 - > Reviewed-on: https://chromium-review.googlesource.com/1103294 - > Commit-Queue: Yang Guo - > Reviewed-by: Yang Guo - > Reviewed-by: Fadi Meawad - > Reviewed-by: Camillo Bruni - > Reviewed-by: Benedikt Meurer - > Cr-Commit-Position: refs/heads/master@{#54121} - - TBR=cbruni@chromium.org - - Bug: v8:7851 - Change-Id: Id063754b2834b3b6a2b2654e76e8637bcd6aa5f8 - Reviewed-on: https://chromium-review.googlesource.com/1137071 - Commit-Queue: Yang Guo - Reviewed-by: Yang Guo - Reviewed-by: Camillo Bruni - Reviewed-by: Benedikt Meurer - Cr-Commit-Position: refs/heads/master@{#54532} - -Refs: https://github.com/v8/v8/commit/0dd33901a16c7c64290b7e7ddf13945b773c5d79 - -PR-URL: https://github.com/nodejs/node/pull/21983 -Reviewed-By: Refael Ackermann -Reviewed-By: Gus Caplan -Reviewed-By: Ujjwal Sharma -Reviewed-By: Matteo Collina ---- - AUTHORS | 1 + - BUILD.gn | 1 + - src/bootstrapper.cc | 9 ++ - src/builtins/builtins-definitions.h | 6 +- - src/builtins/builtins-trace.cc | 191 ++++++++++++++++++++++++++++ - src/debug/debug-evaluate.cc | 3 + - src/messages.h | 9 +- - test/cctest/test-trace-event.cc | 134 ++++++++++++++++++- - 8 files changed, 351 insertions(+), 3 deletions(-) - create mode 100644 deps/v8/src/builtins/builtins-trace.cc - -diff --git a/AUTHORS b/AUTHORS -index b9391a0d28..3873f0ca68 100644 ---- a/AUTHORS -+++ b/AUTHORS -@@ -87,6 +87,7 @@ Jan de Mooij - Jan Krems - Jay Freeman - James Pike -+James M Snell - Jianghua Yang - Joel Stanley - Johan Bergström -diff --git a/BUILD.gn b/BUILD.gn -index 1e31acb277..4c8c8acd59 100644 ---- a/BUILD.gn -+++ b/BUILD.gn -@@ -1588,6 +1588,7 @@ v8_source_set("v8_base") { - "src/builtins/builtins-sharedarraybuffer.cc", - "src/builtins/builtins-string.cc", - "src/builtins/builtins-symbol.cc", -+ "src/builtins/builtins-trace.cc", - "src/builtins/builtins-typed-array.cc", - "src/builtins/builtins-utils.h", - "src/builtins/builtins.cc", -diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc -index 6723f3d5d4..656650cd64 100644 ---- a/src/bootstrapper.cc -+++ b/src/bootstrapper.cc -@@ -5077,6 +5077,15 @@ bool Genesis::InstallExtraNatives() { - - Handle extras_binding = - factory()->NewJSObject(isolate()->object_function()); -+ -+ // binding.isTraceCategoryEnabled(category) -+ SimpleInstallFunction(isolate(), extras_binding, "isTraceCategoryEnabled", -+ Builtins::kIsTraceCategoryEnabled, 1, true); -+ -+ // binding.trace(phase, category, name, id, data) -+ SimpleInstallFunction(isolate(), extras_binding, "trace", Builtins::kTrace, 5, -+ true); -+ - native_context()->set_extras_binding_object(*extras_binding); - - for (int i = ExtraNatives::GetDebuggerCount(); -diff --git a/src/builtins/builtins-definitions.h b/src/builtins/builtins-definitions.h -index 46b02d88d8..2d7c780c70 100644 ---- a/src/builtins/builtins-definitions.h -+++ b/src/builtins/builtins-definitions.h -@@ -1308,7 +1308,11 @@ namespace internal { - ASM(CallApiGetter) \ - ASM(DoubleToI) \ - TFC(GetProperty, GetProperty, 1) \ -- ASM(MathPowInternal) -+ ASM(MathPowInternal) \ -+ \ -+ /* Trace */ \ -+ CPP(IsTraceCategoryEnabled) \ -+ CPP(Trace) - - #ifdef V8_INTL_SUPPORT - #define BUILTIN_LIST(CPP, API, TFJ, TFC, TFS, TFH, ASM) \ -diff --git a/src/builtins/builtins-trace.cc b/src/builtins/builtins-trace.cc -new file mode 100644 -index 0000000000..cd0f5a77d0 ---- /dev/null -+++ b/src/builtins/builtins-trace.cc -@@ -0,0 +1,191 @@ -+// Copyright 2018 the V8 project authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+#include "src/api.h" -+#include "src/builtins/builtins-utils.h" -+#include "src/builtins/builtins.h" -+#include "src/counters.h" -+#include "src/json-stringifier.h" -+#include "src/objects-inl.h" -+ -+namespace v8 { -+namespace internal { -+ -+namespace { -+ -+using v8::tracing::TracedValue; -+ -+#define MAX_STACK_LENGTH 100 -+ -+class MaybeUtf8 { -+ public: -+ explicit MaybeUtf8(Isolate* isolate, Handle string) : buf_(data_) { -+ string = String::Flatten(isolate, string); -+ int len; -+ if (string->IsOneByteRepresentation()) { -+ // Technically this allows unescaped latin1 characters but the trace -+ // events mechanism currently does the same and the current consuming -+ // tools are tolerant of it. A more correct approach here would be to -+ // escape non-ascii characters but this is easier and faster. -+ len = string->length(); -+ AllocateSufficientSpace(len); -+ if (len > 0) { -+ // Why copy? Well, the trace event mechanism requires null-terminated -+ // strings, the bytes we get from SeqOneByteString are not. buf_ is -+ // guaranteed to be null terminated. -+ memcpy(buf_, Handle::cast(string)->GetChars(), len); -+ } -+ } else { -+ Local local = Utils::ToLocal(string); -+ len = local->Utf8Length(); -+ AllocateSufficientSpace(len); -+ if (len > 0) { -+ local->WriteUtf8(reinterpret_cast(buf_)); -+ } -+ } -+ buf_[len] = 0; -+ } -+ const char* operator*() const { return reinterpret_cast(buf_); } -+ -+ private: -+ void AllocateSufficientSpace(int len) { -+ if (len + 1 > MAX_STACK_LENGTH) { -+ allocated_.reset(new uint8_t[len + 1]); -+ buf_ = allocated_.get(); -+ } -+ } -+ -+ // In the most common cases, the buffer here will be stack allocated. -+ // A heap allocation will only occur if the data is more than MAX_STACK_LENGTH -+ // Given that this is used primarily for trace event categories and names, -+ // the MAX_STACK_LENGTH should be more than enough. -+ uint8_t* buf_; -+ uint8_t data_[MAX_STACK_LENGTH]; -+ std::unique_ptr allocated_; -+}; -+ -+class JsonTraceValue : public ConvertableToTraceFormat { -+ public: -+ explicit JsonTraceValue(Isolate* isolate, Handle object) { -+ // object is a JSON string serialized using JSON.stringify() from within -+ // the BUILTIN(Trace) method. This may (likely) contain UTF8 values so -+ // to grab the appropriate buffer data we have to serialize it out. We -+ // hold on to the bits until the AppendAsTraceFormat method is called. -+ MaybeUtf8 data(isolate, object); -+ data_ = *data; -+ } -+ -+ void AppendAsTraceFormat(std::string* out) const override { *out += data_; } -+ -+ private: -+ std::string data_; -+}; -+ -+const uint8_t* GetCategoryGroupEnabled(Isolate* isolate, -+ Handle string) { -+ MaybeUtf8 category(isolate, string); -+ return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(*category); -+} -+ -+#undef MAX_STACK_LENGTH -+ -+} // namespace -+ -+// Builins::kIsTraceCategoryEnabled(category) : bool -+BUILTIN(IsTraceCategoryEnabled) { -+ HandleScope scope(isolate); -+ Handle category = args.atOrUndefined(isolate, 1); -+ if (!category->IsString()) { -+ THROW_NEW_ERROR_RETURN_FAILURE( -+ isolate, NewTypeError(MessageTemplate::kTraceEventCategoryError)); -+ } -+ return isolate->heap()->ToBoolean( -+ *GetCategoryGroupEnabled(isolate, Handle::cast(category))); -+} -+ -+// Builtins::kTrace(phase, category, name, id, data) : bool -+BUILTIN(Trace) { -+ HandleScope handle_scope(isolate); -+ -+ Handle phase_arg = args.atOrUndefined(isolate, 1); -+ Handle category = args.atOrUndefined(isolate, 2); -+ Handle name_arg = args.atOrUndefined(isolate, 3); -+ Handle id_arg = args.atOrUndefined(isolate, 4); -+ Handle data_arg = args.atOrUndefined(isolate, 5); -+ -+ const uint8_t* category_group_enabled = -+ GetCategoryGroupEnabled(isolate, Handle::cast(category)); -+ -+ // Exit early if the category group is not enabled. -+ if (!*category_group_enabled) { -+ return ReadOnlyRoots(isolate).false_value(); -+ } -+ -+ if (!phase_arg->IsNumber()) { -+ THROW_NEW_ERROR_RETURN_FAILURE( -+ isolate, NewTypeError(MessageTemplate::kTraceEventPhaseError)); -+ } -+ if (!category->IsString()) { -+ THROW_NEW_ERROR_RETURN_FAILURE( -+ isolate, NewTypeError(MessageTemplate::kTraceEventCategoryError)); -+ } -+ if (!name_arg->IsString()) { -+ THROW_NEW_ERROR_RETURN_FAILURE( -+ isolate, NewTypeError(MessageTemplate::kTraceEventNameError)); -+ } -+ -+ uint32_t flags = TRACE_EVENT_FLAG_COPY; -+ int32_t id = 0; -+ if (!id_arg->IsNullOrUndefined(isolate)) { -+ if (!id_arg->IsNumber()) { -+ THROW_NEW_ERROR_RETURN_FAILURE( -+ isolate, NewTypeError(MessageTemplate::kTraceEventIDError)); -+ } -+ flags |= TRACE_EVENT_FLAG_HAS_ID; -+ id = DoubleToInt32(id_arg->Number()); -+ } -+ -+ Handle name_str = Handle::cast(name_arg); -+ if (name_str->length() == 0) { -+ THROW_NEW_ERROR_RETURN_FAILURE( -+ isolate, NewTypeError(MessageTemplate::kTraceEventNameLengthError)); -+ } -+ MaybeUtf8 name(isolate, name_str); -+ -+ // We support passing one additional trace event argument with the -+ // name "data". Any JSON serializable value may be passed. -+ static const char* arg_name = "data"; -+ int32_t num_args = 0; -+ uint8_t arg_type; -+ uint64_t arg_value; -+ -+ if (!data_arg->IsUndefined(isolate)) { -+ // Serializes the data argument as a JSON string, which is then -+ // copied into an object. This eliminates duplicated code but -+ // could have perf costs. It is also subject to all the same -+ // limitations as JSON.stringify() as it relates to circular -+ // references and value limitations (e.g. BigInt is not supported). -+ JsonStringifier stringifier(isolate); -+ Handle result; -+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( -+ isolate, result, -+ stringifier.Stringify(data_arg, isolate->factory()->undefined_value(), -+ isolate->factory()->undefined_value())); -+ std::unique_ptr traced_value; -+ traced_value.reset( -+ new JsonTraceValue(isolate, Handle::cast(result))); -+ tracing::SetTraceValue(std::move(traced_value), &arg_type, &arg_value); -+ num_args++; -+ } -+ -+ TRACE_EVENT_API_ADD_TRACE_EVENT( -+ static_cast(DoubleToInt32(phase_arg->Number())), -+ category_group_enabled, *name, tracing::kGlobalScope, id, tracing::kNoId, -+ num_args, &arg_name, &arg_type, &arg_value, flags); -+ -+ return ReadOnlyRoots(isolate).true_value(); -+} -+ -+} // namespace internal -+} // namespace v8 -diff --git a/src/debug/debug-evaluate.cc b/src/debug/debug-evaluate.cc -index 0dd2303772..d263fa45a9 100644 ---- a/src/debug/debug-evaluate.cc -+++ b/src/debug/debug-evaluate.cc -@@ -567,6 +567,9 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) { - case Builtins::kArrayMap: - case Builtins::kArrayReduce: - case Builtins::kArrayReduceRight: -+ // Trace builtins. -+ case Builtins::kIsTraceCategoryEnabled: -+ case Builtins::kTrace: - // TypedArray builtins. - case Builtins::kTypedArrayConstructor: - case Builtins::kTypedArrayPrototypeBuffer: -diff --git a/src/messages.h b/src/messages.h -index 1d1a07d7b6..68078bb373 100644 ---- a/src/messages.h -+++ b/src/messages.h -@@ -757,7 +757,14 @@ class ErrorUtils : public AllStatic { - T(DataCloneDeserializationError, "Unable to deserialize cloned data.") \ - T(DataCloneDeserializationVersionError, \ - "Unable to deserialize cloned data due to invalid or unsupported " \ -- "version.") -+ "version.") \ -+ /* Builtins-Trace Errors */ \ -+ T(TraceEventCategoryError, "Trace event category must be a string.") \ -+ T(TraceEventNameError, "Trace event name must be a string.") \ -+ T(TraceEventNameLengthError, \ -+ "Trace event name must not be an empty string.") \ -+ T(TraceEventPhaseError, "Trace event phase must be a number.") \ -+ T(TraceEventIDError, "Trace event id must be a number.") - - class MessageTemplate { - public: -diff --git a/test/cctest/test-trace-event.cc b/test/cctest/test-trace-event.cc -index 7b736b907d..47545af37f 100644 ---- a/test/cctest/test-trace-event.cc -+++ b/test/cctest/test-trace-event.cc -@@ -75,7 +75,7 @@ class MockTracingController : public v8::TracingController { - const char* name, uint64_t handle) override {} - - const uint8_t* GetCategoryGroupEnabled(const char* name) override { -- if (strcmp(name, "v8-cat")) { -+ if (strncmp(name, "v8-cat", 6)) { - static uint8_t no = 0; - return &no; - } else { -@@ -282,3 +282,135 @@ TEST(TestEventWithTimestamp) { - CHECK_EQ(20683, GET_TRACE_OBJECT(3)->timestamp); - CHECK_EQ(32832, GET_TRACE_OBJECT(4)->timestamp); - } -+ -+TEST(BuiltinsIsTraceCategoryEnabled) { -+ CcTest::InitializeVM(); -+ MockTracingPlatform platform; -+ -+ v8::Isolate* isolate = CcTest::isolate(); -+ v8::HandleScope handle_scope(isolate); -+ LocalContext env; -+ -+ v8::Local binding = env->GetExtrasBindingObject(); -+ CHECK(!binding.IsEmpty()); -+ -+ auto undefined = v8::Undefined(isolate); -+ auto isTraceCategoryEnabled = -+ binding->Get(env.local(), v8_str("isTraceCategoryEnabled")) -+ .ToLocalChecked() -+ .As(); -+ -+ { -+ // Test with an enabled category -+ v8::Local argv[] = {v8_str("v8-cat")}; -+ auto result = isTraceCategoryEnabled->Call(env.local(), undefined, 1, argv) -+ .ToLocalChecked() -+ .As(); -+ -+ CHECK(result->BooleanValue()); -+ } -+ -+ { -+ // Test with a disabled category -+ v8::Local argv[] = {v8_str("cat")}; -+ auto result = isTraceCategoryEnabled->Call(env.local(), undefined, 1, argv) -+ .ToLocalChecked() -+ .As(); -+ -+ CHECK(!result->BooleanValue()); -+ } -+ -+ { -+ // Test with an enabled utf8 category -+ v8::Local argv[] = {v8_str("v8-cat\u20ac")}; -+ auto result = isTraceCategoryEnabled->Call(env.local(), undefined, 1, argv) -+ .ToLocalChecked() -+ .As(); -+ -+ CHECK(result->BooleanValue()); -+ } -+} -+ -+TEST(BuiltinsTrace) { -+ CcTest::InitializeVM(); -+ MockTracingPlatform platform; -+ -+ v8::Isolate* isolate = CcTest::isolate(); -+ v8::HandleScope handle_scope(isolate); -+ LocalContext env; -+ -+ v8::Local binding = env->GetExtrasBindingObject(); -+ CHECK(!binding.IsEmpty()); -+ -+ auto undefined = v8::Undefined(isolate); -+ auto trace = binding->Get(env.local(), v8_str("trace")) -+ .ToLocalChecked() -+ .As(); -+ -+ // Test with disabled category -+ { -+ v8::Local category = v8_str("cat"); -+ v8::Local name = v8_str("name"); -+ v8::Local argv[] = { -+ v8::Integer::New(isolate, 'b'), // phase -+ category, name, v8::Integer::New(isolate, 0), // id -+ undefined // data -+ }; -+ auto result = trace->Call(env.local(), undefined, 5, argv) -+ .ToLocalChecked() -+ .As(); -+ -+ CHECK(!result->BooleanValue()); -+ CHECK_EQ(0, GET_TRACE_OBJECTS_LIST->size()); -+ } -+ -+ // Test with enabled category -+ { -+ v8::Local category = v8_str("v8-cat"); -+ v8::Local name = v8_str("name"); -+ v8::Local context = isolate->GetCurrentContext(); -+ v8::Local data = v8::Object::New(isolate); -+ data->Set(context, v8_str("foo"), v8_str("bar")).FromJust(); -+ v8::Local argv[] = { -+ v8::Integer::New(isolate, 'b'), // phase -+ category, name, v8::Integer::New(isolate, 123), // id -+ data // data arg -+ }; -+ auto result = trace->Call(env.local(), undefined, 5, argv) -+ .ToLocalChecked() -+ .As(); -+ -+ CHECK(result->BooleanValue()); -+ CHECK_EQ(1, GET_TRACE_OBJECTS_LIST->size()); -+ -+ CHECK_EQ(123, GET_TRACE_OBJECT(0)->id); -+ CHECK_EQ('b', GET_TRACE_OBJECT(0)->phase); -+ CHECK_EQ("name", GET_TRACE_OBJECT(0)->name); -+ CHECK_EQ(1, GET_TRACE_OBJECT(0)->num_args); -+ } -+ -+ // Test with enabled utf8 category -+ { -+ v8::Local category = v8_str("v8-cat\u20ac"); -+ v8::Local name = v8_str("name\u20ac"); -+ v8::Local context = isolate->GetCurrentContext(); -+ v8::Local data = v8::Object::New(isolate); -+ data->Set(context, v8_str("foo"), v8_str("bar")).FromJust(); -+ v8::Local argv[] = { -+ v8::Integer::New(isolate, 'b'), // phase -+ category, name, v8::Integer::New(isolate, 123), // id -+ data // data arg -+ }; -+ auto result = trace->Call(env.local(), undefined, 5, argv) -+ .ToLocalChecked() -+ .As(); -+ -+ CHECK(result->BooleanValue()); -+ CHECK_EQ(2, GET_TRACE_OBJECTS_LIST->size()); -+ -+ CHECK_EQ(123, GET_TRACE_OBJECT(1)->id); -+ CHECK_EQ('b', GET_TRACE_OBJECT(1)->phase); -+ CHECK_EQ("name\u20ac", GET_TRACE_OBJECT(1)->name); -+ CHECK_EQ(1, GET_TRACE_OBJECT(1)->num_args); -+ } -+} --- -2.17.0 - - -From 127e7035ce70e70bdb62969f965d6941156c042c Mon Sep 17 00:00:00 2001 -From: Matheus Marchini -Date: Wed, 1 Aug 2018 15:09:51 -0300 -Subject: [PATCH 02/11] deps: cherry-pick 09bca09 from upstream V8 - -Original commit message: - - [postmortem] add ScopeInfo and Context types - - The metadata introduced in this patch will be useful for postmortem - tools to inspect Contexts and ScopeInfos (see - https://github.com/nodejs/llnode/issues/211). - - R=bmeurer@google.com, yangguo@google.com - - Change-Id: I927fcab4014d128bd782046c1ecb9ee045723e95 - Reviewed-on: https://chromium-review.googlesource.com/1153858 - Reviewed-by: Yang Guo - Commit-Queue: Yang Guo - Cr-Commit-Position: refs/heads/master@{#54768} - -Refs: https://github.com/v8/v8/commit/09bca095e38d6e4770ae48e174f59d33c - -PR-URL: https://github.com/nodejs/node/pull/22068 -Reviewed-By: James M Snell -Reviewed-By: Ruben Bridgewater ---- - BUILD.gn | 1 + - tools/gen-postmortem-metadata.py | 5 ++++- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/BUILD.gn b/BUILD.gn -index 4c8c8acd59..443694d880 100644 ---- a/BUILD.gn -+++ b/BUILD.gn -@@ -852,6 +852,7 @@ action("postmortem-metadata") { - "src/objects/js-regexp-string-iterator.h", - "src/objects/map.h", - "src/objects/map-inl.h", -+ "src/objects/scope-info.h", - "src/objects/script.h", - "src/objects/script-inl.h", - "src/objects/shared-function-info.h", -diff --git a/tools/gen-postmortem-metadata.py b/tools/gen-postmortem-metadata.py -index d8ef7b4a15..8191c8152f 100644 ---- a/tools/gen-postmortem-metadata.py -+++ b/tools/gen-postmortem-metadata.py -@@ -58,6 +58,9 @@ consts_misc = [ - { 'name': 'APIObjectType', 'value': 'JS_API_OBJECT_TYPE' }, - { 'name': 'SpecialAPIObjectType', 'value': 'JS_SPECIAL_API_OBJECT_TYPE' }, - -+ { 'name': 'FirstContextType', 'value': 'FIRST_CONTEXT_TYPE' }, -+ { 'name': 'LastContextType', 'value': 'LAST_CONTEXT_TYPE' }, -+ - { 'name': 'IsNotStringMask', 'value': 'kIsNotStringMask' }, - { 'name': 'StringTag', 'value': 'kStringTag' }, - -@@ -282,7 +285,7 @@ extras_accessors = [ - expected_classes = [ - 'ConsString', 'FixedArray', 'HeapNumber', 'JSArray', 'JSFunction', - 'JSObject', 'JSRegExp', 'JSValue', 'Map', 'Oddball', 'Script', -- 'SeqOneByteString', 'SharedFunctionInfo' -+ 'SeqOneByteString', 'SharedFunctionInfo', 'ScopeInfo' - ]; - - --- -2.17.0 - - -From 8dc159658c97ff04dfc08ff5bfcd1a1a17b98430 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Sun, 19 Aug 2018 21:53:40 +0200 -Subject: [PATCH 03/11] deps: cherry-pick c608122 from upstream V8 - -Original commit message: - - [api][keys] Allow skipping indices for Proxies with GetPropertyNames - - Bug: v8:7942 - Change-Id: I7b3740b04cbcaa56dc809150900ab8d821b054ce - Reviewed-on: https://chromium-review.googlesource.com/1156544 - Reviewed-by: Toon Verwaest - Commit-Queue: Camillo Bruni - Cr-Commit-Position: refs/heads/master@{#54821} - -Refs: https://github.com/v8/v8/commit/c608122b85238397a43910246f5ff218eb43fb24 - -PR-URL: https://github.com/nodejs/node/pull/21983 -Reviewed-By: Refael Ackermann -Reviewed-By: Gus Caplan -Reviewed-By: Ujjwal Sharma -Reviewed-By: Matteo Collina ---- - src/keys.cc | 48 +++++++++++------- - src/keys.h | 14 ++++-- - src/runtime/runtime-forin.cc | 3 +- - test/cctest/test-api.cc | 97 +++++++++++++++++++++++++++++++++++- - 4 files changed, 136 insertions(+), 26 deletions(-) - -diff --git a/src/keys.cc b/src/keys.cc -index 8ecbe0a1d7..689f4ac3df 100644 ---- a/src/keys.cc -+++ b/src/keys.cc -@@ -38,10 +38,10 @@ static bool ContainsOnlyValidKeys(Handle array) { - // static - MaybeHandle KeyAccumulator::GetKeys( - Handle object, KeyCollectionMode mode, PropertyFilter filter, -- GetKeysConversion keys_conversion, bool is_for_in) { -+ GetKeysConversion keys_conversion, bool is_for_in, bool skip_indices) { - Isolate* isolate = object->GetIsolate(); -- FastKeyAccumulator accumulator(isolate, object, mode, filter); -- accumulator.set_is_for_in(is_for_in); -+ FastKeyAccumulator accumulator(isolate, object, mode, filter, is_for_in, -+ skip_indices); - return accumulator.GetKeys(keys_conversion); - } - -@@ -355,7 +355,8 @@ Handle GetFastEnumPropertyKeys(Isolate* isolate, - template - MaybeHandle GetOwnKeysWithElements(Isolate* isolate, - Handle object, -- GetKeysConversion convert) { -+ GetKeysConversion convert, -+ bool skip_indices) { - Handle keys; - ElementsAccessor* accessor = object->GetElementsAccessor(); - if (fast_properties) { -@@ -364,8 +365,14 @@ MaybeHandle GetOwnKeysWithElements(Isolate* isolate, - // TODO(cbruni): preallocate big enough array to also hold elements. - keys = KeyAccumulator::GetOwnEnumPropertyKeys(isolate, object); - } -- MaybeHandle result = -- accessor->PrependElementIndices(object, keys, convert, ONLY_ENUMERABLE); -+ -+ MaybeHandle result; -+ if (skip_indices) { -+ result = keys; -+ } else { -+ result = -+ accessor->PrependElementIndices(object, keys, convert, ONLY_ENUMERABLE); -+ } - - if (FLAG_trace_for_in_enumerate) { - PrintF("| strings=%d symbols=0 elements=%u || prototypes>=1 ||\n", -@@ -403,7 +410,8 @@ MaybeHandle FastKeyAccumulator::GetKeysFast( - - // Do not try to use the enum-cache for dict-mode objects. - if (map->is_dictionary_map()) { -- return GetOwnKeysWithElements(isolate_, object, keys_conversion); -+ return GetOwnKeysWithElements(isolate_, object, keys_conversion, -+ skip_indices_); - } - int enum_length = receiver_->map()->EnumLength(); - if (enum_length == kInvalidEnumCacheSentinel) { -@@ -421,7 +429,8 @@ MaybeHandle FastKeyAccumulator::GetKeysFast( - } - // The properties-only case failed because there were probably elements on the - // receiver. -- return GetOwnKeysWithElements(isolate_, object, keys_conversion); -+ return GetOwnKeysWithElements(isolate_, object, keys_conversion, -+ skip_indices_); - } - - MaybeHandle -@@ -450,6 +459,7 @@ MaybeHandle FastKeyAccumulator::GetKeysSlow( - GetKeysConversion keys_conversion) { - KeyAccumulator accumulator(isolate_, mode_, filter_); - accumulator.set_is_for_in(is_for_in_); -+ accumulator.set_skip_indices(skip_indices_); - accumulator.set_last_non_empty_prototype(last_non_empty_prototype_); - - MAYBE_RETURN(accumulator.CollectKeys(receiver_, receiver_), -@@ -699,13 +709,15 @@ Maybe KeyAccumulator::CollectOwnPropertyNames(Handle receiver, - Maybe KeyAccumulator::CollectAccessCheckInterceptorKeys( - Handle access_check_info, Handle receiver, - Handle object) { -- MAYBE_RETURN((CollectInterceptorKeysInternal( -- receiver, object, -- handle(InterceptorInfo::cast( -- access_check_info->indexed_interceptor()), -- isolate_), -- this, kIndexed)), -- Nothing()); -+ if (!skip_indices_) { -+ MAYBE_RETURN((CollectInterceptorKeysInternal( -+ receiver, object, -+ handle(InterceptorInfo::cast( -+ access_check_info->indexed_interceptor()), -+ isolate_), -+ this, kIndexed)), -+ Nothing()); -+ } - MAYBE_RETURN( - (CollectInterceptorKeysInternal( - receiver, object, -@@ -942,9 +954,9 @@ Maybe KeyAccumulator::CollectOwnJSProxyTargetKeys( - Handle keys; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate_, keys, -- KeyAccumulator::GetKeys(target, KeyCollectionMode::kOwnOnly, -- ALL_PROPERTIES, -- GetKeysConversion::kConvertToString, is_for_in_), -+ KeyAccumulator::GetKeys( -+ target, KeyCollectionMode::kOwnOnly, ALL_PROPERTIES, -+ GetKeysConversion::kConvertToString, is_for_in_, skip_indices_), - Nothing()); - Maybe result = AddKeysFromJSProxy(proxy, keys); - return result; -diff --git a/src/keys.h b/src/keys.h -index 649d6a9599..5abbaac5cd 100644 ---- a/src/keys.h -+++ b/src/keys.h -@@ -40,7 +40,7 @@ class KeyAccumulator final BASE_EMBEDDED { - static MaybeHandle GetKeys( - Handle object, KeyCollectionMode mode, PropertyFilter filter, - GetKeysConversion keys_conversion = GetKeysConversion::kKeepNumbers, -- bool is_for_in = false); -+ bool is_for_in = false, bool skip_indices = false); - - Handle GetKeys( - GetKeysConversion convert = GetKeysConversion::kKeepNumbers); -@@ -128,14 +128,19 @@ class KeyAccumulator final BASE_EMBEDDED { - class FastKeyAccumulator { - public: - FastKeyAccumulator(Isolate* isolate, Handle receiver, -- KeyCollectionMode mode, PropertyFilter filter) -- : isolate_(isolate), receiver_(receiver), mode_(mode), filter_(filter) { -+ KeyCollectionMode mode, PropertyFilter filter, -+ bool is_for_in = false, bool skip_indices = false) -+ : isolate_(isolate), -+ receiver_(receiver), -+ mode_(mode), -+ filter_(filter), -+ is_for_in_(is_for_in), -+ skip_indices_(skip_indices) { - Prepare(); - } - - bool is_receiver_simple_enum() { return is_receiver_simple_enum_; } - bool has_empty_prototype() { return has_empty_prototype_; } -- void set_is_for_in(bool value) { is_for_in_ = value; } - - MaybeHandle GetKeys( - GetKeysConversion convert = GetKeysConversion::kKeepNumbers); -@@ -153,6 +158,7 @@ class FastKeyAccumulator { - KeyCollectionMode mode_; - PropertyFilter filter_; - bool is_for_in_ = false; -+ bool skip_indices_ = false; - bool is_receiver_simple_enum_ = false; - bool has_empty_prototype_ = false; - -diff --git a/src/runtime/runtime-forin.cc b/src/runtime/runtime-forin.cc -index 5df16faf46..ed1e226060 100644 ---- a/src/runtime/runtime-forin.cc -+++ b/src/runtime/runtime-forin.cc -@@ -26,8 +26,7 @@ MaybeHandle Enumerate(Isolate* isolate, - JSObject::MakePrototypesFast(receiver, kStartAtReceiver, isolate); - FastKeyAccumulator accumulator(isolate, receiver, - KeyCollectionMode::kIncludePrototypes, -- ENUMERABLE_STRINGS); -- accumulator.set_is_for_in(true); -+ ENUMERABLE_STRINGS, true); - // Test if we have an enum cache for {receiver}. - if (!accumulator.is_receiver_simple_enum()) { - Handle keys; -diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc -index d5d1ae101b..a018e12853 100644 ---- a/test/cctest/test-api.cc -+++ b/test/cctest/test-api.cc -@@ -15360,14 +15360,107 @@ THREADED_TEST(PropertyEnumeration2) { - } - } - --THREADED_TEST(PropertyNames) { -+THREADED_TEST(GetPropertyNames) { - LocalContext context; - v8::Isolate* isolate = context->GetIsolate(); - v8::HandleScope scope(isolate); - v8::Local result = CompileRun( - "var result = {0: 0, 1: 1, a: 2, b: 3};" - "result[Symbol('symbol')] = true;" -- "result.__proto__ = {2: 4, 3: 5, c: 6, d: 7};" -+ "result.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};" -+ "result;"); -+ v8::Local object = result.As(); -+ v8::PropertyFilter default_filter = -+ static_cast(v8::ONLY_ENUMERABLE | v8::SKIP_SYMBOLS); -+ v8::PropertyFilter include_symbols_filter = v8::ONLY_ENUMERABLE; -+ -+ v8::Local properties = -+ object->GetPropertyNames(context.local()).ToLocalChecked(); -+ const char* expected_properties1[] = {"0", "1", "a", "b", "2", "3", "c", "d"}; -+ CheckStringArray(isolate, properties, 8, expected_properties1); -+ -+ properties = -+ object -+ ->GetPropertyNames(context.local(), -+ v8::KeyCollectionMode::kIncludePrototypes, -+ default_filter, v8::IndexFilter::kIncludeIndices) -+ .ToLocalChecked(); -+ CheckStringArray(isolate, properties, 8, expected_properties1); -+ -+ properties = object -+ ->GetPropertyNames(context.local(), -+ v8::KeyCollectionMode::kIncludePrototypes, -+ include_symbols_filter, -+ v8::IndexFilter::kIncludeIndices) -+ .ToLocalChecked(); -+ const char* expected_properties1_1[] = {"0", "1", "a", "b", nullptr, -+ "2", "3", "c", "d"}; -+ CheckStringArray(isolate, properties, 9, expected_properties1_1); -+ CheckIsSymbolAt(isolate, properties, 4, "symbol"); -+ -+ properties = -+ object -+ ->GetPropertyNames(context.local(), -+ v8::KeyCollectionMode::kIncludePrototypes, -+ default_filter, v8::IndexFilter::kSkipIndices) -+ .ToLocalChecked(); -+ const char* expected_properties2[] = {"a", "b", "c", "d"}; -+ CheckStringArray(isolate, properties, 4, expected_properties2); -+ -+ properties = object -+ ->GetPropertyNames(context.local(), -+ v8::KeyCollectionMode::kIncludePrototypes, -+ include_symbols_filter, -+ v8::IndexFilter::kSkipIndices) -+ .ToLocalChecked(); -+ const char* expected_properties2_1[] = {"a", "b", nullptr, "c", "d"}; -+ CheckStringArray(isolate, properties, 5, expected_properties2_1); -+ CheckIsSymbolAt(isolate, properties, 2, "symbol"); -+ -+ properties = -+ object -+ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly, -+ default_filter, v8::IndexFilter::kIncludeIndices) -+ .ToLocalChecked(); -+ const char* expected_properties3[] = {"0", "1", "a", "b"}; -+ CheckStringArray(isolate, properties, 4, expected_properties3); -+ -+ properties = object -+ ->GetPropertyNames( -+ context.local(), v8::KeyCollectionMode::kOwnOnly, -+ include_symbols_filter, v8::IndexFilter::kIncludeIndices) -+ .ToLocalChecked(); -+ const char* expected_properties3_1[] = {"0", "1", "a", "b", nullptr}; -+ CheckStringArray(isolate, properties, 5, expected_properties3_1); -+ CheckIsSymbolAt(isolate, properties, 4, "symbol"); -+ -+ properties = -+ object -+ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly, -+ default_filter, v8::IndexFilter::kSkipIndices) -+ .ToLocalChecked(); -+ const char* expected_properties4[] = {"a", "b"}; -+ CheckStringArray(isolate, properties, 2, expected_properties4); -+ -+ properties = object -+ ->GetPropertyNames( -+ context.local(), v8::KeyCollectionMode::kOwnOnly, -+ include_symbols_filter, v8::IndexFilter::kSkipIndices) -+ .ToLocalChecked(); -+ const char* expected_properties4_1[] = {"a", "b", nullptr}; -+ CheckStringArray(isolate, properties, 3, expected_properties4_1); -+ CheckIsSymbolAt(isolate, properties, 2, "symbol"); -+} -+ -+THREADED_TEST(ProxyGetPropertyNames) { -+ LocalContext context; -+ v8::Isolate* isolate = context->GetIsolate(); -+ v8::HandleScope scope(isolate); -+ v8::Local result = CompileRun( -+ "var target = {0: 0, 1: 1, a: 2, b: 3};" -+ "target[Symbol('symbol')] = true;" -+ "target.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};" -+ "var result = new Proxy(target, {});" - "result;"); - v8::Local object = result.As(); - v8::PropertyFilter default_filter = --- -2.17.0 - - -From 56d7411be3c70a3e99cbc60aadee06bbc99a233e Mon Sep 17 00:00:00 2001 -From: Camillo Bruni -Date: Sat, 18 Aug 2018 13:41:51 -0400 -Subject: [PATCH 04/11] deps: cherry-pick e1a7699 from upstream V8 - -Original commit message: - - [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration - - - Explicitly allows construction of - {Named,Indexed}PropertyHandlerConfiguration with all the members filled. - - Bug: v8:7612 - Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng - Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded - Reviewed-on: https://chromium-review.googlesource.com/1163882 - Reviewed-by: Toon Verwaest - Reviewed-by: Adam Klein - Commit-Queue: Camillo Bruni - Cr-Commit-Position: refs/heads/master@{#55142} - -PR-URL: https://github.com/nodejs/node/pull/22390 -Fixes: https://github.com/nodejs/node/issues/17480 -Fixes: https://github.com/nodejs/node/issues/17481 -Refs: https://github.com/v8/v8/commit/e1a76995ef311eb3ca66e12ef1941ed596034d59 -Reviewed-By: Anna Henningsen -Reviewed-By: Gus Caplan -Reviewed-By: James M Snell ---- - include/v8.h | 39 +++++ - src/api.cc | 4 - - src/objects.cc | 63 ++++---- - test/unittests/api/interceptor-unittest.cc | 176 +++++++++++++++++++++ - 4 files changed, 247 insertions(+), 35 deletions(-) - -diff --git a/include/v8.h b/include/v8.h -index 23d5ba36db..20a65afcbc 100644 ---- a/include/v8.h -+++ b/include/v8.h -@@ -5994,6 +5994,26 @@ enum class PropertyHandlerFlags { - }; - - struct NamedPropertyHandlerConfiguration { -+ NamedPropertyHandlerConfiguration( -+ GenericNamedPropertyGetterCallback getter, -+ GenericNamedPropertySetterCallback setter, -+ GenericNamedPropertyQueryCallback query, -+ GenericNamedPropertyDeleterCallback deleter, -+ GenericNamedPropertyEnumeratorCallback enumerator, -+ GenericNamedPropertyDefinerCallback definer, -+ GenericNamedPropertyDescriptorCallback descriptor, -+ Local data = Local(), -+ PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) -+ : getter(getter), -+ setter(setter), -+ query(query), -+ deleter(deleter), -+ enumerator(enumerator), -+ definer(definer), -+ descriptor(descriptor), -+ data(data), -+ flags(flags) {} -+ - NamedPropertyHandlerConfiguration( - /** Note: getter is required */ - GenericNamedPropertyGetterCallback getter = 0, -@@ -6045,6 +6065,25 @@ struct NamedPropertyHandlerConfiguration { - - - struct IndexedPropertyHandlerConfiguration { -+ IndexedPropertyHandlerConfiguration( -+ IndexedPropertyGetterCallback getter, -+ IndexedPropertySetterCallback setter, IndexedPropertyQueryCallback query, -+ IndexedPropertyDeleterCallback deleter, -+ IndexedPropertyEnumeratorCallback enumerator, -+ IndexedPropertyDefinerCallback definer, -+ IndexedPropertyDescriptorCallback descriptor, -+ Local data = Local(), -+ PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) -+ : getter(getter), -+ setter(setter), -+ query(query), -+ deleter(deleter), -+ enumerator(enumerator), -+ definer(definer), -+ descriptor(descriptor), -+ data(data), -+ flags(flags) {} -+ - IndexedPropertyHandlerConfiguration( - /** Note: getter is required */ - IndexedPropertyGetterCallback getter = 0, -diff --git a/src/api.cc b/src/api.cc -index 7c569e3a9f..6155cbb325 100644 ---- a/src/api.cc -+++ b/src/api.cc -@@ -1879,10 +1879,6 @@ static i::Handle CreateInterceptorInfo( - i::Isolate* isolate, Getter getter, Setter setter, Query query, - Descriptor descriptor, Deleter remover, Enumerator enumerator, - Definer definer, Local data, PropertyHandlerFlags flags) { -- // Either intercept attributes or descriptor. -- DCHECK(query == nullptr || descriptor == nullptr); -- // Only use descriptor callback with definer callback. -- DCHECK(query == nullptr || definer == nullptr); - auto obj = i::Handle::cast( - isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE, i::TENURED)); - obj->set_flags(0); -diff --git a/src/objects.cc b/src/objects.cc -index 01421bacc4..0aac39d304 100644 ---- a/src/objects.cc -+++ b/src/objects.cc -@@ -7817,41 +7817,42 @@ Maybe GetPropertyDescriptorWithInterceptor(LookupIterator* it, - } - } - -- if (it->state() == LookupIterator::INTERCEPTOR) { -- Isolate* isolate = it->isolate(); -- Handle interceptor = it->GetInterceptor(); -- if (!interceptor->descriptor()->IsUndefined(isolate)) { -- Handle result; -- Handle holder = it->GetHolder(); -+ if (it->state() != LookupIterator::INTERCEPTOR) return Just(false); - -- Handle receiver = it->GetReceiver(); -- if (!receiver->IsJSReceiver()) { -- ASSIGN_RETURN_ON_EXCEPTION_VALUE( -- isolate, receiver, Object::ConvertReceiver(isolate, receiver), -- Nothing()); -- } -+ Isolate* isolate = it->isolate(); -+ Handle interceptor = it->GetInterceptor(); -+ if (interceptor->descriptor()->IsUndefined(isolate)) return Just(false); - -- PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, -- *holder, kDontThrow); -- if (it->IsElement()) { -- result = args.CallIndexedDescriptor(interceptor, it->index()); -- } else { -- result = args.CallNamedDescriptor(interceptor, it->name()); -- } -- if (!result.is_null()) { -- // Request successfully intercepted, try to set the property -- // descriptor. -- Utils::ApiCheck( -- PropertyDescriptor::ToPropertyDescriptor(isolate, result, desc), -- it->IsElement() ? "v8::IndexedPropertyDescriptorCallback" -- : "v8::NamedPropertyDescriptorCallback", -- "Invalid property descriptor."); -+ Handle result; -+ Handle holder = it->GetHolder(); - -- return Just(true); -- } -- it->Next(); -- } -+ Handle receiver = it->GetReceiver(); -+ if (!receiver->IsJSReceiver()) { -+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, -+ Object::ConvertReceiver(isolate, receiver), -+ Nothing()); -+ } -+ -+ PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, -+ *holder, kDontThrow); -+ if (it->IsElement()) { -+ result = args.CallIndexedDescriptor(interceptor, it->index()); -+ } else { -+ result = args.CallNamedDescriptor(interceptor, it->name()); - } -+ if (!result.is_null()) { -+ // Request successfully intercepted, try to set the property -+ // descriptor. -+ Utils::ApiCheck( -+ PropertyDescriptor::ToPropertyDescriptor(isolate, result, desc), -+ it->IsElement() ? "v8::IndexedPropertyDescriptorCallback" -+ : "v8::NamedPropertyDescriptorCallback", -+ "Invalid property descriptor."); -+ -+ return Just(true); -+ } -+ -+ it->Next(); - return Just(false); - } - } // namespace -diff --git a/test/unittests/api/interceptor-unittest.cc b/test/unittests/api/interceptor-unittest.cc -index 2f9f0e459e..b13384f18a 100644 ---- a/test/unittests/api/interceptor-unittest.cc -+++ b/test/unittests/api/interceptor-unittest.cc -@@ -29,4 +29,180 @@ TEST_F(InterceptorTest, FreezeApiObjectWithInterceptor) { - } - - } // namespace -+ -+namespace internal { -+namespace { -+ -+class InterceptorLoggingTest : public TestWithNativeContext { -+ public: -+ InterceptorLoggingTest() {} -+ -+ static const int kTestIndex = 0; -+ -+ static void NamedPropertyGetter(Local name, -+ const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "named getter"); -+ } -+ -+ static void NamedPropertySetter(Local name, Local value, -+ const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "named setter"); -+ } -+ -+ static void NamedPropertyQuery( -+ Local name, const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "named query"); -+ } -+ -+ static void NamedPropertyDeleter( -+ Local name, const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "named deleter"); -+ } -+ -+ static void NamedPropertyEnumerator( -+ const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "named enumerator"); -+ } -+ -+ static void NamedPropertyDefiner( -+ Local name, const v8::PropertyDescriptor& desc, -+ const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "named definer"); -+ } -+ -+ static void NamedPropertyDescriptor( -+ Local name, const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "named descriptor"); -+ } -+ -+ static void IndexedPropertyGetter( -+ uint32_t index, const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "indexed getter"); -+ } -+ -+ static void IndexedPropertySetter( -+ uint32_t index, Local value, -+ const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "indexed setter"); -+ } -+ -+ static void IndexedPropertyQuery( -+ uint32_t index, const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "indexed query"); -+ } -+ -+ static void IndexedPropertyDeleter( -+ uint32_t index, const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "indexed deleter"); -+ } -+ -+ static void IndexedPropertyEnumerator( -+ const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "indexed enumerator"); -+ } -+ -+ static void IndexedPropertyDefiner( -+ uint32_t index, const v8::PropertyDescriptor& desc, -+ const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "indexed definer"); -+ } -+ -+ static void IndexedPropertyDescriptor( -+ uint32_t index, const v8::PropertyCallbackInfo& info) { -+ LogCallback(info, "indexed descriptor"); -+ } -+ -+ template -+ static void LogCallback(const v8::PropertyCallbackInfo& info, -+ const char* callback_name) { -+ InterceptorLoggingTest* test = reinterpret_cast( -+ info.This()->GetAlignedPointerFromInternalField(kTestIndex)); -+ test->Log(callback_name); -+ } -+ -+ void Log(const char* callback_name) { -+ if (log_is_empty_) { -+ log_is_empty_ = false; -+ } else { -+ log_ << ", "; -+ } -+ log_ << callback_name; -+ } -+ -+ protected: -+ void SetUp() override { -+ // Set up the object that supports full interceptors. -+ v8::Local templ = v8::ObjectTemplate::New(v8_isolate()); -+ templ->SetInternalFieldCount(1); -+ templ->SetHandler(v8::NamedPropertyHandlerConfiguration( -+ NamedPropertyGetter, NamedPropertySetter, NamedPropertyQuery, -+ NamedPropertyDeleter, NamedPropertyEnumerator, NamedPropertyDefiner, -+ NamedPropertyDescriptor)); -+ templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( -+ IndexedPropertyGetter, IndexedPropertySetter, IndexedPropertyQuery, -+ IndexedPropertyDeleter, IndexedPropertyEnumerator, -+ IndexedPropertyDefiner, IndexedPropertyDescriptor)); -+ v8::Local instance = -+ templ->NewInstance(context()).ToLocalChecked(); -+ instance->SetAlignedPointerInInternalField(kTestIndex, this); -+ SetGlobalProperty("obj", instance); -+ } -+ -+ std::string Run(const char* script) { -+ log_is_empty_ = true; -+ log_.str(std::string()); -+ log_.clear(); -+ -+ RunJS(script); -+ return log_.str(); -+ } -+ -+ private: -+ bool log_is_empty_ = false; -+ std::stringstream log_; -+}; -+ -+TEST_F(InterceptorLoggingTest, DispatchTest) { -+ EXPECT_EQ(Run("for (var p in obj) {}"), -+ "indexed enumerator, named enumerator"); -+ EXPECT_EQ(Run("Object.keys(obj)"), "indexed enumerator, named enumerator"); -+ -+ EXPECT_EQ(Run("obj.foo"), "named getter"); -+ EXPECT_EQ(Run("obj[42]"), "indexed getter"); -+ -+ EXPECT_EQ(Run("obj.foo = null"), "named setter"); -+ EXPECT_EQ(Run("obj[42] = null"), "indexed setter"); -+ -+ EXPECT_EQ(Run("Object.getOwnPropertyDescriptor(obj, 'foo')"), -+ "named descriptor"); -+ -+ EXPECT_EQ(Run("Object.getOwnPropertyDescriptor(obj, 42)"), -+ "indexed descriptor"); -+ -+ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {value: 42})"), -+ "named descriptor, named definer, named setter"); -+ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {get(){} })"), -+ "named descriptor, named definer"); -+ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {set(value){}})"), -+ "named descriptor, named definer"); -+ EXPECT_EQ(Run("Object.defineProperty(obj, 'foo', {get(){}, set(value){}})"), -+ "named descriptor, named definer"); -+ -+ EXPECT_EQ(Run("Object.defineProperty(obj, 42, {value: 'foo'})"), -+ "indexed descriptor, " -+ // then attempt definer first and fallback to setter. -+ "indexed definer, indexed setter"); -+ -+ EXPECT_EQ(Run("Object.prototype.propertyIsEnumerable.call(obj, 'a')"), -+ "named query"); -+ EXPECT_EQ(Run("Object.prototype.propertyIsEnumerable.call(obj, 42)"), -+ "indexed query"); -+ -+ EXPECT_EQ(Run("Object.prototype.hasOwnProperty.call(obj, 'a')"), -+ "named query"); -+ // TODO(cbruni): Fix once hasOnwProperty is fixed (https://crbug.com/872628) -+ EXPECT_EQ(Run("Object.prototype.hasOwnProperty.call(obj, '42')"), ""); -+} -+} // namespace -+} // namespace internal - } // namespace v8 --- -2.17.0 - - -From 7766baf943a61843eaf706f349dd663218639e8c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Tue, 4 Sep 2018 21:22:51 +0200 -Subject: [PATCH 05/11] deps: cherry-pick ba752ea from upstream V8 - -Original commit message: - - [cpu-profiler] Use instruction start as the key for the CodeMap - - Previously we used the start address of the AbstractCode object. This - doesn't make sense for off-heap builtins, where the code isn't contained - in the object itself. It also hides other potential problems - sometimes - the sample.pc is inside the AbstractCode object header - this is - never valid. - - There were a few changes necessary to make this happen: - - Change the interface of CodeMoveEvent. Now 'to' and 'from' are both - AbstractCode objects, which is nice because many users were taking - 'to' and adding the header offset to it to try and find the - instruction start address. This isn't valid for off-heap builtins. - - Fix a bug in CodeMap::MoveCode where we didn't update the CodeEntry - object to reflect the new instruction_start. - - Rename the 'start' field in all of the CodeEventRecord sub-classes - to make it clear that this is the address of the first instruction. - - Fix the confusion in RecordTickSample between 'tos' and 'pc' which - caused pc_offset to be calculated incorrectly. - - Bug: v8:7983 - Change-Id: I3e9dddf74e4b2e96a5f031d216ef7008d6f184d1 - Reviewed-on: https://chromium-review.googlesource.com/1148457 - Commit-Queue: Peter Marshall - Reviewed-by: Jakob Gruber - Reviewed-by: Michael Lippautz - Cr-Commit-Position: refs/heads/master@{#54749} - -Refs: https://github.com/v8/v8/commit/ba752ea4c50713dff1e94f45a79db3ba968a8d66 - -PR-URL: https://github.com/nodejs/node/pull/21983 -Reviewed-By: Refael Ackermann -Reviewed-By: Gus Caplan -Reviewed-By: Ujjwal Sharma -Reviewed-By: Matteo Collina ---- - src/code-events.h | 4 +-- - src/heap/mark-compact.cc | 2 +- - src/log.cc | 25 ++++++-------- - src/log.h | 4 +-- - src/perf-jit.cc | 2 +- - src/perf-jit.h | 4 +-- - src/profiler/cpu-profiler-inl.h | 10 +++--- - src/profiler/cpu-profiler.cc | 2 +- - src/profiler/cpu-profiler.h | 14 ++++---- - src/profiler/profile-generator.cc | 41 +++++++++++++++------- - src/profiler/profile-generator.h | 2 ++ - src/profiler/profiler-listener.cc | 49 +++++++++++++-------------- - src/profiler/profiler-listener.h | 2 +- - src/snapshot/serializer.h | 4 +-- - test/cctest/test-cpu-profiler.cc | 18 +++++----- - test/cctest/test-log.cc | 2 +- - test/cctest/test-profile-generator.cc | 3 +- - 17 files changed, 101 insertions(+), 87 deletions(-) - -diff --git a/src/code-events.h b/src/code-events.h -index 09cd5a62e0..ec07a2e107 100644 ---- a/src/code-events.h -+++ b/src/code-events.h -@@ -83,7 +83,7 @@ class CodeEventListener { - virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; - virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; - virtual void RegExpCodeCreateEvent(AbstractCode* code, String* source) = 0; -- virtual void CodeMoveEvent(AbstractCode* from, Address to) = 0; -+ virtual void CodeMoveEvent(AbstractCode* from, AbstractCode* to) = 0; - virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; - virtual void CodeMovingGCEvent() = 0; - virtual void CodeDisableOptEvent(AbstractCode* code, -@@ -154,7 +154,7 @@ class CodeEventDispatcher { - void RegExpCodeCreateEvent(AbstractCode* code, String* source) { - CODE_EVENT_DISPATCH(RegExpCodeCreateEvent(code, source)); - } -- void CodeMoveEvent(AbstractCode* from, Address to) { -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) { - CODE_EVENT_DISPATCH(CodeMoveEvent(from, to)); - } - void SharedFunctionInfoMoveEvent(Address from, Address to) { -diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc -index 6bc01238b8..af56c72418 100644 ---- a/src/heap/mark-compact.cc -+++ b/src/heap/mark-compact.cc -@@ -1149,7 +1149,7 @@ class ProfilingMigrationObserver final : public MigrationObserver { - int size) final { - if (dest == CODE_SPACE || (dest == OLD_SPACE && dst->IsBytecodeArray())) { - PROFILE(heap_->isolate(), -- CodeMoveEvent(AbstractCode::cast(src), dst->address())); -+ CodeMoveEvent(AbstractCode::cast(src), AbstractCode::cast(dst))); - } - heap_->OnMoveEvent(dst, src, size); - } -diff --git a/src/log.cc b/src/log.cc -index 77d68ef94e..f19897b27b 100644 ---- a/src/log.cc -+++ b/src/log.cc -@@ -270,7 +270,7 @@ class PerfBasicLogger : public CodeEventLogger { - explicit PerfBasicLogger(Isolate* isolate); - ~PerfBasicLogger() override; - -- void CodeMoveEvent(AbstractCode* from, Address to) override {} -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override {} - void CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) override {} - -@@ -496,7 +496,7 @@ class LowLevelLogger : public CodeEventLogger { - LowLevelLogger(Isolate* isolate, const char* file_name); - ~LowLevelLogger() override; - -- void CodeMoveEvent(AbstractCode* from, Address to) override; -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; - void CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) override {} - void SnapshotPositionEvent(HeapObject* obj, int pos); -@@ -615,11 +615,10 @@ void LowLevelLogger::LogRecordedBuffer(const wasm::WasmCode* code, - code->instructions().length()); - } - --void LowLevelLogger::CodeMoveEvent(AbstractCode* from, Address to) { -+void LowLevelLogger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { - CodeMoveStruct event; - event.from_address = from->InstructionStart(); -- size_t header_size = from->InstructionStart() - from->address(); -- event.to_address = to + header_size; -+ event.to_address = to->InstructionStart(); - LogWriteStruct(event); - } - -@@ -641,7 +640,7 @@ class JitLogger : public CodeEventLogger { - public: - JitLogger(Isolate* isolate, JitCodeEventHandler code_event_handler); - -- void CodeMoveEvent(AbstractCode* from, Address to) override; -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; - void CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) override {} - void AddCodeLinePosInfoEvent(void* jit_handler_data, int pc_offset, -@@ -700,7 +699,7 @@ void JitLogger::LogRecordedBuffer(const wasm::WasmCode* code, const char* name, - code_event_handler_(&event); - } - --void JitLogger::CodeMoveEvent(AbstractCode* from, Address to) { -+void JitLogger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { - base::LockGuard guard(&logger_mutex_); - - JitCodeEvent event; -@@ -709,12 +708,7 @@ void JitLogger::CodeMoveEvent(AbstractCode* from, Address to) { - from->IsCode() ? JitCodeEvent::JIT_CODE : JitCodeEvent::BYTE_CODE; - event.code_start = reinterpret_cast(from->InstructionStart()); - event.code_len = from->InstructionSize(); -- -- // Calculate the header size. -- const size_t header_size = from->InstructionStart() - from->address(); -- -- // Calculate the new start address of the instructions. -- event.new_code_start = reinterpret_cast(to + header_size); -+ event.new_code_start = reinterpret_cast(to->InstructionStart()); - event.isolate = reinterpret_cast(isolate_); - - code_event_handler_(&event); -@@ -1431,9 +1425,10 @@ void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { - msg.WriteToLogFile(); - } - --void Logger::CodeMoveEvent(AbstractCode* from, Address to) { -+void Logger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { - if (!is_listening_to_code_events()) return; -- MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), to); -+ MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), -+ to->address()); - } - - namespace { -diff --git a/src/log.h b/src/log.h -index 485de0f4d1..3bc54a5926 100644 ---- a/src/log.h -+++ b/src/log.h -@@ -222,7 +222,7 @@ class Logger : public CodeEventListener { - // Emits a code create event for a RegExp. - void RegExpCodeCreateEvent(AbstractCode* code, String* source); - // Emits a code move event. -- void CodeMoveEvent(AbstractCode* from, Address to); -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to); - // Emits a code line info record event. - void CodeLinePosInfoRecordEvent(Address code_start, - ByteArray* source_position_table); -@@ -486,7 +486,7 @@ class ExternalCodeEventListener : public CodeEventListener { - void GetterCallbackEvent(Name* name, Address entry_point) override {} - void SetterCallbackEvent(Name* name, Address entry_point) override {} - void SharedFunctionInfoMoveEvent(Address from, Address to) override {} -- void CodeMoveEvent(AbstractCode* from, Address to) override {} -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override {} - void CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) override {} - void CodeMovingGCEvent() override {} -diff --git a/src/perf-jit.cc b/src/perf-jit.cc -index 3aaa36bc12..f6b2cf401a 100644 ---- a/src/perf-jit.cc -+++ b/src/perf-jit.cc -@@ -420,7 +420,7 @@ void PerfJitLogger::LogWriteUnwindingInfo(Code* code) { - LogWriteBytes(padding_bytes, static_cast(padding_size)); - } - --void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) { -+void PerfJitLogger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { - // We may receive a CodeMove event if a BytecodeArray object moves. Otherwise - // code relocation is not supported. - CHECK(from->IsBytecodeArray()); -diff --git a/src/perf-jit.h b/src/perf-jit.h -index d08f4b91ab..3b11cf30c2 100644 ---- a/src/perf-jit.h -+++ b/src/perf-jit.h -@@ -41,7 +41,7 @@ class PerfJitLogger : public CodeEventLogger { - explicit PerfJitLogger(Isolate* isolate); - virtual ~PerfJitLogger(); - -- void CodeMoveEvent(AbstractCode* from, Address to) override; -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; - void CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) override {} - -@@ -120,7 +120,7 @@ class PerfJitLogger : public CodeEventLogger { - public: - explicit PerfJitLogger(Isolate* isolate) : CodeEventLogger(isolate) {} - -- void CodeMoveEvent(AbstractCode* from, Address to) override { -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override { - UNIMPLEMENTED(); - } - -diff --git a/src/profiler/cpu-profiler-inl.h b/src/profiler/cpu-profiler-inl.h -index f6eaa8f8a3..9274bc03c6 100644 ---- a/src/profiler/cpu-profiler-inl.h -+++ b/src/profiler/cpu-profiler-inl.h -@@ -16,17 +16,17 @@ namespace v8 { - namespace internal { - - void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { -- code_map->AddCode(start, entry, size); -+ code_map->AddCode(instruction_start, entry, instruction_size); - } - - - void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { -- code_map->MoveCode(from, to); -+ code_map->MoveCode(from_instruction_start, to_instruction_start); - } - - - void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) { -- CodeEntry* entry = code_map->FindEntry(start); -+ CodeEntry* entry = code_map->FindEntry(instruction_start); - if (entry != nullptr) { - entry->set_bailout_reason(bailout_reason); - } -@@ -34,7 +34,7 @@ void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) { - - - void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) { -- CodeEntry* entry = code_map->FindEntry(start); -+ CodeEntry* entry = code_map->FindEntry(instruction_start); - if (entry == nullptr) return; - std::vector frames_vector( - deopt_frames, deopt_frames + deopt_frame_count); -@@ -44,7 +44,7 @@ void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) { - - - void ReportBuiltinEventRecord::UpdateCodeMap(CodeMap* code_map) { -- CodeEntry* entry = code_map->FindEntry(start); -+ CodeEntry* entry = code_map->FindEntry(instruction_start); - if (!entry) { - // Code objects for builtins should already have been added to the map but - // some of them have been filtered out by CpuProfiler. -diff --git a/src/profiler/cpu-profiler.cc b/src/profiler/cpu-profiler.cc -index 463a30f184..555c47f2f4 100644 ---- a/src/profiler/cpu-profiler.cc -+++ b/src/profiler/cpu-profiler.cc -@@ -426,7 +426,7 @@ void CpuProfiler::LogBuiltins() { - CodeEventsContainer evt_rec(CodeEventRecord::REPORT_BUILTIN); - ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; - Builtins::Name id = static_cast(i); -- rec->start = builtins->builtin(id)->address(); -+ rec->instruction_start = builtins->builtin(id)->InstructionStart(); - rec->builtin_id = id; - processor_->Enqueue(evt_rec); - } -diff --git a/src/profiler/cpu-profiler.h b/src/profiler/cpu-profiler.h -index febc154802..78bb3b4a25 100644 ---- a/src/profiler/cpu-profiler.h -+++ b/src/profiler/cpu-profiler.h -@@ -53,9 +53,9 @@ class CodeEventRecord { - - class CodeCreateEventRecord : public CodeEventRecord { - public: -- Address start; -+ Address instruction_start; - CodeEntry* entry; -- unsigned size; -+ unsigned instruction_size; - - V8_INLINE void UpdateCodeMap(CodeMap* code_map); - }; -@@ -63,8 +63,8 @@ class CodeCreateEventRecord : public CodeEventRecord { - - class CodeMoveEventRecord : public CodeEventRecord { - public: -- Address from; -- Address to; -+ Address from_instruction_start; -+ Address to_instruction_start; - - V8_INLINE void UpdateCodeMap(CodeMap* code_map); - }; -@@ -72,7 +72,7 @@ class CodeMoveEventRecord : public CodeEventRecord { - - class CodeDisableOptEventRecord : public CodeEventRecord { - public: -- Address start; -+ Address instruction_start; - const char* bailout_reason; - - V8_INLINE void UpdateCodeMap(CodeMap* code_map); -@@ -81,7 +81,7 @@ class CodeDisableOptEventRecord : public CodeEventRecord { - - class CodeDeoptEventRecord : public CodeEventRecord { - public: -- Address start; -+ Address instruction_start; - const char* deopt_reason; - int deopt_id; - Address pc; -@@ -95,7 +95,7 @@ class CodeDeoptEventRecord : public CodeEventRecord { - - class ReportBuiltinEventRecord : public CodeEventRecord { - public: -- Address start; -+ Address instruction_start; - Builtins::Name builtin_id; - - V8_INLINE void UpdateCodeMap(CodeMap* code_map); -diff --git a/src/profiler/profile-generator.cc b/src/profiler/profile-generator.cc -index 92619f2fbf..845fe97b64 100644 ---- a/src/profiler/profile-generator.cc -+++ b/src/profiler/profile-generator.cc -@@ -529,6 +529,8 @@ void CodeMap::AddCode(Address addr, CodeEntry* entry, unsigned size) { - ClearCodesInRange(addr, addr + size); - unsigned index = AddCodeEntry(addr, entry); - code_map_.emplace(addr, CodeEntryMapInfo{index, size}); -+ DCHECK(entry->instruction_start() == kNullAddress || -+ addr == entry->instruction_start()); - } - - void CodeMap::ClearCodesInRange(Address start, Address end) { -@@ -550,8 +552,14 @@ CodeEntry* CodeMap::FindEntry(Address addr) { - auto it = code_map_.upper_bound(addr); - if (it == code_map_.begin()) return nullptr; - --it; -- Address end_address = it->first + it->second.size; -- return addr < end_address ? entry(it->second.index) : nullptr; -+ Address start_address = it->first; -+ Address end_address = start_address + it->second.size; -+ CodeEntry* ret = addr < end_address ? entry(it->second.index) : nullptr; -+ if (ret && ret->instruction_start() != kNullAddress) { -+ DCHECK_EQ(start_address, ret->instruction_start()); -+ DCHECK(addr >= start_address && addr < end_address); -+ } -+ return ret; - } - - void CodeMap::MoveCode(Address from, Address to) { -@@ -563,6 +571,9 @@ void CodeMap::MoveCode(Address from, Address to) { - DCHECK(from + info.size <= to || to + info.size <= from); - ClearCodesInRange(to, to + info.size); - code_map_.emplace(to, info); -+ -+ CodeEntry* entry = code_entries_[info.index].entry; -+ entry->set_instruction_start(to); - } - - unsigned CodeMap::AddCodeEntry(Address start, CodeEntry* entry) { -@@ -693,26 +704,29 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) { - if (sample.pc != nullptr) { - if (sample.has_external_callback && sample.state == EXTERNAL) { - // Don't use PC when in external callback code, as it can point -- // inside callback's code, and we will erroneously report -+ // inside a callback's code, and we will erroneously report - // that a callback calls itself. - stack_trace.push_back( - {FindEntry(reinterpret_cast
(sample.external_callback_entry)), - no_line_info}); - } else { -- CodeEntry* pc_entry = FindEntry(reinterpret_cast
(sample.pc)); -- // If there is no pc_entry we're likely in native code. -- // Find out, if top of stack was pointing inside a JS function -- // meaning that we have encountered a frameless invocation. -+ Address attributed_pc = reinterpret_cast
(sample.pc); -+ CodeEntry* pc_entry = FindEntry(attributed_pc); -+ // If there is no pc_entry, we're likely in native code. Find out if the -+ // top of the stack (the return address) was pointing inside a JS -+ // function, meaning that we have encountered a frameless invocation. - if (!pc_entry && !sample.has_external_callback) { -- pc_entry = FindEntry(reinterpret_cast
(sample.tos)); -+ attributed_pc = reinterpret_cast
(sample.tos); -+ pc_entry = FindEntry(attributed_pc); - } - // If pc is in the function code before it set up stack frame or after the -- // frame was destroyed SafeStackFrameIterator incorrectly thinks that -- // ebp contains return address of the current function and skips caller's -- // frame. Check for this case and just skip such samples. -+ // frame was destroyed, SafeStackFrameIterator incorrectly thinks that -+ // ebp contains the return address of the current function and skips the -+ // caller's frame. Check for this case and just skip such samples. - if (pc_entry) { -- int pc_offset = static_cast(reinterpret_cast
(sample.pc) - -- pc_entry->instruction_start()); -+ int pc_offset = -+ static_cast(attributed_pc - pc_entry->instruction_start()); -+ DCHECK_GE(pc_offset, 0); - src_line = pc_entry->GetSourceLine(pc_offset); - if (src_line == v8::CpuProfileNode::kNoLineNumberInfo) { - src_line = pc_entry->line_number(); -@@ -744,6 +758,7 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) { - // Find out if the entry has an inlining stack associated. - int pc_offset = - static_cast(stack_pos - entry->instruction_start()); -+ DCHECK_GE(pc_offset, 0); - const std::vector>* inline_stack = - entry->GetInlineStack(pc_offset); - if (inline_stack) { -diff --git a/src/profiler/profile-generator.h b/src/profiler/profile-generator.h -index 3e301a4082..8eef05bcdb 100644 ---- a/src/profiler/profile-generator.h -+++ b/src/profiler/profile-generator.h -@@ -108,7 +108,9 @@ class CodeEntry { - const std::vector>* GetInlineStack( - int pc_offset) const; - -+ void set_instruction_start(Address start) { instruction_start_ = start; } - Address instruction_start() const { return instruction_start_; } -+ - CodeEventListener::LogEventsAndTags tag() const { - return TagField::decode(bit_field_); - } -diff --git a/src/profiler/profiler-listener.cc b/src/profiler/profiler-listener.cc -index 9c29da9ec7..f90a2e11d3 100644 ---- a/src/profiler/profiler-listener.cc -+++ b/src/profiler/profiler-listener.cc -@@ -24,9 +24,9 @@ ProfilerListener::~ProfilerListener() = default; - void ProfilerListener::CallbackEvent(Name* name, Address entry_point) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = entry_point; -+ rec->instruction_start = entry_point; - rec->entry = NewCodeEntry(CodeEventListener::CALLBACK_TAG, GetName(name)); -- rec->size = 1; -+ rec->instruction_size = 1; - DispatchCodeEvent(evt_rec); - } - -@@ -34,13 +34,13 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - AbstractCode* code, const char* name) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = code->address(); -+ rec->instruction_start = code->InstructionStart(); - rec->entry = NewCodeEntry(tag, GetName(name), CodeEntry::kEmptyResourceName, - CpuProfileNode::kNoLineNumberInfo, - CpuProfileNode::kNoColumnNumberInfo, nullptr, - code->InstructionStart()); - RecordInliningInfo(rec->entry, code); -- rec->size = code->ExecutableSize(); -+ rec->instruction_size = code->InstructionSize(); - DispatchCodeEvent(evt_rec); - } - -@@ -48,13 +48,13 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - AbstractCode* code, Name* name) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = code->address(); -+ rec->instruction_start = code->InstructionStart(); - rec->entry = NewCodeEntry(tag, GetName(name), CodeEntry::kEmptyResourceName, - CpuProfileNode::kNoLineNumberInfo, - CpuProfileNode::kNoColumnNumberInfo, nullptr, - code->InstructionStart()); - RecordInliningInfo(rec->entry, code); -- rec->size = code->ExecutableSize(); -+ rec->instruction_size = code->InstructionSize(); - DispatchCodeEvent(evt_rec); - } - -@@ -64,7 +64,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - Name* script_name) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = code->address(); -+ rec->instruction_start = code->InstructionStart(); - rec->entry = NewCodeEntry(tag, GetName(shared->DebugName()), - GetName(InferScriptName(script_name, shared)), - CpuProfileNode::kNoLineNumberInfo, -@@ -72,7 +72,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - code->InstructionStart()); - RecordInliningInfo(rec->entry, code); - rec->entry->FillFunctionInfo(shared); -- rec->size = code->ExecutableSize(); -+ rec->instruction_size = code->InstructionSize(); - DispatchCodeEvent(evt_rec); - } - -@@ -83,7 +83,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - int column) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = abstract_code->address(); -+ rec->instruction_start = abstract_code->InstructionStart(); - std::unique_ptr line_table; - if (shared->script()->IsScript()) { - Script* script = Script::cast(shared->script()); -@@ -105,7 +105,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - std::move(line_table), abstract_code->InstructionStart()); - RecordInliningInfo(rec->entry, abstract_code); - rec->entry->FillFunctionInfo(shared); -- rec->size = abstract_code->ExecutableSize(); -+ rec->instruction_size = abstract_code->InstructionSize(); - DispatchCodeEvent(evt_rec); - } - -@@ -114,20 +114,20 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - wasm::WasmName name) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = code->instruction_start(); -+ rec->instruction_start = code->instruction_start(); - rec->entry = NewCodeEntry( - tag, GetName(name.start()), CodeEntry::kWasmResourceNamePrefix, - CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo, - nullptr, code->instruction_start()); -- rec->size = code->instructions().length(); -+ rec->instruction_size = code->instructions().length(); - DispatchCodeEvent(evt_rec); - } - --void ProfilerListener::CodeMoveEvent(AbstractCode* from, Address to) { -+void ProfilerListener::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_MOVE); - CodeMoveEventRecord* rec = &evt_rec.CodeMoveEventRecord_; -- rec->from = from->address(); -- rec->to = to; -+ rec->from_instruction_start = from->InstructionStart(); -+ rec->to_instruction_start = to->InstructionStart(); - DispatchCodeEvent(evt_rec); - } - -@@ -135,7 +135,7 @@ void ProfilerListener::CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT); - CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_; -- rec->start = code->address(); -+ rec->instruction_start = code->InstructionStart(); - rec->bailout_reason = GetBailoutReason(shared->disable_optimization_reason()); - DispatchCodeEvent(evt_rec); - } -@@ -145,7 +145,7 @@ void ProfilerListener::CodeDeoptEvent(Code* code, DeoptimizeKind kind, - CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT); - CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_; - Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc); -- rec->start = code->address(); -+ rec->instruction_start = code->InstructionStart(); - rec->deopt_reason = DeoptimizeReasonToString(info.deopt_reason); - rec->deopt_id = info.deopt_id; - rec->pc = pc; -@@ -160,10 +160,10 @@ void ProfilerListener::CodeDeoptEvent(Code* code, DeoptimizeKind kind, - void ProfilerListener::GetterCallbackEvent(Name* name, Address entry_point) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = entry_point; -+ rec->instruction_start = entry_point; - rec->entry = - NewCodeEntry(CodeEventListener::CALLBACK_TAG, GetConsName("get ", name)); -- rec->size = 1; -+ rec->instruction_size = 1; - DispatchCodeEvent(evt_rec); - } - -@@ -171,23 +171,22 @@ void ProfilerListener::RegExpCodeCreateEvent(AbstractCode* code, - String* source) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = code->address(); -+ rec->instruction_start = code->InstructionStart(); - rec->entry = NewCodeEntry( - CodeEventListener::REG_EXP_TAG, GetConsName("RegExp: ", source), - CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, -- CpuProfileNode::kNoColumnNumberInfo, nullptr, -- code->raw_instruction_start()); -- rec->size = code->ExecutableSize(); -+ CpuProfileNode::kNoColumnNumberInfo, nullptr, code->InstructionStart()); -+ rec->instruction_size = code->InstructionSize(); - DispatchCodeEvent(evt_rec); - } - - void ProfilerListener::SetterCallbackEvent(Name* name, Address entry_point) { - CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); - CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; -- rec->start = entry_point; -+ rec->instruction_start = entry_point; - rec->entry = - NewCodeEntry(CodeEventListener::CALLBACK_TAG, GetConsName("set ", name)); -- rec->size = 1; -+ rec->instruction_size = 1; - DispatchCodeEvent(evt_rec); - } - -diff --git a/src/profiler/profiler-listener.h b/src/profiler/profiler-listener.h -index 5cff7cc11d..51fba18a60 100644 ---- a/src/profiler/profiler-listener.h -+++ b/src/profiler/profiler-listener.h -@@ -44,7 +44,7 @@ class ProfilerListener : public CodeEventListener { - wasm::WasmName name) override; - - void CodeMovingGCEvent() override {} -- void CodeMoveEvent(AbstractCode* from, Address to) override; -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; - void CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) override; - void CodeDeoptEvent(Code* code, DeoptimizeKind kind, Address pc, -diff --git a/src/snapshot/serializer.h b/src/snapshot/serializer.h -index 6a5d1a4aac..658d37f286 100644 ---- a/src/snapshot/serializer.h -+++ b/src/snapshot/serializer.h -@@ -28,8 +28,8 @@ class CodeAddressMap : public CodeEventLogger { - isolate_->logger()->RemoveCodeEventListener(this); - } - -- void CodeMoveEvent(AbstractCode* from, Address to) override { -- address_to_name_map_.Move(from->address(), to); -+ void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override { -+ address_to_name_map_.Move(from->address(), to->address()); - } - - void CodeDisableOptEvent(AbstractCode* code, -diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc -index 4e7a70c76f..f74bdf1ede 100644 ---- a/test/cctest/test-cpu-profiler.cc -+++ b/test/cctest/test-cpu-profiler.cc -@@ -176,27 +176,29 @@ TEST(CodeEvents) { - "comment"); - profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, - "comment2"); -- profiler_listener.CodeMoveEvent(comment2_code, moved_code->address()); -+ profiler_listener.CodeMoveEvent(comment2_code, moved_code); - - // Enqueue a tick event to enable code events processing. -- EnqueueTickSampleEvent(processor, aaa_code->address()); -+ EnqueueTickSampleEvent(processor, aaa_code->InstructionStart()); - - isolate->logger()->RemoveCodeEventListener(&profiler_listener); - processor->StopSynchronously(); - - // Check the state of profile generator. -- CodeEntry* aaa = generator->code_map()->FindEntry(aaa_code->address()); -+ CodeEntry* aaa = -+ generator->code_map()->FindEntry(aaa_code->InstructionStart()); - CHECK(aaa); - CHECK_EQ(0, strcmp(aaa_str, aaa->name())); - - CodeEntry* comment = -- generator->code_map()->FindEntry(comment_code->address()); -+ generator->code_map()->FindEntry(comment_code->InstructionStart()); - CHECK(comment); - CHECK_EQ(0, strcmp("comment", comment->name())); - -- CHECK(!generator->code_map()->FindEntry(comment2_code->address())); -+ CHECK(!generator->code_map()->FindEntry(comment2_code->InstructionStart())); - -- CodeEntry* comment2 = generator->code_map()->FindEntry(moved_code->address()); -+ CodeEntry* comment2 = -+ generator->code_map()->FindEntry(moved_code->InstructionStart()); - CHECK(comment2); - CHECK_EQ(0, strcmp("comment2", comment2->name())); - } -@@ -298,11 +300,11 @@ TEST(Issue1398) { - profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); - - v8::TickSample* sample = processor->StartTickSample(); -- sample->pc = reinterpret_cast(code->address()); -+ sample->pc = reinterpret_cast(code->InstructionStart()); - sample->tos = nullptr; - sample->frames_count = v8::TickSample::kMaxFramesCount; - for (unsigned i = 0; i < sample->frames_count; ++i) { -- sample->stack[i] = reinterpret_cast(code->address()); -+ sample->stack[i] = reinterpret_cast(code->InstructionStart()); - } - processor->FinishTickSample(); - -diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc -index 0b13a7e660..1dfa22b4cc 100644 ---- a/test/cctest/test-log.cc -+++ b/test/cctest/test-log.cc -@@ -751,7 +751,7 @@ TEST(Issue539892) { - explicit FakeCodeEventLogger(i::Isolate* isolate) - : CodeEventLogger(isolate) {} - -- void CodeMoveEvent(i::AbstractCode* from, Address to) override {} -+ void CodeMoveEvent(i::AbstractCode* from, i::AbstractCode* to) override {} - void CodeDisableOptEvent(i::AbstractCode* code, - i::SharedFunctionInfo* shared) override {} - -diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc -index 9b2d7e3ab2..b53bf148e6 100644 ---- a/test/cctest/test-profile-generator.cc -+++ b/test/cctest/test-profile-generator.cc -@@ -676,7 +676,8 @@ int GetFunctionLineNumber(CpuProfiler& profiler, LocalContext& env, - i::Handle func = i::Handle::cast( - v8::Utils::OpenHandle(*v8::Local::Cast( - env->Global()->Get(env.local(), v8_str(name)).ToLocalChecked()))); -- CodeEntry* func_entry = code_map->FindEntry(func->abstract_code()->address()); -+ CodeEntry* func_entry = -+ code_map->FindEntry(func->abstract_code()->InstructionStart()); - if (!func_entry) FATAL("%s", name); - return func_entry->line_number(); - } --- -2.17.0 - - -From fc1770b0d1a5762bd14ccbd8a3688a7592d96cd7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Tue, 4 Sep 2018 21:24:03 +0200 -Subject: [PATCH 06/11] deps: cherry-pick bf5ea81 from upstream V8 - -Original commit message: - - [tracing] allow dynamic control of tracing - - If the trace_buffer_ was null, we were returning a pointer to a static - flag back that permanently disabled that particular trace point. - - This implied an assumption that tracing will be statically enabled at - process startup, and once it is disabled, it will never be enabled - again. On Node.js side we want to dynamically enable/disable tracing as per - programmer intent. - - Change-Id: Ic7a7839b8450ab5c356d85e8e0826f42824907f4 - Reviewed-on: https://chromium-review.googlesource.com/1161518 - Reviewed-by: Yang Guo - Commit-Queue: Ali Ijaz Sheikh - Cr-Commit-Position: refs/heads/master@{#54903} - -Refs: https://github.com/v8/v8/commit/bf5ea8138c0726613c9d722a3ccb552a8f477992 - -PR-URL: https://github.com/nodejs/node/pull/21983 -Reviewed-By: Refael Ackermann -Reviewed-By: Gus Caplan -Reviewed-By: Ujjwal Sharma -Reviewed-By: Matteo Collina ---- - src/libplatform/tracing/tracing-controller.cc | 13 ++++--------- - 1 file changed, 4 insertions(+), 9 deletions(-) - -diff --git a/src/libplatform/tracing/tracing-controller.cc b/src/libplatform/tracing/tracing-controller.cc -index 647306d627..b4aa7baf72 100644 ---- a/src/libplatform/tracing/tracing-controller.cc -+++ b/src/libplatform/tracing/tracing-controller.cc -@@ -24,18 +24,17 @@ namespace tracing { - // convert internally to determine the category name from the char enabled - // pointer. - const char* g_category_groups[MAX_CATEGORY_GROUPS] = { -- "toplevel", "tracing already shutdown", -+ "toplevel", - "tracing categories exhausted; must increase MAX_CATEGORY_GROUPS", - "__metadata"}; - - // The enabled flag is char instead of bool so that the API can be used from C. - unsigned char g_category_group_enabled[MAX_CATEGORY_GROUPS] = {0}; - // Indexes here have to match the g_category_groups array indexes above. --const int g_category_already_shutdown = 1; --const int g_category_categories_exhausted = 2; -+const int g_category_categories_exhausted = 1; - // Metadata category not used in V8. --// const int g_category_metadata = 3; --const int g_num_builtin_categories = 4; -+// const int g_category_metadata = 2; -+const int g_num_builtin_categories = 3; - - // Skip default categories. - v8::base::AtomicWord g_category_index = g_num_builtin_categories; -@@ -103,10 +102,6 @@ void TracingController::UpdateTraceEventDuration( - - const uint8_t* TracingController::GetCategoryGroupEnabled( - const char* category_group) { -- if (!trace_buffer_) { -- DCHECK(!g_category_group_enabled[g_category_already_shutdown]); -- return &g_category_group_enabled[g_category_already_shutdown]; -- } - return GetCategoryGroupEnabledInternal(category_group); - } - --- -2.17.0 - - -From a3f258c7693fd76fc26edc8c9d5b67f260eb755d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Tue, 4 Sep 2018 21:24:34 +0200 -Subject: [PATCH 07/11] deps: cherry-pick a8f6869 from upstream V8 - -Original commit message: - - [debug] Fully implement Debug::ArchiveDebug and Debug::RestoreDebug. - - I have a project that embeds V8 and uses a single `Isolate` from multiple - threads. The program runs just fine, but sometimes the inspector doesn't - stop on the correct line after stepping over a statement that switches - threads behind the scenes, even though the original thread is restored by - the time the next statement is executed. - - After some digging, I discovered that the `Debug::ArchiveDebug` and - `Debug::RestoreDebug` methods, which should be responsible for - saving/restoring this `ThreadLocal` information when switching threads, - currently don't do anything. - - This commit implements those methods using MemCopy, in the style of other - Archive/Restore methods in the V8 codebase. - - Related: https://groups.google.com/forum/#!topic/v8-users/_Qf2rwljRk8 - - Note: I believe my employer, Meteor Development Group, has previously - signed the CLA using the group email address google-contrib@meteor.com. - - R=yangguo@chromium.org,jgruber@chromium.org - CC=info@bnoordhuis.nl - - Bug: v8:7230 - Change-Id: Id517c873eb81cd53f7216c7efd441b956cf7f943 - Reviewed-on: https://chromium-review.googlesource.com/833260 - Commit-Queue: Yang Guo - Reviewed-by: Yang Guo - Cr-Commit-Position: refs/heads/master@{#54902} - -Refs: https://github.com/v8/v8/commit/a8f6869177685cfb9c199c454a86f4698c260515 - -PR-URL: https://github.com/nodejs/node/pull/21983 -Reviewed-By: Refael Ackermann -Reviewed-By: Gus Caplan -Reviewed-By: Ujjwal Sharma -Reviewed-By: Matteo Collina ---- - AUTHORS | 2 + - src/debug/debug.cc | 24 +++++-- - src/debug/debug.h | 1 + - src/v8threads.cc | 8 ++- - src/v8threads.h | 1 + - test/cctest/test-debug.cc | 127 ++++++++++++++++++++++++++++++++++++++ - 6 files changed, 155 insertions(+), 8 deletions(-) - -diff --git a/AUTHORS b/AUTHORS -index 3873f0ca68..6179e2230d 100644 ---- a/AUTHORS -+++ b/AUTHORS -@@ -32,6 +32,7 @@ Facebook, Inc. <*@fb.com> - Facebook, Inc. <*@oculus.com> - Vewd Software AS <*@vewd.com> - Groupon <*@groupon.com> -+Meteor Development Group <*@meteor.com> - Cloudflare, Inc. <*@cloudflare.com> - - Aaron Bieber -@@ -49,6 +50,7 @@ Andrei Kashcha - Anna Henningsen - Bangfu Tao - Ben Coe -+Ben Newman - Ben Noordhuis - Benjamin Tan - Bert Belder -diff --git a/src/debug/debug.cc b/src/debug/debug.cc -index 47de9523a5..3877f156ef 100644 ---- a/src/debug/debug.cc -+++ b/src/debug/debug.cc -@@ -355,19 +355,31 @@ void Debug::ThreadInit() { - - - char* Debug::ArchiveDebug(char* storage) { -- // Simply reset state. Don't archive anything. -- ThreadInit(); -+ MemCopy(storage, reinterpret_cast(&thread_local_), -+ ArchiveSpacePerThread()); - return storage + ArchiveSpacePerThread(); - } - -- - char* Debug::RestoreDebug(char* storage) { -- // Simply reset state. Don't restore anything. -- ThreadInit(); -+ MemCopy(reinterpret_cast(&thread_local_), storage, -+ ArchiveSpacePerThread()); -+ -+ // Enter the debugger. -+ DebugScope debug_scope(this); -+ -+ // Clear any one-shot breakpoints that may have been set by the other -+ // thread, and reapply breakpoints for this thread. -+ ClearOneShot(); -+ -+ if (thread_local_.last_step_action_ != StepNone) { -+ // Reset the previous step action for this thread. -+ PrepareStep(thread_local_.last_step_action_); -+ } -+ - return storage + ArchiveSpacePerThread(); - } - --int Debug::ArchiveSpacePerThread() { return 0; } -+int Debug::ArchiveSpacePerThread() { return sizeof(ThreadLocal); } - - void Debug::Iterate(RootVisitor* v) { - v->VisitRootPointer(Root::kDebug, nullptr, &thread_local_.return_value_); -diff --git a/src/debug/debug.h b/src/debug/debug.h -index 31881fe106..13844769c1 100644 ---- a/src/debug/debug.h -+++ b/src/debug/debug.h -@@ -314,6 +314,7 @@ class Debug { - static int ArchiveSpacePerThread(); - void FreeThreadResources() { } - void Iterate(RootVisitor* v); -+ void InitThread(const ExecutionAccess& lock) { ThreadInit(); } - - bool CheckExecutionState() { return is_active() && break_id() != 0; } - -diff --git a/src/v8threads.cc b/src/v8threads.cc -index db927010ef..0fb333c1f3 100644 ---- a/src/v8threads.cc -+++ b/src/v8threads.cc -@@ -45,7 +45,7 @@ void Locker::Initialize(v8::Isolate* isolate) { - } else { - internal::ExecutionAccess access(isolate_); - isolate_->stack_guard()->ClearThread(access); -- isolate_->stack_guard()->InitThread(access); -+ isolate_->thread_manager()->InitThread(access); - } - } - DCHECK(isolate_->thread_manager()->IsLockedByCurrentThread()); -@@ -95,6 +95,10 @@ Unlocker::~Unlocker() { - - namespace internal { - -+void ThreadManager::InitThread(const ExecutionAccess& lock) { -+ isolate_->stack_guard()->InitThread(lock); -+ isolate_->debug()->InitThread(lock); -+} - - bool ThreadManager::RestoreThread() { - DCHECK(IsLockedByCurrentThread()); -@@ -127,7 +131,7 @@ bool ThreadManager::RestoreThread() { - isolate_->FindPerThreadDataForThisThread(); - if (per_thread == nullptr || per_thread->thread_state() == nullptr) { - // This is a new thread. -- isolate_->stack_guard()->InitThread(access); -+ InitThread(access); - return false; - } - ThreadState* state = per_thread->thread_state(); -diff --git a/src/v8threads.h b/src/v8threads.h -index bb87afea7d..7fde0c9ec4 100644 ---- a/src/v8threads.h -+++ b/src/v8threads.h -@@ -67,6 +67,7 @@ class ThreadManager { - void Lock(); - void Unlock(); - -+ void InitThread(const ExecutionAccess&); - void ArchiveThread(); - bool RestoreThread(); - void FreeThreadResources(); -diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc -index d3c10822ff..7430fbf06b 100644 ---- a/test/cctest/test-debug.cc -+++ b/test/cctest/test-debug.cc -@@ -3717,6 +3717,133 @@ TEST(DebugBreakOffThreadTerminate) { - CHECK(try_catch.HasTerminated()); - } - -+class ArchiveRestoreThread : public v8::base::Thread, -+ public v8::debug::DebugDelegate { -+ public: -+ ArchiveRestoreThread(v8::Isolate* isolate, int spawn_count) -+ : Thread(Options("ArchiveRestoreThread")), -+ isolate_(isolate), -+ debug_(reinterpret_cast(isolate_)->debug()), -+ spawn_count_(spawn_count), -+ break_count_(0) {} -+ -+ virtual void Run() { -+ v8::Locker locker(isolate_); -+ isolate_->Enter(); -+ -+ v8::HandleScope scope(isolate_); -+ v8::Local context = v8::Context::New(isolate_); -+ v8::Context::Scope context_scope(context); -+ -+ v8::Local test = CompileFunction(isolate_, -+ "function test(n) {\n" -+ " debugger;\n" -+ " return n + 1;\n" -+ "}\n", -+ "test"); -+ -+ debug_->SetDebugDelegate(this); -+ v8::internal::DisableBreak enable_break(debug_, false); -+ -+ v8::Local args[1] = {v8::Integer::New(isolate_, spawn_count_)}; -+ -+ int result = test->Call(context, context->Global(), 1, args) -+ .ToLocalChecked() -+ ->Int32Value(context) -+ .FromJust(); -+ -+ // Verify that test(spawn_count_) returned spawn_count_ + 1. -+ CHECK_EQ(spawn_count_ + 1, result); -+ -+ isolate_->Exit(); -+ } -+ -+ void BreakProgramRequested(v8::Local context, -+ const std::vector&) { -+ auto stack_traces = v8::debug::StackTraceIterator::Create(isolate_); -+ if (!stack_traces->Done()) { -+ v8::debug::Location location = stack_traces->GetSourceLocation(); -+ -+ i::PrintF("ArchiveRestoreThread #%d hit breakpoint at line %d\n", -+ spawn_count_, location.GetLineNumber()); -+ -+ switch (location.GetLineNumber()) { -+ case 1: // debugger; -+ CHECK_EQ(break_count_, 0); -+ -+ // Attempt to stop on the next line after the first debugger -+ // statement. If debug->{Archive,Restore}Debug() improperly reset -+ // thread-local debug information, the debugger will fail to stop -+ // before the test function returns. -+ debug_->PrepareStep(StepNext); -+ -+ // Spawning threads while handling the current breakpoint verifies -+ // that the parent thread correctly archived and restored the -+ // state necessary to stop on the next line. If not, then control -+ // will simply continue past the `return n + 1` statement. -+ MaybeSpawnChildThread(); -+ -+ break; -+ -+ case 2: // return n + 1; -+ CHECK_EQ(break_count_, 1); -+ break; -+ -+ default: -+ CHECK(false); -+ } -+ } -+ -+ ++break_count_; -+ } -+ -+ void MaybeSpawnChildThread() { -+ if (spawn_count_ > 1) { -+ v8::Unlocker unlocker(isolate_); -+ -+ // Spawn a thread that spawns a thread that spawns a thread (and so -+ // on) so that the ThreadManager is forced to archive and restore -+ // the current thread. -+ ArchiveRestoreThread child(isolate_, spawn_count_ - 1); -+ child.Start(); -+ child.Join(); -+ -+ // The child thread sets itself as the debug delegate, so we need to -+ // usurp it after the child finishes, or else future breakpoints -+ // will be delegated to a destroyed ArchiveRestoreThread object. -+ debug_->SetDebugDelegate(this); -+ -+ // This is the most important check in this test, since -+ // child.GetBreakCount() will return 1 if the debugger fails to stop -+ // on the `return n + 1` line after the grandchild thread returns. -+ CHECK_EQ(child.GetBreakCount(), 2); -+ } -+ } -+ -+ int GetBreakCount() { return break_count_; } -+ -+ private: -+ v8::Isolate* isolate_; -+ v8::internal::Debug* debug_; -+ const int spawn_count_; -+ int break_count_; -+}; -+ -+TEST(DebugArchiveRestore) { -+ v8::Isolate::CreateParams create_params; -+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); -+ v8::Isolate* isolate = v8::Isolate::New(create_params); -+ -+ ArchiveRestoreThread thread(isolate, 5); -+ // Instead of calling thread.Start() and thread.Join() here, we call -+ // thread.Run() directly, to make sure we exercise archive/restore -+ // logic on the *current* thread as well as other threads. -+ thread.Run(); -+ CHECK_EQ(thread.GetBreakCount(), 2); -+ -+ isolate->Dispose(); -+} -+ - class DebugEventExpectNoException : public v8::debug::DebugDelegate { - public: - void ExceptionThrown(v8::Local paused_context, --- -2.17.0 - - -From 3771c9abc852d73748dde22866e71cd552ec8214 Mon Sep 17 00:00:00 2001 -From: Peter Marshall -Date: Tue, 4 Sep 2018 15:48:15 +0200 -Subject: [PATCH 08/11] deps: backport detailed line info for CPU profiler - -[cpu-profiler] Add flag to always generate accurate line info. -https://chromium.googlesource.com/v8/v8/+/ -56baf56790de439b3f69e887e94beb3b301ed77c - -[cpu-profiler] Turn on detailed line info for optimized code -https://chromium.googlesource.com/v8/v8/+/ -84894ce6d2af7feb9e1f5574409355120887326c - -[cpu-profiler] Separate the flags for generating extra line information -https://chromium.googlesource.com/v8/v8/+/ -30ff6719db441cc7ef220d449970cc169067e256 - -PR-URL: https://github.com/nodejs/node/pull/22688 -Reviewed-By: James M Snell -Reviewed-By: Ruben Bridgewater ---- - src/flag-definitions.h | 3 +++ - src/isolate.cc | 4 ++++ - src/isolate.h | 2 ++ - src/optimized-compilation-info.cc | 2 +- - 4 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/src/flag-definitions.h b/src/flag-definitions.h -index 052869f308..4d5aa6f885 100644 ---- a/src/flag-definitions.h -+++ b/src/flag-definitions.h -@@ -1243,6 +1243,9 @@ DEFINE_BOOL(log_function_events, false, - DEFINE_BOOL(prof, false, - "Log statistical profiling information (implies --log-code).") - -+DEFINE_BOOL(detailed_line_info, true, -+ "Always generate detailed line information for CPU profiling.") -+ - #if defined(ANDROID) - // Phones and tablets have processors that are much slower than desktop - // and laptop computers for which current heuristics are tuned. -diff --git a/src/isolate.cc b/src/isolate.cc -index b0a970305e..b33b713672 100644 ---- a/src/isolate.cc -+++ b/src/isolate.cc -@@ -3247,6 +3247,10 @@ bool Isolate::use_optimizer() { - !is_precise_count_code_coverage() && !is_block_count_code_coverage(); - } - -+bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const { -+ return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info; -+} -+ - bool Isolate::NeedsSourcePositionsForProfiling() const { - return FLAG_trace_deopt || FLAG_trace_turbo || FLAG_trace_turbo_graph || - FLAG_turbo_profiling || FLAG_perf_prof || is_profiling() || -diff --git a/src/isolate.h b/src/isolate.h -index 09aaf99684..d94c0fde14 100644 ---- a/src/isolate.h -+++ b/src/isolate.h -@@ -1044,6 +1044,8 @@ class Isolate : private HiddenFactory { - - bool NeedsSourcePositionsForProfiling() const; - -+ bool NeedsDetailedOptimizedCodeLineInfo() const; -+ - bool is_best_effort_code_coverage() const { - return code_coverage_mode() == debug::Coverage::kBestEffort; - } -diff --git a/src/optimized-compilation-info.cc b/src/optimized-compilation-info.cc -index 09b8a0edea..77730919f1 100644 ---- a/src/optimized-compilation-info.cc -+++ b/src/optimized-compilation-info.cc -@@ -38,7 +38,7 @@ OptimizedCompilationInfo::OptimizedCompilationInfo( - // Collect source positions for optimized code when profiling or if debugger - // is active, to be able to get more precise source positions at the price of - // more memory consumption. -- if (isolate->NeedsSourcePositionsForProfiling()) { -+ if (isolate->NeedsDetailedOptimizedCodeLineInfo()) { - MarkAsSourcePositionsEnabled(); - } - --- -2.17.0 - - -From ff05f6490aa2f568b1f26193cf1033e6392af4b4 Mon Sep 17 00:00:00 2001 -From: Ali Ijaz Sheikh -Date: Tue, 11 Sep 2018 15:40:28 -0700 -Subject: [PATCH 09/11] 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 ---- - src/libplatform/tracing/tracing-controller.cc | 32 +++++++++++-------- - 1 file changed, 18 insertions(+), 14 deletions(-) - -diff --git a/src/libplatform/tracing/tracing-controller.cc b/src/libplatform/tracing/tracing-controller.cc -index b4aa7baf72..e0a6a1234c 100644 ---- a/src/libplatform/tracing/tracing-controller.cc -+++ b/src/libplatform/tracing/tracing-controller.cc -@@ -63,13 +63,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; - } -@@ -81,13 +83,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; - } --- -2.17.0 - - -From ab150160f8149063865729e52c6a7597133f9057 Mon Sep 17 00:00:00 2001 -From: Alexey Kozyatinskiy -Date: Fri, 10 Aug 2018 13:09:49 -0700 -Subject: [PATCH 10/11] deps: cherry-pick dbfcc48 from upstream V8 - -Original commit message: -``` -[inspector] added V8InspectorClient::resourceNameToUrl - -Some clients (see Node.js) use platform path as ScriptOrigin. -Reporting platform path in protocol makes using protocol much harder. -This CL introduced V8InspectorClient::resourceNameToUrl method that -is called for any reported using protocol url. -V8Inspector uses url internally as well so protocol client may generate -pattern for blackboxing with file urls only and does not need to build -complicated regexp that covers files urls and platform paths on -different platforms. - -R=lushnikov@chromium.org -TBR=yangguo@chromium.org - -Bug: none -Change-Id: Iff302e7441df922fa5d689fe510f5a9bfd470b9b -Reviewed-on: https://chromium-review.googlesource.com/1164624 -Commit-Queue: Aleksey Kozyatinskiy -Reviewed-by: Alexei Filippov -Cr-Commit-Position: refs/heads/master@{#55029} -``` -Refs: https://github.com/v8/v8/commit/dbfcc48 -PR-URL: https://github.com/nodejs/node/pull/22251 -Reviewed-By: Eugene Ostroukhov -Reviewed-By: Tiancheng "Timothy" Gu ---- - include/v8-inspector.h | 5 + - src/inspector/v8-debugger-agent-impl.cc | 5 +- - src/inspector/v8-debugger-script.cc | 38 +++--- - src/inspector/v8-debugger-script.h | 11 +- - src/inspector/v8-debugger.cc | 13 +- - src/inspector/v8-profiler-agent-impl.cc | 46 ++++--- - src/inspector/v8-stack-trace-impl.cc | 24 +++- - src/inspector/v8-stack-trace-impl.h | 4 +- - .../resource-name-to-url-expected.txt | 122 ++++++++++++++++++ - .../debugger/resource-name-to-url.js | 49 +++++++ - test/inspector/inspector-test.cc | 15 +++ - test/inspector/isolate-data.cc | 29 +++++ - test/inspector/isolate-data.h | 4 + - 13 files changed, 317 insertions(+), 48 deletions(-) - create mode 100644 deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt - create mode 100644 deps/v8/test/inspector/debugger/resource-name-to-url.js - -diff --git a/include/v8-inspector.h b/include/v8-inspector.h -index d879a94373..ad04d01bd2 100644 ---- a/include/v8-inspector.h -+++ b/include/v8-inspector.h -@@ -215,6 +215,11 @@ class V8_EXPORT V8InspectorClient { - virtual bool canExecuteScripts(int contextGroupId) { return true; } - - virtual void maxAsyncCallStackDepthChanged(int depth) {} -+ -+ virtual std::unique_ptr resourceNameToUrl( -+ const StringView& resourceName) { -+ return nullptr; -+ } - }; - - // These stack trace ids are intended to be passed between debuggers and be -diff --git a/src/inspector/v8-debugger-agent-impl.cc b/src/inspector/v8-debugger-agent-impl.cc -index e4e6492b67..d9cb49b1d4 100644 ---- a/src/inspector/v8-debugger-agent-impl.cc -+++ b/src/inspector/v8-debugger-agent-impl.cc -@@ -1396,7 +1396,7 @@ void V8DebuggerAgentImpl::didParseSource( - protocol::StringUtil::parseJSON(inspected->auxData())); - } - bool isLiveEdit = script->isLiveEdit(); -- bool hasSourceURL = script->hasSourceURL(); -+ bool hasSourceURLComment = script->hasSourceURLComment(); - bool isModule = script->isModule(); - String16 scriptId = script->scriptId(); - String16 scriptURL = script->sourceURL(); -@@ -1416,7 +1416,8 @@ void V8DebuggerAgentImpl::didParseSource( - Maybe executionContextAuxDataParam( - std::move(executionContextAuxData)); - const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; -- const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; -+ const bool* hasSourceURLParam = -+ hasSourceURLComment ? &hasSourceURLComment : nullptr; - const bool* isModuleParam = isModule ? &isModule : nullptr; - std::unique_ptr stack = - V8StackTraceImpl::capture(m_inspector->debugger(), contextGroupId, 1); -diff --git a/src/inspector/v8-debugger-script.cc b/src/inspector/v8-debugger-script.cc -index c40477ae2a..d861265e14 100644 ---- a/src/inspector/v8-debugger-script.cc -+++ b/src/inspector/v8-debugger-script.cc -@@ -6,6 +6,7 @@ - - #include "src/inspector/inspected-context.h" - #include "src/inspector/string-util.h" -+#include "src/inspector/v8-inspector-impl.h" - #include "src/inspector/wasm-translation.h" - #include "src/utils.h" - -@@ -110,9 +111,9 @@ class ActualScript : public V8DebuggerScript { - - public: - ActualScript(v8::Isolate* isolate, v8::Local script, -- bool isLiveEdit) -+ bool isLiveEdit, V8InspectorClient* client) - : V8DebuggerScript(isolate, String16::fromInteger(script->Id()), -- GetNameOrSourceUrl(script)), -+ GetScriptURL(script, client)), - m_isLiveEdit(isLiveEdit) { - Initialize(script); - } -@@ -218,10 +219,18 @@ class ActualScript : public V8DebuggerScript { - } - - private: -- String16 GetNameOrSourceUrl(v8::Local script) { -- v8::Local name; -- if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) -- return toProtocolString(name); -+ String16 GetScriptURL(v8::Local script, -+ V8InspectorClient* client) { -+ v8::Local sourceURL; -+ if (script->SourceURL().ToLocal(&sourceURL) && sourceURL->Length() > 0) -+ return toProtocolString(sourceURL); -+ v8::Local v8Name; -+ if (script->Name().ToLocal(&v8Name) && v8Name->Length() > 0) { -+ String16 name = toProtocolString(v8Name); -+ std::unique_ptr url = -+ client->resourceNameToUrl(toStringView(name)); -+ return url ? toString16(url->string()) : name; -+ } - return String16(); - } - -@@ -231,7 +240,8 @@ class ActualScript : public V8DebuggerScript { - - void Initialize(v8::Local script) { - v8::Local tmp; -- if (script->SourceURL().ToLocal(&tmp)) m_sourceURL = toProtocolString(tmp); -+ m_hasSourceURLComment = -+ script->SourceURL().ToLocal(&tmp) && tmp->Length() > 0; - if (script->SourceMappingURL().ToLocal(&tmp)) - m_sourceMappingURL = toProtocolString(tmp); - m_startLine = script->LineOffset(); -@@ -398,9 +408,9 @@ class WasmVirtualScript : public V8DebuggerScript { - - std::unique_ptr V8DebuggerScript::Create( - v8::Isolate* isolate, v8::Local scriptObj, -- bool isLiveEdit) { -+ bool isLiveEdit, V8InspectorClient* client) { - return std::unique_ptr( -- new ActualScript(isolate, scriptObj, isLiveEdit)); -+ new ActualScript(isolate, scriptObj, isLiveEdit, client)); - } - - std::unique_ptr V8DebuggerScript::CreateWasm( -@@ -418,12 +428,11 @@ V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate, String16 id, - - V8DebuggerScript::~V8DebuggerScript() {} - --const String16& V8DebuggerScript::sourceURL() const { -- return m_sourceURL.isEmpty() ? m_url : m_sourceURL; --} -- - void V8DebuggerScript::setSourceURL(const String16& sourceURL) { -- m_sourceURL = sourceURL; -+ if (sourceURL.length() > 0) { -+ m_hasSourceURLComment = true; -+ m_url = sourceURL; -+ } - } - - bool V8DebuggerScript::setBreakpoint(const String16& condition, -@@ -431,5 +440,4 @@ bool V8DebuggerScript::setBreakpoint(const String16& condition, - v8::HandleScope scope(m_isolate); - return script()->SetBreakpoint(toV8String(m_isolate, condition), loc, id); - } -- - } // namespace v8_inspector -diff --git a/src/inspector/v8-debugger-script.h b/src/inspector/v8-debugger-script.h -index e0e7d93b20..38e6448f48 100644 ---- a/src/inspector/v8-debugger-script.h -+++ b/src/inspector/v8-debugger-script.h -@@ -40,13 +40,14 @@ - namespace v8_inspector { - - // Forward declaration. -+class V8InspectorClient; - class WasmTranslation; - - class V8DebuggerScript { - public: - static std::unique_ptr Create( - v8::Isolate* isolate, v8::Local script, -- bool isLiveEdit); -+ bool isLiveEdit, V8InspectorClient* client); - static std::unique_ptr CreateWasm( - v8::Isolate* isolate, WasmTranslation* wasmTranslation, - v8::Local underlyingScript, String16 id, -@@ -55,9 +56,9 @@ class V8DebuggerScript { - virtual ~V8DebuggerScript(); - - const String16& scriptId() const { return m_id; } -- const String16& url() const { return m_url; } -- bool hasSourceURL() const { return !m_sourceURL.isEmpty(); } -- const String16& sourceURL() const; -+ bool hasSourceURLComment() const { return m_hasSourceURLComment; } -+ const String16& sourceURL() const { return m_url; } -+ - virtual const String16& sourceMappingURL() const = 0; - virtual const String16& source() const = 0; - virtual const String16& hash() const = 0; -@@ -95,7 +96,7 @@ class V8DebuggerScript { - - String16 m_id; - String16 m_url; -- String16 m_sourceURL; -+ bool m_hasSourceURLComment = false; - int m_executionContextId = 0; - - v8::Isolate* m_isolate; -diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc -index 1ceb4210f7..7d1f7cefd1 100644 ---- a/src/inspector/v8-debugger.cc -+++ b/src/inspector/v8-debugger.cc -@@ -226,13 +226,15 @@ void V8Debugger::getCompiledScripts( - v8::Local script = scripts.Get(i); - if (!script->WasCompiled()) continue; - if (script->IsEmbedded()) { -- result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); -+ result.push_back(V8DebuggerScript::Create(m_isolate, script, false, -+ m_inspector->client())); - continue; - } - int contextId; - if (!script->ContextId().To(&contextId)) continue; - if (m_inspector->contextGroupId(contextId) != contextGroupId) continue; -- result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); -+ result.push_back(V8DebuggerScript::Create(m_isolate, script, false, -+ m_inspector->client())); - } - } - -@@ -585,13 +587,14 @@ void V8Debugger::ScriptCompiled(v8::Local script, - }); - } else if (m_ignoreScriptParsedEventsCounter == 0) { - v8::Isolate* isolate = m_isolate; -+ V8InspectorClient* client = m_inspector->client(); - m_inspector->forEachSession( - m_inspector->contextGroupId(contextId), -- [&isolate, &script, &has_compile_error, -- &is_live_edited](V8InspectorSessionImpl* session) { -+ [&isolate, &script, &has_compile_error, &is_live_edited, -+ &client](V8InspectorSessionImpl* session) { - if (!session->debuggerAgent()->enabled()) return; - session->debuggerAgent()->didParseSource( -- V8DebuggerScript::Create(isolate, script, is_live_edited), -+ V8DebuggerScript::Create(isolate, script, is_live_edited, client), - !has_compile_error); - }); - } -diff --git a/src/inspector/v8-profiler-agent-impl.cc b/src/inspector/v8-profiler-agent-impl.cc -index 59a99d79d5..f14815fdc4 100644 ---- a/src/inspector/v8-profiler-agent-impl.cc -+++ b/src/inspector/v8-profiler-agent-impl.cc -@@ -7,6 +7,7 @@ - #include - - #include "src/base/atomicops.h" -+#include "src/debug/debug-interface.h" - #include "src/flags.h" // TODO(jgruber): Remove include and DEPS entry. - #include "src/inspector/protocol/Protocol.h" - #include "src/inspector/string-util.h" -@@ -31,6 +32,15 @@ static const char typeProfileStarted[] = "typeProfileStarted"; - - namespace { - -+String16 resourceNameToUrl(V8InspectorImpl* inspector, -+ v8::Local v8Name) { -+ String16 name = toProtocolString(v8Name); -+ if (!inspector) return name; -+ std::unique_ptr url = -+ inspector->client()->resourceNameToUrl(toStringView(name)); -+ return url ? toString16(url->string()) : name; -+} -+ - std::unique_ptr> - buildInspectorObjectForPositionTicks(const v8::CpuProfileNode* node) { - unsigned lineCount = node->GetHitLineCount(); -@@ -51,13 +61,14 @@ buildInspectorObjectForPositionTicks(const v8::CpuProfileNode* node) { - } - - std::unique_ptr buildInspectorObjectFor( -- v8::Isolate* isolate, const v8::CpuProfileNode* node) { -+ V8InspectorImpl* inspector, const v8::CpuProfileNode* node) { -+ v8::Isolate* isolate = inspector->isolate(); - v8::HandleScope handleScope(isolate); - auto callFrame = - protocol::Runtime::CallFrame::create() - .setFunctionName(toProtocolString(node->GetFunctionName())) - .setScriptId(String16::fromInteger(node->GetScriptId())) -- .setUrl(toProtocolString(node->GetScriptResourceName())) -+ .setUrl(resourceNameToUrl(inspector, node->GetScriptResourceName())) - .setLineNumber(node->GetLineNumber() - 1) - .setColumnNumber(node->GetColumnNumber() - 1) - .build(); -@@ -107,18 +118,19 @@ std::unique_ptr> buildInspectorObjectForTimestamps( - return array; - } - --void flattenNodesTree(v8::Isolate* isolate, const v8::CpuProfileNode* node, -+void flattenNodesTree(V8InspectorImpl* inspector, -+ const v8::CpuProfileNode* node, - protocol::Array* list) { -- list->addItem(buildInspectorObjectFor(isolate, node)); -+ list->addItem(buildInspectorObjectFor(inspector, node)); - const int childrenCount = node->GetChildrenCount(); - for (int i = 0; i < childrenCount; i++) -- flattenNodesTree(isolate, node->GetChild(i), list); -+ flattenNodesTree(inspector, node->GetChild(i), list); - } - - std::unique_ptr createCPUProfile( -- v8::Isolate* isolate, v8::CpuProfile* v8profile) { -+ V8InspectorImpl* inspector, v8::CpuProfile* v8profile) { - auto nodes = protocol::Array::create(); -- flattenNodesTree(isolate, v8profile->GetTopDownRoot(), nodes.get()); -+ flattenNodesTree(inspector, v8profile->GetTopDownRoot(), nodes.get()); - return protocol::Profiler::Profile::create() - .setNodes(std::move(nodes)) - .setStartTime(static_cast(v8profile->GetStartTime())) -@@ -320,7 +332,7 @@ std::unique_ptr createCoverageRange( - } - - Response coverageToProtocol( -- v8::Isolate* isolate, const v8::debug::Coverage& coverage, -+ V8InspectorImpl* inspector, const v8::debug::Coverage& coverage, - std::unique_ptr>* - out_result) { - std::unique_ptr> result = -@@ -361,8 +373,10 @@ Response coverageToProtocol( - } - String16 url; - v8::Local name; -- if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) { -+ if (script->SourceURL().ToLocal(&name) && name->Length()) { - url = toProtocolString(name); -+ } else if (script->Name().ToLocal(&name) && name->Length()) { -+ url = resourceNameToUrl(inspector, name); - } - result->addItem(protocol::Profiler::ScriptCoverage::create() - .setScriptId(String16::fromInteger(script->Id())) -@@ -384,7 +398,7 @@ Response V8ProfilerAgentImpl::takePreciseCoverage( - } - v8::HandleScope handle_scope(m_isolate); - v8::debug::Coverage coverage = v8::debug::Coverage::CollectPrecise(m_isolate); -- return coverageToProtocol(m_isolate, coverage, out_result); -+ return coverageToProtocol(m_session->inspector(), coverage, out_result); - } - - Response V8ProfilerAgentImpl::getBestEffortCoverage( -@@ -393,12 +407,12 @@ Response V8ProfilerAgentImpl::getBestEffortCoverage( - v8::HandleScope handle_scope(m_isolate); - v8::debug::Coverage coverage = - v8::debug::Coverage::CollectBestEffort(m_isolate); -- return coverageToProtocol(m_isolate, coverage, out_result); -+ return coverageToProtocol(m_session->inspector(), coverage, out_result); - } - - namespace { - std::unique_ptr> --typeProfileToProtocol(v8::Isolate* isolate, -+typeProfileToProtocol(V8InspectorImpl* inspector, - const v8::debug::TypeProfile& type_profile) { - std::unique_ptr> - result = protocol::Array::create(); -@@ -426,8 +440,10 @@ typeProfileToProtocol(v8::Isolate* isolate, - } - String16 url; - v8::Local name; -- if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) { -+ if (script->SourceURL().ToLocal(&name) && name->Length()) { - url = toProtocolString(name); -+ } else if (script->Name().ToLocal(&name) && name->Length()) { -+ url = resourceNameToUrl(inspector, name); - } - result->addItem(protocol::Profiler::ScriptTypeProfile::create() - .setScriptId(String16::fromInteger(script->Id())) -@@ -462,7 +478,7 @@ Response V8ProfilerAgentImpl::takeTypeProfile( - v8::HandleScope handle_scope(m_isolate); - v8::debug::TypeProfile type_profile = - v8::debug::TypeProfile::Collect(m_isolate); -- *out_result = typeProfileToProtocol(m_isolate, type_profile); -+ *out_result = typeProfileToProtocol(m_session->inspector(), type_profile); - return Response::OK(); - } - -@@ -491,7 +507,7 @@ std::unique_ptr V8ProfilerAgentImpl::stopProfiling( - m_profiler->StopProfiling(toV8String(m_isolate, title)); - std::unique_ptr result; - if (profile) { -- if (serialize) result = createCPUProfile(m_isolate, profile); -+ if (serialize) result = createCPUProfile(m_session->inspector(), profile); - profile->Delete(); - } - --m_startedProfilesCount; -diff --git a/src/inspector/v8-stack-trace-impl.cc b/src/inspector/v8-stack-trace-impl.cc -index 75293c59af..9be0d4fa38 100644 ---- a/src/inspector/v8-stack-trace-impl.cc -+++ b/src/inspector/v8-stack-trace-impl.cc -@@ -7,6 +7,7 @@ - #include - - #include "src/inspector/v8-debugger.h" -+#include "src/inspector/v8-inspector-impl.h" - #include "src/inspector/wasm-translation.h" - - namespace v8_inspector { -@@ -73,7 +74,10 @@ std::unique_ptr buildInspectorObjectCommon( - std::unique_ptr> - inspectorFrames = protocol::Array::create(); - for (size_t i = 0; i < frames.size(); i++) { -- inspectorFrames->addItem(frames[i]->buildInspectorObject()); -+ V8InspectorClient* client = nullptr; -+ if (debugger && debugger->inspector()) -+ client = debugger->inspector()->client(); -+ inspectorFrames->addItem(frames[i]->buildInspectorObject(client)); - } - std::unique_ptr stackTrace = - protocol::Runtime::StackTrace::create() -@@ -117,7 +121,9 @@ StackFrame::StackFrame(v8::Local v8Frame) - m_scriptId(String16::fromInteger(v8Frame->GetScriptId())), - m_sourceURL(toProtocolString(v8Frame->GetScriptNameOrSourceURL())), - m_lineNumber(v8Frame->GetLineNumber() - 1), -- m_columnNumber(v8Frame->GetColumn() - 1) { -+ m_columnNumber(v8Frame->GetColumn() - 1), -+ m_hasSourceURLComment(v8Frame->GetScriptName() != -+ v8Frame->GetScriptNameOrSourceURL()) { - DCHECK_NE(v8::Message::kNoLineNumberInfo, m_lineNumber + 1); - DCHECK_NE(v8::Message::kNoColumnInfo, m_columnNumber + 1); - } -@@ -137,12 +143,20 @@ int StackFrame::lineNumber() const { return m_lineNumber; } - - int StackFrame::columnNumber() const { return m_columnNumber; } - --std::unique_ptr StackFrame::buildInspectorObject() -- const { -+std::unique_ptr StackFrame::buildInspectorObject( -+ V8InspectorClient* client) const { -+ String16 frameUrl = m_sourceURL; -+ if (client && !m_hasSourceURLComment && frameUrl.length() > 0) { -+ std::unique_ptr url = -+ client->resourceNameToUrl(toStringView(m_sourceURL)); -+ if (url) { -+ frameUrl = toString16(url->string()); -+ } -+ } - return protocol::Runtime::CallFrame::create() - .setFunctionName(m_functionName) - .setScriptId(m_scriptId) -- .setUrl(m_sourceURL) -+ .setUrl(frameUrl) - .setLineNumber(m_lineNumber) - .setColumnNumber(m_columnNumber) - .build(); -diff --git a/src/inspector/v8-stack-trace-impl.h b/src/inspector/v8-stack-trace-impl.h -index a8f23c48b6..019fd469cd 100644 ---- a/src/inspector/v8-stack-trace-impl.h -+++ b/src/inspector/v8-stack-trace-impl.h -@@ -33,7 +33,8 @@ class StackFrame { - const String16& sourceURL() const; - int lineNumber() const; // 0-based. - int columnNumber() const; // 0-based. -- std::unique_ptr buildInspectorObject() const; -+ std::unique_ptr buildInspectorObject( -+ V8InspectorClient* client) const; - bool isEqual(StackFrame* frame) const; - - private: -@@ -42,6 +43,7 @@ class StackFrame { - String16 m_sourceURL; - int m_lineNumber; // 0-based. - int m_columnNumber; // 0-based. -+ bool m_hasSourceURLComment; - }; - - class V8StackTraceImpl : public V8StackTrace { -diff --git a/test/inspector/debugger/resource-name-to-url-expected.txt b/test/inspector/debugger/resource-name-to-url-expected.txt -new file mode 100644 -index 0000000000..0ecd0b82ef ---- /dev/null -+++ b/test/inspector/debugger/resource-name-to-url-expected.txt -@@ -0,0 +1,122 @@ -+Tests V8InspectorClient::resourceNameToUrl. -+Check script with url: -+{ -+ method : Debugger.scriptParsed -+ params : { -+ endColumn : 16 -+ endLine : 0 -+ executionContextId : -+ hasSourceURL : false -+ hash : 033b33d191ed51ed823355d865eb871d811403e2 -+ isLiveEdit : false -+ isModule : false -+ length : 16 -+ scriptId : -+ sourceMapURL : -+ startColumn : 0 -+ startLine : 0 -+ url : prefix://url -+ } -+} -+Check script with sourceURL comment: -+{ -+ method : Debugger.scriptParsed -+ params : { -+ endColumn : 37 -+ endLine : 0 -+ executionContextId : -+ hasSourceURL : true -+ hash : 06c136ce206c5f505f32af524e6ec71b5baa0bbb -+ isLiveEdit : false -+ isModule : false -+ length : 37 -+ scriptId : -+ sourceMapURL : -+ startColumn : 0 -+ startLine : 0 -+ url : foo.js -+ } -+} -+Check script failed to parse: -+{ -+ method : Debugger.scriptFailedToParse -+ params : { -+ endColumn : 15 -+ endLine : 0 -+ executionContextId : -+ hasSourceURL : false -+ hash : 033b33d191ed51ed1f44cd0465eb871d811403e2 -+ isModule : false -+ length : 15 -+ scriptId : -+ sourceMapURL : -+ startColumn : 0 -+ startLine : 0 -+ url : prefix://url -+ } -+} -+Check script failed to parse with sourceURL comment: -+{ -+ method : Debugger.scriptFailedToParse -+ params : { -+ endColumn : 36 -+ endLine : 0 -+ executionContextId : -+ hasSourceURL : true -+ hash : 23a2885951475580023e2a742563d78876d8f05e -+ isModule : false -+ length : 36 -+ scriptId : -+ sourceMapURL : -+ startColumn : 0 -+ startLine : 0 -+ url : foo.js -+ } -+} -+Test runtime stack trace: -+{ -+ method : Runtime.consoleAPICalled -+ params : { -+ args : [ -+ [0] : { -+ description : 42 -+ type : number -+ value : 42 -+ } -+ ] -+ executionContextId : -+ stackTrace : { -+ callFrames : [ -+ [0] : { -+ columnNumber : 14 -+ functionName : foo -+ lineNumber : 2 -+ scriptId : -+ url : prefix://url -+ } -+ [1] : { -+ columnNumber : 0 -+ functionName : -+ lineNumber : 0 -+ scriptId : -+ url : boo.js -+ } -+ [2] : { -+ columnNumber : 4 -+ functionName : -+ lineNumber : 4 -+ scriptId : -+ url : prefix://url -+ } -+ ] -+ } -+ timestamp : -+ type : log -+ } -+} -+Test debugger stack trace: -+[ -+ [0] : prefix://url -+ [1] : boo.js -+ [2] : prefix://url -+] -diff --git a/test/inspector/debugger/resource-name-to-url.js b/test/inspector/debugger/resource-name-to-url.js -new file mode 100644 -index 0000000000..620c7a2864 ---- /dev/null -+++ b/test/inspector/debugger/resource-name-to-url.js -@@ -0,0 +1,49 @@ -+// Copyright 2018 the V8 project authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+let {session, contextGroup, Protocol} = InspectorTest.start( -+ 'Tests V8InspectorClient::resourceNameToUrl.'); -+ -+(async function test(){ -+ Protocol.Runtime.enable(); -+ await Protocol.Debugger.enable(); -+ contextGroup.addScript(`inspector.setResourceNamePrefix('prefix://')`); -+ await Protocol.Debugger.onceScriptParsed(); -+ -+ InspectorTest.log('Check script with url:'); -+ contextGroup.addScript('function foo(){}', 0, 0, 'url'); -+ InspectorTest.logMessage(await Protocol.Debugger.onceScriptParsed()); -+ -+ InspectorTest.log('Check script with sourceURL comment:'); -+ contextGroup.addScript('function foo(){} //# sourceURL=foo.js', 0, 0, 'url'); -+ InspectorTest.logMessage(await Protocol.Debugger.onceScriptParsed()); -+ -+ InspectorTest.log('Check script failed to parse:'); -+ contextGroup.addScript('function foo(){', 0, 0, 'url'); -+ InspectorTest.logMessage(await Protocol.Debugger.onceScriptFailedToParse()); -+ -+ InspectorTest.log('Check script failed to parse with sourceURL comment:'); -+ contextGroup.addScript('function foo(){ //# sourceURL=foo.js', 0, 0, 'url'); -+ InspectorTest.logMessage(await Protocol.Debugger.onceScriptFailedToParse()); -+ -+ InspectorTest.log('Test runtime stack trace:'); -+ contextGroup.addScript(` -+ function foo() { -+ console.log(42); -+ } -+ eval('foo(); //# sourceURL=boo.js'); -+ `, 0, 0, 'url'); -+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); -+ -+ InspectorTest.log('Test debugger stack trace:'); -+ contextGroup.addScript(` -+ function foo() { -+ debugger; -+ } -+ eval('foo(); //# sourceURL=boo.js'); -+ `, 0, 0, 'url'); -+ const {params:{callFrames}} = await Protocol.Debugger.oncePaused(); -+ InspectorTest.logMessage(callFrames.map(frame => frame.url)); -+ InspectorTest.completeTest(); -+})(); -diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc -index 668a9463d5..93a8b1d3f2 100644 ---- a/test/inspector/inspector-test.cc -+++ b/test/inspector/inspector-test.cc -@@ -712,6 +712,9 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { - ToV8String(isolate, "setAllowCodeGenerationFromStrings"), - v8::FunctionTemplate::New( - isolate, &InspectorExtension::SetAllowCodeGenerationFromStrings)); -+ inspector->Set(ToV8String(isolate, "setResourceNamePrefix"), -+ v8::FunctionTemplate::New( -+ isolate, &InspectorExtension::SetResourceNamePrefix)); - global->Set(ToV8String(isolate, "inspector"), inspector); - } - -@@ -973,6 +976,18 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { - args.GetIsolate()->GetCurrentContext()->AllowCodeGenerationFromStrings( - args[0].As()->Value()); - } -+ -+ static void SetResourceNamePrefix( -+ const v8::FunctionCallbackInfo& args) { -+ if (args.Length() != 1 || !args[0]->IsString()) { -+ fprintf(stderr, "Internal error: setResourceNamePrefix('prefix')."); -+ Exit(); -+ } -+ v8::Isolate* isolate = args.GetIsolate(); -+ v8::Local context = isolate->GetCurrentContext(); -+ IsolateData* data = IsolateData::FromContext(context); -+ data->SetResourceNamePrefix(v8::Local::Cast(args[0])); -+ } - }; - - bool RunExtraCode(v8::Isolate* isolate, v8::Local context, -diff --git a/test/inspector/isolate-data.cc b/test/inspector/isolate-data.cc -index 15eee89a61..a669cc41a1 100644 ---- a/test/inspector/isolate-data.cc -+++ b/test/inspector/isolate-data.cc -@@ -423,3 +423,32 @@ void IsolateData::maxAsyncCallStackDepthChanged(int depth) { - if (!log_max_async_call_stack_depth_changed_) return; - fprintf(stdout, "maxAsyncCallStackDepthChanged: %d\n", depth); - } -+ -+void IsolateData::SetResourceNamePrefix(v8::Local prefix) { -+ resource_name_prefix_.Reset(v8::Isolate::GetCurrent(), prefix); -+} -+ -+namespace { -+class StringBufferImpl : public v8_inspector::StringBuffer { -+ public: -+ StringBufferImpl(v8::Isolate* isolate, v8::Local string) -+ : data_(ToVector(string)), -+ view_(data_.start(), data_.length()) {} -+ const v8_inspector::StringView& string() override { return view_; } -+ -+ private: -+ v8::internal::Vector data_; -+ v8_inspector::StringView view_; -+}; -+} // anonymous namespace -+ -+std::unique_ptr IsolateData::resourceNameToUrl( -+ const v8_inspector::StringView& resourceName) { -+ if (resource_name_prefix_.IsEmpty()) return nullptr; -+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); -+ v8::HandleScope handle_scope(isolate); -+ v8::Local name = ToString(isolate, resourceName); -+ v8::Local prefix = resource_name_prefix_.Get(isolate); -+ v8::Local url = v8::String::Concat(prefix, name); -+ return std::unique_ptr(new StringBufferImpl(isolate, url)); -+} -diff --git a/test/inspector/isolate-data.h b/test/inspector/isolate-data.h -index 5eb9803a74..d0a263e573 100644 ---- a/test/inspector/isolate-data.h -+++ b/test/inspector/isolate-data.h -@@ -76,6 +76,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { - void FireContextCreated(v8::Local context, int context_group_id); - void FireContextDestroyed(v8::Local context); - void FreeContext(v8::Local context); -+ void SetResourceNamePrefix(v8::Local prefix); - - private: - struct VectorCompare { -@@ -114,6 +115,8 @@ class IsolateData : public v8_inspector::V8InspectorClient { - v8_inspector::V8StackTrace*) override; - bool isInspectableHeapObject(v8::Local) override; - void maxAsyncCallStackDepthChanged(int depth) override; -+ std::unique_ptr resourceNameToUrl( -+ const v8_inspector::StringView& resourceName) override; - - // The isolate gets deleted by its {Dispose} method, not by the default - // deleter. Therefore we have to define a custom deleter for the unique_ptr to -@@ -141,6 +144,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { - bool log_console_api_message_calls_ = false; - bool log_max_async_call_stack_depth_changed_ = false; - v8::Global not_inspectable_private_; -+ v8::Global resource_name_prefix_; - - DISALLOW_COPY_AND_ASSIGN(IsolateData); - }; --- -2.17.0 - - -From dafaa6ecb520df3761ed68115ee3e6b102963092 Mon Sep 17 00:00:00 2001 -From: Yang Guo -Date: Mon, 17 Sep 2018 07:43:46 +0200 -Subject: [PATCH 11/11] deps: add missing HandleScope in FieldType::PrintTo - -Refs: https://github.com/nodejs/node/issues/22775 - -PR-URL: https://github.com/nodejs/node/pull/22890 -Reviewed-By: Ruben Bridgewater -Reviewed-By: Anna Henningsen -Reviewed-By: Refael Ackermann ---- - src/field-type.cc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/field-type.cc b/src/field-type.cc -index 3b51095323..2eebebe3d6 100644 ---- a/src/field-type.cc -+++ b/src/field-type.cc -@@ -78,6 +78,7 @@ void FieldType::PrintTo(std::ostream& os) { - os << "None"; - } else { - DCHECK(IsClass()); -+ HandleScope scope(Map::cast(this)->GetIsolate()); - os << "Class(" << static_cast(*AsClass()) << ")"; - } - } --- -2.17.0 - diff --git a/patches/common/v8/ostreams.patch b/patches/common/v8/ostreams.patch index d0f7eb18ef..e38374623d 100644 --- a/patches/common/v8/ostreams.patch +++ b/patches/common/v8/ostreams.patch @@ -1,5 +1,11 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Mon, 22 Oct 2018 10:47:12 -0700 +Subject: ostreams.patch + + diff --git a/src/ostreams.h b/src/ostreams.h -index c6b64a1cd9..236a73d018 100644 +index c6b64a1cd95b92ed37abe56d71dd6132c4ff9db4..236a73d01800f58a4f37c8abdd8df346d8fcf2c5 100644 --- a/src/ostreams.h +++ b/src/ostreams.h @@ -32,7 +32,7 @@ class OFStreamBase : public std::streambuf { @@ -11,3 +17,6 @@ index c6b64a1cd9..236a73d018 100644 public: explicit OFStream(FILE* f); virtual ~OFStream(); +-- +2.17.0 + diff --git a/script/apply-patches b/script/apply-patches deleted file mode 100755 index ea6a082293..0000000000 --- a/script/apply-patches +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -import argparse -import os -import subprocess -import sys - -from lib import git -from lib.patches import PatchesConfig - - -SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) -PATCHES_DIR = os.path.join(SOURCE_ROOT, 'patches') -PATCHES_COMMON_DIR = os.path.join(PATCHES_DIR, 'common') -PATCHES_MIPS64EL_DIR = os.path.join(PATCHES_DIR, 'mips64el') -SRC = 'src' -SRC_DIR = os.path.join(SOURCE_ROOT, SRC) - - -def main(): - args = parse_args() - - project_root = os.path.abspath(args.project_root) - - for folder in args.folders: - error = apply_patches_for_dir(folder, project_root, args.commit) - if error: - sys.stderr.write(error + '\n') - sys.stderr.flush() - return 1 - - return 0 - - -def apply_patches_for_dir(directory, project_root, commit): - for root, dirs, files in os.walk(directory): - config = PatchesConfig.from_directory(root, project_root=project_root) - patches_list = config.get_patches_list() - if patches_list is None: - continue - - (success, failed_patches) = patches_list.apply(commit=commit) - if not success: - patch_path = failed_patches[0].get_file_path() - return '{0} failed to apply'.format(os.path.basename(patch_path)) - - -def parse_args(): - parser = argparse.ArgumentParser(description='Apply all required patches.') - - parser.add_argument('--commit', default=False, action='store_true', - help='Commit a patch after it has been applied') - parser.add_argument('--project-root', required=False, default=git.get_repo_root(os.path.abspath(__file__)), - help='Parent folder to resolve repos relative paths against') - parser.add_argument('-t', '--target_arch', - help='Target architecture') - - parser.add_argument('-f', '--folder', dest='folders', help='Apply patches from this folder', nargs='*', default=[]) - - args = parser.parse_args() - if not args.folders: - args.folders.append(PATCHES_COMMON_DIR) - if args.target_arch == 'mips64el': - args.folders.append(PATCHES_MIPS64EL_DIR) - return args - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/script/apply_all_patches.py b/script/apply_all_patches.py new file mode 100644 index 0000000000..54e69192d2 --- /dev/null +++ b/script/apply_all_patches.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +from lib import git +from lib.patches import patch_from_dir + + +patch_dirs = { + 'src/electron/patches/common/chromium': + 'src', + + 'src/electron/patches/common/boringssl': + 'src/third_party/boringssl/src', + + 'src/electron/patches/common/ffmpeg': + 'src/third_party/ffmpeg', + + 'src/electron/patches/common/skia': + 'src/third_party/skia', + + 'src/electron/patches/common/v8': + 'src/v8', +} + + +def apply_patches(dirs): + for patch_dir, repo in dirs.iteritems(): + git.am(repo=repo, patch_data=patch_from_dir(patch_dir), + committer_name="Electron Scripts", committer_email="scripts@electron") + + +def main(): + apply_patches(patch_dirs) + + +if __name__ == '__main__': + main() diff --git a/script/git-export-patches b/script/git-export-patches new file mode 100755 index 0000000000..f83d7984c3 --- /dev/null +++ b/script/git-export-patches @@ -0,0 +1,126 @@ +#!/usr/bin/env python + +import argparse +import os +import re +import subprocess +import sys + + +def guess_base_commit(repo): + """Guess which commit the patches might be based on""" + args = [ + 'git', + '-C', + repo, + 'describe', + '--tags', + ] + return subprocess.check_output(args).split('-')[0:2] + + +def format_patch(repo, since): + args = [ + 'git', + '-C', + repo, + 'format-patch', + '--keep-subject', + '--no-stat', + '--stdout', + + # The name of the parent commit object isn't useful information in this + # context, so zero it out to avoid needless patch-file churn. + '--zero-commit', + + # Some versions of git print out different numbers of characters in the + # 'index' line of patches, so pass --full-index to get consistent + # behaviour. + '--full-index', + since + ] + return subprocess.check_output(args) + + +def split_patches(patch_data): + """Split a concatenated series of patches into N separate patches""" + patches = [] + patch_start = re.compile('^From [0-9a-f]+ ') + for line in patch_data.splitlines(): + if patch_start.match(line): + patches.append([]) + patches[-1].append(line) + return patches + + +def munge_subject_to_filename(subject): + """Derive a suitable filename from a commit's subject""" + if subject.endswith('.patch'): + subject = subject[:-6] + return re.sub(r'[^A-Za-z0-9-]+', '_', subject).strip('_').lower() + '.patch' + + +def get_file_name(patch): + """Return the name of the file to which the patch should be written""" + for line in patch: + if line.startswith('Patch-Filename: '): + return line[len('Patch-Filename: '):] + # If no patch-filename header, munge the subject. + for line in patch: + if line.startswith('Subject: '): + return munge_subject_to_filename(line[len('Subject: '):]) + + +def remove_patch_filename(patch): + """Strip out the Patch-Filename trailer from a patch's message body""" + force_keep_next_line = False + for i, l in enumerate(patch): + is_patchfilename = l.startswith('Patch-Filename: ') + next_is_patchfilename = i < len(patch) - 1 and patch[i+1].startswith('Patch-Filename: ') + if not force_keep_next_line and (is_patchfilename or (next_is_patchfilename and len(l.rstrip()) == 0)): + pass # drop this line + else: + yield l + force_keep_next_line = l.startswith('Subject: ') + + +def main(argv): + parser = argparse.ArgumentParser() + parser.add_argument("-o", "--output", + help="directory into which exported patches will be written") + parser.add_argument("patch_range", + nargs='?', + help="range of patches to export. Defaults to all commits since the " + "most recent tag or remote branch.") + args = parser.parse_args(argv) + + repo = '.' + patch_range = args.patch_range + if patch_range is None: + patch_range, num_patches = guess_base_commit(repo) + sys.stderr.write("Exporting {} patches since {}\n".format(num_patches, patch_range)) + patch_data = format_patch(repo, patch_range) + patches = split_patches(patch_data) + + out_dir = args.output + try: + os.mkdir(out_dir) + except OSError: + pass + + # remove old patches, so that deleted commits are correctly reflected in the + # patch files (as a removed file) + for p in os.listdir(out_dir): + if p.endswith('.patch'): + os.remove(os.path.join(out_dir, p)) + + with open(os.path.join(out_dir, '.patches'), 'w') as pl: + for patch in patches: + filename = get_file_name(patch) + with open(os.path.join(out_dir, filename), 'w') as f: + f.write('\n'.join(remove_patch_filename(patch))) + pl.write(filename + '\n') + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/script/git-import-patches b/script/git-import-patches new file mode 100755 index 0000000000..91d7e1e540 --- /dev/null +++ b/script/git-import-patches @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import argparse +import os +import sys + +from lib import git +from lib.patches import patch_from_dir + + +def main(argv): + parser = argparse.ArgumentParser() + parser.add_argument("patch_dir", + help="directory containing patches to apply") + parser.add_argument("-3", "--3way", + action="store_true", dest='threeway', + help="use 3-way merge to resolve conflicts") + args = parser.parse_args(argv) + + git.am( + repo='.', + patch_data=patch_from_dir(args.patch_dir), + threeway=args.threeway + ) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/script/lib/git.py b/script/lib/git.py index 1bcb698ca5..c78db07b56 100644 --- a/script/lib/git.py +++ b/script/lib/git.py @@ -9,8 +9,6 @@ structure, or make assumptions about the passed arguments or calls' outcomes. import os import subprocess -from lib.util import scoped_cwd - def is_repo_root(path): path_exists = os.path.exists(path) @@ -42,8 +40,28 @@ def get_repo_root(path): return get_repo_root(parent_path) +def am(repo, patch_data, threeway=False, + committer_name=None, committer_email=None): + args = [] + if threeway: + args += ['--3way'] + root_args = ['-C', repo] + if committer_name is not None: + root_args += ['-c', 'user.name=' + committer_name] + if committer_email is not None: + root_args += ['-c', 'user.email=' + committer_email] + command = ['git'] + root_args + ['am'] + args + proc = subprocess.Popen( + command, + stdin=subprocess.PIPE) + proc.communicate(patch_data) + if proc.returncode != 0: + raise RuntimeError("Command {} returned {}".format(command, + proc.returncode)) + + def apply_patch(repo, patch_path, directory=None, index=False, reverse=False): - args = ['git', 'apply', + args = ['git', '-C', repo, 'apply', '--ignore-space-change', '--ignore-whitespace', '--whitespace', 'fix' @@ -56,35 +74,31 @@ def apply_patch(repo, patch_path, directory=None, index=False, reverse=False): args += ['--reverse'] args += ['--', patch_path] - with scoped_cwd(repo): - return_code = subprocess.call(args) - applied_successfully = (return_code == 0) - return applied_successfully + return_code = subprocess.call(args) + applied_successfully = (return_code == 0) + return applied_successfully def get_patch(repo, commit_hash): - args = ['git', 'diff-tree', + args = ['git', '-C', repo, 'diff-tree', '-p', commit_hash, '--' # Explicitly tell Git `commit_hash` is a revision, not a path. ] - with scoped_cwd(repo): - return subprocess.check_output(args) + return subprocess.check_output(args) def get_head_commit(repo): - args = ['git', 'rev-parse', 'HEAD'] + args = ['git', '-C', repo, 'rev-parse', 'HEAD'] - with scoped_cwd(repo): - return subprocess.check_output(args).strip() + return subprocess.check_output(args).strip() def reset(repo): - args = ['git', 'reset'] + args = ['git', '-C', repo, 'reset'] - with scoped_cwd(repo): - subprocess.check_call(args) + subprocess.check_call(args) def commit(repo, author, message): @@ -96,12 +110,11 @@ def commit(repo, author, message): env['GIT_COMMITTER_NAME'] = 'Anonymous Committer' env['GIT_COMMITTER_EMAIL'] = 'anonymous@electronjs.org' - args = ['git', 'commit', + args = ['git', '-C', repo, 'commit', '--author', author, '--message', message ] - with scoped_cwd(repo): - return_code = subprocess.call(args, env=env) - committed_successfully = (return_code == 0) - return committed_successfully + return_code = subprocess.call(args, env=env) + committed_successfully = (return_code == 0) + return committed_successfully diff --git a/script/lib/patches.py b/script/lib/patches.py index 274df0ac30..92533b45da 100644 --- a/script/lib/patches.py +++ b/script/lib/patches.py @@ -1,177 +1,27 @@ #!/usr/bin/env python import os -import sys - -from lib import git - -SOURCE_ROOT = os.path.abspath(os.path.dirname( - os.path.dirname(os.path.dirname(__file__)))) -VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor') -PYYAML_LIB_DIR = os.path.join(VENDOR_DIR, 'pyyaml', 'lib') -sys.path.append(PYYAML_LIB_DIR) -import yaml #pylint: disable=wrong-import-position,wrong-import-order - -class Patch: - def __init__(self, file_path, repo_path, paths_prefix=None, - author='Anonymous ', description=None): - self.author = author - self.description = description - self.file_path = file_path - self.paths_prefix = paths_prefix - self.repo_path = repo_path - - def apply(self, reverse=False, commit=False, index=False): - # Add the change to index only if we're going to commit it later. - add_to_index = index or commit - patch_applied = git.apply_patch(self.repo_path, self.file_path, - directory=self.paths_prefix, - index=add_to_index, reverse=reverse) - - if not patch_applied: - return False - - if commit: - message = self.__get_commit_message(reverse) - patch_committed = git.commit(self.repo_path, author=self.author, - message=message) - return patch_committed - - return True - - def __get_commit_message(self, reverse): - message = self.description - - if message is None: - message = os.path.basename(self.file_path) - - if reverse: - message = 'Revert: ' + message - - return message - - def reverse(self): - return self.apply(reverse=True) - - def get_file_path(self): - return self.file_path -class PatchesList: - """A list of patches for a specific git repo.""" - - def __init__(self, repo_path, patches): - # TODO(alexeykuzmin): Make sure that all patches have the same repo_path. - self.repo_path = repo_path - self.patches = patches - - def __len__(self): - return len(self.patches) - - def apply(self, reverse=False, stop_on_error=True, commit=False): - all_patches_applied = True - failed_patches = [] - - for patch in self.patches: - # Even if `commit` is True we're not going to commit - # individual patches, it takes too much time in the Chromium repo. - # Applying all commits takes about 10 minutes (!) on a fast dev machine. - # Instead of it we are going only to add all changes to the index - # and commit them all at once later. - applied_successfully = patch.apply(reverse=reverse, index=commit, - commit=False) - - if not applied_successfully: - all_patches_applied = False - failed_patches.append(patch) - - should_stop_now = not applied_successfully and stop_on_error - if should_stop_now: - break - - if commit and not all_patches_applied: - git.reset(self.repo_path) - - if commit and all_patches_applied: - author = 'Electron Build Process ' - message = 'Apply Electron patches' - git.commit(self.repo_path, author=author, message=message) - - return (all_patches_applied, failed_patches) - - def reverse(self, stop_on_error=True, commit=False): - return self.apply(reverse=True, stop_on_error=stop_on_error, commit=commit) +def read_patch(patch_dir, patch_filename): + """Read a patch from |patch_dir/filename| and amend the commit message with + metadata about the patch file it came from.""" + ret = [] + with open(os.path.join(patch_dir, patch_filename)) as f: + for l in f.readlines(): + if l.startswith('diff -'): + ret.append('Patch-Filename: {}\n'.format(patch_filename)) + ret.append(l) + return ''.join(ret) -class PatchesConfig: - @staticmethod - def from_directory(dir_path, project_root, config_name='.patches.yaml'): - config_path = os.path.join(dir_path, config_name) - return PatchesConfig(config_path, project_root) +def patch_from_dir(patch_dir): + """Read a directory of patches into a format suitable for passing to + 'git am'""" + with open(os.path.join(patch_dir, ".patches")) as f: + patch_list = [l.rstrip('\n') for l in f.readlines()] - def __init__(self, config_path, project_root): - self.path = config_path - self.patches_list = None - self.project_root = project_root - - def __parse(self): - contents = None - - if os.path.isfile(self.path): - with open(self.path, 'r') as stream: - try: - contents = yaml.load(stream) - except yaml.YAMLError as e: - print(e) - - return contents - - def __create_patch(self, raw_data, base_directory, repo_path, paths_prefix): - author = raw_data['author'] - if author is None: # Shouldn't actually happen. - author = 'Anonymous ' - - relative_file_path = raw_data['file'] - absolute_file_path = os.path.join(base_directory, relative_file_path) - - # Use a patch file path as a commit summary - # and optional description as a commit body. - description = relative_file_path - if raw_data['description'] is not None: - description += '\n\n' + raw_data['description'] - - return Patch(absolute_file_path, repo_path, paths_prefix=paths_prefix, - author=author, description=description) - - def __create_patches_list(self): - config_contents = self.__parse() - if config_contents is None: - return None - - relative_repo_path = os.path.normpath(config_contents['repo']) - absolute_repo_path = os.path.join(self.project_root, relative_repo_path) - - # If the 'repo' path is not really a git repository, - # then use that path as a prefix for patched files. - paths_prefix = None - if not git.is_repo_root(absolute_repo_path): - assert(git.is_repo_root(self.project_root)) - absolute_repo_path = self.project_root - paths_prefix = relative_repo_path - - patches_data = config_contents['patches'] - base_directory = os.path.abspath(os.path.dirname(self.path)) - - patches = [self.__create_patch(data, base_directory, absolute_repo_path, - paths_prefix) for data in patches_data] - patches_list = PatchesList(repo_path=absolute_repo_path, patches=patches) - return patches_list - - def get_patches_list(self): - if self.patches_list is not None: - return self.patches_list - - patches_list = self.__create_patches_list() - self.patches_list = patches_list - - return patches_list + return ''.join([ + read_patch(patch_dir, patch_filename) + for patch_filename in patch_list + ]) diff --git a/script/patch.py b/script/patch.py deleted file mode 100755 index 275b7e82bf..0000000000 --- a/script/patch.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -""" -Usage: patch -h - -Use this script to selectively apply and reverse patches. -It is mostly useful to fix patches during upgrades to a new Chromium version. -""" - -import argparse -import os -import subprocess -import sys - -import lib.git as git -from lib.patches import Patch, PatchesList, PatchesConfig - - -def main(): - args = parse_args() - - directory = args.directory - force = args.force - patches = args.patch - project_root = args.project_root - repo = args.repo - reverse = args.reverse - - if directory: - (success, failed_patches) = apply_patches_from_directory( - directory, project_root, force, reverse) - else: - (success, failed_patches) = apply_patches(repo, patches, force, reverse) - - if success: - print 'Done: All patches applied.' - else: - failed_patches_paths = [p.get_file_path() for p in failed_patches] - print 'Error: {0} patch(es) failed:\n{1}'.format( - len(failed_patches), '\n'.join(failed_patches_paths)) - - return 0 if success else 1 - - -def apply_patches(repo_path, patches_paths, force=False, reverse=False): - absolute_repo_path = os.path.abspath(repo_path) - patches = [Patch(os.path.abspath(patch_path), absolute_repo_path) - for patch_path in patches_paths] - patches_list = PatchesList(repo_path=absolute_repo_path, patches=patches) - stop_on_error = not force - return patches_list.apply(reverse=reverse, stop_on_error=stop_on_error) - - -def apply_patches_from_directory(directory, project_root, - force=False, reverse=False): - config = PatchesConfig.from_directory(directory, project_root=project_root) - patches_list = config.get_patches_list() - - # Notify user if we didn't find any patch files. - if patches_list is None or len(patches_list) == 0: - print 'Warning: No patches found in the "{0}" folder.'.format(directory) - return (True, []) - - # Then try to apply patches. - stop_on_error = not force - return patches_list.apply(reverse=reverse, stop_on_error=stop_on_error) - - -def parse_args(): - parser = argparse.ArgumentParser(description='Apply patches to a git repo') - parser.add_argument('-f', '--force', default=False, action='store_true', - help='Do not stop on the first failed patch.') - parser.add_argument('--project-root', required=False, - default=git.get_repo_root(os.path.abspath(__file__)), - help='A folder to resolve repos relative paths against') - parser.add_argument('-R', '--reverse', default=False, action='store_true', - help='Apply patches in reverse.') - parser.add_argument('-r', '--repo', help='Path to a repository root folder.') - - paths_group = parser.add_mutually_exclusive_group(required=True) - paths_group.add_argument('-d', '--directory', - help='Path to a directory with patches. \ - If present, -p/--patch is ignored.') - paths_group.add_argument('-p', '--patch', nargs='*', - help='Path(s) to a patch file(s).') - - args = parser.parse_args() - - # Additional rules. - if args.patch is not None and args.repo is None: - parser.error("Repository path (-r/--repo) is required \ - when you supply patches list.") - - return args - - -if __name__ == '__main__': - sys.exit(main())