Changeset 233432 in webkit
- Timestamp:
- Jul 2, 2018 1:52:18 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r233431 r233432 1 2018-07-02 Brady Eidson <beidson@apple.com> 2 3 Crash notifying observers of responsiveness state change 4 <rdar://problem/41267796> and https://bugs.webkit.org/show_bug.cgi?id=187262 5 6 Reviewed by Tim Horton. 7 8 * UIProcess/PageLoadState.cpp: 9 (WebKit::PageLoadState::callObserverCallback): Copy the container ahead of time. 10 1 11 2018-07-02 Sihui Liu <sihui_liu@apple.com> 2 12 -
trunk/Source/WebKit/UIProcess/PageLoadState.cpp
r216132 r233432 420 420 void PageLoadState::callObserverCallback(void (Observer::*callback)()) 421 421 { 422 for (auto* observer : m_observers) 422 auto protectedPage = makeRef(m_webPageProxy); 423 424 auto observerCopy = m_observers; 425 for (auto* observer : observerCopy) { 426 // This appears potentially inefficient on the surface (searching in a Vector) 427 // but in practice - using only API - there will only ever be (1) observer. 428 if (!m_observers.contains(observer)) 429 continue; 430 423 431 (observer->*callback)(); 432 } 424 433 } 425 434 -
trunk/Tools/ChangeLog
r233428 r233432 1 2018-07-02 Brady Eidson <beidson@apple.com> 2 3 Crash notifying observers of responsiveness state change 4 <rdar://problem/41267796> and https://bugs.webkit.org/show_bug.cgi?id=187262 5 6 Reviewed by Tim Horton. 7 8 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 9 * TestWebKitAPI/Tests/WebKit/ResponsivenessTimerCrash.mm: Added. 10 (-[RTObserver observeValueForKeyPath:ofObject:change:context:]): 11 (TestWebKitAPI::TEST): 12 * TestWebKitAPI/cocoa/TestWKWebView.h: 13 * TestWebKitAPI/cocoa/TestWKWebView.mm: 14 (-[TestWKWebView typeCharacter:]): 15 (-[TestWKWebView hostWindow]): 16 1 17 2018-07-02 Michael Catanzaro <mcatanzaro@igalia.com> 2 18 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r233374 r233432 178 178 5120C83D1E6751290025B250 /* WebsiteDataStoreCustomPaths.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5120C83C1E6750790025B250 /* WebsiteDataStoreCustomPaths.mm */; }; 179 179 5120C83E1E67678F0025B250 /* WebsiteDataStoreCustomPaths.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5120C83B1E674E350025B250 /* WebsiteDataStoreCustomPaths.html */; }; 180 512C4C9E20EAA40D004945EA /* ResponsivenessTimerCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */; }; 180 181 51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */; }; 181 182 5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; }; … … 1402 1403 5120C83B1E674E350025B250 /* WebsiteDataStoreCustomPaths.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = WebsiteDataStoreCustomPaths.html; sourceTree = "<group>"; }; 1403 1404 5120C83C1E6750790025B250 /* WebsiteDataStoreCustomPaths.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebsiteDataStoreCustomPaths.mm; sourceTree = "<group>"; }; 1405 512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResponsivenessTimerCrash.mm; sourceTree = "<group>"; }; 1404 1406 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic_Bundle.cpp; sourceTree = "<group>"; }; 1405 1407 51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic.cpp; sourceTree = "<group>"; }; … … 2805 2807 8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */, 2806 2808 83DE134C1EF1C4FE00C1B355 /* ResponsivenessTimer.cpp */, 2809 512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */, 2807 2810 C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */, 2808 2811 C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */, … … 3694 3697 7CCE7EDF1A411A9200447C4C /* LayoutUnit.cpp in Sources */, 3695 3698 7A66BDB61EAF14EF00CCC924 /* LimitTitleSize.cpp in Sources */, 3699 512C4C9E20EAA40D004945EA /* ResponsivenessTimerCrash.mm in Sources */, 3696 3700 7A7B0E7F1EAFE4C3006AB8AE /* LimitTitleSize.mm in Sources */, 3697 3701 C25CCA061E51380B0026CB8A /* LineBreaking.mm in Sources */, -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h
r229542 r233432 58 58 - (void)performAfterLoading:(dispatch_block_t)actions; 59 59 - (void)waitForNextPresentationUpdate; 60 - (void)typeCharacter:(char)character; 60 61 @end 61 62 … … 75 76 - (void)mouseMoveToPoint:(NSPoint)point withFlags:(NSEventModifierFlags)flags; 76 77 - (void)sendClicksAtPoint:(NSPoint)point numberOfClicks:(NSUInteger)numberOfClicks; 77 - (void)typeCharacter:(char)character;78 78 - (NSWindow *)hostWindow; 79 79 @end -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
r231663 r233432 312 312 } 313 313 314 @end315 316 #if PLATFORM(IOS)317 318 @implementation TestWKWebView (IOSOnly)319 320 - (UIView <UITextInput> *)textInputContentView321 {322 return (UIView <UITextInput> *)[self valueForKey:@"_currentContentView"];323 }324 325 - (RetainPtr<NSArray>)selectionRectsAfterPresentationUpdate326 {327 RetainPtr<TestWKWebView> retainedSelf = self;328 329 __block bool isDone = false;330 __block RetainPtr<NSArray> selectionRects;331 [self _doAfterNextPresentationUpdate:^() {332 selectionRects = adoptNS([[retainedSelf _uiTextSelectionRects] retain]);333 isDone = true;334 }];335 336 TestWebKitAPI::Util::run(&isDone);337 return selectionRects;338 }339 340 - (_WKActivatedElementInfo *)activatedElementAtPosition:(CGPoint)position341 {342 __block RetainPtr<_WKActivatedElementInfo> info;343 __block bool finished = false;344 [self _requestActivatedElementAtPosition:position completionBlock:^(_WKActivatedElementInfo *elementInfo) {345 info = elementInfo;346 finished = true;347 }];348 349 TestWebKitAPI::Util::run(&finished);350 return info.autorelease();351 }352 353 @end354 355 #endif356 357 #if PLATFORM(MAC)358 @implementation TestWKWebView (MacOnly)359 - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure360 {361 [_hostWindow _mouseDownAtPoint:point simulatePressure:simulatePressure clickCount:1];362 }363 364 - (void)mouseUpAtPoint:(NSPoint)point365 {366 [_hostWindow _mouseUpAtPoint:point clickCount:1];367 }368 369 - (void)mouseMoveToPoint:(NSPoint)point withFlags:(NSEventModifierFlags)flags370 {371 [self mouseMoved:[NSEvent mouseEventWithType:NSEventTypeMouseMoved location:point modifierFlags:flags timestamp:GetCurrentEventTime() windowNumber:[_hostWindow windowNumber] context:[NSGraphicsContext currentContext] eventNumber:++gEventNumber clickCount:0 pressure:0]];372 }373 374 - (void)sendClicksAtPoint:(NSPoint)point numberOfClicks:(NSUInteger)numberOfClicks375 {376 for (NSUInteger clickCount = 1; clickCount <= numberOfClicks; ++clickCount) {377 [_hostWindow _mouseDownAtPoint:point simulatePressure:NO clickCount:clickCount];378 [_hostWindow _mouseUpAtPoint:point clickCount:clickCount];379 }380 }381 382 - (NSWindow *)hostWindow383 {384 return _hostWindow.get();385 }386 387 314 - (void)typeCharacter:(char)character { 388 315 NSString *characterAsString = [NSString stringWithFormat:@"%c" , character]; … … 392 319 [self keyUp:[NSEvent keyEventWithType:keyUpEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:[_hostWindow windowNumber] context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]]; 393 320 } 321 322 @end 323 324 #if PLATFORM(IOS) 325 326 @implementation TestWKWebView (IOSOnly) 327 328 - (UIView <UITextInput> *)textInputContentView 329 { 330 return (UIView <UITextInput> *)[self valueForKey:@"_currentContentView"]; 331 } 332 333 - (RetainPtr<NSArray>)selectionRectsAfterPresentationUpdate 334 { 335 RetainPtr<TestWKWebView> retainedSelf = self; 336 337 __block bool isDone = false; 338 __block RetainPtr<NSArray> selectionRects; 339 [self _doAfterNextPresentationUpdate:^() { 340 selectionRects = adoptNS([[retainedSelf _uiTextSelectionRects] retain]); 341 isDone = true; 342 }]; 343 344 TestWebKitAPI::Util::run(&isDone); 345 return selectionRects; 346 } 347 348 - (_WKActivatedElementInfo *)activatedElementAtPosition:(CGPoint)position 349 { 350 __block RetainPtr<_WKActivatedElementInfo> info; 351 __block bool finished = false; 352 [self _requestActivatedElementAtPosition:position completionBlock:^(_WKActivatedElementInfo *elementInfo) { 353 info = elementInfo; 354 finished = true; 355 }]; 356 357 TestWebKitAPI::Util::run(&finished); 358 return info.autorelease(); 359 } 360 361 @end 362 363 #endif 364 365 #if PLATFORM(MAC) 366 @implementation TestWKWebView (MacOnly) 367 - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure 368 { 369 [_hostWindow _mouseDownAtPoint:point simulatePressure:simulatePressure clickCount:1]; 370 } 371 372 - (void)mouseUpAtPoint:(NSPoint)point 373 { 374 [_hostWindow _mouseUpAtPoint:point clickCount:1]; 375 } 376 377 - (void)mouseMoveToPoint:(NSPoint)point withFlags:(NSEventModifierFlags)flags 378 { 379 [self mouseMoved:[NSEvent mouseEventWithType:NSEventTypeMouseMoved location:point modifierFlags:flags timestamp:GetCurrentEventTime() windowNumber:[_hostWindow windowNumber] context:[NSGraphicsContext currentContext] eventNumber:++gEventNumber clickCount:0 pressure:0]]; 380 } 381 382 - (void)sendClicksAtPoint:(NSPoint)point numberOfClicks:(NSUInteger)numberOfClicks 383 { 384 for (NSUInteger clickCount = 1; clickCount <= numberOfClicks; ++clickCount) { 385 [_hostWindow _mouseDownAtPoint:point simulatePressure:NO clickCount:clickCount]; 386 [_hostWindow _mouseUpAtPoint:point clickCount:clickCount]; 387 } 388 } 389 390 - (NSWindow *)hostWindow 391 { 392 return _hostWindow.get(); 393 } 394 394 @end 395 395 #endif
Note: See TracChangeset
for help on using the changeset viewer.