| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 27ada1f commit 3b6895a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1511,24 +1511,22 @@ void ContextifyContext::CompileFunction( | |||
| 1511 | 1511 | } | |
| 1512 | 1512 | ||
| 1513 | 1513 | TryCatchScope try_catch(env); | |
| 1514 | - Local<Object> result = CompileFunctionAndCacheResult(env, | ||
| 1515 | - parsing_context, | ||
| 1516 | - &source, | ||
| 1517 | - params, | ||
| 1518 | - context_extensions, | ||
| 1519 | - options, | ||
| 1520 | - produce_cached_data, | ||
| 1521 | - id_symbol, | ||
| 1522 | - try_catch); | ||
| 1523 | - | ||
| 1524 | - if (try_catch.HasCaught() && !try_catch.HasTerminated()) { | ||
| 1514 | + MaybeLocal<Object> maybe_result = | ||
| 1515 | + CompileFunctionAndCacheResult(env, | ||
| 1516 | + parsing_context, | ||
| 1517 | + &source, | ||
| 1518 | + params, | ||
| 1519 | + context_extensions, | ||
| 1520 | + options, | ||
| 1521 | + produce_cached_data, | ||
| 1522 | + id_symbol, | ||
| 1523 | + try_catch); | ||
| 1524 | + Local<Object> result; | ||
| 1525 | + if (!maybe_result.ToLocal(&result)) { | ||
| 1526 | + CHECK(try_catch.HasCaught()); | ||
| 1525 | 1527 | try_catch.ReThrow(); | |
| 1526 | 1528 | return; | |
| 1527 | 1529 | } | |
| 1528 | - | ||
| 1529 | - if (result.IsEmpty()) { | ||
| 1530 | - return; | ||
| 1531 | - } | ||
| 1532 | 1530 | args.GetReturnValue().Set(result); | |
| 1533 | 1531 | } | |
| 1534 | 1532 | ||
@@ -1544,7 +1542,7 @@ static LocalVector<String> GetCJSParameters(IsolateData* data) { | |||
| 1544 | 1542 | return result; | |
| 1545 | 1543 | } | |
| 1546 | 1544 | ||
| 1547 | - Local<Object> ContextifyContext::CompileFunctionAndCacheResult( | ||
| 1545 | + MaybeLocal<Object> ContextifyContext::CompileFunctionAndCacheResult( | ||
| 1548 | 1546 | Environment* env, | |
| 1549 | 1547 | Local<Context> parsing_context, | |
| 1550 | 1548 | ScriptCompiler::Source* source, | |
@@ -1566,28 +1564,29 @@ Local<Object> ContextifyContext::CompileFunctionAndCacheResult( | |||
| 1566 | 1564 | ||
| 1567 | 1565 | Local<Function> fn; | |
| 1568 | 1566 | if (!maybe_fn.ToLocal(&fn)) { | |
| 1569 | - if (try_catch.HasCaught() && !try_catch.HasTerminated()) { | ||
| 1567 | + CHECK(try_catch.HasCaught()); | ||
| 1568 | + if (!try_catch.HasTerminated()) { | ||
| 1570 | 1569 | errors::DecorateErrorStack(env, try_catch); | |
| 1571 | - return Object::New(env->isolate()); | ||
| 1572 | 1570 | } | |
| 1571 | + return {}; | ||
| 1573 | 1572 | } | |
| 1574 | 1573 | ||
| 1575 | 1574 | Local<Context> context = env->context(); | |
| 1576 | 1575 | if (fn->SetPrivate(context, env->host_defined_option_symbol(), id_symbol) | |
| 1577 | 1576 | .IsNothing()) { | |
| 1578 | - return Object::New(env->isolate()); | ||
| 1577 | + return {}; | ||
| 1579 | 1578 | } | |
| 1580 | 1579 | ||
| 1581 | 1580 | Isolate* isolate = env->isolate(); | |
| 1582 | 1581 | Local<Object> result = Object::New(isolate); | |
| 1583 | 1582 | if (result->Set(parsing_context, env->function_string(), fn).IsNothing()) | |
| 1584 | - return Object::New(env->isolate()); | ||
| 1583 | + return {}; | ||
| 1585 | 1584 | if (result | |
| 1586 | 1585 | ->Set(parsing_context, | |
| 1587 | 1586 | env->source_map_url_string(), | |
| 1588 | 1587 | fn->GetScriptOrigin().SourceMapUrl()) | |
| 1589 | 1588 | .IsNothing()) | |
| 1590 | - return Object::New(env->isolate()); | ||
| 1589 | + return {}; | ||
| 1591 | 1590 | ||
| 1592 | 1591 | std::unique_ptr<ScriptCompiler::CachedData> new_cached_data; | |
| 1593 | 1592 | if (produce_cached_data) { | |
@@ -1600,7 +1599,7 @@ Local<Object> ContextifyContext::CompileFunctionAndCacheResult( | |||
| 1600 | 1599 | produce_cached_data, | |
| 1601 | 1600 | std::move(new_cached_data)) | |
| 1602 | 1601 | .IsNothing()) { | |
| 1603 | - return Object::New(env->isolate()); | ||
| 1602 | + return {}; | ||
| 1604 | 1603 | } | |
| 1605 | 1604 | ||
| 1606 | 1605 | return result; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -146,7 +146,7 @@ class ContextifyContext final : CPPGC_MIXIN(ContextifyContext) { | |||
| 146 | 146 | static void IsContext(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 147 | 147 | static void CompileFunction( | |
| 148 | 148 | const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 149 | - static v8::Local<v8::Object> CompileFunctionAndCacheResult( | ||
| 149 | + static v8::MaybeLocal<v8::Object> CompileFunctionAndCacheResult( | ||
| 150 | 150 | Environment* env, | |
| 151 | 151 | v8::Local<v8::Context> parsing_context, | |
| 152 | 152 | v8::ScriptCompiler::Source* source, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments