WebKit.GeolocationTransitionToLowAccuracy API crashes when enabling PSON
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 06:14:58 +0000 (06:14 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 06:14:58 +0000 (06:14 +0000)
commit2ed195503b9baf7a843e451e54a91cfda30afcfc
treede84e5a1be5622209f2698e40302064ac6162515
parent22c5784f93fb4a69ab029881376a3b3c96a51d8b
WebKit.GeolocationTransitionToLowAccuracy API crashes when enabling PSON
https://bugs.webkit.org/show_bug.cgi?id=191616

Reviewed by Chris Dumez.

The crash was caused by WKView in autorelease pool invoking stopUpdatingCallback after
GeolocationTransitionToLowAccuracyStateTracker in the stack had been destroyed,
resulting in the use-after-free.

Made the tests more robust by clearing geolocation provider before exiting each test
since we can't really prevent WKView from entering an autorelease pool.

Also made WebKit.GeolocationTransitionToLowAccuracy wait for the success callback
instead of simply the end of the navigation so that the test would continue to work
even if a web content process was created for the second web view (lowAccuracyWebView)

* TestWebKitAPI/Tests/WebKit/Geolocation.cpp:
(TestWebKitAPI::setupGeolocationProvider): Moved "*" to match the WebKit coding style guideline.
(TestWebKitAPI::clearGeolocationProvider): Added.
(TestWebKitAPI::runJavaScriptAlert): Added.
(TestWebKitAPI::didFinishNavigation): Deleted.
* TestWebKitAPI/Tests/WebKit/geolocationWatchPosition.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238165 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit/Geolocation.cpp
Tools/TestWebKitAPI/Tests/WebKit/geolocationWatchPosition.html