Merge central to inbound

This commit is contained in:
Marco Bonardo 2012-03-30 12:27:55 +02:00
commit 932988efc9
114 changed files with 10881 additions and 845 deletions

View File

@ -94,6 +94,11 @@ endif
include $(topsrcdir)/ipc/app/defs.mk
DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
# Set MSVC dlls version to package, if any.
ifdef WIN32_REDIST_DIR
DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
endif
ifneq (,$(filter aurora beta,$(MOZ_UPDATE_CHANNEL)))
DEFINES += -DSHIP_FEEDBACK=1
endif

View File

@ -70,20 +70,20 @@
#endif
#ifdef XP_WIN32
#ifndef MOZ_DEBUG
#if _MSC_VER == 1400
#if MOZ_MSVC_REDIST == 1400
@BINPATH@/Microsoft.VC80.CRT.manifest
@BINPATH@/msvcm80.dll
@BINPATH@/msvcp80.dll
@BINPATH@/msvcr80.dll
#elif _MSC_VER == 1500
#elif MOZ_MSVC_REDIST == 1500
@BINPATH@/Microsoft.VC90.CRT.manifest
@BINPATH@/msvcm90.dll
@BINPATH@/msvcp90.dll
@BINPATH@/msvcr90.dll
#elif _MSC_VER == 1600
#elif MOZ_MSVC_REDIST == 1600
@BINPATH@/msvcp100.dll
@BINPATH@/msvcr100.dll
#elif _MSC_VER == 1700
#elif MOZ_MSVC_REDIST == 1700
@BINPATH@/msvcp110.dll
@BINPATH@/msvcr110.dll
#endif

View File

@ -1352,29 +1352,29 @@ xpicleanup@BIN_SUFFIX@
components/jsd3250.dll
components/nsPostUpdateWin.js
js3250.dll
plugins/npnul32.dll
#if _MSC_VER != 1400
mozcpp19.dll
mozcrt19.dll
#if MOZ_MSVC_REDIST != 1400
Microsoft.VC80.CRT.manifest
msvcm80.dll
msvcp80.dll
msvcr80.dll
#endif
#if _MSC_VER != 1500
#if MOZ_MSVC_REDIST != 1500
Microsoft.VC90.CRT.manifest
msvcm90.dll
msvcp90.dll
msvcr90.dll
#endif
#if _MSC_VER != 1600
#if MOZ_MSVC_REDIST != 1600
msvcp100.dll
msvcr100.dll
#endif
#if _MSC_VER != 1700
#if MOZ_MSVC_REDIST != 1700
msvcp110.dll
msvcr110.dll
#endif
mozcrt19.dll
mozcpp19.dll
plugins/npnul32.dll
#endif
@DLL_PREFIX@xpcom_core@DLL_SUFFIX@
components/@DLL_PREFIX@jar50@DLL_SUFFIX@

View File

@ -1287,67 +1287,11 @@ public:
}
}
static void DropScriptObject(PRUint32 aLangID, void *aObject,
const char *name, void *aClosure)
{
DropScriptObject(aLangID, aObject, aClosure);
}
/**
* Unbinds the content from the tree and nulls it out if it's not null.
*/
static void DestroyAnonymousContent(nsCOMPtr<nsIContent>* aContent);
/**
* Keep script object aNewObject, held by aScriptObjectHolder, alive.
*
* NOTE: This currently only supports objects that hold script objects of one
* scripting language.
*
* @param aLangID script language ID of aNewObject
* @param aScriptObjectHolder the object that holds aNewObject
* @param aTracer the tracer for aScriptObject
* @param aNewObject the script object to hold
* @param aWasHoldingObjects whether aScriptObjectHolder was already holding
* script objects (ie. HoldScriptObject was called
* on it before, without a corresponding call to
* DropScriptObjects)
*/
static nsresult HoldScriptObject(PRUint32 aLangID, void* aScriptObjectHolder,
nsScriptObjectTracer* aTracer,
void* aNewObject, bool aWasHoldingObjects)
{
if (aLangID == nsIProgrammingLanguage::JAVASCRIPT) {
return aWasHoldingObjects ? NS_OK :
HoldJSObjects(aScriptObjectHolder, aTracer);
}
return HoldScriptObject(aLangID, aNewObject);
}
/**
* Drop any script objects that aScriptObjectHolder is holding.
*
* NOTE: This currently only supports objects that hold script objects of one
* scripting language.
*
* @param aLangID script language ID of the objects that
* @param aScriptObjectHolder the object that holds script object that we want
* to drop
* @param aTracer the tracer for aScriptObject
*/
static nsresult DropScriptObjects(PRUint32 aLangID, void* aScriptObjectHolder,
nsScriptObjectTracer* aTracer)
{
if (aLangID == nsIProgrammingLanguage::JAVASCRIPT) {
return DropJSObjects(aScriptObjectHolder);
}
aTracer->Trace(aScriptObjectHolder, DropScriptObject, nsnull);
return NS_OK;
}
/**
* Keep the JS objects held by aScriptObjectHolder alive.
*
@ -2063,11 +2007,6 @@ private:
static nsresult EnsureStringBundle(PropertiesFile aFile);
static nsIDOMScriptObjectFactory *GetDOMScriptObjectFactory();
static nsresult HoldScriptObject(PRUint32 aLangID, void* aObject);
static void DropScriptObject(PRUint32 aLangID, void *aObject, void *aClosure);
static bool CanCallerAccess(nsIPrincipal* aSubjectPrincipal,
nsIPrincipal* aPrincipal);
@ -2129,8 +2068,6 @@ private:
static nsILineBreaker* sLineBreaker;
static nsIWordBreaker* sWordBreaker;
static nsIScriptRuntime* sScriptRuntimes[NS_STID_ARRAY_UBOUND];
static PRInt32 sScriptRootCount[NS_STID_ARRAY_UBOUND];
static PRUint32 sJSGCThingRootCount;
#ifdef IBMBIDI

View File

@ -527,7 +527,7 @@ public:
* Get the length of the text content.
* NOTE: This should not be called on elements.
*/
virtual PRUint32 TextLength() = 0;
virtual PRUint32 TextLength() const = 0;
/**
* Set the text to the given value. If aNotify is true then

View File

@ -291,8 +291,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0xfcd3b0d1, 0x75db, 0x46c4, \
{ 0xa1, 0xf5, 0x07, 0xc2, 0x09, 0xf8, 0x1f, 0x44 } }
{ 0x458300ed, 0xe418, 0x4577, \
{ 0x89, 0xd7, 0xfe, 0xf1, 0x34, 0xf3, 0x52, 0x19 } }
/**
* An internal interface that abstracts some DOMNode-related parts that both
@ -587,12 +587,10 @@ public:
* @param aNotify whether to notify the document (current document for
* nsIContent, and |this| for nsIDocument) that the remove has
* occurred
* @param aMutationEvent whether to fire a mutation event
*
* Note: If there is no child at aIndex, this method will simply do nothing.
*/
virtual nsresult RemoveChildAt(PRUint32 aIndex,
bool aNotify) = 0;
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify) = 0;
/**
* Get a property associated with this node.
@ -1423,6 +1421,12 @@ public:
// Optimized way to get classinfo.
virtual nsXPCClassInfo* GetClassInfo() = 0;
/**
* Returns the length of this node, as specified at
* <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-length>
*/
PRUint32 Length() const;
protected:
// Override this function to create a custom slots class.
@ -1507,8 +1511,8 @@ protected:
* @param aChildArray The child array to work with.
* @param aMutationEvent whether to fire a mutation event for this removal.
*/
nsresult doRemoveChildAt(PRUint32 aIndex, bool aNotify, nsIContent* aKid,
nsAttrAndChildArray& aChildArray);
void doRemoveChildAt(PRUint32 aIndex, bool aNotify, nsIContent* aKid,
nsAttrAndChildArray& aChildArray);
/**
* Most of the implementation of the nsINode InsertChildAt method.

View File

@ -263,8 +263,6 @@ nsIContentPolicy *nsContentUtils::sContentPolicyService;
bool nsContentUtils::sTriedToGetContentPolicy = false;
nsILineBreaker *nsContentUtils::sLineBreaker;
nsIWordBreaker *nsContentUtils::sWordBreaker;
nsIScriptRuntime *nsContentUtils::sScriptRuntimes[NS_STID_ARRAY_UBOUND];
PRInt32 nsContentUtils::sScriptRootCount[NS_STID_ARRAY_UBOUND];
PRUint32 nsContentUtils::sJSGCThingRootCount;
#ifdef IBMBIDI
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nsnull;
@ -4330,69 +4328,6 @@ nsContentUtils::DestroyAnonymousContent(nsCOMPtr<nsIContent>* aContent)
}
}
/* static */
nsIDOMScriptObjectFactory*
nsContentUtils::GetDOMScriptObjectFactory()
{
if (!sDOMScriptObjectFactory) {
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
CallGetService(kDOMScriptObjectFactoryCID, &sDOMScriptObjectFactory);
}
return sDOMScriptObjectFactory;
}
/* static */
nsresult
nsContentUtils::HoldScriptObject(PRUint32 aLangID, void *aObject)
{
NS_ASSERTION(aObject, "unexpected null object");
NS_ASSERTION(aLangID != nsIProgrammingLanguage::JAVASCRIPT,
"Should use HoldJSObjects.");
nsresult rv;
PRUint32 langIndex = NS_STID_INDEX(aLangID);
nsIScriptRuntime *runtime = sScriptRuntimes[langIndex];
if (!runtime) {
nsIDOMScriptObjectFactory *factory = GetDOMScriptObjectFactory();
NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
rv = factory->GetScriptRuntimeByID(aLangID, &runtime);
NS_ENSURE_SUCCESS(rv, rv);
// This makes sScriptRuntimes hold a strong ref.
sScriptRuntimes[langIndex] = runtime;
}
rv = runtime->HoldScriptObject(aObject);
NS_ENSURE_SUCCESS(rv, rv);
++sScriptRootCount[langIndex];
NS_LOG_ADDREF(sScriptRuntimes[langIndex], sScriptRootCount[langIndex],
"HoldScriptObject", sizeof(void*));
return NS_OK;
}
/* static */
void
nsContentUtils::DropScriptObject(PRUint32 aLangID, void *aObject,
void *aClosure)
{
NS_ASSERTION(aObject, "unexpected null object");
NS_ASSERTION(aLangID != nsIProgrammingLanguage::JAVASCRIPT,
"Should use DropJSObjects.");
PRUint32 langIndex = NS_STID_INDEX(aLangID);
NS_LOG_RELEASE(sScriptRuntimes[langIndex], sScriptRootCount[langIndex] - 1,
"HoldScriptObject");
sScriptRuntimes[langIndex]->DropScriptObject(aObject);
if (--sScriptRootCount[langIndex] == 0) {
NS_RELEASE(sScriptRuntimes[langIndex]);
}
}
/* static */
nsresult
nsContentUtils::HoldJSObjects(void* aScriptObjectHolder,

View File

@ -697,11 +697,11 @@ nsDOMAttribute::AppendChildTo(nsIContent* aKid, bool aNotify)
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
void
nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
if (aIndex != 0 || !mChild) {
return NS_OK;
return;
}
doRemoveChild(aNotify);
@ -709,7 +709,6 @@ nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, bool aNotify)
nsString nullString;
SetDOMStringToNull(nullString);
SetValue(nullString);
return NS_OK;
}
nsresult

