Title: [180692] branches/safari-600.1.4.15-branch/Source

Diff

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-02-26 19:56:49 UTC (rev 180692)
@@ -1,3 +1,56 @@
+2015-02-26  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r179480
+
+    2015-02-02  Jeremy Jones  <jere...@apple.com>
+
+            Prevent crash when accessing WebAVPlayerController.delegate.
+            https://bugs.webkit.org/show_bug.cgi?id=140893
+
+            Reviewed by Darin Adler.
+
+            This patch aims to prevent a null delegate access during invalidation by adding null checks before accessing the delegate, by making explicit the recreation of m_playerController, and by consolidating and correcting the teardown sequence.
+
+            * WebCore.exp.in:
+            * platform/ios/WebVideoFullscreenInterface.h: add resetMediaState()
+            * platform/ios/WebVideoFullscreenInterfaceAVKit.h: ditto.
+            * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+            (-[WebAVPlayerController playerViewController:shouldExitFullScreenWithReason:]): Check for null before accessing delegate.
+            (-[WebAVPlayerController play:]): ditto.
+            (-[WebAVPlayerController pause:]): ditto.
+            (-[WebAVPlayerController togglePlayback:]): ditto.
+            (-[WebAVPlayerController setPlaying:]): ditto.
+            (-[WebAVPlayerController beginScrubbing:]): ditto.
+            (-[WebAVPlayerController endScrubbing:]): ditto.
+            (-[WebAVPlayerController seekToTime:]): ditto.
+            (-[WebAVPlayerController beginScanningForward:]): ditto.
+            (-[WebAVPlayerController endScanningForward:]): ditto.
+            (-[WebAVPlayerController beginScanningBackward:]): ditto.
+            (-[WebAVPlayerController endScanningBackward:]): ditto.
+            (-[WebAVPlayerController seekToBeginning:]): ditto.
+            (-[WebAVPlayerController seekToEnd:]): ditto.
+            (-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]): ditto.
+            (-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]): ditto.
+            (-[WebAVPlayerController layoutSublayersOfLayer:]): ditto.
+            (WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit): initialize m_playerController
+            (WebVideoFullscreenInterfaceAVKit::resetMediaState): Added.
+            (WebVideoFullscreenInterfaceAVKit::setDuration): remove playerController()
+            (WebVideoFullscreenInterfaceAVKit::setCurrentTime): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setRate): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setVideoDimensions): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setSeekableRanges): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setExternalPlayback): ditto.
+            (WebVideoFullscreenInterfaceAVKit::setupFullscreenInternal): ditto.
+            (WebVideoFullscreenInterfaceAVKit::enterFullscreenStandard): ditto.
+            (WebVideoFullscreenInterfaceAVKit::cleanupFullscreenInternal): consolidated cleanup code from invalidate()
+            (WebVideoFullscreenInterfaceAVKit::invalidate): consolidate cleanup code.
+            (WebVideoFullscreenInterfaceAVKit::playerController): Deleted.
+            * platform/ios/WebVideoFullscreenModelVideoElement.mm:
+            (WebVideoFullscreenModelVideoElement::setVideoElement): call resetMediaState()
+
 2015-02-25  Babak Shafiei  <bshaf...@apple.com>
 
         Merge r180274.

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/WebCore.exp.in (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebCore/WebCore.exp.in	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/WebCore.exp.in	2015-02-26 19:56:49 UTC (rev 180692)
@@ -3446,6 +3446,7 @@
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit14setCurrentTimeEdd
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit15enterFullscreenEv
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit15setupFullscreenER7CALayerNS_7IntRectEP6UIView
+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit15resetMediaStateEv
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17cleanupFullscreenEv
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17setSeekableRangesERKNS_10TimeRangesE
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit18setVideoDimensionsEbff

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h	2015-02-26 19:56:49 UTC (rev 180692)
@@ -44,6 +44,7 @@
     enum ExternalPlaybackTargetType { TargetTypeNone, TargetTypeAirPlay, TargetTypeTVOut };
     
     virtual ~WebVideoFullscreenInterface() { };
+    virtual void resetMediaState() = 0;
     virtual void setDuration(double) = 0;
     virtual void setCurrentTime(double currentTime, double anchorTime) = 0;
     virtual void setRate(bool isPlaying, float playbackRate) = 0;

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2015-02-26 19:56:49 UTC (rev 180692)
@@ -63,6 +63,7 @@
 
 protected:
     void setupFullscreenInternal(PlatformLayer&, IntRect initialRect, UIView *);
+    void beginSession();
     void enterFullscreenOptimized();
     void enterFullscreenStandard();
     void exitFullscreenInternal(IntRect finalRect);
@@ -81,8 +82,6 @@
     RetainPtr<UIView> m_parentView;
     RetainPtr<UIWindow> m_parentWindow;
 
-    WebAVPlayerController *playerController();
-    
     void doEnterFullscreen();
         
 public:
@@ -91,6 +90,7 @@
     void setWebVideoFullscreenModel(WebVideoFullscreenModel*);
     void setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver*);
     
