| 1465 | } |
| 1466 | |
| 1467 | func forceRuntimeInitFailureForTest(enable bool) func() { |
| 1468 | oldHook := runtimeInitContextHook |
| 1469 | if enable { |
| 1470 | runtimeInitContextHook = func(ctx *C.JSContext) C.JSValue { |
| 1471 | msg := C.CString("forced init failure") |
| 1472 | defer C.free(unsafe.Pointer(msg)) |
| 1473 | return C.ThrowInternalError(ctx, msg) |
| 1474 | } |
| 1475 | } else { |
| 1476 | runtimeInitContextHook = nil |
| 1477 | } |
| 1478 | return func() { |
| 1479 | runtimeInitContextHook = oldHook |
| 1480 | } |
| 1481 | } |
| 1482 | |
| 1483 | func forceRuntimeInitSuccessForTest(enable bool) func() { |
| 1484 | oldHook := runtimeInitContextHook |