View File

@ -90,7 +90,7 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual already_AddRefed<nsIURI> GetBaseURI() const;

View File

@ -3514,12 +3514,12 @@ nsDocument::AppendChildTo(nsIContent* aKid, bool aNotify)
return nsDocument::InsertChildAt(aKid, GetChildCount(), aNotify);
}
nsresult
void
nsDocument::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsCOMPtr<nsIContent> oldKid = GetChildAt(aIndex);
if (!oldKid) {
return NS_OK;
return;
}
if (oldKid->IsElement()) {
@ -3527,10 +3527,8 @@ nsDocument::RemoveChildAt(PRUint32 aIndex, bool aNotify)
DestroyElementMaps();
}
nsresult rv =
doRemoveChildAt(aIndex, aNotify, oldKid, mChildren);
doRemoveChildAt(aIndex, aNotify, oldKid, mChildren);
mCachedRootElement = nsnull;
return rv;
}
PRInt32
@ -5986,7 +5984,6 @@ BlastFunc(nsAttrHashKey::KeyType aKey, nsDOMAttribute *aData, void* aUserArg)
static void
BlastSubtreeToPieces(nsINode *aNode)
{
PRUint32 i, count;
if (aNode->IsElement()) {
nsGenericElement *element = static_cast<nsGenericElement*>(aNode);
const nsDOMAttributeMap *map = element->GetAttributeMap();
@ -6008,16 +6005,10 @@ BlastSubtreeToPieces(nsINode *aNode)
}
}
count = aNode->GetChildCount();
for (i = 0; i < count; ++i) {
PRUint32 count = aNode->GetChildCount();
for (PRUint32 i = 0; i < count; ++i) {
BlastSubtreeToPieces(aNode->GetFirstChild());
#ifdef DEBUG
nsresult rv =
#endif
aNode->RemoveChildAt(0, false);
// XXX Should we abort here?
NS_ASSERTION(NS_SUCCEEDED(rv), "Uhoh, RemoveChildAt shouldn't fail!");
aNode->RemoveChildAt(0, false);
}
}
@ -6121,8 +6112,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
// Remove from parent.
nsCOMPtr<nsINode> parent = adoptedNode->GetNodeParent();
if (parent) {
rv = parent->RemoveChildAt(parent->IndexOf(adoptedNode), true);
NS_ENSURE_SUCCESS(rv, rv);
parent->RemoveChildAt(parent->IndexOf(adoptedNode), true);
}
break;

View File

@ -724,7 +724,7 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
return NS_ERROR_NOT_IMPLEMENTED;

View File

@ -742,32 +742,6 @@ static bool IsTextNode(nsINode *aNode)
return aNode && aNode->IsNodeOfType(nsINode::eTEXT);
}
static nsresult GetLengthOfDOMNode(nsIDOMNode *aNode, PRUint32 &aCount)
{
aCount = 0;
if (!aNode) { return NS_ERROR_NULL_POINTER; }
nsresult result=NS_OK;
nsCOMPtr<nsIDOMCharacterData>nodeAsChar;
nodeAsChar = do_QueryInterface(aNode);
if (nodeAsChar) {
nodeAsChar->GetLength(&aCount);
}
else
{
bool hasChildNodes;
aNode->HasChildNodes(&hasChildNodes);
if (true==hasChildNodes)
{
nsCOMPtr<nsIDOMNodeList>nodeList;
result = aNode->GetChildNodes(getter_AddRefs(nodeList));
if (NS_SUCCEEDED(result) && nodeList) {
nodeList->GetLength(&aCount);
}
}
}
return result;
}
nsresult
nsDocumentEncoder::SerializeRangeNodes(nsRange* aRange,
nsINode* aNode,
@ -1699,13 +1673,12 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, PRInt32
if (IsTextNode(n))
{
// if not at end of text node, we are done
PRUint32 len;
GetLengthOfDOMNode(aNode, len);
PRUint32 len = n->Length();
if (offset < (PRInt32)len)
{
// unless everything after us in just whitespace. NOTE: we need a more
// general solution that truly detects all cases of non-significant
// whitesace with no false alarms.
// whitespace with no false alarms.
nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(aNode);
nsAutoString text;
nodeAsText->SubstringData(offset, len-offset, text);
@ -1891,17 +1864,19 @@ nsHTMLCopyEncoder::IsLastNode(nsIDOMNode *aNode)
{
nsCOMPtr<nsIDOMNode> parent;
PRInt32 offset,j;
PRUint32 numChildren;
nsresult rv = GetNodeLocation(aNode, address_of(parent), &offset);
if (NS_FAILED(rv))
{
NS_NOTREACHED("failure in IsLastNode");
return false;
}
GetLengthOfDOMNode(parent, numChildren);
if (offset+1 == (PRInt32)numChildren) // easy case, we are last dom child
nsCOMPtr<nsINode> parentNode = do_QueryInterface(parent);
if (!parentNode) {
return true;
if (!parent)
}
PRUint32 numChildren = parentNode->Length();
if (offset+1 == (PRInt32)numChildren) // easy case, we are last dom child
return true;
// need to check if any nodes after us are really visible.
// Mike wrote something for me along these lines in nsSelectionController,

View File

@ -680,10 +680,9 @@ nsGenericDOMDataNode::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return NS_OK;
}
nsresult
void
nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
return NS_OK;
}
nsIContent *
@ -874,7 +873,7 @@ nsGenericDOMDataNode::GetText()
}
PRUint32
nsGenericDOMDataNode::TextLength()
nsGenericDOMDataNode::TextLength() const
{
return mText.GetLength();
}

View File

@ -170,7 +170,7 @@ public:
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
NS_IMETHOD GetTextContent(nsAString &aTextContent)
{
nsresult rv = GetNodeValue(aTextContent);
@ -211,7 +211,7 @@ public:
virtual const nsAttrName* GetAttrNameAt(PRUint32 aIndex) const;
virtual PRUint32 GetAttrCount() const;
virtual const nsTextFragment *GetText();
virtual PRUint32 TextLength();
virtual PRUint32 TextLength() const;
virtual nsresult SetText(const PRUnichar* aBuffer, PRUint32 aLength,
bool aNotify);
// Need to implement this here too to avoid hiding.

View File

@ -535,7 +535,8 @@ nsINode::RemoveChild(nsINode *aOldChild)
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
return RemoveChildAt(index, true);
RemoveChildAt(index, true);
return NS_OK;
}
nsresult
@ -3848,20 +3849,18 @@ nsINode::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return NS_OK;
}
nsresult
void
nsGenericElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
NS_ASSERTION(oldKid == GetChildAt(aIndex), "Unexpected child in RemoveChildAt");
if (oldKid) {
return doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren);
doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren);
}
return NS_OK;
}
nsresult
void
nsINode::doRemoveChildAt(PRUint32 aIndex, bool aNotify,
nsIContent* aKid, nsAttrAndChildArray& aChildArray)
{
@ -3888,8 +3887,6 @@ nsINode::doRemoveChildAt(PRUint32 aIndex, bool aNotify,
}
aKid->UnbindFromTree();
return NS_OK;
}
NS_IMETHODIMP
@ -4273,12 +4270,9 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsresult res;
// If we're replacing
if (aReplace) {
res = RemoveChildAt(insPos, true);
NS_ENSURE_SUCCESS(res, res);
RemoveChildAt(insPos, true);
}
if (newContent->IsRootOfAnonymousSubtree()) {
@ -4298,8 +4292,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
res = oldParent->RemoveChildAt(removeIndex, true);
NS_ENSURE_SUCCESS(res, res);
oldParent->RemoveChildAt(removeIndex, true);
// Adjust insert index if the node we ripped out was a sibling
// of the node we're inserting before
@ -4308,6 +4301,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
}
}
nsresult res = NS_OK;
// Move new child over to our document if needed. Do this after removing
// it from its parent so that AdoptNode doesn't fire DOMNodeRemoved
// DocumentType nodes are the only nodes that can have a null
@ -5621,7 +5615,7 @@ nsGenericElement::GetText()
}
PRUint32
nsGenericElement::TextLength()
nsGenericElement::TextLength() const
{
// We can remove this assertion if it turns out to be useful to be able
// to depend on this returning 0
@ -6416,6 +6410,25 @@ nsINode::Contains(nsIDOMNode* aOther, bool* aReturn)
return NS_OK;
}
PRUint32
nsINode::Length() const
{
switch (NodeType()) {
case nsIDOMNode::DOCUMENT_TYPE_NODE:
return 0;
case nsIDOMNode::TEXT_NODE:
case nsIDOMNode::CDATA_SECTION_NODE:
case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
case nsIDOMNode::COMMENT_NODE:
MOZ_ASSERT(IsNodeOfType(eCONTENT));
return static_cast<const nsIContent*>(this)->TextLength();
default:
return GetChildCount();
}
}
nsresult nsGenericElement::MozRequestFullScreen()
{
// Only grant full-screen requests if this is called from inside a trusted

View File

@ -263,7 +263,7 @@ public:
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
NS_IMETHOD GetTextContent(nsAString &aTextContent);
NS_IMETHOD SetTextContent(const nsAString& aTextContent);
@ -327,7 +327,7 @@ public:
virtual const nsAttrName* GetAttrNameAt(PRUint32 aIndex) const;
virtual PRUint32 GetAttrCount() const;
virtual const nsTextFragment *GetText();
virtual PRUint32 TextLength();
virtual PRUint32 TextLength() const;
virtual nsresult SetText(const PRUnichar* aBuffer, PRUint32 aLength,
bool aNotify);
// Need to implement this here too to avoid hiding.

View File

@ -1865,6 +1865,47 @@ GK_ATOM(Taiwanese, "zh-TW")
GK_ATOM(HongKongChinese, "zh-HK")
GK_ATOM(Unicode, "x-unicode")
// language codes specifically referenced in the gfx code
GK_ATOM(ko, "ko")
GK_ATOM(zh_cn, "zh-cn")
GK_ATOM(zh_hk, "zh-hk")
GK_ATOM(zh_tw, "zh-tw")
// additional codes used in nsUnicodeRange.cpp
GK_ATOM(x_cyrillic, "x-cyrillic")
GK_ATOM(he, "he")
GK_ATOM(ar, "ar")
GK_ATOM(x_baltic, "x-baltic")
GK_ATOM(x_devanagari, "x-devanagari")
GK_ATOM(x_tamil, "x-tamil")
GK_ATOM(x_armn, "x-armn")
GK_ATOM(x_beng, "x-beng")
GK_ATOM(x_cans, "x-cans")
GK_ATOM(x_ethi, "x-ethi")
GK_ATOM(x_geor, "x-geor")
GK_ATOM(x_gujr, "x-gujr")
GK_ATOM(x_guru, "x-guru")
GK_ATOM(x_khmr, "x-khmr")
GK_ATOM(x_knda, "x-knda")
GK_ATOM(x_mlym, "x-mlym")
GK_ATOM(x_orya, "x-orya")
GK_ATOM(x_sinh, "x-sinh")
GK_ATOM(x_telu, "x-telu")
GK_ATOM(x_tibt, "x-tibt")
// used in gfxGDIFontList.h
GK_ATOM(ko_xxx, "ko-xxx")
GK_ATOM(x_central_euro, "x-central-euro")
GK_ATOM(x_symbol, "x-symbol")
// referenced in all.js
GK_ATOM(x_user_def, "x-user-def")
// additional languages that use Turkish-style case transformation
GK_ATOM(az, "az")
GK_ATOM(ba, "ba")
GK_ATOM(crh, "crh")
// Names for editor transactions
GK_ATOM(TypingTxnName, "Typing")
GK_ATOM(IMETxnName, "IME")

View File

@ -622,16 +622,6 @@ nsRange::ParentChainChanged(nsIContent *aContent)
DoSetRange(mStartParent, mStartOffset, mEndParent, mEndOffset, newRoot);
}
// Private helper routine: get the length of aNode
static PRUint32 GetNodeLength(nsINode *aNode)
{
if(aNode->IsNodeOfType(nsINode::eDATA_NODE)) {
return static_cast<nsIContent*>(aNode)->TextLength();
}
return aNode->GetChildCount();
}
/******************************************************
* Utilities for comparing points: API from nsIDOMRange
******************************************************/
@ -674,7 +664,7 @@ nsRange::ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aResult)
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
}
if (aOffset < 0 || aOffset > GetNodeLength(parent)) {
if (aOffset < 0 || aOffset > parent->Length()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -938,9 +928,9 @@ nsRange::SetStart(nsINode* aParent, PRInt32 aOffset)
nsINode* newRoot = IsValidBoundary(aParent);
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
PRInt32 len = GetNodeLength(aParent);
if (aOffset < 0 || aOffset > len)
if (aOffset < 0 || aOffset > aParent->Length()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
// Collapse if not positioned yet, if positioned in another doc or
// if the new start is after end.
@ -1002,8 +992,7 @@ nsRange::SetEnd(nsINode* aParent, PRInt32 aOffset)
nsINode* newRoot = IsValidBoundary(aParent);
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
PRInt32 len = GetNodeLength(aParent);
if (aOffset < 0 || aOffset > len) {
if (aOffset < 0 || aOffset > aParent->Length()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -1100,7 +1089,7 @@ nsRange::SelectNodeContents(nsIDOMNode* aN)
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
AutoInvalidateSelection atEndOfBlock(this);
DoSetRange(node, 0, node, GetNodeLength(node), newRoot);
DoSetRange(node, 0, node, node->Length(), newRoot);
return NS_OK;
}

View File

@ -918,7 +918,8 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
mDocument->NodePrincipal(),
aRequest->mOriginPrincipal,
url.get(), aRequest->mLineNo,
aRequest->mJSVersion, nsnull, &isUndefined);
JSVersion(aRequest->mJSVersion), nsnull,
&isUndefined);
// Put the old script back in case it wants to do anything else.
mCurrentScript = oldCurrent;

View File

@ -220,7 +220,7 @@ nsHTMLFieldSetElement::InsertChildAt(nsIContent* aChild, PRUint32 aIndex,
return rv;
}
nsresult
void
nsHTMLFieldSetElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
bool firstLegendHasChanged = false;
@ -239,14 +239,11 @@ nsHTMLFieldSetElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
}
}
nsresult rv = nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
if (firstLegendHasChanged) {
NotifyElementsForFirstLegendChange(aNotify);
}
return rv;
}
void

