2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <CommonsJavaScript/Validator.h>
20 #include <CommonsJavaScript/JSUtils.h>
21 #include <CommonsJavaScript/JSCallbackManager.h>
22 #include <CommonsJavaScript/Utils.h>
23 #include <FilterConverter.h>
24 #include "EventFindCallHistory.h"
25 #include "EventRemoveBatch.h"
26 #include "EventRemoveAll.h"
27 #include "EventCallHistoryListener.h"
28 #include "CallHistoryFactory.h"
29 #include "ICallHistory.h"
30 #include <SecurityExceptions.h>
32 #include <JSWebAPIErrorFactory.h>
33 #include <ArgumentValidator.h>
34 #include <TimeTracer.h>
37 #include "JSCallHistoryEntry.h"
38 #include "JSCallHistory.h"
39 #include "CallHistoryStaticController.h"
40 #include "CallHistoryMultiCallback.h"
41 #include "ResponseDispatcher.h"
42 #include "Converter.h"
43 #include "plugin_config.h"
44 #include "CallHistoryAsyncCallbackManager.h"
45 #include "CallHistoryListenerManager.h"
46 #include "CallHistoryFilterConverter.h"
51 using namespace WrtDeviceApis::Commons;
52 using namespace WrtDeviceApis::CommonsJavaScript;
53 using namespace DeviceAPI::Tizen;
54 using namespace DeviceAPI::Common;
57 namespace CallHistory {
60 JSClassRef JSCallHistory::m_jsClassRef = NULL;
62 JSClassDefinition JSCallHistory::m_classInfo =
65 kJSClassAttributeNone,
83 JSStaticValue JSCallHistory::m_property[] = {
87 JSStaticFunction JSCallHistory::m_function[] =
89 { "find", JSCallHistory::find, kJSPropertyAttributeNone },
90 { "remove", JSCallHistory::remove, kJSPropertyAttributeNone },
91 { "removeBatch", JSCallHistory::removeBatch, kJSPropertyAttributeNone },
92 { "removeAll", JSCallHistory::removeAll, kJSPropertyAttributeNone },
93 { "addChangeListener", JSCallHistory::addChangeListener, kJSPropertyAttributeNone },
94 { "removeChangeListener", JSCallHistory::removeChangeListener, kJSPropertyAttributeNone },
98 const JSClassRef JSCallHistory::getClassRef() {
100 m_jsClassRef = JSClassCreate(&m_classInfo);
105 const JSClassDefinition* JSCallHistory::getClassInfo(){
109 void JSCallHistory::initialize(JSContextRef context, JSObjectRef object) {
110 JSCallHistoryPriv* priv = static_cast<JSCallHistoryPriv*>(JSObjectGetPrivate(object));
113 ICallHistoryPtr CallHistory(CallHistoryFactory::getInstance().getCallHistoryObject());
114 priv = new JSCallHistoryPriv(context, CallHistory);
115 if(!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
121 void JSCallHistory::finalize(JSObjectRef object) {
122 JSCallHistoryPriv* priv = static_cast<JSCallHistoryPriv*>(JSObjectGetPrivate(object));
124 JSObjectSetPrivate(object, NULL);
129 JSObjectRef JSCallHistory::createJSObject(JSContextRef context, JSObjectRef object)
131 ICallHistoryPtr CallHistory(CallHistoryFactory::getInstance().getCallHistoryObject());
132 JSCallHistoryPriv* priv = new JSCallHistoryPriv(context, CallHistory);
134 return JSObjectMake(context, getClassRef(), priv);
137 bool JSCallHistory::hasInstance(JSContextRef context, JSObjectRef constructor,
138 JSValueRef possibleInstance, JSValueRef* exception) {
139 return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
142 JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
143 const JSValueRef arguments[], JSValueRef* exception) {
144 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
145 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
146 CALL_HISTORY_FUNCTION_API_FIND);
148 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
150 if (argumentCount < 1) {
151 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
154 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
157 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
160 JSContextRef gContext = priv->getContext();
161 WrtDeviceApis::CommonsJavaScript::Converter converter(context);
162 Validator check(context, exception);
164 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
168 ArgumentValidator validator(context, argumentCount, arguments);
170 JSObjectRef successCB = validator.toFunction(0);
172 JSObjectRef errCB = validator.toFunction(1, true);
174 unsigned long limit = validator.toULong(4, true);
175 unsigned long offset = validator.toULong(5, true);
177 if(successCB != NULL)
178 cbm->setOnSuccess(successCB);
181 cbm->setOnError(errCB);
183 if (argumentCount >= 3) {
184 if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2])) {
185 if (!JSValueIsObject(context, arguments[2])) {
186 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : filter");
191 cbm->setObject(thisObject);
193 CallHistoryFilterConverterFactory::ConverterType filterConverter =
194 CallHistoryFilterConverterFactory::getConverter(context);
196 EventFindCallHistoryPtr event(new EventFindCallHistory());
197 ICallHistoryPtr callHistory(priv->getObject());
199 event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData> (cbm));
200 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
202 if (argumentCount >= 3) {
203 if(JSValueIsUndefined(context, arguments[2])) {
204 throw DeviceAPI::Common::TypeMismatchException("Filter is undefined");
207 if(!JSValueIsNull(context, arguments[2])){
208 FilterPtr filter = filterConverter->toFilter(arguments[2]);
211 throw DeviceAPI::Common::TypeMismatchException("Invalid Filter");
213 event ->setFilter(filter);
218 if (argumentCount >= 4) {
219 if(JSValueIsUndefined(context, arguments[3])) {
220 throw DeviceAPI::Common::TypeMismatchException("Sortmode is undefined");
223 if (!JSValueIsNull(context, arguments[3])) {
224 DeviceAPI::Tizen::SortModePtr sortMode = filterConverter->toSortMode(arguments[3]);
226 if(sortMode == NULL){
227 throw DeviceAPI::Common::TypeMismatchException("Invalid Sortmode");
229 event->setSortMode(filterConverter->toSortMode(arguments[3]));
234 event->setLimit(limit);
235 event->setOffset(offset);
237 callHistory->find(event);
238 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
239 } catch(const BasePlatformException& err){
240 return JSWebAPIErrorFactory::postException(context, exception, err);
241 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
242 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, ex.GetMessage());
243 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
244 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage()));
245 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
246 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
247 } catch(const WrtDeviceApis::Commons::Exception& ex) {
248 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
251 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
252 return JSValueMakeUndefined(context);
255 JSValueRef JSCallHistory::remove(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
256 const JSValueRef arguments[], JSValueRef* exception) {
258 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
259 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
260 CALL_HISTORY_FUNCTION_API_REMOVE);
262 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
265 ArgumentValidator validator(context, argumentCount, arguments);
267 JSObjectRef entryObj = validator.toObject(0);
269 if (argumentCount < 1) {
270 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
273 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
276 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
279 Converter converter(context);
281 if (!JSValueIsObjectOfClass(context, arguments[0], JSCallHistoryEntry::getClassRef())) {
282 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : CallHistoryEntry");
285 ICallHistoryPtr callHistory(priv->getObject());
286 if(entryObj != NULL){
287 CallHistoryEntryPropertiesPtr entry = converter.toCallHistoryEntryProperties(entryObj);
288 callHistory->remove(entry->getEntryId());
290 } catch(const BasePlatformException& err){
291 return JSWebAPIErrorFactory::postException(context, exception, err);
292 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
293 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, ex.GetMessage());
294 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
295 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
296 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
297 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage());
298 } catch(const WrtDeviceApis::Commons::Exception& ex) {
299 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage());
302 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
303 return JSValueMakeUndefined(context);
306 JSValueRef JSCallHistory::removeBatch(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
307 const JSValueRef arguments[], JSValueRef* exception) {
309 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
310 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
311 CALL_HISTORY_FUNCTION_API_REMOVE_BATCH);
313 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
315 if (argumentCount < 1) {
316 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
319 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
322 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
325 JSContextRef gContext = priv->getContext();
326 Converter converter(context);
328 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
331 ArgumentValidator validator(context, argumentCount, arguments);
333 JSObjectRef entryObj = validator.toObject(0);
334 JSObjectRef successCB = validator.toFunction(1, true);
335 JSObjectRef errCB = validator.toFunction(2, true);
337 if(successCB != NULL)
338 cbm->setOnSuccess(successCB);
341 cbm->setOnError(errCB);
343 cbm->setObject(thisObject);
345 EventRemoveBatchPtr event(new EventRemoveBatch());
346 ICallHistoryPtr callHistory(priv->getObject());
348 event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData> (cbm));
349 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
351 CallHistoryEntryList entryList;
353 entryList = converter.toVectorOfCallHistoryEntryProperties(entryObj);
355 std::vector<unsigned long> entryIds;
357 if (entryList.size() > 0) {
358 for (unsigned int i = 0; i < entryList.size(); i++) {
359 entryIds.push_back(entryList[i]->getEntryId());
361 event->setEntryIds(entryIds);
362 callHistory->removeBatch(event);
363 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
365 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid values error : Entry array is empty"));
367 } catch(const BasePlatformException& err){
368 return JSWebAPIErrorFactory::postException(context, exception, err);
369 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
370 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, ex.GetMessage());
371 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
372 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage()));
373 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
374 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
375 } catch(const WrtDeviceApis::Commons::Exception& ex) {
376 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
379 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
380 return JSValueMakeUndefined(context);
383 JSValueRef JSCallHistory::removeAll(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
384 const JSValueRef arguments[], JSValueRef* exception) {
386 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
387 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
388 CALL_HISTORY_FUNCTION_API_REMOVE_ALL);
390 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
392 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
395 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
398 JSContextRef gContext = priv->getContext();
399 Converter converter(context);
401 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
404 ArgumentValidator validator(context, argumentCount, arguments);
406 JSObjectRef successCB = validator.toFunction(0, true);
407 JSObjectRef errCB = validator.toFunction(1, true);
409 if(successCB != NULL)
410 cbm->setOnSuccess(successCB);
412 cbm->setOnError(errCB);
414 cbm->setObject(thisObject);
415 EventRemoveAllPtr event(new EventRemoveAll());
416 ICallHistoryPtr callHistory(priv->getObject());
418 event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData> (cbm));
419 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
420 callHistory->removeAll(event);
421 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
422 } catch(const BasePlatformException& err){
423 return JSWebAPIErrorFactory::postException(context, exception, err);
424 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
425 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, ex.GetMessage());
426 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
427 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage()));
428 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
429 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
430 } catch(const WrtDeviceApis::Commons::Exception& ex) {
431 cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
434 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
435 return JSValueMakeUndefined(context);
438 JSValueRef JSCallHistory::addChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
439 const JSValueRef arguments[], JSValueRef* exception) {
441 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
442 CALL_HISTORY_FUNCTION_API_ADDLISTENER);
444 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
447 ArgumentValidator validator(context, argumentCount, arguments);
449 JSObjectRef observerObj = validator.toCallbackObject(0, false,"onadded","onchanged","onremoved",NULL);
451 if (argumentCount < 1) {
452 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
455 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
458 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
461 JSContextRef gContext = priv->getContext();
462 Converter converter(context);
465 if (argumentCount >= 1) {
466 EventCallHistoryListenerPrivateDataPtr privData(converter.toEventCallHistoryListenerPrivateData(observerObj, gContext));
468 EventCallHistoryListenerEmitterPtr emitter(new EventCallHistoryListenerEmitter);
469 emitter->setListener(&CallHistoryStaticController::getInstance());
470 emitter->setEventPrivateData(DPL::StaticPointerCast<EventCallHistoryListener::PrivateDataType>(privData));
472 ICallHistoryPtr callHistory(priv->getObject());
473 id = callHistory->addListener(emitter);
475 CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, id));
476 DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
477 CallHistoryListenerManagerSingleton::Instance().registerListener(listenerItem, gContext);
479 return JSUtil::toJSValueRef(context, id);
481 } catch(const BasePlatformException& err){
482 return JSWebAPIErrorFactory::postException(context, exception, err);
483 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
484 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, ex.GetMessage());
485 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
486 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
487 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
488 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage());
489 } catch(const WrtDeviceApis::Commons::Exception& ex) {
490 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage());
494 JSValueRef JSCallHistory::removeChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
495 const JSValueRef arguments[], JSValueRef* exception) {
497 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
498 CALL_HISTORY_FUNCTION_API_REMOVELISTENER);
500 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
504 ArgumentValidator validator(context, argumentCount, arguments);
506 handle = validator.toLong(0);
508 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
511 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
514 JSContextRef gContext = priv->getContext();
517 ICallHistoryPtr callHistory(priv->getObject());
518 callHistory->removeListener(handle);
520 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Invalid values error : handle");
523 CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, handle));
524 DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
525 CallHistoryListenerManagerSingleton::Instance().unregisterListener(listenerItem);
526 } catch(const BasePlatformException& err){
527 return JSWebAPIErrorFactory::postException(context, exception, err);
528 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
529 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, ex.GetMessage());
530 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
531 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
532 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
533 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage());
534 } catch(const WrtDeviceApis::Commons::Exception& ex) {
535 return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage());
538 return JSValueMakeUndefined(context);