(&mut self, fields: HashMap<K, serde_json::Value>)
| 33 | } |
| 34 | |
| 35 | pub fn inject_sso_instance<K>(&mut self, fields: HashMap<K, serde_json::Value>) |
| 36 | where |
| 37 | K: AsRef<str> + Eq, |
| 38 | { |
| 39 | self.arena.mutate_root(|mc, state| { |
| 40 | let ctx = state.get_context(); |
| 41 | let name = state.intern_static("sso"); |
| 42 | let class = crate::builtins::sso::create_sso_provider_class(ctx); |
| 43 | let mut instance = Instance::new(class); |
| 44 | for (key, value) in fields { |
| 45 | instance.fields.insert( |
| 46 | state.intern(key.as_ref().as_bytes()), |
| 47 | Value::from_serde_value(ctx, &value), |
| 48 | ); |
| 49 | } |
| 50 | state |
| 51 | .globals |
| 52 | .insert(name, Gc::new(mc, RefLock::new(instance)).into()); |
| 53 | }); |
| 54 | } |
| 55 | |
| 56 | pub fn inject_variables(&mut self, variables: HashMap<String, serde_json::Value>) { |
| 57 | self.arena.mutate_root(|_mc, state| { |
no test coverage detected