B2G/gecko/dom/messages/SystemMessagePermissionsChecker.jsm
/**
   * Check if the system message is permitted to be sent to the given
   * app's page at run-time based on the current app's permissions.
   * @param string aSysMsgName
   *        The system messsage name.
   * @param string aPageURI
   *        The app's page URI.
   * @param string aManifestURL
   *        The app's manifest URL.
   * @returns bool
   *        Is permitted or not.
   **/
Check if the system message is permitted to be sent to the given
app's page at run-time based on the current app's permissions.
@param string aSysMsgName
The system messsage name.
@param string aPageURI
The app's page URI.
@param string aManifestURL
The app's manifest URL.
@returns bool
Is permitted or not.
Check if the system message is permitted to be sent to the given app ' s page at run - time based on the current app ' s permissions . @param string aSysMsgName The system messsage name . @param string aPageURI The app ' s page URI . @param string aManifestURL The app ' s manifest URL . @returns bool Is permitted or not .
function isSystemMessagePermittedToSend(aSysMsgName, aPageURI, aManifestURL) {
    debug("isSystemMessagePermittedToSend(): " +
          "aSysMsgName: " + aSysMsgName + ", " +
          "aPageURI: " + aPageURI + ", " +
          "aManifestURL: " + aManifestURL);
    let permNames = this.getSystemMessagePermissions(aSysMsgName);
    if (permNames === null) {
      return false;
    }
    let pageURI = Services.io.newURI(aPageURI, null, null);
    for (let permName in permNames) {
      let permNamesWithAccess = permNames[permName];
      for (let idx in permNamesWithAccess) {
        if(PermissionSettingsModule.getPermission(permNamesWithAccess[idx],
                                                  aManifestURL,
                                                  pageURI.prePath,
                                                  false) != "allow") {
          debug("'" + aSysMsgName + "' isn't permitted by '" + permName + "'. " +
                "Please add the permission for app: '" + pageURI.prePath + "'.");
          return false;
        }
      }
    }
    return true;
  }
function isSystemMessagePermittedToSend ( aSysMsgName , aPageURI , aManifestURL ) { debug ( "isSystemMessagePermittedToSend(): " + "aSysMsgName: " + aSysMsgName + ", " + "aPageURI: " + aPageURI + ", " + "aManifestURL: " + aManifestURL ) ; let permNames = this . getSystemMessagePermissions ( aSysMsgName ) ; if ( permNames === null ) { return false ; } let pageURI = Services . io . newURI ( aPageURI , null , null ) ; for ( let permName in permNames ) { let permNamesWithAccess = permNames [ permName ] ; for ( let idx in permNamesWithAccess ) { if ( PermissionSettingsModule . getPermission ( permNamesWithAccess [ idx ] , aManifestURL , pageURI . prePath , false ) != "allow" ) { debug ( "'" + aSysMsgName + "' isn't permitted by '" + permName + "'. " + "Please add the permission for app: '" + pageURI . prePath + "'." ) ; return false ; } } } return true ; }
Check if the system message is permitted to be sent to the given
 app's page at run-time based on the current app's permissions.
Check if the system message is permitted to be sent to the given app ' s page at run - time based on the current app ' s permissions .
// Early return false as soon as any permission is not matched. // All the permissions needed for this system message are matched.