| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,7 @@ using v8::FunctionCallbackInfo; | |||
| 31 | 31 | using v8::HandleScope; | |
| 32 | 32 | using v8::Isolate; | |
| 33 | 33 | using v8::Just; | |
| 34 | + using v8::JustVoid; | ||
| 34 | 35 | using v8::Local; | |
| 35 | 36 | using v8::Maybe; | |
| 36 | 37 | using v8::MaybeLocal; | |
@@ -635,7 +636,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) { | |||
| 635 | 636 | ||
| 636 | 637 | // This runs at runtime, regardless of whether the context | |
| 637 | 638 | // is created from a snapshot. | |
| 638 | - Maybe<bool> InitializeContextRuntime(Local<Context> context) { | ||
| 639 | + Maybe<void> InitializeContextRuntime(Local<Context> context) { | ||
| 639 | 640 | Isolate* isolate = context->GetIsolate(); | |
| 640 | 641 | HandleScope handle_scope(isolate); | |
| 641 | 642 | ||
@@ -653,7 +654,7 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) { | |||
| 653 | 654 | Boolean::New(isolate, is_code_generation_from_strings_allowed)); | |
| 654 | 655 | ||
| 655 | 656 | if (per_process::cli_options->disable_proto == "") { | |
| 656 | - return Just(true); | ||
| 657 | + return JustVoid(); | ||
| 657 | 658 | } | |
| 658 | 659 | ||
| 659 | 660 | // Remove __proto__ | |
@@ -669,14 +670,14 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) { | |||
| 669 | 670 | if (!context->Global() | |
| 670 | 671 | ->Get(context, object_string) | |
| 671 | 672 | .ToLocal(&object_v)) { | |
| 672 | - return Nothing<bool>(); | ||
| 673 | + return Nothing<void>(); | ||
| 673 | 674 | } | |
| 674 | 675 | ||
| 675 | 676 | Local<Value> prototype_v; | |
| 676 | 677 | if (!object_v.As<Object>() | |
| 677 | 678 | ->Get(context, prototype_string) | |
| 678 | 679 | .ToLocal(&prototype_v)) { | |
| 679 | - return Nothing<bool>(); | ||
| 680 | + return Nothing<void>(); | ||
| 680 | 681 | } | |
| 681 | 682 | ||
| 682 | 683 | prototype = prototype_v.As<Object>(); | |
@@ -689,13 +690,13 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) { | |||
| 689 | 690 | if (prototype | |
| 690 | 691 | ->Delete(context, proto_string) | |
| 691 | 692 | .IsNothing()) { | |
| 692 | - return Nothing<bool>(); | ||
| 693 | + return Nothing<void>(); | ||
| 693 | 694 | } | |
| 694 | 695 | } else if (per_process::cli_options->disable_proto == "throw") { | |
| 695 | 696 | Local<Value> thrower; | |
| 696 | 697 | if (!Function::New(context, ProtoThrower) | |
| 697 | 698 | .ToLocal(&thrower)) { | |
| 698 | - return Nothing<bool>(); | ||
| 699 | + return Nothing<void>(); | ||
| 699 | 700 | } | |
| 700 | 701 | ||
| 701 | 702 | PropertyDescriptor descriptor(thrower, thrower); | |
@@ -704,17 +705,17 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) { | |||
| 704 | 705 | if (prototype | |
| 705 | 706 | ->DefineProperty(context, proto_string, descriptor) | |
| 706 | 707 | .IsNothing()) { | |
| 707 | - return Nothing<bool>(); | ||
| 708 | + return Nothing<void>(); | ||
| 708 | 709 | } | |
| 709 | 710 | } else if (per_process::cli_options->disable_proto != "") { | |
| 710 | 711 | // Validated in ProcessGlobalArgs | |
| 711 | 712 | UNREACHABLE("invalid --disable-proto mode"); | |
| 712 | 713 | } | |
| 713 | 714 | ||
| 714 | - return Just(true); | ||
| 715 | + return JustVoid(); | ||
| 715 | 716 | } | |
| 716 | 717 | ||
| 717 | - Maybe<bool> InitializeBaseContextForSnapshot(Local<Context> context) { | ||
| 718 | + Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { | ||
| 718 | 719 | Isolate* isolate = context->GetIsolate(); | |
| 719 | 720 | HandleScope handle_scope(isolate); | |
| 720 | 721 | ||
@@ -728,18 +729,18 @@ Maybe<bool> InitializeBaseContextForSnapshot(Local<Context> context) { | |||
| 728 | 729 | ||
| 729 | 730 | Local<Value> intl_v; | |
| 730 | 731 | if (!context->Global()->Get(context, intl_string).ToLocal(&intl_v)) { | |
| 731 | - return Nothing<bool>(); | ||
| 732 | + return Nothing<void>(); | ||
| 732 | 733 | } | |
| 733 | 734 | ||
| 734 | 735 | if (intl_v->IsObject() && | |
| 735 | 736 | intl_v.As<Object>()->Delete(context, break_iter_string).IsNothing()) { | |
| 736 | - return Nothing<bool>(); | ||
| 737 | + return Nothing<void>(); | ||
| 737 | 738 | } | |
| 738 | 739 | } | |
| 739 | - return Just(true); | ||
| 740 | + return JustVoid(); | ||
| 740 | 741 | } | |
| 741 | 742 | ||
| 742 | - Maybe<bool> InitializeMainContextForSnapshot(Local<Context> context) { | ||
| 743 | + Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { | ||
| 743 | 744 | Isolate* isolate = context->GetIsolate(); | |
| 744 | 745 | HandleScope handle_scope(isolate); | |
| 745 | 746 | ||
@@ -750,12 +751,12 @@ Maybe<bool> InitializeMainContextForSnapshot(Local<Context> context) { | |||
| 750 | 751 | ContextEmbedderIndex::kAllowCodeGenerationFromStrings, True(isolate)); | |
| 751 | 752 | ||
| 752 | 753 | if (InitializeBaseContextForSnapshot(context).IsNothing()) { | |
| 753 | - return Nothing<bool>(); | ||
| 754 | + return Nothing<void>(); | ||
| 754 | 755 | } | |
| 755 | 756 | return InitializePrimordials(context); | |
| 756 | 757 | } | |
| 757 | 758 | ||
| 758 | - Maybe<bool> InitializePrimordials(Local<Context> context) { | ||
| 759 | + Maybe<void> InitializePrimordials(Local<Context> context) { | ||
| 759 | 760 | // Run per-context JS files. | |
| 760 | 761 | Isolate* isolate = context->GetIsolate(); | |
| 761 | 762 | Context::Scope context_scope(context); | |
@@ -769,7 +770,7 @@ Maybe<bool> InitializePrimordials(Local<Context> context) { | |||
| 769 | 770 | if (primordials->SetPrototype(context, Null(isolate)).IsNothing() || | |
| 770 | 771 | !GetPerContextExports(context).ToLocal(&exports) || | |
| 771 | 772 | exports->Set(context, primordials_string, primordials).IsNothing()) { | |
| 772 | - return Nothing<bool>(); | ||
| 773 | + return Nothing<void>(); | ||
| 773 | 774 | } | |
| 774 | 775 | ||
| 775 | 776 | static const char* context_files[] = {"internal/per_context/primordials", | |
@@ -793,11 +794,11 @@ Maybe<bool> InitializePrimordials(Local<Context> context) { | |||
| 793 | 794 | context, *module, arraysize(arguments), arguments, nullptr) | |
| 794 | 795 | .IsEmpty()) { | |
| 795 | 796 | // Execution failed during context creation. | |
| 796 | - return Nothing<bool>(); | ||
| 797 | + return Nothing<void>(); | ||
| 797 | 798 | } | |
| 798 | 799 | } | |
| 799 | 800 | ||
| 800 | - return Just(true); | ||
| 801 | + return JustVoid(); | ||
| 801 | 802 | } | |
| 802 | 803 | ||
| 803 | 804 | // This initializes the main context (i.e. vm contexts are not included). | |
@@ -806,7 +807,10 @@ Maybe<bool> InitializeContext(Local<Context> context) { | |||
| 806 | 807 | return Nothing<bool>(); | |
| 807 | 808 | } | |
| 808 | 809 | ||
| 809 | - return InitializeContextRuntime(context); | ||
| 810 | + if (InitializeContextRuntime(context).IsNothing()) { | ||
| 811 | + return Nothing<bool>(); | ||
| 812 | + } | ||
| 813 | + return Just(true); | ||
| 810 | 814 | } | |
| 811 | 815 | ||
| 812 | 816 | uv_loop_t* GetCurrentEventLoop(Isolate* isolate) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,8 +46,8 @@ Maybe<bool> EmitProcessBeforeExit(Environment* env) { | |||
| 46 | 46 | Local<Integer> exit_code = Integer::New( | |
| 47 | 47 | isolate, static_cast<int32_t>(env->exit_code(ExitCode::kNoFailure))); | |
| 48 | 48 | ||
| 49 | - return ProcessEmit(env, "beforeExit", exit_code).IsEmpty() ? | ||
| 50 | - Nothing<bool>() : Just(true); | ||
| 49 | + return ProcessEmit(env, "beforeExit", exit_code).IsEmpty() ? Nothing<bool>() | ||
| 50 | + : Just(true); | ||
| 51 | 51 | } | |
| 52 | 52 | ||
| 53 | 53 | static ExitCode EmitExitInternal(Environment* env) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ using v8::FunctionCallbackInfo; | |||
| 10 | 10 | using v8::FunctionTemplate; | |
| 11 | 11 | using v8::HandleScope; | |
| 12 | 12 | using v8::Just; | |
| 13 | + using v8::JustVoid; | ||
| 13 | 14 | using v8::Local; | |
| 14 | 15 | using v8::Maybe; | |
| 15 | 16 | using v8::Object; | |
@@ -110,9 +111,9 @@ Maybe<std::vector<BaseObjectPtr<BaseObject>>> BaseObject::NestedTransferables() | |||
| 110 | 111 | return Just(std::vector<BaseObjectPtr<BaseObject>>{}); | |
| 111 | 112 | } | |
| 112 | 113 | ||
| 113 | - Maybe<bool> BaseObject::FinalizeTransferRead(Local<Context> context, | ||
| 114 | + Maybe<void> BaseObject::FinalizeTransferRead(Local<Context> context, | ||
| 114 | 115 | ValueDeserializer* deserializer) { | |
| 115 | - return Just(true); | ||
| 116 | + return JustVoid(); | ||
| 116 | 117 | } | |
| 117 | 118 | ||
| 118 | 119 | BaseObject::PointerData* BaseObject::pointer_data() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -173,7 +173,7 @@ class BaseObject : public MemoryRetainer { | |||
| 173 | 173 | virtual std::unique_ptr<worker::TransferData> CloneForMessaging() const; | |
| 174 | 174 | virtual v8::Maybe<std::vector<BaseObjectPtrImpl<BaseObject, false>>> | |
| 175 | 175 | NestedTransferables() const; | |
| 176 | - virtual v8::Maybe<bool> FinalizeTransferRead( | ||
| 176 | + virtual v8::Maybe<void> FinalizeTransferRead( | ||
| 177 | 177 | v8::Local<v8::Context> context, v8::ValueDeserializer* deserializer); | |
| 178 | 178 | ||
| 179 | 179 | // Indicates whether this object is expected to use a strong reference during | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1480,13 +1480,13 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { | |||
| 1480 | 1480 | ||
| 1481 | 1481 | switch (order) { | |
| 1482 | 1482 | case DNS_ORDER_IPV4_FIRST: | |
| 1483 | - if (add(true, false).IsNothing()) return; | ||
| 1484 | - if (add(false, true).IsNothing()) return; | ||
| 1483 | + if (add(true, false).IsNothing() || add(false, true).IsNothing()) | ||
| 1484 | + return; | ||
| 1485 | 1485 | ||
| 1486 | 1486 | break; | |
| 1487 | 1487 | case DNS_ORDER_IPV6_FIRST: | |
| 1488 | - if (add(false, true).IsNothing()) return; | ||
| 1489 | - if (add(true, false).IsNothing()) return; | ||
| 1488 | + if (add(false, true).IsNothing() || add(true, false).IsNothing()) | ||
| 1489 | + return; | ||
| 1490 | 1490 | ||
| 1491 | 1491 | break; | |
| 1492 | 1492 | default: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,6 @@ using v8::HandleScope; | |||
| 19 | 19 | using v8::Integer; | |
| 20 | 20 | using v8::Intercepted; | |
| 21 | 21 | using v8::Isolate; | |
| 22 | - using v8::Just; | ||
| 23 | 22 | using v8::JustVoid; | |
| 24 | 23 | using v8::Local; | |
| 25 | 24 | using v8::Maybe; | |
@@ -320,7 +319,7 @@ Maybe<void> KVStore::AssignFromObject(Local<Context> context, | |||
| 320 | 319 | ||
| 321 | 320 | // TODO(bnoordhuis) Not super efficient but called infrequently. Not worth | |
| 322 | 321 | // the trouble yet of specializing for RealEnvStore and MapKVStore. | |
| 323 | - Maybe<bool> KVStore::AssignToObject(v8::Isolate* isolate, | ||
| 322 | + Maybe<void> KVStore::AssignToObject(v8::Isolate* isolate, | ||
| 324 | 323 | v8::Local<v8::Context> context, | |
| 325 | 324 | v8::Local<v8::Object> object) { | |
| 326 | 325 | HandleScope scope(isolate); | |
@@ -333,9 +332,9 @@ Maybe<bool> KVStore::AssignToObject(v8::Isolate* isolate, | |||
| 333 | 332 | ok = ok && key->IsString(); | |
| 334 | 333 | ok = ok && Get(isolate, key.As<String>()).ToLocal(&value); | |
| 335 | 334 | ok = ok && object->Set(context, key, value).To(&ok); | |
| 336 | - if (!ok) return Nothing<bool>(); | ||
| 335 | + if (!ok) return Nothing<void>(); | ||
| 337 | 336 | } | |
| 338 | - return Just(true); | ||
| 337 | + return JustVoid(); | ||
| 339 | 338 | } | |
| 340 | 339 | ||
| 341 | 340 | static Intercepted EnvGetter(Local<Name> property, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,10 +110,10 @@ void SignalExit(int signal, siginfo_t* info, void* ucontext); | |||
| 110 | 110 | std::string GetProcessTitle(const char* default_title); | |
| 111 | 111 | std::string GetHumanReadableProcessName(); | |
| 112 | 112 | ||
| 113 | - v8::Maybe<bool> InitializeBaseContextForSnapshot( | ||
| 113 | + v8::Maybe<void> InitializeBaseContextForSnapshot( | ||
| 114 | 114 | v8::Local<v8::Context> context); | |
| 115 | - v8::Maybe<bool> InitializeContextRuntime(v8::Local<v8::Context> context); | ||
| 116 | - v8::Maybe<bool> InitializePrimordials(v8::Local<v8::Context> context); | ||
| 115 | + v8::Maybe<void> InitializeContextRuntime(v8::Local<v8::Context> context); | ||
| 116 | + v8::Maybe<void> InitializePrimordials(v8::Local<v8::Context> context); | ||
| 117 | 117 | ||
| 118 | 118 | class NodeArrayBufferAllocator : public ArrayBufferAllocator { | |
| 119 | 119 | public: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,6 +25,7 @@ using v8::Global; | |||
| 25 | 25 | using v8::HandleScope; | |
| 26 | 26 | using v8::Isolate; | |
| 27 | 27 | using v8::Just; | |
| 28 | + using v8::JustVoid; | ||
| 28 | 29 | using v8::Local; | |
| 29 | 30 | using v8::Maybe; | |
| 30 | 31 | using v8::MaybeLocal; | |
@@ -337,7 +338,11 @@ class SerializerDelegate : public ValueSerializer::Delegate { | |||
| 337 | 338 | // methods like toString(). It's probably confusing if that gets lost | |
| 338 | 339 | // in transmission. | |
| 339 | 340 | Local<Object> normal_object = Object::New(isolate); | |
| 340 | - env_->env_vars()->AssignToObject(isolate, env_->context(), normal_object); | ||
| 341 | + if (env_->env_vars() | ||
| 342 | + ->AssignToObject(isolate, env_->context(), normal_object) | ||
| 343 | + .IsNothing()) { | ||
| 344 | + return Nothing<bool>(); | ||
| 345 | + } | ||
| 341 | 346 | serializer->WriteUint32(kNormalObject); // Instead of a BaseObject. | |
| 342 | 347 | return serializer->WriteValue(env_->context(), normal_object); | |
| 343 | 348 | } | |
@@ -1389,25 +1394,25 @@ JSTransferable::NestedTransferables() const { | |||
| 1389 | 1394 | return Just(ret); | |
| 1390 | 1395 | } | |
| 1391 | 1396 | ||
| 1392 | - Maybe<bool> JSTransferable::FinalizeTransferRead( | ||
| 1397 | + Maybe<void> JSTransferable::FinalizeTransferRead( | ||
| 1393 | 1398 | Local<Context> context, ValueDeserializer* deserializer) { | |
| 1394 | 1399 | // Call `this[kDeserialize](data)` where `data` comes from the return value | |
| 1395 | 1400 | // of `this[kTransfer]()` or `this[kClone]()`. | |
| 1396 | 1401 | HandleScope handle_scope(env()->isolate()); | |
| 1397 | 1402 | Local<Value> data; | |
| 1398 | - if (!deserializer->ReadValue(context).ToLocal(&data)) return Nothing<bool>(); | ||
| 1403 | + if (!deserializer->ReadValue(context).ToLocal(&data)) return Nothing<void>(); | ||
| 1399 | 1404 | ||
| 1400 | 1405 | Local<Symbol> method_name = env()->messaging_deserialize_symbol(); | |
| 1401 | 1406 | Local<Value> method; | |
| 1402 | 1407 | if (!target()->Get(context, method_name).ToLocal(&method)) { | |
| 1403 | - return Nothing<bool>(); | ||
| 1408 | + return Nothing<void>(); | ||
| 1404 | 1409 | } | |
| 1405 | - if (!method->IsFunction()) return Just(true); | ||
| 1410 | + if (!method->IsFunction()) return JustVoid(); | ||
| 1406 | 1411 | ||
| 1407 | 1412 | if (method.As<Function>()->Call(context, target(), 1, &data).IsEmpty()) { | |
| 1408 | - return Nothing<bool>(); | ||
| 1413 | + return Nothing<void>(); | ||
| 1409 | 1414 | } | |
| 1410 | - return Just(true); | ||
| 1415 | + return JustVoid(); | ||
| 1411 | 1416 | } | |
| 1412 | 1417 | ||
| 1413 | 1418 | JSTransferable::Data::Data(std::string&& deserialize_info, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -340,7 +340,7 @@ class JSTransferable : public BaseObject { | |||
| 340 | 340 | std::unique_ptr<TransferData> CloneForMessaging() const override; | |
| 341 | 341 | v8::Maybe<std::vector<BaseObjectPtr<BaseObject>>> | |
| 342 | 342 | NestedTransferables() const override; | |
| 343 | - v8::Maybe<bool> FinalizeTransferRead( | ||
| 343 | + v8::Maybe<void> FinalizeTransferRead( | ||
| 344 | 344 | v8::Local<v8::Context> context, | |
| 345 | 345 | v8::ValueDeserializer* deserializer) override; | |
| 346 | 346 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments