Chromium Code Reviews| Index: chrome/renderer/resources/extensions/platform_keys/key.js |
| diff --git a/chrome/renderer/resources/extensions/platform_keys/key.js b/chrome/renderer/resources/extensions/platform_keys/key.js |
| index bea1fc402a187f89a335f8d7575752fcca58b4b1..dbd378fd44e41f9c9e8267d6d61586e4593fe7a4 100644 |
| --- a/chrome/renderer/resources/extensions/platform_keys/key.js |
| +++ b/chrome/renderer/resources/extensions/platform_keys/key.js |
| @@ -9,6 +9,7 @@ var utils = require('utils'); |
| * @enum {string} |
| */ |
| var KeyType = { |
| + __proto__: null, |
| public: 'public', |
| private: 'private' |
| }; |
| @@ -18,12 +19,14 @@ var KeyType = { |
| * @enum {string} |
| */ |
| var KeyUsage = { |
| + __proto__: null, |
| sign: 'sign', |
| verify: 'verify' |
| }; |
| /** |
| * Implementation of WebCrypto.Key used in enterprise.platformKeys. |
| + * |
| * @param {KeyType} type The type of the new key. |
| * @param {ArrayBuffer} publicKeySpki The Subject Public Key Info in DER |
| * encoding. |
| @@ -32,22 +35,27 @@ var KeyUsage = { |
| * @param {boolean} extractable Whether the key is extractable. |
| * @constructor |
| */ |
| -var KeyImpl = function(type, publicKeySpki, algorithm, usages, extractable) { |
| +function KeyImpl(type, publicKeySpki, algorithm, usages, extractable) { |
| this.type = type; |
| this.spki = publicKeySpki; |
| this.algorithm = algorithm; |
| this.usages = usages; |
| this.extractable = extractable; |
| -}; |
| - |
| -var KeyBase = function() {}; |
| +} |
| +$Object.setPrototypeOf(KeyImpl, null); |
| +$Object.setPrototypeOf(KeyImpl.prototype, null); |
| -Object.defineProperty(KeyBase.prototype, 'algorithm', { |
| - enumerable: true, |
| - get: function() { |
| +/** |
| + * The public base class of Key. |
| + */ |
| +function KeyBase() { |
|
Devlin
2016/04/26 22:41:25
nit: let's do "function KeyBase() {}" (one line)
robwu
2016/04/26 23:14:33
Done.
|
| +} |
| +KeyBase.prototype = { |
| + constructor: KeyBase, |
| + get algorithm() { |
| return utils.deepCopy(privates(this).impl.algorithm); |
| - } |
| -}); |
| + }, |
| +}; |
| function Key() { |
| privates(Key).constructPrivate(this, arguments); |
| @@ -64,6 +72,7 @@ utils.expose(Key, KeyImpl, { |
| /** |
| * Returns |key|'s Subject Public Key Info. Throws an exception if |key| is not |
| * a valid Key object. |
| + * |
| * @param {Key} key |
| * @return {ArrayBuffer} The Subject Public Key Info in DER encoding of |key|. |
| */ |