Diff
Modified: trunk/LayoutTests/ChangeLog (218516 => 218517)
--- trunk/LayoutTests/ChangeLog 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/LayoutTests/ChangeLog 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,3 +1,15 @@
+2017-06-19 Alex Christensen <[email protected]>
+
+ [Cocoa] implement URLSession:task:needNewBodyStream: delegate method
+ https://bugs.webkit.org/show_bug.cgi?id=173551
+ rdar://problem/32250512
+
+ Reviewed by Alex Christensen.
+
+ * http/tests/misc/form-blob-challenge-expected.txt: Added.
+ * http/tests/misc/form-blob-challenge.html: Added.
+ * http/tests/misc/resources/basic-echo-post.php: Added.
+
2017-06-19 Matt Lewis <[email protected]>
Adjusted test ecpectaions for webrtc/libwebrtc/descriptionGetters.html.
Added: trunk/LayoutTests/http/tests/misc/form-blob-challenge-expected.txt (0 => 218517)
--- trunk/LayoutTests/http/tests/misc/form-blob-challenge-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/misc/form-blob-challenge-expected.txt 2017-06-19 23:51:00 UTC (rev 218517)
@@ -0,0 +1,2 @@
+ALERT: Response: Uploaded blob data: blobdata
+
Added: trunk/LayoutTests/http/tests/misc/form-blob-challenge.html (0 => 218517)
--- trunk/LayoutTests/http/tests/misc/form-blob-challenge.html (rev 0)
+++ trunk/LayoutTests/http/tests/misc/form-blob-challenge.html 2017-06-19 23:51:00 UTC (rev 218517)
@@ -0,0 +1,20 @@
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+var formData = new FormData();
+formData.append("data", new Blob(["blobdata"]));
+
+var xhr = new XMLHttpRequest();
+xhr._onreadystatechange_ = function () {
+ if (xhr.readyState === 4) {
+ alert("Response: " + xhr.responseText);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+};
+xhr.open("POST", "resources/basic-echo-post.php", true, "testuser", "testpassword");
+xhr.send(formData);
+</script>
Added: trunk/LayoutTests/http/tests/misc/resources/basic-echo-post.php (0 => 218517)
--- trunk/LayoutTests/http/tests/misc/resources/basic-echo-post.php (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/basic-echo-post.php 2017-06-19 23:51:00 UTC (rev 218517)
@@ -0,0 +1,16 @@
+<?php
+header("Cache-Control: no-store");
+header("Connection: close");
+if (!isset($_SERVER['PHP_AUTH_USER'])
+ || !isset($_SERVER['PHP_AUTH_PW'])) {
+ header("WWW-Authenticate: Basic realm=\"TestRealm\"");
+ header('HTTP/1.0 401 Unauthorized');
+ echo "Please send a username and password";
+ exit;
+}
+
+$myfile = fopen($_FILES["data"]["tmp_name"], "r") or die("Unable to open file!");
+echo "Uploaded blob data: ";
+echo fread($myfile,$_FILES["data"]["size"]);
+fclose($myfile);
+?>
Modified: trunk/Source/WebCore/ChangeLog (218516 => 218517)
--- trunk/Source/WebCore/ChangeLog 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/ChangeLog 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,3 +1,40 @@
+2017-06-19 Darin Adler <[email protected]>
+
+ [Cocoa] implement URLSession:task:needNewBodyStream: delegate method
+ https://bugs.webkit.org/show_bug.cgi?id=173551
+ rdar://problem/32250512
+
+ Reviewed by Alex Christensen.
+
+ Covered by http/tests/misc/form-blob-challenge.html
+
+ * WebCore.xcodeproj/project.pbxproj: Removed NSURLRequestSPI.h.
+
+ * platform/network/cf/FormDataStreamCFNet.cpp:
+ (WebCore::createHTTPBodyCFReadStream): Factored this out from setHTTPBody.
+ (WebCore::setHTTPBody): Factored out the function above.
+ * platform/network/cf/FormDataStreamCFNet.h: Added createHTTPBodyCFReadStream.
+
+ * platform/network/cocoa/ResourceRequestCocoa.mm: Use CFNetworkSPI.h.
+ * platform/network/ios/ResourceRequestIOS.mm: Ditto.
+
+ * platform/network/mac/FormDataStreamMac.h: Added createHTTPBodyNSInputStream.
+ * platform/network/mac/FormDataStreamMac.mm:
+ (WebCore::createHTTPBodyNSInputStream): Added/
+
+ * platform/network/mac/ResourceHandleMac.mm: Use CFNetworkSPI.h.
+ * platform/network/mac/ResourceRequestMac.mm: Ditto.
+ * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Ditto.
+ * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: Ditto.
+
+ * platform/network/mac/WebCoreURLResponse.h: Moved SPI declarations from
+ here into CFNetworkSPI.h.
+
+ * platform/spi/cf/CFNetworkSPI.h: Use #pragma once, consolidated SPI that was
+ defined in scattered locations.
+
+ * platform/spi/cocoa/NSURLRequestSPI.h: Removed. Superceded by CFNetworkSPI.h.
+
2017-06-19 Brady Eidson <[email protected]>
Various IndexedDB crashes as an after effect of previous test.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (218516 => 218517)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1544,7 +1544,6 @@
31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31A795C11888B72400382F90 /* ANGLEInstancedArrays.cpp */; };
31AB5000122878A2001A7DB0 /* GraphicsContext3DIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 31AB4FFF122878A2001A7DB0 /* GraphicsContext3DIOS.h */; };
31B313DB1B69871600F2AABC /* NSURLConnectionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31B313DA1B69871600F2AABC /* NSURLConnectionSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 31B313DD1B6987DB00F2AABC /* NSURLRequestSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31B313DC1B6987DB00F2AABC /* NSURLRequestSPI.h */; };
31B313DF1B6988C500F2AABC /* NSButtonCellSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31B313DE1B6988C500F2AABC /* NSButtonCellSPI.h */; };
31BC742D1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31BC742B1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.cpp */; };
31BC742E1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 31BC742C1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.h */; };
@@ -9220,7 +9219,6 @@
31A795C51888BAD100382F90 /* JSANGLEInstancedArrays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSANGLEInstancedArrays.h; sourceTree = "<group>"; };
31AB4FFF122878A2001A7DB0 /* GraphicsContext3DIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3DIOS.h; sourceTree = "<group>"; };
31B313DA1B69871600F2AABC /* NSURLConnectionSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSURLConnectionSPI.h; sourceTree = "<group>"; };
- 31B313DC1B6987DB00F2AABC /* NSURLRequestSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSURLRequestSPI.h; sourceTree = "<group>"; };
31B313DE1B6988C500F2AABC /* NSButtonCellSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSButtonCellSPI.h; sourceTree = "<group>"; };
31BC742B1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAnimationTriggerScrollValue.cpp; sourceTree = "<group>"; };
31BC742C1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAnimationTriggerScrollValue.h; sourceTree = "<group>"; };
@@ -18881,7 +18879,6 @@
31B313DA1B69871600F2AABC /* NSURLConnectionSPI.h */,
CE1252541A1BEC0E00864480 /* NSURLDownloadSPI.h */,
653EF83819A043AE0052202C /* NSURLFileTypeMappingsSPI.h */,
- 31B313DC1B6987DB00F2AABC /* NSURLRequestSPI.h */,
1AED3BD91D3D5F260099FD78 /* PassKitSPI.h */,
CEE27ACA1BBB53A20072400A /* pthreadSPI.h */,
CE12523C1A1676CD00864480 /* QuartzCoreSPI.h */,
@@ -28915,7 +28912,6 @@
31B313DB1B69871600F2AABC /* NSURLConnectionSPI.h in Headers */,
CE1252551A1BEC0E00864480 /* NSURLDownloadSPI.h in Headers */,
658F540319A1C9240088FC92 /* NSURLFileTypeMappingsSPI.h in Headers */,
- 31B313DD1B6987DB00F2AABC /* NSURLRequestSPI.h in Headers */,
2D77AC2D1BF2B9A00072470A /* NSViewSPI.h in Headers */,
2D0CF8171BCF5DE1007A4937 /* NSWindowSPI.h in Headers */,
F55B3DC81251F12D003EF269 /* NumberInputType.h in Headers */,
Modified: trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp (218516 => 218517)
--- trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2007, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -361,35 +361,19 @@
}
}
-void setHTTPBody(CFMutableURLRequestRef request, FormData* formData)
+RetainPtr<CFReadStreamRef> createHTTPBodyCFReadStream(FormData& formData)
{
- if (!formData)
- return;
-
- size_t count = formData->elements().size();
+ auto resolvedFormData = formData.resolveBlobReferences();
- // Handle the common special case of one piece of form data, with no files.
- if (count == 1 && !formData->alwaysStream()) {
- const FormDataElement& element = formData->elements()[0];
- if (element.m_type == FormDataElement::Type::Data) {
- RetainPtr<CFDataRef> data = "" reinterpret_cast<const UInt8 *>(element.m_data.data()), element.m_data.size()));
- CFURLRequestSetHTTPRequestBody(request, data.get());
- return;
- }
- }
+ // Precompute the content length so CFNetwork doesn't use chunked mode.
+ unsigned long long length = 0;
-
- Ref<FormData> newFormData = formData->resolveBlobReferences();
- count = newFormData->elements().size();
-
- // Precompute the content length so NSURLConnection doesn't use chunked mode.
- unsigned long long length = 0;
- for (size_t i = 0; i < count; ++i) {
- const FormDataElement& element = newFormData->elements()[i];
+ for (auto& element : resolvedFormData->elements()) {
if (element.m_type == FormDataElement::Type::Data)
length += element.m_data.size();
else {
- // If we're sending the file range, use the existing range length for now. We will detect if the file has been changed right before we read the file and abort the operation if necessary.
+ // If we're sending the file range, use the existing range length for now.
+ // We will detect if the file has been changed right before we read the file and abort the operation if necessary.
if (element.m_fileLength != BlobDataItem::toEndOfFile) {
length += element.m_fileLength;
continue;
@@ -400,16 +384,29 @@
}
}
- // Create and set the stream.
+ FormCreationContext formContext = { WTFMove(resolvedFormData), length };
+ CFReadStreamCallBacksV1 callBacks = { 1, formCreate, formFinalize, nullptr, formOpen, nullptr, formRead, nullptr, formCanRead, formClose, formCopyProperty, nullptr, nullptr, formSchedule, formUnschedule };
+ return adoptCF(CFReadStreamCreate(nullptr, static_cast<const void*>(&callBacks), &formContext));
+}
- // Pass the length along with the formData so it does not have to be recomputed.
- FormCreationContext formContext = {WTFMove(newFormData), length};
+void setHTTPBody(CFMutableURLRequestRef request, FormData* formData)
+{
+ if (!formData)
+ return;
- CFReadStreamCallBacksV1 callBacks = { 1, formCreate, formFinalize, 0, formOpen, 0, formRead, 0, formCanRead, formClose, formCopyProperty, 0, 0, formSchedule, formUnschedule
- };
- RetainPtr<CFReadStreamRef> stream = adoptCF(CFReadStreamCreate(0, static_cast<const void*>(&callBacks), &formContext));
+ // Handle the common special case of one piece of form data, with no files.
+ auto& elements = formData->elements();
+ if (elements.size() == 1 && !formData->alwaysStream()) {
+ auto& element = elements[0];
+ if (element.m_type == FormDataElement::Type::Data) {
+ auto& vector = element.m_data;
+ auto data = "" reinterpret_cast<const UInt8*>(vector.data()), vector.size()));
+ CFURLRequestSetHTTPRequestBody(request, data.get());
+ return;
+ }
+ }
- CFURLRequestSetHTTPRequestBodyStream(request, stream.get());
+ CFURLRequestSetHTTPRequestBodyStream(request, createHTTPBodyCFReadStream(*formData).get());
}
FormData* httpBodyFromStream(CFReadStreamRef stream)
Modified: trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.h (218516 => 218517)
--- trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.h 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.h 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2007, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef FormDataStreamCFNet_h
-#define FormDataStreamCFNet_h
+#pragma once
#include <wtf/Forward.h>
+#include <wtf/RetainPtr.h>
typedef struct _CFURLRequest* CFMutableURLRequestRef;
typedef struct __CFReadStream* CFReadStreamRef;
@@ -40,6 +40,7 @@
class FormData;
void setHTTPBody(CFMutableURLRequestRef, FormData*);
+RetainPtr<CFReadStreamRef> createHTTPBodyCFReadStream(FormData&);
FormData* httpBodyFromStream(CFReadStreamRef);
@@ -46,5 +47,3 @@
CFStringRef formDataStreamLengthPropertyName();
} // namespace WebCore
-
-#endif // FormDataStreamCFNet_h
Modified: trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm (218516 => 218517)
--- trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -28,6 +28,7 @@
#if PLATFORM(COCOA)
+#import "CFNetworkSPI.h"
#import "FileSystem.h"
#import "FormDataStreamMac.h"
#import "HTTPHeaderNames.h"
@@ -34,21 +35,9 @@
#import "ResourceRequestCFNet.h"
#import "RuntimeApplicationChecks.h"
#import "WebCoreSystemInterface.h"
-
#import <Foundation/Foundation.h>
#import <wtf/text/CString.h>
-@interface NSURLRequest (WebNSURLRequestDetails)
-- (NSArray *)contentDispositionEncodingFallbackArray;
-+ (void)setDefaultTimeoutInterval:(NSTimeInterval)seconds;
-- (CFURLRequestRef)_CFURLRequest;
-- (id)_initWithCFURLRequest:(CFURLRequestRef)request;
-@end
-
-@interface NSMutableURLRequest (WebMutableNSURLRequestDetails)
-- (void)setContentDispositionEncodingFallbackArray:(NSArray *)theEncodingFallbackArray;
-@end
-
namespace WebCore {
NSURLRequest *ResourceRequest::nsURLRequest(HTTPBodyUpdatePolicy bodyPolicy) const
Modified: trunk/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm (218516 => 218517)
--- trunk/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -28,10 +28,7 @@
#if PLATFORM(IOS)
-@interface NSURLRequest (WebNSURLRequestDetails)
-- (CFURLRequestRef)_CFURLRequest;
-- (id)_initWithCFURLRequest:(CFURLRequestRef)request;
-@end
+#import "CFNetworkSPI.h"
namespace WebCore {
Modified: trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.h (218516 => 218517)
--- trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.h 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.h 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,9 +31,8 @@
#if !USE(CFURLCONNECTION)
#include <wtf/Forward.h>
+#include <wtf/RetainPtr.h>
-typedef const struct _CFURLRequest* CFURLRequestRef;
-
@class NSInputStream;
@class NSMutableURLRequest;
@@ -42,6 +41,7 @@
class FormData;
void setHTTPBody(NSMutableURLRequest *, FormData*);
+WEBCORE_EXPORT RetainPtr<NSInputStream> createHTTPBodyNSInputStream(FormData&);
FormData* httpBodyFromStream(NSInputStream *);
CFStringRef formDataStreamLengthPropertyName();
Modified: trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.mm (218516 => 218517)
--- trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2008, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,13 +31,9 @@
#if !USE(CFURLCONNECTION)
-#import "FormData.h"
+#import "CFNetworkSPI.h"
#import "FormDataStreamCFNet.h"
-@interface NSURLRequest (WebNSURLRequestDetails)
-- (CFURLRequestRef)_CFURLRequest;
-@end
-
namespace WebCore {
void setHTTPBody(NSMutableURLRequest *request, FormData* formData)
@@ -45,6 +41,11 @@
setHTTPBody(const_cast<CFMutableURLRequestRef>([request _CFURLRequest]), formData);
}
+RetainPtr<NSInputStream> createHTTPBodyNSInputStream(FormData& formData)
+{
+ return reinterpret_cast<NSInputStream *>(createHTTPBodyCFReadStream(formData).get());
+}
+
FormData* httpBodyFromStream(NSInputStream *stream)
{
return httpBodyFromStream(reinterpret_cast<CFReadStreamRef>(stream));
Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (218516 => 218517)
--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -70,10 +70,6 @@
#import "CFNetworkSPI.h"
#import "RuntimeApplicationChecks.h"
#import "WebCoreThreadRun.h"
-
-@interface NSURLRequest ()
-- (CFURLRequestRef) _CFURLRequest;
-@end
#endif
using namespace WebCore;
Modified: trunk/Source/WebCore/platform/network/mac/ResourceRequestMac.mm (218516 => 218517)
--- trunk/Source/WebCore/platform/network/mac/ResourceRequestMac.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/mac/ResourceRequestMac.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -28,13 +28,9 @@
#if PLATFORM(MAC)
+#import "CFNetworkSPI.h"
#import <Foundation/Foundation.h>
-@interface NSURLRequest (WebNSURLRequestDetails)
-- (CFURLRequestRef)_CFURLRequest;
-- (id)_initWithCFURLRequest:(CFURLRequestRef)request;
-@end
-
namespace WebCore {
#if USE(CFURLCONNECTION)
Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm (218516 => 218517)
--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -30,8 +30,8 @@
#import "AuthenticationChallenge.h"
#import "AuthenticationMac.h"
+#import "CFNetworkSPI.h"
#import "Logging.h"
-#import "NSURLRequestSPI.h"
#import "ResourceHandle.h"
#import "ResourceHandleClient.h"
#import "ResourceRequest.h"
Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (218516 => 218517)
--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +30,8 @@
#import "AuthenticationChallenge.h"
#import "AuthenticationMac.h"
+#import "CFNetworkSPI.h"
#import "Logging.h"
-#import "NSURLRequestSPI.h"
#import "ResourceHandle.h"
#import "ResourceHandleClient.h"
#import "ResourceRequest.h"
@@ -58,7 +58,7 @@
- (void)detachHandle
{
- m_handle = 0;
+ m_handle = nullptr;
m_requestResult = nullptr;
m_cachedResponseResult = nullptr;
Modified: trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.h (218516 => 218517)
--- trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.h 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.h 2017-06-19 23:51:00 UTC (rev 218517)
@@ -28,20 +28,12 @@
#include "CFNetworkSPI.h"
+namespace WebCore {
+
#ifdef __OBJC__
-@interface NSURLResponse (Details)
-- (void)_setMIMEType:(NSString *)type;
-@end
-
-@class NSURLConnection;
-@class NSURLRequest;
-@class NSURLResponse;
-
-namespace WebCore {
WEBCORE_EXPORT NSURLResponse *synthesizeRedirectResponseIfNecessary(NSURLRequest *currentRequest, NSURLRequest *newRequest, NSURLResponse *redirectResponse);
-}
-#endif // __OBJC__
+#endif
-namespace WebCore {
WEBCORE_EXPORT void adjustMIMETypeIfNecessary(CFURLResponseRef, bool isMainResourceLoad);
+
}
Modified: trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h (218516 => 218517)
--- trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h 2017-06-19 23:51:00 UTC (rev 218517)
@@ -25,8 +25,7 @@
#pragma clang system_header
-#ifndef CFNetworkSPI_h
-#define CFNetworkSPI_h
+#pragma once
#include "CFNetworkConnectionCacheSPI.h"
#include <CFNetwork/CFNetwork.h>
@@ -46,7 +45,7 @@
// FIXME: Remove the defined(__OBJC__)-guard once we fix <rdar://problem/19033610>.
#if defined(__OBJC__) && PLATFORM(COCOA)
#import <CFNetwork/CFNSURLConnection.h>
-#endif // defined(__OBJC__) && PLATFORM(COCOA)
+#endif
#else // !PLATFORM(WIN) && !USE(APPLE_INTERNAL_SDK)
@@ -83,6 +82,7 @@
#endif
#if defined(__OBJC__)
+
@interface NSURLCache ()
-(instancetype)_initWithMemoryCapacity:(NSUInteger)memoryCapacity diskCapacity:(NSUInteger)diskCapacity relativePath:(NSString *)path;
- (CFURLCacheRef)_CFURLCache;
@@ -91,9 +91,18 @@
@interface NSURLRequest ()
+ (NSArray *)allowsSpecificHTTPSCertificateForHost:(NSString *)host;
+ (void)setAllowsSpecificHTTPSCertificate:(NSArray *)allow forHost:(NSString *)host;
++ (void)setDefaultTimeoutInterval:(NSTimeInterval)seconds;
+- (NSArray *)contentDispositionEncodingFallbackArray;
+- (CFURLRequestRef)_CFURLRequest;
+- (id)_initWithCFURLRequest:(CFURLRequestRef)request;
+- (id)_propertyForKey:(NSString *)key;
- (void)_setProperty:(id)value forKey:(NSString *)key;
@end
+@interface NSMutableURLRequest ()
+- (void)setContentDispositionEncodingFallbackArray:(NSArray *)theEncodingFallbackArray;
+@end
+
@interface NSURLResponse ()
+ (NSURLResponse *)_responseWithCFURLResponse:(CFURLResponseRef)response;
- (CFURLResponseRef)_CFURLResponse;
@@ -154,6 +163,7 @@
WTF_EXTERN_C_BEGIN
#if !PLATFORM(WIN)
+
CFURLStorageSessionRef _CFURLStorageSessionCreate(CFAllocatorRef, CFStringRef, CFDictionaryRef);
CFURLCacheRef _CFURLStorageSessionCopyCache(CFAllocatorRef, CFURLStorageSessionRef);
@@ -174,10 +184,11 @@
#if PLATFORM(COCOA)
CFDataRef _CFCachedURLResponseGetMemMappedData(CFCachedURLResponseRef);
-#ifdef __BLOCKS__
+#endif
+
+#if PLATFORM(COCOA) && defined(__BLOCKS__)
void _CFCachedURLResponseSetBecameFileBackedCallBackBlock(CFCachedURLResponseRef, CFCachedURLResponseCallBackBlock, dispatch_queue_t);
#endif
-#endif // PLATFORM(COCOA)
extern CFStringRef const kCFHTTPCookieLocalFileDomain;
extern const CFStringRef kCFHTTPVersion1_1;
@@ -218,6 +229,7 @@
WTF_EXTERN_C_END
#if defined(__OBJC__) && !USE(APPLE_INTERNAL_SDK)
+
enum : NSUInteger {
NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3,
};
@@ -226,6 +238,7 @@
-(id)_initWithCFCachedURLResponse:(CFCachedURLResponseRef)cachedResponse;
-(CFCachedURLResponseRef)_CFCachedURLResponse;
@end
+
#endif
WTF_EXTERN_C_BEGIN
@@ -271,6 +284,9 @@
+ (void)_setSharedHTTPCookieStorage:(NSHTTPCookieStorage *)storage;
@end
#endif
+
+@interface NSURLResponse ()
+- (void)_setMIMEType:(NSString *)type;
+@end
+
#endif // defined(__OBJC__)
-
-#endif // CFNetworkSPI_h
Deleted: trunk/Source/WebCore/platform/spi/cocoa/NSURLRequestSPI.h (218516 => 218517)
--- trunk/Source/WebCore/platform/spi/cocoa/NSURLRequestSPI.h 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebCore/platform/spi/cocoa/NSURLRequestSPI.h 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if USE(APPLE_INTERNAL_SDK)
-
-#import <Foundation/NSURLRequestPrivate.h>
-
-#else
-
-@interface NSURLRequest ()
-- (id)_propertyForKey:(NSString *)key;
-@end
-
-#endif
-
-
-
Modified: trunk/Source/WebKit2/ChangeLog (218516 => 218517)
--- trunk/Source/WebKit2/ChangeLog 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,3 +1,33 @@
+2017-06-19 Darin Adler <[email protected]>
+
+ [Cocoa] implement URLSession:task:needNewBodyStream: delegate method
+ https://bugs.webkit.org/show_bug.cgi?id=173551
+ rdar://problem/32250512
+
+ Reviewed by Alex Christensen.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate existingTask:]): Added helper method.
+ (-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
+ Updated to use existingTask: method.
+ (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]): Added.
+ (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
+ Updated to use existingTask: method.
+ (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]): Ditto.
+ (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): Ditto.
+ (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): Ditto.
+ (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): Ditto.
+ (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): Ditto.
+ (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]): Ditto.
+ (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]): Ditto.
+ (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]): Ditto.
+ (WebKit::globalAllowsCellularAccess): Deleted. Just use a normal global.
+ (WebKit::globalLegacyCustomProtocolManager): Deleted. Just use a normal global.
+ (WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Updated for normal global.
+ (WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Ditto.
+ (WebKit::NetworkSessionCocoa::defaultSession): Ditto.
+ (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Ditto.
+
2017-06-19 Ryan Haddad <[email protected]>
Unreviewed, rolling out r218503.
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (218516 => 218517)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2017-06-19 23:19:11 UTC (rev 218516)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2017-06-19 23:51:00 UTC (rev 218517)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,6 +40,7 @@
#import <Foundation/NSURLSession.h>
#import <WebCore/CFNetworkSPI.h>
#import <WebCore/Credential.h>
+#import <WebCore/FormDataStreamMac.h>
#import <WebCore/FrameLoaderTypes.h>
#import <WebCore/NetworkStorageSession.h>
#import <WebCore/NotImplemented.h>
@@ -118,6 +119,18 @@
_session = nullptr;
}
+- (NetworkDataTaskCocoa*)existingTask:(NSURLSessionTask *)task
+{
+ if (!_session)
+ return nullptr;
+
+ if (!task)
+ return nullptr;
+
+ auto allowStoredCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
+ return _session->dataTaskForIdentifier(task.taskIdentifier, allowStoredCredentials);
+}
+
- (void)URLSession:(NSURLSession *)session didBecomeInvalidWithError:(nullable NSError *)error
{
ASSERT(!_session);
@@ -125,26 +138,33 @@
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
{
- if (!_session)
- return;
-
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials))
+ if (auto* networkDataTask = [self existingTask:task])
networkDataTask->didSendData(totalBytesSent, totalBytesExpectedToSend);
}
-- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest *))completionHandler
+- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler
{
- if (!_session) {
+ auto* networkDataTask = [self existingTask:task];
+ if (!networkDataTask) {
completionHandler(nil);
return;
}
+ auto* body = networkDataTask->firstRequest().httpBody();
+ if (!body) {
+ completionHandler(nil);
+ return;
+ }
+
+ completionHandler(WebCore::createHTTPBodyNSInputStream(*body).get());
+}
+
+- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest *))completionHandler
+{
auto taskIdentifier = task.taskIdentifier;
LOG(NetworkSession, "%llu willPerformHTTPRedirection from %s to %s", taskIdentifier, response.URL.absoluteString.UTF8String, request.URL.absoluteString.UTF8String);
-
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
+
+ if (auto* networkDataTask = [self existingTask:task]) {
auto completionHandlerCopy = Block_copy(completionHandler);
networkDataTask->willPerformHTTPRedirection(response, request, [completionHandlerCopy, taskIdentifier](auto& request) {
#if !LOG_DISABLED
@@ -163,16 +183,10 @@
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask*)task _schemeUpgraded:(NSURLRequest*)request completionHandler:(void (^)(NSURLRequest*))completionHandler
{
- if (!_session) {
- completionHandler(nil);
- return;
- }
-
auto taskIdentifier = task.taskIdentifier;
LOG(NetworkSession, "%llu _schemeUpgraded %s", taskIdentifier, request.URL.absoluteString.UTF8String);
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(taskIdentifier, storedCredentials)) {
+ if (auto* networkDataTask = [self existingTask:task]) {
auto completionHandlerCopy = Block_copy(completionHandler);
networkDataTask->willPerformHTTPRedirection(WebCore::synthesizeRedirectResponseIfNecessary([task currentRequest], request, nil), request, [completionHandlerCopy, taskIdentifier](auto& request) {
#if !LOG_DISABLED
@@ -206,16 +220,10 @@
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
- if (!_session) {
- completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
- return;
- }
-
auto taskIdentifier = task.taskIdentifier;
LOG(NetworkSession, "%llu didReceiveChallenge", taskIdentifier);
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
+ if (auto* networkDataTask = [self existingTask:task]) {
WebCore::AuthenticationChallenge authenticationChallenge(challenge);
auto completionHandlerCopy = Block_copy(completionHandler);
auto sessionID = _session->sessionID();
@@ -260,8 +268,7 @@
return;
LOG(NetworkSession, "%llu didCompleteWithError %@", task.taskIdentifier, error);
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials))
+ if (auto* networkDataTask = [self existingTask:task])
networkDataTask->didCompleteWithError(error, networkDataTask->networkLoadMetrics());
else if (error) {
auto downloadID = _session->takeDownloadID(task.taskIdentifier);
@@ -284,12 +291,8 @@
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics
{
- if (!_session)
- return;
-
LOG(NetworkSession, "%llu didFinishCollectingMetrics", task.taskIdentifier);
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
+ if (auto* networkDataTask = [self existingTask:task]) {
NSURLSessionTaskTransactionMetrics *m = metrics.transactionMetrics.lastObject;
NSDate *fetchStartDate = m.fetchStartDate;
NSTimeInterval domainLookupStartInterval = m.domainLookupStartDate ? [m.domainLookupStartDate timeIntervalSinceDate:fetchStartDate] : -1;
@@ -352,15 +355,9 @@
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler
{
- if (!_session) {
- completionHandler(NSURLSessionResponseCancel);
- return;
- }
-
auto taskIdentifier = dataTask.taskIdentifier;
LOG(NetworkSession, "%llu didReceiveResponse", taskIdentifier);
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(taskIdentifier, storedCredentials)) {
+ if (auto* networkDataTask = [self existingTask:dataTask]) {
ASSERT(isMainThread());
// Avoid MIME type sniffing if the response comes back as 304 Not Modified.
@@ -397,11 +394,7 @@
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data
{
- if (!_session)
- return;
-
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(dataTask.taskIdentifier, storedCredentials))
+ if (auto* networkDataTask = [self existingTask:dataTask])
networkDataTask->didReceiveData(WebCore::SharedBuffer::create(data));
}
@@ -420,8 +413,7 @@
if (!_session)
return;
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- ASSERT_WITH_MESSAGE_UNUSED(storedCredentials, !_session->dataTaskForIdentifier([downloadTask taskIdentifier], storedCredentials), "The NetworkDataTask should be destroyed immediately after didBecomeDownloadTask returns");
+ ASSERT_WITH_MESSAGE(![self existingTask:downloadTask], "The NetworkDataTask should be destroyed immediately after didBecomeDownloadTask returns");
auto downloadID = _session->downloadID([downloadTask taskIdentifier]);
if (auto* download = WebKit::NetworkProcess::singleton().downloadManager().download(downloadID))
@@ -438,11 +430,7 @@
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask
{
- if (!_session)
- return;
-
- auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier([dataTask taskIdentifier], storedCredentials)) {
+ if (auto* networkDataTask = [self existingTask:dataTask]) {
Ref<NetworkDataTaskCocoa> protectedNetworkDataTask(*networkDataTask);
auto downloadID = networkDataTask->pendingDownloadID();
auto& downloadManager = WebKit::NetworkProcess::singleton().downloadManager();
@@ -460,6 +448,13 @@
namespace WebKit {
+static bool allowsCellularAccess { true };
+static LegacyCustomProtocolManager* legacyCustomProtocolManager;
+
+#if !ASSERT_DISABLED
+static bool sessionsCreated = false;
+#endif
+
static NSURLSessionConfiguration *configurationForSessionID(const WebCore::SessionID& session)
{
if (session.isEphemeral()) {
@@ -470,18 +465,6 @@
return [NSURLSessionConfiguration defaultSessionConfiguration];
}
-static bool& globalAllowsCellularAccess()
-{
- static bool allowsCellularAccess { true };
- return allowsCellularAccess;
-}
-
-static LegacyCustomProtocolManager*& globalLegacyCustomProtocolManager()
-{
- static LegacyCustomProtocolManager* customProtocolManager { nullptr };
- return customProtocolManager;
-}
-
static RetainPtr<CFDataRef>& globalSourceApplicationAuditTokenData()
{
static NeverDestroyed<RetainPtr<CFDataRef>> sourceApplicationAuditTokenData;
@@ -508,14 +491,10 @@
}
#endif
-#if !ASSERT_DISABLED
-static bool sessionsCreated = false;
-#endif
-
void NetworkSessionCocoa::setLegacyCustomProtocolManager(LegacyCustomProtocolManager* customProtocolManager)
{
ASSERT(!sessionsCreated);
- globalLegacyCustomProtocolManager() = customProtocolManager;
+ legacyCustomProtocolManager = customProtocolManager;
}
void NetworkSessionCocoa::setSourceApplicationAuditTokenData(RetainPtr<CFDataRef>&& data)
@@ -538,7 +517,7 @@
void NetworkSessionCocoa::setAllowsCellularAccess(bool value)
{
- globalAllowsCellularAccess() = value;
+ allowsCellularAccess = value;
}
#if PLATFORM(IOS)
@@ -557,7 +536,7 @@
NetworkSession& NetworkSessionCocoa::defaultSession()
{
ASSERT(isMainThread());
- static NetworkSession* session = &NetworkSessionCocoa::create(WebCore::SessionID::defaultSessionID(), globalLegacyCustomProtocolManager()).leakRef();
+ static NetworkSession* session = &NetworkSessionCocoa::create(WebCore::SessionID::defaultSessionID(), legacyCustomProtocolManager).leakRef();
return *session;
}
@@ -572,7 +551,7 @@
NSURLSessionConfiguration *configuration = configurationForSessionID(m_sessionID);
- if (!globalAllowsCellularAccess())
+ if (!allowsCellularAccess)
configuration.allowsCellularAccess = NO;
if (NetworkCache::singleton().isEnabled())