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

Side by Side Diff: test/inspector/inspector-test.cc

Issue 2705533002: [inspector] remove iterators and for...of loops from injected-script-source (Closed)
Patch Set: ac Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if !defined(_WIN32) && !defined(_WIN64) 5 #if !defined(_WIN32) && !defined(_WIN64)
6 #include <unistd.h> // NOLINT 6 #include <unistd.h> // NOLINT
7 #endif // !defined(_WIN32) && !defined(_WIN64) 7 #endif // !defined(_WIN32) && !defined(_WIN64)
8 8
9 #include <locale.h> 9 #include <locale.h>
10 10
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 class InspectorExtension : public v8::Extension { 376 class InspectorExtension : public v8::Extension {
377 public: 377 public:
378 InspectorExtension() 378 InspectorExtension()
379 : v8::Extension("v8_inspector/inspector", 379 : v8::Extension("v8_inspector/inspector",
380 "native function attachInspector();" 380 "native function attachInspector();"
381 "native function detachInspector();" 381 "native function detachInspector();"
382 "native function setMaxAsyncTaskStacks();" 382 "native function setMaxAsyncTaskStacks();"
383 "native function breakProgram();" 383 "native function breakProgram();"
384 "native function createObjectWithStrictCheck();" 384 "native function createObjectWithStrictCheck();"
385 "native function callWithScheduledBreak();") {} 385 "native function callWithScheduledBreak();"
386 "native function allowAccessorFormatting();") {}
386 387
387 virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( 388 virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
388 v8::Isolate* isolate, v8::Local<v8::String> name) { 389 v8::Isolate* isolate, v8::Local<v8::String> name) {
389 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 390 v8::Local<v8::Context> context = isolate->GetCurrentContext();
390 if (name->Equals(context, 391 if (name->Equals(context,
391 v8::String::NewFromUtf8(isolate, "attachInspector", 392 v8::String::NewFromUtf8(isolate, "attachInspector",
392 v8::NewStringType::kNormal) 393 v8::NewStringType::kNormal)
393 .ToLocalChecked()) 394 .ToLocalChecked())
394 .FromJust()) { 395 .FromJust()) {
395 return v8::FunctionTemplate::New(isolate, InspectorExtension::Attach); 396 return v8::FunctionTemplate::New(isolate, InspectorExtension::Attach);
(...skipping 24 matching lines...) Expand all
420 .FromJust()) { 421 .FromJust()) {
421 return v8::FunctionTemplate::New( 422 return v8::FunctionTemplate::New(
422 isolate, InspectorExtension::CreateObjectWithStrictCheck); 423 isolate, InspectorExtension::CreateObjectWithStrictCheck);
423 } else if (name->Equals(context, v8::String::NewFromUtf8( 424 } else if (name->Equals(context, v8::String::NewFromUtf8(
424 isolate, "callWithScheduledBreak", 425 isolate, "callWithScheduledBreak",
425 v8::NewStringType::kNormal) 426 v8::NewStringType::kNormal)
426 .ToLocalChecked()) 427 .ToLocalChecked())
427 .FromJust()) { 428 .FromJust()) {
428 return v8::FunctionTemplate::New( 429 return v8::FunctionTemplate::New(
429 isolate, InspectorExtension::CallWithScheduledBreak); 430 isolate, InspectorExtension::CallWithScheduledBreak);
431 } else if (name->Equals(context, v8::String::NewFromUtf8(
432 isolate, "allowAccessorFormatting",
433 v8::NewStringType::kNormal)
434 .ToLocalChecked())
435 .FromJust()) {
436 return v8::FunctionTemplate::New(
437 isolate, InspectorExtension::AllowAccessorFormatting);
430 } 438 }
431 return v8::Local<v8::FunctionTemplate>(); 439 return v8::Local<v8::FunctionTemplate>();
432 } 440 }
433 441
434 private: 442 private:
435 static void Attach(const v8::FunctionCallbackInfo<v8::Value>& args) { 443 static void Attach(const v8::FunctionCallbackInfo<v8::Value>& args) {
436 v8::Isolate* isolate = args.GetIsolate(); 444 v8::Isolate* isolate = args.GetIsolate();
437 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 445 v8::Local<v8::Context> context = isolate->GetCurrentContext();
438 v8_inspector::V8Inspector* inspector = 446 v8_inspector::V8Inspector* inspector =
439 InspectorClientImpl::InspectorFromContext(context); 447 InspectorClientImpl::InspectorFromContext(context);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 v8_inspector::StringView reason_view(reason.start(), reason.length()); 526 v8_inspector::StringView reason_view(reason.start(), reason.length());
519 v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>()); 527 v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>());
520 v8_inspector::StringView details_view(details.start(), details.length()); 528 v8_inspector::StringView details_view(details.start(), details.length());
521 session->schedulePauseOnNextStatement(reason_view, details_view); 529 session->schedulePauseOnNextStatement(reason_view, details_view);
522 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); 530 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
523 v8::MaybeLocal<v8::Value> result; 531 v8::MaybeLocal<v8::Value> result;
524 result = args[0].As<v8::Function>()->Call(context, context->Global(), 0, 532 result = args[0].As<v8::Function>()->Call(context, context->Global(), 0,
525 nullptr); 533 nullptr);
526 session->cancelPauseOnNextStatement(); 534 session->cancelPauseOnNextStatement();
527 } 535 }
536
537 static void AllowAccessorFormatting(
538 const v8::FunctionCallbackInfo<v8::Value>& args) {
539 if (args.Length() != 1 || !args[0]->IsObject()) {
540 fprintf(stderr, "Internal error: allowAccessorFormatting('object').");
541 Exit();
542 }
543 v8::Local<v8::Object> object = args[0].As<v8::Object>();
544 v8::Isolate* isolate = args.GetIsolate();
545 v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi(
546 isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting",
547 v8::NewStringType::kNormal)
548 .ToLocalChecked());
549 object
550 ->SetPrivate(isolate->GetCurrentContext(), shouldFormatAccessorsPrivate,
551 v8::Null(isolate))
552 .ToChecked();
553 }
528 }; 554 };
529 555
530 v8::Local<v8::String> ToString(v8::Isolate* isolate, 556 v8::Local<v8::String> ToString(v8::Isolate* isolate,
531 const v8_inspector::StringView& string) { 557 const v8_inspector::StringView& string) {
532 if (string.is8Bit()) 558 if (string.is8Bit())
533 return v8::String::NewFromOneByte(isolate, string.characters8(), 559 return v8::String::NewFromOneByte(isolate, string.characters8(),
534 v8::NewStringType::kNormal, 560 v8::NewStringType::kNormal,
535 static_cast<int>(string.length())) 561 static_cast<int>(string.length()))
536 .ToLocalChecked(); 562 .ToLocalChecked();
537 else 563 else
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 argv[i]); 656 argv[i]);
631 Exit(); 657 Exit();
632 } 658 }
633 frontend_runner.Append(new ExecuteStringTask(chars)); 659 frontend_runner.Append(new ExecuteStringTask(chars));
634 } 660 }
635 661
636 frontend_runner.Join(); 662 frontend_runner.Join();
637 backend_runner.Join(); 663 backend_runner.Join();
638 return 0; 664 return 0;
639 } 665 }
OLDNEW
« no previous file with comments | « test/inspector/inspector-impl.cc ('k') | test/inspector/runtime/evaluate-with-generate-preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698