Skip to content

Commit

Permalink
browser(webkit): ignore WebSocket HTTPS errors on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Apr 21, 2020
1 parent 5b085fd commit 40df7bf
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 7 deletions.
2 changes: 1 addition & 1 deletion browser_patches/webkit/BUILD_NUMBER
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1201
1202
74 changes: 68 additions & 6 deletions browser_patches/webkit/patches/bootstrap.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4746,17 +4746,18 @@ index a9d228ca404918860c40651994db78a1e76db5ca..1fc3c345308dfed8384d1c02334f2030
}

diff --git a/Source/WebCore/page/SocketProvider.cpp b/Source/WebCore/page/SocketProvider.cpp
index 803ac83155ff4df1becf75cd4710f6fbf7bbc32a..54fb28427e8b2b7da2ea3204673414f8e1bd24d7 100644
index 803ac83155ff4df1becf75cd4710f6fbf7bbc32a..010b0555af7905b3b8a19d9f4619bc6f3b3241a3 100644
--- a/Source/WebCore/page/SocketProvider.cpp
+++ b/Source/WebCore/page/SocketProvider.cpp
@@ -33,7 +33,11 @@ namespace WebCore {

Ref<SocketStreamHandle> SocketProvider::createSocketStreamHandle(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, const StorageSessionProvider* provider)
{
- return SocketStreamHandleImpl::create(url, client, sessionID, credentialPartition, { }, provider);
+#if OS(WINDOWS)
+ return SocketStreamHandleImpl::create(url, false, client, sessionID, credentialPartition, { }, provider);
+#else
return SocketStreamHandleImpl::create(url, client, sessionID, credentialPartition, { }, provider);
+ return SocketStreamHandleImpl::create(url, false, client, sessionID, credentialPartition, { }, provider);
+#endif
}

Expand Down Expand Up @@ -5374,6 +5375,66 @@ index 87930048f4fd18d6098af7de4da25be532df5931..2bb2afcf9473b0d5d97efbe18dd7b814
Vector<WTF::Function<void(bool)>> m_listeners;
Timer m_updateStateTimer;

diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h b/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h
index d677280d2b5e7b053a240c155d64bc881f1737bb..1be949e09982b34366d162e6d45ebc51a76dcfb0 100644
--- a/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h
+++ b/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h
@@ -47,7 +47,7 @@ class SocketStreamHandleClient;

class SocketStreamHandleImpl : public SocketStreamHandle {
public:
- static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider) { return adoptRef(*new SocketStreamHandleImpl(url, client, sessionID, credentialPartition, WTFMove(auditData), provider)); }
+ static Ref<SocketStreamHandleImpl> create(const URL& url, bool ignoreCertificateErrors, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider) { return adoptRef(*new SocketStreamHandleImpl(url, ignoreCertificateErrors, client, sessionID, credentialPartition, WTFMove(auditData), provider)); }

virtual ~SocketStreamHandleImpl();

@@ -61,7 +61,7 @@ private:
Optional<size_t> platformSendInternal(const uint8_t*, size_t);
bool sendPendingData();

- WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, SourceApplicationAuditToken&&, const StorageSessionProvider*);
+ WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, bool ignoreCertificateErrors, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, SourceApplicationAuditToken&&, const StorageSessionProvider*);
void createStreams();
void scheduleStreams();
void chooseProxy();
@@ -106,6 +106,7 @@ private:
String m_credentialPartition;
SourceApplicationAuditToken m_auditData;
RefPtr<const StorageSessionProvider> m_storageSessionProvider;
+ bool m_ignoreCertificateErrors { false };

StreamBuffer<uint8_t, 1024 * 1024> m_buffer;
static const unsigned maxBufferSize = 100 * 1024 * 1024;
diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp b/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
index 545c28e62f72771de5f3f3e9fed2e8cf6147ed0f..a6fc5f5b3fc62adce2604821bd29f9aed378c24c 100644
--- a/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
@@ -96,7 +96,7 @@ static inline auto callbacksRunLoopMode()
#endif
}

