From 9a058fb7661975aa4a2bfd73c12db3e816556a15 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 8 Apr 2020 15:32:17 -0700 Subject: [PATCH] ci: auto-3way patches and detect changes (#23034) --- .circleci/config.yml | 31 +++- DEPS | 2 + .../chromium/browser_compositor_mac.patch | 2 +- .../chromium/cherry-pick-db71a0afc1d0.patch | 114 -------------- .../common/chromium/command-ismediakey.patch | 6 +- .../fix_disabling_compositor_recycling.patch | 2 +- .../fix_hi-dpi_transitions_on_catalina.patch | 18 +-- ...check_false_disable_touch_bar_typing.patch | 10 +- patches/common/chromium/mas-cfisobjc.patch | 6 +- .../chromium/mas_blink_no_private_api.patch | 6 +- .../mas_disable_custom_window_frame.patch | 16 +- .../mas_disable_remote_accessibility.patch | 26 ++-- .../chromium/mas_disable_remote_layer.patch | 18 +-- .../mas_disable_spi_file_type_mappings.patch | 6 +- .../common/chromium/mas_no_private_api.patch | 42 ++--- .../render_widget_host_view_mac.patch | 8 +- .../common/chromium/webview_cross_drag.patch | 2 +- patches/common/ffmpeg/build_gn.patch | 4 +- .../fix_bug_in_receiver_maps_inference.patch | 4 +- ...ix_memory_leak_in_prototypeusers_add.patch | 2 +- ...ng_back_node_with_ltcg_configuration.patch | 4 +- patches/node/fix_enable_worker_threads.patch | 4 +- ..._and_options_parser_for_debug_builds.patch | 26 ++-- .../fix_uv_fs_mkdir_for_invalid_names.patch | 21 +-- .../fsevents-regression-in-watching.patch | 11 +- ...s-stop-using-fsevents-to-watch-files.patch | 11 +- ...win-fix-uv_spawn-ENOMEM-on-empty-env.patch | 14 +- script/apply_all_patches.py | 6 + script/export_all_patches.py | 31 ++++ script/git-export-patches | 137 +---------------- script/lib/git.py | 144 +++++++++++++++++- 31 files changed, 349 insertions(+), 385 deletions(-) delete mode 100644 patches/common/chromium/cherry-pick-db71a0afc1d0.patch create mode 100644 script/export_all_patches.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c651bf8c38ef..f0e860af93534 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -208,11 +208,30 @@ step-gclient-sync: &step-gclient-sync # If we did not restore a complete sync then we need to sync for realz if [ ! -s "src/electron/.circle-sync-done" ]; then gclient config \ - --name "src/electron" \ - --unmanaged \ - $GCLIENT_EXTRA_ARGS \ - "$CIRCLE_REPOSITORY_URL" - gclient sync --with_branch_heads --with_tags + --name "src/electron" \ + --unmanaged \ + $GCLIENT_EXTRA_ARGS \ + "$CIRCLE_REPOSITORY_URL" + + ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags + # Re-export all the patches to check if there were changes. + python src/electron/script/export_all_patches.py src/electron/patches/common/config.json + cd src/electron + git update-index --refresh || true + if ! git diff-index --quiet HEAD --; then + # There are changes to the patches. Make a git commit with the updated patches + git add patches + GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="anonymous@electronjs.org" git commit -m "update patches" --author="Electron Bot " + # Export it + mkdir -p ../../patches + git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch + echo + echo "======================================================================" + echo "There were changes to the patches when applying." + echo "Check the CI artifacts for a patch you can apply to fix it." + echo "======================================================================" + exit 1 + fi fi step-setup-env-for-build: &step-setup-env-for-build @@ -747,6 +766,8 @@ steps-checkout-fast: &steps-checkout-fast - *step-set-git-cache-path # This sync call only runs if .circle-sync-done is an EMPTY file - *step-gclient-sync + - store_artifacts: + path: patches # These next few steps reset Electron to the correct commit regardless of which cache was restored - run: name: Wipe Electron diff --git a/DEPS b/DEPS index a1cb6573c2ba9..e6ddcb607ba52 100644 --- a/DEPS +++ b/DEPS @@ -154,3 +154,5 @@ hooks = [ recursedeps = [ 'src', ] + +# Touch DEPS to bust cache diff --git a/patches/common/chromium/browser_compositor_mac.patch b/patches/common/chromium/browser_compositor_mac.patch index 7e47d8119f0bd..1024e5c0ce083 100644 --- a/patches/common/chromium/browser_compositor_mac.patch +++ b/patches/common/chromium/browser_compositor_mac.patch @@ -29,7 +29,7 @@ diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/cont index 4b3f3c7e97e73ad6d0166ad114f4168d9ed00e11..59e58d693c971742951434f6582140d9179235f2 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.mm +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm -@@ -80,6 +80,12 @@ +@@ -80,6 +80,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { DCHECK_EQ(1u, num_erased); } diff --git a/patches/common/chromium/cherry-pick-db71a0afc1d0.patch b/patches/common/chromium/cherry-pick-db71a0afc1d0.patch deleted file mode 100644 index a7139da7f8eb6..0000000000000 --- a/patches/common/chromium/cherry-pick-db71a0afc1d0.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Raymond Toy -Date: Thu, 19 Mar 2020 21:54:36 +0000 -Subject: Clear context from orphan handlers when BaseAudioContext is going - away - -When preparing to collect a BaseAudioContext, go through all the -rendering_orphan_handlers_ and deletable_orphan_handlers_ and remove -the context from the handler. This ensures that these handlers no -longer have references to the context when the BaseAudioContext is -destroyed because in some cases, these orphan handlers will get pulled -and access the context, which is already gone. - -Clearing these in a prefinalizer ensures these orphan handlers don't -try to touch the context. - -Manually verified that the repro case no longer reproduces. - -Bug: 1062247 -Change-Id: I50d083743903eb9544e09aa1ee912fc880331501 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107806 -Reviewed-by: Kentaro Hara -Reviewed-by: Hongchan Choi -Commit-Queue: Raymond Toy -Cr-Commit-Position: refs/heads/master@{#751814} - -diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc -index c232899becfa2810a3dd86b5404050498aeca84f..0004f0c9470620f3201afe1d5fe535f17bc963f3 100644 ---- a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc -+++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc -@@ -187,6 +187,12 @@ void BaseAudioContext::Uninitialize() { - DCHECK_EQ(resume_resolvers_.size(), 0u); - } - -+void BaseAudioContext::Dispose() { -+ // BaseAudioContext is going away, so remove the context from the orphan -+ // handlers. -+ GetDeferredTaskHandler().ClearContextFromOrphanHandlers(); -+} -+ - void BaseAudioContext::ContextLifecycleStateChanged( - mojom::FrameLifecycleState state) { - // Don't need to do anything for an offline context. -diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.h b/third_party/blink/renderer/modules/webaudio/base_audio_context.h -index 8351bd861e871e441b467c509d16f930e083f2a8..88244e5f24775c5bd59057ae9ffff2149d110e1f 100644 ---- a/third_party/blink/renderer/modules/webaudio/base_audio_context.h -+++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.h -@@ -95,6 +95,7 @@ class MODULES_EXPORT BaseAudioContext - public ContextLifecycleStateObserver { - USING_GARBAGE_COLLECTED_MIXIN(BaseAudioContext); - DEFINE_WRAPPERTYPEINFO(); -+ USING_PRE_FINALIZER(BaseAudioContext, Dispose); - - public: - // The state of an audio context. On creation, the state is Suspended. The -@@ -119,6 +120,8 @@ class MODULES_EXPORT BaseAudioContext - return dest ? dest->GetAudioDestinationHandler().IsInitialized() : false; - } - -+ void Dispose(); -+ - // Document notification - void ContextLifecycleStateChanged(mojom::FrameLifecycleState) override; - void ContextDestroyed(ExecutionContext*) override; -diff --git a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc -index e8fe36a1060ae846692f90bee836304ec593fc46..b1b189567dca1b83277f02952719d384c638b32b 100644 ---- a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc -+++ b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc -@@ -293,10 +293,7 @@ void DeferredTaskHandler::HandleDeferredTasks() { - } - - void DeferredTaskHandler::ContextWillBeDestroyed() { -- for (auto& handler : rendering_orphan_handlers_) -- handler->ClearContext(); -- for (auto& handler : deletable_orphan_handlers_) -- handler->ClearContext(); -+ ClearContextFromOrphanHandlers(); - ClearHandlersToBeDeleted(); - // Some handlers might live because of their cross thread tasks. - } -@@ -359,6 +356,19 @@ void DeferredTaskHandler::ClearHandlersToBeDeleted() { - active_source_handlers_.clear(); - } - -+void DeferredTaskHandler::ClearContextFromOrphanHandlers() { -+ DCHECK(IsMainThread()); -+ -+ // |rendering_orphan_handlers_| and |deletable_orphan_handlers_| can -+ // be modified on the audio thread. -+ GraphAutoLocker locker(*this); -+ -+ for (auto& handler : rendering_orphan_handlers_) -+ handler->ClearContext(); -+ for (auto& handler : deletable_orphan_handlers_) -+ handler->ClearContext(); -+} -+ - void DeferredTaskHandler::SetAudioThreadToCurrentThread() { - DCHECK(!IsMainThread()); - audio_thread_.store(CurrentThread(), std::memory_order_relaxed); -diff --git a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h -index 0ede5f5b5dabeeef9decc94c94d91ddc7351c722..2900b0f7cf3c47c8e92cc3ad4dda665eabdc479f 100644 ---- a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h -+++ b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h -@@ -109,6 +109,9 @@ class MODULES_EXPORT DeferredTaskHandler final - void RequestToDeleteHandlersOnMainThread(); - void ClearHandlersToBeDeleted(); - -+ // Clear the context from the rendering and deletable orphan handlers. -+ void ClearContextFromOrphanHandlers(); -+ - bool AcceptsTailProcessing() const { return accepts_tail_processing_; } - void StopAcceptingTailProcessing() { accepts_tail_processing_ = false; } - diff --git a/patches/common/chromium/command-ismediakey.patch b/patches/common/chromium/command-ismediakey.patch index fa4e48136f2c2..13324702a96ba 100644 --- a/patches/common/chromium/command-ismediakey.patch +++ b/patches/common/chromium/command-ismediakey.patch @@ -100,7 +100,7 @@ index f4e3126a4efd66f05c4f13e40ba23db10b8cca96..9232dda3fc82d9ad56fef96a25993121 } return VKEY_UNKNOWN; } -@@ -193,7 +200,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy, +@@ -193,7 +200,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy, int key_code = (data1 & 0xFFFF0000) >> 16; if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT && key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST && @@ -112,7 +112,7 @@ index f4e3126a4efd66f05c4f13e40ba23db10b8cca96..9232dda3fc82d9ad56fef96a25993121 return event; } -@@ -224,6 +234,7 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy, +@@ -224,6 +234,7 @@ std::unique_ptr MediaKeysListener::Create( // For Mac OS 10.12.2 or later, we want to use MPRemoteCommandCenter for // getting media keys globally if there is a RemoteCommandCenterDelegate // available. @@ -120,7 +120,7 @@ index f4e3126a4efd66f05c4f13e40ba23db10b8cca96..9232dda3fc82d9ad56fef96a25993121 if (@available(macOS 10.12.2, *)) { if (scope == Scope::kGlobal && now_playing::RemoteCommandCenterDelegate::GetInstance()) { -@@ -233,6 +244,7 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy, +@@ -233,6 +244,7 @@ std::unique_ptr MediaKeysListener::Create( return std::move(listener); } } diff --git a/patches/common/chromium/fix_disabling_compositor_recycling.patch b/patches/common/chromium/fix_disabling_compositor_recycling.patch index 0c344d4fd8fa7..29d292a84ade5 100644 --- a/patches/common/chromium/fix_disabling_compositor_recycling.patch +++ b/patches/common/chromium/fix_disabling_compositor_recycling.patch @@ -9,7 +9,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont index 2b10c5b8f6d4a7a091ef3dd9d8ff324e5663f768..477cef4973bc4f2d50aa173571fc1d2bcd0a6469 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -485,7 +485,12 @@ +@@ -485,7 +485,12 @@ void RenderWidgetHostViewMac::WasUnOccluded() { void RenderWidgetHostViewMac::WasOccluded() { host()->WasHidden(); diff --git a/patches/common/chromium/fix_hi-dpi_transitions_on_catalina.patch b/patches/common/chromium/fix_hi-dpi_transitions_on_catalina.patch index 43def24c70a2c..94967e4a14661 100644 --- a/patches/common/chromium/fix_hi-dpi_transitions_on_catalina.patch +++ b/patches/common/chromium/fix_hi-dpi_transitions_on_catalina.patch @@ -48,7 +48,7 @@ diff --git a/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm b/co index 402b6099126e0ac8dd3b6be5c0ffb1a1946dc139..c6b03fe02d9228bc22b9343687ea845c77c47d8d 100644 --- a/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm +++ b/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm -@@ -310,9 +310,11 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { +@@ -310,9 +310,11 @@ BridgedNativeWidgetImpl::BridgedNativeWidgetImpl( bridge_mojo_binding_(this) { DCHECK(GetIdToWidgetImplMap().find(id_) == GetIdToWidgetImplMap().end()); GetIdToWidgetImplMap().insert(std::make_pair(id_, this)); @@ -60,7 +60,7 @@ index 402b6099126e0ac8dd3b6be5c0ffb1a1946dc139..c6b03fe02d9228bc22b9343687ea845c // The delegate should be cleared already. Note this enforces the precondition // that -[NSWindow close] is invoked on the hosted window before the // destructor is called. -@@ -1102,7 +1104,17 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { +@@ -1102,7 +1104,17 @@ remote_cocoa::DragDropClient* BridgedNativeWidgetImpl::drag_drop_client() { } //////////////////////////////////////////////////////////////////////////////// @@ -83,7 +83,7 @@ diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168706b3f33 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm -@@ -31,8 +31,8 @@ +@@ -31,8 +31,8 @@ Boolean CGDisplayUsesForceToGray(void); namespace display { namespace { @@ -94,7 +94,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168 const int64_t kConfigureDelayMs = 500; NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) { -@@ -155,20 +155,27 @@ CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) { +@@ -155,20 +155,27 @@ class ScreenMac : public Screen { CGDisplayRegisterReconfigurationCallback( ScreenMac::DisplayReconfigurationCallBack, this); @@ -126,7 +126,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168 CGDisplayRemoveReconfigurationCallback( ScreenMac::DisplayReconfigurationCallBack, this); -@@ -193,16 +200,18 @@ bool IsWindowUnderCursor(gfx::NativeWindow native_window) override { +@@ -193,16 +200,18 @@ class ScreenMac : public Screen { int GetNumDisplays() const override { return GetAllDisplays().size(); } const std::vector& GetAllDisplays() const override { @@ -147,7 +147,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168 if (!window) return GetPrimaryDisplay(); -@@ -275,31 +284,30 @@ void RemoveObserver(DisplayObserver* observer) override { +@@ -275,31 +284,30 @@ class ScreenMac : public Screen { static void DisplayReconfigurationCallBack(CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void* userInfo) { @@ -189,7 +189,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168 if (displays_require_update_) { displays_ = BuildDisplaysFromQuartz(); displays_require_update_ = false; -@@ -307,7 +315,7 @@ void EnsureDisplaysValid() const { +@@ -307,7 +315,7 @@ class ScreenMac : public Screen { } void ConfigureTimerFired() { @@ -198,7 +198,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168 change_notifier_.NotifyDisplaysChanged(old_displays_, displays_); old_displays_ = displays_; } -@@ -321,7 +329,7 @@ void ConfigureTimerFired() { +@@ -321,7 +329,7 @@ class ScreenMac : public Screen { // It would be ridiculous to have this many displays connected, but // CGDirectDisplayID is just an integer, so supporting up to this many // doesn't hurt. @@ -207,7 +207,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168 CGDisplayCount online_display_count = 0; if (CGGetOnlineDisplayList(base::size(online_displays), online_displays, &online_display_count) != kCGErrorSuccess) { -@@ -357,21 +365,32 @@ void ConfigureTimerFired() { +@@ -357,21 +365,32 @@ class ScreenMac : public Screen { : displays; } diff --git a/patches/common/chromium/make_autocorrect_off_and_spellcheck_false_disable_touch_bar_typing.patch b/patches/common/chromium/make_autocorrect_off_and_spellcheck_false_disable_touch_bar_typing.patch index b38ff8f5d6922..68a3bbc547a66 100644 --- a/patches/common/chromium/make_autocorrect_off_and_spellcheck_false_disable_touch_bar_typing.patch +++ b/patches/common/chromium/make_autocorrect_off_and_spellcheck_false_disable_touch_bar_typing.patch @@ -32,7 +32,7 @@ diff --git a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge_loc index 2aa04c3764e6361fccec7ba47feb51fa40d99d3b..6bea303d86447f8a1311c67e183b4724b2e802e8 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge_local.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge_local.mm -@@ -185,9 +185,11 @@ +@@ -185,9 +185,11 @@ void RenderWidgetHostNSViewBridgeLocal::CancelComposition() { [cocoa_view_ cancelComposition]; } @@ -79,7 +79,7 @@ index 46fcb918f42654ec1d7d2c5c5ea70e4a402dede1..2815129bd44643fea242977a7f7dcf9d #include "ui/accessibility/platform/ax_platform_node.h" #import "ui/base/clipboard/clipboard_util_mac.h" #import "ui/base/cocoa/appkit_utils.h" -@@ -190,6 +191,7 @@ - (void)candidateListTouchBarItem:(NSCandidateListTouchBarItem*)anItem +@@ -190,6 +191,7 @@ void ExtractUnderlines(NSAttributedString* string, @implementation RenderWidgetHostViewCocoa @synthesize markedRange = markedRange_; @synthesize textInputType = textInputType_; @@ -87,7 +87,7 @@ index 46fcb918f42654ec1d7d2c5c5ea70e4a402dede1..2815129bd44643fea242977a7f7dcf9d @synthesize spellCheckerForTesting = spellCheckerForTesting_; - (id)initWithClient:(RenderWidgetHostNSViewClient*)client -@@ -1945,7 +1947,9 @@ - (void)invalidateTouchBar { +@@ -1945,7 +1947,9 @@ extern NSString* NSTextInputReplacementRangeAttributeName; - (NSTouchBar*)makeTouchBar { if (textInputType_ != ui::TEXT_INPUT_TYPE_NONE && @@ -102,7 +102,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont index 477cef4973bc4f2d50aa173571fc1d2bcd0a6469..2ad881d2dd3bec1de545eaab29b69c12a05bbfe2 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -566,7 +566,11 @@ +@@ -566,7 +566,11 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled( if (!did_update_state) return; @@ -115,7 +115,7 @@ index 477cef4973bc4f2d50aa173571fc1d2bcd0a6469..2ad881d2dd3bec1de545eaab29b69c12 // |updated_view| is the last view to change its TextInputState which can be // used to start/stop monitoring composition info when it has a focused -@@ -582,7 +586,6 @@ +@@ -582,7 +586,6 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled( // Set the monitor state based on the text input focus state. const bool has_focus = HasFocus(); diff --git a/patches/common/chromium/mas-cfisobjc.patch b/patches/common/chromium/mas-cfisobjc.patch index fbe33c570f4cb..5343cb43739f2 100644 --- a/patches/common/chromium/mas-cfisobjc.patch +++ b/patches/common/chromium/mas-cfisobjc.patch @@ -9,7 +9,7 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm index 8b20ebc678c39b722bd5b03930ce89847e8cc73a..dca8c939e757003aafc1528ec7bbb739bf971fa6 100644 --- a/base/mac/foundation_util.mm +++ b/base/mac/foundation_util.mm -@@ -26,7 +26,6 @@ +@@ -26,7 +26,6 @@ CFTypeID SecKeyGetTypeID(); #if !defined(OS_IOS) CFTypeID SecACLGetTypeID(); CFTypeID SecTrustedApplicationGetTypeID(); @@ -17,7 +17,7 @@ index 8b20ebc678c39b722bd5b03930ce89847e8cc73a..dca8c939e757003aafc1528ec7bbb739 #endif } // extern "C" -@@ -315,8 +314,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) { +@@ -315,8 +314,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) { const_cast(reinterpret_cast(cf_val)); DCHECK(!cf_val || CTFontGetTypeID() == CFGetTypeID(cf_val) || @@ -27,7 +27,7 @@ index 8b20ebc678c39b722bd5b03930ce89847e8cc73a..dca8c939e757003aafc1528ec7bbb739 return ns_val; } -@@ -384,9 +382,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) { +@@ -384,9 +382,6 @@ CFCast(const CFTypeRef& cf_val) { return (CTFontRef)(cf_val); } diff --git a/patches/common/chromium/mas_blink_no_private_api.patch b/patches/common/chromium/mas_blink_no_private_api.patch index aee504f2890ae..0b3f506c6d2b1 100644 --- a/patches/common/chromium/mas_blink_no_private_api.patch +++ b/patches/common/chromium/mas_blink_no_private_api.patch @@ -18,7 +18,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d extern "C" { // Kill ring calls. Would be better to use NSKillRing.h, but that's not -@@ -39,38 +40,53 @@ +@@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing(); void _NSNewKillRingSequence(); void _NSSetKillRingToYankedState(); } @@ -92,7 +92,7 @@ index e965faf9fd8d5ec3572d769421f149907d66c67f..b2d0bbd80994fdf9607009d9e27bf4c3 namespace blink { -@@ -72,10 +74,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame, +@@ -72,10 +74,12 @@ bool ThemePainterMac::PaintTextField(const Node* node, // behavior change while remaining a fragile solution. // https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3 if (!use_ns_text_field_cell) { @@ -105,7 +105,7 @@ index e965faf9fd8d5ec3572d769421f149907d66c67f..b2d0bbd80994fdf9607009d9e27bf4c3 return false; } -@@ -161,10 +165,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame, +@@ -161,10 +165,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node, const PaintInfo& paint_info, const IntRect& r) { LocalCurrentGraphicsContext local_context(paint_info.context, r); diff --git a/patches/common/chromium/mas_disable_custom_window_frame.patch b/patches/common/chromium/mas_disable_custom_window_frame.patch index 5367b5bb803f0..e88c3985fd475 100644 --- a/patches/common/chromium/mas_disable_custom_window_frame.patch +++ b/patches/common/chromium/mas_disable_custom_window_frame.patch @@ -18,7 +18,7 @@ index 677279352ba9a0415814654cfb676a240a316bc3..2194a762c6a14233f2246fb320ea1588 @interface NSWindow (PrivateBrowserNativeWidgetAPI) + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle; @end -@@ -69,10 +70,13 @@ - (NSRect)_draggableFrame NS_DEPRECATED_MAC(10_10, 10_11) { +@@ -69,10 +70,13 @@ @end @@ -32,7 +32,7 @@ index 677279352ba9a0415814654cfb676a240a316bc3..2194a762c6a14233f2246fb320ea1588 + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle { // - NSThemeFrame and its subclasses will be nil if it's missing at runtime. if ([BrowserWindowFrame class]) -@@ -87,6 +91,8 @@ - (BOOL)_usesCustomDrawing { +@@ -87,6 +91,8 @@ return NO; } @@ -54,7 +54,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b @interface NSWindow (PrivateAPI) + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle; @end -@@ -18,8 +20,12 @@ - (CGFloat)_titlebarHeight { +@@ -18,8 +20,12 @@ } @end @@ -67,7 +67,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle { if ([NativeWidgetMacFramelessNSWindowFrame class]) { return [NativeWidgetMacFramelessNSWindowFrame class]; -@@ -27,4 +33,6 @@ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle { +@@ -27,4 +33,6 @@ return [super frameViewClassForStyleMask:windowStyle]; } @@ -108,7 +108,7 @@ index aa2bb3a5f886c44f8217eaca8b0d19526090b47e..198d2f03d5b4c41f280bc4d9ce93bdcd - (BOOL)hasKeyAppearance; - (long long)_resizeDirectionForMouseLocation:(CGPoint)location; -@@ -56,6 +58,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event { +@@ -56,6 +58,8 @@ } @end @@ -117,7 +117,7 @@ index aa2bb3a5f886c44f8217eaca8b0d19526090b47e..198d2f03d5b4c41f280bc4d9ce93bdcd @implementation NativeWidgetMacNSWindowTitledFrame - (void)mouseDown:(NSEvent*)event { [self cr_mouseDownOnFrameView:event]; -@@ -76,6 +80,8 @@ - (BOOL)usesCustomDrawing { +@@ -76,6 +80,8 @@ } @end @@ -126,7 +126,7 @@ index aa2bb3a5f886c44f8217eaca8b0d19526090b47e..198d2f03d5b4c41f280bc4d9ce93bdcd @implementation NativeWidgetMacNSWindow { @private base::scoped_nsobject commandDispatcher_; -@@ -153,6 +159,8 @@ - (BOOL)hasViewsMenuActive { +@@ -153,6 +159,8 @@ // NSWindow overrides. @@ -135,7 +135,7 @@ index aa2bb3a5f886c44f8217eaca8b0d19526090b47e..198d2f03d5b4c41f280bc4d9ce93bdcd + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { if (windowStyle & NSWindowStyleMaskTitled) { if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class]) -@@ -164,6 +172,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { +@@ -164,6 +172,8 @@ return [super frameViewClassForStyleMask:windowStyle]; } diff --git a/patches/common/chromium/mas_disable_remote_accessibility.patch b/patches/common/chromium/mas_disable_remote_accessibility.patch index c19fea339cfdc..4f529423cfce6 100644 --- a/patches/common/chromium/mas_disable_remote_accessibility.patch +++ b/patches/common/chromium/mas_disable_remote_accessibility.patch @@ -10,7 +10,7 @@ diff --git a/components/remote_cocoa/app_shim/bridge_factory_impl.mm b/component index 5ed3c60b5f4f502b4171271c4e38c722bddd9d14..20346425bfbb6bea148df8ca1d3e61cdb11be20e 100644 --- a/components/remote_cocoa/app_shim/bridge_factory_impl.mm +++ b/components/remote_cocoa/app_shim/bridge_factory_impl.mm -@@ -43,6 +43,7 @@ +@@ -43,6 +43,7 @@ class Bridge : public BridgedNativeWidgetHostHelper { // BridgedNativeWidgetHostHelper: id GetNativeViewAccessible() override { @@ -18,7 +18,7 @@ index 5ed3c60b5f4f502b4171271c4e38c722bddd9d14..20346425bfbb6bea148df8ca1d3e61cd if (!remote_accessibility_element_) { int64_t browser_pid = 0; std::vector element_token; -@@ -53,6 +54,9 @@ id GetNativeViewAccessible() override { +@@ -53,6 +54,9 @@ class Bridge : public BridgedNativeWidgetHostHelper { ui::RemoteAccessibility::GetRemoteElementFromToken(element_token); } return remote_accessibility_element_.get(); @@ -28,7 +28,7 @@ index 5ed3c60b5f4f502b4171271c4e38c722bddd9d14..20346425bfbb6bea148df8ca1d3e61cd } void DispatchKeyEvent(ui::KeyEvent* event) override { bool event_handled = false; -@@ -90,8 +94,10 @@ void GetWordAt(const gfx::Point& location_in_content, +@@ -90,8 +94,10 @@ class Bridge : public BridgedNativeWidgetHostHelper { mojom::TextInputHostAssociatedPtr text_input_host_ptr_; std::unique_ptr bridge_impl_; @@ -43,7 +43,7 @@ diff --git a/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm b/co index a9f2b8af7deeda5c5c05c6354ce83063c7261afb..402b6099126e0ac8dd3b6be5c0ffb1a1946dc139 100644 --- a/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm +++ b/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm -@@ -543,10 +543,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { +@@ -543,10 +543,12 @@ void BridgedNativeWidgetImpl::CreateContentView(uint64_t ns_view_id, // this should be treated as an error and caught early. CHECK(bridged_view_); @@ -60,7 +60,7 @@ diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/cont index 98b4efbae0082f912f0df3315724db567811d4a1..cc0b1c5b2e7af5cef916c6bb581d33663bc577c4 100644 --- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm +++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm -@@ -60,8 +60,10 @@ id GetFocusedBrowserAccessibilityElement() override { +@@ -60,8 +60,10 @@ class RenderWidgetHostNSViewBridgeOwner return nil; } void SetAccessibilityWindow(NSWindow* window) override { @@ -71,7 +71,7 @@ index 98b4efbae0082f912f0df3315724db567811d4a1..cc0b1c5b2e7af5cef916c6bb581d3366 } void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event, -@@ -122,8 +124,10 @@ void SmartMagnify(const blink::WebGestureEvent& web_event) override { +@@ -122,8 +124,10 @@ class RenderWidgetHostNSViewBridgeOwner mojom::RenderWidgetHostNSViewClientAssociatedPtr client_; std::unique_ptr bridge_; @@ -113,7 +113,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont index a1138408c0985efc1334c9a92f7e875680b69a4a..2b10c5b8f6d4a7a091ef3dd9d8ff324e5663f768 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -244,8 +244,10 @@ +@@ -244,8 +244,10 @@ RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { void RenderWidgetHostViewMac::MigrateNSViewBridge( remote_cocoa::mojom::BridgeFactory* remote_cocoa_application, uint64_t parent_ns_view_id) { @@ -124,7 +124,7 @@ index a1138408c0985efc1334c9a92f7e875680b69a4a..2b10c5b8f6d4a7a091ef3dd9d8ff324e // Disconnect from the previous bridge (this will have the effect of // destroying the associated bridge), and close the binding (to allow it -@@ -1390,8 +1392,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1390,8 +1392,10 @@ RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessible() { gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -135,7 +135,7 @@ index a1138408c0985efc1334c9a92f7e875680b69a4a..2b10c5b8f6d4a7a091ef3dd9d8ff324e return [cocoa_view() window]; } -@@ -1431,9 +1435,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1431,9 +1435,11 @@ id RenderWidgetHostViewMac::GetFocusedBrowserAccessibilityElement() { } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -147,7 +147,7 @@ index a1138408c0985efc1334c9a92f7e875680b69a4a..2b10c5b8f6d4a7a091ef3dd9d8ff324e } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -1914,12 +1920,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1914,12 +1920,14 @@ void RenderWidgetHostViewMac::StopSpeaking() { void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken( const std::vector& window_token) { @@ -232,7 +232,7 @@ diff --git a/ui/views/cocoa/bridged_native_widget_host_impl.mm b/ui/views/cocoa/ index dd3365aa841dc7d4d9c998ff097ffc8f21c811eb..f46c10998f29a15bedc246fd23b53d1b68653ff8 100644 --- a/ui/views/cocoa/bridged_native_widget_host_impl.mm +++ b/ui/views/cocoa/bridged_native_widget_host_impl.mm -@@ -348,14 +348,22 @@ void UpdateCALayerParams(gfx::CALayerParams* ca_layer_params) { +@@ -348,14 +348,22 @@ gfx::NativeViewAccessible BridgedNativeWidgetHostImpl::GetNativeViewAccessibleForNSView() const { if (bridge_impl_) return bridge_impl_->ns_view(); @@ -255,7 +255,7 @@ index dd3365aa841dc7d4d9c998ff097ffc8f21c811eb..f46c10998f29a15bedc246fd23b53d1b } remote_cocoa::mojom::BridgedNativeWidget* BridgedNativeWidgetHostImpl::bridge() -@@ -1172,6 +1180,7 @@ void UpdateCALayerParams(gfx::CALayerParams* ca_layer_params) { +@@ -1172,6 +1180,7 @@ void BridgedNativeWidgetHostImpl::OnFocusWindowToolbar() { void BridgedNativeWidgetHostImpl::SetRemoteAccessibilityTokens( const std::vector& window_token, const std::vector& view_token) { @@ -263,7 +263,7 @@ index dd3365aa841dc7d4d9c998ff097ffc8f21c811eb..f46c10998f29a15bedc246fd23b53d1b remote_window_accessible_ = ui::RemoteAccessibility::GetRemoteElementFromToken(window_token); remote_view_accessible_ = -@@ -1179,14 +1188,17 @@ void UpdateCALayerParams(gfx::CALayerParams* ca_layer_params) { +@@ -1179,14 +1188,17 @@ void BridgedNativeWidgetHostImpl::SetRemoteAccessibilityTokens( [remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()]; [remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_.get()]; diff --git a/patches/common/chromium/mas_disable_remote_layer.patch b/patches/common/chromium/mas_disable_remote_layer.patch index cfd69a42cc058..55b8d580e29f9 100644 --- a/patches/common/chromium/mas_disable_remote_layer.patch +++ b/patches/common/chromium/mas_disable_remote_layer.patch @@ -33,7 +33,7 @@ diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/se index cf6b3450c209db70c2f0bd8658258e01b9f7421c..af720dc0ef327011ec9e965603d4ee6cb9c9edee 100644 --- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm -@@ -57,6 +57,7 @@ +@@ -57,6 +57,7 @@ ImageTransportSurfaceOverlayMac::~ImageTransportSurfaceOverlayMac() { } bool ImageTransportSurfaceOverlayMac::Initialize(gl::GLSurfaceFormat format) { @@ -41,7 +41,7 @@ index cf6b3450c209db70c2f0bd8658258e01b9f7421c..af720dc0ef327011ec9e965603d4ee6c // Create the CAContext to send this to the GPU process, and the layer for // the context. if (use_remote_layer_api_) { -@@ -65,6 +66,7 @@ +@@ -65,6 +66,7 @@ bool ImageTransportSurfaceOverlayMac::Initialize(gl::GLSurfaceFormat format) { [CAContext contextWithCGSConnection:connection_id options:@{}] retain]); [ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()]; } @@ -49,7 +49,7 @@ index cf6b3450c209db70c2f0bd8658258e01b9f7421c..af720dc0ef327011ec9e965603d4ee6c return true; } -@@ -123,7 +125,9 @@ +@@ -123,7 +125,9 @@ gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffersInternal( "GLImpl", static_cast(gl::GetGLImplementation()), "width", pixel_size_.width()); if (use_remote_layer_api_) { @@ -63,7 +63,7 @@ diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated index 60abe639bd9c9cf6885f811c741a45eeb683ec58..c38eed5fbdefc96a3d60e4ab70d3b007264ccb3c 100644 --- a/ui/accelerated_widget_mac/display_ca_layer_tree.mm +++ b/ui/accelerated_widget_mac/display_ca_layer_tree.mm -@@ -98,6 +98,7 @@ - (void)setContentsChanged; +@@ -98,6 +98,7 @@ void DisplayCALayerTree::UpdateCALayerTree( } void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) { @@ -71,7 +71,7 @@ index 60abe639bd9c9cf6885f811c741a45eeb683ec58..c38eed5fbdefc96a3d60e4ab70d3b007 // Early-out if the remote layer has not changed. if ([remote_layer_ contextId] == ca_context_id) return; -@@ -122,6 +123,9 @@ - (void)setContentsChanged; +@@ -122,6 +123,9 @@ void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) { [io_surface_layer_ removeFromSuperlayer]; io_surface_layer_.reset(); } @@ -146,7 +146,7 @@ diff --git a/ui/views/cocoa/bridged_native_widget_host_impl.mm b/ui/views/cocoa/ index be87bb2cede4e859486cc5e4daa1ac435ee8fefa..dd3365aa841dc7d4d9c998ff097ffc8f21c811eb 100644 --- a/ui/views/cocoa/bridged_native_widget_host_impl.mm +++ b/ui/views/cocoa/bridged_native_widget_host_impl.mm -@@ -211,6 +211,8 @@ bool PositionWindowInScreenCoordinates(Widget* widget, +@@ -211,6 +211,8 @@ uint64_t g_last_bridged_native_widget_id = 0; } // namespace @@ -155,7 +155,7 @@ index be87bb2cede4e859486cc5e4daa1ac435ee8fefa..dd3365aa841dc7d4d9c998ff097ffc8f // A gfx::CALayerParams may pass the content to be drawn across processes via // either an IOSurface (sent as mach port) or a CAContextID (which is an // integer). For historical reasons, software compositing uses IOSurfaces. -@@ -265,6 +267,8 @@ void UpdateCALayerParams(gfx::CALayerParams* ca_layer_params) { +@@ -265,6 +267,8 @@ class BridgedNativeWidgetHostImpl::IOSurfaceToRemoteLayerInterceptor { base::scoped_nsobject io_surface_layer_; }; @@ -164,7 +164,7 @@ index be87bb2cede4e859486cc5e4daa1ac435ee8fefa..dd3365aa841dc7d4d9c998ff097ffc8f // static BridgedNativeWidgetHostImpl* BridgedNativeWidgetHostImpl::GetFromNativeWindow( gfx::NativeWindow native_window) { -@@ -1451,6 +1455,7 @@ void UpdateCALayerParams(gfx::CALayerParams* ca_layer_params) { +@@ -1451,6 +1455,7 @@ void BridgedNativeWidgetHostImpl::AcceleratedWidgetCALayerParamsUpdated() { const gfx::CALayerParams* ca_layer_params = compositor_->widget()->GetCALayerParams(); if (ca_layer_params) { @@ -172,7 +172,7 @@ index be87bb2cede4e859486cc5e4daa1ac435ee8fefa..dd3365aa841dc7d4d9c998ff097ffc8f // Replace IOSurface mach ports with CAContextIDs only when using the // out-of-process bridge (to reduce risk, because this workaround is being // merged to late-life-cycle release branches) and when an IOSurface -@@ -1467,8 +1472,11 @@ void UpdateCALayerParams(gfx::CALayerParams* ca_layer_params) { +@@ -1467,8 +1472,11 @@ void BridgedNativeWidgetHostImpl::AcceleratedWidgetCALayerParamsUpdated() { &updated_ca_layer_params); bridge_ptr_->SetCALayerParams(updated_ca_layer_params); } else { diff --git a/patches/common/chromium/mas_disable_spi_file_type_mappings.patch b/patches/common/chromium/mas_disable_spi_file_type_mappings.patch index c711de93189fb..aef314fe25dc3 100644 --- a/patches/common/chromium/mas_disable_spi_file_type_mappings.patch +++ b/patches/common/chromium/mas_disable_spi_file_type_mappings.patch @@ -18,7 +18,7 @@ index a510c87ea7d92763a20db61f1dd946f363fff7a3..b5f8ed97440200c3fccadfccce28c7bc // SPI declaration; see the commentary in GetPlatformExtensionsForMimeType. // iOS must not use any private API, per Apple guideline. -@@ -26,7 +26,7 @@ @interface NSURLFileTypeMappings : NSObject +@@ -26,7 +26,7 @@ + (NSURLFileTypeMappings*)sharedMappings; - (NSArray*)extensionsForMIMEType:(NSString*)mimeType; @end @@ -27,7 +27,7 @@ index a510c87ea7d92763a20db61f1dd946f363fff7a3..b5f8ed97440200c3fccadfccce28c7bc namespace net { -@@ -75,7 +75,7 @@ - (NSArray*)extensionsForMIMEType:(NSString*)mimeType; +@@ -75,7 +75,7 @@ bool PlatformMimeUtil::GetPlatformPreferredExtensionForMimeType( void PlatformMimeUtil::GetPlatformExtensionsForMimeType( const std::string& mime_type, std::unordered_set* extensions) const { @@ -36,7 +36,7 @@ index a510c87ea7d92763a20db61f1dd946f363fff7a3..b5f8ed97440200c3fccadfccce28c7bc NSArray* extensions_list = nil; #else // There is no API for this that uses UTIs. The WebKitSystemInterface call -@@ -90,7 +90,7 @@ - (NSArray*)extensionsForMIMEType:(NSString*)mimeType; +@@ -90,7 +90,7 @@ void PlatformMimeUtil::GetPlatformExtensionsForMimeType( NSArray* extensions_list = [[NSURLFileTypeMappings sharedMappings] extensionsForMIMEType:base::SysUTF8ToNSString(mime_type)]; diff --git a/patches/common/chromium/mas_no_private_api.patch b/patches/common/chromium/mas_no_private_api.patch index 6e98200922c08..cdeaae2fd850f 100644 --- a/patches/common/chromium/mas_no_private_api.patch +++ b/patches/common/chromium/mas_no_private_api.patch @@ -41,7 +41,7 @@ diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/cont index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a279af78c 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.mm +++ b/content/browser/accessibility/browser_accessibility_cocoa.mm -@@ -141,6 +141,7 @@ +@@ -141,6 +141,7 @@ NSDictionary* attributeToMethodNameMap = nil; // VoiceOver uses -1 to mean "no limit" for AXResultsLimit. const int kAXResultsLimitNoLimit = -1; @@ -49,7 +49,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a extern "C" { // The following are private accessibility APIs required for cursor navigation -@@ -346,6 +347,7 @@ void AddMisspelledTextAttributes( +@@ -346,6 +347,7 @@ NSAttributedString* GetAttributedTextForTextMarkerRange( AddMisspelledTextAttributes(text_only_objects, attributed_text); return [attributed_text attributedSubstringFromRange:range]; } @@ -57,7 +57,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a // Returns an autoreleased copy of the AXNodeData's attribute. NSString* NSStringForStringAttribute(BrowserAccessibility* browserAccessibility, -@@ -613,7 +615,9 @@ + (void)initialize { +@@ -613,7 +615,9 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; {NSAccessibilityEditableAncestorAttribute, @"editableAncestor"}, {NSAccessibilityElementBusyAttribute, @"elementBusy"}, {NSAccessibilityEnabledAttribute, @"enabled"}, @@ -67,7 +67,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a {NSAccessibilityExpandedAttribute, @"expanded"}, {NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"}, {NSAccessibilityFocusedAttribute, @"focused"}, -@@ -648,13 +652,17 @@ + (void)initialize { +@@ -648,13 +652,17 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; {NSAccessibilityRowsAttribute, @"rows"}, // TODO(aboxhall): expose // NSAccessibilityServesAsTitleForUIElementsAttribute @@ -85,7 +85,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a {NSAccessibilitySizeAttribute, @"size"}, {NSAccessibilitySortDirectionAttribute, @"sortDirection"}, {NSAccessibilitySubroleAttribute, @"subrole"}, -@@ -1145,6 +1153,7 @@ - (NSNumber*)enabled { +@@ -1145,6 +1153,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; ax::mojom::Restriction::kDisabled]; } @@ -93,7 +93,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a // Returns a text marker that points to the last character in the document that // can be selected with VoiceOver. - (id)endTextMarker { -@@ -1155,6 +1164,7 @@ - (id)endTextMarker { +@@ -1155,6 +1164,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtEndOfAnchor()); } @@ -101,7 +101,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a - (NSNumber*)expanded { if (![self instanceActive]) -@@ -2033,6 +2043,7 @@ - (NSValue*)selectedTextRange { +@@ -2033,6 +2043,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return [NSValue valueWithRange:NSMakeRange(selStart, selLength)]; } @@ -109,7 +109,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a - (id)selectedTextMarkerRange { if (![self instanceActive]) return nil; -@@ -2065,6 +2076,7 @@ - (id)selectedTextMarkerRange { +@@ -2065,6 +2076,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; anchorAffinity, *focusObject, focusOffset, focusAffinity)); } @@ -117,7 +117,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a - (NSValue*)size { if (![self instanceActive]) -@@ -2097,6 +2109,7 @@ - (NSString*)sortDirection { +@@ -2097,6 +2109,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return nil; } @@ -125,7 +125,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a // Returns a text marker that points to the first character in the document that // can be selected with VoiceOver. - (id)startTextMarker { -@@ -2107,6 +2120,7 @@ - (id)startTextMarker { +@@ -2107,6 +2120,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtStartOfAnchor()); } @@ -133,7 +133,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a // Returns a subrole based upon the role. - (NSString*)subrole { -@@ -2407,12 +2421,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range { +@@ -2407,12 +2421,14 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; NSMutableAttributedString* attributedValue = [[[NSMutableAttributedString alloc] initWithString:value] autorelease]; @@ -148,7 +148,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a return [attributedValue attributedSubstringFromRange:range]; } -@@ -2495,6 +2511,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2495,6 +2511,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return ToBrowserAccessibilityCocoa(cell); } @@ -156,7 +156,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) { BrowserAccessibilityPositionInstance position = CreatePositionFromTextMarker(parameter); -@@ -2672,6 +2689,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2672,6 +2689,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; NSString* text = GetTextForTextMarkerRange(parameter); return [NSNumber numberWithInt:[text length]]; } @@ -164,7 +164,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a if ([attribute isEqualToString: NSAccessibilityBoundsForRangeParameterizedAttribute]) { -@@ -2705,6 +2723,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2705,6 +2723,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return nil; } @@ -172,7 +172,7 @@ index 444bb384d8453c19f0eec31dc3411b8684f502ca..9d0fbb5d5faf900810b4f85cc8c9bb3a if ([attribute isEqualToString: NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) { -@@ -2785,6 +2804,7 @@ AXPlatformRange range(position->CreatePreviousLineStartPosition( +@@ -2785,6 +2804,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return @(child->GetIndexInParent()); } @@ -184,7 +184,7 @@ diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm index 0c9de0ce2504dca9e9e628885b3dcfbfc37f9675..d6b4139c4bf486182883a45ba7ccc70d42681998 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm -@@ -491,6 +491,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -491,6 +491,7 @@ NSDictionary* BrowserAccessibilityManagerMac:: [user_info setObject:native_focus_object forKey:NSAccessibilityTextChangeElement]; @@ -192,7 +192,7 @@ index 0c9de0ce2504dca9e9e628885b3dcfbfc37f9675..d6b4139c4bf486182883a45ba7ccc70d id selected_text = [native_focus_object selectedTextMarkerRange]; if (selected_text) { NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute = -@@ -498,6 +499,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -498,6 +499,7 @@ NSDictionary* BrowserAccessibilityManagerMac:: [user_info setObject:selected_text forKey:NSAccessibilitySelectedTextMarkerRangeAttribute]; } @@ -216,7 +216,7 @@ index e59ac93d0e1554a2df5d8c74db2beba25d090228..6657c48664bdec4964b382f80309d1bf namespace content { -@@ -22,6 +24,7 @@ +@@ -22,6 +24,7 @@ namespace { // verifies there are no existing open connections), and then indicates that // Chrome should continue execution without access to launchservicesd. void DisableSystemServices() { @@ -244,7 +244,7 @@ index fcf50dc3bd9a94536d7fc457c4e7b413a83dc672..6252cb195ff77aa31295c4958fd6b80c extern "C" { // Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and // `Karabiner` [3] to programmatically control the Bluetooth state. Calling the -@@ -49,6 +50,7 @@ +@@ -49,6 +50,7 @@ extern "C" { // [4] https://support.apple.com/kb/PH25091 void IOBluetoothPreferenceSetControllerPowerState(int state); } @@ -252,7 +252,7 @@ index fcf50dc3bd9a94536d7fc457c4e7b413a83dc672..6252cb195ff77aa31295c4958fd6b80c namespace { -@@ -121,8 +123,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) { +@@ -121,8 +123,10 @@ BluetoothAdapterMac::BluetoothAdapterMac() controller_state_function_( base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState, base::Unretained(this))), @@ -263,7 +263,7 @@ index fcf50dc3bd9a94536d7fc457c4e7b413a83dc672..6252cb195ff77aa31295c4958fd6b80c should_update_name_(true), classic_discovery_manager_( BluetoothDiscoveryManagerMac::CreateClassic(this)), -@@ -319,8 +323,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) { +@@ -319,8 +323,12 @@ bool BluetoothAdapterMac::IsLowEnergyAvailable() { } bool BluetoothAdapterMac::SetPoweredImpl(bool powered) { diff --git a/patches/common/chromium/render_widget_host_view_mac.patch b/patches/common/chromium/render_widget_host_view_mac.patch index 125b95f881d6a..e3c1c55917a5c 100644 --- a/patches/common/chromium/render_widget_host_view_mac.patch +++ b/patches/common/chromium/render_widget_host_view_mac.patch @@ -20,7 +20,7 @@ index f583a0a6eaacc63941c7bf281534d9d7baeb7f1e..46fcb918f42654ec1d7d2c5c5ea70e4a // These are not documented, so use only after checking -respondsToSelector:. @interface NSApplication (UndocumentedSpeechMethods) - (void)speakString:(NSString*)string; -@@ -403,6 +408,9 @@ - (BOOL)acceptsMouseEventsWhenInactive { +@@ -403,6 +408,9 @@ void ExtractUnderlines(NSAttributedString* string, } - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { @@ -30,7 +30,7 @@ index f583a0a6eaacc63941c7bf281534d9d7baeb7f1e..46fcb918f42654ec1d7d2c5c5ea70e4a return [self acceptsMouseEventsWhenInactive]; } -@@ -785,6 +793,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { +@@ -785,6 +793,10 @@ void ExtractUnderlines(NSAttributedString* string, eventType == NSKeyDown && !(modifierFlags & NSCommandKeyMask); @@ -41,7 +41,7 @@ index f583a0a6eaacc63941c7bf281534d9d7baeb7f1e..46fcb918f42654ec1d7d2c5c5ea70e4a // We only handle key down events and just simply forward other events. if (eventType != NSKeyDown) { clientHelper_->ForwardKeyboardEvent(event, latency_info); -@@ -1498,9 +1510,11 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -1498,9 +1510,11 @@ void ExtractUnderlines(NSAttributedString* string, // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -53,7 +53,7 @@ index f583a0a6eaacc63941c7bf281534d9d7baeb7f1e..46fcb918f42654ec1d7d2c5c5ea70e4a - (NSArray*)validAttributesForMarkedText { // This code is just copied from WebKit except renaming variables. -@@ -1509,7 +1523,10 @@ - (NSArray*)validAttributesForMarkedText { +@@ -1509,7 +1523,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName; initWithObjects:NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName, NSMarkedClauseSegmentAttributeName, diff --git a/patches/common/chromium/webview_cross_drag.patch b/patches/common/chromium/webview_cross_drag.patch index e84f56ae574fe..401f509e2e42d 100644 --- a/patches/common/chromium/webview_cross_drag.patch +++ b/patches/common/chromium/webview_cross_drag.patch @@ -20,7 +20,7 @@ diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser index f4250007968103cb174d201eb377b04e589dc0a8..90e548004049f3636dee08341f2b77af6de78e1a 100644 --- a/content/browser/web_contents/web_drag_dest_mac.mm +++ b/content/browser/web_contents/web_drag_dest_mac.mm -@@ -336,6 +336,7 @@ - (void)setDragStartTrackersForProcess:(int)processID { +@@ -336,6 +336,7 @@ content::GlobalRoutingID GetRenderViewHostID(content::RenderViewHost* rvh) { } - (bool)isValidDragTarget:(content::RenderWidgetHostImpl*)targetRWH { diff --git a/patches/common/ffmpeg/build_gn.patch b/patches/common/ffmpeg/build_gn.patch index 2c38bfa538640..554d7ba89cdff 100644 --- a/patches/common/ffmpeg/build_gn.patch +++ b/patches/common/ffmpeg/build_gn.patch @@ -8,10 +8,10 @@ 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 fd79bc4eaba90ab5e8c6df9942dbfaeeebabbc73..1e1859d5aa1567da8a768c870d8a477b052f50ec 100755 +index 1f11a9731dec49be8f56fae39faad896fb2a48c7..1a6aa50c00262cbb581769ea8a9845caab44c1bc 100755 --- a/BUILD.gn +++ b/BUILD.gn -@@ -397,6 +397,10 @@ if (is_component_ffmpeg) { +@@ -422,6 +422,10 @@ if (is_component_ffmpeg) { # So we can append below and assume they're defined. ldflags = [] diff --git a/patches/common/v8/fix_bug_in_receiver_maps_inference.patch b/patches/common/v8/fix_bug_in_receiver_maps_inference.patch index ba35b2a65cf78..a71f8238461fc 100644 --- a/patches/common/v8/fix_bug_in_receiver_maps_inference.patch +++ b/patches/common/v8/fix_bug_in_receiver_maps_inference.patch @@ -6,10 +6,10 @@ Subject: Fix bug in receiver maps inference Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2062404 diff --git a/src/compiler/node-properties.cc b/src/compiler/node-properties.cc -index f43a348bb2d5b803270e42f64a3c790c52a3581b..ab4ced69ab60d6078aeb27c3d8b97e87400687ce 100644 +index d6528c553a149cb7bcf1543b0e0c3b13d30622b2..92226565ea732d197e582f31d53d28a86236ed2f 100644 --- a/src/compiler/node-properties.cc +++ b/src/compiler/node-properties.cc -@@ -386,6 +386,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMapsUnsafe( +@@ -444,6 +444,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps( // We reached the allocation of the {receiver}. return kNoReceiverMaps; } diff --git a/patches/common/v8/objects_fix_memory_leak_in_prototypeusers_add.patch b/patches/common/v8/objects_fix_memory_leak_in_prototypeusers_add.patch index 4c95dadaf02a3..9529c290ea601 100644 --- a/patches/common/v8/objects_fix_memory_leak_in_prototypeusers_add.patch +++ b/patches/common/v8/objects_fix_memory_leak_in_prototypeusers_add.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Inf=C3=BChr?= Date: Fri, 13 Dec 2019 14:13:21 +0100 -Subject: [objects] Fix memory leak in PrototypeUsers::Add +Subject: Fix memory leak in PrototypeUsers::Add MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/patches/node/build_bring_back_node_with_ltcg_configuration.patch b/patches/node/build_bring_back_node_with_ltcg_configuration.patch index ff48f6394a2f7..7c2732b48e817 100644 --- a/patches/node/build_bring_back_node_with_ltcg_configuration.patch +++ b/patches/node/build_bring_back_node_with_ltcg_configuration.patch @@ -10,7 +10,7 @@ THe fix for this should land in node-gyp as discussed in above issue, landing this as temporary patch. diff --git a/common.gypi b/common.gypi -index bde7d7300f44596abe5cdfac0639ecb1bb4d885f..412f613e7cfcf563fa6a000b932723166ab567da 100644 +index bb60a045c1132bf3a16d0b773ba34e5e9efb0f0c..59d987caa72dc96bfcec6ff9a03c58d655546b5e 100644 --- a/common.gypi +++ b/common.gypi @@ -19,7 +19,7 @@ @@ -22,7 +22,7 @@ index bde7d7300f44596abe5cdfac0639ecb1bb4d885f..412f613e7cfcf563fa6a000b93272316 'node_shared_openssl%': 'false', 'node_tag%': '', -@@ -240,6 +240,26 @@ +@@ -211,6 +211,26 @@ 'cflags': [ '-fPIE' ], 'ldflags': [ '-fPIE', '-pie' ] }], diff --git a/patches/node/fix_enable_worker_threads.patch b/patches/node/fix_enable_worker_threads.patch index 586cd0b46a95c..9aae69c96a8c5 100644 --- a/patches/node/fix_enable_worker_threads.patch +++ b/patches/node/fix_enable_worker_threads.patch @@ -12,10 +12,10 @@ This commit fixes this problem by changing node_worker to use the three-arg implementation of `NewIsolate` to prevent it trying to use a possibly-null ptr. diff --git a/src/node_worker.cc b/src/node_worker.cc -index 8f97f5c351..2bfbb28e61 100644 +index e84b36f132ae3b89b4b0ae101195bcd0ebbf5673..4a95e6e409185341655024a11943aee47a1051e4 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc -@@ -112,7 +112,10 @@ class WorkerThreadData { +@@ -124,7 +124,10 @@ class WorkerThreadData { array_buffer_allocator_(ArrayBufferAllocator::Create()) { CHECK_EQ(uv_loop_init(&loop_), 0); diff --git a/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch b/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch index 07e1eeb8b5d54..2d80c1af4dcbf 100644 --- a/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch +++ b/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch @@ -17,6 +17,19 @@ index b91a5059cd1f19d87e5876c372f3ded60681a5df..f81cf8dfb892a8ddd9084c5d9477b178 public: static void Initialize(v8::Local target, v8::Local unused, +diff --git a/src/node_options.cc b/src/node_options.cc +index 4689a3e405be5fbbe3bb960940b48276669d8bc6..099daaa37da8e8374f28a05b3cf39f8898129802 100644 +--- a/src/node_options.cc ++++ b/src/node_options.cc +@@ -219,7 +219,7 @@ const DebugOptionsParser _dop_instance{}; + const EnvironmentOptionsParser _eop_instance{_dop_instance}; + + template <> +-void Parse( ++void NODE_EXTERN Parse( + StringVector* const args, StringVector* const exec_args, + StringVector* const v8_args, + DebugOptions* const options, diff --git a/src/node_options.h b/src/node_options.h index c79b08ad09c183ad24faf864fb8ba4692b527c70..a116b2fdaad590c8999142d18b9b81dac67b5359 100644 --- a/src/node_options.h @@ -39,16 +52,3 @@ index c79b08ad09c183ad24faf864fb8ba4692b527c70..a116b2fdaad590c8999142d18b9b81da StringVector* const args, StringVector* const exec_args, StringVector* const v8_args, OptionsType* const options, OptionEnvvarSettings required_env_settings, StringVector* const errors); -diff --git a/src/node_options.cc b/src/node_options.cc -index 4689a3e405be5fbbe3bb960940b48276669d8bc6..099daaa37da8e8374f28a05b3cf39f8898129802 100644 ---- a/src/node_options.cc -+++ b/src/node_options.cc -@@ -219,7 +219,7 @@ const DebugOptionsParser _dop_instance{}; - const EnvironmentOptionsParser _eop_instance{_dop_instance}; - - template <> --void Parse( -+void NODE_EXTERN Parse( - StringVector* const args, StringVector* const exec_args, - StringVector* const v8_args, - DebugOptions* const options, diff --git a/patches/node/fix_uv_fs_mkdir_for_invalid_names.patch b/patches/node/fix_uv_fs_mkdir_for_invalid_names.patch index 1ed72b23454be..7ce07de1c3234 100644 --- a/patches/node/fix_uv_fs_mkdir_for_invalid_names.patch +++ b/patches/node/fix_uv_fs_mkdir_for_invalid_names.patch @@ -1,7 +1,10 @@ -From ecff27857dafe3f5d30a6ab8646ea69a93e4940a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Thu, 11 Jul 2019 12:45:38 +0200 -Subject: [PATCH] win, fs: mkdir return UV_EINVAL for invalid names +Subject: win, fs: mkdir return UV_EINVAL for invalid names +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit Makes uv_fs_mkdir return UV_EINVAL for invalid filenames instead of UV_ENOENT. @@ -14,10 +17,10 @@ Reviewed-By: Saúl Ibarra Corretgé Reviewed-By: Colin Ihrig diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c -index 15094121..31242b51 100644 +index 9e2f084c8d0e9c0cc60cf5010bdc396bf5eb22e5..088191320cc671a8bc6ae45f07b3b05f95b01b08 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c -@@ -1180,8 +1180,13 @@ void fs__unlink(uv_fs_t* req) { +@@ -850,8 +850,13 @@ void fs__unlink(uv_fs_t* req) { void fs__mkdir(uv_fs_t* req) { /* TODO: use req->mode. */ @@ -34,10 +37,10 @@ index 15094121..31242b51 100644 diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c -index 35a992d8..95f6b5e9 100644 +index c3153c717b7cd391f71b6184d62e4ee55841591b..fb64ae6b037be591a30a63d9e5450dcfd48e3bdc 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c -@@ -4060,4 +4060,16 @@ TEST_IMPL(fs_fchmod_archive_readonly) { +@@ -3815,4 +3815,16 @@ TEST_IMPL(fs_fchmod_archive_readonly) { return 0; } @@ -55,10 +58,10 @@ index 35a992d8..95f6b5e9 100644 +} #endif diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h -index 3c5f21b9..ffa7e545 100644 +index 8886b07c8a74736208d5614257f832f59d79633a..29e9cbf85df3f07dd3a017ffca1cea0b56e76b89 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h -@@ -380,6 +380,7 @@ TEST_DECLARE (fs_exclusive_sharing_mode) +@@ -372,6 +372,7 @@ TEST_DECLARE (fs_exclusive_sharing_mode) TEST_DECLARE (fs_file_flag_no_buffering) TEST_DECLARE (fs_open_readonly_acl) TEST_DECLARE (fs_fchmod_archive_readonly) @@ -66,7 +69,7 @@ index 3c5f21b9..ffa7e545 100644 #endif TEST_DECLARE (strscpy) TEST_DECLARE (threadpool_queue_work_simple) -@@ -973,6 +974,7 @@ TASK_LIST_START +@@ -957,6 +958,7 @@ TASK_LIST_START TEST_ENTRY (fs_file_flag_no_buffering) TEST_ENTRY (fs_open_readonly_acl) TEST_ENTRY (fs_fchmod_archive_readonly) diff --git a/patches/node/fsevents-regression-in-watching.patch b/patches/node/fsevents-regression-in-watching.patch index e808aba80e358..e32aa0bd3ff6a 100644 --- a/patches/node/fsevents-regression-in-watching.patch +++ b/patches/node/fsevents-regression-in-watching.patch @@ -1,7 +1,10 @@ -From ae12376dbb56fa080b699f00840c7b9c5230a85f Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Sat, 7 Sep 2019 20:45:39 -0400 -Subject: [PATCH] fsevents: regression in watching / +Subject: fsevents: regression in watching / +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit This case got lost by accident in https://github.com/libuv/libuv/pull/2082, @@ -13,7 +16,7 @@ Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé diff --git a/deps/uv/src/unix/fsevents.c b/deps/uv/src/unix/fsevents.c -index ddacda31..deeaa63d 100644 +index ddacda31fef87eee131fc2ee2ff46cc88be429d9..deeaa63d4730de9aa17ee87923acd96d6507a55d 100644 --- a/deps/uv/src/unix/fsevents.c +++ b/deps/uv/src/unix/fsevents.c @@ -263,10 +263,12 @@ static void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef, @@ -32,7 +35,7 @@ index ddacda31..deeaa63d 100644 if (memcmp(path, handle->realpath, handle->realpath_len) != 0) diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c -index 4b8bb1ef..7725c3af 100644 +index 4b8bb1ef03e54407cba8eef85179039632cc3f28..7725c3af94edd5d62bb960912262d38aefa6676e 100644 --- a/deps/uv/test/test-fs-event.c +++ b/deps/uv/test/test-fs-event.c @@ -47,6 +47,7 @@ static const char file_prefix[] = "fsevent-"; diff --git a/patches/node/fsevents-stop-using-fsevents-to-watch-files.patch b/patches/node/fsevents-stop-using-fsevents-to-watch-files.patch index b502c5540d58f..65ab81f31b145 100644 --- a/patches/node/fsevents-stop-using-fsevents-to-watch-files.patch +++ b/patches/node/fsevents-stop-using-fsevents-to-watch-files.patch @@ -1,7 +1,10 @@ -From 97b85e8b75b8f3df774b6e008dbaa143daa412b7 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Sat, 7 Sep 2019 14:55:40 -0400 -Subject: [PATCH] fsevents: stop using fsevents to watch files +Subject: fsevents: stop using fsevents to watch files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit Goes back to just using it to watch folders, but keeps the other logic changes around. @@ -17,7 +20,7 @@ Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c -index c04e7a48..ad09f403 100644 +index c04e7a485cf992beec501144e04ff068c17b9494..ad09f4031318cafe08faed3f0a6373e2bb598672 100644 --- a/deps/uv/src/unix/kqueue.c +++ b/deps/uv/src/unix/kqueue.c @@ -454,10 +454,26 @@ int uv_fs_event_start(uv_fs_event_t* handle, @@ -102,7 +105,7 @@ index c04e7a48..ad09f403 100644 #endif diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c -index ea34bd63..4b8bb1ef 100644 +index ea34bd63a70625c3e2c60d5a1bbb087c5f0bbb2e..4b8bb1ef03e54407cba8eef85179039632cc3f28 100644 --- a/deps/uv/test/test-fs-event.c +++ b/deps/uv/test/test-fs-event.c @@ -656,6 +656,12 @@ TEST_IMPL(fs_event_watch_file_current_dir) { diff --git a/patches/node/win-fix-uv_spawn-ENOMEM-on-empty-env.patch b/patches/node/win-fix-uv_spawn-ENOMEM-on-empty-env.patch index f90a387698b92..f7fed25a92fd1 100644 --- a/patches/node/win-fix-uv_spawn-ENOMEM-on-empty-env.patch +++ b/patches/node/win-fix-uv_spawn-ENOMEM-on-empty-env.patch @@ -1,7 +1,7 @@ -From 1fc72276f91c7d378f14dfd0bb6b0ca8667e4bc5 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 9 Aug 2019 13:34:20 +0200 -Subject: [PATCH] win: fix uv_spawn() ENOMEM on empty env +Subject: win: fix uv_spawn() ENOMEM on empty env Commit ba780231 ("unix,win: handle zero-sized allocations uniformly") makes `uv__malloc()` return NULL when `size == 0`. @@ -17,7 +17,7 @@ Reviewed-By: Jameson Nash Reviewed-By: Bartosz Sosnowski diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c -index f9c53de0..9b7fdc1d 100644 +index fa1a76a2e6626e15bdd0681626fc82c9ca6907fe..e1010d1248a95a3927d6ed1a1affbb545c1d7201 100644 --- a/deps/uv/src/win/process.c +++ b/deps/uv/src/win/process.c @@ -714,7 +714,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { @@ -39,10 +39,10 @@ index f9c53de0..9b7fdc1d 100644 /* sort our (UTF-16) copy */ qsort(env_copy, env_block_count-1, sizeof(wchar_t*), qsort_wcscmp); diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h -index 3f94360f..6eb8ecad 100644 +index 29e9cbf85df3f07dd3a017ffca1cea0b56e76b89..10ec86869008c2cd15848e71476bd18fb2af3da1 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h -@@ -264,6 +264,7 @@ TEST_DECLARE (spawn_fails) +@@ -263,6 +263,7 @@ TEST_DECLARE (spawn_fails) #ifndef _WIN32 TEST_DECLARE (spawn_fails_check_for_waitpid_cleanup) #endif @@ -50,7 +50,7 @@ index 3f94360f..6eb8ecad 100644 TEST_DECLARE (spawn_exit_code) TEST_DECLARE (spawn_stdout) TEST_DECLARE (spawn_stdin) -@@ -829,6 +830,7 @@ TASK_LIST_START +@@ -819,6 +820,7 @@ TASK_LIST_START #ifndef _WIN32 TEST_ENTRY (spawn_fails_check_for_waitpid_cleanup) #endif @@ -59,7 +59,7 @@ index 3f94360f..6eb8ecad 100644 TEST_ENTRY (spawn_stdout) TEST_ENTRY (spawn_stdin) diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c -index fea1165d..fec610bf 100644 +index fea1165d89e08e9e56257cded55048b09c27d1d0..fec610bfdef97eff778c28158c2360ef02cb08e5 100644 --- a/deps/uv/test/test-spawn.c +++ b/deps/uv/test/test-spawn.c @@ -232,6 +232,34 @@ TEST_IMPL(spawn_fails_check_for_waitpid_cleanup) { diff --git a/script/apply_all_patches.py b/script/apply_all_patches.py index ec5b7dbc94b4b..0512d2d29e058 100755 --- a/script/apply_all_patches.py +++ b/script/apply_all_patches.py @@ -10,6 +10,12 @@ def apply_patches(dirs): for patch_dir, repo in dirs.iteritems(): + # save the upstream HEAD so we can refer to it when we later export patches + git.update_ref( + repo=repo, + ref='refs/patches/upstream-head', + newvalue='HEAD' + ) git.am(repo=repo, patch_data=patch_from_dir(patch_dir), committer_name="Electron Scripts", committer_email="scripts@electron") diff --git a/script/export_all_patches.py b/script/export_all_patches.py new file mode 100644 index 0000000000000..562e2d1de4582 --- /dev/null +++ b/script/export_all_patches.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import argparse +import json +import os +import sys + +from lib import git + + +def export_patches(dirs): + for patch_dir, repo in dirs.iteritems(): + git.export_patches(repo=repo, out_dir=patch_dir) + + +def parse_args(): + parser = argparse.ArgumentParser(description='Export Electron patches') + parser.add_argument('config', nargs='+', + type=argparse.FileType('r'), + help='patches\' config(s) in the JSON format') + return parser.parse_args() + + +def main(): + configs = parse_args().config + for config_json in configs: + export_patches(json.load(config_json)) + + +if __name__ == '__main__': + main() diff --git a/script/git-export-patches b/script/git-export-patches index de68c485aaa1b..70930aab63707 100755 --- a/script/git-export-patches +++ b/script/git-export-patches @@ -6,115 +6,7 @@ import re import subprocess import sys - -def guess_base_commit(repo): - """Guess which commit the patches might be based on""" - try: - args = [ - 'git', - '-C', - repo, - 'rev-parse', - '--verify', - 'refs/patches/upstream-head', - ] - upstream_head = subprocess.check_output(args).strip() - args = [ - 'git', - '-C', - repo, - 'rev-list', - '--count', - upstream_head + '..', - ] - num_commits = subprocess.check_output(args).strip() - return [upstream_head, num_commits] - except subprocess.CalledProcessError: - args = [ - 'git', - '-C', - repo, - 'describe', - '--tags', - ] - return subprocess.check_output(args).rsplit('-', 2)[0:2] - - -def format_patch(repo, since): - args = [ - 'git', - '-C', - repo, - '-c', - 'core.attributesfile=' + os.path.join(os.path.dirname(os.path.realpath(__file__)), '.electron.attributes'), - # Ensure it is not possible to match anything - # Disabled for now as we have consistent chunk headers - # '-c', - # 'diff.electron.xfuncname=$^', - 'format-patch', - '--keep-subject', - '--no-stat', - '--stdout', - - # Per RFC 3676 the signature is separated from the body by a line with - # '-- ' on it. If the signature option is omitted the signature defaults - # to the Git version number. - '--no-signature', - - # 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: ') - +from lib import git def main(argv): parser = argparse.ArgumentParser() @@ -127,32 +19,7 @@ def main(argv): "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)).rstrip('\n') + '\n') - pl.write(filename + '\n') + git.export_patches('.', args.output, patch_range=args.patch_range) if __name__ == '__main__': diff --git a/script/lib/git.py b/script/lib/git.py index ef2b0bab44e0c..56150e8b9c235 100644 --- a/script/lib/git.py +++ b/script/lib/git.py @@ -7,7 +7,9 @@ """ import os +import re import subprocess +import sys def is_repo_root(path): @@ -115,7 +117,7 @@ def reset(repo): def commit(repo, author, message): - """ Commit whatever in the index is now.""" + """Commit whatever in the index is now.""" # Let's setup committer info so git won't complain about it being missing. # TODO: Is there a better way to set committer's name and email? @@ -131,3 +133,143 @@ def commit(repo, author, message): return_code = subprocess.call(args, env=env) committed_successfully = (return_code == 0) return committed_successfully + +def get_upstream_head(repo): + args = [ + 'git', + '-C', + repo, + 'rev-parse', + '--verify', + 'refs/patches/upstream-head', + ] + return subprocess.check_output(args).strip() + +def get_commit_count(repo, commit_range): + args = [ + 'git', + '-C', + repo, + 'rev-list', + '--count', + commit_range + ] + return int(subprocess.check_output(args).strip()) + +def guess_base_commit(repo): + """Guess which commit the patches might be based on""" + try: + upstream_head = get_upstream_head(repo) + num_commits = get_commit_count(repo, upstream_head + '..') + return [upstream_head, num_commits] + except subprocess.CalledProcessError: + args = [ + 'git', + '-C', + repo, + 'describe', + '--tags', + ] + return subprocess.check_output(args).rsplit('-', 2)[0:2] + + +def format_patch(repo, since): + args = [ + 'git', + '-C', + repo, + '-c', + 'core.attributesfile=' + os.path.join(os.path.dirname(os.path.realpath(__file__)), '.electron.attributes'), + # Ensure it is not possible to match anything + # Disabled for now as we have consistent chunk headers + # '-c', + # 'diff.electron.xfuncname=$^', + 'format-patch', + '--keep-subject', + '--no-stat', + '--stdout', + + # Per RFC 3676 the signature is separated from the body by a line with + # '-- ' on it. If the signature option is omitted the signature defaults + # to the Git version number. + '--no-signature', + + # 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 export_patches(repo, out_dir, patch_range=None): + 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) + + 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)).rstrip('\n') + '\n') + pl.write(filename + '\n')