Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 part of dart.isolate; | |
| 6 | |
| 7 /** | |
| 8 * An unforgable object that preserves its identity when passed through other | |
| 9 * isolates. | |
| 10 * | |
| 11 * Objects sent through [SendPort]s to other isolates, and back again, will | |
| 12 * generally be copied, and will not have the same identity as the original. | |
| 13 * A capability object preserves its identity when sent through other isolates. | |
|
floitsch
2014/01/29 15:26:26
Do we need the identity requirement?
Equality woul
Lasse Reichstein Nielsen
2014/01/29 15:58:13
I think identity is preferable.
It allows you to u
floitsch
2014/01/29 16:52:35
No doubt about that. The question is, if it's not
| |
| 14 * | |
| 15 * Capabilities can be used as access guards: A remote isolate can send | |
| 16 * a request for an operation, but it is only allowed if the request contains | |
| 17 * the correct capability object. | |
| 18 * | |
| 19 * This allows exposing the same interface to multiple clients, but restricting | |
| 20 * some operations to only those clients that have also been given the | |
| 21 * corresponding capability. | |
| 22 * | |
| 23 * When comparing capabilities, always use identity comparison. That is, either | |
| 24 * use [identical] to test, or use the known capability as the left-hand side of | |
| 25 * the `==` operator. This prevents a malicious user from providing a fake | |
| 26 * capability object with a custom equality that would claim to be equal | |
| 27 * to your capability. | |
| 28 * | |
| 29 * Capabilities can be used inside a single isolate, but they have no advantage | |
| 30 * over just using `new Object` to create a unique object. The only advantage | |
| 31 * of `Capability` over `Object` is that it preserves its identity when | |
| 32 * round-tripped through other isolates. | |
| 33 */ | |
| 34 class Capability { | |
| 35 /** | |
| 36 * Create a new unforgable capability object. | |
| 37 */ | |
| 38 external factory Capability(); | |
| 39 } | |
| OLD | NEW |