Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp

Issue 2564493002: Make WebSocket available again in service workers (Closed)
Patch Set: Addressed #26 Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/loader/FrameLoader.h" 42 #include "core/loader/FrameLoader.h"
43 #include "core/loader/FrameLoaderClient.h" 43 #include "core/loader/FrameLoaderClient.h"
44 #include "core/loader/MixedContentChecker.h" 44 #include "core/loader/MixedContentChecker.h"
45 #include "modules/websockets/InspectorWebSocketEvents.h" 45 #include "modules/websockets/InspectorWebSocketEvents.h"
46 #include "modules/websockets/WebSocketChannelClient.h" 46 #include "modules/websockets/WebSocketChannelClient.h"
47 #include "modules/websockets/WebSocketFrame.h" 47 #include "modules/websockets/WebSocketFrame.h"
48 #include "modules/websockets/WebSocketHandleImpl.h" 48 #include "modules/websockets/WebSocketHandleImpl.h"
49 #include "platform/network/NetworkLog.h" 49 #include "platform/network/NetworkLog.h"
50 #include "platform/network/WebSocketHandshakeRequest.h" 50 #include "platform/network/WebSocketHandshakeRequest.h"
51 #include "platform/weborigin/SecurityOrigin.h" 51 #include "platform/weborigin/SecurityOrigin.h"
52 #include "public/platform/InterfaceProvider.h"
52 #include "public/platform/Platform.h" 53 #include "public/platform/Platform.h"
53 #include "wtf/PtrUtil.h" 54 #include "wtf/PtrUtil.h"
54 #include <memory> 55 #include <memory>
55 56
56 namespace blink { 57 namespace blink {
57 58
58 class DocumentWebSocketChannel::BlobLoader final 59 class DocumentWebSocketChannel::BlobLoader final
59 : public GarbageCollectedFinalized<DocumentWebSocketChannel::BlobLoader>, 60 : public GarbageCollectedFinalized<DocumentWebSocketChannel::BlobLoader>,
60 public FileReaderLoaderClient { 61 public FileReaderLoaderClient {
61 public: 62 public:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 m_url = url; 168 m_url = url;
168 Vector<String> protocols; 169 Vector<String> protocols;
169 // Avoid placing an empty token in the Vector when the protocol string is 170 // Avoid placing an empty token in the Vector when the protocol string is
170 // empty. 171 // empty.
171 if (!protocol.isEmpty()) { 172 if (!protocol.isEmpty()) {
172 // Since protocol is already verified and escaped, we can simply split 173 // Since protocol is already verified and escaped, we can simply split
173 // it. 174 // it.
174 protocol.split(", ", true, protocols); 175 protocol.split(", ", true, protocols);
175 } 176 }
176 177
177 if (document()->frame()) { 178 if (document()->frame() &&
179 document()->frame()->interfaceProvider() !=
180 InterfaceProvider::getEmptyInterfaceProvider()) {
178 // Initialize the WebSocketHandle with the frame's InterfaceProvider to 181 // Initialize the WebSocketHandle with the frame's InterfaceProvider to
179 // provide the WebSocket implementation with context about this frame. 182 // provide the WebSocket implementation with context about this frame.
180 // This is important so that the browser can show UI associated with 183 // This is important so that the browser can show UI associated with
181 // the WebSocket (e.g., for certificate errors). 184 // the WebSocket (e.g., for certificate errors).
182 m_handle->initialize(document()->frame()->interfaceProvider()); 185 m_handle->initialize(document()->frame()->interfaceProvider());
183 } else { 186 } else {
184 m_handle->initialize(Platform::current()->interfaceProvider()); 187 m_handle->initialize(Platform::current()->interfaceProvider());
185 } 188 }
186 m_handle->connect(url, protocols, document()->getSecurityOrigin(), 189 m_handle->connect(url, protocols, document()->getSecurityOrigin(),
187 document()->firstPartyForCookies(), document()->userAgent(), 190 document()->firstPartyForCookies(), document()->userAgent(),
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 WebSocketChannel::trace(visitor); 656 WebSocketChannel::trace(visitor);
654 } 657 }
655 658
656 std::ostream& operator<<(std::ostream& ostream, 659 std::ostream& operator<<(std::ostream& ostream,
657 const DocumentWebSocketChannel* channel) { 660 const DocumentWebSocketChannel* channel) {
658 return ostream << "DocumentWebSocketChannel " 661 return ostream << "DocumentWebSocketChannel "
659 << static_cast<const void*>(channel); 662 << static_cast<const void*>(channel);
660 } 663 }
661 664
662 } // namespace blink 665 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698