File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ lockdown({
3434 dateTaming : 'unsafe' ,
3535} ) ;
3636
37+ /**
38+ * TODO:
39+ * To support multiple plugins per worker, we need to duplex the rpcStream
40+ * on this end, and pass MetaMaskInpageProvider the appropriate stream name.
41+ */
42+
3743// init
3844( function ( ) {
3945 class Controller {
@@ -191,7 +197,7 @@ lockdown({
191197 } ) ;
192198 compartment . evaluate ( sourceCode ) ;
193199 } catch ( err ) {
194- // _removePlugin (pluginName) // TODO:WW
200+ this . removePlugin ( pluginName ) ;
195201 console . error (
196202 `Error while running plugin '${ pluginName } ' in worker:${ self . name } .` ,
197203 err ,
@@ -215,9 +221,18 @@ lockdown({
215221 this . pluginRpcHandlers . set ( pluginName , func ) ;
216222 } ;
217223
224+ // TODO: harden throws an error. Why?
218225 // return harden(pluginProvider as PluginProvider);
219226 return pluginProvider as PluginProvider ;
220227 }
228+
229+ /**
230+ * Removes the plugin with the given name. Specifically:
231+ * - Deletes the plugin's RPC handler, if any
232+ */
233+ private removePlugin ( pluginName : string ) : void {
234+ this . pluginRpcHandlers . delete ( pluginName ) ;
235+ }
221236 }
222237
223238 function setupMultiplex (
You can’t perform that action at this time.
0 commit comments