@@ -5735,16 +5735,23 @@ module.exports = function(AV) {
57355735 * Constructs a new AVRole with the given name and ACL.
57365736 *
57375737 * @param {String } name The name of the Role to create.
5738- * @param {AV.ACL } acl The ACL for this role. Roles must have an ACL.
5738+ * @param {AV.ACL } [acl] The ACL for this role. if absent, the default ACL
5739+ * `{'*': { read: true }}` will be used.
57395740 */
57405741 constructor : function ( name , acl ) {
5741- if ( _ . isString ( name ) && ( acl instanceof AV . ACL ) ) {
5742+ if ( _ . isString ( name ) ) {
57425743 AV . Object . prototype . constructor . call ( this , null , null ) ;
57435744 this . setName ( name ) ;
5744- this . setACL ( acl ) ;
5745- } else {
5746- AV . Object . prototype . constructor . call ( this , name , acl ) ;
57475745 }
5746+ if ( acl === undefined ) {
5747+ var defaultAcl = new AV . ACL ( ) ;
5748+ defaultAcl . setPublicReadAccess ( true ) ;
5749+ acl = defaultAcl ;
5750+ }
5751+ if ( ! ( acl instanceof AV . ACL ) ) {
5752+ throw new TypeError ( 'acl must be an instance of AV.ACL' ) ;
5753+ }
5754+ this . setACL ( acl ) ;
57485755 } ,
57495756
57505757 /**
@@ -8414,7 +8421,9 @@ function drainQueue() {
84148421 currentQueue = queue ;
84158422 queue = [ ] ;
84168423 while ( ++ queueIndex < len ) {
8417- currentQueue [ queueIndex ] . run ( ) ;
8424+ if ( currentQueue ) {
8425+ currentQueue [ queueIndex ] . run ( ) ;
8426+ }
84188427 }
84198428 queueIndex = - 1 ;
84208429 len = queue . length ;
@@ -8466,7 +8475,6 @@ process.binding = function (name) {
84668475 throw new Error ( 'process.binding is not supported' ) ;
84678476} ;
84688477
8469- // TODO(shtylman)
84708478process . cwd = function ( ) { return '/' } ;
84718479process . chdir = function ( dir ) {
84728480 throw new Error ( 'process.chdir is not supported' ) ;
0 commit comments