WebKitBrowser/InjectedBundle/NotifyWPEFramework.cpp
// Implementation of JS function: loops over arguments and passes all strings to WPEFramework.
Implementation of JS function: loops over arguments and passes all strings to WPEFramework.
Implementation of JS function : loops over arguments and passes all strings to WPEFramework .
JSValueRef NotifyWPEFramework::HandleMessage(JSContextRef context, JSObjectRef,
            JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef*)
        {
            WKStringRef messageName = WKStringCreateWithUTF8CString(GetMessageName().c_str());
            WKMutableArrayRef messageBody = WKMutableArrayCreate();
            for (unsigned int index = 0; index < argumentCount; index++) {
                const JSValueRef& argument = arguments[index];
                if (!JSValueIsString(context, argument))
                    continue;
                JSStringRef jsString = JSValueToStringCopy(context, argument, nullptr);
                WKStringRef messageLine = WKStringCreateWithJSString(jsString);
                WKArrayAppendItem(messageBody, messageLine);
                WKRelease(messageLine);
                JSStringRelease(jsString);
            }
            WKBundlePostSynchronousMessage(g_Bundle, messageName, messageBody, nullptr);
            WKRelease(messageBody);
            WKRelease(messageName);
            return JSValueMakeNull(context);
        }
JSValueRef NotifyWPEFramework :: HandleMessage ( JSContextRef context , JSObjectRef , JSObjectRef , size_t argumentCount , const JSValueRef arguments [ ] , JSValueRef * ) { WKStringRef messageName = WKStringCreateWithUTF8CString ( GetMessageName ( ) . c_str ( ) ) ; WKMutableArrayRef messageBody = WKMutableArrayCreate ( ) ; for ( unsigned int index = 0 ; index < argumentCount ; index ++ ) { const JSValueRef & argument = arguments [ index ] ; if ( ! JSValueIsString ( context , argument ) ) continue ; JSStringRef jsString = JSValueToStringCopy ( context , argument , nullptr ) ; WKStringRef messageLine = WKStringCreateWithJSString ( jsString ) ; WKArrayAppendItem ( messageBody , messageLine ) ; WKRelease ( messageLine ) ; JSStringRelease ( jsString ) ; } WKBundlePostSynchronousMessage ( g_Bundle , messageName , messageBody , nullptr ) ; WKRelease ( messageBody ) ; WKRelease ( messageName ) ; return JSValueMakeNull ( context ) ; }
Implementation of JS function: loops over arguments and passes all strings to WPEFramework.
Implementation of JS function : loops over arguments and passes all strings to WPEFramework .
// Build message body. // For now only pass along strings.