Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsInstallTrigger.cpp File Reference
#include "nsSoftwareUpdate.h"
#include "nsXPInstallManager.h"
#include "nsInstallTrigger.h"
#include "nsInstallVersion.h"
#include "nsIDOMInstallTriggerGlobal.h"
#include "nscore.h"
#include "netCore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIPermissionManager.h"
#include "nsIDocShell.h"
#include "nsNetUtil.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIPrincipal.h"
#include "nsIObserverService.h"
#include "nsIPropertyBag2.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "VerReg.h"
#include "nsIContentHandler.h"
#include "nsIChannel.h"
#include "nsIURI.h"

Go to the source code of this file.

Functions

 NS_IMPL_THREADSAFE_ISUPPORTS3 (nsInstallTrigger, nsIScriptObjectOwner, nsIDOMInstallTriggerGlobal, nsIContentHandler) NS_IMETHODIMP nsInstallTrigger
static void updatePermissions (const char *aPref, PRUint32 aPermission, nsIPermissionManager *aPermissionManager, nsIPrefBranch *aPrefBranch)

Function Documentation

Definition at line 87 of file nsInstallTrigger.cpp.

{
    NS_PRECONDITION(nsnull != aScriptObject, "null arg");
    nsresult res = NS_OK;

    if (nsnull == mScriptObject)
    {
        res = NS_NewScriptInstallTriggerGlobal(aContext,
                                               (nsIDOMInstallTriggerGlobal*)this,
                                               aContext->GetGlobalObject(),
                                               &mScriptObject);
    }

    *aScriptObject = mScriptObject;
    return res;
}

Here is the call graph for this function:

static void updatePermissions ( const char *  aPref,
PRUint32  aPermission,
nsIPermissionManager aPermissionManager,
nsIPrefBranch aPrefBranch 
) [static]

Definition at line 276 of file nsInstallTrigger.cpp.

{
    NS_PRECONDITION(aPref && aPermissionManager && aPrefBranch, "Null arguments!");

    nsXPIDLCString hostlist;
    nsresult rv = aPrefBranch->GetCharPref( aPref, getter_Copies(hostlist));
    if (NS_SUCCEEDED(rv) && !hostlist.IsEmpty())
    {
        nsCAutoString host;
        PRInt32 start=0, match=0;
        nsresult rv;
        nsCOMPtr<nsIURI> uri;

        do {
            match = hostlist.FindChar(',', start);

            host = Substring(hostlist, start, match-start);
            host.CompressWhitespace();
            host.Insert("http://", 0);

            rv = NS_NewURI(getter_AddRefs(uri), host);
            if (NS_SUCCEEDED(rv))
            {
                aPermissionManager->Add( uri, XPI_PERMISSION, aPermission );
            }
            start = match+1;
        } while ( match > 0 );

        // save empty list, we don't need to do this again
        aPrefBranch->SetCharPref( aPref, "");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: