Creates a new Isolate object with a restricted set of capabilities.
The port should be a control port for an isolate, as taken from
The capabilities should be the subset of the capabilities that are available to the original isolate. Capabilities of an isolate are locked to that isolate, and have no effect anywhere else, so the capabilities should come from the same isolate as the control port.
Isolate isolate = findSomeIsolate(); Isolate restrictedIsolate = Isolate(isolate.controlPort); untrustedCode(restrictedIsolate);
This example creates a new
Isolate object that cannot be used to
pause or terminate the isolate. All the untrusted code can do is to
inspect the isolate and see uncaught errors or when it terminates.