117 lines
3.9 KiB
Plaintext
117 lines
3.9 KiB
Plaintext
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Mozilla browser.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications, Inc. Portions created by Netscape are
|
|
* Copyright (C) 1999, Mozilla. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
* Adam Lock <adamlock@netscape.com>
|
|
*/
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
interface nsIURI;
|
|
interface nsIInputStream;
|
|
interface nsIDOMDocument;
|
|
interface nsIWebProgressListener;
|
|
interface nsILocalFile;
|
|
|
|
/**
|
|
* @status UNDER_REVIEW
|
|
*/
|
|
|
|
/**
|
|
* Interface for persisting DOM documents and URIs to local storage.
|
|
*/
|
|
[scriptable, uuid(814ba433-a816-4785-9f95-ad3ba0a43dab)]
|
|
interface nsIWebBrowserPersist : nsISupports
|
|
{
|
|
/** No special persistence behaviour. */
|
|
const unsigned long PERSIST_FLAGS_NONE = 0;
|
|
/** Only use cached data (could result in failure if data is not cached). */
|
|
const unsigned long PERSIST_FLAGS_FROM_CACHE = 1;
|
|
/** Bypass the cached data. */
|
|
const unsigned long PERSIST_FLAGS_BYPASS_CACHE = 2;
|
|
/** Ignore any redirected data (usually adverts). */
|
|
const unsigned long PERSIST_FLAGS_IGNORE_REDIRECTED_DATA = 4;
|
|
/** Ignore IFRAME content (usually adverts). */
|
|
const unsigned long PERSIST_FLAGS_IGNORE_IFRAMES = 8;
|
|
|
|
/** Flags governing how data is fetched from the network. */
|
|
attribute unsigned long persistFlags;
|
|
|
|
/** Persister is ready to save data */
|
|
const unsigned long PERSIST_STATE_READY = 1;
|
|
/** Persister is saving data */
|
|
const unsigned long PERSIST_STATE_SAVING = 2;
|
|
/** Persister has finished saving data */
|
|
const unsigned long PERSIST_STATE_FINISHED = 3;
|
|
|
|
/**
|
|
* Current state of the persister object.
|
|
*/
|
|
readonly attribute unsigned long currentState;
|
|
|
|
/**
|
|
* Value indicating the success or failure of the persist
|
|
* operation.
|
|
*
|
|
* @return NS_OK Operation was successful or is still ongoing.
|
|
* @return NS_BINDING_ABORTED Operation cancelled.
|
|
* @return NS_ERROR_FAILURE Non-specific failure.
|
|
*/
|
|
readonly attribute unsigned long result;
|
|
|
|
/**
|
|
* Callback listener for progress notifications.
|
|
*/
|
|
attribute nsIWebProgressListener progressListener;
|
|
|
|
/**
|
|
* Save the specified URI to file.
|
|
*
|
|
* @param aURI URI to save to file or <CODE>nsnull</CODE>
|
|
* to use current URI if the implementation supports such
|
|
* a concept.
|
|
* @param aPostData Data to pass with in an HTTP request or nsnull.
|
|
* @param aFile Target local file.
|
|
*
|
|
* @return NS_OK Operation has been started.
|
|
* @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
|
|
*/
|
|
void saveURI(in nsIURI aURI, in nsIInputStream aPostData, in nsILocalFile aFile);
|
|
|
|
/**
|
|
* Save the specified DOM document to file and optionally all linked files
|
|
* (e.g. images, CSS, JS & subframes). Do not call this method until the
|
|
* document has finished loading!
|
|
*
|
|
* @param aDocument Document to save to file.
|
|
* @param aFile Target local file.
|
|
* @param aDataPath Path to folder (which must already exist) to save
|
|
* linked files to or nsnull.
|
|
*
|
|
* @return NS_OK Operation has been started.
|
|
* @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
|
|
*/
|
|
void saveDocument(in nsIDOMDocument aDocument, in nsILocalFile aFile, in nsILocalFile aDataPath);
|
|
|
|
/**
|
|
* Cancels the current operation. The caller is responsible for cleaning up
|
|
* partially written files or directories.
|
|
*/
|
|
void cancelSave();
|
|
};
|