Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsWebBrowserPersist.cpp File Reference
#include "nspr.h"
#include "nsIFileStreams.h"
#include "nsNetUtil.h"
#include "nsComponentManagerUtils.h"
#include "nsIComponentRegistrar.h"
#include "nsIStorageStream.h"
#include "nsISeekableStream.h"
#include "nsIHttpChannel.h"
#include "nsIEncodedChannel.h"
#include "nsIUploadChannel.h"
#include "nsICachingChannel.h"
#include "nsEscape.h"
#include "nsUnicharUtils.h"
#include "nsIStringEnumerator.h"
#include "nsCRT.h"
#include "nsSupportsArray.h"
#include "nsInt64.h"
#include "nsCExternalHandlerService.h"
#include "nsIURL.h"
#include "nsIFileURL.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXMLDocument.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDOMTreeWalker.h"
#include "nsIDOMNode.h"
#include "nsIDOMComment.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNSDocument.h"
#include "nsIWebProgressListener.h"
#include "nsIAuthPrompt.h"
#include "nsIPrompt.h"
#include "nsISHEntry.h"
#include "nsIWebPageDescriptor.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMHTMLTableElement.h"
#include "nsIDOMHTMLTableRowElement.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLEmbedElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLAppletElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIImageLoadingContent.h"
#include "ftpCore.h"
#include "nsITransport.h"
#include "nsISocketTransport.h"
#include "nsIStringBundle.h"
#include "nsWebBrowserPersist.h"

Go to the source code of this file.

Classes

struct  DocData
struct  URIData
struct  OutputData
struct  UploadData
struct  CleanupData
class  nsMyISupportsKey
struct  FixRedirectData
struct  SpecialXHTMLTags

Defines

#define NS_SUCCESS_DONT_FIXUP   NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 1)

Functions

static NS_METHOD DiscardSegments (nsIInputStream *input, void *closure, const char *buf, PRUint32 offset, PRUint32 count, PRUint32 *countRead)
static PRBool IsSpecialXHTMLTag (nsIDOMNode *aNode)
static PRBool HasSpecialXHTMLTags (nsIDOMNode *aParent)
static PRBool NeedXHTMLBaseTag (nsIDOMDocument *aDocument)

Variables

const PRUint32 kDefaultMaxFilenameLength = 64
const char * kNonpersistableSchemes []
const PRUint32 kNonpersistableSchemesSize = sizeof(kNonpersistableSchemes) / sizeof(kNonpersistableSchemes[0])
const PRUint32 kDefaultPersistFlags
const char * kWebBrowserPersistStringBundle = "chrome://global/locale/nsWebBrowserPersist.properties"

Class Documentation

struct DocData

Definition at line 120 of file nsWebBrowserPersist.cpp.

Collaboration diagram for DocData:
Class Members
nsCOMPtr< nsIURI > mBaseURI
nsCString mCharset
nsCOMPtr< nsIURI > mDataPath
PRPackedBool mDataPathIsRelative
nsCOMPtr< nsIDOMDocument > mDocument
nsCOMPtr< nsIURI > mFile
nsCString mRelativePathToData
struct URIData

Definition at line 132 of file nsWebBrowserPersist.cpp.

Collaboration diagram for URIData:
Class Members
nsCString mCharset
nsCOMPtr< nsIURI > mDataPath
PRPackedBool mDataPathIsRelative
nsCOMPtr< nsIURI > mFile
nsString mFilename
PRPackedBool mIsSubFrame
PRPackedBool mNeedsFixup
PRPackedBool mNeedsPersisting
nsCString mRelativePathToData
PRPackedBool mSaved
nsString mSubFrameExt
struct CleanupData

Definition at line 188 of file nsWebBrowserPersist.cpp.

Collaboration diagram for CleanupData:
Class Members
nsCOMPtr< nsILocalFile > mFile
PRPackedBool mIsDirectory
struct FixRedirectData

Definition at line 2349 of file nsWebBrowserPersist.cpp.

Collaboration diagram for FixRedirectData:
Class Members
nsISupportsKey * mMatchingKey
nsCOMPtr< nsIChannel > mNewChannel
nsCOMPtr< nsIURI > mOriginalURI
struct SpecialXHTMLTags