+    virtual void resetMediaState() override; 
     virtual void setDuration(double) override;
     virtual void setCurrentTime(double currentTime, double anchorTime) override;
     virtual void setRate(bool isPlaying, float playbackRate) override;

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2015-02-26 19:56:49 UTC (rev 180692)
@@ -89,6 +89,7 @@
     WebAVMediaSelectionOption *_currentLegibleMediaSelectionOption;
 }
 
+-(void)resetState;
 @property(retain) AVPlayerController* playerControllerProxy;
 @property(assign) WebVideoFullscreenModel* delegate;
 
@@ -156,6 +157,38 @@
     [super dealloc];
 }
 
+
+-(void)resetState {
+    self.contentDuration = 0;
+    self.maxTime = 0;
+    self.contentDurationWithinEndTimes = 0;
+    self.loadedTimeRanges = @[];
+    
+    self.canPlay = NO;
+    self.canPause = NO;
+    self.canTogglePlayback = NO;
+    self.hasEnabledAudio = NO;
+    self.canSeek = NO;
+    self.minTime = 0;
+    self.status = AVPlayerControllerStatusUnknown;
+    
+    self.timing = nil;
+    self.rate = 0;
+    
+    self.hasEnabledVideo = NO;
+    self.contentDimensions = CGSizeMake(0, 0);
+    
+    self.seekableTimeRanges = [NSMutableArray array];
+    
+    self.canScanBackward = NO;
+    
+    self.audioMediaSelectionOptions = nil;
+    self.currentAudioMediaSelectionOption = nil;
+    
+    self.legibleMediaSelectionOptions = nil;
+    self.currentLegibleMediaSelectionOption = nil;
+}
+
 - (id)forwardingTargetForSelector:(SEL)selector
 {
     UNUSED_PARAM(selector);
@@ -166,9 +199,12 @@
 {
     UNUSED_PARAM(playerViewController);
     UNUSED_PARAM(reason);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return YES;
+    
     if (reason == AVPlayerViewControllerExitFullScreenReasonDoneButtonTapped || reason == AVPlayerViewControllerExitFullScreenReasonRemoteControlStopEventReceived)
         self.delegate->pause();
+    
     self.delegate->requestExitFullscreen();
     return NO;
 }
@@ -176,21 +212,24 @@
 - (void)play:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->play();
 }
 
 - (void)pause:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->pause();
 }
 
 - (void)togglePlayback:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->togglePlayState();
 }
 
@@ -201,12 +240,13 @@
 
 - (void)setPlaying:(BOOL)playing
 {
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     if (playing)
         self.delegate->play();
     else
         self.delegate->pause();
-    }
+}
 
 + (NSSet *)keyPathsForValuesAffectingPlaying
 {
@@ -216,20 +256,23 @@
 - (void)beginScrubbing:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->beginScrubbing();
 }
 
 - (void)endScrubbing:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->endScrubbing();
 }
 
 - (void)seekToTime:(NSTimeInterval)time
 {
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->fastSeek(time);
 }
 
@@ -292,28 +335,32 @@
 - (void)beginScanningForward:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->beginScanningForward();
 }
 
 - (void)endScanningForward:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->endScanning();
 }
 
 - (void)beginScanningBackward:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->beginScanningBackward();
 }
 
 - (void)endScanningBackward:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     self.delegate->endScanning();
 }
 
@@ -335,8 +382,8 @@
 - (void)seekToBeginning:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
-
+    if (!self.delegate)
+        return;
     self.delegate->seekToTime(-INFINITY);
 }
 
@@ -363,8 +410,8 @@
 - (void)seekToEnd:(id)sender
 {
     UNUSED_PARAM(sender);
-    ASSERT(self.delegate);
-
+    if (!self.delegate)
+        return;
     self.delegate->seekToTime(INFINITY);
 }
 
