(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func TestBridgeMappingCorruptionFailClosed(t *testing.T) { |
| 117 | rt := NewRuntime() |
| 118 | defer rt.Close() |
| 119 | ctx := rt.NewContext() |
| 120 | defer ctx.Close() |
| 121 | |
| 122 | require.NotNil(t, getContextFromJS(ctx.ref)) |
| 123 | require.NotNil(t, getRuntimeFromJS(rt.ref)) |
| 124 | |
| 125 | contextMapping.Store(ctx.ref, "corrupted-context") |
| 126 | require.Nil(t, getContextFromJS(ctx.ref)) |
| 127 | |
| 128 | runtimeMapping.Store(rt.ref, "corrupted-runtime") |
| 129 | require.Nil(t, getRuntimeFromJS(rt.ref)) |
| 130 | require.NotPanics(t, func() { |
| 131 | _ = goInterruptHandler(rt.ref) |
| 132 | }) |
| 133 | |
| 134 | registerContext(ctx.ref, ctx) |
| 135 | registerRuntime(rt.ref, rt) |
| 136 | |
| 137 | fn := ctx.NewFunction(func(ctx *Context, this *Value, args []*Value) *Value { |
| 138 | return ctx.NewString("ok") |
| 139 | }) |
| 140 | ctx.Globals().Set("__bridge_boundary_fn", fn) |
| 141 | |
| 142 | result := ctx.Eval(` |
| 143 | try { |
| 144 | __bridge_boundary_fn(); |
| 145 | "ok"; |
| 146 | } catch (e) { |
| 147 | String(e); |
| 148 | } |
| 149 | `) |
| 150 | defer result.Free() |
| 151 | require.False(t, result.IsException()) |
| 152 | require.Equal(t, "ok", result.ToString()) |
| 153 | } |
| 154 | |
| 155 | func TestResolveClassObjectFromOpaqueContracts(t *testing.T) { |
| 156 | rt := NewRuntime() |
nothing calls this directly
no test coverage detected