Title: [185511] trunk/Source/WebKit2
Revision
185511
Author
[email protected]
Date
2015-06-12 10:04:48 -0700 (Fri, 12 Jun 2015)

Log Message

[iOS WK2] Video with reflection crashes WebKit and Safari
https://bugs.webkit.org/show_bug.cgi?id=145905
rdar://problem/18364939

Reviewed by Anders Carlsson.

On iOS, AVPlayerLayers are contained inside a WebVideoContainerLayer, but
the layer type is still LayerTypeAVPlayerLayer.

Avoid throwing exceptions when cloning such layers by checking the layer class.

* WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
(WebKit::PlatformCALayerRemoteCustom::clone):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185510 => 185511)


--- trunk/Source/WebKit2/ChangeLog	2015-06-12 16:59:26 UTC (rev 185510)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-12 17:04:48 UTC (rev 185511)
@@ -1,3 +1,19 @@
+2015-06-12  Simon Fraser  <[email protected]>
+
+        [iOS WK2] Video with reflection crashes WebKit and Safari
+        https://bugs.webkit.org/show_bug.cgi?id=145905
+        rdar://problem/18364939
+
+        Reviewed by Anders Carlsson.
+        
+        On iOS, AVPlayerLayers are contained inside a WebVideoContainerLayer, but
+        the layer type is still LayerTypeAVPlayerLayer.
+        
+        Avoid throwing exceptions when cloning such layers by checking the layer class.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
+        (WebKit::PlatformCALayerRemoteCustom::clone):
+
 2015-06-12  Csaba Osztrogonác  <[email protected]>
 
         [EFL] Fix unused private field warning in WebContextMenuProxyEfl.cpp

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm (185510 => 185511)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm	2015-06-12 16:59:26 UTC (rev 185510)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm	2015-06-12 17:04:48 UTC (rev 185511)
@@ -104,13 +104,20 @@
     bool copyContents = true;
 
     if (layerType() == LayerTypeAVPlayerLayer) {
-        clonedLayer = adoptNS([allocAVPlayerLayerInstance() init]);
+        
+        if ([platformLayer() isKindOfClass:getAVPlayerLayerClass()]) {
+            clonedLayer = adoptNS([allocAVPlayerLayerInstance() init]);
 
-        AVPlayerLayer* destinationPlayerLayer = static_cast<AVPlayerLayer *>(clonedLayer.get());
-        AVPlayerLayer* sourcePlayerLayer = static_cast<AVPlayerLayer *>(platformLayer());
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [destinationPlayerLayer setPlayer:[sourcePlayerLayer player]];
-        });
+            AVPlayerLayer* destinationPlayerLayer = static_cast<AVPlayerLayer *>(clonedLayer.get());
+            AVPlayerLayer* sourcePlayerLayer = static_cast<AVPlayerLayer *>(platformLayer());
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [destinationPlayerLayer setPlayer:[sourcePlayerLayer player]];
+            });
+        } else {
+            // On iOS, the AVPlayerLayer is inside a WebVideoContainerLayer. This code needs to share logic with MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer().
+            clonedLayer = adoptNS([[CALayer alloc] init]);
+        }
+
         copyContents = false;
     } else if (layerType() == LayerTypeWebGLLayer) {
         clonedLayer = adoptNS([[CALayer alloc] init]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to