@@ -417,7 +464,8 @@
     [_currentAudioMediaSelectionOption release];
     _currentAudioMediaSelectionOption = [option retain];
     
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     
     NSInteger index = NSNotFound;
     
@@ -440,7 +488,8 @@
     [_currentLegibleMediaSelectionOption release];
     _currentLegibleMediaSelectionOption = [option retain];
     
-    ASSERT(self.delegate);
+    if (!self.delegate)
+        return;
     
     NSInteger index = NSNotFound;
     
@@ -580,22 +629,25 @@
 @end
 
 WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit()
-    : m_videoFullscreenModel(nullptr)
+    : m_playerController(adoptNS([[WebAVPlayerController alloc] init]))
+    , m_videoFullscreenModel(nullptr)
 {
 }
 
-WebAVPlayerController *WebVideoFullscreenInterfaceAVKit::playerController()
+void WebVideoFullscreenInterfaceAVKit::resetMediaState()
 {
-    if (!m_playerController)
-    {
-        m_playerController = adoptNS([[WebAVPlayerController alloc] init]);
-        if (m_videoFullscreenModel)
-            [m_playerController setDelegate:m_videoFullscreenModel];
-    }
-    return m_playerController.get();
+    RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
+    
+    dispatch_async(dispatch_get_main_queue(), [strongThis] {
+        if (!strongThis->m_playerController) {
+            strongThis->m_playerController = adoptNS([[WebAVPlayerController alloc] init]);
+            [strongThis->m_playerController setDelegate:strongThis->m_videoFullscreenModel];
+            
+        } else
+            [strongThis->m_playerController resetState];
+    });
 }
 
-
 void WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel(WebVideoFullscreenModel* model)
 {
     m_videoFullscreenModel = model;
@@ -612,7 +664,7 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     
     dispatch_async(dispatch_get_main_queue(), [strongThis, duration] {
-        WebAVPlayerController* playerController = strongThis->playerController();
+        WebAVPlayerController* playerController = strongThis->m_playerController.get();
 
         // FIXME: https://bugs.webkit.org/show_bug.cgi?id=127017 use correct values instead of duration for all these
         playerController.contentDuration = duration;
@@ -636,10 +688,10 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     
     dispatch_async(dispatch_get_main_queue(), [strongThis, currentTime, anchorTime] {
-        NSTimeInterval anchorTimeStamp = ![strongThis->playerController() rate] ? NAN : anchorTime;
+        NSTimeInterval anchorTimeStamp = ![strongThis->m_playerController rate] ? NAN : anchorTime;
         AVValueTiming *timing = [getAVValueTimingClass() valueTimingWithAnchorValue:currentTime
             anchorTimeStamp:anchorTimeStamp rate:0];
-        strongThis->playerController().timing = timing;
+        [strongThis->m_playerController setTiming:timing];
     });
 }
 
@@ -648,7 +700,7 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     
     dispatch_async(dispatch_get_main_queue(), [strongThis, isPlaying, playbackRate] {
-        strongThis->playerController().rate = isPlaying ? playbackRate : 0.;
+        [strongThis->m_playerController setRate:isPlaying ? playbackRate : 0.];
     });
 }
 
@@ -657,8 +709,8 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     
     dispatch_async(dispatch_get_main_queue(), [strongThis, hasVideo, width, height] {
-        strongThis->playerController().hasEnabledVideo = hasVideo;
-        strongThis->playerController().contentDimensions = CGSizeMake(width, height);
+        [strongThis->m_playerController setHasEnabledVideo:hasVideo];
+        [strongThis->m_playerController setContentDimensions:CGSizeMake(width, height)];
     });
 }
 
@@ -678,7 +730,7 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     
     dispatch_async(dispatch_get_main_queue(), [strongThis, seekableRanges] {
-        strongThis->playerController().seekableTimeRanges = seekableRanges.get();
+        [strongThis->m_playerController setSeekableTimeRanges:seekableRanges.get()];
     });
 }
 
@@ -687,7 +739,7 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     
     dispatch_async(dispatch_get_main_queue(), [strongThis, canPlayFastReverse] {
-        strongThis->playerController().canScanBackward = canPlayFastReverse;
+        [strongThis->m_playerController setCanScanBackward:canPlayFastReverse];
     });
 }
 
