diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 99648476cf8..36dc3ff2f96 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -387,15 +387,10 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent) NS_ASSERTION(targetDocument, "No document while accessible is in document?!"); nsINode* targetNode = accessible->GetNode(); - nsIContent* targetContent = targetNode->IsElement() ? - targetNode->AsElement() : nsnull; - nsIContent* origTargetContent = origTargetNode->IsElement() ? - origTargetNode->AsElement() : nsnull; #ifdef MOZ_XUL - bool isTree = targetContent ? - targetContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) : - PR_FALSE; + bool isTree = targetNode->IsElement() && + targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL); if (isTree) { nsRefPtr treeAcc = do_QueryObject(accessible); diff --git a/content/base/public/nsDeprecatedOperationList.h b/content/base/public/nsDeprecatedOperationList.h index 00e0fa4dfad..0427e82ca9a 100644 --- a/content/base/public/nsDeprecatedOperationList.h +++ b/content/base/public/nsDeprecatedOperationList.h @@ -71,10 +71,10 @@ DEPRECATED_OPERATION(IsSupported) DEPRECATED_OPERATION(IsEqualNode) DEPRECATED_OPERATION(TextContent) DEPRECATED_OPERATION(EnablePrivilege) +DEPRECATED_OPERATION(Position) +DEPRECATED_OPERATION(TotalSize) DEPRECATED_OPERATION(IsSameNode) -DEPRECATED_OPERATION(ReplaceWholeText) DEPRECATED_OPERATION(GlobalStorage) -DEPRECATED_OPERATION(XmlEncoding) DEPRECATED_OPERATION(XmlVersion) DEPRECATED_OPERATION(InputEncoding) DEPRECATED_OPERATION(XmlStandalone) diff --git a/content/base/public/nsIFrameMessageManager.idl b/content/base/public/nsIFrameMessageManager.idl index 2977298e31d..9c65179813a 100644 --- a/content/base/public/nsIFrameMessageManager.idl +++ b/content/base/public/nsIFrameMessageManager.idl @@ -64,24 +64,26 @@ interface nsIFrameMessageListener : nsISupports void receiveMessage(); }; -[scriptable, uuid(6b736edb-863d-40bd-bca2-62f44da803c0)] +[scriptable, uuid(a27d8fcd-8de9-4a51-87f4-2b83bba901d5)] interface nsIFrameMessageManager : nsISupports { void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener); void removeMessageListener(in AString aMessage, in nsIFrameMessageListener aListener); - void sendAsyncMessage(/*in messageName, in JSON*/); + [implicit_jscontext,optional_argc] + void sendAsyncMessage([optional] in AString messageName, [optional] in jsval obj); }; -[scriptable, uuid(cdb1a40b-9862-426c-ae8a-f5ab84e20e32)] +[scriptable, uuid(21e5d940-d457-4c0f-bb5e-35c159ed19e3)] interface nsISyncMessageSender : nsIFrameMessageManager { /** * Returns an array of JSON objects. */ - void sendSyncMessage(/*in messageName, in JSON*/); + [implicit_jscontext,optional_argc] + jsval sendSyncMessage([optional] in AString messageName, [optional] in jsval obj); }; -[scriptable, uuid(6f23339f-2b5c-4f22-a03f-bb7ec101f83d)] +[scriptable, uuid(78a1d024-60e3-4b7b-98cd-4c6b84b4f060)] interface nsIContentFrameMessageManager : nsISyncMessageSender { /** @@ -112,20 +114,20 @@ interface nsIContentFrameMessageManager : nsISyncMessageSender DOMString btoa(in DOMString aBase64Data); }; -[uuid(9c48d557-92fe-4edb-95fc-bfe97e77bdc3)] +[uuid(1f7af930-a232-4a84-a049-73eaa45f2db5)] interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager { [notxpcom] nsIContent getOwnerContent(); }; -[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)] +[scriptable, uuid(e91b0939-a74a-4c4f-8cfd-17dd42e8642a)] interface nsITreeItemFrameMessageManager : nsIFrameMessageManager { readonly attribute unsigned long childCount; nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex); }; -[scriptable, uuid(9e5c0526-aa4c-49f0-afbb-57f489cd9b59)] +[scriptable, uuid(14e1f147-793d-4788-bbbb-ae806ecdddbb)] interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager { /** diff --git a/content/base/src/nsAttrValue.cpp b/content/base/src/nsAttrValue.cpp index 4525b396865..91791576fd6 100644 --- a/content/base/src/nsAttrValue.cpp +++ b/content/base/src/nsAttrValue.cpp @@ -1356,70 +1356,70 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict, bool aCanBePercent, bool* aIsPercent) const { - *aStrict = PR_FALSE; + *aStrict = true; *aErrorCode = NS_ERROR_ILLEGAL_VALUE; if (aCanBePercent) { - *aIsPercent = PR_FALSE; + *aIsPercent = false; } nsAString::const_iterator iter, end; aValue.BeginReading(iter); aValue.EndReading(end); + + while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) { + *aStrict = false; + ++iter; + } + + if (iter == end) { + return 0; + } + bool negate = false; + if (*iter == PRUnichar('-')) { + negate = true; + ++iter; + } else if (*iter == PRUnichar('+')) { + *aStrict = false; + ++iter; + } + PRInt32 value = 0; - if (iter != end) { - if (*iter == PRUnichar('-')) { - negate = PR_TRUE; + PRInt32 pValue = 0; // Previous value, used to check integer overflow + while (iter != end) { + if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) { + value = (value * 10) + (*iter - PRUnichar('0')); ++iter; - } - if (iter != end) { - if ((*iter >= PRUnichar('1') || (*iter == PRUnichar('0') && !negate)) && - *iter <= PRUnichar('9')) { - value = *iter - PRUnichar('0'); - ++iter; - *aStrict = (value != 0 || iter == end || - (aCanBePercent && *iter == PRUnichar('%'))); - while (iter != end && *aStrict) { - if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) { - value = (value * 10) + (*iter - PRUnichar('0')); - ++iter; - if (iter != end && value > ((PR_INT32_MAX / 10) - 9)) { - *aStrict = PR_FALSE; - } - } else if (aCanBePercent && *iter == PRUnichar('%')) { - ++iter; - if (iter == end) { - *aIsPercent = PR_TRUE; - } else { - *aStrict = PR_FALSE; - } - } else { - *aStrict = PR_FALSE; - } - } - if (*aStrict) { - if (negate) { - value = -value; - } - if (!aCanBePercent || !*aIsPercent) { - *aErrorCode = NS_OK; -#ifdef DEBUG - nsAutoString stringValue; - stringValue.AppendInt(value); - if (aCanBePercent && *aIsPercent) { - stringValue.AppendLiteral("%"); - } - NS_ASSERTION(stringValue.Equals(aValue), "Wrong conversion!"); -#endif - return value; - } - } + // Checking for integer overflow. + if (pValue > value) { + *aStrict = false; + *aErrorCode = NS_ERROR_ILLEGAL_VALUE; + break; + } else { + pValue = value; + *aErrorCode = NS_OK; } + } else if (aCanBePercent && *iter == PRUnichar('%')) { + ++iter; + *aIsPercent = true; + if (iter != end) { + *aStrict = false; + break; + } + } else { + *aStrict = false; + break; + } + } + if (negate) { + value = -value; + // Checking the special case of -0. + if (!value) { + *aStrict = false; } } - nsAutoString tmp(aValue); - return tmp.ToInteger(aErrorCode); + return value; } PRInt64 diff --git a/content/base/src/nsDOMLists.cpp b/content/base/src/nsDOMLists.cpp index c48ee6a111d..641a9f419ec 100644 --- a/content/base/src/nsDOMLists.cpp +++ b/content/base/src/nsDOMLists.cpp @@ -38,8 +38,7 @@ * ***** END LICENSE BLOCK ***** */ /* - * Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various - * DOM3 stuff and some interfaces specified by WHATWG. + * Implementation of nsIDOMDOMStringList, used by various DOM stuff. */ #include "nsDOMLists.h" @@ -95,92 +94,3 @@ nsDOMStringList::Contains(const nsAString& aString, bool *aResult) return NS_OK; } - - -nsNameList::nsNameList() -{ -} - -nsNameList::~nsNameList() -{ -} -DOMCI_DATA(NameList, nsNameList) - -NS_IMPL_ADDREF(nsNameList) -NS_IMPL_RELEASE(nsNameList) -NS_INTERFACE_TABLE_HEAD(nsNameList) - NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsNameList) - NS_INTERFACE_TABLE_ENTRY(nsNameList, nsIDOMNameList) - NS_OFFSET_AND_INTERFACE_TABLE_END - NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE - NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NameList) - NS_INTERFACE_MAP_END - -NS_IMETHODIMP -nsNameList::GetName(PRUint32 aIndex, nsAString& aResult) -{ - if (aIndex >= mNames.Length()) { - SetDOMStringToNull(aResult); - } else { - aResult = mNames[aIndex]; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsNameList::GetNamespaceURI(PRUint32 aIndex, nsAString& aResult) -{ - if (aIndex >= mNames.Length()) { - SetDOMStringToNull(aResult); - } else { - aResult = mNamespaceURIs[aIndex]; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsNameList::GetLength(PRUint32 *aLength) -{ - *aLength = mNames.Length(); - - return NS_OK; -} - -bool -nsNameList::Add(const nsAString& aNamespaceURI, const nsAString& aName) -{ - PRUint32 count = mNamespaceURIs.Length(); - if (mNamespaceURIs.InsertElementAt(count, aNamespaceURI)) { - if (mNames.InsertElementAt(count, aName)) { - return PR_TRUE; - } - mNamespaceURIs.RemoveElementAt(count); - } - - return PR_FALSE; -} - -NS_IMETHODIMP -nsNameList::Contains(const nsAString& aName, bool *aResult) -{ - *aResult = mNames.Contains(aName); - - return NS_OK; -} - -NS_IMETHODIMP -nsNameList::ContainsNS(const nsAString& aNamespaceURI, const nsAString& aName, - bool *aResult) -{ - PRUint32 index = mNames.IndexOf(aName); - if (index != mNames.NoIndex) { - *aResult = mNamespaceURIs[index].Equals(aNamespaceURI); - } - else { - *aResult = PR_FALSE; - } - - return NS_OK; -} diff --git a/content/base/src/nsDOMLists.h b/content/base/src/nsDOMLists.h index d4452e8ddba..2933d2e29f7 100644 --- a/content/base/src/nsDOMLists.h +++ b/content/base/src/nsDOMLists.h @@ -38,15 +38,13 @@ * ***** END LICENSE BLOCK ***** */ /* - * Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various - * DOM3 stuff and some interfaces specified by WHATWG. + * Implementation of nsIDOMDOMStringList, used by various DOM stuff. */ #ifndef nsDOMLists_h___ #define nsDOMLists_h___ #include "nsIDOMDOMStringList.h" -#include "nsIDOMNameList.h" #include "nsTArray.h" #include "nsString.h" @@ -68,20 +66,4 @@ private: nsTArray mNames; }; -class nsNameList : public nsIDOMNameList -{ -public: - nsNameList(); - virtual ~nsNameList(); - - NS_DECL_ISUPPORTS - NS_DECL_NSIDOMNAMELIST - - bool Add(const nsAString& aNamespaceURI, const nsAString& aName); - -private: - nsTArray mNamespaceURIs; - nsTArray mNames; -}; - #endif /* nsDOMLists_h___ */ diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 59fb5191553..684347cf5ab 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -4493,11 +4493,6 @@ nsDocument::CreateProcessingInstruction(const nsAString& aTarget, { *aReturn = nsnull; - // There are no PIs for HTML - if (IsHTML()) { - return NS_ERROR_DOM_NOT_SUPPORTED_ERR; - } - nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE); NS_ENSURE_SUCCESS(rv, rv); @@ -5893,23 +5888,6 @@ nsDocument::GetInputEncoding(nsAString& aInputEncoding) return NS_OK; } -NS_IMETHODIMP -nsDocument::GetXmlEncoding(nsAString& aXmlEncoding) -{ - WarnOnceAbout(eXmlEncoding); - if (!IsHTML() && - mXMLDeclarationBits & XML_DECLARATION_BITS_DECLARATION_EXISTS && - mXMLDeclarationBits & XML_DECLARATION_BITS_ENCODING_EXISTS) { - // XXX We don't store the encoding given in the xml declaration. - // For now, just output the inputEncoding which we do store. - GetInputEncoding(aXmlEncoding); - } else { - SetDOMStringToNull(aXmlEncoding); - } - - return NS_OK; -} - NS_IMETHODIMP nsDocument::GetXmlStandalone(bool *aXmlStandalone) { @@ -8467,114 +8445,114 @@ nsIDocument::SizeOf() const return size; } -// Returns the root document in a document hierarchy. -static nsIDocument* -GetRootDocument(nsIDocument* aDoc) -{ - if (!aDoc) { - return nsnull; - } - nsCOMPtr shell = aDoc->GetShell(); - if (!shell) { - return nsnull; - } - nsPresContext* ctx = shell->GetPresContext(); - if (!ctx) { - return nsnull; - } - nsRootPresContext* rpc = ctx->GetRootPresContext(); - if (!rpc) { - return nsnull; - } - return rpc->Document(); -} - -class nsDispatchFullScreenChange : public nsRunnable -{ -public: - nsDispatchFullScreenChange(nsIDocument *aDoc) - : mDoc(aDoc) - { - mTarget = aDoc->GetFullScreenElement(); - if (!mTarget) { - mTarget = aDoc; - } - } - - NS_IMETHOD Run() - { - nsContentUtils::DispatchTrustedEvent(mDoc, - mTarget, - NS_LITERAL_STRING("mozfullscreenchange"), - PR_TRUE, - PR_FALSE); - return NS_OK; - } - - nsCOMPtr mDoc; - nsCOMPtr mTarget; -}; - -void -nsDocument::UpdateFullScreenStatus(bool aIsFullScreen) -{ - if (mIsFullScreen != aIsFullScreen) { - nsCOMPtr event(new nsDispatchFullScreenChange(this)); - NS_DispatchToCurrentThread(event); - } - mIsFullScreen = aIsFullScreen; - if (!mIsFullScreen) { - // Full-screen is being turned off. Reset the full-screen element, to - // save us from having to traverse the document hierarchy again in - // MozCancelFullScreen(). - ResetFullScreenElement(); - } -} - -static bool -UpdateFullScreenStatus(nsIDocument* aDocument, void* aData) -{ - aDocument->UpdateFullScreenStatus(*static_cast(aData)); - aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData); - return PR_TRUE; -} - -static void -UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen) -{ - nsIDocument* root = GetRootDocument(aDoc); - if (root) { - UpdateFullScreenStatus(root, static_cast(&aIsFullScreen)); - } -} - -void -nsDocument::ResetFullScreenElement() -{ +// Returns the root document in a document hierarchy. +static nsIDocument* +GetRootDocument(nsIDocument* aDoc) +{ + if (!aDoc) { + return nsnull; + } + nsCOMPtr shell = aDoc->GetShell(); + if (!shell) { + return nsnull; + } + nsPresContext* ctx = shell->GetPresContext(); + if (!ctx) { + return nsnull; + } + nsRootPresContext* rpc = ctx->GetRootPresContext(); + if (!rpc) { + return nsnull; + } + return rpc->Document(); +} + +class nsDispatchFullScreenChange : public nsRunnable +{ +public: + nsDispatchFullScreenChange(nsIDocument *aDoc) + : mDoc(aDoc) + { + mTarget = aDoc->GetFullScreenElement(); + if (!mTarget) { + mTarget = aDoc; + } + } + + NS_IMETHOD Run() + { + nsContentUtils::DispatchTrustedEvent(mDoc, + mTarget, + NS_LITERAL_STRING("mozfullscreenchange"), + PR_TRUE, + PR_FALSE); + return NS_OK; + } + + nsCOMPtr mDoc; + nsCOMPtr mTarget; +}; + +void +nsDocument::UpdateFullScreenStatus(bool aIsFullScreen) +{ + if (mIsFullScreen != aIsFullScreen) { + nsCOMPtr event(new nsDispatchFullScreenChange(this)); + NS_DispatchToCurrentThread(event); + } + mIsFullScreen = aIsFullScreen; + if (!mIsFullScreen) { + // Full-screen is being turned off. Reset the full-screen element, to + // save us from having to traverse the document hierarchy again in + // MozCancelFullScreen(). + ResetFullScreenElement(); + } +} + +static bool +UpdateFullScreenStatus(nsIDocument* aDocument, void* aData) +{ + aDocument->UpdateFullScreenStatus(*static_cast(aData)); + aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData); + return PR_TRUE; +} + +static void +UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen) +{ + nsIDocument* root = GetRootDocument(aDoc); + if (root) { + UpdateFullScreenStatus(root, static_cast(&aIsFullScreen)); + } +} + +void +nsDocument::ResetFullScreenElement() +{ if (mFullScreenElement) { nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_FALSE); - } - mFullScreenElement = nsnull; -} - -static bool -ResetFullScreenElement(nsIDocument* aDocument, void* aData) -{ - aDocument->ResetFullScreenElement(); - aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData); - return PR_TRUE; -} - -static void -ResetFullScreenElementInDocTree(nsIDocument* aDoc) -{ - nsIDocument* root = GetRootDocument(aDoc); - if (root) { - ResetFullScreenElement(root, nsnull); - } -} - -NS_IMETHODIMP + } + mFullScreenElement = nsnull; +} + +static bool +ResetFullScreenElement(nsIDocument* aDocument, void* aData) +{ + aDocument->ResetFullScreenElement(); + aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData); + return PR_TRUE; +} + +static void +ResetFullScreenElementInDocTree(nsIDocument* aDoc) +{ + nsIDocument* root = GetRootDocument(aDoc); + if (root) { + ResetFullScreenElement(root, nsnull); + } +} + +NS_IMETHODIMP nsDocument::MozCancelFullScreen() { if (!nsContentUtils::IsRequestFullScreenAllowed()) { @@ -8582,104 +8560,104 @@ nsDocument::MozCancelFullScreen() } CancelFullScreen(); return NS_OK; -} - -void -nsDocument::CancelFullScreen() -{ - if (!nsContentUtils::IsFullScreenApiEnabled() || - !IsFullScreenDoc() || - !GetWindow()) { - return; - } - - // Disable full-screen mode in all documents in this hierarchy. - UpdateFullScreenStatusInDocTree(this, PR_FALSE); - - // Move the window out of full-screen mode. - GetWindow()->SetFullScreen(PR_FALSE); - - return; -} - -bool -nsDocument::IsFullScreenDoc() -{ - return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen; -} - -void -nsDocument::RequestFullScreen(Element* aElement) -{ - if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) { - return; - } - - // Reset the full-screen elements of every document in this document - // hierarchy. - ResetFullScreenElementInDocTree(this); - - if (aElement->IsInDoc()) { - // Propagate up the document hierarchy, setting the full-screen element as - // the element's container in ancestor documents. Note we don't propagate - // down the document hierarchy, the full-screen element (or its container) - // is not visible there. - mFullScreenElement = aElement; +} + +void +nsDocument::CancelFullScreen() +{ + if (!nsContentUtils::IsFullScreenApiEnabled() || + !IsFullScreenDoc() || + !GetWindow()) { + return; + } + + // Disable full-screen mode in all documents in this hierarchy. + UpdateFullScreenStatusInDocTree(this, PR_FALSE); + + // Move the window out of full-screen mode. + GetWindow()->SetFullScreen(PR_FALSE); + + return; +} + +bool +nsDocument::IsFullScreenDoc() +{ + return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen; +} + +void +nsDocument::RequestFullScreen(Element* aElement) +{ + if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) { + return; + } + + // Reset the full-screen elements of every document in this document + // hierarchy. + ResetFullScreenElementInDocTree(this); + + if (aElement->IsInDoc()) { + // Propagate up the document hierarchy, setting the full-screen element as + // the element's container in ancestor documents. Note we don't propagate + // down the document hierarchy, the full-screen element (or its container) + // is not visible there. + mFullScreenElement = aElement; // Set the full-screen state on the element, so the css-pseudo class // applies to the element. - nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE); - nsIDocument* child = this; - nsIDocument* parent; - while (parent = child->GetParentDocument()) { - nsIContent* content = parent->FindContentForSubDocument(child); - nsCOMPtr element(do_QueryInterface(content)); + nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE); + nsIDocument* child = this; + nsIDocument* parent; + while (parent = child->GetParentDocument()) { + nsIContent* content = parent->FindContentForSubDocument(child); + nsCOMPtr element(do_QueryInterface(content)); // Containing frames also need the css-pseudo class applied. - nsEventStateManager::SetFullScreenState(element, PR_TRUE); - static_cast(parent)->mFullScreenElement = element; - child = parent; - } - } - - // Set all documents in hierarchy to full-screen mode. - UpdateFullScreenStatusInDocTree(this, PR_TRUE); - - // Make the window full-screen. Note we must make the state changes above - // before making the window full-screen, as then the document reports as - // being in full-screen mode when the Chrome "fullscreen" event fires, - // enabling browser.js to distinguish between browser and dom full-screen - // modes. - GetWindow()->SetFullScreen(PR_TRUE); -} - -NS_IMETHODIMP -nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement) -{ - NS_ENSURE_ARG_POINTER(aFullScreenElement); - if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) { - *aFullScreenElement = nsnull; - return NS_OK; - } - nsCOMPtr e(do_QueryInterface(GetFullScreenElement())); - NS_IF_ADDREF(*aFullScreenElement = e); - return NS_OK; -} - -Element* -nsDocument::GetFullScreenElement() -{ - if (!nsContentUtils::IsFullScreenApiEnabled() || - (mFullScreenElement && !mFullScreenElement->IsInDoc())) { - return nsnull; - } - return mFullScreenElement; -} - -NS_IMETHODIMP -nsDocument::GetMozFullScreen(bool *aFullScreen) -{ - NS_ENSURE_ARG_POINTER(aFullScreen); - *aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc(); - return NS_OK; + nsEventStateManager::SetFullScreenState(element, PR_TRUE); + static_cast(parent)->mFullScreenElement = element; + child = parent; + } + } + + // Set all documents in hierarchy to full-screen mode. + UpdateFullScreenStatusInDocTree(this, PR_TRUE); + + // Make the window full-screen. Note we must make the state changes above + // before making the window full-screen, as then the document reports as + // being in full-screen mode when the Chrome "fullscreen" event fires, + // enabling browser.js to distinguish between browser and dom full-screen + // modes. + GetWindow()->SetFullScreen(PR_TRUE); +} + +NS_IMETHODIMP +nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement) +{ + NS_ENSURE_ARG_POINTER(aFullScreenElement); + if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) { + *aFullScreenElement = nsnull; + return NS_OK; + } + nsCOMPtr e(do_QueryInterface(GetFullScreenElement())); + NS_IF_ADDREF(*aFullScreenElement = e); + return NS_OK; +} + +Element* +nsDocument::GetFullScreenElement() +{ + if (!nsContentUtils::IsFullScreenApiEnabled() || + (mFullScreenElement && !mFullScreenElement->IsInDoc())) { + return nsnull; + } + return mFullScreenElement; +} + +NS_IMETHODIMP +nsDocument::GetMozFullScreen(bool *aFullScreen) +{ + NS_ENSURE_ARG_POINTER(aFullScreen); + *aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc(); + return NS_OK; } PRInt64 diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index 33c79b24b35..03df2f09842 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -113,17 +113,17 @@ #include "ContentParent.h" #include "TabParent.h" #include "mozilla/layout/RenderFrameParent.h" - +#include "mozilla/dom/Element.h" #include "mozilla/Preferences.h" +#include "jsapi.h" + using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::layers; using namespace mozilla::layout; typedef FrameMetrics::ViewID ViewID; -#include "jsapi.h" - class nsAsyncDocShellDestroyer : public nsRunnable { public: @@ -315,7 +315,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader) NS_INTERFACE_MAP_END -nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated) +nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated) : mOwnerContent(aOwner) , mDepthTooGreat(PR_FALSE) , mIsTopLevelContent(PR_FALSE) @@ -336,7 +336,7 @@ nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated) } nsFrameLoader* -nsFrameLoader::Create(nsIContent* aOwner, bool aNetworkCreated) +nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated) { NS_ENSURE_TRUE(aOwner, nsnull); nsIDocument* doc = aOwner->GetOwnerDoc(); @@ -962,8 +962,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, "Swapping some sort of random loaders?"); NS_ENSURE_STATE(!mInShow && !aOther->mInShow); - nsIContent* ourContent = mOwnerContent; - nsIContent* otherContent = aOther->mOwnerContent; + Element* ourContent = mOwnerContent; + Element* otherContent = aOther->mOwnerContent; if (!ourContent || !otherContent) { // Can't handle this @@ -1337,7 +1337,7 @@ nsFrameLoader::GetDepthTooGreat(bool* aDepthTooGreat) } void -nsFrameLoader::SetOwnerContent(nsIContent* aContent) +nsFrameLoader::SetOwnerContent(Element* aContent) { mOwnerContent = aContent; if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) { diff --git a/content/base/src/nsFrameLoader.h b/content/base/src/nsFrameLoader.h index a3be87d49b6..ed04a0206d9 100644 --- a/content/base/src/nsFrameLoader.h +++ b/content/base/src/nsFrameLoader.h @@ -53,7 +53,7 @@ #include "nsAutoPtr.h" #include "nsFrameMessageManager.h" #include "Layers.h" -#include "nsIContent.h" +#include "mozilla/dom/Element.h" class nsIURI; class nsSubDocumentFrame; @@ -170,7 +170,7 @@ class nsFrameLoader : public nsIFrameLoader, typedef mozilla::layout::RenderFrameParent RenderFrameParent; protected: - nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated); + nsFrameLoader(mozilla::dom::Element* aOwner, bool aNetworkCreated); public: ~nsFrameLoader() { @@ -186,7 +186,8 @@ public: return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL); } - static nsFrameLoader* Create(nsIContent* aOwner, bool aNetworkCreated); + static nsFrameLoader* Create(mozilla::dom::Element* aOwner, + bool aNetworkCreated); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader) @@ -279,8 +280,8 @@ public: } nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; } - nsIContent* GetOwnerContent() { return mOwnerContent; } - void SetOwnerContent(nsIContent* aContent); + mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; } + void SetOwnerContent(mozilla::dom::Element* aContent); private: @@ -313,7 +314,7 @@ private: nsCOMPtr mDocShell; nsCOMPtr mURIToLoad; - nsIContent *mOwnerContent; // WEAK + mozilla::dom::Element* mOwnerContent; // WEAK public: // public because a callback needs these. nsRefPtr mMessageManager; diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index d6048b9fbf7..e5a14b717db 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: IDL; tab-width: 2; 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 * @@ -15,11 +15,12 @@ * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is - * Mozilla Corporation + * the Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Ms2ger * * 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 @@ -188,91 +189,60 @@ static JSBool JSONCreator(const jschar* aBuf, uint32 aLen, void* aData) { nsAString* result = static_cast(aData); - result->Append((PRUnichar*)aBuf, (PRUint32)aLen); - return JS_TRUE; + result->Append(static_cast(aBuf), + static_cast(aLen)); + return true; } -nsresult -nsFrameMessageManager::GetParamsForMessage(nsAString& aMessageName, +void +nsFrameMessageManager::GetParamsForMessage(const jsval& aObject, + JSContext* aCx, nsAString& aJSON) { - aMessageName.Truncate(); aJSON.Truncate(); - nsAXPCNativeCallContext* ncc = nsnull; - nsresult rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc); - NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_STATE(ncc); - - JSContext* ctx = nsnull; - rv = ncc->GetJSContext(&ctx); - NS_ENSURE_SUCCESS(rv, rv); - - PRUint32 argc; - jsval* argv = nsnull; - ncc->GetArgc(&argc); - ncc->GetArgvPtr(&argv); - - JSAutoRequest ar(ctx); - JSString* str; - if (argc && (str = JS_ValueToString(ctx, argv[0])) && str) { - nsDependentJSString depStr; - if (!depStr.init(ctx, str)) { - return NS_ERROR_OUT_OF_MEMORY; - } - aMessageName.Assign(depStr); - } - - if (argc >= 2) { - jsval v = argv[1]; - JS_Stringify(ctx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON); - } - return NS_OK; + JSAutoRequest ar(aCx); + jsval v = aObject; + JS_Stringify(aCx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON); } NS_IMETHODIMP -nsFrameMessageManager::SendSyncMessage() +nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName, + const jsval& aObject, + JSContext* aCx, + PRUint8 aArgc, + jsval* aRetval) { NS_ASSERTION(!IsGlobal(), "Should not call SendSyncMessage in chrome"); NS_ASSERTION(!IsWindowLevel(), "Should not call SendSyncMessage in chrome"); NS_ASSERTION(!mParentManager, "Should not have parent manager in content!"); + *aRetval = JSVAL_VOID; if (mSyncCallback) { NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED); - nsString messageName; nsString json; - nsresult rv = GetParamsForMessage(messageName, json); - NS_ENSURE_SUCCESS(rv, rv); + if (aArgc >= 2) { + GetParamsForMessage(aObject, aCx, json); + } InfallibleTArray retval; - if (mSyncCallback(mCallbackData, messageName, json, &retval)) { - nsAXPCNativeCallContext* ncc = nsnull; - rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc); - NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_STATE(ncc); - - JSContext* ctx = nsnull; - rv = ncc->GetJSContext(&ctx); - NS_ENSURE_SUCCESS(rv, rv); - JSAutoRequest ar(ctx); - + if (mSyncCallback(mCallbackData, aMessageName, json, &retval)) { + JSAutoRequest ar(aCx); PRUint32 len = retval.Length(); - JSObject* dataArray = JS_NewArrayObject(ctx, len, NULL); + JSObject* dataArray = JS_NewArrayObject(aCx, len, NULL); NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0; i < len; ++i) { - if (retval[i].IsEmpty()) + if (retval[i].IsEmpty()) { continue; + } jsval ret = JSVAL_VOID; - if (!JS_ParseJSON(ctx, (jschar*)retval[i].get(), - (uint32)retval[i].Length(), &ret)) { + if (!JS_ParseJSON(aCx, static_cast(retval[i].get()), + retval[i].Length(), &ret)) { return NS_ERROR_UNEXPECTED; } - NS_ENSURE_TRUE(JS_SetElement(ctx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY); + NS_ENSURE_TRUE(JS_SetElement(aCx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY); } - jsval* retvalPtr; - ncc->GetRetValPtr(&retvalPtr); - *retvalPtr = OBJECT_TO_JSVAL(dataArray); - ncc->SetReturnValueWasSet(PR_TRUE); + *aRetval = OBJECT_TO_JSVAL(dataArray); } } return NS_OK; @@ -295,13 +265,16 @@ nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage, } NS_IMETHODIMP -nsFrameMessageManager::SendAsyncMessage() +nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName, + const jsval& aObject, + JSContext* aCx, + PRUint8 aArgc) { - nsString messageName; nsString json; - nsresult rv = GetParamsForMessage(messageName, json); - NS_ENSURE_SUCCESS(rv, rv); - return SendAsyncMessageInternal(messageName, json); + if (aArgc >= 2) { + GetParamsForMessage(aObject, aCx, json); + } + return SendAsyncMessageInternal(aMessageName, json); } NS_IMETHODIMP @@ -428,14 +401,14 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, jsval json = JSVAL_NULL; if (!aJSON.IsEmpty()) { - if (!JS_ParseJSON(ctx, (jschar*)nsString(aJSON).get(), - (uint32)aJSON.Length(), &json)) { + if (!JS_ParseJSON(ctx, static_cast(PromiseFlatString(aJSON).get()), + aJSON.Length(), &json)) { json = JSVAL_NULL; } } JSString* jsMessage = JS_NewUCStringCopyN(ctx, - reinterpret_cast(nsString(aMessage).get()), + static_cast(PromiseFlatString(aMessage).get()), aMessage.Length()); NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY); JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE); diff --git a/content/base/src/nsFrameMessageManager.h b/content/base/src/nsFrameMessageManager.h index 4f26c8fbeb0..ab508b83fe5 100644 --- a/content/base/src/nsFrameMessageManager.h +++ b/content/base/src/nsFrameMessageManager.h @@ -150,7 +150,9 @@ public: void Disconnect(bool aRemoveFromParent = true); void SetCallbackData(void* aData, bool aLoadScripts = true); - nsresult GetParamsForMessage(nsAString& aMessageName, nsAString& aJSON); + void GetParamsForMessage(const jsval& aObject, + JSContext* aCx, + nsAString& aJSON); nsresult SendAsyncMessageInternal(const nsAString& aMessage, const nsAString& aJSON); JSContext* GetJSContext() { return mContext; } diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 7738f72db07..2ccef3145b7 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -840,81 +840,6 @@ nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText) return NS_OK; } -nsresult -nsGenericDOMDataNode::ReplaceWholeText(const nsAString& aContent, - nsIDOMText **aResult) -{ - *aResult = nsnull; - - GetOwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceWholeText); - - // Handle parent-less nodes - nsCOMPtr parent = GetParent(); - if (!parent) { - if (aContent.IsEmpty()) { - return NS_OK; - } - - SetNodeValue(aContent); - return CallQueryInterface(this, aResult); - } - - // We're relying on mozAutoSubtreeModified to keep the doc alive here. - nsIDocument* doc = GetOwnerDoc(); - - // Batch possible DOMSubtreeModified events. - mozAutoSubtreeModified subtree(doc, nsnull); - - PRInt32 index = parent->IndexOf(this); - if (index < 0) { - NS_WARNING("Trying to use .replaceWholeText with an anonymous text node " - "child of a binding parent?"); - return NS_ERROR_DOM_NOT_SUPPORTED_ERR; - } - - // We don't support entity references or read-only nodes, so remove the - // logically adjacent text nodes (which therefore must all be siblings of - // this) and set this one to the provided text, if that text isn't empty. - PRInt32 first = - FirstLogicallyAdjacentTextNode(parent, index); - PRInt32 last = - LastLogicallyAdjacentTextNode(parent, index, parent->GetChildCount()); - - // Fire mutation events. Optimize the common case of there being no - // listeners - if (nsContentUtils:: - HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED)) { - for (PRInt32 i = first; i <= last; ++i) { - nsCOMPtr child = parent->GetChildAt((PRUint32)i); - if (child && - (i != index || aContent.IsEmpty())) { - nsContentUtils::MaybeFireNodeRemoved(child, parent, doc); - } - } - } - - // Remove the needed nodes - // Don't want to use 'doc' here since it might no longer be the correct - // document. - mozAutoDocUpdate updateBatch(parent->GetCurrentDoc(), UPDATE_CONTENT_MODEL, - PR_TRUE); - - do { - if (last == index && !aContent.IsEmpty()) - continue; - - parent->RemoveChildAt(last, PR_TRUE); - } while (last-- > first); - - // Empty string means we removed this node too. - if (aContent.IsEmpty()) { - return NS_OK; - } - - SetText(aContent.BeginReading(), aContent.Length(), PR_TRUE); - return CallQueryInterface(this, aResult); -} - //---------------------------------------------------------------------- // Implementation of the nsIContent interface text functions diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index 46fb002f204..7a19dfc4006 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -330,8 +330,6 @@ protected: nsresult GetWholeText(nsAString& aWholeText); - nsresult ReplaceWholeText(const nsAString& aContent, nsIDOMText **aReturn); - nsresult GetIsElementContentWhitespace(bool *aReturn) { GetOwnerDoc()->WarnOnceAbout(nsIDocument::eIsElementContentWhitespace); diff --git a/content/base/src/nsInProcessTabChildGlobal.h b/content/base/src/nsInProcessTabChildGlobal.h index c6bef840faa..5e89776f483 100644 --- a/content/base/src/nsInProcessTabChildGlobal.h +++ b/content/base/src/nsInProcessTabChildGlobal.h @@ -66,10 +66,15 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal, nsDOMEventTargetHelper) NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager) - NS_IMETHOD SendSyncMessage() + NS_IMETHOD SendSyncMessage(const nsAString& aMessageName, + const jsval& aObject, + JSContext* aCx, + PRUint8 aArgc, + jsval* aRetval) { - return mMessageManager ? mMessageManager->SendSyncMessage() - : NS_ERROR_NULL_POINTER; + return mMessageManager + ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval) + : NS_ERROR_NULL_POINTER; } NS_IMETHOD GetContent(nsIDOMWindow** aContent); NS_IMETHOD GetDocShell(nsIDocShell** aDocShell); diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 828c93db502..f5210df21da 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -166,7 +166,7 @@ nsAsyncInstantiateEvent::Run() nsresult rv = mContent->Instantiate(frame, mContentType, mURI); if (NS_FAILED(rv)) { - mContent->Fallback(true); + mContent->Fallback(PR_TRUE); } } else { LOG(("OBJLC [%p]: Discarding event, data changed\n", mContent)); @@ -216,7 +216,7 @@ nsPluginErrorEvent::Run() return NS_OK; } nsContentUtils::DispatchTrustedEvent(mContent->GetDocument(), mContent, - type, true, true); + type, PR_TRUE, PR_TRUE); return NS_OK; } @@ -275,8 +275,8 @@ nsPluginCrashedEvent::Run() return NS_OK; } - event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), true, true); - privateEvent->SetTrusted(true); + event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), PR_TRUE, PR_TRUE); + privateEvent->SetTrusted(PR_TRUE); privateEvent->GetInternalNSEvent()->flags |= NS_EVENT_FLAG_ONLY_CHROME_DISPATCH; nsCOMPtr variant; @@ -338,7 +338,7 @@ class AutoNotifier { mOldState = aContent->ObjectState(); } ~AutoNotifier() { - mContent->NotifyStateChanged(mOldType, mOldState, false, mNotify); + mContent->NotifyStateChanged(mOldType, mOldState, PR_FALSE, mNotify); } /** @@ -349,7 +349,7 @@ class AutoNotifier { void Notify() { NS_ASSERTION(mNotify, "Should not notify when notify=false"); - mContent->NotifyStateChanged(mOldType, mOldState, true, true); + mContent->NotifyStateChanged(mOldType, mOldState, PR_TRUE, PR_TRUE); mOldType = mContent->Type(); mOldState = mContent->ObjectState(); } @@ -372,7 +372,7 @@ class AutoFallback { ~AutoFallback() { if (NS_FAILED(*mResult)) { LOG(("OBJLC [%p]: rv=%08x, falling back\n", mContent, *mResult)); - mContent->Fallback(false); + mContent->Fallback(PR_FALSE); if (mPluginState != ePluginOtherState) { mContent->mFallbackReason = mPluginState; } @@ -400,7 +400,7 @@ class AutoFallback { class AutoSetInstantiatingToFalse { public: AutoSetInstantiatingToFalse(nsObjectLoadingContent* objlc) : mContent(objlc) {} - ~AutoSetInstantiatingToFalse() { mContent->mInstantiating = false; } + ~AutoSetInstantiatingToFalse() { mContent->mInstantiating = PR_FALSE; } private: nsObjectLoadingContent* mContent; }; @@ -411,7 +411,7 @@ IsSupportedImage(const nsCString& aMimeType) { imgILoader* loader = nsContentUtils::GetImgLoader(); if (!loader) { - return false; + return PR_FALSE; } bool supported; @@ -425,7 +425,7 @@ IsSupportedPlugin(const nsCString& aMIMEType) nsCOMPtr pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID)); nsPluginHost *pluginHost = static_cast(pluginHostCOM.get()); if (!pluginHost) { - return false; + return PR_FALSE; } nsresult rv = pluginHost->IsPluginEnabledForType(aMIMEType.get()); return NS_SUCCEEDED(rv); @@ -459,31 +459,31 @@ IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType) GetExtensionFromURI(uri, ext); if (ext.IsEmpty()) { - return false; + return PR_FALSE; } nsCOMPtr pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID)); nsPluginHost *pluginHost = static_cast(pluginHostCOM.get()); if (!pluginHost) { - return false; + return PR_FALSE; } const char* typeFromExt; if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt))) { mimeType = typeFromExt; - return true; + return PR_TRUE; } - return false; + return PR_FALSE; } nsObjectLoadingContent::nsObjectLoadingContent() : mPendingInstantiateEvent(nsnull) , mChannel(nsnull) , mType(eType_Loading) - , mInstantiating(false) - , mUserDisabled(false) - , mSuppressed(false) - , mNetworkCreated(true) + , mInstantiating(PR_FALSE) + , mUserDisabled(PR_FALSE) + , mSuppressed(PR_FALSE) + , mNetworkCreated(PR_TRUE) , mFallbackReason(ePluginOtherState) { } @@ -507,11 +507,11 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, return NS_BINDING_ABORTED; } - AutoNotifier notifier(this, true); + AutoNotifier notifier(this, PR_TRUE); if (!IsSuccessfulRequest(aRequest)) { LOG(("OBJLC [%p]: OnStartRequest: Request failed\n", this)); - Fallback(false); + Fallback(PR_FALSE); return NS_BINDING_ABORTED; } @@ -598,7 +598,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsIDocument* doc = thisContent->GetOwnerDoc(); if (!doc) { - Fallback(false); + Fallback(PR_FALSE); return NS_BINDING_ABORTED; } @@ -638,16 +638,17 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, break; case eType_Document: { if (!mFrameLoader) { - mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated); + mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(), + mNetworkCreated); if (!mFrameLoader) { - Fallback(false); + Fallback(PR_FALSE); return NS_ERROR_UNEXPECTED; } } rv = mFrameLoader->CheckForRecursiveLoad(uri); if (NS_FAILED(rv)) { - Fallback(false); + Fallback(PR_FALSE); return rv; } @@ -687,7 +688,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, break; } case eType_Plugin: - mInstantiating = true; + mInstantiating = PR_TRUE; if (mType != newType) { // This can go away once plugin loading moves to content (bug 90268) mType = newType; @@ -699,7 +700,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, // Do nothing in this case: This is probably due to a display:none // frame. If we ever get a frame, HasNewFrame will do the right thing. // Abort the load though, we have no use for the data. - mInstantiating = false; + mInstantiating = PR_FALSE; return NS_BINDING_ABORTED; } @@ -710,7 +711,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, rv = frame->Instantiate(chan, getter_AddRefs(mFinalListener)); - mInstantiating = false; + mInstantiating = PR_FALSE; if (!weakFrame.IsAlive()) { // The frame was destroyed while instantiating. Abort the load. @@ -726,7 +727,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, // Need to fallback here (instead of using the case below), so that we can // set mFallbackReason without it being overwritten. This is also why we // return early. - Fallback(false); + Fallback(PR_FALSE); PluginSupportState pluginState = GetPluginSupportState(thisContent, mContentType); @@ -753,7 +754,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, return NS_BINDING_ABORTED; } #endif - Fallback(false); + Fallback(PR_FALSE); } else if (mType == eType_Plugin) { nsIObjectFrame* frame = GetExistingFrame(eFlushContent); if (frame) { @@ -767,7 +768,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, } LOG(("OBJLC [%p]: Found no listener, falling back\n", this)); - Fallback(false); + Fallback(PR_FALSE); return NS_BINDING_ABORTED; } @@ -874,7 +875,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance) } // Trigger frame construction - mInstantiating = true; + mInstantiating = PR_TRUE; nsCOMPtr thisContent = do_QueryInterface(static_cast(this)); @@ -883,13 +884,13 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance) nsIDocument* doc = thisContent->GetCurrentDoc(); if (!doc) { // Nothing we can do while plugin loading is done in layout... - mInstantiating = false; + mInstantiating = PR_FALSE; return NS_OK; } doc->FlushPendingNotifications(Flush_Frames); - mInstantiating = false; + mInstantiating = PR_FALSE; frame = GetExistingFrame(eFlushContent); if (!frame) { @@ -922,7 +923,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance) if (NS_SUCCEEDED(rv) && weakFrame.IsAlive()) { rv = frame->GetPluginInstance(aInstance); } else { - Fallback(true); + Fallback(PR_TRUE); } } return rv; @@ -1173,10 +1174,10 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI, // the AutoNotifier triggers frame construction, events can be posted as // appropriate. NS_ASSERTION(!mInstantiating, "LoadObject was reentered?"); - mInstantiating = true; + mInstantiating = PR_TRUE; AutoSetInstantiatingToFalse autoset(this); - mUserDisabled = mSuppressed = false; + mUserDisabled = mSuppressed = PR_FALSE; mURI = aURI; mContentType = aTypeHint; @@ -1213,7 +1214,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI, // Security checks if (doc->IsLoadedAsData()) { if (!doc->IsStaticDocument()) { - Fallback(false); + Fallback(PR_FALSE); } return NS_OK; } @@ -1228,7 +1229,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI, nsresult rv = secMan->CheckLoadURIWithPrincipal(thisContent->NodePrincipal(), aURI, 0); if (NS_FAILED(rv)) { - Fallback(false); + Fallback(PR_FALSE); return NS_OK; } @@ -1277,7 +1278,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI, // Must have a frameloader before creating a frame, or the frame will // create its own. if (!mFrameLoader && newType == eType_Document) { - mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated); + mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(), + mNetworkCreated); if (!mFrameLoader) { mURI = nsnull; return NS_OK; @@ -1296,7 +1298,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI, case eType_Image: // Don't notify, because we will take care of that ourselves. if (aURI) { - rv = LoadImage(aURI, aForceLoad, false); + rv = LoadImage(aURI, aForceLoad, PR_FALSE); } else { rv = NS_ERROR_NOT_AVAILABLE; } @@ -1324,13 +1326,13 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI, // If the class ID specifies a supported plugin, or if we have no explicit URI // but a type, immediately instantiate the plugin. bool isSupportedClassID = false; - nsCAutoString typeForID; // Will be set iff isSupportedClassID == true + nsCAutoString typeForID; // Will be set iff isSupportedClassID == PR_TRUE bool hasID = false; if (caps & eSupportClassID) { nsAutoString classid; thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classid); if (!classid.IsEmpty()) { - hasID = true; + hasID = PR_TRUE; isSupportedClassID = NS_SUCCEEDED(TypeForClassID(classid, typeForID)); } } @@ -1444,7 +1446,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI, // Set up the channel's principal and such, like nsDocShell::DoURILoad does nsContentUtils::SetUpChannelOwner(thisContent->NodePrincipal(), - chan, aURI, true); + chan, aURI, PR_TRUE); nsCOMPtr scriptChannel = do_QueryInterface(chan); if (scriptChannel) { @@ -1515,7 +1517,7 @@ nsObjectLoadingContent::IsSuccessfulRequest(nsIRequest* aRequest) nsresult status; nsresult rv = aRequest->GetStatus(&status); if (NS_FAILED(rv) || NS_FAILED(status)) { - return false; + return PR_FALSE; } // This may still be an error page or somesuch @@ -1524,12 +1526,12 @@ nsObjectLoadingContent::IsSuccessfulRequest(nsIRequest* aRequest) bool success; rv = httpChan->GetRequestSucceeded(&success); if (NS_FAILED(rv) || !success) { - return false; + return PR_FALSE; } } // Otherwise, the request is successful - return true; + return PR_TRUE; } /* static */ bool @@ -1537,17 +1539,17 @@ nsObjectLoadingContent::CanHandleURI(nsIURI* aURI) { nsCAutoString scheme; if (NS_FAILED(aURI->GetScheme(scheme))) { - return false; + return PR_FALSE; } nsIIOService* ios = nsContentUtils::GetIOService(); if (!ios) - return false; + return PR_FALSE; nsCOMPtr handler; ios->GetProtocolHandler(scheme.get(), getter_AddRefs(handler)); if (!handler) { - return false; + return PR_FALSE; } nsCOMPtr extHandler = @@ -1596,20 +1598,20 @@ nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType) return supported != nsIWebNavigationInfo::PLUGIN; } - return false; + return PR_FALSE; } void nsObjectLoadingContent::UnloadContent() { // Don't notify in CancelImageRequests. We do it ourselves. - CancelImageRequests(false); + CancelImageRequests(PR_FALSE); if (mFrameLoader) { mFrameLoader->Destroy(); mFrameLoader = nsnull; } mType = eType_Null; - mUserDisabled = mSuppressed = false; + mUserDisabled = mSuppressed = PR_FALSE; mFallbackReason = ePluginOtherState; } @@ -1804,9 +1806,9 @@ nsObjectLoadingContent::HandleBeingBlockedByContentPolicy(nsresult aStatus, UnloadContent(); if (NS_SUCCEEDED(aStatus)) { if (aRetval == nsIContentPolicy::REJECT_TYPE) { - mUserDisabled = true; + mUserDisabled = PR_TRUE; } else if (aRetval == nsIContentPolicy::REJECT_SERVER) { - mSuppressed = true; + mSuppressed = PR_TRUE; } } } @@ -1856,7 +1858,7 @@ nsObjectLoadingContent::Instantiate(nsIObjectFrame* aFrame, // Mark that we're instantiating now so that we don't end up // re-entering instantiation code. bool oldInstantiatingValue = mInstantiating; - mInstantiating = true; + mInstantiating = PR_TRUE; nsCString typeToUse(aMIMEType); if (typeToUse.IsEmpty() && aURI) { @@ -1936,7 +1938,7 @@ nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent, } } else if (!hasAlternateContent) { hasAlternateContent = - nsStyleUtil::IsSignificantChild(child, true, false); + nsStyleUtil::IsSignificantChild(child, PR_TRUE, PR_FALSE); } } @@ -1979,8 +1981,8 @@ nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const if (mFrameLoader) { nsCOMPtr content = - do_QueryInterface(static_cast((aDest))); - nsFrameLoader* fl = nsFrameLoader::Create(content, false); + do_QueryInterface(static_cast(aDest)); + nsFrameLoader* fl = nsFrameLoader::Create(content->AsElement(), PR_FALSE); if (fl) { aDest->mFrameLoader = fl; mFrameLoader->CreateStaticClone(fl); @@ -2001,7 +2003,7 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag, const nsAString& browserDumpID, bool submittedCrashReport) { - AutoNotifier notifier(this, true); + AutoNotifier notifier(this, PR_TRUE); UnloadContent(); mFallbackReason = ePluginCrashed; nsCOMPtr thisContent = do_QueryInterface(static_cast(this)); diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 2a512ac8a21..34f232ade59 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -1401,10 +1401,7 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget, if (aUseLSEventWrapper) { nsCOMPtr xhrprogressEvent = - new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize); - if (!xhrprogressEvent) { - return; - } + new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize, mOwner); event = xhrprogressEvent; } aTarget->DispatchDOMEvent(nsnull, event, nsnull, nsnull); @@ -3240,7 +3237,9 @@ nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value) // DOM event class to handle progress notifications nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner, PRUint64 aCurrentProgress, - PRUint64 aMaxProgress) + PRUint64 aMaxProgress, + nsPIDOMWindow* aWindow) + : mWindow(aWindow) { mInner = static_cast(aInner); mCurProgress = aCurrentProgress; @@ -3270,11 +3269,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXMLHttpProgressEvent) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInner); + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mWindow); NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mInner, nsIDOMProgressEvent) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mWindow); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput) @@ -3283,8 +3284,23 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput) return NS_ERROR_NOT_IMPLEMENTED; } +void +nsXMLHttpProgressEvent::WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations aOperation) +{ + if (!mWindow) { + return; + } + nsCOMPtr document = + do_QueryInterface(mWindow->GetExtantDocument()); + if (!document) { + return; + } + document->WarnOnceAbout(aOperation); +} + NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition) { + WarnAboutLSProgressEvent(nsIDocument::ePosition); // XXX can we change the iface? LL_L2UI(*aPosition, mCurProgress); return NS_OK; @@ -3292,8 +3308,8 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition) NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(PRUint32 *aTotalSize) { + WarnAboutLSProgressEvent(nsIDocument::eTotalSize); // XXX can we change the iface? LL_L2UI(*aTotalSize, mMaxProgress); return NS_OK; } - diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index afb82206a4b..47e045d87d4 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -380,7 +380,8 @@ class nsXMLHttpProgressEvent : public nsIDOMProgressEvent, public: nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner, PRUint64 aCurrentProgress, - PRUint64 aMaxProgress); + PRUint64 aMaxProgress, + nsPIDOMWindow* aWindow); virtual ~nsXMLHttpProgressEvent(); NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -421,9 +422,12 @@ public: } protected: + void WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations); + // Use nsDOMProgressEvent so that we can forward // most of the method calls easily. nsRefPtr mInner; + nsCOMPtr mWindow; PRUint64 mCurProgress; PRUint64 mMaxProgress; }; diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index c34930dadfe..61d9a213a62 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -231,7 +231,6 @@ _TEST_FILES1 = \ test_bug438519.html \ test_bug444722.html \ test_bug451376.html \ - test_text_replaceWholeText.html \ test_text_wholeText.html \ test_bug433533.html \ wholeTexty-helper.xml \ diff --git a/content/base/test/test_bug352728.html b/content/base/test/test_bug352728.html index d4543c54123..f6b6d52f65b 100644 --- a/content/base/test/test_bug352728.html +++ b/content/base/test/test_bug352728.html @@ -87,10 +87,32 @@ function testPI(aTarget, aData, aShouldSucceed, aReason) { try { var pi = document.createProcessingInstruction(aTarget, aData); - ok(0, "Invalid processing instruction creation", - "Shouldn't create processing instructions in HTML"); + var types = [ ProcessingInstruction, Node ]; + checkTypes(pi, "processing instruction", types); + + var interfaces = [ "nsIDOMProcessingInstruction", "nsIDOMNode", + "nsIDOMEventTarget" ]; + checkInterfaces(pi, "processing instruction", interfaces); + + is(pi.target, aTarget, "Check target"); + is(pi.data, aData, "Check data"); + is(pi.nodeName, aTarget, "Check nodeName"); + is(pi.nodeValue, aData, "Check nodeValue"); + is(pi.localName, null, "Check localName") + is(pi.namespaceURI, null, "Check namespaceURI"); + + is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType"); + + if (!aShouldSucceed) { + ok(false, "Invalid processing instruction creation", aReason); + } } catch (e) { - is(e.code, DOMException.NOT_SUPPORTED_ERR, "Check exception code"); + if (aShouldSucceed) { + ok(false, "Correct functioning of processing instruction stuff", + "something broke: " + e); + } else { + is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code"); + } } } diff --git a/content/base/test/test_bug431701.html b/content/base/test/test_bug431701.html index 908084e05be..16ad7805f8f 100644 --- a/content/base/test/test_bug431701.html +++ b/content/base/test/test_bug431701.html @@ -59,32 +59,31 @@ function xhrDoc(idx) { } // Each row has the document getter function, then the characterSet, -// inputEncoding, xmlEncoding expected for that document. +// inputEncoding expected for that document. var tests = [ - [ frameDoc("one"), "ISO-8859-1", "ISO-8859-1", null ], - [ frameDoc("two"), "UTF-8", "UTF-8", null ], - [ frameDoc("three"), "ISO-8859-1", "ISO-8859-1", null ], - [ frameDoc("four"), "UTF-8", "UTF-8", null ], - [ frameDoc("five"), "UTF-8", "UTF-8", null ], - [ frameDoc("six"), "UTF-8", "UTF-8", "UTF-8"], - [ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ], - [ createDoc, "UTF-8", null, null ], - [ xhrDoc(4), "UTF-8", "UTF-8", null ], - [ xhrDoc(5), "UTF-8", "UTF-8", "UTF-8" ], - [ xhrDoc(6), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ], + [ frameDoc("one"), "ISO-8859-1", "ISO-8859-1" ], + [ frameDoc("two"), "UTF-8", "UTF-8" ], + [ frameDoc("three"), "ISO-8859-1", "ISO-8859-1" ], + [ frameDoc("four"), "UTF-8", "UTF-8" ], + [ frameDoc("five"), "UTF-8", "UTF-8" ], + [ frameDoc("six"), "UTF-8", "UTF-8" ], + [ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1" ], + [ createDoc, "UTF-8", null ], + [ xhrDoc(4), "UTF-8", "UTF-8" ], + [ xhrDoc(5), "UTF-8", "UTF-8" ], + [ xhrDoc(6), "ISO-8859-1", "ISO-8859-1" ], ]; function doTest(idx) { var [docGetter, expectedCharacterSet, - expectedInputEncoding, expectedXMLEncoding] = tests[idx]; + expectedInputEncoding] = tests[idx]; var doc = docGetter(); // Have to be careful here to catch null vs "" is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet"); is(doc.inputEncoding, expectedInputEncoding, "Test " + idx + " inputEncoding"); - is(doc.xmlEncoding, expectedXMLEncoding, "Test " + idx + " xmlEncoding"); } addLoadEvent(function() { diff --git a/content/base/test/test_bug444030.xhtml b/content/base/test/test_bug444030.xhtml index 3dc5fb88c34..92f6ba0e57e 100644 --- a/content/base/test/test_bug444030.xhtml +++ b/content/base/test/test_bug444030.xhtml @@ -35,15 +35,6 @@ function doTest() { } ok(hadException, "Should have got an exception when using .wholeText with a text node child of the binding parent"); - - hadException = false; - try { - anonTextNode.replaceWholeText("foobar"); - } catch(e) { - hadException = true; - } - ok(hadException, - "Should have got an exception when using .replaceWholeText with a text node child of the binding parent"); SimpleTest.finish(); } diff --git a/content/base/test/test_text_replaceWholeText.html b/content/base/test/test_text_replaceWholeText.html deleted file mode 100644 index 9a59944fedc..00000000000 --- a/content/base/test/test_text_replaceWholeText.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - Text.replaceWholeText tests - - - - -Mozilla Bug 421765 -

