[M130][WRTjs] Fix wgtapi01, widgte01 webTCT failures 13/319613/5
authorsidpaswan <s.paswan@samsung.com>
Thu, 13 Feb 2025 11:57:55 +0000 (17:27 +0530)
committerBot Blink <blinkbot@samsung.com>
Tue, 18 Feb 2025 14:02:48 +0000 (14:02 +0000)
- For window object property name is accessed from the FunctionCallbackInfo 'Array' and
the corresponding object for the property name is obtained and set.

- The return value of getter and setter for NamedPropertyHandlerConfiguration is set accordingly
when WRT interceptor handles the request(kYes) vs when it should be looked beyond the interceptor(kNo)

Change-Id: Ie00826cdf9368d5479eb7c400a580ebd3d8acc00
Signed-off-by: sidpaswan <s.paswan@samsung.com>
tizen_src/chromium_impl/components/xwalk_extensions/renderer/native_module/widget_module.cc
tizen_src/chromium_impl/components/xwalk_extensions/renderer/xwalk_extension_trampoline.cc

index 168be5719dfc4aa9913b55cdf03f0f7a9599d4e9..d1bc29068cbf9c996f95125e3991396eaefc3dcc 100644 (file)
@@ -325,10 +325,10 @@ WidgetModule::WidgetModule() {
 
     if (std::find(kExcludeList.begin(), kExcludeList.end(), key)
         != kExcludeList.end())
-      return v8::Intercepted::kYes;;
+      return v8::Intercepted::kNo;;
 
     if (!WidgetPreferenceDB::HasItem(key))
-      return v8::Intercepted::kYes;
+      return v8::Intercepted::kNo;
 
     std::string value;
     if (WidgetPreferenceDB::GetItem(key, &value)) {
@@ -337,7 +337,7 @@ WidgetModule::WidgetModule() {
       return v8::Intercepted::kYes;
     } else {
       info.GetReturnValue().SetNull();
-      return v8::Intercepted::kNo;
+      return v8::Intercepted::kYes;
     }
   };
 
@@ -349,7 +349,7 @@ WidgetModule::WidgetModule() {
 
     if (std::find(kExcludeList.begin(), kExcludeList.end(), key)
         != kExcludeList.end())
-      return v8::Intercepted::kYes;
+      return v8::Intercepted::kNo;
 
     v8::Local<v8::Value> oldvalue = v8::Null(isolate);
     std::string oldvaluestr;
@@ -388,7 +388,7 @@ WidgetModule::WidgetModule() {
       return v8::Intercepted::kYes;
     } else {
       info.GetReturnValue().Set(false);
-      return v8::Intercepted::kNo;
+      return v8::Intercepted::kYes;
     }
   };
 
index c58cc110655dbe8c84f2629d147334123de6294b..9301d76b5f4323b3e4ca3a7b4de8354b9f964fd0 100644 (file)
@@ -86,12 +86,17 @@ v8::Local<v8::Object> LoadExtension(
 void AccessorGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
   v8::Isolate* isolate = info.GetIsolate();
   auto holder = LoadExtension(isolate, info.Data());
-  if (holder.IsEmpty())
+  if (holder.IsEmpty() || !info.Data()->IsArray())
     return;
 
   v8::Local<v8::Context> context = isolate->GetCurrentContext();
+
+  v8::Local<v8::Array> data = info.Data().As<v8::Array>();
+  v8::Local<v8::Value> property =
+      data->Get(context, 1).FromMaybe(v8::Local<v8::Value>());
   v8::Local<v8::Value> value =
-      holder.As<v8::Object>()->Get(context, info[1])
+      holder.As<v8::Object>()
+          ->Get(context, property)
           .FromMaybe(v8::Local<v8::Value>::Cast(v8::Undefined(isolate)));
   info.GetReturnValue().Set(value);
 }
@@ -99,15 +104,21 @@ void AccessorGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
 void AccessorSetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
   v8::Isolate* isolate = info.GetIsolate();
   auto holder = LoadExtension(isolate, info.Data());
-  if (holder.IsEmpty())
+  if (holder.IsEmpty() || !info.Data()->IsArray())
     return;
 
   v8::Local<v8::Context> context = isolate->GetCurrentContext();
+
+  v8::Local<v8::Array> data = info.Data().As<v8::Array>();
+  v8::Local<v8::Value> property =
+      data->Get(context, 1).FromMaybe(v8::Local<v8::Value>());
+  v8::Local<v8::Value> value =
+      data->Get(context, 0).FromMaybe(v8::Local<v8::Value>());
   if (!holder.As<v8::Object>()
-           ->Set(context, info[1], info[0])
+           ->Set(context, property, value)
            .FromMaybe(false)) {
     LOG(ERROR) << "Fail to set property : "
-               << *v8::String::Utf8Value(isolate, info[1]);
+               << *v8::String::Utf8Value(isolate, property);
   }
 }