@@ -708,9 +760,9 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     
     dispatch_async(dispatch_get_main_queue(), [webOptions, strongThis, selectedIndex] {
-        strongThis->playerController().audioMediaSelectionOptions = webOptions.get();
+        [strongThis->m_playerController setAudioMediaSelectionOptions:webOptions.get()];
         if (selectedIndex < [webOptions count])
-            strongThis->playerController().currentAudioMediaSelectionOption = [webOptions objectAtIndex:static_cast<NSUInteger>(selectedIndex)];
+            [strongThis->m_playerController setCurrentAudioMediaSelectionOption:[webOptions objectAtIndex:static_cast<NSUInteger>(selectedIndex)]];
     });
 }
 
@@ -720,9 +772,9 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
 
     dispatch_async(dispatch_get_main_queue(), [webOptions, strongThis, selectedIndex] {
-        strongThis->playerController().legibleMediaSelectionOptions = webOptions.get();
+        [strongThis->m_playerController setLegibleMediaSelectionOptions:webOptions.get()];
         if (selectedIndex < [webOptions count])
-            strongThis->playerController().currentLegibleMediaSelectionOption = [webOptions objectAtIndex:static_cast<NSUInteger>(selectedIndex)];
+            [strongThis->m_playerController setCurrentLegibleMediaSelectionOption:[webOptions objectAtIndex:static_cast<NSUInteger>(selectedIndex)]];
     });
 }
 
