Changeset 255132 in webkit
- Timestamp:
- Jan 26, 2020 2:15:17 PM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r255131 r255132 1 2020-01-26 Darin Adler <darin@apple.com> 2 3 Protect against crashes during WKWebView init function when methods are called before the view is fully initialized 4 https://bugs.webkit.org/show_bug.cgi?id=206799 5 rdar://problem/58871371 6 7 Reviewed by Sam Weinig. 8 9 Part way through creating WKWebView, some methods can be called and they need to be careful 10 not to use anything that may not be initialized yet. 11 12 * UIProcess/API/Cocoa/WKWebView.mm: 13 (-[WKWebView dealloc]): Check _page for null, since this might happen if the superclass's 14 init method returned nil. 15 16 * UIProcess/API/ios/WKWebViewIOS.mm: 17 (-[WKWebView _frameOrBoundsChanged]): Check _page for null, since this might be called 18 before object initialization is complete. 19 (-[WKWebView setSemanticContentAttribute:]): Ditto. 20 21 * UIProcess/API/mac/WKWebViewMac.mm: 22 (-[WKWebView setFrameSize:]): Check _impl for null since this might be called before 23 oject initialization is complete. 24 (-[WKWebView setUserInterfaceLayoutDirection:]): Ditto. 25 (-[WKWebView renewGState]): Ditto. 26 1 27 2020-01-26 Said Abou-Hallawa <said@apple.com> 2 28 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r255054 r255132 1 1 /* 2 * Copyright (C) 2014-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 592 592 [_contentView _webViewDestroyed]; 593 593 594 if (_ remoteObjectRegistry)594 if (_page && _remoteObjectRegistry) 595 595 _page->process().processPool().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _page->identifier()); 596 596 #endif 597 597 598 _page->close(); 598 if (_page) 599 _page->close(); 599 600 600 601 #if PLATFORM(IOS_FAMILY) … … 607 608 #endif 608 609 609 pageToViewMap().remove(_page.get()); 610 if (_page) 611 pageToViewMap().remove(_page.get()); 610 612 611 613 [super dealloc]; -
trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
r255054 r255132 1 1 /* 2 * Copyright (C) 2014-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1760 1760 1761 1761 BOOL sizeChanged = NO; 1762 if (auto drawingArea = _page->drawingArea()) 1763 sizeChanged = drawingArea->setSize(WebCore::IntSize(bounds.size)); 1762 if (_page) { 1763 if (auto drawingArea = _page->drawingArea()) 1764 sizeChanged = drawingArea->setSize(WebCore::IntSize(bounds.size)); 1765 } 1764 1766 1765 1767 if (sizeChanged & [self usesStandardContentView]) … … 2379 2381 [super setSemanticContentAttribute:contentAttribute]; 2380 2382 2381 _page->setUserInterfaceLayoutDirection(toUserInterfaceLayoutDirection(contentAttribute)); 2383 if (_page) 2384 _page->setUserInterfaceLayoutDirection(toUserInterfaceLayoutDirection(contentAttribute)); 2382 2385 } 2383 2386 -
trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
r254409 r255132 1 1 /* 2 * Copyright (C) 2014-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 136 136 [super setFrameSize:size]; 137 137 [_safeBrowsingWarning setFrame:self.bounds]; 138 _impl->setFrameSize(NSSizeToCGSize(size)); 138 if (_impl) 139 _impl->setFrameSize(NSSizeToCGSize(size)); 139 140 } 140 141 … … 142 143 { 143 144 [super setUserInterfaceLayoutDirection:userInterfaceLayoutDirection]; 144 145 _impl->setUserInterfaceLayoutDirection(userInterfaceLayoutDirection);145 if (_impl) 146 _impl->setUserInterfaceLayoutDirection(userInterfaceLayoutDirection); 146 147 } 147 148 … … 150 151 ALLOW_DEPRECATED_IMPLEMENTATIONS_END 151 152 { 152 _impl->renewGState(); 153 if (_impl) 154 _impl->renewGState(); 153 155 [super renewGState]; 154 156 }
Note: See TracChangeset
for help on using the changeset viewer.