function eventListenerPermissions() {
      listenOnce(chrome.permissions.onAdded,
                 function(permissions) {
        chrome.bookmarks.getTree(pass(function() {
          assertTrue(true);
        }));
      });
      listenOnce(chrome.permissions.onRemoved,
                 function(permissions) {
        assertTrue(typeof chrome.bookmarks == 'object' &&
                   chrome.bookmarks != null);
        var nativeBindingsError =
            "'bookmarks.getTree' is not available in this context.";
        var jsBindingsError =
            "'bookmarks' requires a different Feature that is not present.";
        var regexp = new RegExp(nativeBindingsError + '|' + jsBindingsError);
        assertThrows(chrome.bookmarks.getTree, [function(){}], regexp);
      });

      chrome.permissions.request(
          {permissions: ['bookmarks', 'management']}, pass(function(granted) {
        assertTrue(granted);
        chrome.permissions.remove(
            {permissions: ['bookmarks']}, pass(function() {
          assertTrue(true);
        }));
      }));
    }
// onAdded and onRemoved event listeners.
onAdded and onRemoved event listeners.
onAdded and onRemoved event listeners .
function eventListenerPermissions() {
      listenOnce(chrome.permissions.onAdded,
                 function(permissions) {
        chrome.bookmarks.getTree(pass(function() {
          assertTrue(true);
        }));
      });
      listenOnce(chrome.permissions.onRemoved,
                 function(permissions) {
        assertTrue(typeof chrome.bookmarks == 'object' &&
                   chrome.bookmarks != null);
        var nativeBindingsError =
            "'bookmarks.getTree' is not available in this context.";
        var jsBindingsError =
            "'bookmarks' requires a different Feature that is not present.";
        var regexp = new RegExp(nativeBindingsError + '|' + jsBindingsError);
        assertThrows(chrome.bookmarks.getTree, [function(){}], regexp);
      });
      chrome.permissions.request(
          {permissions: ['bookmarks', 'management']}, pass(function(granted) {
        assertTrue(granted);
        chrome.permissions.remove(
            {permissions: ['bookmarks']}, pass(function() {
          assertTrue(true);
        }));
      }));
    }
function eventListenerPermissions ( ) { listenOnce ( chrome . permissions . onAdded , function ( permissions ) { chrome . bookmarks . getTree ( pass ( function ( ) { assertTrue ( true ) ; } ) ) ; } ) ; listenOnce ( chrome . permissions . onRemoved , function ( permissions ) { assertTrue ( typeof chrome . bookmarks == 'object' && chrome . bookmarks != null ) ; var nativeBindingsError = "'bookmarks.getTree' is not available in this context." ; var jsBindingsError = "'bookmarks' requires a different Feature that is not present." ; var regexp = new RegExp ( nativeBindingsError + '|' + jsBindingsError ) ; assertThrows ( chrome . bookmarks . getTree , [ function ( ) { } ] , regexp ) ; } ) ; chrome . permissions . request ( { permissions : [ 'bookmarks' , 'management' ] } , pass ( function ( granted ) { assertTrue ( granted ) ; chrome . permissions . remove ( { permissions : [ 'bookmarks' ] } , pass ( function ( ) { assertTrue ( true ) ; } ) ) ; } ) ) ; }
onAdded and onRemoved event listeners.
onAdded and onRemoved event listeners .