- - - - -
-
-
- - diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index f04613b873c..61cbea01de2 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -20190,7 +20190,7 @@ function test_size_attributes_parse_badsuffix() { var canvas = document.getElementById('c637'); var ctx = canvas.getContext('2d'); -todo(canvas.width == 100, "canvas.width == 100"); +is(canvas.width, 100, "canvas.width == 100"); } @@ -20400,7 +20400,7 @@ var canvas = document.getElementById('c648'); var ctx = canvas.getContext('2d'); canvas.setAttribute('width', '100foo'); -todo(canvas.width == 100, "canvas.width == 100"); +is(canvas.width, 100, "canvas.width == 100"); } diff --git a/content/events/test/test_bug650493.html b/content/events/test/test_bug650493.html index baf60c29f2d..a81ca6889ab 100644 --- a/content/events/test/test_bug650493.html +++ b/content/events/test/test_bug650493.html @@ -209,22 +209,6 @@ check(); is(children.length, 0, "should have received DOMNodeRemoved for all frag children when appending"); is(frag.childNodes.length, 0, "fragment should be empty when appending"); -testName = "prepare replaceWholeText"; -var textNode; -root.appendChild(document.createTextNode("hello")); -root.appendChild(document.createTextNode("")); -root.appendChild(textNode = document.createTextNode("world")); -root.appendChild(document.createTextNode("fahrvergnugen")); -root.appendChild(document.createTextNode("")); -root.appendChild(document.createElement("div")); -root.appendChild(document.createTextNode("smorgasbord")); -root.appendChild(document.createTextNode("")); -check(); - -testName = "run replaceWholeText"; -textNode.replaceWholeText("supercalifragilisticexpialidocious"); -check(); - diff --git a/content/html/content/src/nsHTMLTableElement.cpp b/content/html/content/src/nsHTMLTableElement.cpp index 2b8863e1e3f..8b9848914b5 100644 --- a/content/html/content/src/nsHTMLTableElement.cpp +++ b/content/html/content/src/nsHTMLTableElement.cpp @@ -68,8 +68,6 @@ public: TableRowsCollection(nsHTMLTableElement *aParent); virtual ~TableRowsCollection(); - nsresult Init(); - NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_NSIDOMHTMLCOLLECTION @@ -83,13 +81,18 @@ public: protected: // Those rows that are not in table sections + nsHTMLTableElement* mParent; nsRefPtr mOrphanRows; - nsHTMLTableElement * mParent; }; TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent) : mParent(aParent) + , mOrphanRows(new nsContentList(mParent, + mParent->NodeInfo()->NamespaceID(), + nsGkAtoms::tr, + nsGkAtoms::tr, + PR_FALSE)) { } @@ -118,17 +121,6 @@ NS_INTERFACE_TABLE_HEAD(TableRowsCollection) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLCollection) NS_INTERFACE_MAP_END -nsresult -TableRowsCollection::Init() -{ - mOrphanRows = new nsContentList(mParent, - mParent->NodeInfo()->NamespaceID(), - nsGkAtoms::tr, - nsGkAtoms::tr, - PR_FALSE); - return NS_OK; -} - // Macro that can be used to avoid copy/pasting code to iterate over the // rowgroups. _code should be the code to execute for each rowgroup. The // rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows". Note @@ -499,15 +491,7 @@ NS_IMETHODIMP nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue) { if (!mRows) { - // XXX why was this here NS_ADDREF(nsGkAtoms::tr); mRows = new TableRowsCollection(this); - NS_ENSURE_TRUE(mRows, NS_ERROR_OUT_OF_MEMORY); - - nsresult rv = mRows->Init(); - if (NS_FAILED(rv)) { - mRows = nsnull; - return rv; - } } *aValue = mRows; diff --git a/content/html/content/test/reflect.js b/content/html/content/test/reflect.js index 53fa8458cac..4b019db982a 100644 --- a/content/html/content/test/reflect.js +++ b/content/html/content/test/reflect.js @@ -462,11 +462,6 @@ function reflectBoolean(aParameters) */ function reflectInt(aParameters) { - //TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr] - function testExponential(value) { - return !!/^[ \t\n\f\r]*[\+\-]?[0-9]+e[0-9]+/.exec(value); - } - // Expected value returned by .getAttribute() when |value| has been previously passed to .setAttribute(). function expectedGetAttributeResult(value) { return (value !== null) ? String(value) : ""; @@ -556,34 +551,10 @@ function reflectInt(aParameters) //TBD: Bug 586761: .setAttribute(attr, -2147483648) --> element[attr] == defaultValue instead of -2147483648 todo_is(element[attr], intValue, "Bug 586761: " + element.localName + ".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] "); - } else if (testExponential(v)) { - //TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr] - todo_is(element[attr], intValue, "Bug 673820: " + element.localName + - ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); - } else if (v == "why 567 what") { - //TBD: Bug 679672: .setAttribute() is somehow able to parse "why 567 what" into "567" - todo_is(element[attr], intValue, "Bug 679672: " + element.localName + - ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); - } else if (v === "-0" && nonNegative) { + } else if ((v === "-0" || v == "-0xABCDEF") && nonNegative) { //TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0" todo_is(element[attr], intValue, "Bug 688093: " + element.localName + ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); - } else if (v == "+42foo") { - //TBD: Bug: Unable to correctly parse "+" character in front of string - todo_is(element[attr], intValue, "Bug: " + element.localName + - ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); - } else if (v == "0x10FFFF" && defaultValue != 0) { - //TBD: Bug: Integer attributes should parse "0x10FFFF" as 0, but instead incorrectly return defaultValue - todo_is(element[attr], intValue, "Bug: " + element.localName + - ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); - } else if (v == "-0xABCDEF" && !nonNegative && defaultValue != 0) { - //TBD: Bug: Signed integer attributes should parse "-0xABCDEF" as -0, but instead incorrectly return defaultValue - todo_is(element[attr], intValue, "Bug: " + element.localName + - ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); - } else if ((v == "++2" || v == "+-2" || v == "--2" || v == "-+2") && element[attr] != defaultValue) { - //TBD: Bug: Should not be able to parse strings with multiple sign characters, should return defaultValue - todo_is(element[attr], intValue, "Bug: " + element.localName + - ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); } else { is(element[attr], intValue, element.localName + ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 11cdc419de4..c818848d673 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -139,7 +139,6 @@ #include "nsIDOMDOMStringList.h" #include "nsIDOMDOMTokenList.h" #include "nsIDOMDOMSettableTokenList.h" -#include "nsIDOMNameList.h" #include "nsIDOMNSElement.h" #include "nsDOMStringMap.h" @@ -1000,9 +999,6 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH, ARRAY_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(NameList, nsDOMGenericSH, - DOM_DEFAULT_SCRIPTABLE_FLAGS) - #ifdef MOZ_XUL NS_DEFINE_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH, DEFAULT_SCRIPTABLE_FLAGS) @@ -2996,10 +2992,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList) DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(NameList, nsIDOMNameList) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNameList) - DOM_CLASSINFO_MAP_END - #ifdef MOZ_XUL DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn) DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn) diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index 3ee66d820e1..9a06542aa96 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -220,9 +220,6 @@ DOMCI_CLASS(XULTreeBuilder) // DOMStringList object DOMCI_CLASS(DOMStringList) -// NameList object used by the DOM -DOMCI_CLASS(NameList) - #ifdef MOZ_XUL DOMCI_CLASS(TreeColumn) DOMCI_CLASS(TreeColumns) diff --git a/dom/interfaces/base/domstubs.idl b/dom/interfaces/base/domstubs.idl index 48c56926b79..aa2fe0f9ce8 100644 --- a/dom/interfaces/base/domstubs.idl +++ b/dom/interfaces/base/domstubs.idl @@ -60,7 +60,6 @@ interface nsIDOMProcessingInstruction; interface nsIDOMText; interface nsIDOMDOMStringList; interface nsIDOMDOMTokenList; -interface nsIDOMNameList; interface nsIDOMClientRect; interface nsIDOMClientRectList; diff --git a/dom/interfaces/core/Makefile.in b/dom/interfaces/core/Makefile.in index cc2bc2f7158..32cf01e77d6 100644 --- a/dom/interfaces/core/Makefile.in +++ b/dom/interfaces/core/Makefile.in @@ -66,7 +66,6 @@ SDK_XPIDLSRCS = \ $(NULL) XPIDLSRCS = \ nsIDOMDOMStringList.idl \ - nsIDOMNameList.idl \ nsIDOMXMLDocument.idl \ nsIDOMUserDataHandler.idl \ nsIDOMNSEditableElement.idl \ diff --git a/dom/interfaces/core/nsIDOMDocument.idl b/dom/interfaces/core/nsIDOMDocument.idl index 160f4d33394..2ccc958d50e 100644 --- a/dom/interfaces/core/nsIDOMDocument.idl +++ b/dom/interfaces/core/nsIDOMDocument.idl @@ -67,7 +67,7 @@ interface nsIDOMCaretPosition; * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html */ -[scriptable, uuid(C54536AF-C238-4D8B-A339-54E2A0649FF5)] +[scriptable, uuid(489faaa9-c54e-466c-8164-9a5fcc3a7052)] interface nsIDOMDocument : nsIDOMNode { readonly attribute nsIDOMDocumentType doctype; @@ -106,8 +106,6 @@ interface nsIDOMDocument : nsIDOMNode nsIDOMElement getElementById(in DOMString elementId); // Introduced in DOM Level 3: readonly attribute DOMString inputEncoding; - // Introduced in DOM Level 3: - readonly attribute DOMString xmlEncoding; // Introduced in DOM Level 3: attribute boolean xmlStandalone; // raises(DOMException) on setting diff --git a/dom/interfaces/core/nsIDOMNameList.idl b/dom/interfaces/core/nsIDOMNameList.idl deleted file mode 100644 index d97199f969a..00000000000 --- a/dom/interfaces/core/nsIDOMNameList.idl +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** 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.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2003 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Peter Van der Beken - * - * - * 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 ***** */ - -/** - * Corresponds to http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407 - */ - -#include "domstubs.idl" - -[scriptable, uuid(faaf1b80-1ddd-11d9-8c46-000a95dc234c)] -interface nsIDOMNameList : nsISupports -{ - DOMString getName(in unsigned long index) - raises(DOMException); - DOMString getNamespaceURI(in unsigned long index) - raises(DOMException); - readonly attribute unsigned long length; - boolean contains(in DOMString str); - boolean containsNS(in DOMString namespaceURI, - in DOMString name); -}; diff --git a/dom/interfaces/core/nsIDOMText.idl b/dom/interfaces/core/nsIDOMText.idl index 76a803ff0d6..397c95843a3 100644 --- a/dom/interfaces/core/nsIDOMText.idl +++ b/dom/interfaces/core/nsIDOMText.idl @@ -47,7 +47,7 @@ * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html */ -[scriptable, uuid(92b0df87-78a1-4e3b-a23c-d0c5bb2b83f9)] +[scriptable, uuid(8a876308-7891-468c-8f7a-9f2b81160c3c)] interface nsIDOMText : nsIDOMCharacterData { nsIDOMText splitText(in unsigned long offset) @@ -68,12 +68,4 @@ interface nsIDOMText : nsIDOMCharacterData * passing an element, comment, or processing-instruction boundary. */ readonly attribute DOMString wholeText; - - /** - * If content is empty, removes all logically adjacent text nodes (including - * this node) from the DOM tree, returning null; otherwise, replaces the - * contents of this node with aContent and removes all other logically - * adjacent text nodes from the DOM tree, returning this node. - */ - nsIDOMText replaceWholeText(in DOMString content) raises(DOMException); }; diff --git a/dom/interfaces/core/nsIDOMXMLDocument.idl b/dom/interfaces/core/nsIDOMXMLDocument.idl index ed67f988339..3b3de01bb29 100644 --- a/dom/interfaces/core/nsIDOMXMLDocument.idl +++ b/dom/interfaces/core/nsIDOMXMLDocument.idl @@ -38,7 +38,7 @@ #include "nsIDOMDocument.idl" -[scriptable, uuid(0457526E-1FA5-476C-9314-0F704617B9F4)] +[scriptable, uuid(8168733e-9cf6-4552-9f03-57de11b87f3f)] interface nsIDOMXMLDocument : nsIDOMDocument { // DOM Level 3 Load & Save, DocumentLS diff --git a/dom/interfaces/html/nsIDOMHTMLDocument.idl b/dom/interfaces/html/nsIDOMHTMLDocument.idl index bf1d543295d..f5ce6c013f3 100644 --- a/dom/interfaces/html/nsIDOMHTMLDocument.idl +++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl @@ -47,7 +47,7 @@ */ interface nsISelection; -[scriptable, uuid(DA6A8183-3C50-4F4A-9EFC-0E050B9A856A)] +[scriptable, uuid(9a23fb3c-1d25-462e-8e85-c78c9dc61755)] interface nsIDOMHTMLDocument : nsIDOMDocument { readonly attribute DOMString URL; diff --git a/dom/interfaces/svg/nsIDOMSVGDocument.idl b/dom/interfaces/svg/nsIDOMSVGDocument.idl index 09055440d0a..acddadede34 100644 --- a/dom/interfaces/svg/nsIDOMSVGDocument.idl +++ b/dom/interfaces/svg/nsIDOMSVGDocument.idl @@ -39,7 +39,7 @@ interface nsIDOMSVGSVGElement; -[scriptable, uuid(E055EF40-D6BA-443A-B4DB-C1CCFAA6EB31)] +[scriptable, uuid(1767ad4f-bb2b-474b-b208-9910ed152605)] interface nsIDOMSVGDocument : nsIDOMDocument { readonly attribute DOMString domain; diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 15b987d8898..e887ece6c50 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */ +/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*- */ /* vim: set sw=4 ts=8 et tw=80 : */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -98,10 +98,15 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper) NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager) - NS_IMETHOD SendSyncMessage() + NS_IMETHOD SendSyncMessage(const nsAString& aMessageName, + const jsval& aObject, + JSContext* aCx, + PRUint8 aArgc, + jsval* aRetval) { - return mMessageManager ? mMessageManager->SendSyncMessage() - : NS_ERROR_NULL_POINTER; + return mMessageManager + ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval) + : NS_ERROR_NULL_POINTER; } NS_IMETHOD GetContent(nsIDOMWindow** aContent); NS_IMETHOD GetDocShell(nsIDocShell** aDocShell); diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index cd72d900c1c..19e1b42a6cb 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -108,12 +108,12 @@ IsSupportedWarning=Use of attributes' isSupported() is deprecated. IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated. TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead. EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead. +PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated. +TotalSizeWarning=Use of XMLHttpRequest's progress events' totalSize attribute is deprecated. nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.parse instead. nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead. nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead. IsSameNodeWarning=Use of isSameNode is deprecated. Please use A == B to test for equality instead. -ReplaceWholeTextWarning=Use of replaceWholeText is deprecated. Please call normalize() on the parent and set the data attribute, or use textContent instead. -XmlEncodingWarning=Use of xmlEncoding is deprecated. XmlVersionWarning=Use of xmlVersion is deprecated. InputEncodingWarning=Use of inputEncoding is deprecated. XmlStandaloneWarning=Use of xmlStandalone is deprecated. diff --git a/dom/tests/mochitest/bugs/test_bug42976.html b/dom/tests/mochitest/bugs/test_bug42976.html index b57a7369606..6060df33572 100644 --- a/dom/tests/mochitest/bugs/test_bug42976.html +++ b/dom/tests/mochitest/bugs/test_bug42976.html @@ -39,9 +39,6 @@ function runTest() { // doc.xmlStandalone ok(doc.xmlStandalone == clonefalse.xmlStandalone, "xmlStandalone not preserved correctly; " + iframes[i].id); - // doc.xmlEncoding - ok(doc.xmlEncoding == clonefalse.xmlEncoding, "xmlEncoding not preserved correctly; " + iframes[i].id); - // doc.characterSet ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id); diff --git a/dom/tests/mochitest/dom-level1-core/exclusions.js b/dom/tests/mochitest/dom-level1-core/exclusions.js index 679885ddf41..4efb664be74 100644 --- a/dom/tests/mochitest/dom-level1-core/exclusions.js +++ b/dom/tests/mochitest/dom-level1-core/exclusions.js @@ -88,7 +88,8 @@ var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", var createEntityRef = ["documentinvalidcharacterexceptioncreateentref", "documentinvalidcharacterexceptioncreateentref1", "hc_attrgetvalue2", "hc_nodevalue03"]; - +var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi", + "documentinvalidcharacterexceptioncreatepi1"]; var todoTests = {}; function concat(lst/*...*/) { @@ -101,5 +102,5 @@ function concat(lst/*...*/) { } return f; } -var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef); +var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef, createProcessingInstructionHTML); for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; } diff --git a/js/src/xpconnect/src/dom_quickstubs.qsconf b/js/src/xpconnect/src/dom_quickstubs.qsconf index e155f1e381f..ff3c654742a 100644 --- a/js/src/xpconnect/src/dom_quickstubs.qsconf +++ b/js/src/xpconnect/src/dom_quickstubs.qsconf @@ -148,11 +148,6 @@ members = [ 'nsIDOMDOMStringList.*', 'nsIDOMDOMTokenList.*', 'nsIDOMDOMSettableTokenList.*', - 'nsIDOMNameList.getName', - 'nsIDOMNameList.contains', - 'nsIDOMNameList.containsNS', - 'nsIDOMNameList.length', - 'nsIDOMNameList.getNamespaceURI', 'nsIDOMXULDocument.getBoxObjectFor', 'nsIDOMNSElement.*', diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 3937372979f..36b50ddb07c 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3146,12 +3146,11 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll) } } } else { - rv = NS_ERROR_FAILURE; //changed to NS_OK in quirks mode if ScrollTo is called - - // Scroll to the top/left if the anchor can not be - // found and it is labelled top (quirks mode only). @see bug 80784 - if ((NS_LossyConvertUTF16toASCII(aAnchorName).LowerCaseEqualsLiteral("top")) && - (mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)) { + rv = NS_ERROR_FAILURE; + NS_NAMED_LITERAL_STRING(top, "top"); + if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) { + // Scroll to the top/left if aAnchorName is "top" and there is no element + // with such a name or id. rv = NS_OK; nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable(); // Check |aScroll| after setting |rv| so we set |rv| to the same diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 963d8b23127..e37414fa8c6 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -68,6 +68,12 @@ _TEST_FILES = \ test_after_paint_pref.html \ test_border_radius_hit_testing.html \ test_bug66619.html \ + test_bug93077-1.html \ + test_bug93077-2.html \ + test_bug93077-3.html \ + test_bug93077-4.html \ + test_bug93077-5.html \ + test_bug93077-6.html \ test_bug114649.html \ $(warning test_bug369950.html disabled due to random orange; see bug 492575) \ test_bug386575.xhtml \ diff --git a/layout/base/tests/test_bug93077-1.html b/layout/base/tests/test_bug93077-1.html new file mode 100644 index 00000000000..16fad6b2aab --- /dev/null +++ b/layout/base/tests/test_bug93077-1.html @@ -0,0 +1,32 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-2.html b/layout/base/tests/test_bug93077-2.html new file mode 100644 index 00000000000..24e17b73539 --- /dev/null +++ b/layout/base/tests/test_bug93077-2.html @@ -0,0 +1,32 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-3.html b/layout/base/tests/test_bug93077-3.html new file mode 100644 index 00000000000..0c37be986a7 --- /dev/null +++ b/layout/base/tests/test_bug93077-3.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-4.html b/layout/base/tests/test_bug93077-4.html new file mode 100644 index 00000000000..ea624086ab5 --- /dev/null +++ b/layout/base/tests/test_bug93077-4.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-5.html b/layout/base/tests/test_bug93077-5.html new file mode 100644 index 00000000000..ffe9233cf6e --- /dev/null +++ b/layout/base/tests/test_bug93077-5.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-6.html b/layout/base/tests/test_bug93077-6.html new file mode 100644 index 00000000000..08cdb6c7fd8 --- /dev/null +++ b/layout/base/tests/test_bug93077-6.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ + diff --git a/layout/reftests/bugs/539880-1-ref.html b/layout/reftests/bugs/539880-1-ref.html index 853b0a94a48..8f8a8ac9477 100644 --- a/layout/reftests/bugs/539880-1-ref.html +++ b/layout/reftests/bugs/539880-1-ref.html @@ -6,7 +6,7 @@ 0
border="0"
border="0px"
-
border="0em"
+
border="0em"
1 @@ -18,19 +18,19 @@ 2
border="2"
border="2px"
-
border="2em"
+
border="2em"
3
border="3"
border="3px"
-
border="3em"
+
border="3em"
10
border="10"
border="10px"
-
border="10em"
+
border="10em"
diff --git a/modules/libpr0n/src/imgLoader.cpp b/modules/libpr0n/src/imgLoader.cpp index 0b2d8ca709f..676c5427de4 100644 --- a/modules/libpr0n/src/imgLoader.cpp +++ b/modules/libpr0n/src/imgLoader.cpp @@ -397,23 +397,13 @@ nsProgressNotificationProxy::GetInterface(const nsIID& iid, return NS_NOINTERFACE; } -static bool NewRequestAndEntry(bool forcePrincipalCheckForCacheEntry, - imgRequest **request, imgCacheEntry **entry) +static void NewRequestAndEntry(bool aForcePrincipalCheckForCacheEntry, + imgRequest **aRequest, imgCacheEntry **aEntry) { - *request = new imgRequest(); - if (!*request) - return PR_FALSE; - - *entry = new imgCacheEntry(*request, forcePrincipalCheckForCacheEntry); - if (!*entry) { - delete *request; - return PR_FALSE; - } - - NS_ADDREF(*request); - NS_ADDREF(*entry); - - return PR_TRUE; + nsRefPtr request = new imgRequest(); + nsRefPtr entry = new imgCacheEntry(request, aForcePrincipalCheckForCacheEntry); + request.forget(aRequest); + entry.forget(aEntry); } static bool ShouldRevalidateEntry(imgCacheEntry *aEntry, @@ -1697,9 +1687,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - if (!NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request), - getter_AddRefs(entry))) - return NS_ERROR_OUT_OF_MEMORY; + NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request), + getter_AddRefs(entry)); PR_LOG(gImgLog, PR_LOG_DEBUG, ("[this=%p] imgLoader::LoadImage -- Created new imgRequest [request=%p]\n", this, request.get())); @@ -1902,9 +1891,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb // Default to doing a principal check because we don't know who // started that load and whether their principal ended up being // inherited on the channel. - if (!NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), - getter_AddRefs(entry))) - return NS_ERROR_OUT_OF_MEMORY; + NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), getter_AddRefs(entry)); // We use originalURI here to fulfil the imgIRequest contract on GetURI. nsCOMPtr originalURI;