From c5320b395183cef7b36736050cfd236eb5d37b45 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 28 Aug 2020 09:40:47 -0700 Subject: [PATCH] fix: save dialog extensions should be deterministic (#25164) --- shell/browser/ui/file_dialog_mac.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/browser/ui/file_dialog_mac.mm b/shell/browser/ui/file_dialog_mac.mm index 73d12d5ab595..d490e1656a02 100644 --- a/shell/browser/ui/file_dialog_mac.mm +++ b/shell/browser/ui/file_dialog_mac.mm @@ -90,7 +90,8 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) { // Create array to keep file types and their name. for (const Filter& filter : filters) { - NSMutableSet* file_type_set = [NSMutableSet set]; + NSMutableOrderedSet* file_type_set = + [NSMutableOrderedSet orderedSetWithCapacity:filters.size()]; [filter_names addObject:@(filter.first.c_str())]; for (std::string ext : filter.second) { // macOS is incapable of understanding multiple file extensions, @@ -104,7 +105,7 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) { [file_type_set addObject:@(ext.c_str())]; } - [file_types_list addObject:[file_type_set allObjects]]; + [file_types_list addObject:[file_type_set array]]; } // Passing empty array to setAllowedFileTypes will cause exception.