Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6210)

Unified Diff: chrome/renderer/resources/extensions/utils.js

Issue 141803016: Hide Port privates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/resources/extensions/messaging.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/utils.js
diff --git a/chrome/renderer/resources/extensions/utils.js b/chrome/renderer/resources/extensions/utils.js
index edf249cadc7d1186be9d5146554a733bf804a785..425ed2b436a6cd977cc2aca4f65485c28237b8ce 100644
--- a/chrome/renderer/resources/extensions/utils.js
+++ b/chrome/renderer/resources/extensions/utils.js
@@ -53,7 +53,7 @@ function loadTypeSchema(typeName, defaultSchema) {
// expose takes a private class implementation |cls| and exposes a subset of its
// methods |funcs| in a public wrapper class that it returns.
not at google - send to devlin 2014/01/27 23:21:56 explain |props| in this comment as well, though wh
Fady Samuel 2014/01/28 20:45:45 Done. As per our offline discussion, it's fairly m
-function expose(cls, funcs) {
+function expose(cls, funcs, props) {
function publicClass() {
var privateObj = $Object.create(cls.prototype);
$Function.apply(cls, privateObj, arguments);
@@ -61,12 +61,27 @@ function expose(cls, funcs) {
privates(this).impl = privateObj;
}
- $Array.forEach(funcs, function(func) {
- publicClass.prototype[func] = function() {
- var impl = privates(this).impl;
- return $Function.apply(impl[func], impl, arguments);
- };
- });
+
+ if (funcs) {
+ $Array.forEach(funcs, function(func) {
+ publicClass.prototype[func] = function() {
+ var impl = privates(this).impl;
+ return $Function.apply(impl[func], impl, arguments);
+ };
+ });
+ }
+
+ if (props) {
+ $Array.forEach(props, function(prop) {
+ $Object.defineProperty(publicClass.prototype, prop, {
+ enumerable: true,
+ get: function() {
+ var impl = privates(this).impl;
+ return impl[prop];
+ }
not at google - send to devlin 2014/01/27 23:21:56 Hm this is pretty tricky. You should make this se
Fady Samuel 2014/01/28 20:45:45 Done.
+ });
+ });
+ }
return publicClass;
}
« no previous file with comments | « chrome/renderer/resources/extensions/messaging.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698