View File

@ -84,7 +84,7 @@ public:
virtual nsresult InsertChildAt(nsIContent* aChild, PRUint32 aIndex,
bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
// nsIFormControl
NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_FIELDSET; }

View File

@ -72,10 +72,10 @@ public:
// nsIDOMHTMLOptGroupElement
NS_DECL_NSIDOMHTMLOPTGROUPELEMENT
// nsGenericElement
// nsINode
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
// nsIContent
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
@ -187,16 +187,12 @@ nsHTMLOptGroupElement::InsertChildAt(nsIContent* aKid,
return rv;
}
nsresult
void
nsHTMLOptGroupElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsSafeOptionListMutation safeMutation(GetSelect(), this, nsnull, aIndex,
aNotify);
nsresult rv = nsGenericHTMLElement::RemoveChildAt(aIndex, aNotify);
if (NS_FAILED(rv)) {
safeMutation.MutationFailed();
}
return rv;
nsGenericHTMLElement::RemoveChildAt(aIndex, aNotify);
}
nsEventStates

View File

@ -230,15 +230,11 @@ nsHTMLSelectElement::InsertChildAt(nsIContent* aKid,
return rv;
}
nsresult
void
nsHTMLSelectElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsSafeOptionListMutation safeMutation(this, this, nsnull, aIndex, aNotify);
nsresult rv = nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
if (NS_FAILED(rv)) {
safeMutation.MutationFailed();
}
return rv;
nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
}

View File

@ -296,7 +296,7 @@ public:
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
// Overriden nsIFormControl methods
NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_SELECT; }

View File

@ -261,8 +261,8 @@ DOMSVGTests::GetAttrName(PRUint8 aAttrEnum) const
void
DOMSVGTests::GetAttrValue(PRUint8 aAttrEnum, nsAttrValue& aValue) const
{
NS_ABORT_IF_FALSE(aAttrEnum >= 0 && aAttrEnum < ArrayLength(sStringListNames),
"aAttrEnum out of range");
MOZ_ASSERT(aAttrEnum < ArrayLength(sStringListNames),
"aAttrEnum out of range");
aValue.SetTo(mStringListAttributes[aAttrEnum], nsnull);
}

View File

@ -126,14 +126,11 @@ nsSVGSwitchElement::InsertChildAt(nsIContent* aKid,
return rv;
}
nsresult
void
nsSVGSwitchElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsresult rv = nsSVGSwitchElementBase::RemoveChildAt(aIndex, aNotify);
if (NS_SUCCEEDED(rv)) {
MaybeInvalidate();
}
return rv;
nsSVGSwitchElementBase::RemoveChildAt(aIndex, aNotify);
MaybeInvalidate();
}
//----------------------------------------------------------------------

View File

@ -75,7 +75,7 @@ public:
// nsINode
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
// nsIContent
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;

View File

@ -691,8 +691,7 @@ txMozillaXMLOutput::createTxWrapper()
++j;
}
else {
rv = mDocument->RemoveChildAt(j, true);
NS_ENSURE_SUCCESS(rv, rv);
mDocument->RemoveChildAt(j, true);
rv = wrapper->AppendChildTo(childContent, true);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -270,16 +270,14 @@ nsXTFElementWrapper::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
void
nsXTFElementWrapper::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsresult rv;
if (mNotificationMask & nsIXTFElement::NOTIFY_WILL_REMOVE_CHILD)
GetXTFElement()->WillRemoveChild(aIndex);
rv = nsXTFElementWrapperBase::RemoveChildAt(aIndex, aNotify);
nsXTFElementWrapperBase::RemoveChildAt(aIndex, aNotify);
if (mNotificationMask & nsIXTFElement::NOTIFY_CHILD_REMOVED)
GetXTFElement()->ChildRemoved(aIndex);
return rv;
}
nsIAtom *

View File

@ -84,7 +84,7 @@ public:
bool aNullParent = true);
nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
bool aNotify);
nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
void RemoveChildAt(PRUint32 aIndex, bool aNotify);
nsIAtom *GetIDAttributeName() const;
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,

View File

@ -189,7 +189,8 @@ nsXULContextMenuBuilder::UndoAddSeparator()
return NS_OK;
}
return mCurrentNode->RemoveChildAt(count - 1, false);
mCurrentNode->RemoveChildAt(count - 1, false);
return NS_OK;
}
NS_IMETHODIMP

View File

