Title: [196714] trunk/Source/WebKit/ios
Revision
196714
Author
[email protected]
Date
2016-02-17 12:40:28 -0800 (Wed, 17 Feb 2016)

Log Message

[iOS WK1] NSTimer in WebGeolocationProviderIOS.mm fires on the main thread without the WebThreadLock
<http://webkit.org/b/154347>
<rdar://problem/19360382>

Reviewed by Andy Estes.

This isn't testable because the GeolocationClientMock in WebCore
bypasses this code in WebKit1.

* Misc/WebGeolocationProviderIOS.mm:
(-[WebGeolocationProviderIOS _handlePendingInitialPosition:]):
Assert that this is always called on the WebThread.
(-[WebGeolocationProviderIOS registerWebView:]): Register the
NSTimer on the WebThread NSRunLoop.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ios/ChangeLog (196713 => 196714)


--- trunk/Source/WebKit/ios/ChangeLog	2016-02-17 20:29:50 UTC (rev 196713)
+++ trunk/Source/WebKit/ios/ChangeLog	2016-02-17 20:40:28 UTC (rev 196714)
@@ -1,3 +1,20 @@
+2016-02-17  David Kilzer  <[email protected]>
+
+        [iOS WK1] NSTimer in WebGeolocationProviderIOS.mm fires on the main thread without the WebThreadLock
+        <http://webkit.org/b/154347>
+        <rdar://problem/19360382>
+
+        Reviewed by Andy Estes.
+
+        This isn't testable because the GeolocationClientMock in WebCore
+        bypasses this code in WebKit1.
+
+        * Misc/WebGeolocationProviderIOS.mm:
+        (-[WebGeolocationProviderIOS _handlePendingInitialPosition:]):
+        Assert that this is always called on the WebThread.
+        (-[WebGeolocationProviderIOS registerWebView:]): Register the
+        NSTimer on the WebThread NSRunLoop.
+
 2016-01-16  Myles C. Maxfield  <[email protected]>
 
         Remove TextRun::allowsRoundingHacks()

Modified: trunk/Source/WebKit/ios/Misc/WebGeolocationProviderIOS.mm (196713 => 196714)


--- trunk/Source/WebKit/ios/Misc/WebGeolocationProviderIOS.mm	2016-02-17 20:29:50 UTC (rev 196713)
+++ trunk/Source/WebKit/ios/Misc/WebGeolocationProviderIOS.mm	2016-02-17 20:40:28 UTC (rev 196714)
@@ -157,6 +157,7 @@
 - (void)_handlePendingInitialPosition:(NSTimer*)timer
 {
     ASSERT_UNUSED(timer, timer == _sendLastPositionAsynchronouslyTimer);
+    ASSERT(WebThreadIsCurrent());
 
     if (_lastPosition) {
         Vector<WebView*> webViewsCopy;
@@ -196,12 +197,10 @@
     // We send the lastPosition asynchronously because WebKit does not handle updating the position synchronously.
     // On WebKit2, we could skip that and send the position directly from the UIProcess.
     _pendingInitialPositionWebView.add(webView);
-    if (!_sendLastPositionAsynchronouslyTimer)
-        _sendLastPositionAsynchronouslyTimer = [NSTimer scheduledTimerWithTimeInterval:0
-                                                                                target:self
-                                                                              selector:@selector(_handlePendingInitialPosition:)
-                                                                              userInfo:nil
-                                                                               repeats:NO];
+    if (!_sendLastPositionAsynchronouslyTimer) {
+        _sendLastPositionAsynchronouslyTimer = [NSTimer timerWithTimeInterval:0 target:self selector:@selector(_handlePendingInitialPosition:) userInfo:nil repeats:NO];
+        [WebThreadNSRunLoop() addTimer:_sendLastPositionAsynchronouslyTimer.get() forMode:NSDefaultRunLoopMode];
+    }
 }
 
 - (void)unregisterWebView:(WebView *)webView
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to