Title: [202546] trunk/Source/WebCore
Revision
202546
Author
[email protected]
Date
2016-06-27 23:44:01 -0700 (Mon, 27 Jun 2016)

Log Message

REGRESSION?(r202466): http/tests/security/canvas-remote-read-remote-video-redirect.html failing on Sierra
https://bugs.webkit.org/show_bug.cgi?id=159172
<rdar://problem/27030025>

Reviewed by Brent Fulgham.

Add a hasSingleSecurityOrigin property to WebCoreNSURLSession that gets updated each time one of that
sessions' tasks receieves a response or a redirect request. Check that property from the MediaPlayerPrivate.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin):
* platform/network/cocoa/WebCoreNSURLSession.h:
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSession updateHasSingleSecurityOrigin:]):
(-[WebCoreNSURLSession dataTaskWithRequest:]):
(-[WebCoreNSURLSession dataTaskWithURL:]):
(-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
(-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (202545 => 202546)


--- trunk/Source/WebCore/ChangeLog	2016-06-28 06:38:32 UTC (rev 202545)
+++ trunk/Source/WebCore/ChangeLog	2016-06-28 06:44:01 UTC (rev 202546)
@@ -1,3 +1,24 @@
+2016-06-27  Jer Noble  <[email protected]>
+
+        REGRESSION?(r202466): http/tests/security/canvas-remote-read-remote-video-redirect.html failing on Sierra
+        https://bugs.webkit.org/show_bug.cgi?id=159172
+        <rdar://problem/27030025>
+
+        Reviewed by Brent Fulgham.
+
+        Add a hasSingleSecurityOrigin property to WebCoreNSURLSession that gets updated each time one of that
+        sessions' tasks receieves a response or a redirect request. Check that property from the MediaPlayerPrivate.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin):
+        * platform/network/cocoa/WebCoreNSURLSession.h:
+        * platform/network/cocoa/WebCoreNSURLSession.mm:
+        (-[WebCoreNSURLSession updateHasSingleSecurityOrigin:]):
+        (-[WebCoreNSURLSession dataTaskWithRequest:]):
+        (-[WebCoreNSURLSession dataTaskWithURL:]):
+        (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
+        (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]):
+
 2016-06-27  Alex Christensen  <[email protected]>
 
         CMake build fix.

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (202545 => 202546)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2016-06-28 06:38:32 UTC (rev 202545)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2016-06-28 06:44:01 UTC (rev 202546)
@@ -2241,7 +2241,18 @@
     
     Ref<SecurityOrigin> resolvedOrigin(SecurityOrigin::create(resolvedURL()));
     Ref<SecurityOrigin> requestedOrigin(SecurityOrigin::createFromString(assetURL()));
-    return resolvedOrigin.get().isSameSchemeHostPort(&requestedOrigin.get());
+    if (!resolvedOrigin.get().isSameSchemeHostPort(&requestedOrigin.get()))
+        return false;
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 101100
+    AVAssetResourceLoader *resourceLoader = m_avAsset.get().resourceLoader;
+    if (Settings::isAVFoundationNSURLSessionEnabled() && [resourceLoader respondsToSelector:@selector(URLSession)]) {
+        WebCoreNSURLSession *session = (WebCoreNSURLSession *)resourceLoader.URLSession;
+        if ([session respondsToSelector:@selector(hasSingleSecurityOrigin)])
+            return session.hasSingleSecurityOrigin;
+    }
+#endif
+    return true;
 }
 
 bool MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck() const

Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h (202545 => 202546)


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h	2016-06-28 06:38:32 UTC (rev 202545)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h	2016-06-28 06:44:01 UTC (rev 202546)
@@ -46,6 +46,7 @@
 class PlatformMediaResource;
 class PlatformMediaResourceLoader;
 class WebCoreNSURLSessionDataTaskClient;
+class SecurityOrigin;
 }
 
 enum class WebCoreNSURLSessionCORSAccessCheckResults {
@@ -63,9 +64,11 @@
     NSString *_sessionDescription;
     HashSet<RetainPtr<WebCoreNSURLSessionDataTask>> _dataTasks;
     BOOL _invalidated;
+    BOOL _hasSingleSecurityOrigin;
     NSUInteger _nextTaskIdentifier;
     OSObjectPtr<dispatch_queue_t> _internalQueue;
     WebCoreNSURLSessionCORSAccessCheckResults _corsResults;
+    RefPtr<WebCore::SecurityOrigin> _requestedOrigin;
 }
 - (id)initWithResourceLoader:(WebCore::PlatformMediaResourceLoader&)loader delegate:(id<NSURLSessionTaskDelegate>)delegate delegateQueue:(NSOperationQueue*)queue;
 @property (readonly, retain) NSOperationQueue *delegateQueue;
@@ -73,6 +76,7 @@
 @property (readonly, copy) NSURLSessionConfiguration *configuration;
 @property (copy) NSString *sessionDescription;
 @property (readonly) BOOL didPassCORSAccessChecks;
+@property (readonly) BOOL hasSingleSecurityOrigin;
 - (void)finishTasksAndInvalidate;
 - (void)invalidateAndCancel;
 

Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (202545 => 202546)


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2016-06-28 06:38:32 UTC (rev 202545)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2016-06-28 06:44:01 UTC (rev 202546)
@@ -30,6 +30,7 @@
 
 #import "CachedResourceRequest.h"
 #import "PlatformMediaResourceLoader.h"
+#import "SecurityOrigin.h"
 #import "SubresourceLoader.h"
 
 using namespace WebCore;
@@ -44,6 +45,7 @@
 - (void)taskCompleted:(WebCoreNSURLSessionDataTask *)task;
 - (void)addDelegateOperation:(void (^)(void))operation;
 - (void)task:(WebCoreNSURLSessionDataTask *)task didReceiveCORSAccessCheckResult:(BOOL)result;
+- (void)updateHasSingleSecurityOrigin:(SecurityOrigin&)origin;
 @end
 
 @interface WebCoreNSURLSessionDataTask ()
@@ -83,6 +85,7 @@
     self.delegate = inDelegate;
     _queue = inQueue ? inQueue : [NSOperationQueue mainQueue];
     _internalQueue = adoptOSObject(dispatch_queue_create("WebCoreNSURLSession _internalQueue", DISPATCH_QUEUE_SERIAL));
+    _hasSingleSecurityOrigin = YES;
 
     return self;
 }
@@ -139,8 +142,21 @@
         _corsResults = WebCoreNSURLSessionCORSAccessCheckResults::Pass;
 }
 
+- (void)updateHasSingleSecurityOrigin:(SecurityOrigin&)origin
+{
+    if (!_requestedOrigin) {
+        _requestedOrigin = &origin;
+        return;
+    }
+
+    if (!origin.isSameSchemeHostPort(_requestedOrigin.get()))
+        _hasSingleSecurityOrigin = false;
+}
+
 #pragma mark - NSURLSession API
 @synthesize sessionDescription=_sessionDescription;
+@synthesize hasSingleSecurityOrigin=_hasSingleSecurityOrigin;
+
 @dynamic delegate;
 - (__nullable id<NSURLSessionDelegate>)delegate
 {
@@ -234,6 +250,8 @@
     if (_invalidated)
         return nil;
 
+    [self updateHasSingleSecurityOrigin:SecurityOrigin::create([request URL])];
+
     WebCoreNSURLSessionDataTask *task = [[WebCoreNSURLSessionDataTask alloc] initWithSession:self identifier:_nextTaskIdentifier++ request:request];
     _dataTasks.add(task);
     return (NSURLSessionDataTask *)[task autorelease];
@@ -244,6 +262,8 @@
     if (_invalidated)
         return nil;
 
+    [self updateHasSingleSecurityOrigin:SecurityOrigin::create(url)];
+
     WebCoreNSURLSessionDataTask *task = [[WebCoreNSURLSessionDataTask alloc] initWithSession:self identifier:_nextTaskIdentifier++ URL:url];
     _dataTasks.add(task);
     return (NSURLSessionDataTask *)[task autorelease];
@@ -524,6 +544,7 @@
     ASSERT_UNUSED(resource, &resource == _resource);
     ASSERT(isMainThread());
     [self.session task:self didReceiveCORSAccessCheckResult:resource.didPassAccessControlCheck()];
+    [self.session updateHasSingleSecurityOrigin:SecurityOrigin::create(response.url())];
     self.countOfBytesExpectedToReceive = response.expectedContentLength();
     [self _setDefersLoading:YES];
     RetainPtr<NSURLResponse> strongResponse { response.nsURLResponse() };
@@ -608,6 +629,8 @@
     // current request during responseReceieved: to work around a CoreMedia bug.
     if (response.httpStatusCode() != 302 && response.httpStatusCode() != 307)
         self.currentRequest = [NSURLRequest requestWithURL:request.url()];
+
+    [self.session updateHasSingleSecurityOrigin:SecurityOrigin::create(request.url())];
 }
 
 - (void)_resource:(PlatformMediaResource&)resource loadFinishedWithError:(NSError *)error
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to