@ -808,12 +808,11 @@ nsScriptEventHandlerOwnerTearoff::CompileEventHandler(
if (aHandler) {
NS_ASSERTION(!attr->mEventHandler, "Leaking handler.");
rv = nsContentUtils::HoldScriptObject(aContext->GetScriptTypeID(),
elem,
&NS_CYCLE_COLLECTION_NAME(nsXULPrototypeNode),
aHandler.get(),
elem->mHoldsScriptObject);
if (NS_FAILED(rv)) return rv;
if (!elem->mHoldsScriptObject) {
rv = nsContentUtils::HoldJSObjects(
elem, &NS_CYCLE_COLLECTION_NAME(nsXULPrototypeNode));
NS_ENSURE_SUCCESS(rv, rv);
}
elem->mHoldsScriptObject = true;
}
@ -925,13 +924,12 @@ nsXULElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsStyledElement::UnbindFromTree(aDeep, aNullParent);
}
nsresult
void
nsXULElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
{
nsresult rv;
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
if (!oldKid) {
return NS_OK;
return;
}
// On the removal of a <treeitem>, <treechildren>, or <treecell> element,
@ -954,7 +952,7 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
// If it's not, look at our parent
if (!controlElement)
rv = GetParentTree(getter_AddRefs(controlElement));
GetParentTree(getter_AddRefs(controlElement));
nsCOMPtr<nsIDOMElement> oldKidElem = do_QueryInterface(oldKid);
if (controlElement && oldKidElem) {
@ -994,7 +992,7 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
}
}
rv = nsStyledElement::RemoveChildAt(aIndex, aNotify);
nsStyledElement::RemoveChildAt(aIndex, aNotify);
if (newCurrentIndex == -2)
controlElement->SetCurrentItem(nsnull);
@ -1022,8 +1020,6 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
false,
true);
}
return rv;
}
void
@ -2905,8 +2901,7 @@ void
nsXULPrototypeElement::Unlink()
{
if (mHoldsScriptObject) {
nsContentUtils::DropScriptObjects(mScriptTypeID, this,
&NS_CYCLE_COLLECTION_NAME(nsXULPrototypeNode));
nsContentUtils::DropJSObjects(this);
mHoldsScriptObject = false;
}
mNumAttributes = 0;
@ -3185,8 +3180,7 @@ void
nsXULPrototypeScript::UnlinkJSObjects()
{
if (mScriptObject.mObject) {
nsContentUtils::DropScriptObjects(mScriptObject.mLangID, this,
&NS_CYCLE_COLLECTION_NAME(nsXULPrototypeNode));
nsContentUtils::DropJSObjects(this);
mScriptObject.mObject = nsnull;
}
}
@ -3197,14 +3191,11 @@ nsXULPrototypeScript::Set(JSScript* aObject)
NS_ASSERTION(!mScriptObject.mObject, "Leaking script object.");
if (!aObject) {
mScriptObject.mObject = nsnull;
return;
}
nsresult rv = nsContentUtils::HoldScriptObject(mScriptObject.mLangID,
this,
&NS_CYCLE_COLLECTION_NAME(nsXULPrototypeNode),
aObject, false);
nsresult rv = nsContentUtils::HoldJSObjects(
this, &NS_CYCLE_COLLECTION_NAME(nsXULPrototypeNode));
if (NS_SUCCEEDED(rv)) {
mScriptObject.mObject = aObject;
}

View File

@ -482,7 +482,7 @@ public:
nsIContent* aBindingParent,
bool aCompileEventHandlers);
virtual void UnbindFromTree(bool aDeep, bool aNullParent);
virtual nsresult RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual bool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString& aResult) const;
virtual bool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const;

View File

@ -4115,15 +4115,13 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
// The element matches. "Go Deep!"
rv = Merge(elementInDocument, currContent, aNotify);
if (NS_FAILED(rv)) return rv;
rv = aOverlayNode->RemoveChildAt(0, false);
if (NS_FAILED(rv)) return rv;
aOverlayNode->RemoveChildAt(0, false);
continue;
}
}
rv = aOverlayNode->RemoveChildAt(0, false);
if (NS_FAILED(rv)) return rv;
aOverlayNode->RemoveChildAt(0, false);
rv = InsertElement(aTargetNode, currContent, aNotify);
if (NS_FAILED(rv)) return rv;
@ -4513,7 +4511,8 @@ nsXULDocument::RemoveElement(nsIContent* aParent, nsIContent* aChild)
{
PRInt32 nodeOffset = aParent->IndexOf(aChild);
return aParent->RemoveChildAt(nodeOffset, true);
aParent->RemoveChildAt(nodeOffset, true);
return NS_OK;
}
//----------------------------------------------------------------------

View File

@ -956,8 +956,7 @@ nsXULContentBuilder::RemoveMember(nsIContent* aContent)
// Note: RemoveChildAt sets |child|'s document to null so that
// it'll get knocked out of the XUL doc's resource-to-element
// map.
nsresult rv = parent->RemoveChildAt(pos, true);
if (NS_FAILED(rv)) return rv;
parent->RemoveChildAt(pos, true);
}
// Remove from the content support map.

View File

@ -9287,8 +9287,7 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
bool is_undefined;
scx->EvaluateString(nsDependentString(script), FastGetGlobalJSObject(),
timeout->mPrincipal, timeout->mPrincipal,
filename, lineNo,
handler->GetScriptVersion(), nsnull,
filename, lineNo, JSVERSION_DEFAULT, nsnull,
&is_undefined);
} else {
nsCOMPtr<nsIVariant> dummy;

View File

@ -124,7 +124,7 @@ public:
nsIPrincipal *aOriginPrincipal,
const char *aURL,
PRUint32 aLineNo,
PRUint32 aVersion,
JSVersion aVersion,
nsAString *aRetValue,
bool* aIsUndefined) = 0;

View File

@ -42,9 +42,8 @@
class nsIArray;
#define NS_ISCRIPTTIMEOUTHANDLER_IID \
{ /* {17a9ce1a-d73b-45d1-8145-a0ae57bcc76e} */ \
0x17a9ce1a, 0xd73b, 0x45d1, \
{ 0x81, 0x45, 0xa0, 0xae, 0x57, 0xbc, 0xc7, 0x6e } }
{ 0xd60ec934, 0x0c75, 0x4777, \
{ 0xba, 0x41, 0xb8, 0x2f, 0x37, 0xc9, 0x13, 0x56 } }
/**
* Abstraction of the script objects etc required to do timeouts in a
@ -75,9 +74,6 @@ public:
// If a script object, get the argv suitable for passing back to the
// script context.
virtual nsIArray *GetArgv() = 0;
// Get the language version for this timeout.
virtual PRUint32 GetScriptVersion() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptTimeoutHandler,

View File

@ -1358,7 +1358,7 @@ nsJSContext::EvaluateString(const nsAString& aScript,
nsIPrincipal *aOriginPrincipal,
const char *aURL,
PRUint32 aLineNo,
PRUint32 aVersion,
JSVersion aVersion,
nsAString *aRetValue,
bool* aIsUndefined)
{

View File

@ -88,7 +88,7 @@ public:
nsIPrincipal *originPrincipal,
const char *aURL,
PRUint32 aLineNo,
PRUint32 aVersion,
JSVersion aVersion,
nsAString *aRetValue,
bool* aIsUndefined);
virtual nsresult EvaluateStringWithValue(const nsAString& aScript,

View File

@ -79,9 +79,6 @@ public:
virtual PRUint32 GetScriptTypeID() {
return nsIProgrammingLanguage::JAVASCRIPT;
}
virtual PRUint32 GetScriptVersion() {
return mVersion;
}
virtual nsIArray *GetArgv() {
return mArgv;

View File

@ -64,8 +64,7 @@ interface nsIDOMStorage : nsISupports
* Retrieve the name of the key at a particular index.
*
* @param index index of the item to retrieve
* @returns the key at index
* @throws INDEX_SIZE_ERR if there is no key at that index
* @returns the key at index, null if there is no key at that index
*/
DOMString key(in unsigned long index);

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -86,33 +86,20 @@ nsJSEventListener::nsJSEventListener(nsIScriptContext *aContext,
// until we are done with it.
NS_ASSERTION(aScopeObject && aContext,
"EventListener with no context or scope?");
nsContentUtils::HoldScriptObject(aContext->GetScriptTypeID(), this,
&NS_CYCLE_COLLECTION_NAME(nsJSEventListener),
aScopeObject, false);
if (aHandler) {
nsContentUtils::HoldScriptObject(aContext->GetScriptTypeID(), this,
&NS_CYCLE_COLLECTION_NAME(nsJSEventListener),
aHandler, true);
}
NS_HOLD_JS_OBJECTS(this, nsJSEventListener);
}
nsJSEventListener::~nsJSEventListener()
{
if (mContext)
nsContentUtils::DropScriptObjects(mContext->GetScriptTypeID(), this,
&NS_CYCLE_COLLECTION_NAME(nsJSEventListener));
if (mContext) {
NS_DROP_JS_OBJECTS(this, nsJSEventListener);
}
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsJSEventListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSEventListener)
if (tmp->mContext) {
if (tmp->mContext->GetScriptTypeID() == nsIProgrammingLanguage::JAVASCRIPT) {
NS_DROP_JS_OBJECTS(tmp, nsJSEventListener);
}
else {
nsContentUtils::DropScriptObjects(tmp->mContext->GetScriptTypeID(), tmp,
&NS_CYCLE_COLLECTION_NAME(nsJSEventListener));
}
NS_DROP_JS_OBJECTS(tmp, nsJSEventListener);
tmp->mScopeObject = nsnull;
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContext)
}

View File

@ -363,7 +363,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
principal,
mURL.get(), // url
1, // line no
nsnull,
JSVERSION_DEFAULT,
&result,
&isUndefined);

View File