@@ -737,7 +789,7 @@
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
 
     dispatch_async(dispatch_get_main_queue(), [strongThis, enabled, localizedDeviceName, externalPlaybackType] {
-        WebAVPlayerController* playerController = strongThis->playerController();
+        WebAVPlayerController* playerController = strongThis->m_playerController.get();
         playerController.externalPlaybackAirPlayDeviceLocalizedName = localizedDeviceName;
         playerController.externalPlaybackType = externalPlaybackType;
         playerController.externalPlaybackActive = enabled;
@@ -777,17 +829,17 @@
     [m_videoLayer removeFromSuperlayer];
 
     m_videoLayerContainer = [WebAVVideoLayer videoLayer];
-    [m_videoLayerContainer setHidden:playerController().externalPlaybackActive];
+    [m_videoLayerContainer setHidden:[m_playerController isExternalPlaybackActive]];
     [m_videoLayerContainer setVideoSublayer:m_videoLayer.get()];
 
-    CGSize videoSize = playerController().contentDimensions;
+    CGSize videoSize = [m_playerController contentDimensions];
     CGRect videoRect = CGRectMake(0, 0, videoSize.width, videoSize.height);
     [m_videoLayerContainer setVideoRect:videoRect];
 
     m_playerViewController = adoptNS([[getAVPlayerViewControllerClass() alloc] initWithVideoLayer:m_videoLayerContainer.get()]);
     [m_playerViewController setShowsPlaybackControls:NO];
-    [m_playerViewController setPlayerController:(AVPlayerController *)playerController()];
-    [m_playerViewController setDelegate:playerController()];
+    [m_playerViewController setPlayerController:(AVPlayerController *)m_playerController.get()];
+    [m_playerViewController setDelegate:m_playerController.get()];
     [m_videoLayerContainer setPlayerViewController:m_playerViewController.get()];
 
     if (m_viewController) {
@@ -893,18 +945,27 @@
         if (m_parentWindow)
             [[getUIApplicationClass() sharedApplication] _setStatusBarOrientation:[m_parentWindow interfaceOrientation]];
     }
+    
+    [m_playerController setDelegate:nil];
+    
     [m_playerViewController setDelegate:nil];
+    [m_playerViewController setPlayerController:nil];
+    
+    [m_playerViewController exitFullScreenAnimated:NO completionHandler:nil];
+    
     [[m_playerViewController view] removeFromSuperview];
     if (m_viewController)
         [m_playerViewController removeFromParentViewController];
-    [m_playerViewController setPlayerController:nil];
-    m_playerViewController = nil;
+    
     [m_videoLayer removeFromSuperlayer];
-    m_videoLayer = nil;
     [m_videoLayerContainer removeFromSuperlayer];
     [m_videoLayerContainer setPlayerViewController:nil];
+    [[m_viewController view] removeFromSuperview];
+    
+    m_videoLayer = nil;
     m_videoLayerContainer = nil;
-    [[m_viewController view] removeFromSuperview];
+    m_playerViewController = nil;
+    m_playerController = nil;
     m_viewController = nil;
     m_window = nil;
     m_parentView = nil;
@@ -919,26 +980,10 @@
 
 void WebVideoFullscreenInterfaceAVKit::invalidate()
 {
-    [m_window setHidden:YES];
-    [m_window setRootViewController:nil];
-    [m_playerViewController exitFullScreenAnimated:NO completionHandler:nil];
-    m_playerController = nil;
-    [m_playerViewController setDelegate:nil];
-    [[m_playerViewController view] removeFromSuperview];
-    if (m_viewController)
-        [m_playerViewController removeFromParentViewController];
-    [m_playerViewController setPlayerController:nil];
-    m_playerViewController = nil;
-    [m_videoLayer removeFromSuperlayer];
-    m_videoLayer = nil;
-    [m_videoLayerContainer removeFromSuperlayer];
-    [m_videoLayerContainer setPlayerViewController:nil];
-    m_videoLayerContainer = nil;
-    [[m_viewController view] removeFromSuperview];
-    m_viewController = nil;
-    m_window = nil;
-    m_parentView = nil;
-    m_parentWindow = nil;
+    m_videoFullscreenModel = nil;
+    m_fullscreenChangeObserver = nil;
+    
+    cleanupFullscreenInternal();
 }
 
 void WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen()

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm	2015-02-26 19:56:49 UTC (rev 180692)
@@ -68,6 +68,9 @@
     if (m_mediaElement == mediaElement)
         return;
 
+    if (m_videoFullscreenInterface)
+        m_videoFullscreenInterface->resetMediaState();
+
     if (m_mediaElement && m_isListening) {
         for (auto eventName : observedEventNames())
             m_mediaElement->removeEventListener(eventName, this, false);

Modified: branches/safari-600.1.4.15-branch/Source/WebKit2/ChangeLog (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebKit2/ChangeLog	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebKit2/ChangeLog	2015-02-26 19:56:49 UTC (rev 180692)
@@ -1,3 +1,23 @@
+2015-02-26  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r179480
+
+    2015-02-02  Jeremy Jones  <jere...@apple.com>
+
+            Prevent crash when accessing WebAVPlayerController.delegate.
+            https://bugs.webkit.org/show_bug.cgi?id=140893
+
+            Reviewed by Darin Adler.
+
+            Plumb new resetMediaState() through IPC interface WebVideoFullscreenManagerProxy.
+
+            * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in:
+            * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+            (WebKit::WebVideoFullscreenManagerProxy::invalidate): remove redundant set to nullptr.
+            * WebProcess/ios/WebVideoFullscreenManager.h:
+            * WebProcess/ios/WebVideoFullscreenManager.mm:
+            (WebKit::WebVideoFullscreenManager::resetMediaState):
+
 2015-02-25  Babak Shafiei  <bshaf...@apple.com>
 
         Merge r180539.

Modified: branches/safari-600.1.4.15-branch/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in	2015-02-26 19:56:49 UTC (rev 180692)
@@ -22,6 +22,7 @@
 
 #if PLATFORM(IOS)
 messages -> WebVideoFullscreenManagerProxy {
+    ResetMediaState()
     SetCurrentTime(double currentTime, double hostTime)
     SetVideoDimensions(bool hasVideo, unsigned width, unsigned height)
     SetSeekableRangesVector(Vector<std::pair<double, double>> ranges);

Modified: branches/safari-600.1.4.15-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h	2015-02-26 19:56:49 UTC (rev 180692)
@@ -67,6 +67,7 @@
     virtual bool operator==(const EventListener& rhs) override { return static_cast<WebCore::EventListener*>(this) == &rhs; }
     
     // FullscreenInterface
+    virtual void resetMediaState() override;
     virtual void setDuration(double) override;
     virtual void setCurrentTime(double currentTime, double anchorTime) override;
     virtual void setRate(bool isPlaying, float playbackRate) override;

Modified: branches/safari-600.1.4.15-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (180691 => 180692)


--- branches/safari-600.1.4.15-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm	2015-02-26 19:51:52 UTC (rev 180691)
+++ branches/safari-600.1.4.15-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm	2015-02-26 19:56:49 UTC (rev 180692)
@@ -114,6 +114,11 @@
     m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(clientRectForNode(node)), m_page->pageID());
 }
 
+void WebVideoFullscreenManager::resetMediaState()
+{
+    m_page->send(Messages::WebVideoFullscreenManagerProxy::ResetMediaState(), m_page->pageID());
+}
+    
 void WebVideoFullscreenManager::setDuration(double duration)
 {
     m_page->send(Messages::WebVideoFullscreenManagerProxy::SetDuration(duration), m_page->pageID());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to