зеркало из https://github.com/mozilla/pjs.git
Relanding, since backing out did not fix orange. Bug 232691.
This commit is contained in:
Родитель
b9b7c23334
Коммит
f79a6813af
|
@ -459,7 +459,7 @@ NS_IMETHODIMP nsHTMLGroupboxAccessible::GetName(nsAString& _retval)
|
|||
legends->Item(0, getter_AddRefs(legendNode));
|
||||
nsCOMPtr<nsIContent> legendContent(do_QueryInterface(legendNode));
|
||||
if (legendContent) {
|
||||
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
_retval.Truncate(); // Default name is blank
|
||||
return AppendFlatStringFromSubtree(legendContent, &_retval);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ nsHTMLTableCaptionAccessible::GetState(PRUint32 *aResult)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLTableCaptionAccessible::GetValue(nsAString& aResult)
|
||||
{
|
||||
aResult.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
aResult.Truncate(); // Default name is blank
|
||||
|
||||
nsCOMPtr<nsIContent> captionContent(do_QueryInterface(mDOMNode));
|
||||
AppendFlatStringFromSubtree(captionContent, &aResult);
|
||||
|
@ -109,7 +109,7 @@ NS_IMETHODIMP nsHTMLTableAccessible::GetState(PRUint32 *aResult)
|
|||
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetName(nsAString& aResult)
|
||||
{
|
||||
aResult.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
aResult.Truncate(); // Default name is blank
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
|
|
|
@ -404,7 +404,7 @@ NS_IMETHODIMP nsXULGroupboxAccessible::GetState(PRUint32 *_retval)
|
|||
|
||||
NS_IMETHODIMP nsXULGroupboxAccessible::GetName(nsAString& _retval)
|
||||
{
|
||||
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
_retval.Truncate(); // Default name is blank
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
|
|
|
@ -274,7 +274,7 @@ NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetState(PRUint32 *_retval)
|
|||
|
||||
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetName(nsAString& _retval)
|
||||
{
|
||||
_retval.Assign(NS_LITERAL_STRING(""));
|
||||
_retval.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ mozSanitizingHTMLSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||
rv = DoOpenContainer(id);
|
||||
}
|
||||
else {
|
||||
rv = DoAddLeaf(id, nsString());
|
||||
rv = DoAddLeaf(id, EmptyString());
|
||||
}
|
||||
|
||||
mContent = 0;
|
||||
|
|
|
@ -346,7 +346,7 @@ nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
|
|||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return NS_NewDOMDocumentType(aReturn, name, nsnull, nsnull,
|
||||
aPublicId, aSystemId, nsString());
|
||||
aPublicId, aSystemId, EmptyString());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1017,7 +1017,7 @@ nsDocument::GetLineBreaker()
|
|||
do_GetService(NS_LWBRK_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
lbf->GetBreaker(nsString(), getter_AddRefs(mLineBreaker));
|
||||
lbf->GetBreaker(EmptyString(), getter_AddRefs(mLineBreaker));
|
||||
NS_ENSURE_TRUE(mLineBreaker, nsnull);
|
||||
}
|
||||
|
||||
|
@ -1040,7 +1040,7 @@ nsDocument::GetWordBreaker()
|
|||
do_GetService(NS_LWBRK_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
wbf->GetBreaker(nsString(), getter_AddRefs(mWordBreaker));
|
||||
wbf->GetBreaker(EmptyString(), getter_AddRefs(mWordBreaker));
|
||||
NS_ENSURE_TRUE(wbf, nsnull);
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ nsHTMLContentSerializer::AppendText(nsIDOMText* aText,
|
|||
nsresult rv;
|
||||
nsCOMPtr<nsILineBreakerFactory> lf(do_GetService(kLWBrkCID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = lf->GetBreaker(nsString(), getter_AddRefs(mLineBreaker));
|
||||
rv = lf->GetBreaker(EmptyString(), getter_AddRefs(mLineBreaker));
|
||||
// Ignore result value.
|
||||
// If we are unable to obtain a line breaker,
|
||||
// we will use our simple fallback logic.
|
||||
|
@ -655,7 +655,7 @@ nsHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
|
|||
if (IsShorthandAttr(attrName, aTagName) && valueStr.IsEmpty()) {
|
||||
valueStr = nameStr;
|
||||
}
|
||||
SerializeAttr(nsAutoString(), nameStr, valueStr, aStr, !isJS);
|
||||
SerializeAttr(EmptyString(), nameStr, valueStr, aStr, !isJS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ nsHTMLContentSerializer::SerializeLIValueAttribute(nsIDOMElement* aElement,
|
|||
if (offset == 0 && found) {
|
||||
// offset = 0 => LI itself has the value attribute and we did not need to traverse back.
|
||||
// Just serialize value attribute like other tags.
|
||||
SerializeAttr(nsAutoString(), NS_LITERAL_STRING("value"), valueStr, aStr, PR_FALSE);
|
||||
SerializeAttr(EmptyString(), NS_LITERAL_STRING("value"), valueStr, aStr, PR_FALSE);
|
||||
}
|
||||
else if (offset == 1 && !found) {
|
||||
/*(offset = 1 && !found) means either LI is the first child node of OL
|
||||
|
@ -1336,7 +1336,7 @@ nsHTMLContentSerializer::SerializeLIValueAttribute(nsIDOMElement* aElement,
|
|||
|
||||
//As serializer needs to use this valueAttr we are creating here,
|
||||
valueStr.AppendInt(startVal + offset);
|
||||
SerializeAttr(nsAutoString(), NS_LITERAL_STRING("value"), valueStr, aStr, PR_FALSE);
|
||||
SerializeAttr(EmptyString(), NS_LITERAL_STRING("value"), valueStr, aStr, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -510,7 +510,7 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||
|
||||
if (!attrPrefix) {
|
||||
// Default NS attribute does not have prefix (and the name is "xmlns")
|
||||
PushNameSpaceDecl(nsString(), uriStr, aElement);
|
||||
PushNameSpaceDecl(EmptyString(), uriStr, aElement);
|
||||
} else {
|
||||
attrName->ToString(nameStr);
|
||||
PushNameSpaceDecl(nameStr, uriStr, aElement);
|
||||
|
|
|
@ -1201,7 +1201,7 @@ nsHTMLInputElement::SelectAll(nsIPresContext* aPresContext)
|
|||
|
||||
if (formControlFrame) {
|
||||
formControlFrame->SetProperty(aPresContext, nsHTMLAtoms::select,
|
||||
nsAutoString());
|
||||
EmptyString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ nsHTMLTextAreaElement::SelectAll(nsIPresContext* aPresContext)
|
|||
|
||||
if (formControlFrame) {
|
||||
formControlFrame->SetProperty(aPresContext, nsHTMLAtoms::select,
|
||||
nsString());
|
||||
EmptyString());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -2380,7 +2380,7 @@ nsHTMLDocument::ScriptWriteCommon(PRBool aNewlineTerminate)
|
|||
}
|
||||
|
||||
// No arguments...
|
||||
return WriteCommon(nsString(), aNewlineTerminate);
|
||||
return WriteCommon(EmptyString(), aNewlineTerminate);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -260,7 +260,7 @@ void nsCSSScanner::OutputError()
|
|||
PRUnichar *error = ToNewUnicode(mError);
|
||||
rv = errorObject->Init(error,
|
||||
NS_ConvertASCIItoUCS2(mFileName.get()).get(),
|
||||
NS_LITERAL_STRING("").get(),
|
||||
EmptyString().get(),
|
||||
mErrorLineNumber,
|
||||
mErrorColNumber,
|
||||
0,
|
||||
|
|
|
@ -526,8 +526,8 @@ GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument,
|
|||
than going away. See bug 61840. */
|
||||
|
||||
if (mDocShell && aDocument) {
|
||||
SetStatus(nsString());
|
||||
SetDefaultStatus(nsString());
|
||||
SetStatus(EmptyString());
|
||||
SetDefaultStatus(EmptyString());
|
||||
}
|
||||
|
||||
if (mDocument) {
|
||||
|
|
|
@ -158,12 +158,12 @@ void TypeInState::Reset()
|
|||
|
||||
nsresult TypeInState::SetProp(nsIAtom *aProp)
|
||||
{
|
||||
return SetProp(aProp,nsAutoString(),nsAutoString());
|
||||
return SetProp(aProp,EmptyString(),EmptyString());
|
||||
}
|
||||
|
||||
nsresult TypeInState::SetProp(nsIAtom *aProp, const nsString &aAttr)
|
||||
{
|
||||
return SetProp(aProp,aAttr,nsAutoString());
|
||||
return SetProp(aProp,aAttr,EmptyString());
|
||||
}
|
||||
|
||||
nsresult TypeInState::SetProp(nsIAtom *aProp, const nsString &aAttr, const nsString &aValue)
|
||||
|
@ -209,12 +209,12 @@ nsresult TypeInState::SetProp(nsIAtom *aProp, const nsString &aAttr, const nsStr
|
|||
nsresult TypeInState::ClearAllProps()
|
||||
{
|
||||
// null prop means "all" props
|
||||
return ClearProp(nsnull,nsAutoString());
|
||||
return ClearProp(nsnull,EmptyString());
|
||||
}
|
||||
|
||||
nsresult TypeInState::ClearProp(nsIAtom *aProp)
|
||||
{
|
||||
return ClearProp(aProp,nsAutoString());
|
||||
return ClearProp(aProp,EmptyString());
|
||||
}
|
||||
|
||||
nsresult TypeInState::ClearProp(nsIAtom *aProp, const nsString &aAttr)
|
||||
|
@ -285,7 +285,7 @@ nsresult TypeInState::TakeRelativeFontSize(PRInt32 *outRelSize)
|
|||
|
||||
nsresult TypeInState::GetTypingState(PRBool &isSet, PRBool &theSetting, nsIAtom *aProp)
|
||||
{
|
||||
return GetTypingState(isSet, theSetting, aProp, nsAutoString(), nsnull);
|
||||
return GetTypingState(isSet, theSetting, aProp, EmptyString(), nsnull);
|
||||
}
|
||||
|
||||
nsresult TypeInState::GetTypingState(PRBool &isSet,
|
||||
|
|
|
@ -4303,7 +4303,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsISelection *aSelection, nsIDOMDocume
|
|||
}
|
||||
nsCOMPtr<nsIDOMNode> newNode;
|
||||
nsCOMPtr<nsIDOMText> nodeAsText;
|
||||
res = aDoc->CreateTextNode(nsAutoString(), getter_AddRefs(nodeAsText));
|
||||
res = aDoc->CreateTextNode(EmptyString(), getter_AddRefs(nodeAsText));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!nodeAsText) return NS_ERROR_NULL_POINTER;
|
||||
newNode = do_QueryInterface(nodeAsText);
|
||||
|
|
|
@ -2510,7 +2510,7 @@ nsHTMLEditor::GetHTMLBackgroundColorState(PRBool *aMixed, nsAString &aOutColor)
|
|||
//TODO: We don't handle "mixed" correctly!
|
||||
if (!aMixed) return NS_ERROR_NULL_POINTER;
|
||||
*aMixed = PR_FALSE;
|
||||
aOutColor.Assign(NS_LITERAL_STRING(""));
|
||||
aOutColor.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
PRInt32 selectedCount;
|
||||
|
@ -3312,7 +3312,7 @@ nsHTMLEditor::CreateElementWithDefaults(const nsAString& aTagName, nsIDOMElement
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Mark the new element dirty, so it will be formatted
|
||||
newElement->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), nsAutoString());
|
||||
newElement->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), EmptyString());
|
||||
|
||||
// Set default values for new elements
|
||||
if (TagName.Equals(NS_LITERAL_STRING("hr")))
|
||||
|
@ -6030,7 +6030,7 @@ nsHTMLEditor::GetSelectionContainer(nsIDOMElement ** aReturn)
|
|||
|
||||
nsCOMPtr<nsIDOMElement> focusElement;
|
||||
if (startContainer == endContainer && startOffset + 1 == endOffset) {
|
||||
res = GetSelectedElement(NS_LITERAL_STRING(""), getter_AddRefs(focusElement));
|
||||
res = GetSelectedElement(EmptyString(), getter_AddRefs(focusElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (focusElement)
|
||||
focusNode = do_QueryInterface(focusElement);
|
||||
|
|
|
@ -1501,7 +1501,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
|
|||
if (!CanContainTag(selectedNode, tag)) return NS_OK;
|
||||
|
||||
// manipulating text attributes on a collapsed selection only sets state for the next text insertion
|
||||
return mTypeInState->SetProp(atom, nsAutoString(), nsAutoString());
|
||||
return mTypeInState->SetProp(atom, EmptyString(), EmptyString());
|
||||
}
|
||||
|
||||
// wrap with txn batching, rules sniffing, and selection preservation code
|
||||
|
|
|
@ -1044,12 +1044,12 @@ nsHTMLEditor::SetFinalSize(PRInt32 aX, PRInt32 aY)
|
|||
if (setWidth)
|
||||
mHTMLCSSUtils->RemoveCSSProperty(mResizedObject,
|
||||
nsEditProperty::cssWidth,
|
||||
NS_LITERAL_STRING(""),
|
||||
EmptyString(),
|
||||
PR_FALSE);
|
||||
if (setHeight)
|
||||
mHTMLCSSUtils->RemoveCSSProperty(mResizedObject,
|
||||
nsEditProperty::cssHeight,
|
||||
NS_LITERAL_STRING(""),
|
||||
EmptyString(),
|
||||
PR_FALSE);
|
||||
}
|
||||
// finally notify the listeners if any
|
||||
|
|
|
@ -141,7 +141,7 @@ NS_METHOD CAppFileLocationProvider::GetAppDataDirectory(nsILocalFile **aLocalFil
|
|||
FSRef fsRef;
|
||||
err = ::FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &fsRef);
|
||||
if (err) return NS_ERROR_FAILURE;
|
||||
NS_NewLocalFile(nsString(), PR_TRUE, getter_AddRefs(localDir));
|
||||
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localDir));
|
||||
if (!localDir) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsILocalFileMac> localDirMac(do_QueryInterface(localDir));
|
||||
rv = localDirMac->InitWithFSRef(&fsRef);
|
||||
|
|
|
@ -1105,13 +1105,13 @@ NS_METHOD CBrowserShell::SaveDocument(ESaveFormat inSaveFormat)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return SaveInternal(documentURI, domDocument, nsString(), false, inSaveFormat); // don't bypass cache
|
||||
return SaveInternal(documentURI, domDocument, EmptyString(), false, inSaveFormat); // don't bypass cache
|
||||
}
|
||||
|
||||
// Save link target
|
||||
NS_METHOD CBrowserShell::SaveLink(nsIURI* inURI)
|
||||
{
|
||||
return SaveInternal(inURI, nsnull, nsString(), true, eSaveFormatHTML); // bypass cache
|
||||
return SaveInternal(inURI, nsnull, EmptyString(), true, eSaveFormatHTML); // bypass cache
|
||||
}
|
||||
|
||||
const char* const kPersistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1";
|
||||
|
|
|
@ -164,7 +164,7 @@ nsLDAPSyncQuery::OnLDAPInit(nsILDAPConnection *aConn, nsresult aStatus)
|
|||
|
||||
// kick off a bind operation
|
||||
//
|
||||
rv = mOperation->SimpleBind(nsCString());
|
||||
rv = mOperation->SimpleBind(EmptyCString());
|
||||
if (NS_FAILED(rv)) {
|
||||
FinishLDAPQuery();
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -423,7 +423,7 @@ nsresult nsLDAPSyncQuery::InitConnection()
|
|||
|
||||
rv = mConnection->Init(host.get(), port,
|
||||
(options & nsILDAPURL::OPT_SECURE)
|
||||
? PR_TRUE : PR_FALSE, nsCString(), selfProxy,
|
||||
? PR_TRUE : PR_FALSE, EmptyCString(), selfProxy,
|
||||
nsnull, mProtocolVersion);
|
||||
if (NS_FAILED(rv)) {
|
||||
FinishLDAPQuery();
|
||||
|
|
|
@ -520,7 +520,7 @@ nsresult
|
|||
myspAffixMgr::DecodeString(const nsAFlatCString &aSource, nsAString &aDest)
|
||||
{
|
||||
if (!mDecoder) {
|
||||
aDest.Assign(NS_LITERAL_STRING(""));
|
||||
aDest.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
PRInt32 inLength = aSource.Length();
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
//Construct an Attribute object using the specified name and document owner
|
||||
//
|
||||
Attr::Attr(const nsAString& name, Document* owner):
|
||||
NodeDefinition(Node::ATTRIBUTE_NODE, name, nsString(), owner)
|
||||
NodeDefinition(Node::ATTRIBUTE_NODE, name, EmptyString(), owner)
|
||||
{
|
||||
int idx = nodeName.FindChar(':');
|
||||
if (idx == kNotFound) {
|
||||
|
@ -78,7 +78,7 @@ Attr::Attr(const nsAString& name, Document* owner):
|
|||
Attr::Attr(const nsAString& aNamespaceURI,
|
||||
const nsAString& aName,
|
||||
Document* aOwner) :
|
||||
NodeDefinition(Node::ATTRIBUTE_NODE, aName, nsString(), aOwner)
|
||||
NodeDefinition(Node::ATTRIBUTE_NODE, aName, EmptyString(), aOwner)
|
||||
{
|
||||
if (aNamespaceURI.IsEmpty())
|
||||
mNamespaceID = kNameSpaceID_None;
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
//Construct a Document. Currently no parameters are required, but the the
|
||||
//node constructor is called to identify the node type.
|
||||
//
|
||||
Document::Document() : NodeDefinition(Node::DOCUMENT_NODE, nsString(), NULL)
|
||||
Document::Document() : NodeDefinition(Node::DOCUMENT_NODE, EmptyString(), NULL)
|
||||
{
|
||||
mIDMap.Init(0);
|
||||
documentElement = nsnull;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
//type.
|
||||
//
|
||||
Element::Element(const nsAString& tagName, Document* owner) :
|
||||
NodeDefinition(Node::ELEMENT_NODE, tagName, nsString(), owner)
|
||||
NodeDefinition(Node::ELEMENT_NODE, tagName, EmptyString(), owner)
|
||||
{
|
||||
mAttributes.ownerElement = this;
|
||||
mNamespaceID = kNameSpaceID_Unknown;
|
||||
|
@ -69,7 +69,7 @@ Element::Element(const nsAString& tagName, Document* owner) :
|
|||
Element::Element(const nsAString& aNamespaceURI,
|
||||
const nsAString& aTagName,
|
||||
Document* aOwner) :
|
||||
NodeDefinition(Node::ELEMENT_NODE, aTagName, nsString(), aOwner)
|
||||
NodeDefinition(Node::ELEMENT_NODE, aTagName, EmptyString(), aOwner)
|
||||
{
|
||||
Element(aTagName, aOwner);
|
||||
if (aNamespaceURI.IsEmpty())
|
||||
|
|
|
@ -372,7 +372,7 @@ class DocumentFragment : public NodeDefinition
|
|||
private:
|
||||
friend class Document;
|
||||
DocumentFragment(Document* aOwner) :
|
||||
NodeDefinition(Node::DOCUMENT_FRAGMENT_NODE, nsString(), aOwner)
|
||||
NodeDefinition(Node::DOCUMENT_FRAGMENT_NODE, EmptyString(), aOwner)
|
||||
{
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,369 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txHTMLOutput.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsStaticNameTable.h"
|
||||
#include "txAtoms.h"
|
||||
#include "txOutputFormat.h"
|
||||
#include "txStringUtils.h"
|
||||
#include "XMLUtils.h"
|
||||
|
||||
#define EMPTY_ELEMENTS_COUNT 13
|
||||
const char* const kHTMLEmptyTags[] =
|
||||
{
|
||||
"area",
|
||||
"base",
|
||||
"basefont",
|
||||
"br",
|
||||
"col",
|
||||
"frame",
|
||||
"hr",
|
||||
"img",
|
||||
"input",
|
||||
"isindex",
|
||||
"link",
|
||||
"meta",
|
||||
"param"
|
||||
};
|
||||
|
||||
#define SHORTHAND_ATTR_COUNT 12
|
||||
const char* const kHTMLEmptyAttributes[] =
|
||||
{
|
||||
"checked",
|
||||
"compact",
|
||||
"declare",
|
||||
"defer",
|
||||
"disabled",
|
||||
"ismap",
|
||||
"multiple",
|
||||
"noresize",
|
||||
"noshade",
|
||||
"nowrap",
|
||||
"readonly",
|
||||
"selected"
|
||||
};
|
||||
|
||||
struct txEmptyAttributesMaps
|
||||
{
|
||||
typedef nsCOMArray<nsIAtom> EmptyAttrBag;
|
||||
EmptyAttrBag mMaps[SHORTHAND_ATTR_COUNT];
|
||||
};
|
||||
|
||||
static PRInt32 gTableRefCount;
|
||||
static nsStaticCaseInsensitiveNameTable* gHTMLEmptyTagsTable;
|
||||
static nsStaticCaseInsensitiveNameTable* gHTMLEmptyAttributesTable;
|
||||
static txEmptyAttributesMaps* gHTMLEmptyAttributesMaps;
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
txHTMLOutput::init()
|
||||
{
|
||||
if (0 == gTableRefCount++) {
|
||||
NS_ASSERTION(!gHTMLEmptyTagsTable, "pre existing array!");
|
||||
gHTMLEmptyTagsTable = new nsStaticCaseInsensitiveNameTable();
|
||||
if (!gHTMLEmptyTagsTable) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
gHTMLEmptyTagsTable->Init(kHTMLEmptyTags, EMPTY_ELEMENTS_COUNT);
|
||||
|
||||
NS_ASSERTION(!gHTMLEmptyAttributesTable, "pre existing array!");
|
||||
gHTMLEmptyAttributesTable = new nsStaticCaseInsensitiveNameTable();
|
||||
if (!gHTMLEmptyAttributesTable) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
gHTMLEmptyAttributesTable->Init(kHTMLEmptyAttributes,
|
||||
SHORTHAND_ATTR_COUNT);
|
||||
|
||||
NS_ASSERTION(!gHTMLEmptyAttributesMaps, "pre existing map!");
|
||||
gHTMLEmptyAttributesMaps = new txEmptyAttributesMaps();
|
||||
if (!gHTMLEmptyAttributesMaps) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// checked
|
||||
gHTMLEmptyAttributesMaps->mMaps[0].AppendObject(txHTMLAtoms::input);
|
||||
|
||||
// compact
|
||||
gHTMLEmptyAttributesMaps->mMaps[1].AppendObject(txHTMLAtoms::dir);
|
||||
gHTMLEmptyAttributesMaps->mMaps[1].AppendObject(txHTMLAtoms::dl);
|
||||
gHTMLEmptyAttributesMaps->mMaps[1].AppendObject(txHTMLAtoms::menu);
|
||||
gHTMLEmptyAttributesMaps->mMaps[1].AppendObject(txHTMLAtoms::ol);
|
||||
gHTMLEmptyAttributesMaps->mMaps[1].AppendObject(txHTMLAtoms::ul);
|
||||
|
||||
// declare
|
||||
gHTMLEmptyAttributesMaps->mMaps[2].AppendObject(txHTMLAtoms::object);
|
||||
|
||||
// defer
|
||||
gHTMLEmptyAttributesMaps->mMaps[3].AppendObject(txHTMLAtoms::script);
|
||||
|
||||
// disabled
|
||||
gHTMLEmptyAttributesMaps->mMaps[4].AppendObject(txHTMLAtoms::button);
|
||||
gHTMLEmptyAttributesMaps->mMaps[4].AppendObject(txHTMLAtoms::input);
|
||||
gHTMLEmptyAttributesMaps->mMaps[4].AppendObject(txHTMLAtoms::optgroup);
|
||||
gHTMLEmptyAttributesMaps->mMaps[4].AppendObject(txHTMLAtoms::option);
|
||||
gHTMLEmptyAttributesMaps->mMaps[4].AppendObject(txHTMLAtoms::select);
|
||||
gHTMLEmptyAttributesMaps->mMaps[4].AppendObject(txHTMLAtoms::textarea);
|
||||
|
||||
// ismap
|
||||
gHTMLEmptyAttributesMaps->mMaps[5].AppendObject(txHTMLAtoms::img);
|
||||
gHTMLEmptyAttributesMaps->mMaps[5].AppendObject(txHTMLAtoms::input);
|
||||
|
||||
// multiple
|
||||
gHTMLEmptyAttributesMaps->mMaps[6].AppendObject(txHTMLAtoms::select);
|
||||
|
||||
// noresize
|
||||
gHTMLEmptyAttributesMaps->mMaps[7].AppendObject(txHTMLAtoms::frame);
|
||||
|
||||
// noshade
|
||||
gHTMLEmptyAttributesMaps->mMaps[8].AppendObject(txHTMLAtoms::hr);
|
||||
|
||||
// nowrap
|
||||
gHTMLEmptyAttributesMaps->mMaps[9].AppendObject(txHTMLAtoms::td);
|
||||
gHTMLEmptyAttributesMaps->mMaps[9].AppendObject(txHTMLAtoms::th);
|
||||
|
||||
// readonly
|
||||
gHTMLEmptyAttributesMaps->mMaps[10].AppendObject(txHTMLAtoms::input);
|
||||
gHTMLEmptyAttributesMaps->mMaps[10].AppendObject(txHTMLAtoms::textarea);
|
||||
|
||||
// selected
|
||||
gHTMLEmptyAttributesMaps->mMaps[11].AppendObject(txHTMLAtoms::option);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
txHTMLOutput::shutdown()
|
||||
{
|
||||
if (0 == --gTableRefCount) {
|
||||
if (gHTMLEmptyTagsTable) {
|
||||
delete gHTMLEmptyTagsTable;
|
||||
gHTMLEmptyTagsTable = nsnull;
|
||||
}
|
||||
if (gHTMLEmptyAttributesTable) {
|
||||
delete gHTMLEmptyAttributesTable;
|
||||
gHTMLEmptyAttributesTable = nsnull;
|
||||
}
|
||||
if (gHTMLEmptyAttributesMaps) {
|
||||
delete gHTMLEmptyAttributesMaps;
|
||||
gHTMLEmptyAttributesMaps = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
txHTMLOutput::txHTMLOutput(txOutputFormat* aFormat, ostream* aOut)
|
||||
: txXMLOutput(aFormat, aOut)
|
||||
{
|
||||
mUseEmptyElementShorthand = PR_FALSE;
|
||||
}
|
||||
|
||||
txHTMLOutput::~txHTMLOutput()
|
||||
{
|
||||
}
|
||||
|
||||
void txHTMLOutput::attribute(const nsAString& aName,
|
||||
const PRInt32 aNsID,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
if (!mStartTagOpen)
|
||||
// XXX Signal this? (can't add attributes after element closed)
|
||||
return;
|
||||
|
||||
MBool shortHand = MB_FALSE;
|
||||
if (aNsID == kNameSpaceID_None) {
|
||||
const nsAString& localPart = XMLUtils::getLocalPart(aName);
|
||||
shortHand = isShorthandAttribute(localPart);
|
||||
if (shortHand &&
|
||||
localPart.Equals(aValue, txCaseInsensitiveStringComparator())) {
|
||||
txListIterator iter(&mAttributes);
|
||||
txOutAttr* setAtt = 0;
|
||||
nsCOMPtr<nsIAtom> localName = do_GetAtom(localPart);
|
||||
txExpandedName att(aNsID, localName);
|
||||
while ((setAtt = (txOutAttr*)iter.next())) {
|
||||
if (setAtt->mName == att) {
|
||||
setAtt->mShorthand = MB_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!setAtt) {
|
||||
setAtt = new txOutAttr(aNsID, localName, nsString());
|
||||
setAtt->mShorthand = MB_TRUE;
|
||||
mAttributes.add(setAtt);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!shortHand)
|
||||
txXMLOutput::attribute(aName, aNsID, aValue);
|
||||
}
|
||||
|
||||
void txHTMLOutput::characters(const nsAString& aData, PRBool aDOE)
|
||||
{
|
||||
if (aDOE) {
|
||||
closeStartTag(MB_FALSE);
|
||||
printUTF8Chars(aData);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Special-case script and style
|
||||
if (!mCurrentElements.isEmpty()) {
|
||||
txExpandedName* currentElement = (txExpandedName*)mCurrentElements.peek();
|
||||
if (currentElement->mNamespaceID == kNameSpaceID_None &&
|
||||
(currentElement->mLocalName == txHTMLAtoms::script ||
|
||||
currentElement->mLocalName == txHTMLAtoms::style)) {
|
||||
closeStartTag(MB_FALSE);
|
||||
printUTF8Chars(aData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
txXMLOutput::characters(aData, aDOE);
|
||||
}
|
||||
|
||||
void txHTMLOutput::endElement(const nsAString& aName,
|
||||
const PRInt32 aNsID)
|
||||
{
|
||||
const nsAString& localPart = XMLUtils::getLocalPart(aName);
|
||||
if ((aNsID == kNameSpaceID_None) && isShorthandElement(localPart) &&
|
||||
mStartTagOpen) {
|
||||
MBool newLine = (mOutputFormat.mIndent == eTrue) &&
|
||||
mAfterEndTag;
|
||||
closeStartTag(MB_FALSE);
|
||||
if (newLine)
|
||||
*mOut << endl;
|
||||
if (mOutputFormat.mIndent == eTrue)
|
||||
mIndentLevel -= DEFAULT_INDENT;
|
||||
mAfterEndTag = MB_TRUE;
|
||||
}
|
||||
else {
|
||||
txXMLOutput::endElement(aName, aNsID);
|
||||
}
|
||||
delete (txExpandedName*)mCurrentElements.pop();
|
||||
}
|
||||
|
||||
void txHTMLOutput::processingInstruction(const nsAString& aTarget,
|
||||
const nsAString& aData)
|
||||
{
|
||||
closeStartTag(MB_FALSE);
|
||||
if (mOutputFormat.mIndent == eTrue) {
|
||||
for (PRUint32 i = 0; i < mIndentLevel; i++)
|
||||
*mOut << ' ';
|
||||
}
|
||||
*mOut << PI_START;
|
||||
printUTF8Chars(aTarget);
|
||||
*mOut << SPACE;
|
||||
printUTF8Chars(aData);
|
||||
*mOut << R_ANGLE_BRACKET;
|
||||
if (mOutputFormat.mIndent == eTrue)
|
||||
*mOut << endl;
|
||||
}
|
||||
|
||||
void txHTMLOutput::startDocument()
|
||||
{
|
||||
// XXX Should be using mOutputFormat.getVersion
|
||||
*mOut << DOCTYPE_START << "html " << PUBLIC;
|
||||
*mOut << " \"-//W3C//DTD HTML 4.0 Transitional//EN\"";
|
||||
*mOut << " \"http://www.w3.org/TR/REC-html40/loose.dtd\"";
|
||||
*mOut << DOCTYPE_END << endl;
|
||||
}
|
||||
|
||||
void txHTMLOutput::startElement(const nsAString& aName,
|
||||
const PRInt32 aNsID)
|
||||
{
|
||||
txXMLOutput::startElement(aName, aNsID);
|
||||
|
||||
nsCOMPtr<nsIAtom> localAtom;
|
||||
if (aNsID == kNameSpaceID_None) {
|
||||
nsAutoString localName;
|
||||
TX_ToLowerCase(aName, localName);
|
||||
localAtom = do_GetAtom(localName);
|
||||
}
|
||||
else {
|
||||
localAtom = do_GetAtom(aName);
|
||||
}
|
||||
NS_ASSERTION(localAtom, "Can't get atom");
|
||||
txExpandedName* currentElement = new txExpandedName(aNsID, localAtom);
|
||||
NS_ASSERTION(currentElement, "Can't create currentElement");
|
||||
if (currentElement)
|
||||
mCurrentElements.push(currentElement);
|
||||
}
|
||||
|
||||
void txHTMLOutput::closeStartTag(MBool aUseEmptyElementShorthand)
|
||||
{
|
||||
txExpandedName* currentElement = mCurrentElements.isEmpty() ?
|
||||
nsnull : (txExpandedName*)mCurrentElements.peek();
|
||||
if (mStartTagOpen && currentElement &&
|
||||
(currentElement->mNamespaceID == kNameSpaceID_None) &&
|
||||
(currentElement->mLocalName == txHTMLAtoms::head)) {
|
||||
txXMLOutput::closeStartTag(MB_FALSE);
|
||||
if (mOutputFormat.mIndent == eTrue) {
|
||||
*mOut << endl;
|
||||
for (PRUint32 i = 0; i < mIndentLevel; i++)
|
||||
*mOut << ' ';
|
||||
}
|
||||
*mOut << LT << "meta http-equiv=" << QUOTE << "Content-Type" << QUOTE;
|
||||
*mOut << " content=" << QUOTE;
|
||||
printUTF8Chars(mOutputFormat.mMediaType);
|
||||
*mOut << "; charset=";
|
||||
printUTF8Chars(mOutputFormat.mEncoding);
|
||||
*mOut << QUOTE << GT;
|
||||
}
|
||||
else {
|
||||
txXMLOutput::closeStartTag(aUseEmptyElementShorthand);
|
||||
}
|
||||
}
|
||||
|
||||
MBool txHTMLOutput::isShorthandElement(const nsAString& aLocalName)
|
||||
{
|
||||
return (gHTMLEmptyTagsTable->Lookup(aLocalName) !=
|
||||
nsStaticCaseInsensitiveNameTable::NOT_FOUND);
|
||||
}
|
||||
|
||||
MBool txHTMLOutput::isShorthandAttribute(const nsAString& aLocalName)
|
||||
{
|
||||
PRInt32 index = gHTMLEmptyTagsTable->Lookup(aLocalName);
|
||||
if (index == nsStaticCaseInsensitiveNameTable::NOT_FOUND) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
txExpandedName* currentElement = (txExpandedName*)mCurrentElements.peek();
|
||||
return (gHTMLEmptyAttributesMaps->mMaps[index].IndexOf(currentElement->mLocalName) > -1);
|
||||
}
|
|
@ -958,7 +958,7 @@ txStartElement::execute(txExecutionState& aEs)
|
|||
else {
|
||||
// we call characters with an empty string to "close" any element to
|
||||
// make sure that no attributes are added
|
||||
aEs.mResultHandler->characters(nsString(), PR_FALSE);
|
||||
aEs.mResultHandler->characters(EmptyString(), PR_FALSE);
|
||||
}
|
||||
|
||||
rv = aEs.pushString(name);
|
||||
|
|
|
@ -66,7 +66,7 @@ txMozillaTextOutput::txMozillaTextOutput(nsIDOMDocumentFragment* aDest)
|
|||
aDest->GetOwnerDocument(getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "unable to get ownerdocument");
|
||||
nsCOMPtr<nsIDOMText> textNode;
|
||||
nsresult rv = doc->CreateTextNode(nsString(),
|
||||
nsresult rv = doc->CreateTextNode(EmptyString(),
|
||||
getter_AddRefs(textNode));
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
|
@ -165,7 +165,7 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
|||
|
||||
nsCOMPtr<nsIDOMNSDocument> nsDoc = do_QueryInterface(mDocument);
|
||||
if (nsDoc) {
|
||||
nsDoc->SetTitle(nsString());
|
||||
nsDoc->SetTitle(EmptyString());
|
||||
}
|
||||
|
||||
// Reset and set up document
|
||||
|
@ -293,7 +293,7 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMText> textNode;
|
||||
mDocument->CreateTextNode(nsString(),
|
||||
mDocument->CreateTextNode(EmptyString(),
|
||||
getter_AddRefs(textNode));
|
||||
NS_ASSERTION(textNode, "Failed to create the text node");
|
||||
if (!textNode) {
|
||||
|
|
|
@ -155,7 +155,7 @@ void txMozillaXMLOutput::attribute(const nsAString& aName,
|
|||
// Outputting HTML as XHTML, lowercase attribute names
|
||||
nsAutoString lowerName;
|
||||
TX_ToLowerCase(aName, lowerName);
|
||||
element->SetAttributeNS(nsString(), lowerName,
|
||||
element->SetAttributeNS(EmptyString(), lowerName,
|
||||
aValue);
|
||||
}
|
||||
else {
|
||||
|
@ -202,7 +202,7 @@ void txMozillaXMLOutput::endDocument()
|
|||
if (mCreatingNewDocument && !mHaveTitleElement) {
|
||||
nsCOMPtr<nsIDOMNSDocument> domDoc = do_QueryInterface(mDocument);
|
||||
if (domDoc) {
|
||||
domDoc->SetTitle(nsString());
|
||||
domDoc->SetTitle(EmptyString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -688,7 +688,7 @@ txMozillaXSLTProcessor::reportError(nsresult aResult,
|
|||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
if (sbs) {
|
||||
nsXPIDLString errorText;
|
||||
sbs->FormatStatusMessage(aResult, nsString().get(),
|
||||
sbs->FormatStatusMessage(aResult, EmptyString().get(),
|
||||
getter_Copies(errorText));
|
||||
|
||||
nsXPIDLString errorMessage;
|
||||
|
|
|
@ -65,7 +65,7 @@ void txUnknownHandler::endDocument()
|
|||
// didn't create a document element. Switching to XML output mode
|
||||
// anyway.
|
||||
|
||||
nsresult rv = createHandlerAndFlush(eXMLOutput, nsString(),
|
||||
nsresult rv = createHandlerAndFlush(eXMLOutput, EmptyString(),
|
||||
kNameSpaceID_None);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
|
|
@ -121,7 +121,7 @@ mozLineTerm::mozLineTerm() :
|
|||
mSuspended(PR_FALSE),
|
||||
mEchoFlag(PR_TRUE),
|
||||
mObserver(nsnull),
|
||||
mCookie(nsAutoString()),
|
||||
mCookie(EmptyString()),
|
||||
mLastTime(LL_ZERO)
|
||||
{
|
||||
mLTerm = lterm_new();
|
||||
|
|
|
@ -102,12 +102,12 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(mozXMLTerminal,
|
|||
mozXMLTerminal::mozXMLTerminal() :
|
||||
mInitialized(PR_FALSE),
|
||||
|
||||
mCookie(nsAutoString()),
|
||||
mCookie(EmptyString()),
|
||||
|
||||
mCommand(nsAutoString()),
|
||||
mPromptExpr(nsAutoString()),
|
||||
mCommand(EmptyString()),
|
||||
mPromptExpr(EmptyString()),
|
||||
|
||||
mInitInput(nsAutoString()),
|
||||
mInitInput(EmptyString()),
|
||||
|
||||
mXMLTermShell(nsnull),
|
||||
mDocShell(nsnull),
|
||||
|
|
|
@ -78,7 +78,7 @@ void
|
|||
nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify)
|
||||
{
|
||||
if (aDisabled)
|
||||
mFrame->GetContent()->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, nsString(),
|
||||
mFrame->GetContent()->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, EmptyString(),
|
||||
notify);
|
||||
else
|
||||
mFrame->GetContent()->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, notify);
|
||||
|
|
|
@ -78,7 +78,7 @@ void
|
|||
nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify)
|
||||
{
|
||||
if (aDisabled)
|
||||
mFrame->GetContent()->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, nsString(),
|
||||
mFrame->GetContent()->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, EmptyString(),
|
||||
notify);
|
||||
else
|
||||
mFrame->GetContent()->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, notify);
|
||||
|
|
|
@ -260,7 +260,7 @@ void nsCSSScanner::OutputError()
|
|||
PRUnichar *error = ToNewUnicode(mError);
|
||||
rv = errorObject->Init(error,
|
||||
NS_ConvertASCIItoUCS2(mFileName.get()).get(),
|
||||
NS_LITERAL_STRING("").get(),
|
||||
EmptyString().get(),
|
||||
mErrorLineNumber,
|
||||
mErrorColNumber,
|
||||
0,
|
||||
|
|
|
@ -503,7 +503,7 @@ nsSplitterFrameInner::MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent)
|
|||
State newState = GetState();
|
||||
// if the state is dragging then make it Open.
|
||||
if (newState == Dragging)
|
||||
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, nsAutoString(), PR_TRUE);
|
||||
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, EmptyString(), PR_TRUE);
|
||||
|
||||
mPressed = PR_FALSE;
|
||||
|
||||
|
|
|
@ -1810,7 +1810,7 @@ nsMsgIncomingServer::GetPasswordPromptRequired(PRBool *aPasswordIsRequired)
|
|||
nsAutoString passwordFound;
|
||||
|
||||
// Get password entry corresponding to the host URI we are passing in.
|
||||
rv = passwordMgrInt->FindPasswordEntry(currServerUri, nsString(), nsString(),
|
||||
rv = passwordMgrInt->FindPasswordEntry(currServerUri, EmptyString(), EmptyString(),
|
||||
hostFound, userNameFound, passwordFound);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ nsresult RecursiveCopy(nsIFile* srcDir, nsIFile* destDir)
|
|||
}
|
||||
}
|
||||
else
|
||||
rv = dirEntry->CopyTo(destDir, nsString());
|
||||
rv = dirEntry->CopyTo(destDir, EmptyString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ LocateSpoolFile(nsACString & spoolPath)
|
|||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsILocalFile> spoolFile;
|
||||
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(spoolFile));
|
||||
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(spoolFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
char * mailEnv = PR_GetEnv("MAIL");
|
||||
|
|
|
@ -158,7 +158,7 @@ NS_IMETHODIMP nsNoIncomingServer::CopyDefaultMessages(const char *folderNameOnDi
|
|||
#ifdef DEBUG_sspitzer
|
||||
printf("copy default %s\n",folderNameOnDisk);
|
||||
#endif
|
||||
rv = defaultMessagesFile->CopyTo(localParentDir, nsString());
|
||||
rv = defaultMessagesFile->CopyTo(localParentDir, EmptyString());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -313,7 +313,7 @@ NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID &
|
|||
return rv;
|
||||
|
||||
nsCOMPtr<nsILocalFile> theFile;
|
||||
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(theFile));
|
||||
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(theFile));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = theFile->SetRelativeDescriptor(fromFile, Substring(++keyEnd, strEnd));
|
||||
|
|
|
@ -211,7 +211,7 @@ nsJVMAuthTools::SetAuthenticationInfo(const char* protocol,
|
|||
schemeString,
|
||||
realmString,
|
||||
EmptyCString(),
|
||||
nsString(),
|
||||
EmptyString(),
|
||||
NS_ConvertUTF8toUCS2(username),
|
||||
NS_ConvertUTF8toUCS2(password));
|
||||
return rv;
|
||||
|
|
|
@ -615,8 +615,8 @@ nsJVMConfigManagerUnix::AddDirectory(nsAString& aHomeDirName)
|
|||
nsJVMConfig* config = NS_STATIC_CAST(nsJVMConfig *,
|
||||
mJVMConfigList.Get(&key));
|
||||
if (!config) {
|
||||
config = new nsJVMConfig(version, type, nsString(), arch, path,
|
||||
mozPluginPath, nsString());
|
||||
config = new nsJVMConfig(version, type, EmptyString(), arch, path,
|
||||
mozPluginPath, EmptyString());
|
||||
NS_ENSURE_TRUE(config, NS_ERROR_OUT_OF_MEMORY);
|
||||
mJVMConfigList.Put(&key, NS_STATIC_CAST(void *, config));
|
||||
NS_ADDREF(config);
|
||||
|
|
|
@ -1063,7 +1063,7 @@ nsDiskCacheDevice::MoveCacheToTrash(nsIFile ** result)
|
|||
rv = mCacheDirectory->GetParent(getter_AddRefs(parentDir));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mCacheDirectory->MoveToNative(uniqueDir, nsCString());
|
||||
rv = mCacheDirectory->MoveToNative(uniqueDir, EmptyCString());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// set mCacheDirectory to point to parentDir/Cache/ again
|
||||
|
|
|
@ -217,7 +217,7 @@ nsresult RecursiveCopy(nsIFile* srcDir, nsIFile* destDir)
|
|||
}
|
||||
}
|
||||
else
|
||||
rv = dirEntry->CopyToNative(destDir, nsCString());
|
||||
rv = dirEntry->CopyToNative(destDir, EmptyCString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1442,7 +1442,7 @@ nsresult ProfileStruct::InternalizeLocation(nsIRegistry *aRegistry, nsRegistryKe
|
|||
CFURLRef pathURLRef = ::CFURLCreateWithFileSystemPath(NULL, pathStrRef, kCFURLHFSPathStyle, true);
|
||||
if (pathURLRef)
|
||||
{
|
||||
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(tempLocal));
|
||||
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(tempLocal));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsILocalFileMac> tempLocalMac(do_QueryInterface(tempLocal));
|
||||
|
@ -1467,7 +1467,7 @@ nsresult ProfileStruct::InternalizeLocation(nsIRegistry *aRegistry, nsRegistryKe
|
|||
regLocationData = regData;
|
||||
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(tempLocal));
|
||||
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(tempLocal));
|
||||
if (NS_SUCCEEDED(rv)) // regLocationData is ASCII so no loss
|
||||
rv = tempLocal->SetPersistentDescriptor(NS_LossyConvertUCS2toASCII(regLocationData));
|
||||
#else
|
||||
|
|
|
@ -1653,7 +1653,7 @@ nsBrowserWindow::CreateStatusBar(PRInt32 aWidth)
|
|||
{
|
||||
widget->SetForegroundColor(NS_RGB(0, 0, 0));
|
||||
PRUint32 size;
|
||||
mStatus->SetText(nsAutoString(),size);
|
||||
mStatus->SetText(EmptyString(),size);
|
||||
mStatus->SetMaxTextLength(MAX_TEXT_LENGTH);
|
||||
|
||||
nsITextWidget* textWidget = nsnull;
|
||||
|
|
|
@ -1418,7 +1418,7 @@ PRBool CreateSiteDialog(nsIWidget * aParent)
|
|||
#endif
|
||||
NS_CreateLabel(mSiteDialog,mSiteLabel,rect,HandleSiteEvent,&font);
|
||||
mSiteLabel->SetAlignment(eAlign_Left);
|
||||
mSiteLabel->SetLabel(nsAutoString());
|
||||
mSiteLabel->SetLabel(EmptyString());
|
||||
|
||||
y += 34;
|
||||
w = 75;
|
||||
|
|
|
@ -756,7 +756,7 @@ GetOSXFolderType(short aDomain, OSType aFolderType, nsILocalFile **localFile)
|
|||
err = ::FSFindFolder(aDomain, aFolderType, kCreateFolder, &fsRef);
|
||||
if (err == noErr)
|
||||
{
|
||||
NS_NewLocalFile(nsString(), PR_TRUE, localFile);
|
||||
NS_NewLocalFile(EmptyString(), PR_TRUE, localFile);
|
||||
nsCOMPtr<nsILocalFileMac> localMacFile(do_QueryInterface(*localFile));
|
||||
if (localMacFile)
|
||||
rv = localMacFile->InitWithFSRef(&fsRef);
|
||||
|
|
|
@ -353,7 +353,7 @@ NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsILocalFile **aLocalFi
|
|||
FSRef fsRef;
|
||||
OSErr err = ::FSFindFolder(kUserDomain, kDomainLibraryFolderType, kCreateFolder, &fsRef);
|
||||
if (err) return NS_ERROR_FAILURE;
|
||||
NS_NewLocalFile(nsString(), PR_TRUE, getter_AddRefs(localDir));
|
||||
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localDir));
|
||||
if (!localDir) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsILocalFileMac> localDirMac(do_QueryInterface(localDir));
|
||||
rv = localDirMac->InitWithFSRef(&fsRef);
|
||||
|
|
|
@ -878,7 +878,7 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret
|
|||
}
|
||||
else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory)
|
||||
{
|
||||
NS_NewLocalFile(nsString(), PR_TRUE, getter_AddRefs(localFile));
|
||||
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localFile));
|
||||
nsCOMPtr<nsILocalFileMac> localMacFile(do_QueryInterface(localFile));
|
||||
|
||||
if (localMacFile)
|
||||
|
|
|
@ -634,7 +634,7 @@ nsLocalFile::CopyDirectoryTo(nsIFile *newParent)
|
|||
if NS_FAILED((rv = IsDirectory(&dirCheck)))
|
||||
return rv;
|
||||
if (!dirCheck)
|
||||
return CopyToNative(newParent, nsCString());
|
||||
return CopyToNative(newParent, EmptyCString());
|
||||
|
||||
if (NS_FAILED(rv = Equals(newParent, &dirCheck)))
|
||||
return rv;
|
||||
|
@ -684,7 +684,7 @@ nsLocalFile::CopyDirectoryTo(nsIFile *newParent)
|
|||
rv = newParent->Clone(getter_AddRefs(destClone));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsILocalFile> newDir(do_QueryInterface(destClone));
|
||||
if (NS_FAILED(rv = entry->CopyToNative(newDir, nsCString()))) {
|
||||
if (NS_FAILED(rv = entry->CopyToNative(newDir, EmptyCString()))) {
|
||||
#ifdef DEBUG
|
||||
nsresult rv2;
|
||||
nsCAutoString pathName;
|
||||
|
@ -698,7 +698,7 @@ nsLocalFile::CopyDirectoryTo(nsIFile *newParent)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (NS_FAILED(rv = entry->CopyToNative(newParent, nsCString()))) {
|
||||
if (NS_FAILED(rv = entry->CopyToNative(newParent, EmptyCString()))) {
|
||||
#ifdef DEBUG
|
||||
nsresult rv2;
|
||||
nsCAutoString pathName;
|
||||
|
|
|
@ -76,7 +76,7 @@ CurrentAppDirMatchesPersistentDescriptor(xptiInterfaceInfoManager* aMgr,
|
|||
aMgr->GetApplicationDir(getter_AddRefs(appDir));
|
||||
|
||||
nsCOMPtr<nsILocalFile> descDir;
|
||||
nsresult rv = NS_NewNativeLocalFile(nsCString(), PR_FALSE, getter_AddRefs(descDir));
|
||||
nsresult rv = NS_NewNativeLocalFile(EmptyCString(), PR_FALSE, getter_AddRefs(descDir));
|
||||
if(NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ PRBool xptiWorkingSet::DirectoryAtMatchesPersistentDescriptor(PRUint32 i,
|
|||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsILocalFile> descDir;
|
||||
nsresult rv = NS_NewNativeLocalFile(nsCString(), PR_FALSE, getter_AddRefs(descDir));
|
||||
nsresult rv = NS_NewNativeLocalFile(EmptyCString(), PR_FALSE, getter_AddRefs(descDir));
|
||||
if(NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ CopyTest(const char *testFile, const char *targetDir)
|
|||
rv = dir->InitWithNativePath(nsDependentCString(targetDir));
|
||||
VerifyResult(rv);
|
||||
|
||||
rv = file->CopyTo(dir, nsString());
|
||||
rv = file->CopyTo(dir, EmptyString());
|
||||
VerifyResult(rv);
|
||||
|
||||
printf("end copy test\n");
|
||||
|
|
|
@ -1210,7 +1210,7 @@ nsAppShellService::LaunchTask(const char *aParam, PRInt32 height, PRInt32 width,
|
|||
|
||||
}
|
||||
else {
|
||||
rv = OpenWindow(chromeUrlForTask, nsString(), width, height);
|
||||
rv = OpenWindow(chromeUrlForTask, EmptyString(), width, height);
|
||||
}
|
||||
|
||||
// If we get here without an error, then a window was opened OK.
|
||||
|
|
|
@ -2754,7 +2754,7 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea
|
|||
|
||||
// look for query option which is the string the user is searching for
|
||||
nsAutoString userVar, inputUnused;
|
||||
if (NS_FAILED(rv = GetInputs(dataUni, userVar, nsAutoString(), inputUnused, 0, 0, 0))) return(rv);
|
||||
if (NS_FAILED(rv = GetInputs(dataUni, userVar, EmptyString(), inputUnused, 0, 0, 0))) return(rv);
|
||||
if (userVar.IsEmpty()) return(NS_RDF_NO_VALUE);
|
||||
|
||||
nsAutoString queryStr;
|
||||
|
@ -2879,7 +2879,7 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea
|
|||
ClearResults(PR_FALSE);
|
||||
|
||||
// do the search
|
||||
DoSearch(nsnull, engine, searchURL, nsAutoString());
|
||||
DoSearch(nsnull, engine, searchURL, EmptyString());
|
||||
|
||||
*searchInProgress = PR_TRUE;
|
||||
}
|
||||
|
@ -3206,7 +3206,7 @@ InternetSearchDataSource::BeginSearchRequest(nsIRDFResource *source, PRBool doNe
|
|||
|
||||
if (doNetworkRequest)
|
||||
{
|
||||
DoSearch(source, engine, nsAutoString(), text);
|
||||
DoSearch(source, engine, EmptyString(), text);
|
||||
requestInitiated = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ nsInstall::AddDirectory(const nsString& aRegName,
|
|||
PRInt32* aReturn)
|
||||
{
|
||||
return AddDirectory(aRegName,
|
||||
nsAutoString(),
|
||||
EmptyString(),
|
||||
aJarSource,
|
||||
aFolder,
|
||||
aSubdir,
|
||||
|
@ -565,11 +565,11 @@ nsInstall::AddDirectory(const nsString& aJarSource,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
return AddDirectory(nsAutoString(),
|
||||
nsAutoString(),
|
||||
return AddDirectory(EmptyString(),
|
||||
EmptyString(),
|
||||
aJarSource,
|
||||
mPackageFolder,
|
||||
nsAutoString(),
|
||||
EmptyString(),
|
||||
INSTALL_NO_COMPARE,
|
||||
aReturn);
|
||||
}
|
||||
|
@ -740,11 +740,11 @@ nsInstall::AddSubcomponent(const nsString& aJarSource,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
return AddSubcomponent(nsAutoString(),
|
||||
return AddSubcomponent(EmptyString(),
|
||||
version,
|
||||
aJarSource,
|
||||
mPackageFolder,
|
||||
nsAutoString(),
|
||||
EmptyString(),
|
||||
INSTALL_NO_COMPARE,
|
||||
aReturn);
|
||||
}
|
||||
|
@ -1032,7 +1032,7 @@ nsInstall::GetComponentFolder(const nsString& aComponentName, const nsString& aS
|
|||
PRInt32
|
||||
nsInstall::GetComponentFolder(const nsString& aComponentName, nsInstallFolder** aNewFolder)
|
||||
{
|
||||
return GetComponentFolder(aComponentName, nsAutoString(), aNewFolder);
|
||||
return GetComponentFolder(aComponentName, EmptyString(), aNewFolder);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -1064,7 +1064,7 @@ PRInt32
|
|||
nsInstall::GetFolder(const nsString& targetFolder, nsInstallFolder** aNewFolder)
|
||||
{
|
||||
/* This version of GetFolder takes an nsString object as the only param */
|
||||
return GetFolder(targetFolder, nsAutoString(), aNewFolder);
|
||||
return GetFolder(targetFolder, EmptyString(), aNewFolder);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -1348,7 +1348,7 @@ nsInstall::Patch(const nsString& aRegName, const nsString& aVersion, const nsStr
|
|||
PRInt32
|
||||
nsInstall::Patch(const nsString& aRegName, const nsString& aJarSource, nsInstallFolder* aFolder, const nsString& aTargetName, PRInt32* aReturn)
|
||||
{
|
||||
return Patch(aRegName, nsAutoString(), aJarSource, aFolder, aTargetName, aReturn);
|
||||
return Patch(aRegName, EmptyString(), aJarSource, aFolder, aTargetName, aReturn);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -1415,7 +1415,7 @@ nsInstall::SetPackageFolder(nsInstallFolder& aFolder)
|
|||
{
|
||||
return OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = folder->Init(aFolder, nsAutoString());
|
||||
nsresult res = folder->Init(aFolder, EmptyString());
|
||||
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
|
@ -1495,7 +1495,7 @@ nsInstall::StartInstall(const nsString& aUserPackageName, const nsString& aRegis
|
|||
|
||||
if (mPackageFolder && packageDir)
|
||||
{
|
||||
if (NS_FAILED( mPackageFolder->Init(packageDir, nsString()) ))
|
||||
if (NS_FAILED( mPackageFolder->Init(packageDir, EmptyString()) ))
|
||||
{
|
||||
delete mPackageFolder;
|
||||
mPackageFolder = nsnull;
|
||||
|
@ -1635,7 +1635,7 @@ nsInstall::FileOpDirGetParent(nsInstallFolder& aTarget, nsInstallFolder** thePar
|
|||
{
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
folder->Init(parent,nsString());
|
||||
folder->Init(parent,EmptyString());
|
||||
*theParentFolder = folder;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -119,7 +119,7 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
nsInstallFolder* folder = new nsInstallFolder();
|
||||
if ( folder )
|
||||
{
|
||||
folder->Init(a->GetJarFileLocation(),nsString());
|
||||
folder->Init(a->GetJarFileLocation(),EmptyString());
|
||||
JSObject* fileSpecObject =
|
||||
JS_NewObject(cx, &FileSpecObjectClass, gFileSpecProto, NULL);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче