Title: [204210] trunk
Revision
204210
Author
[email protected]
Date
2016-08-05 18:13:59 -0700 (Fri, 05 Aug 2016)

Log Message

revert r202466 r202546 this causes regressions in media loading with temporary redirects.
https://bugs.webkit.org/show_bug.cgi?id=160613

Patch by Jeremy Jones <[email protected]> on 2016-08-05
Reviewed by Jon Lee.

Source/WebCore:

No new tests. Skipping two tests.

This reverts a change that attempted to fix temporary redirects with media loading.
The change introduced problems. Reverting this to require media stack to properly
handle redirects.

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

LayoutTests:

Reverting a fix that enabled two tests. These tests now fail and are skipped.

* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204209 => 204210)


--- trunk/LayoutTests/ChangeLog	2016-08-06 01:05:15 UTC (rev 204209)
+++ trunk/LayoutTests/ChangeLog	2016-08-06 01:13:59 UTC (rev 204210)
@@ -1,3 +1,14 @@
+2016-08-05  Jeremy Jones  <[email protected]>
+
+        revert r202466 r202546 this causes regressions in media loading with temporary redirects.
+        https://bugs.webkit.org/show_bug.cgi?id=160613
+
+        Reviewed by Jon Lee.
+
+        Reverting a fix that enabled two tests. These tests now fail and are skipped.
+
+        * platform/mac/TestExpectations:
+
 2016-08-05  Nan Wang  <[email protected]>
 
         AX: Asking for group members of radio button that has no name attribute will cause crash

Modified: trunk/LayoutTests/platform/mac/TestExpectations (204209 => 204210)


--- trunk/LayoutTests/platform/mac/TestExpectations	2016-08-06 01:05:15 UTC (rev 204209)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2016-08-06 01:13:59 UTC (rev 204210)
@@ -1385,6 +1385,10 @@
 [ Sierra+ ] http/tests/security/anchor-download-allow-sameorigin.html [ Skip ]
 [ Sierra+ ] http/tests/security/anchor-download-allow-blob.html [ Skip ]
 
+# <rdar://problem/25780035> CSP does not ignore paths for media redirects
+[ Sierra+ ] http/tests/security/contentSecurityPolicy/audio-redirect-allowed2.html [ Skip ]
+[ Sierra+ ] http/tests/security/contentSecurityPolicy/video-redirect-allowed2.html [ Skip ]
+
 # <rdar://problem/26590623> LayoutTest http/tests/preload/single_download_preload_runner.html failing
 [ Sierra+ ] http/tests/preload/single_download_preload_runner.html [ Pass Timeout Failure ]
 

Modified: trunk/Source/WebCore/ChangeLog (204209 => 204210)


--- trunk/Source/WebCore/ChangeLog	2016-08-06 01:05:15 UTC (rev 204209)
+++ trunk/Source/WebCore/ChangeLog	2016-08-06 01:13:59 UTC (rev 204210)
@@ -1,3 +1,27 @@
+2016-08-05  Jeremy Jones  <[email protected]>
+
+        revert r202466 r202546 this causes regressions in media loading with temporary redirects.
+        https://bugs.webkit.org/show_bug.cgi?id=160613
+
+        Reviewed by Jon Lee.
+
+        No new tests. Skipping two tests.
+
+        This reverts a change that attempted to fix temporary redirects with media loading.
+        The change introduced problems. Reverting this to require media stack to properly
+        handle redirects.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin):
+        * platform/network/cocoa/WebCoreNSURLSession.h:
+        * platform/network/cocoa/WebCoreNSURLSession.mm:
+        (-[WebCoreNSURLSession initWithResourceLoader:delegate:delegateQueue:]): Deleted.
+        (-[WebCoreNSURLSession updateHasSingleSecurityOrigin:]): Deleted.
+        (-[WebCoreNSURLSession dataTaskWithRequest:]): Deleted.
+        (-[WebCoreNSURLSession dataTaskWithURL:]): Deleted.
+        (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
+        (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]): Deleted.
+
 2016-08-05  Simon Fraser  <[email protected]>
 
         Add a tiny bit more image logging

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2016-08-06 01:05:15 UTC (rev 204209)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2016-08-06 01:13:59 UTC (rev 204210)
@@ -2244,18 +2244,7 @@
     
     Ref<SecurityOrigin> resolvedOrigin(SecurityOrigin::create(resolvedURL()));
     Ref<SecurityOrigin> requestedOrigin(SecurityOrigin::createFromString(assetURL()));
-    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;
+    return resolvedOrigin.get().isSameSchemeHostPort(&requestedOrigin.get());
 }
 
 bool MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck() const

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


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h	2016-08-06 01:05:15 UTC (rev 204209)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h	2016-08-06 01:13:59 UTC (rev 204210)
@@ -47,7 +47,6 @@
 class PlatformMediaResource;
 class PlatformMediaResourceLoader;
 class WebCoreNSURLSessionDataTaskClient;
-class SecurityOrigin;
 }
 
 enum class WebCoreNSURLSessionCORSAccessCheckResults {
@@ -66,11 +65,9 @@
     HashSet<RetainPtr<WebCoreNSURLSessionDataTask>> _dataTasks;
     Lock _dataTasksLock;
     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;
@@ -78,7 +75,6 @@
 @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 (204209 => 204210)


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2016-08-06 01:05:15 UTC (rev 204209)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2016-08-06 01:13:59 UTC (rev 204210)
@@ -30,7 +30,6 @@
 
 #import "CachedResourceRequest.h"
 #import "PlatformMediaResourceLoader.h"
-#import "SecurityOrigin.h"
 #import "SubresourceLoader.h"
 
 using namespace WebCore;
@@ -45,7 +44,6 @@
 - (void)taskCompleted:(WebCoreNSURLSessionDataTask *)task;
 - (void)addDelegateOperation:(void (^)(void))operation;
 - (void)task:(WebCoreNSURLSessionDataTask *)task didReceiveCORSAccessCheckResult:(BOOL)result;
-- (void)updateHasSingleSecurityOrigin:(SecurityOrigin&)origin;
 @end
 
 @interface WebCoreNSURLSessionDataTask ()
@@ -85,7 +83,6 @@
     self.delegate = inDelegate;
     _queue = inQueue ? inQueue : [NSOperationQueue mainQueue];
     _internalQueue = adoptOSObject(dispatch_queue_create("WebCoreNSURLSession _internalQueue", DISPATCH_QUEUE_SERIAL));
-    _hasSingleSecurityOrigin = YES;
 
     return self;
 }
@@ -150,21 +147,8 @@
         _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
 {
@@ -275,8 +259,6 @@
     if (_invalidated)
         return nil;
 
-    [self updateHasSingleSecurityOrigin:SecurityOrigin::create([request URL])];
-
     WebCoreNSURLSessionDataTask *task = [[WebCoreNSURLSessionDataTask alloc] initWithSession:self identifier:_nextTaskIdentifier++ request:request];
     {
         Locker<Lock> locker(_dataTasksLock);
@@ -290,8 +272,6 @@
     if (_invalidated)
         return nil;
 
-    [self updateHasSingleSecurityOrigin:SecurityOrigin::create(url)];
-
     WebCoreNSURLSessionDataTask *task = [[WebCoreNSURLSessionDataTask alloc] initWithSession:self identifier:_nextTaskIdentifier++ URL:url];
     {
         Locker<Lock> locker(_dataTasksLock);
@@ -575,22 +555,9 @@
     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() };
-
-    if (response.url() != URL(self.currentRequest.URL)) {
-        // FIXME(<rdar://problem/27000361>):
-        // Work around a bug in CoreMedia: CM will pull the URL out of the ResourceResponse
-        // and use that URL for all future requests for the same piece of media. This breaks
-        // certain features of CORS, as well as being against the HTTP spec in the case of
-        // non-permanent redirects.
-        auto responseData = response.crossThreadData();
-        responseData.url = ""
-        strongResponse = ResourceResponseBase::fromCrossThreadData(WTFMove(responseData)).nsURLResponse();
-    }
-
     RetainPtr<WebCoreNSURLSessionDataTask> strongSelf { self };
     [self.session addDelegateOperation:[strongSelf, strongResponse] {
         strongSelf->_response = strongResponse.get();
@@ -654,14 +621,6 @@
     // delegate handles the callback and responds via a completion handler. If, in
     // the future, the ResourceLoader exposes a callback-based willSendResponse
     // API, this can be implemented.
-
-    // FIXME(<rdar://problem/27000361>):
-    // Do not update the current request if the redirect is temporary; use this
-    // 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