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

Side by Side Diff: runtime/bin/vmservice_impl.cc

Issue 2125343002: Ban cross origin WebSocket connections to the service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: skybrian review Created 4 years, 5 months 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 | « runtime/bin/vmservice_impl.h ('k') | runtime/observatory/HACKING.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/vmservice_impl.h" 5 #include "bin/vmservice_impl.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 result = Dart_SetNativeResolver(library, VmServiceIONativeResolver, NULL); 169 result = Dart_SetNativeResolver(library, VmServiceIONativeResolver, NULL);
170 SHUTDOWN_ON_ERROR(result); 170 SHUTDOWN_ON_ERROR(result);
171 result = Dart_FinalizeLoading(false); 171 result = Dart_FinalizeLoading(false);
172 SHUTDOWN_ON_ERROR(result); 172 SHUTDOWN_ON_ERROR(result);
173 return true; 173 return true;
174 } 174 }
175 175
176 176
177 bool VmService::Setup(const char* server_ip, 177 bool VmService::Setup(const char* server_ip,
178 intptr_t server_port, 178 intptr_t server_port,
179 bool running_precompiled) { 179 bool running_precompiled,
180 bool dev_mode_server) {
180 Dart_Isolate isolate = Dart_CurrentIsolate(); 181 Dart_Isolate isolate = Dart_CurrentIsolate();
181 ASSERT(isolate != NULL); 182 ASSERT(isolate != NULL);
182 SetServerIPAndPort("", 0); 183 SetServerIPAndPort("", 0);
183 184
184 Dart_Handle result; 185 Dart_Handle result;
185 186
186 // Prepare builtin and its dependent libraries for use to resolve URIs. 187 // Prepare builtin and its dependent libraries for use to resolve URIs.
187 // Set up various closures, e.g: printing, timers etc. 188 // Set up various closures, e.g: printing, timers etc.
188 // Set up 'package root' for URI resolution. 189 // Set up 'package root' for URI resolution.
189 result = DartUtils::PrepareForScriptLoading(true, false); 190 result = DartUtils::PrepareForScriptLoading(true, false);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Adjust server_port to port 0 which will result in the first available 235 // Adjust server_port to port 0 which will result in the first available
235 // port when the HTTP server is started. 236 // port when the HTTP server is started.
236 server_port = 0; 237 server_port = 0;
237 } 238 }
238 result = DartUtils::SetIntegerField(library, "_port", server_port); 239 result = DartUtils::SetIntegerField(library, "_port", server_port);
239 SHUTDOWN_ON_ERROR(result); 240 SHUTDOWN_ON_ERROR(result);
240 result = Dart_SetField(library, 241 result = Dart_SetField(library,
241 DartUtils::NewString("_autoStart"), 242 DartUtils::NewString("_autoStart"),
242 Dart_NewBoolean(auto_start)); 243 Dart_NewBoolean(auto_start));
243 SHUTDOWN_ON_ERROR(result); 244 SHUTDOWN_ON_ERROR(result);
245 result = Dart_SetField(library,
246 DartUtils::NewString("_originCheckDisabled"),
247 Dart_NewBoolean(dev_mode_server));
244 248
245 // Are we running on Windows? 249 // Are we running on Windows?
246 #if defined(TARGET_OS_WINDOWS) 250 #if defined(TARGET_OS_WINDOWS)
247 Dart_Handle is_windows = Dart_True(); 251 Dart_Handle is_windows = Dart_True();
248 #else 252 #else
249 Dart_Handle is_windows = Dart_False(); 253 Dart_Handle is_windows = Dart_False();
250 #endif 254 #endif
251 result = 255 result =
252 Dart_SetField(library, DartUtils::NewString("_isWindows"), is_windows); 256 Dart_SetField(library, DartUtils::NewString("_isWindows"), is_windows);
253 SHUTDOWN_ON_ERROR(result); 257 SHUTDOWN_ON_ERROR(result);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 Dart_Handle source = GetSource(url_string); 357 Dart_Handle source = GetSource(url_string);
354 if (Dart_IsError(source)) { 358 if (Dart_IsError(source)) {
355 return source; 359 return source;
356 } 360 }
357 return Dart_LoadSource(library, url, source, 0, 0); 361 return Dart_LoadSource(library, url, source, 0, 0);
358 } 362 }
359 363
360 364
361 } // namespace bin 365 } // namespace bin
362 } // namespace dart 366 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice_impl.h ('k') | runtime/observatory/HACKING.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698