@ -1131,10 +1131,6 @@ IndexFinder(nsSessionStorageEntry* aEntry, void* userArg)
nsresult
DOMStorageImpl::GetKey(bool aCallerSecure, PRUint32 aIndex, nsAString& aKey)
{
// XXXjst: This is as retarded as the DOM spec is, takes an unsigned
// int, but the spec talks about what to do if a negative value is
// passed in.
// XXX: This does a linear search for the key at index, which would
// suck if there's a large numer of indexes. Do we care? If so,
// maybe we need to have a lazily populated key array here or
@ -1148,8 +1144,9 @@ DOMStorageImpl::GetKey(bool aCallerSecure, PRUint32 aIndex, nsAString& aKey)
mItems.EnumerateEntries(IndexFinder, &data);
if (!data.mItem) {
// aIndex was larger than the number of accessible keys. Throw.
return NS_ERROR_DOM_INDEX_SIZE_ERR;
// aIndex was larger than the number of accessible keys. Return null.
aKey.SetIsVoid(true);
return NS_OK;
}
aKey = data.mItem->GetKey();

View File

@ -57,6 +57,7 @@ DIRS += \
orientation \
sessionstorage \
storageevent \
w3c \
browser-frame \
$(NULL)

View File

@ -7,28 +7,13 @@
<script type="text/javascript">
var INDEX_SIZE_ERR = 1;
function checkException(func, exc)
{
var exceptionThrew = false;
try {
func();
}
catch (ex) {
exceptionThrew = true;
is(ex.code, exc, "Expected "+exc+" exception");
}
ok(exceptionThrew, "Exception "+exc+" threw");
}
function startTest()
{
// Initially check the localStorage is empty
is(localStorage.length, 0, "The storage is empty [1]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
is(localStorage["nonexisting"], null, "Nonexisting item is null (array access)");
is(localStorage.nonexisting, null, "Nonexisting item is null (property access)");
@ -62,8 +47,8 @@ function startTest()
localStorage.setItem("key1", "value1");
is(localStorage.length, 1, "The storage has one key-value pair");
is(localStorage.key(0), "key1");
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
// check all access method give the correct result
// and are of the correct type
@ -78,7 +63,7 @@ function startTest()
// remove the previously added key and check the storage is empty
localStorage.removeItem("key1");
is(localStorage.length, 0, "The storage is empty [2]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), null, "\'key1\' removed");
is(typeof localStorage.getItem("key1"), "object", "getItem('key1') is object");
@ -107,8 +92,8 @@ function startTest()
is(localStorage.length, 2, "The storage has two key-value pairs");
is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
is(localStorage.key(1), secondKey);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(2);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1");
is(localStorage.getItem("key2"), "value2-2");
@ -117,8 +102,8 @@ function startTest()
is(localStorage.length, 2, "The storage has two key-value pairs");
is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
is(localStorage.key(1), secondKey);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(2);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1-2");
is(localStorage.getItem("key2"), "value2-2");
@ -126,8 +111,8 @@ function startTest()
localStorage.removeItem("key2");
is(localStorage.length, 1, "The storage has one key-value pair");
is(localStorage.key(0), "key1");
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1-2");
// JS property test
@ -166,9 +151,9 @@ function startTest()
is("testB" in localStorage, false, "Keys are not in the JS scope of the storage");
is("testC" in localStorage, false, "Keys are not in the JS scope of the storage");
is(localStorage.length, 0, "The storage is empty [3]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR); // this is unspecified!
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null");
is(localStorage.getItem("key1"), null, "key1 removed");
is(localStorage.getItem("key2"), null, "key2 removed");

View File

@ -8,21 +8,6 @@
<script type="text/javascript">
var INDEX_SIZE_ERR = 1;
function checkException(func, exc)
{
var exceptionThrew = false;
try {
func();
}
catch (ex) {
exceptionThrew = true;
is(ex.code, exc, "Expected "+exc+" exception");
}
ok(exceptionThrew, "Exception "+exc+" threw");
}
function startTest()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@ -45,9 +30,9 @@ function doTest()
// Initially check the localStorage is empty
is(localStorage.length, 0, "The storage is empty [1]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
is(localStorage["nonexisting"], null, "Nonexisting item is null (array access)");
is(localStorage.nonexisting, null, "Nonexisting item is null (property access)");
@ -81,8 +66,8 @@ function doTest()
localStorage.setItem("key1", "value1");
is(localStorage.length, 1, "The storage has one key-value pair");
is(localStorage.key(0), "key1");
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
// check all access method give the correct result
// and are of the correct type
@ -97,7 +82,7 @@ function doTest()
// remove the previously added key and check the storage is empty
localStorage.removeItem("key1");
is(localStorage.length, 0, "The storage is empty [2]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), null, "\'key1\' removed");
is(typeof localStorage.getItem("key1"), "object", "getItem('key1') is object");
@ -126,8 +111,8 @@ function doTest()
is(localStorage.length, 2, "The storage has two key-value pairs");
is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
is(localStorage.key(1), secondKey);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(2);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1");
is(localStorage.getItem("key2"), "value2-2");
@ -136,8 +121,8 @@ function doTest()
is(localStorage.length, 2, "The storage has two key-value pairs");
is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
is(localStorage.key(1), secondKey);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(2);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1-2");
is(localStorage.getItem("key2"), "value2-2");
@ -145,8 +130,8 @@ function doTest()
localStorage.removeItem("key2");
is(localStorage.length, 1, "The storage has one key-value pair");
is(localStorage.key(0), "key1");
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1-2");
// JS property test
@ -183,9 +168,9 @@ function doTest()
// Clear the storage
localStorage.clear();
is(localStorage.length, 0, "The storage is empty [3]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR); // this is unspecified!
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null");
is(localStorage.getItem("key1"), null, "key1 removed");
is(localStorage.getItem("key2"), null, "key2 removed");

View File

@ -7,21 +7,6 @@
<script type="text/javascript">
var INDEX_SIZE_ERR = 1;
function checkException(func, exc)
{
var exceptionThrew = false;
try {
func();
}
catch (ex) {
exceptionThrew = true;
is(ex.code, exc, "Expected "+exc+" exception");
}
ok(exceptionThrew, "Exception "+exc+" threw");
}
function startTest()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@ -36,9 +21,9 @@ function startTest()
// Initially check the localStorage is empty
is(localStorage.length, 0, "The storage is empty [1]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
is(localStorage["nonexisting"], null, "Nonexisting item is null (array access)");
is(localStorage.nonexisting, null, "Nonexisting item is null (property access)");
@ -72,8 +57,8 @@ function startTest()
localStorage.setItem("key1", "value1");
is(localStorage.length, 1, "The storage has one key-value pair");
is(localStorage.key(0), "key1");
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
// check all access method give the correct result
// and are of the correct type
@ -88,7 +73,7 @@ function startTest()
// remove the previously added key and check the storage is empty
localStorage.removeItem("key1");
is(localStorage.length, 0, "The storage is empty [2]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), null, "\'key1\' removed");
is(typeof localStorage.getItem("key1"), "object", "getItem('key1') is object");
@ -117,8 +102,8 @@ function startTest()
is(localStorage.length, 2, "The storage has two key-value pairs");
is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
is(localStorage.key(1), secondKey);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(2);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1");
is(localStorage.getItem("key2"), "value2-2");
@ -127,8 +112,8 @@ function startTest()
is(localStorage.length, 2, "The storage has two key-value pairs");
is(localStorage.key(0), firstKey); // After key value changes the order must be preserved
is(localStorage.key(1), secondKey);
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(2);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(2), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1-2");
is(localStorage.getItem("key2"), "value2-2");
@ -136,8 +121,8 @@ function startTest()
localStorage.removeItem("key2");
is(localStorage.length, 1, "The storage has one key-value pair");
is(localStorage.key(0), "key1");
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("key1"), "value1-2");
// JS property test
@ -174,9 +159,9 @@ function startTest()
// Clear the storage
localStorage.clear();
is(localStorage.length, 0, "The storage is empty [3]");
checkException(function() {localStorage.key(0);}, INDEX_SIZE_ERR); // this is unspecified!
checkException(function() {localStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {localStorage.key(1);}, INDEX_SIZE_ERR);
is(localStorage.key(0), null, "key() should return null for out-of-bounds access");
is(localStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(localStorage.key(1), null, "key() should return null for out-of-bounds access");
is(localStorage.getItem("nonexisting"), null, "Nonexisting item is null");
is(localStorage.getItem("key1"), null, "key1 removed");
is(localStorage.getItem("key2"), null, "key2 removed");

View File

@ -7,30 +7,15 @@
<script type="text/javascript">
var INDEX_SIZE_ERR = 1;
function checkException(func, exc)
{
var exceptionThrew = false;
try {
func();
}
catch (ex) {
exceptionThrew = true;
is(ex.code, exc, "Expected "+exc+" exception");
}
ok(exceptionThrew, "Exception "+exc+" threw");
}
function startTest()
{
sessionStorage.clear();
// Initially check the sessionStorage is empty
is(sessionStorage.length, 0, "The storage is empty [1]");
checkException(function() {sessionStorage.key(0);}, INDEX_SIZE_ERR);
checkException(function() {sessionStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {sessionStorage.key(1);}, INDEX_SIZE_ERR);
is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.getItem("nonexisting"), null, "Nonexisting item is null (getItem())");
is(sessionStorage["nonexisting"], null, "Nonexisting item is null (array access)");
is(sessionStorage.nonexisting, null, "Nonexisting item is null (property access)");
@ -64,8 +49,8 @@ function startTest()
sessionStorage.setItem("key1", "value1");
is(sessionStorage.length, 1, "The storage has one key-value pair");
is(sessionStorage.key(0), "key1");
checkException(function() {sessionStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {sessionStorage.key(1);}, INDEX_SIZE_ERR);
is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
// check all access method give the correct result
// and are of the correct type
@ -80,7 +65,7 @@ function startTest()
// remove the previously added key and check the storage is empty
sessionStorage.removeItem("key1");
is(sessionStorage.length, 0, "The storage is empty [2]");
checkException(function() {sessionStorage.key(0);}, INDEX_SIZE_ERR);
is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
is(sessionStorage.getItem("key1"), null, "\'key1\' removed");
is(typeof sessionStorage.getItem("key1"), "object", "getItem('key1') is object");
@ -109,8 +94,8 @@ function startTest()
is(sessionStorage.length, 2, "The storage has two key-value pairs");
is(sessionStorage.key(0), firstKey); // After key value changes the order must be preserved
is(sessionStorage.key(1), secondKey);
checkException(function() {sessionStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {sessionStorage.key(2);}, INDEX_SIZE_ERR);
is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(2), null, "key() should return null for out-of-bounds access");
is(sessionStorage.getItem("key1"), "value1");
is(sessionStorage.getItem("key2"), "value2-2");
@ -119,8 +104,8 @@ function startTest()
is(sessionStorage.length, 2, "The storage has two key-value pairs");
is(sessionStorage.key(0), firstKey); // After key value changes the order must be preserved
is(sessionStorage.key(1), secondKey);
checkException(function() {sessionStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {sessionStorage.key(2);}, INDEX_SIZE_ERR);
is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(2), null, "key() should return null for out-of-bounds access");
is(sessionStorage.getItem("key1"), "value1-2");
is(sessionStorage.getItem("key2"), "value2-2");
@ -128,16 +113,16 @@ function startTest()
sessionStorage.removeItem("key2");
is(sessionStorage.length, 1, "The storage has one key-value pair");
is(sessionStorage.key(0), "key1");
checkException(function() {sessionStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {sessionStorage.key(1);}, INDEX_SIZE_ERR);
is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.getItem("key1"), "value1-2");
// Clear the storage
sessionStorage.clear();
is(sessionStorage.length, 0, "The storage is empty [3]");
checkException(function() {sessionStorage.key(0);}, INDEX_SIZE_ERR); // this is unspecified!
checkException(function() {sessionStorage.key(-1);}, INDEX_SIZE_ERR);
checkException(function() {sessionStorage.key(1);}, INDEX_SIZE_ERR);
is(sessionStorage.key(0), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(-1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.key(1), null, "key() should return null for out-of-bounds access");
is(sessionStorage.getItem("nonexisting"), null, "Nonexisting item is null");
is(sessionStorage.getItem("key1"), null, "key1 removed");
is(sessionStorage.getItem("key2"), null, "key2 removed");

View File

@ -0,0 +1,31 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/tests/mochitest/w3c
DIRS = \
$(NULL)
include $(srcdir)/html.mk
include $(srcdir)/webapps.mk
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_SUPPORT_FILES = \
testharness.js \
testharnessreport.js \
testharness.css \
idlharness.js \
WebIDLParser.js \
$(NULL)
testharnessreport.js: testharnessreport.js.in writeReporter.py
$(PYTHON_PATH) $(srcdir)/writeReporter.py $<
libs:: $(_SUPPORT_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/resources

View File

@ -0,0 +1,97 @@
This directory contains tests imported from W3C test suites. In order to make it
as easy as possible to update these tests, no changes are made to the imported
files (names for scripted tests do get a test_ prefix to integrate with the test
runner, however). The scripts to update tests are provided.
=======================
Files in this directory
=======================
Source; Usage and purpose; License
* testharness.js / testharness.css
Directly imported from the W3C repository (<http://dvcs.w3.org/hg/resources>),
with the updateTestharness.py script.
Provide the test harness.
W3C Test Suite License / W3C 3-clause BSD License
* idlharness.js
Directly imported from the W3C repository (<http://dvcs.w3.org/hg/resources>),
with the updateTestharness.py script.
Used to test WebIDL.
W3C Test Suite License / W3C 3-clause BSD License
* WebIDLParser.js
Directly imported from the W3C repository (<http://dvcs.w3.org/hg/resources>),
with the updateTestharness.py script.
Used by idlharness.js to parse IDL blocks.
MIT License
* updateTestharness.py
Used to update the above files.
MPL
* parseManifest.py
Imported from <https://bitbucket.org/ms2ger/test-runner>. Parses MANIFEST
files (provided in the W3C repository) as documented at
<https://bitbucket.org/ms2ger/test-runner/raw/tip/manifests.txt>.
MIT License
* testharnessreport.js.in
Glue between testharness.js and our Mochitest runner.
MPL
* importTestsuite.py
Imports a test suite from a remote repository. Takes one argument, a file in
the format described under webapps.txt.
Note: removes both source and destination directory before starting. Do not
use with outstanding changes in either directory.
MPL
* Makefile.in
Integration with our build system. Installs support files into /resources and
includes a .mk file for each repository.
MPL
* failures.txt
List of JSON files with expected failures.
* html.json / webapps.json / ...
Expected failures for tests in the webapps repository.
* html.mk / webapps.mk / ...
Generated by importTestsuite.py from webapps.txt.
Contains a list of the directories with tests. To be included in Makefile.in.
* html.txt / webapps.txt / ...
Input to importTestsuite.py.
Lists the URL of the repository and the destination directory (separated by a
vertical bar), followed by a list of directories within the repository
(separated by line feeds).
* html / webapps / ...
Actual tests.
W3C Test Suite License / W3C 3-clause BSD License
* writeReporter.py
Generates testharness.js from testharnessreport.js.in and the JSON files for
repositories listed in failures.txt.
MPL
=====================================================================
Importing an additional directory from an already-imported repository
=====================================================================
Add a line to the relevant data file (e.g. webapps.txt), with the path to the
additional directory relative to the root of the remote repository, and then run
the importTestsuite.py script, passing the data file as its argument.
==========================
Importing a new test suite
==========================
Create a data file in the format documented above, and run the
importTestsuite.py script, passing the data file as its argument.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
html
webapps

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,3 @@
DIRS += \
html/tests/submission/Mozilla \
$(NULL)

View File

@ -0,0 +1,2 @@
https://dvcs.w3.org/hg/html|html
tests/submission/Mozilla

View File

@ -0,0 +1,31 @@
# THIS FILE IS AUTOGENERATED - DO NOT EDIT
DEPTH = ../../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/tests/mochitest/w3c/html/tests/submission/Mozilla
DIRS = \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TESTS = \
test_body-onload.html \
test_pageload-image.html \
test_pageload-video.html \
test_script-for-onload.html \
test_window-onerror-parse-error.html \
test_window-onerror-runtime-error.html \
test_window-onerror-runtime-error-throw.html \
$(NULL)
_TESTS += \
nested-document-write-external.js \
$(NULL)
libs:: $(_TESTS)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1 @@
document.write("w"); document.write("o");

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>HTMLBodyElement.onload</title>
<link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu">
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#handler-window-onload">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test("body.onload should set the window.onload handler")
window.onload = t.step_func(function() {
assert_unreached("This handler should be overwritten.")
})
var b = document.createElement("body")
b.onload = t.step_func(function(e) {
assert_equals(e.currentTarget, window,
"The event should be fired at the window.")
t.done()
})
</script>

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media documents: image</title>
<link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com">
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#read-media">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("The document for a standalone media file should have one child in the body.");
function frameLoaded() {
var testframe = document.getElementById('testframe');
var testframeChildren = testframe.contentDocument.body.childNodes;
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
assert_equals(testframeChildren[0].nodeName, "IMG", "Only child of body must be an <img> element");
assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
"Only child of body must be an HTML element");
t.done();
}
</script>
</head>
<body>
<div id="log"></div>
<iframe id="testframe" onload="t.step(frameLoaded)"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oMFgQGMyFwHucAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"></iframe>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media documents: video</title>
<link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com">
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#read-media">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("The document for a standalone media file should have one child in the body.");
function frameLoaded() {
var testframe = document.getElementById('testframe');
var testframeChildren = testframe.contentDocument.body.childNodes;
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
assert_equals(testframeChildren[0].nodeName, "VIDEO", "Only child of body must be an <video> element");
assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
"Only child of body must be an HTML element");
t.done();
}
</script>
</head>
<body>
<div id="log"></div>
<iframe id="testframe" onload="t.step(frameLoaded)"
src="data:video/webm,"></iframe>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<title>Script for and onload attributes</title>
<link rel="author" title="Matheus Kerschbaum" href="mailto:matjk7@gmail.com">
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#prepare-a-script">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test("Script for and onload attributes");
</script>
<script for=" window " event=" onload() ">
var foo = "bar";
</script>
<script for="object" event="handler">
// This script should fail to run
foo = "baz";
t.step(function() { assert_unreached("This script should fail to run."); });
</script>
<script>
t.step(function() { assert_equals(foo, "bar", "Correct script was executed."); });
t.done();
</script>

View File

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>window.onerror: parse errors</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
In http://dev.w3.org/html5/spec/webappapis.html#creating-scripts ,
step 3 describes parsing the script, and step 5 says:
# Otherwise, report the error using the onerror event handler of
# the script's global object. If the error is still not handled
# after this, then the error may be reported to the user.
which links to
http://dev.w3.org/html5/spec/webappapis.html#report-the-error ,
which describes what to do when onerror is a Function.
-->
</head>
<body>
<div id="log"></div>
<script>
var error_count = 0;
window.onerror = function(msg, url, lineno) {
++error_count;
test(function() {assert_equals(url, window.location.href)},
"correct url passed to window.onerror");
test(function() {assert_equals(lineno, 33)},
"correct line number passed to window.onerror");
};
</script>
<script>This script does not parse correctly.</script>
<script>
test(function() {assert_equals(error_count, 1)},
"correct number of calls to window.onerror");
</script>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<title>window.onerror: runtime scripterrors</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
http://www.w3.org/TR/html5/webappapis.html#runtime-script-errors
says what to do for uncaught runtime script errors, and just below
describes what to do when onerror is a Function.
-->
</head>
<body>
<div id="log"></div>
<script>
var error_count = 0;
window.onerror = function(msg, url, lineno) {
++error_count;
};
</script>
<script>
try {
// This error is caught, so it should NOT trigger onerror.
throw "foo";
} catch (ex) {
}
// This error is NOT caught, so it should trigger onerror.
throw "bar";
</script>
<script>
test(function() {assert_equals(error_count, 1)},
"correct number of calls to window.onerror");
</script>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<title>window.onerror: runtime scripterrors</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
http://www.w3.org/TR/html5/webappapis.html#runtime-script-errors
says what to do for uncaught runtime script errors, and just below
describes what to do when onerror is a Function.
-->
</head>
<body>
<div id="log"></div>
<script>
var error_count = 0;
window.onerror = function(msg, url, lineno) {
++error_count;
test(function() {assert_equals(url, window.location.href)},
"correct url passed to window.onerror");
test(function() {assert_equals(lineno, 35)},
"correct line number passed to window.onerror");
};
</script>
<script>
try {
// This error is caught, so it should NOT trigger onerror.
window.nonexistentproperty.oops();
} catch (ex) {
}
// This error is NOT caught, so it should trigger onerror.
window.nonexistentproperty.oops();
</script>
<script>
test(function() {assert_equals(error_count, 1)},
"correct number of calls to window.onerror");
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,176 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Imports a test suite from a remote repository. Takes one argument, a file in
the format described in README.
Note: removes both source and destination directory before starting. Do not
use with outstanding changes in either directory.
"""
import os
import shutil
import string
import subprocess
import sys
import parseManifest
def parseManifestFile(dest, dir):
subdirs, mochitests, _, __, supportfiles = parseManifest.parseManifestFile("hg-%s/%s/MANIFEST" % (dest, dir))
return subdirs, mochitests, supportfiles
def getData(confFile):
"""This function parses a file of the form
URL of remote repository|Name of the destination directory
First directory of tests
...
Last directory of tests"""
repo = ""
dest = ""
directories = []
try:
fp = open(confFile, "rb")
first = True
for line in fp:
if first:
idx = line.index("|")
repo = line[:idx].strip()
dest = line[idx + 1:].strip()
first = False
else:
directories.append(line.strip())
finally:
fp.close()
return repo, dest, directories
def copy(thissrcdir, dest, directories):
"""Copy mochitests and support files from the external HG directory to their
place in mozilla-central.
"""
print "Copying %s..." % (directories, )
for d in directories:
dirtocreate = dest
os.makedirs(d)
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
sourcedir = "hg-%s/%s" % (dest, d)
destdir = "%s/%s" % (dest, d)
for mochitest in mochitests:
shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
for support in supportfiles:
shutil.copy("%s/%s" % (sourcedir, support), "%s/%s" % (destdir, support))
if len(subdirs):
importDirs(thissrcdir, dest, ["%s/%s" % (d, subdir) for subdir in subdirs])
def printMakefile(dest, directories):
"""Create a .mk file to be included into the main Makefile.in, which lists the
directories with tests.
"""
print "Creating .mk..."
path = dest + ".mk"
fp = open(path, "wb")
fp.write("DIRS += \\\n")
fp.writelines([" %s/%s \\\n" % (dest, d) for d in directories])
fp.write(" $(NULL)\n")
fp.close()
subprocess.check_call(["hg", "add", path])
makefileTemplate = """# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DEPTH = ${depth}
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = ${relativesrcdir}
DIRS = \\
${dirs}
include $$(DEPTH)/config/autoconf.mk
include $$(topsrcdir)/config/rules.mk
"""
testsTemplate = """
_TESTS = \\
${tests}
_TESTS += \\
${support}
libs:: $$(_TESTS)
\t$$(INSTALL) $$(foreach f,$$^,"$$f") $$(DEPTH)/_tests/testing/mochitest/tests/$$(relativesrcdir)
"""
def makefileString(entries):
if not len(entries):
return " $(NULL)"
return "\n".join([" %s \\" % (entry, ) for entry in entries]) + "\n $(NULL)"
def printMakefiles(thissrcdir, dest, directories):
"""Create Makefile.in files for each directory that contains tests we import.
"""
print "Creating Makefile.ins..."
for d in directories:
path = "%s/%s" % (dest, d)
abspath = "%s/%s" % (thissrcdir, path)
print "Creating Makefile.in in %s..." % (path, )
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
fp = open(path + "/Makefile.in", "wb")
result = string.Template(makefileTemplate).substitute({
"depth": "..%s" % ("/.." * abspath.count("/"), ),
"relativesrcdir": "%s/%s" % (thissrcdir, path),
"dirs": makefileString(subdirs)
})
if len(mochitests) + len(supportfiles):
result += string.Template(testsTemplate).substitute({
"tests": makefileString(["test_%s" % (mochitest, ) for mochitest in mochitests]),
"support": makefileString(supportfiles)
})
fp.write(result)
fp.close()
def hgadd(dest, directories):
"""Inform hg of the files in |directories|."""
print "hg adding..."
for d in directories:
subprocess.check_call(["hg", "add", "%s/%s" % (dest, d)])
def importDirs(thissrcdir, dest, directories):
copy(thissrcdir, dest, directories)
printMakefiles(thissrcdir, dest, directories)
def importRepo(confFile, thissrcdir):
try:
repo, dest, directories = getData(confFile)
hgdest = "hg-%s" % (dest, )
print "Going to clone %s to %s..." % (repo, hgdest)
print "Removing %s..." % dest
subprocess.check_call(["rm", "--recursive", "--force", dest])
print "Removing %s..." % hgdest
subprocess.check_call(["rm", "--recursive", "--force", hgdest])
print "Cloning %s to %s..." % (repo, hgdest)
subprocess.check_call(["hg", "clone", repo, hgdest])
print "Going to import %s..." % (directories, )
importDirs(thissrcdir, dest, directories)
printMakefile(dest, directories)
hgadd(dest, directories)
print "Removing %s again..." % hgdest
subprocess.check_call(["rm", "--recursive", "--force", hgdest])
except subprocess.CalledProcessError, e:
print e.returncode
finally:
print "Done"
if __name__ == "__main__":
if len(sys.argv) == 2:
print "Need one argument."
else:
importRepo(sys.argv[1], "dom/tests/mochitest/w3c")

View File

@ -0,0 +1,64 @@
# Copyright (C) 2011-2012 Ms2ger
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
def parseManifest(fd):
def parseReftestLine(chunks):
assert len(chunks) % 2 == 0
reftests = []
for i in range(2, len(chunks), 2):
if not chunks[i] in ["==", "!="]:
raise Exception("Misformatted reftest line " + line)
reftests.append([chunks[i], chunks[1], chunks[i + 1]])
return reftests
dirs = []
autotests = []
reftests = []
othertests = []
supportfiles = []
for fullline in fd:
line = fullline.strip()
if not line:
continue
chunks = line.split(" ")
if chunks[0] == "MANIFEST":
raise Exception("MANIFEST listed on line " + line)
if chunks[0] == "dir" or (chunks[0] == "support" and chunks[1] == "dir"):
dirs.append(chunks[1]);
elif chunks[0] == "ref":
if len(chunks) % 2:
raise Exception("Missing chunk in line " + line)
reftests.extend(parseReftestLine(chunks))
elif chunks[0] == "support":
supportfiles.append(chunks[1])
elif chunks[0] in ["manual", "parser"]:
othertests.append(chunks[1])
else: # automated
autotests.append(chunks[0])
return dirs, autotests, reftests, othertests, supportfiles
def parseManifestFile(path):
fp = open(path)
dirs, autotests, reftests, othertests, supportfiles = parseManifest(fp)
fp.close()
return dirs, autotests, reftests, othertests, supportfiles

View File

@ -0,0 +1,70 @@
html {
font-family:DejaVu Sans, Bitstream Vera Sans, Arial, Sans;
}
section#summary {
margin-bottom:1em;
}
table#results {
border-collapse:collapse;
table-layout:fixed;
width:100%;
}
table#results th:first-child,
table#results td:first-child {
width:4em;
}
table#results th:last-child,
table#results td:last-child {
width:50%;
}
table#results th {
padding:0;
padding-bottom:0.5em;
border-bottom:medium solid black;
}
table#results td {
padding:1em;
padding-bottom:0.5em;
border-bottom:thin solid black;
}
tr.pass > td:first-child {
color:green;
}
tr.fail > td:first-child {
color:red;
}
tr.timeout > td:first-child {
color:red;
}
tr.notrun > td:first-child {
color:blue;
}
.pass .fail .timeout .notrun > td:first-child {
font-variant:small-caps;
}
table#results span {
display:block;
}
table#results span.expected {
font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
white-space:pre;
}
table#results span.actual {
font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
white-space:pre;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,120 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var W3CTest = {
/**
* Dictionary mapping a test URL to either the string "all", which means that
* all tests in this file are expected to fail, or a dictionary mapping test
* names to either the boolean |true|, or the string "debug". The former
* means that this test is expected to fail in all builds, and the latter
* that it is only expected to fail in debug builds.
*
* This is filled in by the writeReporter.py script.
*/
"expectedFailures": ${expectations},
/**
* List of test results, needed by TestRunner to update the UI.
*/
"tests": [],
/**
* Reference to the TestRunner object in the parent frame.
*/
"runner": parent === this ? null : parent.TestRunner || parent.wrappedJSObject.TestRunner,
/**
* Prefixes for the error logging. Indexed first by int(todo) and second by
* int(result).
*/
"prefixes": [
["TEST-UNEXPECTED-FAIL", "TEST-PASS"],
["TEST-KNOWN-FAIL", "TEST-UNEXPECTED-PASS"]
],
/**
* Returns the URL of the current test, relative to the root W3C tests
* directory. Used as a key into the expectedFailures dictionary.
*/
"getURL": function() {
return this.runner.currentTestURL.substring("/tests/dom/tests/mochitest/w3c/".length);
},
/**
* Lets the test runner know about a test result.
*/
"_log": function(test) {
var msg = this.prefixes[+test.todo][+test.result] + " | ";
if (this.runner.currentTestURL)
msg += this.runner.currentTestURL;
msg += " | " + test.message;
this.runner[(test.result === !test.todo) ? "log" : "error"](msg);
},
/**
* Reports a test result. The argument is an object with the following
* properties:
*
* o message (string): message to be reported
* o result (boolean): whether this test failed
* o todo (boolean): whether this test is expected to fail
*/
"report": function(test) {
this.tests.push(test);
this._log(test);
},
/**
* Returns true if this test is expected to fail, and false otherwise.
*/
"_todo": function(url, test) {
if (!(url in this.expectedFailures)) {
return false;
}
if (this.expectedFailures[url] === "all") {
return true;
}
var value = this.expectedFailures[url][test.name];
return value === true || (value === "debug" && !!SpecialPowers.isDebugBuild);
},
/**
* Callback function for testharness.js. Called when one test in a file
* finishes.
*/
"result": function(test) {
var url = this.getURL();
this.report({
"message": test.message || test.name,
"result": test.status === test.PASS,
"todo": this._todo(url, test)
});
},
/**
* Callback function for testharness.js. Called when the entire test file
* finishes.
*/
"finish": function(tests, status) {
var url = this.getURL();
this.report({
"message": "Finished test",
"result": status.status === status.OK,
"todo":
url in this.expectedFailures &&
this.expectedFailures[url] === "error"
});
this.runner.testFinished(this.tests);
}
};
(function() {
if (!W3CTest.runner) {
return;
}
add_result_callback(W3CTest.result.bind(W3CTest));
add_completion_callback(W3CTest.finish.bind(W3CTest));
setup({
"output": false
});
})();

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import subprocess
repo = "https://dvcs.w3.org/hg/resources"
dest = "resources-upstream"
files = ["testharness.js", "testharness.css", "idlharness.js", "WebIDLParser.js"]
subprocess.check_call(["hg", "clone", repo, dest])
for f in files:
subprocess.check_call(["cp", "%s/%s" % (dest, f), f])
subprocess.check_call(["hg", "add", f])
subprocess.check_call(["rm", "--recursive", "--force", dest])

View File

@ -0,0 +1,9 @@
{
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-10.xml": {
"document.getElementsByClassName(): compound": true
},
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-11.xml": {
"document.getElementsByClassName(): \"tricky\" compound": true
}
}

View File

@ -0,0 +1,3 @@
DIRS += \
webapps/DOMCore/tests/submissions/Opera \
$(NULL)

View File

@ -0,0 +1,2 @@
https://dvcs.w3.org/hg/webapps|webapps
DOMCore/tests/submissions/Opera

View File

@ -0,0 +1,41 @@
# THIS FILE IS AUTOGENERATED - DO NOT EDIT
DEPTH = ../../../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera
DIRS = \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TESTS = \
test_getElementsByClassName-01.htm \
test_getElementsByClassName-02.htm \
test_getElementsByClassName-03.htm \
test_getElementsByClassName-04.htm \
test_getElementsByClassName-05.htm \
test_getElementsByClassName-06.htm \
test_getElementsByClassName-07.htm \
test_getElementsByClassName-08.htm \
test_getElementsByClassName-09.htm \
test_getElementsByClassName-10.xml \
test_getElementsByClassName-11.xml \
test_getElementsByClassName-12.htm \
test_getElementsByClassName-13.htm \
test_getElementsByClassName-14.htm \
test_getElementsByClassName-15.htm \
test_getElementsByClassName-16.htm \
test_getElementsByClassName-17.htm \
test_getElementsByClassName-18.htm \
$(NULL)
_TESTS += \
$(NULL)
libs:: $(_TESTS)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1,13 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): simple</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script> test(function() {assert_array_equals(document.getElementsByClassName("\ta\n"),
[document.documentElement, document.body])}) </script>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!doctype html>
<html class="a
b">
<head>
<title>document.getElementsByClassName(): also simple</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a
">
<div id="log"></div>
<script> test(function() {assert_array_equals(document.getElementsByClassName("a\n"), [document.documentElement, document.body])}) </script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): changing classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a")
document.body.className = "b"
assert_array_equals(collection, [document.documentElement])
})
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): changing classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
document.body.className += "\tb";
assert_array_equals(collection, [document.documentElement, document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a">
<head>
<title>document.getElementsByClassName(): changing classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
document.body.removeAttribute("class");
assert_array_equals(collection, [document.documentElement]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(): adding element with class</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
var ele = document.createElement("foo");
ele.setAttribute("class", "a");
document.body.appendChild(ele);
assert_array_equals(collection, [document.body, ele]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(): multiple classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a b">
<div id="log"></div>
<script> test(function() {
assert_array_equals(document.getElementsByClassName("b\t\f\n\na\rb"), [document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(): multiple classes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script> test(function() {
document.getElementsByClassName("a\fa"), [document.body]
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html class="a A">
<head>
<title>document.getElementsByClassName(): case sensitive</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("A a"), [document.documentElement])
})
</script>
</body>
</html>

View File

@ -0,0 +1,17 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.w3.org/2000/svg">
<head>
<title>document.getElementsByClassName(): compound</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"/>
<x class="a"/>
<g:x class="a"/>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("a"),
document.getElementsByTagName("x"));
})
</script>
</body>
</html>

View File

@ -0,0 +1,22 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:t="http://tc.labs.opera.com/#test">
<head>
<title>document.getElementsByClassName(): "tricky" compound</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log" />
<x class="a"/>
<g:x class="a"/>
<x t:class="a" h:class="a" g:class="a"/>
<g:x t:class="a" h:class="a" g:class="a"/>
<t:x class="a" t:class="a" h:class="a" g:class="a"/>
<script>
test(function() {
var collection = document.getElementsByClassName("a");
var test = document.getElementsByTagName("x");
assert_array_equals(collection, [test[0], test[1]]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html class="a">
<head>
<title>element.getElementsByClassName(): simple</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.body.getElementsByClassName("a"), [])
})
</script>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!doctype html>
<html class="a">
<head>
<title>element.getElementsByClassName(): adding an element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a">
<div id="log"></div>
<script>test(function() {
var collection = document.body.getElementsByClassName("a");
var ele = document.createElement("x-y-z");
ele.className = "a";
document.body.appendChild(ele);
assert_array_equals(collection, [ele]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,16 @@
<!-- quirks mode -->
<html class="a A">
<head>
<title>document.getElementsByClassName(): case-insensitive (quirks mode)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName("A a"),
[document.documentElement, document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!doctype html>
<html class="a
b">
<head>
<title>document.getElementsByClassName(array): "a\n"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a
">
<div id="log"></div>
<script>test(function () {
assert_array_equals(document.getElementsByClassName(["a\n"]),
[document.documentElement, document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,16 @@
<!doctype html>
<html class="a
b">
<head>
<title>document.getElementsByClassName(array): "b","a"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="b,a">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName(["b", "a"]), [document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>document.getElementsByClassName(array): "b a"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a b">
<div id="log"></div>
<script>test(function() {
assert_array_equals(document.getElementsByClassName(["b a"]), [document.body]);
})
</script>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!doctype html>
<html class="a,b">
<head>
<title>element.getElementsByClassName(array): "a", "b"</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body class="a,b x">
<div id="log"></div>
<p id="r" class="a,bx"></p>
<script class="xa,b">test(function() {
assert_array_equals(document.documentElement.getElementsByClassName(["\fa","b\n"]),
[document.body])
})
</script>
</body>
</html>

View File

@ -0,0 +1,36 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import string
try:
import json
except ImportError:
import simplejson as json
def writeReporter(src):
src = src.replace("testharnessreport.js.in", "")
expectations = {}
fp = open(src + "failures.txt", "rb")
for line in fp:
gp = open(src + line.strip() + ".json")
expectations.update(json.load(gp))
gp.close()
fp.close()
fp = open(src + "testharnessreport.js.in", "rb")
template = fp.read()
fp.close()
fp = open("testharnessreport.js", "wb")
expjson = json.dumps(expectations,
indent = 2,
sort_keys = True,
separators = (',', ': '))
result = string.Template(template).substitute({ 'expectations': expjson })
fp.write(result)
fp.close()
if __name__ == "__main__":
writeReporter(sys.argv[1])

View File

@ -3139,26 +3139,10 @@ nsresult
nsEditor::GetLengthOfDOMNode(nsIDOMNode *aNode, PRUint32 &aCount)
{
aCount = 0;
if (!aNode) { return NS_ERROR_NULL_POINTER; }
nsresult result=NS_OK;
nsCOMPtr<nsIDOMCharacterData>nodeAsChar = do_QueryInterface(aNode);
if (nodeAsChar) {
nodeAsChar->GetLength(&aCount);
}
else
{
bool hasChildNodes;
aNode->HasChildNodes(&hasChildNodes);
if (hasChildNodes)
{
nsCOMPtr<nsIDOMNodeList>nodeList;
result = aNode->GetChildNodes(getter_AddRefs(nodeList));
if (NS_SUCCEEDED(result) && nodeList) {
nodeList->GetLength(&aCount);
}
}
}
return result;
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
aCount = node->Length();
return NS_OK;
}
@ -4172,17 +4156,8 @@ nsEditor::JoinNodeDeep(nsIDOMNode *aLeftNode,
{
// adjust out params
PRUint32 length;
if (IsTextNode(leftNodeToJoin))
{
nsCOMPtr<nsIDOMCharacterData>nodeAsText;
nodeAsText = do_QueryInterface(leftNodeToJoin);
nodeAsText->GetLength(&length);
}
else
{
res = GetLengthOfDOMNode(leftNodeToJoin, length);
NS_ENSURE_SUCCESS(res, res);
}
res = GetLengthOfDOMNode(leftNodeToJoin, length);
NS_ENSURE_SUCCESS(res, res);
*aOutJoinNode = rightNodeToJoin;
*outOffset = length;

View File

@ -50,8 +50,6 @@ EXPORTS = \
gfx3DMatrix.h \
gfxASurface.h \
gfxAlphaRecovery.h \
gfxAtomList.h \
gfxAtoms.h \
gfxBlur.h \
gfxCachedTempSurface.h \
gfxColor.h \
@ -175,8 +173,6 @@ EXPORTS += \
gfxGDIFont.h \
gfxGDIFontList.h \
gfxPlatformFontList.h \
gfxAtoms.h \
gfxAtomList.h \
$(NULL)
endif
@ -193,7 +189,6 @@ CPPSRCS = \
gfxFontMissingGlyphs.cpp \
gfxFontTest.cpp \
gfxFontUtils.cpp \
gfxAtoms.cpp \
gfxMatrix.cpp \
gfxPath.cpp \
gfxPattern.cpp \

View File

@ -1,103 +0,0 @@
/* -*- Mode: C++; tab-width: 20; 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 Mozilla Foundation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 ***** */
/******
This file contains the list of all gfx language nsIAtoms and their values
It is designed to be used as inline input to gfxAtoms.cpp *only*
through the magic of C preprocessing.
All entries must be enclosed in the macro GFX_ATOM which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
The first argument to GFX_ATOM is the C++ identifier of the atom
The second argument is the string value of the atom
******/
// language codes specifically referenced in the gfx code
GFX_ATOM(en, "en")
GFX_ATOM(x_unicode, "x-unicode")
GFX_ATOM(x_western, "x-western")
GFX_ATOM(ja, "ja")
GFX_ATOM(ko, "ko")
GFX_ATOM(zh_cn, "zh-cn")
GFX_ATOM(zh_hk, "zh-hk")
GFX_ATOM(zh_tw, "zh-tw")
// additional codes used in nsUnicodeRange.cpp
GFX_ATOM(x_cyrillic, "x-cyrillic")
GFX_ATOM(el, "el")
GFX_ATOM(tr, "tr")
GFX_ATOM(he, "he")
GFX_ATOM(ar, "ar")
GFX_ATOM(x_baltic, "x-baltic")
GFX_ATOM(th, "th")
GFX_ATOM(x_devanagari, "x-devanagari")
GFX_ATOM(x_tamil, "x-tamil")
GFX_ATOM(x_armn, "x-armn")
GFX_ATOM(x_beng, "x-beng")
GFX_ATOM(x_cans, "x-cans")
GFX_ATOM(x_ethi, "x-ethi")
GFX_ATOM(x_geor, "x-geor")
GFX_ATOM(x_gujr, "x-gujr")
GFX_ATOM(x_guru, "x-guru")
GFX_ATOM(x_khmr, "x-khmr")
GFX_ATOM(x_knda, "x-knda")
GFX_ATOM(x_mlym, "x-mlym")
GFX_ATOM(x_orya, "x-orya")
GFX_ATOM(x_sinh, "x-sinh")
GFX_ATOM(x_telu, "x-telu")
GFX_ATOM(x_tibt, "x-tibt")
// used in gfxGDIFontList.h
GFX_ATOM(ko_xxx, "ko-xxx")
GFX_ATOM(x_central_euro, "x-central-euro")
GFX_ATOM(x_symbol, "x-symbol")
// referenced in all.js
GFX_ATOM(x_user_def, "x-user-def")
// additional languages that use Turkish-style case transformation
GFX_ATOM(az, "az")
GFX_ATOM(ba, "ba")
GFX_ATOM(crh, "crh")
GFX_ATOM(tt, "tt")

View File

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 20; 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 Mozilla Foundation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 "mozilla/Util.h"
#include "gfxAtoms.h"
#include "nsStaticAtom.h"
#include "nsMemory.h"
using namespace mozilla;
#define GFX_ATOM(name_, value_) nsIAtom* gfxAtoms::name_ = 0;
#include "gfxAtomList.h"
#undef GFX_ATOM
#define GFX_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
#include "gfxAtomList.h"
#undef GFX_ATOM
static const nsStaticAtom atoms[] = {
#define GFX_ATOM(name_, value_) NS_STATIC_ATOM(name_##_buffer, &gfxAtoms::name_),
#include "gfxAtomList.h"
#undef GFX_ATOM
};
void gfxAtoms::RegisterAtoms()
{
NS_RegisterStaticAtoms(atoms);
}

Some files were not shown because too many files have changed in this diff Show More