From 615612e04c5427329db211028a158535a9e4db4a Mon Sep 17 00:00:00 2001 From: agape1225 <49804691+agape1225@users.noreply.github.com> Date: Sat, 1 Aug 2026 21:56:06 +0900 Subject: [PATCH] permission: reuse cached env strings Permission::is_scope_granted() and Permission::Drop() built the "permission" and "resource" diagnostics message keys with FIXED_ONE_BYTE_STRING(isolate, ...) on every publish, even though Environment already caches these exact strings via env->permission_string() and env->resource_string() (src/env_properties.h). One call site in the same file already used the cached accessor; these two did not, and Environment is already in scope at both sites. Assisted-by: Claude Sonnet 5 Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com> --- src/permission/permission.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/permission/permission.cc b/src/permission/permission.cc index c593502d94eb..6c85cc5af36c 100644 --- a/src/permission/permission.cc +++ b/src/permission/permission.cc @@ -257,11 +257,11 @@ bool Permission::is_scope_granted(Environment* env, v8::Object::New(isolate, v8::Null(isolate), nullptr, nullptr, 0); const char* perm_str = PermissionToString(permission); msg->Set(context, - FIXED_ONE_BYTE_STRING(isolate, "permission"), + env->permission_string(), v8::String::NewFromUtf8(isolate, perm_str).ToLocalChecked()) .Check(); msg->Set(context, - FIXED_ONE_BYTE_STRING(isolate, "resource"), + env->resource_string(), v8::String::NewFromUtf8(isolate, res.data(), v8::NewStringType::kNormal, @@ -327,11 +327,11 @@ void Permission::Drop(Environment* env, v8::Object::New(isolate, v8::Null(isolate), nullptr, nullptr, 0); const char* perm_str = PermissionToString(scope); msg->Set(context, - FIXED_ONE_BYTE_STRING(isolate, "permission"), + env->permission_string(), v8::String::NewFromUtf8(isolate, perm_str).ToLocalChecked()) .Check(); msg->Set(context, - FIXED_ONE_BYTE_STRING(isolate, "resource"), + env->resource_string(), v8::String::NewFromUtf8(isolate, param.data(), v8::NewStringType::kNormal,