This function is solely to test the TorqueScript <-> Javascript binding By default, it is marked as secure by the web plugins and then can be called from Javascript on the web page to ensure that function calls across the language boundry are working with arguments and return values
| 436 | // Javascript on the web page to ensure that function calls across the language |
| 437 | // boundry are working with arguments and return values |
| 438 | DefineConsoleFunction( testJavaScriptBridge, const char *, (const char* arg1, const char* arg2, const char* arg3), , "testBridge(arg1, arg2, arg3)") |
| 439 | { |
| 440 | S32 failed = 0; |
| 441 | if (dStrcmp(arg1,"one")) |
| 442 | failed = 2; |
| 443 | if (dStrcmp(arg2,"two")) |
| 444 | failed = 2; |
| 445 | if (dStrcmp(arg3,"three")) |
| 446 | failed = 2; |
| 447 | |
| 448 | |
| 449 | //attempt to call from TorqueScript -> JavaScript |
| 450 | const char* jret = Con::evaluate("JS::bridgeCallback(\"one\",\"two\",\"three\");"); |
| 451 | |
| 452 | if (dStrcmp(jret,"42")) |
| 453 | failed = 3; |
| 454 | |
| 455 | static const U32 bufSize = 256; |
| 456 | char *ret = Con::getReturnBuffer(bufSize); |
| 457 | |
| 458 | dSprintf(ret, bufSize, "%i", failed); |
| 459 | |
| 460 | return ret; |
| 461 | } |
| 462 | |
| 463 | |
| 464 |
nothing calls this directly
no test coverage detected