9b7f802df983cfa9ed25c878b3aa96f12d38eb2d
[framework/web/wrt-plugins-tizen.git] / src / Tizen / JSAbstractFilterArray.cpp
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        JSAbstractFilterArray.cpp
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief
23  */
24
25 #include <algorithm>
26 #include <dpl/log/log.h>
27 #include <CommonsJavaScript/ScopedJSStringRef.h>
28 #include <JSTizenExceptionFactory.h>
29 #include <JSTizenException.h>
30 #include "FilterConverter.h"
31 #include "JSAbstractFilterArray.h"
32
33 #define FUNCTION_CONCAT "concat"
34 #define FUNCTION_JOIN "join"
35 #define FUNCTION_POP "pop"
36 #define FUNCTION_PUSH "push"
37 #define FUNCTION_REVERSE "reverse"
38 #define FUNCTION_SHIFT "shift"
39 #define FUNCTION_SLICE "slice"
40 #define FUNCTION_SORT "sort"
41 #define FUNCTION_SPLICE "splice"
42 #define FUNCTION_TOSTRING "toString"
43 #define FUNCTION_UNSHIFT "unshift"
44 #define FUNCTION_VALUEOF "valueOf"
45 #define ARRAY "Array"
46 #define ATTRIBUTE_LENGTH "length"
47 #define FUNCTION_CONSTRUCTOR "constructor"
48
49 namespace DeviceAPI {\rnamespace Tizen {
50
51 using namespace DeviceAPI::Common;
52 using namespace DeviceAPI::Tizen;
53 using namespace WrtDeviceApis::CommonsJavaScript;
54
55 JSClassDefinition JSAbstractFilterArray::m_classInfo = {
56         0,
57         kJSClassAttributeNone,
58         ARRAY,
59         0,
60         m_property,
61         m_function,
62         initialize,
63         finalize,
64         hasProperty,
65         getProperty,
66         setProperty,
67         NULL, //deleteProperty,
68         getPropertyNames,
69         NULL, //callAsFunction,
70         NULL, //callAsConstructor,
71         NULL, //hasInstance,
72         NULL, //convertToType,
73 };
74
75 JSStaticValue JSAbstractFilterArray::m_property[] = {
76         { ATTRIBUTE_LENGTH, getLength, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
77         { 0, 0, 0, 0 }
78 };
79
80 JSStaticFunction JSAbstractFilterArray::m_function[] = {
81         { FUNCTION_CONCAT, concat, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
82         { FUNCTION_JOIN, join, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
83         { FUNCTION_POP, pop, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
84         { FUNCTION_PUSH, push, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
85         { FUNCTION_REVERSE, reverse, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
86         { FUNCTION_SHIFT, shift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
87         { FUNCTION_SLICE, slice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
88         { FUNCTION_SORT, sort, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
89         { FUNCTION_SPLICE, splice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
90         { FUNCTION_TOSTRING, toString, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
91         { FUNCTION_UNSHIFT, unshift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
92         { FUNCTION_VALUEOF, valueOf, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
93         { FUNCTION_CONSTRUCTOR, constructor, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
94         { 0, 0, 0 }
95 };
96
97 JSClassRef JSAbstractFilterArray::m_jsClassRef = JSClassCreate(
98                 JSAbstractFilterArray::getClassInfo());
99
100 JSValueRef JSAbstractFilterArray::getLength(JSContextRef context,
101                 JSObjectRef object,
102                 JSStringRef propertyName,
103                 JSValueRef* exception)
104 {
105         //LogDebug("enter");
106         Try
107         {
108                 JSAbstractFilterArrayPriv* priv =
109                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
110                 if (!priv) {
111                         Throw(WrtDeviceApis::Commons::NullPointerException);
112                 }
113                 FilterArrayPtr filters = priv->getObject();
114                 if (filters) {
115                         FilterConverterFactory::ConverterType converter =
116                                         FilterConverterFactory::getConverter(context);
117                         return converter->toJSValueRef(filters->size());
118                 }
119         }
120         Catch(WrtDeviceApis::Commons::Exception)
121         {
122                 LogError("invalid conversion");
123         }
124         return JSValueMakeUndefined(context);
125 }
126
127 bool JSAbstractFilterArray::isObjectOfClass(JSContextRef context, JSValueRef value)
128 {
129         return JSValueIsObjectOfClass(context, value, getClassRef());
130 }
131
132 FilterArrayPtr JSAbstractFilterArray::getAbstractFilterArray(JSContextRef context, JSValueRef value)
133 {
134         if (!isObjectOfClass(context, value)) {
135                 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
136         }
137         JSObjectRef object = JSValueToObject(context, value, NULL);
138         if (!object) {
139                 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
140         }
141         JSAbstractFilterArrayPriv *priv = static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
142         if (!priv) {
143                 Throw(WrtDeviceApis::Commons::NullPointerException);
144         }
145         return priv->getObject();
146 }
147
148 JSObjectRef JSAbstractFilterArray::createArray(JSContextRef context,
149                 const FilterArrayPtr &filters)
150 {
151         JSAbstractFilterArrayPriv *priv = new JSAbstractFilterArrayPriv(context, filters);
152         return JSObjectMake(context, getClassRef(), priv);
153 }
154
155 const JSClassDefinition* JSAbstractFilterArray::getClassInfo()
156 {
157         return &(m_classInfo);
158 }
159
160 JSClassRef JSAbstractFilterArray::getClassRef()
161 {
162         if (!m_jsClassRef) {
163                 m_jsClassRef = JSClassCreate(&m_classInfo);
164         }
165         return m_jsClassRef;
166 }
167
168 void JSAbstractFilterArray::initialize(JSContextRef context,
169                 JSObjectRef object)
170 {
171         //LogDebug("enter");
172 }
173
174 void JSAbstractFilterArray::finalize(JSObjectRef object)
175 {
176         //LogDebug("enter");
177         JSAbstractFilterArrayPriv* priv =
178                 static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
179         delete priv;
180         JSObjectSetPrivate(object, NULL);
181 }
182
183 bool JSAbstractFilterArray::hasProperty(JSContextRef context,
184                 JSObjectRef object,
185                 JSStringRef propertyName)
186 {
187         //LogDebug("enter");
188         FilterConverterFactory::ConverterType converter =
189                         FilterConverterFactory::getConverter(context);
190         Try
191         {
192                 size_t index = converter->toSizeT(propertyName);
193                 JSAbstractFilterArrayPriv* priv =
194                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
195                 if (!priv) {
196                         Throw(WrtDeviceApis::Commons::NullPointerException);
197                 }
198                 FilterArrayPtr filters = priv->getObject();
199                 if (index < filters->size()) {
200                         return true;
201                 }
202         }
203         Catch(WrtDeviceApis::Commons::Exception)
204         {
205                 //not reporting error is intended
206         }
207         return false;
208 }
209
210 JSValueRef JSAbstractFilterArray::getProperty(JSContextRef context,
211                 JSObjectRef object,
212                 JSStringRef propertyName,
213                 JSValueRef* exception)
214 {
215         //LogDebug("enter");
216         FilterConverterFactory::ConverterType converter =
217                         FilterConverterFactory::getConverter(context);
218         Try
219         {
220                 size_t index = converter->toSizeT(propertyName);
221                 JSAbstractFilterArrayPriv* priv =
222                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
223                 if (!priv) {
224                         Throw(WrtDeviceApis::Commons::NullPointerException);
225                 }
226                 FilterArrayPtr filters = priv->getObject();
227                 if (index < filters->size()) {
228                         FilterPtr result = filters->at(index);
229                         if (result) {
230                                 return converter->toJSValueRef(result);
231                         }
232                 }
233         }
234         Catch(WrtDeviceApis::Commons::Exception)
235         {
236                 LogError("invalid property");
237         }
238         return JSValueMakeUndefined(context);
239 }
240
241 bool JSAbstractFilterArray::setProperty(JSContextRef context,
242                 JSObjectRef object,
243                 JSStringRef propertyName,
244                 JSValueRef value,
245                 JSValueRef* exception)
246 {
247         //LogDebug("enter");
248         FilterConverterFactory::ConverterType converter =
249                         FilterConverterFactory::getConverter(context);
250         Try
251         {
252                 size_t index = converter->toSizeT(propertyName);
253                 FilterPtr filter;
254                 if (!JSValueIsUndefined(context, value)) {
255                         filter = converter->toFilter(value);
256                 }
257                 JSAbstractFilterArrayPriv* priv =
258                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
259                 if (!priv) {
260                         Throw(WrtDeviceApis::Commons::NullPointerException);
261                 }
262                 FilterArrayPtr filters = priv->getObject();
263                 if (!filters) {
264                         Throw(WrtDeviceApis::Commons::NullPointerException);
265                 }
266                 if (filters->size() <= index) {
267                         filters->resize(index + 1);
268                 }
269                 (*filters)[index] = filter;
270                 return true;
271         }
272         Catch(WrtDeviceApis::Commons::Exception)
273         {
274                 LogError("error occured");
275                 JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
276         }
277         return false;
278 }
279
280 void JSAbstractFilterArray::getPropertyNames(JSContextRef context,
281                 JSObjectRef object,
282                 JSPropertyNameAccumulatorRef propertyNames)
283 {
284         FilterConverterFactory::ConverterType converter =
285                         FilterConverterFactory::getConverter(context);
286         Try
287         {
288                 JSAbstractFilterArrayPriv* priv =
289                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(object));
290                 if (!priv) {
291                         Throw(WrtDeviceApis::Commons::NullPointerException);
292                 }
293                 FilterArrayPtr filters = priv->getObject();
294
295                 int count = filters->size();
296
297                 for(int i=0; i < count; i++)
298                 {
299                         ScopedJSStringRef name(converter->toJSStringRef(converter->toString(i)));
300                         JSPropertyNameAccumulatorAddName(propertyNames, name.get());
301                 }
302         }
303         Catch(WrtDeviceApis::Commons::Exception)
304         {
305                 LogError("invalid property");
306         }
307 }
308
309 JSValueRef JSAbstractFilterArray::concat(JSContextRef context,
310                 JSObjectRef function,
311                 JSObjectRef thisObject,
312                 size_t argumentCount,
313                 const JSValueRef arguments[],
314                 JSValueRef* exception)
315 {
316         //LogDebug("enter");
317         Try
318         {
319                 FilterArrayPtr filters = FilterArrayPtr(new FilterArray());
320                 JSAbstractFilterArrayPriv *newPrivateObject = new JSAbstractFilterArrayPriv(context, filters);
321                 JSValueRef result = JSObjectMake(context, getClassRef(), newPrivateObject);
322
323                 //copy current filters
324                 JSAbstractFilterArrayPriv* priv =
325                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
326                 FilterArrayPtr currentWebSites = priv->getObject();
327                 for (size_t i = 0; i < currentWebSites->size(); ++i) {
328                         filters->push_back(currentWebSites->at(i));
329                 }
330
331                 //copy submitted arrays
332                 FilterConverterFactory::ConverterType converter =
333                                 FilterConverterFactory::getConverter(context);
334                 for (size_t i = 0; i < argumentCount; ++i) {
335                         if (!JSIsArrayValue(context, arguments[i])) {
336                                 Throw(WrtDeviceApis::Commons::ConversionException);
337                         }
338                         // process array of strings
339                         JSObjectRef arrayObj = converter->toJSObjectRef(arguments[i]);
340                         unsigned int len = JSGetArrayLength(context, arrayObj);
341                         for (unsigned int e = 0; e < len; ++e) {
342                                 JSValueRef att = JSGetArrayElement(context, arrayObj, e);
343                                 filters->push_back(converter->toFilter(att));
344                         }
345                 }
346                 return result;
347         }
348         Catch(WrtDeviceApis::Commons::Exception)
349         {
350                 LogError("error occured");
351         }
352         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
353 }
354
355 JSValueRef JSAbstractFilterArray::join(JSContextRef context,
356                 JSObjectRef function,
357                 JSObjectRef thisObject,
358                 size_t argumentCount,
359                 const JSValueRef arguments[],
360                 JSValueRef* exception)
361 {
362         //LogDebug("entered");
363         Try
364         {
365                 std::string result;
366                 std::string separator(",");
367                 FilterConverterFactory::ConverterType converter =
368                                 FilterConverterFactory::getConverter(context);
369                 JSAbstractFilterArrayPriv* priv =
370                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
371                 FilterArrayPtr currentWebSites = priv->getObject();
372                 if (argumentCount > 0 && JSValueIsString(context, arguments[0])) {
373                         separator = converter->toString(arguments[0]);
374                 }
375                 for (size_t i = 0; i < currentWebSites->size(); ++i) {
376                         if (i != 0) {
377                                 result += separator;
378                         }
379                         //FIXME : to be changed to support join
380                         //result += currentWebSites->at(i);
381                 }
382                 return converter->toJSValueRef(result);
383         }
384         Catch(WrtDeviceApis::Commons::Exception)
385         {
386                 LogError("error occured");
387         }
388         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
389 }
390
391 JSValueRef JSAbstractFilterArray::pop(JSContextRef context,
392                 JSObjectRef function,
393                 JSObjectRef thisObject,
394                 size_t argumentCount,
395                 const JSValueRef arguments[],
396                 JSValueRef* exception)
397 {
398         //LogDebug("entered");
399         Try
400         {
401                 FilterConverterFactory::ConverterType converter =
402                                 FilterConverterFactory::getConverter(context);
403                 JSAbstractFilterArrayPriv* priv =
404                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
405                 FilterArrayPtr currentWebSites = priv->getObject();
406                 if (currentWebSites->size() > 0) {
407                         FilterPtr result = currentWebSites->at(
408                                         currentWebSites->size() - 1);
409                         currentWebSites->pop_back();
410                         return converter->toJSValueRef(result);
411                 }
412         }
413         Catch(WrtDeviceApis::Commons::Exception)
414         {
415                 LogError("error occured");
416         }
417         return JSValueMakeUndefined(context);
418 }
419
420 JSValueRef JSAbstractFilterArray::push(JSContextRef context,
421                 JSObjectRef function,
422                 JSObjectRef thisObject,
423                 size_t argumentCount,
424                 const JSValueRef arguments[],
425                 JSValueRef* exception)
426 {
427         //LogDebug("entered");
428         Try
429         {
430                 FilterConverterFactory::ConverterType converter =
431                                 FilterConverterFactory::getConverter(context);
432                 JSAbstractFilterArrayPriv* priv =
433                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
434                 FilterArrayPtr currentWebSites = priv->getObject();
435                 for (size_t i = 0; i < argumentCount; ++i) {
436                         currentWebSites->push_back(converter->toFilter(arguments[i]));
437                 }
438                 return converter->toJSValueRef(currentWebSites->size());
439         }
440         Catch(WrtDeviceApis::Commons::Exception)
441         {
442                 LogError("error occured");
443         }
444         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
445 }
446
447 JSValueRef JSAbstractFilterArray::reverse(JSContextRef context,
448                 JSObjectRef function,
449                 JSObjectRef thisObject,
450                 size_t argumentCount,
451                 const JSValueRef arguments[],
452                 JSValueRef* exception)
453 {
454         //LogDebug("entered");
455         Try
456         {
457                 FilterConverterFactory::ConverterType converter =
458                                 FilterConverterFactory::getConverter(context);
459                 JSAbstractFilterArrayPriv* priv =
460                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
461                 FilterArrayPtr currentWebSites = priv->getObject();
462                 std::reverse(currentWebSites->begin(), currentWebSites->end());
463                 return thisObject;
464         }
465         Catch(WrtDeviceApis::Commons::Exception)
466         {
467                 LogError("error occured");
468         }
469         return JSValueMakeUndefined(context);
470 }
471
472 JSValueRef JSAbstractFilterArray::shift(JSContextRef context,
473                 JSObjectRef function,
474                 JSObjectRef thisObject,
475                 size_t argumentCount,
476                 const JSValueRef arguments[],
477                 JSValueRef* exception)
478 {
479         //LogDebug("entered");
480         Try
481         {
482                 FilterConverterFactory::ConverterType converter =
483                                 FilterConverterFactory::getConverter(context);
484                 JSAbstractFilterArrayPriv* priv =
485                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
486                 FilterArrayPtr currentWebSites = priv->getObject();
487                 if (currentWebSites->size() > 0) {
488                         FilterPtr result = currentWebSites->at(0);
489                         currentWebSites->erase(currentWebSites->begin());
490                         return converter->toJSValueRef(result);
491                 }
492         }
493         Catch(WrtDeviceApis::Commons::Exception)
494         {
495                 LogError("error occured");
496         }
497         return JSValueMakeUndefined(context);
498 }
499
500 JSValueRef JSAbstractFilterArray::slice(JSContextRef context,
501                 JSObjectRef function,
502                 JSObjectRef thisObject,
503                 size_t argumentCount,
504                 const JSValueRef arguments[],
505                 JSValueRef* exception)
506 {
507         //LogDebug("enter");
508         Try
509         {
510                 if (argumentCount < 1) {
511                         return JSValueMakeUndefined(context);
512                 }
513                 FilterConverterFactory::ConverterType converter =
514                                 FilterConverterFactory::getConverter(context);
515                 FilterArrayPtr filters = FilterArrayPtr(new FilterArray());
516                 JSAbstractFilterArrayPriv *newPrivateObject = new JSAbstractFilterArrayPriv(
517                                 context,
518                                 filters);
519                 JSValueRef result = JSObjectMake(context,
520                                                                                  getClassRef(), newPrivateObject);
521
522                 //copy current filters
523                 JSAbstractFilterArrayPriv* priv =
524                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
525                 FilterArrayPtr currentWebSites = priv->getObject();
526                 std::size_t first = converter->toSizeT(arguments[0]);
527                 std::size_t last = currentWebSites->size() - 1;
528                 if (argumentCount > 1) {
529                         last = converter->toSizeT(arguments[1]);
530                         if (last >= currentWebSites->size()) {
531                                 last = currentWebSites->size() - 1;
532                         }
533                 }
534                 for (size_t i = first; i <= last; ++i) {
535                         filters->push_back(currentWebSites->at(i));
536                 }
537
538                 return result;
539         }
540         Catch(WrtDeviceApis::Commons::Exception)
541         {
542                 LogError("error occured");
543         }
544         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
545 }
546
547 JSValueRef JSAbstractFilterArray::sort(JSContextRef context,
548                 JSObjectRef function,
549                 JSObjectRef thisObject,
550                 size_t argumentCount,
551                 const JSValueRef arguments[],
552                 JSValueRef* exception)
553 {
554         //LogDebug("entered");
555         Try
556         {
557                 FilterConverterFactory::ConverterType converter =
558                                 FilterConverterFactory::getConverter(context);
559                 JSAbstractFilterArrayPriv* priv =
560                         static_cast<JSAbstractFilterArrayPriv*>(JSObjectGetPrivate(thisObject));
561                 FilterArrayPtr currentWebSites = priv->getObject();
562                 std::sort(currentWebSites->begin(), currentWebSites->end());
563                 return thisObject;
564         }
565         Catch(WrtDeviceApis::Commons::Exception)
566         {
567                 LogError("error occured");
568         }
569         return JSValueMakeUndefined(context);
570 }
571
572 JSValueRef JSAbstractFilterArray::splice(JSContextRef context,
573                 JSObjectRef function,
574                 JSObjectRef thisObject,
575                 size_t argumentCount,
576                 const JSValueRef arguments[],
577                 JSValueRef* exception)
578 {
579         //LogDebug("entered");
580         return JSValueMakeUndefined(context);
581 }
582
583 JSValueRef JSAbstractFilterArray::toString(JSContextRef context,
584                 JSObjectRef function,
585                 JSObjectRef thisObject,
586                 size_t argumentCount,
587                 const JSValueRef arguments[],
588                 JSValueRef* exception)
589 {
590         //LogDebug("entered");
591         return join(context, function, thisObject, 0, arguments, exception);
592 }
593
594 JSValueRef JSAbstractFilterArray::unshift(JSContextRef context,
595                 JSObjectRef function,
596                 JSObjectRef thisObject,
597                 size_t argumentCount,
598                 const JSValueRef arguments[],
599                 JSValueRef* exception)
600 {
601         //LogDebug("entered");
602         return JSValueMakeUndefined(context);
603 }
604
605 JSValueRef JSAbstractFilterArray::valueOf(JSContextRef context,
606                 JSObjectRef function,
607                 JSObjectRef thisObject,
608                 size_t argumentCount,
609                 const JSValueRef arguments[],
610                 JSValueRef* exception)
611 {
612         //LogDebug("entered");
613         return JSValueMakeUndefined(context);
614 }
615
616 JSValueRef JSAbstractFilterArray::constructor(JSContextRef context,
617                 JSObjectRef function,
618                 JSObjectRef thisObject,
619                 size_t argumentCount,
620                 const JSValueRef arguments[],
621                 JSValueRef* exception)
622 {
623         // To determine this object as array
624         WrtDeviceApis::CommonsJavaScript::ScopedJSStringRef json(JSStringCreateWithUTF8CString("[]"));
625         JSValueRef array = JSValueMakeFromJSONString(context, json.get());
626         WrtDeviceApis::CommonsJavaScript::ScopedJSStringRef constructorStr(JSStringCreateWithUTF8CString("constructor"));
627         JSObjectRef arrayObject = JSValueToObject(context, array, NULL);
628         JSValueRef constructorValue = JSObjectGetProperty(context, arrayObject, constructorStr.get(), NULL);
629         return constructorValue;
630 }
631
632 } // Tizen
633 } // DeviceAPI
634