Skip to content

Commit

Permalink
fix: backport patch for leaking HTML5 video elements
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Jul 19, 2019
1 parent 36ea114 commit 9917c0f
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 37 deletions.
1 change: 1 addition & 0 deletions patches/common/chromium/.patches
Expand Up @@ -110,3 +110,4 @@ fire_caret_location_change_when_focus_moves_from_ui_to_content.patch
do_not_show_virtual_keyboard_for_all_mouse_inputs.patch
setup_the_observer_before_calling_displayvirtualkeyboard.patch
workaround_apparent_data_corruption_in_blockfile_on_os_x_10_14_by.patch
mediacontrols_disconnect_observers_when_controls_are_hidden.patch
2 changes: 1 addition & 1 deletion patches/common/chromium/browser_compositor_mac.patch
Expand Up @@ -29,7 +29,7 @@ diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/cont
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() {
@@ -81,6 +81,12 @@
DCHECK_EQ(1u, num_erased);
}

Expand Down
2 changes: 1 addition & 1 deletion patches/common/chromium/crashpad_http_status.patch
Expand Up @@ -22,7 +22,7 @@ diff --git a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm b/thir
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 @@ bool HTTPTransportMac::ExecuteSynchronously(std::string* response_body) {
@@ -293,7 +293,7 @@ static void Unschedule(CFReadStreamRef stream,
return false;
}
NSInteger http_status = [http_response statusCode];
Expand Down
Expand Up @@ -56,7 +56,7 @@ diff --git a/services/service_manager/sandbox/mac/sandbox_mac.mm b/services/serv
index d69fcc0d4c5c2471163280c03a9fd9366e05031d..cdd7b7f6723162d6875c4d11379837708bdde79d 100644
--- a/services/service_manager/sandbox/mac/sandbox_mac.mm
+++ b/services/service_manager/sandbox/mac/sandbox_mac.mm
@@ -81,6 +81,21 @@ static_assert(arraysize(kDefaultSandboxTypeToResourceIDMapping) ==
@@ -81,6 +81,21 @@
size_t(SANDBOX_TYPE_AFTER_LAST_TYPE),
"sandbox type to resource id mapping incorrect");

Expand All @@ -78,7 +78,7 @@ index d69fcc0d4c5c2471163280c03a9fd9366e05031d..cdd7b7f6723162d6875c4d1137983770
} // namespace

// Static variable declarations.
@@ -242,6 +257,9 @@ bool SandboxMac::Enable(SandboxType sandbox_type) {
@@ -242,6 +257,9 @@
if (!compiler.InsertBooleanParam(kSandboxMacOS1013, macos_1013))
return false;

Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/mas-cfisobjc.patch
Expand Up @@ -9,15 +9,15 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 15fc15ba307e18f438852f00f41b2f5ecf7ff85f..7ca4e0ec5ca87f34e0baa22ba0b704e25fe7ca21 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -26,7 +26,6 @@ CFTypeID SecKeyGetTypeID();
@@ -26,7 +26,6 @@
#if !defined(OS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"

@@ -325,8 +324,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) {
@@ -325,8 +324,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
Expand All @@ -27,7 +27,7 @@ index 15fc15ba307e18f438852f00f41b2f5ecf7ff85f..7ca4e0ec5ca87f34e0baa22ba0b704e2
return ns_val;
}

@@ -394,9 +392,6 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) {
@@ -394,9 +392,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
return (CTFontRef)(cf_val);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/mas_blink_no_private_api.patch
Expand Up @@ -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 @@ NSString* _NSYankFromKillRing();
@@ -39,38 +40,53 @@
void _NSNewKillRingSequence();
void _NSSetKillRingToYankedState();
}
Expand Down Expand Up @@ -92,7 +92,7 @@ index 7a1260db0a139f9f3f8a823af2c220f36162812a..bf9cf7046e2fc9cdfee5b92f2a348185

namespace blink {

@@ -73,10 +75,12 @@ bool ThemePainterMac::PaintTextField(const Node* node,
@@ -73,10 +75,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
// behavior change while remaining a fragile solution.
// https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3
if (!use_ns_text_field_cell) {
Expand All @@ -105,7 +105,7 @@ index 7a1260db0a139f9f3f8a823af2c220f36162812a..bf9cf7046e2fc9cdfee5b92f2a348185
return false;
}

@@ -162,10 +166,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node,
@@ -162,10 +166,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
const PaintInfo& paint_info,
const IntRect& r) {
LocalCurrentGraphicsContext local_context(paint_info.context, r);
Expand Down
42 changes: 21 additions & 21 deletions patches/common/chromium/mas_no_private_api.patch
Expand Up @@ -41,23 +41,23 @@ diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/cont
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;
@@ -135,6 +135,7 @@
// VoiceOver uses -1 to mean "no limit" for AXResultsLimit.
const int kAXResultsLimitNoLimit = -1;

+#ifndef MAS_BUILD
extern "C" {

// The following are private accessibility APIs required for cursor navigation
@@ -341,6 +342,7 @@ NSAttributedString* GetAttributedTextForTextMarkerRange(
@@ -341,6 +342,7 @@ void AddMisspelledTextAttributes(
AddMisspelledTextAttributes(text_only_objects, attributed_text);
return [attributed_text attributedSubstringFromRange:range];
}
+#endif

// Returns an autoreleased copy of the AXNodeData's attribute.
NSString* NSStringForStringAttribute(
@@ -595,7 +597,9 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -595,7 +597,9 @@ + (void)initialize {
{NSAccessibilityDOMIdentifierAttribute, @"domIdentifier"},
{NSAccessibilityEditableAncestorAttribute, @"editableAncestor"},
{NSAccessibilityEnabledAttribute, @"enabled"},
Expand All @@ -67,7 +67,7 @@ index 07e9862b76a920438a779f22d67d3a45ab39abf7..efa52aa9de2f819f28109978c8cef518
{NSAccessibilityExpandedAttribute, @"expanded"},
{NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"},
{NSAccessibilityFocusedAttribute, @"focused"},
@@ -630,13 +634,17 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -630,13 +634,17 @@ + (void)initialize {
{NSAccessibilityRowsAttribute, @"rows"},
// TODO(aboxhall): expose
// NSAccessibilityServesAsTitleForUIElementsAttribute
Expand All @@ -85,55 +85,55 @@ index 07e9862b76a920438a779f22d67d3a45ab39abf7..efa52aa9de2f819f28109978c8cef518
{NSAccessibilitySizeAttribute, @"size"},
{NSAccessibilitySortDirectionAttribute, @"sortDirection"},
{NSAccessibilitySubroleAttribute, @"subrole"},
@@ -1114,6 +1122,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -1114,6 +1122,7 @@ - (NSNumber*)enabled {
ax::mojom::Restriction::kDisabled];
}

+#ifndef MAS_BUILD
// Returns a text marker that points to the last character in the document that
// can be selected with VoiceOver.
- (id)endTextMarker {
@@ -1124,6 +1133,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -1124,6 +1133,7 @@ - (id)endTextMarker {
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
}
+#endif

- (NSNumber*)expanded {
if (![self instanceActive])
@@ -2029,6 +2039,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2029,6 +2039,7 @@ - (NSValue*)selectedTextRange {
return [NSValue valueWithRange:NSMakeRange(selStart, selLength)];
}

+#ifndef MAS_BUILD
- (id)selectedTextMarkerRange {
if (![self instanceActive])
return nil;
@@ -2061,6 +2072,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2061,6 +2072,7 @@ - (id)selectedTextMarkerRange {
anchorAffinity, *focusObject,
focusOffset, focusAffinity));
}
+#endif

- (NSValue*)size {
if (![self instanceActive])
@@ -2093,6 +2105,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2093,6 +2105,7 @@ - (NSString*)sortDirection {
return nil;
}

+#ifndef MAS_BUILD
// Returns a text marker that points to the first character in the document that
// can be selected with VoiceOver.
- (id)startTextMarker {
@@ -2103,6 +2116,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2103,6 +2116,7 @@ - (id)startTextMarker {
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
return CreateTextMarker(position->CreatePositionAtStartOfAnchor());
}
+#endif

// Returns a subrole based upon the role.
- (NSString*) subrole {
@@ -2405,12 +2419,14 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2405,12 +2419,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range {
NSMutableAttributedString* attributedValue =
[[[NSMutableAttributedString alloc] initWithString:value] autorelease];

Expand All @@ -148,31 +148,31 @@ index 07e9862b76a920438a779f22d67d3a45ab39abf7..efa52aa9de2f819f28109978c8cef518

return [attributedValue attributedSubstringFromRange:range];
}
@@ -2527,6 +2543,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2527,6 +2543,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
return nil;
}

+#ifndef MAS_BUILD
if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) {
BrowserAccessibilityPositionInstance position =
CreatePositionFromTextMarker(parameter);
@@ -2704,6 +2721,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2704,6 +2721,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
NSString* text = GetTextForTextMarkerRange(parameter);
return [NSNumber numberWithInt:[text length]];
}
+#endif

if ([attribute isEqualToString:
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
@@ -2741,6 +2759,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2741,6 +2759,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
return nil;
}

+#ifndef MAS_BUILD
if ([attribute isEqualToString:
NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) {
BrowserAccessibilityPositionInstance position =
@@ -2820,6 +2839,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
@@ -2820,6 +2839,7 @@ AXPlatformRange range(position->CreatePreviousLineStartPosition(

return @(child->GetIndexInParent());
}
Expand All @@ -184,15 +184,15 @@ diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm
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::
@@ -437,6 +437,7 @@
[user_info setObject:native_focus_object
forKey:NSAccessibilityTextChangeElement];

+#ifndef MAS_BUILD
id selected_text = [native_focus_object selectedTextMarkerRange];
if (selected_text) {
NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute =
@@ -444,6 +445,7 @@ NSDictionary* BrowserAccessibilityManagerMac::
@@ -444,6 +445,7 @@
[user_info setObject:selected_text
forKey:NSAccessibilitySelectedTextMarkerRangeAttribute];
}
Expand Down Expand Up @@ -220,7 +220,7 @@ index 1e2cc38d3868ceccf8e45f5f82f57bcaa478f982..daa934c345e2686fd2174b7721d0f69a

namespace content {

@@ -38,6 +40,7 @@ namespace {
@@ -38,6 +40,7 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
// This disconnects from the window server, and then indicates that Chrome
// should continue execution without access to launchservicesd.
void DisconnectWindowServer() {
Expand Down Expand Up @@ -248,15 +248,15 @@ index 8b2092ec78f9f6bc1bd4c8af21ada74538f54d29..4f2ee8e2809790df68aedcee09462631
extern "C" {
// Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and
// `Karabiner` [3] to programmatically control the Bluetooth state. Calling the
@@ -47,6 +48,7 @@ extern "C" {
@@ -47,6 +48,7 @@
// [4] https://support.apple.com/kb/PH25091
void IOBluetoothPreferenceSetControllerPowerState(int state);
}
+#endif

namespace {

@@ -120,8 +122,10 @@ BluetoothAdapterMac::BluetoothAdapterMac()
@@ -120,8 +122,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
controller_state_function_(
base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState,
base::Unretained(this))),
Expand All @@ -267,7 +267,7 @@ index 8b2092ec78f9f6bc1bd4c8af21ada74538f54d29..4f2ee8e2809790df68aedcee09462631
should_update_name_(true),
classic_discovery_manager_(
BluetoothDiscoveryManagerMac::CreateClassic(this)),
@@ -314,8 +318,12 @@ bool BluetoothAdapterMac::IsLowEnergyAvailable() {
@@ -314,8 +318,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
}

bool BluetoothAdapterMac::SetPoweredImpl(bool powered) {
Expand Down

0 comments on commit 9917c0f

Please sign in to comment.