-SocketStreamHandleImpl::SocketStreamHandleImpl(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider)
+SocketStreamHandleImpl::SocketStreamHandleImpl(const URL& url, bool ignoreCertificateErrors, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider)
: SocketStreamHandle(url, client)
, m_connectingSubstate(New)
, m_connectionType(Unknown)
@@ -104,6 +104,7 @@ SocketStreamHandleImpl::SocketStreamHandleImpl(const URL& url, SocketStreamHandl
, m_credentialPartition(credentialPartition)
, m_auditData(WTFMove(auditData))
, m_storageSessionProvider(provider)
+ , m_ignoreCertificateErrors(ignoreCertificateErrors)
{
LOG(Network, "SocketStreamHandle %p new client %p", this, &m_client);

@@ -360,7 +361,7 @@ void SocketStreamHandleImpl::createStreams()
}

if (shouldUseSSL()) {
- CFBooleanRef validateCertificateChain = DeprecatedGlobalSettings::allowsAnySSLCertificate() ? kCFBooleanFalse : kCFBooleanTrue;
+ CFBooleanRef validateCertificateChain = m_ignoreCertificateErrors || DeprecatedGlobalSettings::allowsAnySSLCertificate() ? kCFBooleanFalse : kCFBooleanTrue;
const void* keys[] = {
kCFStreamSSLPeerName,
kCFStreamSSLLevel,
diff --git a/Source/WebCore/platform/network/curl/CurlStream.cpp b/Source/WebCore/platform/network/curl/CurlStream.cpp
index 26dc7bef4b74bc6b4e2e526dec6523c3ad6d3643..c783aa5a7984f3966312e5e0ffd76f93ed6208f8 100644
--- a/Source/WebCore/platform/network/curl/CurlStream.cpp
Expand Down Expand Up @@ -5639,17 +5700,18 @@ index 46342935377111aebb2847dca80dde5b4972f270..9d6756747082c6044c13e5df1f65db95
HashSet<Ref<NetworkResourceLoader>> m_keptAliveLoads;

diff --git a/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp b/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp
index d1fa427d82884fc43569d1bf0df7d728921502fc..59790afe7f4deedc69b3f020e23f2b50a38595cf 100644
index d1fa427d82884fc43569d1bf0df7d728921502fc..dc40e8f11f6ce903a87cf569bab48c6f429f8a89 100644
--- a/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp
+++ b/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp
@@ -43,7 +43,11 @@ Ref<NetworkSocketStream> NetworkSocketStream::create(NetworkProcess& networkProc
NetworkSocketStream::NetworkSocketStream(NetworkProcess& networkProcess, URL&& url, PAL::SessionID sessionID, const String& credentialPartition, WebSocketIdentifier identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData)
: m_identifier(identifier)
, m_connection(connection)
- , m_impl(SocketStreamHandleImpl::create(url, *this, sessionID, credentialPartition, WTFMove(auditData), NetworkStorageSessionProvider::create(networkProcess, sessionID).ptr()))
+#if OS(WINDOWS)
+ , m_impl(SocketStreamHandleImpl::create(url, networkProcess.networkSession(sessionID)->ignoreCertificateErrors(), *this, sessionID, credentialPartition, WTFMove(auditData), NetworkStorageSessionProvider::create(networkProcess, sessionID).ptr()))
+#else
, m_impl(SocketStreamHandleImpl::create(url, *this, sessionID, credentialPartition, WTFMove(auditData), NetworkStorageSessionProvider::create(networkProcess, sessionID).ptr()))
+ , m_impl(SocketStreamHandleImpl::create(url, networkProcess.networkSession(sessionID)->ignoreCertificateErrors(), *this, sessionID, credentialPartition, WTFMove(auditData), NetworkStorageSessionProvider::create(networkProcess, sessionID).ptr()))
+#endif
{
}
Expand Down Expand Up @@ -12223,7 +12285,7 @@ index 0000000000000000000000000000000000000000..135a60361fa8fbf907382625e7c8dd4e
+} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/win/WebPageInspectorEmulationAgentWin.cpp b/Source/WebKit/UIProcess/win/WebPageInspectorEmulationAgentWin.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..62b841fe1d0de2296e1c61e328cff564f5aa1c0f
index 0000000000000000000000000000000000000000..520d9714bac279a8b778c2c377af4411fba8d5d7
--- /dev/null
+++ b/Source/WebKit/UIProcess/win/WebPageInspectorEmulationAgentWin.cpp
@@ -0,0 +1,58 @@
Expand Down Expand Up @@ -12277,7 +12339,7 @@ index 0000000000000000000000000000000000000000..62b841fe1d0de2296e1c61e328cff564
+ width += windowRect.right - windowRect.left - viewRect.right + viewRect.left;
+ height += windowRect.bottom - windowRect.top - viewRect.bottom + viewRect.top;
+
+ if (!SetWindowPos(windowHwnd, 0, 0, 0, width, height, SWP_NOCOPYBITS | SWP_NOSENDCHANGING | SWP_NOMOVE)) {
+ if (!SetWindowPos(windowHwnd, 0, 0, 0, width, height, SWP_NOMOVE)) {
+ callback("Could not resize window");
+ return;
+ }
Expand Down

0 comments on commit 40df7bf

Please sign in to comment.