Definition at line 3667 of file nsWebBrowserPersist.cpp.

Class Members
PRUnichar name

Define Documentation

Definition at line 117 of file nsWebBrowserPersist.cpp.


Function Documentation

static NS_METHOD DiscardSegments ( nsIInputStream input,
void closure,
const char *  buf,
PRUint32  offset,
PRUint32  count,
PRUint32 countRead 
) [static]

Definition at line 811 of file nsWebBrowserPersist.cpp.

{
    *countRead = count;
    return NS_OK;
}
static PRBool HasSpecialXHTMLTags ( nsIDOMNode aParent) [static]

Definition at line 3716 of file nsWebBrowserPersist.cpp.

{
    if (IsSpecialXHTMLTag(aParent))
        return PR_TRUE;

    nsCOMPtr<nsIDOMNodeList> list;
    aParent->GetChildNodes(getter_AddRefs(list));
    if (list)
    {
        PRUint32 count;
        list->GetLength(&count);
        PRUint32 i;
        for (i = 0; i < count; i++) {
            nsCOMPtr<nsIDOMNode> node;
            list->Item(i, getter_AddRefs(node));
            if (!node)
                break;
            PRUint16 nodeType;
            node->GetNodeType(&nodeType);
            if (nodeType == nsIDOMNode::ELEMENT_NODE) {
                return HasSpecialXHTMLTags(node);
            }
        }
    }

    return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsSpecialXHTMLTag ( nsIDOMNode aNode) [static]

Definition at line 3671 of file nsWebBrowserPersist.cpp.

{
    nsAutoString ns;
    aNode->GetNamespaceURI(ns);
    if (!ns.EqualsLiteral("http://www.w3.org/1999/xhtml"))
        return PR_FALSE;

    // Ordered so that typical documents work fastest
    static SpecialXHTMLTags tags[] = {
        {'b','o','d','y',0},
        {'h','e','a','d',0},
        {'i','m','g',0},
        {'s','c','r','i','p','t',0},
        {'a',0},
        {'a','r','e','a',0},
        {'l','i','n','k',0},
        {'i','n','p','u','t',0},
        {'f','r','a','m','e',0},
        {'i','f','r','a','m','e',0},
        {'o','b','j','e','c','t',0},
        {'a','p','p','l','e','t',0},
        {'f','o','r','m',0},
        {'b','l','o','c','k','q','u','o','t','e',0},
        {'q',0},
        {'d','e','l',0},
        {'i','n','s',0},
        {0}};

    nsAutoString localName;
    aNode->GetLocalName(localName);
    PRInt32 i;
    for (i = 0; tags[i].name[0]; i++) {
        if (localName.Equals(tags[i].name))
        {
            // XXX This element MAY have URI attributes, but
            //     we are not actually checking if they are present.
            //     That would slow us down further, and I am not so sure
            //     how important that would be.
            return PR_TRUE;
        }
    }

    return PR_FALSE;
}

Here is the caller graph for this function:

static PRBool NeedXHTMLBaseTag ( nsIDOMDocument aDocument) [static]

Definition at line 3744 of file nsWebBrowserPersist.cpp.

{
    nsCOMPtr<nsIDOMElement> docElement;
    aDocument->GetDocumentElement(getter_AddRefs(docElement));

    nsCOMPtr<nsIDOMNode> node(do_QueryInterface(docElement));
    if (node)
    {
        return HasSpecialXHTMLTags(node);
    }

    return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 205 of file nsWebBrowserPersist.cpp.

Initial value:
 {
    "about:",
    "news:", 
    "snews:",
    "ldap:",
    "ldaps:",
    "mailto:", 
    "finger:",
    "telnet:", 
    "gopher:", 
    "javascript:",
    "view-source:",
    "irc:",
    "mailbox:"
}

Definition at line 209 of file nsWebBrowserPersist.cpp.

Definition at line 224 of file nsWebBrowserPersist.cpp.

const char* kWebBrowserPersistStringBundle = "chrome://global/locale/nsWebBrowserPersist.properties"

Definition at line 232 of file nsWebBrowserPersist.cpp.