Merge mozilla-central to mozilla-inbound

This commit is contained in:
Marco Bonardo 2011-10-03 17:13:54 +02:00
Родитель a1c8be78dc e80d62512a
Коммит 3c1bf37929
51 изменённых файлов: 716 добавлений и 1115 удалений

Просмотреть файл

@ -387,15 +387,10 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
NS_ASSERTION(targetDocument, "No document while accessible is in document?!"); NS_ASSERTION(targetDocument, "No document while accessible is in document?!");
nsINode* targetNode = accessible->GetNode(); nsINode* targetNode = accessible->GetNode();
nsIContent* targetContent = targetNode->IsElement() ?
targetNode->AsElement() : nsnull;
nsIContent* origTargetContent = origTargetNode->IsElement() ?
origTargetNode->AsElement() : nsnull;
#ifdef MOZ_XUL #ifdef MOZ_XUL
bool isTree = targetContent ? bool isTree = targetNode->IsElement() &&
targetContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) : targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL);
PR_FALSE;
if (isTree) { if (isTree) {
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible); nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);

Просмотреть файл

@ -71,10 +71,10 @@ DEPRECATED_OPERATION(IsSupported)
DEPRECATED_OPERATION(IsEqualNode) DEPRECATED_OPERATION(IsEqualNode)
DEPRECATED_OPERATION(TextContent) DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege) DEPRECATED_OPERATION(EnablePrivilege)
DEPRECATED_OPERATION(Position)
DEPRECATED_OPERATION(TotalSize)
DEPRECATED_OPERATION(IsSameNode) DEPRECATED_OPERATION(IsSameNode)
DEPRECATED_OPERATION(ReplaceWholeText)
DEPRECATED_OPERATION(GlobalStorage) DEPRECATED_OPERATION(GlobalStorage)
DEPRECATED_OPERATION(XmlEncoding)
DEPRECATED_OPERATION(XmlVersion) DEPRECATED_OPERATION(XmlVersion)
DEPRECATED_OPERATION(InputEncoding) DEPRECATED_OPERATION(InputEncoding)
DEPRECATED_OPERATION(XmlStandalone) DEPRECATED_OPERATION(XmlStandalone)

Просмотреть файл

@ -64,24 +64,26 @@ interface nsIFrameMessageListener : nsISupports
void receiveMessage(); void receiveMessage();
}; };
[scriptable, uuid(6b736edb-863d-40bd-bca2-62f44da803c0)] [scriptable, uuid(a27d8fcd-8de9-4a51-87f4-2b83bba901d5)]
interface nsIFrameMessageManager : nsISupports interface nsIFrameMessageManager : nsISupports
{ {
void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener); void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
void removeMessageListener(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 interface nsISyncMessageSender : nsIFrameMessageManager
{ {
/** /**
* Returns an array of JSON objects. * 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 interface nsIContentFrameMessageManager : nsISyncMessageSender
{ {
/** /**
@ -112,20 +114,20 @@ interface nsIContentFrameMessageManager : nsISyncMessageSender
DOMString btoa(in DOMString aBase64Data); DOMString btoa(in DOMString aBase64Data);
}; };
[uuid(9c48d557-92fe-4edb-95fc-bfe97e77bdc3)] [uuid(1f7af930-a232-4a84-a049-73eaa45f2db5)]
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
{ {
[notxpcom] nsIContent getOwnerContent(); [notxpcom] nsIContent getOwnerContent();
}; };
[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)] [scriptable, uuid(e91b0939-a74a-4c4f-8cfd-17dd42e8642a)]
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
{ {
readonly attribute unsigned long childCount; readonly attribute unsigned long childCount;
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex); nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
}; };
[scriptable, uuid(9e5c0526-aa4c-49f0-afbb-57f489cd9b59)] [scriptable, uuid(14e1f147-793d-4788-bbbb-ae806ecdddbb)]
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
{ {
/** /**

Просмотреть файл

@ -1356,70 +1356,70 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
bool aCanBePercent, bool aCanBePercent,
bool* aIsPercent) const bool* aIsPercent) const
{ {
*aStrict = PR_FALSE; *aStrict = true;
*aErrorCode = NS_ERROR_ILLEGAL_VALUE; *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
if (aCanBePercent) { if (aCanBePercent) {
*aIsPercent = PR_FALSE; *aIsPercent = false;
} }
nsAString::const_iterator iter, end; nsAString::const_iterator iter, end;
aValue.BeginReading(iter); aValue.BeginReading(iter);
aValue.EndReading(end); aValue.EndReading(end);
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
*aStrict = false;
++iter;
}
if (iter == end) {
return 0;
}
bool negate = false; bool negate = false;
if (*iter == PRUnichar('-')) {
negate = true;
++iter;
} else if (*iter == PRUnichar('+')) {
*aStrict = false;
++iter;
}
PRInt32 value = 0; PRInt32 value = 0;
if (iter != end) { PRInt32 pValue = 0; // Previous value, used to check integer overflow
if (*iter == PRUnichar('-')) { while (iter != end) {
negate = PR_TRUE; if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
value = (value * 10) + (*iter - PRUnichar('0'));
++iter; ++iter;
} // Checking for integer overflow.
if (iter != end) { if (pValue > value) {
if ((*iter >= PRUnichar('1') || (*iter == PRUnichar('0') && !negate)) && *aStrict = false;
*iter <= PRUnichar('9')) { *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
value = *iter - PRUnichar('0'); break;
++iter; } else {
*aStrict = (value != 0 || iter == end || pValue = value;
(aCanBePercent && *iter == PRUnichar('%'))); *aErrorCode = NS_OK;
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;
}
}
} }
} 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 value;
return tmp.ToInteger(aErrorCode);
} }
PRInt64 PRInt64

Просмотреть файл

@ -38,8 +38,7 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* /*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various * Implementation of nsIDOMDOMStringList, used by various DOM stuff.
* DOM3 stuff and some interfaces specified by WHATWG.
*/ */
#include "nsDOMLists.h" #include "nsDOMLists.h"
@ -95,92 +94,3 @@ nsDOMStringList::Contains(const nsAString& aString, bool *aResult)
return NS_OK; 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;
}

Просмотреть файл

@ -38,15 +38,13 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* /*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various * Implementation of nsIDOMDOMStringList, used by various DOM stuff.
* DOM3 stuff and some interfaces specified by WHATWG.
*/ */
#ifndef nsDOMLists_h___ #ifndef nsDOMLists_h___
#define nsDOMLists_h___ #define nsDOMLists_h___
#include "nsIDOMDOMStringList.h" #include "nsIDOMDOMStringList.h"
#include "nsIDOMNameList.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsString.h" #include "nsString.h"
@ -68,20 +66,4 @@ private:
nsTArray<nsString> mNames; nsTArray<nsString> 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<nsString> mNamespaceURIs;
nsTArray<nsString> mNames;
};
#endif /* nsDOMLists_h___ */ #endif /* nsDOMLists_h___ */

Просмотреть файл

@ -4493,11 +4493,6 @@ nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
{ {
*aReturn = nsnull; *aReturn = nsnull;
// There are no PIs for HTML
if (IsHTML()) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE); nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -5893,23 +5888,6 @@ nsDocument::GetInputEncoding(nsAString& aInputEncoding)
return NS_OK; 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 NS_IMETHODIMP
nsDocument::GetXmlStandalone(bool *aXmlStandalone) nsDocument::GetXmlStandalone(bool *aXmlStandalone)
{ {
@ -8467,114 +8445,114 @@ nsIDocument::SizeOf() const
return size; return size;
} }
// Returns the root document in a document hierarchy. // Returns the root document in a document hierarchy.
static nsIDocument* static nsIDocument*
GetRootDocument(nsIDocument* aDoc) GetRootDocument(nsIDocument* aDoc)
{ {
if (!aDoc) { if (!aDoc) {
return nsnull; return nsnull;
} }
nsCOMPtr<nsIPresShell> shell = aDoc->GetShell(); nsCOMPtr<nsIPresShell> shell = aDoc->GetShell();
if (!shell) { if (!shell) {
return nsnull; return nsnull;
} }
nsPresContext* ctx = shell->GetPresContext(); nsPresContext* ctx = shell->GetPresContext();
if (!ctx) { if (!ctx) {
return nsnull; return nsnull;
} }
nsRootPresContext* rpc = ctx->GetRootPresContext(); nsRootPresContext* rpc = ctx->GetRootPresContext();
if (!rpc) { if (!rpc) {
return nsnull; return nsnull;
} }
return rpc->Document(); return rpc->Document();
} }
class nsDispatchFullScreenChange : public nsRunnable class nsDispatchFullScreenChange : public nsRunnable
{ {
public: public:
nsDispatchFullScreenChange(nsIDocument *aDoc) nsDispatchFullScreenChange(nsIDocument *aDoc)
: mDoc(aDoc) : mDoc(aDoc)
{ {
mTarget = aDoc->GetFullScreenElement(); mTarget = aDoc->GetFullScreenElement();
if (!mTarget) { if (!mTarget) {
mTarget = aDoc; mTarget = aDoc;
} }
} }
NS_IMETHOD Run() NS_IMETHOD Run()
{ {
nsContentUtils::DispatchTrustedEvent(mDoc, nsContentUtils::DispatchTrustedEvent(mDoc,
mTarget, mTarget,
NS_LITERAL_STRING("mozfullscreenchange"), NS_LITERAL_STRING("mozfullscreenchange"),
PR_TRUE, PR_TRUE,
PR_FALSE); PR_FALSE);
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIDocument> mDoc; nsCOMPtr<nsIDocument> mDoc;
nsCOMPtr<nsISupports> mTarget; nsCOMPtr<nsISupports> mTarget;
}; };
void void
nsDocument::UpdateFullScreenStatus(bool aIsFullScreen) nsDocument::UpdateFullScreenStatus(bool aIsFullScreen)
{ {
if (mIsFullScreen != aIsFullScreen) { if (mIsFullScreen != aIsFullScreen) {
nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this)); nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this));
NS_DispatchToCurrentThread(event); NS_DispatchToCurrentThread(event);
} }
mIsFullScreen = aIsFullScreen; mIsFullScreen = aIsFullScreen;
if (!mIsFullScreen) { if (!mIsFullScreen) {
// Full-screen is being turned off. Reset the full-screen element, to // Full-screen is being turned off. Reset the full-screen element, to
// save us from having to traverse the document hierarchy again in // save us from having to traverse the document hierarchy again in
// MozCancelFullScreen(). // MozCancelFullScreen().
ResetFullScreenElement(); ResetFullScreenElement();
} }
} }
static bool static bool
UpdateFullScreenStatus(nsIDocument* aDocument, void* aData) UpdateFullScreenStatus(nsIDocument* aDocument, void* aData)
{ {
aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData)); aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData));
aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData); aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData);
return PR_TRUE; return PR_TRUE;
} }
static void static void
UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen) UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen)
{ {
nsIDocument* root = GetRootDocument(aDoc); nsIDocument* root = GetRootDocument(aDoc);
if (root) { if (root) {
UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen)); UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen));
} }
} }
void void
nsDocument::ResetFullScreenElement() nsDocument::ResetFullScreenElement()
{ {
if (mFullScreenElement) { if (mFullScreenElement) {
nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_FALSE); nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_FALSE);
} }
mFullScreenElement = nsnull; mFullScreenElement = nsnull;
} }
static bool static bool
ResetFullScreenElement(nsIDocument* aDocument, void* aData) ResetFullScreenElement(nsIDocument* aDocument, void* aData)
{ {
aDocument->ResetFullScreenElement(); aDocument->ResetFullScreenElement();
aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData); aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData);
return PR_TRUE; return PR_TRUE;
} }
static void static void
ResetFullScreenElementInDocTree(nsIDocument* aDoc) ResetFullScreenElementInDocTree(nsIDocument* aDoc)
{ {
nsIDocument* root = GetRootDocument(aDoc); nsIDocument* root = GetRootDocument(aDoc);
if (root) { if (root) {
ResetFullScreenElement(root, nsnull); ResetFullScreenElement(root, nsnull);
} }
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::MozCancelFullScreen() nsDocument::MozCancelFullScreen()
{ {
if (!nsContentUtils::IsRequestFullScreenAllowed()) { if (!nsContentUtils::IsRequestFullScreenAllowed()) {
@ -8582,104 +8560,104 @@ nsDocument::MozCancelFullScreen()
} }
CancelFullScreen(); CancelFullScreen();
return NS_OK; return NS_OK;
} }
void void
nsDocument::CancelFullScreen() nsDocument::CancelFullScreen()
{ {
if (!nsContentUtils::IsFullScreenApiEnabled() || if (!nsContentUtils::IsFullScreenApiEnabled() ||
!IsFullScreenDoc() || !IsFullScreenDoc() ||
!GetWindow()) { !GetWindow()) {
return; return;
} }
// Disable full-screen mode in all documents in this hierarchy. // Disable full-screen mode in all documents in this hierarchy.
UpdateFullScreenStatusInDocTree(this, PR_FALSE); UpdateFullScreenStatusInDocTree(this, PR_FALSE);
// Move the window out of full-screen mode. // Move the window out of full-screen mode.
GetWindow()->SetFullScreen(PR_FALSE); GetWindow()->SetFullScreen(PR_FALSE);
return; return;
} }
bool bool
nsDocument::IsFullScreenDoc() nsDocument::IsFullScreenDoc()
{ {
return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen; return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen;
} }
void void
nsDocument::RequestFullScreen(Element* aElement) nsDocument::RequestFullScreen(Element* aElement)
{ {
if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) { if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) {
return; return;
} }
// Reset the full-screen elements of every document in this document // Reset the full-screen elements of every document in this document
// hierarchy. // hierarchy.
ResetFullScreenElementInDocTree(this); ResetFullScreenElementInDocTree(this);
if (aElement->IsInDoc()) { if (aElement->IsInDoc()) {
// Propagate up the document hierarchy, setting the full-screen element as // Propagate up the document hierarchy, setting the full-screen element as
// the element's container in ancestor documents. Note we don't propagate // the element's container in ancestor documents. Note we don't propagate
// down the document hierarchy, the full-screen element (or its container) // down the document hierarchy, the full-screen element (or its container)
// is not visible there. // is not visible there.
mFullScreenElement = aElement; mFullScreenElement = aElement;
// Set the full-screen state on the element, so the css-pseudo class // Set the full-screen state on the element, so the css-pseudo class
// applies to the element. // applies to the element.
nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE); nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE);
nsIDocument* child = this; nsIDocument* child = this;
nsIDocument* parent; nsIDocument* parent;
while (parent = child->GetParentDocument()) { while (parent = child->GetParentDocument()) {
nsIContent* content = parent->FindContentForSubDocument(child); nsIContent* content = parent->FindContentForSubDocument(child);
nsCOMPtr<Element> element(do_QueryInterface(content)); nsCOMPtr<Element> element(do_QueryInterface(content));
// Containing frames also need the css-pseudo class applied. // Containing frames also need the css-pseudo class applied.
nsEventStateManager::SetFullScreenState(element, PR_TRUE); nsEventStateManager::SetFullScreenState(element, PR_TRUE);
static_cast<nsDocument*>(parent)->mFullScreenElement = element; static_cast<nsDocument*>(parent)->mFullScreenElement = element;
child = parent; child = parent;
} }
} }
// Set all documents in hierarchy to full-screen mode. // Set all documents in hierarchy to full-screen mode.
UpdateFullScreenStatusInDocTree(this, PR_TRUE); UpdateFullScreenStatusInDocTree(this, PR_TRUE);
// Make the window full-screen. Note we must make the state changes above // 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 // before making the window full-screen, as then the document reports as
// being in full-screen mode when the Chrome "fullscreen" event fires, // being in full-screen mode when the Chrome "fullscreen" event fires,
// enabling browser.js to distinguish between browser and dom full-screen // enabling browser.js to distinguish between browser and dom full-screen
// modes. // modes.
GetWindow()->SetFullScreen(PR_TRUE); GetWindow()->SetFullScreen(PR_TRUE);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement) nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement)
{ {
NS_ENSURE_ARG_POINTER(aFullScreenElement); NS_ENSURE_ARG_POINTER(aFullScreenElement);
if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) { if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) {
*aFullScreenElement = nsnull; *aFullScreenElement = nsnull;
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement())); nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement()));
NS_IF_ADDREF(*aFullScreenElement = e); NS_IF_ADDREF(*aFullScreenElement = e);
return NS_OK; return NS_OK;
} }
Element* Element*
nsDocument::GetFullScreenElement() nsDocument::GetFullScreenElement()
{ {
if (!nsContentUtils::IsFullScreenApiEnabled() || if (!nsContentUtils::IsFullScreenApiEnabled() ||
(mFullScreenElement && !mFullScreenElement->IsInDoc())) { (mFullScreenElement && !mFullScreenElement->IsInDoc())) {
return nsnull; return nsnull;
} }
return mFullScreenElement; return mFullScreenElement;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::GetMozFullScreen(bool *aFullScreen) nsDocument::GetMozFullScreen(bool *aFullScreen)
{ {
NS_ENSURE_ARG_POINTER(aFullScreen); NS_ENSURE_ARG_POINTER(aFullScreen);
*aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc(); *aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc();
return NS_OK; return NS_OK;
} }
PRInt64 PRInt64

Просмотреть файл

@ -113,17 +113,17 @@
#include "ContentParent.h" #include "ContentParent.h"
#include "TabParent.h" #include "TabParent.h"
#include "mozilla/layout/RenderFrameParent.h" #include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "jsapi.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::layers; using namespace mozilla::layers;
using namespace mozilla::layout; using namespace mozilla::layout;
typedef FrameMetrics::ViewID ViewID; typedef FrameMetrics::ViewID ViewID;
#include "jsapi.h"
class nsAsyncDocShellDestroyer : public nsRunnable class nsAsyncDocShellDestroyer : public nsRunnable
{ {
public: public:
@ -315,7 +315,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated) nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
: mOwnerContent(aOwner) : mOwnerContent(aOwner)
, mDepthTooGreat(PR_FALSE) , mDepthTooGreat(PR_FALSE)
, mIsTopLevelContent(PR_FALSE) , mIsTopLevelContent(PR_FALSE)
@ -336,7 +336,7 @@ nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated)
} }
nsFrameLoader* nsFrameLoader*
nsFrameLoader::Create(nsIContent* aOwner, bool aNetworkCreated) nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
{ {
NS_ENSURE_TRUE(aOwner, nsnull); NS_ENSURE_TRUE(aOwner, nsnull);
nsIDocument* doc = aOwner->GetOwnerDoc(); nsIDocument* doc = aOwner->GetOwnerDoc();
@ -962,8 +962,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
"Swapping some sort of random loaders?"); "Swapping some sort of random loaders?");
NS_ENSURE_STATE(!mInShow && !aOther->mInShow); NS_ENSURE_STATE(!mInShow && !aOther->mInShow);
nsIContent* ourContent = mOwnerContent; Element* ourContent = mOwnerContent;
nsIContent* otherContent = aOther->mOwnerContent; Element* otherContent = aOther->mOwnerContent;
if (!ourContent || !otherContent) { if (!ourContent || !otherContent) {
// Can't handle this // Can't handle this
@ -1337,7 +1337,7 @@ nsFrameLoader::GetDepthTooGreat(bool* aDepthTooGreat)
} }
void void
nsFrameLoader::SetOwnerContent(nsIContent* aContent) nsFrameLoader::SetOwnerContent(Element* aContent)
{ {
mOwnerContent = aContent; mOwnerContent = aContent;
if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) { if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) {

Просмотреть файл

@ -53,7 +53,7 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsFrameMessageManager.h" #include "nsFrameMessageManager.h"
#include "Layers.h" #include "Layers.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
class nsIURI; class nsIURI;
class nsSubDocumentFrame; class nsSubDocumentFrame;
@ -170,7 +170,7 @@ class nsFrameLoader : public nsIFrameLoader,
typedef mozilla::layout::RenderFrameParent RenderFrameParent; typedef mozilla::layout::RenderFrameParent RenderFrameParent;
protected: protected:
nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated); nsFrameLoader(mozilla::dom::Element* aOwner, bool aNetworkCreated);
public: public:
~nsFrameLoader() { ~nsFrameLoader() {
@ -186,7 +186,8 @@ public:
return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL); 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_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader) NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
@ -279,8 +280,8 @@ public:
} }
nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; } nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
nsIContent* GetOwnerContent() { return mOwnerContent; } mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
void SetOwnerContent(nsIContent* aContent); void SetOwnerContent(mozilla::dom::Element* aContent);
private: private:
@ -313,7 +314,7 @@ private:
nsCOMPtr<nsIDocShell> mDocShell; nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIURI> mURIToLoad; nsCOMPtr<nsIURI> mURIToLoad;
nsIContent *mOwnerContent; // WEAK mozilla::dom::Element* mOwnerContent; // WEAK
public: public:
// public because a callback needs these. // public because a callback needs these.
nsRefPtr<nsFrameMessageManager> mMessageManager; nsRefPtr<nsFrameMessageManager> mMessageManager;

Просмотреть файл

@ -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 ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
@ -15,11 +15,12 @@
* The Original Code is mozilla.org code. * The Original Code is mozilla.org code.
* *
* The Initial Developer of the Original Code is * The Initial Developer of the Original Code is
* Mozilla Corporation * the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010 * Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved. * the Initial Developer. All Rights Reserved.
* *
* Contributor(s): * Contributor(s):
* Ms2ger <ms2ger@gmail.com>
* *
* Alternatively, the contents of this file may be used under the terms of * 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 * 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) JSONCreator(const jschar* aBuf, uint32 aLen, void* aData)
{ {
nsAString* result = static_cast<nsAString*>(aData); nsAString* result = static_cast<nsAString*>(aData);
result->Append((PRUnichar*)aBuf, (PRUint32)aLen); result->Append(static_cast<const PRUnichar*>(aBuf),
return JS_TRUE; static_cast<PRUint32>(aLen));
return true;
} }
nsresult void
nsFrameMessageManager::GetParamsForMessage(nsAString& aMessageName, nsFrameMessageManager::GetParamsForMessage(const jsval& aObject,
JSContext* aCx,
nsAString& aJSON) nsAString& aJSON)
{ {
aMessageName.Truncate();
aJSON.Truncate(); aJSON.Truncate();
nsAXPCNativeCallContext* ncc = nsnull; JSAutoRequest ar(aCx);
nsresult rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc); jsval v = aObject;
NS_ENSURE_SUCCESS(rv, rv); JS_Stringify(aCx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
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;
} }
NS_IMETHODIMP 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(!IsGlobal(), "Should not call SendSyncMessage in chrome");
NS_ASSERTION(!IsWindowLevel(), "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!"); NS_ASSERTION(!mParentManager, "Should not have parent manager in content!");
*aRetval = JSVAL_VOID;
if (mSyncCallback) { if (mSyncCallback) {
NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED); NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
nsString messageName;
nsString json; nsString json;
nsresult rv = GetParamsForMessage(messageName, json); if (aArgc >= 2) {
NS_ENSURE_SUCCESS(rv, rv); GetParamsForMessage(aObject, aCx, json);
}
InfallibleTArray<nsString> retval; InfallibleTArray<nsString> retval;
if (mSyncCallback(mCallbackData, messageName, json, &retval)) { if (mSyncCallback(mCallbackData, aMessageName, json, &retval)) {
nsAXPCNativeCallContext* ncc = nsnull; JSAutoRequest ar(aCx);
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);
PRUint32 len = retval.Length(); 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); NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 i = 0; i < len; ++i) { for (PRUint32 i = 0; i < len; ++i) {
if (retval[i].IsEmpty()) if (retval[i].IsEmpty()) {
continue; continue;
}
jsval ret = JSVAL_VOID; jsval ret = JSVAL_VOID;
if (!JS_ParseJSON(ctx, (jschar*)retval[i].get(), if (!JS_ParseJSON(aCx, static_cast<const jschar*>(retval[i].get()),
(uint32)retval[i].Length(), &ret)) { retval[i].Length(), &ret)) {
return NS_ERROR_UNEXPECTED; 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; *aRetval = OBJECT_TO_JSVAL(dataArray);
ncc->GetRetValPtr(&retvalPtr);
*retvalPtr = OBJECT_TO_JSVAL(dataArray);
ncc->SetReturnValueWasSet(PR_TRUE);
} }
} }
return NS_OK; return NS_OK;
@ -295,13 +265,16 @@ nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsFrameMessageManager::SendAsyncMessage() nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
const jsval& aObject,
JSContext* aCx,
PRUint8 aArgc)
{ {
nsString messageName;
nsString json; nsString json;
nsresult rv = GetParamsForMessage(messageName, json); if (aArgc >= 2) {
NS_ENSURE_SUCCESS(rv, rv); GetParamsForMessage(aObject, aCx, json);
return SendAsyncMessageInternal(messageName, json); }
return SendAsyncMessageInternal(aMessageName, json);
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -428,14 +401,14 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
jsval json = JSVAL_NULL; jsval json = JSVAL_NULL;
if (!aJSON.IsEmpty()) { if (!aJSON.IsEmpty()) {
if (!JS_ParseJSON(ctx, (jschar*)nsString(aJSON).get(), if (!JS_ParseJSON(ctx, static_cast<const jschar*>(PromiseFlatString(aJSON).get()),
(uint32)aJSON.Length(), &json)) { aJSON.Length(), &json)) {
json = JSVAL_NULL; json = JSVAL_NULL;
} }
} }
JSString* jsMessage = JSString* jsMessage =
JS_NewUCStringCopyN(ctx, JS_NewUCStringCopyN(ctx,
reinterpret_cast<const jschar *>(nsString(aMessage).get()), static_cast<const jschar*>(PromiseFlatString(aMessage).get()),
aMessage.Length()); aMessage.Length());
NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY);
JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE); JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE);

Просмотреть файл

@ -150,7 +150,9 @@ public:
void Disconnect(bool aRemoveFromParent = true); void Disconnect(bool aRemoveFromParent = true);
void SetCallbackData(void* aData, bool aLoadScripts = 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, nsresult SendAsyncMessageInternal(const nsAString& aMessage,
const nsAString& aJSON); const nsAString& aJSON);
JSContext* GetJSContext() { return mContext; } JSContext* GetJSContext() { return mContext; }

Просмотреть файл

@ -840,81 +840,6 @@ nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText)
return NS_OK; return NS_OK;
} }
nsresult
nsGenericDOMDataNode::ReplaceWholeText(const nsAString& aContent,
nsIDOMText **aResult)
{
*aResult = nsnull;
GetOwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceWholeText);
// Handle parent-less nodes
nsCOMPtr<nsIContent> 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<nsIContent> 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 // Implementation of the nsIContent interface text functions

Просмотреть файл

@ -330,8 +330,6 @@ protected:
nsresult GetWholeText(nsAString& aWholeText); nsresult GetWholeText(nsAString& aWholeText);
nsresult ReplaceWholeText(const nsAString& aContent, nsIDOMText **aReturn);
nsresult GetIsElementContentWhitespace(bool *aReturn) nsresult GetIsElementContentWhitespace(bool *aReturn)
{ {
GetOwnerDoc()->WarnOnceAbout(nsIDocument::eIsElementContentWhitespace); GetOwnerDoc()->WarnOnceAbout(nsIDocument::eIsElementContentWhitespace);

Просмотреть файл

@ -66,10 +66,15 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal, NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
nsDOMEventTargetHelper) nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager) 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() return mMessageManager
: NS_ERROR_NULL_POINTER; ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
: NS_ERROR_NULL_POINTER;
} }
NS_IMETHOD GetContent(nsIDOMWindow** aContent); NS_IMETHOD GetContent(nsIDOMWindow** aContent);
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell); NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);

Просмотреть файл

@ -166,7 +166,7 @@ nsAsyncInstantiateEvent::Run()
nsresult rv = mContent->Instantiate(frame, mContentType, mURI); nsresult rv = mContent->Instantiate(frame, mContentType, mURI);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
mContent->Fallback(true); mContent->Fallback(PR_TRUE);
} }
} else { } else {
LOG(("OBJLC [%p]: Discarding event, data changed\n", mContent)); LOG(("OBJLC [%p]: Discarding event, data changed\n", mContent));
@ -216,7 +216,7 @@ nsPluginErrorEvent::Run()
return NS_OK; return NS_OK;
} }
nsContentUtils::DispatchTrustedEvent(mContent->GetDocument(), mContent, nsContentUtils::DispatchTrustedEvent(mContent->GetDocument(), mContent,
type, true, true); type, PR_TRUE, PR_TRUE);
return NS_OK; return NS_OK;
} }
@ -275,8 +275,8 @@ nsPluginCrashedEvent::Run()
return NS_OK; return NS_OK;
} }
event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), true, true); event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), PR_TRUE, PR_TRUE);
privateEvent->SetTrusted(true); privateEvent->SetTrusted(PR_TRUE);
privateEvent->GetInternalNSEvent()->flags |= NS_EVENT_FLAG_ONLY_CHROME_DISPATCH; privateEvent->GetInternalNSEvent()->flags |= NS_EVENT_FLAG_ONLY_CHROME_DISPATCH;
nsCOMPtr<nsIWritableVariant> variant; nsCOMPtr<nsIWritableVariant> variant;
@ -338,7 +338,7 @@ class AutoNotifier {
mOldState = aContent->ObjectState(); mOldState = aContent->ObjectState();
} }
~AutoNotifier() { ~AutoNotifier() {
mContent->NotifyStateChanged(mOldType, mOldState, false, mNotify); mContent->NotifyStateChanged(mOldType, mOldState, PR_FALSE, mNotify);
} }
/** /**
@ -349,7 +349,7 @@ class AutoNotifier {
void Notify() { void Notify() {
NS_ASSERTION(mNotify, "Should not notify when notify=false"); 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(); mOldType = mContent->Type();
mOldState = mContent->ObjectState(); mOldState = mContent->ObjectState();
} }
@ -372,7 +372,7 @@ class AutoFallback {
~AutoFallback() { ~AutoFallback() {
if (NS_FAILED(*mResult)) { if (NS_FAILED(*mResult)) {
LOG(("OBJLC [%p]: rv=%08x, falling back\n", mContent, *mResult)); LOG(("OBJLC [%p]: rv=%08x, falling back\n", mContent, *mResult));
mContent->Fallback(false); mContent->Fallback(PR_FALSE);
if (mPluginState != ePluginOtherState) { if (mPluginState != ePluginOtherState) {
mContent->mFallbackReason = mPluginState; mContent->mFallbackReason = mPluginState;
} }
@ -400,7 +400,7 @@ class AutoFallback {
class AutoSetInstantiatingToFalse { class AutoSetInstantiatingToFalse {
public: public:
AutoSetInstantiatingToFalse(nsObjectLoadingContent* objlc) : mContent(objlc) {} AutoSetInstantiatingToFalse(nsObjectLoadingContent* objlc) : mContent(objlc) {}
~AutoSetInstantiatingToFalse() { mContent->mInstantiating = false; } ~AutoSetInstantiatingToFalse() { mContent->mInstantiating = PR_FALSE; }
private: private:
nsObjectLoadingContent* mContent; nsObjectLoadingContent* mContent;
}; };
@ -411,7 +411,7 @@ IsSupportedImage(const nsCString& aMimeType)
{ {
imgILoader* loader = nsContentUtils::GetImgLoader(); imgILoader* loader = nsContentUtils::GetImgLoader();
if (!loader) { if (!loader) {
return false; return PR_FALSE;
} }
bool supported; bool supported;
@ -425,7 +425,7 @@ IsSupportedPlugin(const nsCString& aMIMEType)
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID)); nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get()); nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
if (!pluginHost) { if (!pluginHost) {
return false; return PR_FALSE;
} }
nsresult rv = pluginHost->IsPluginEnabledForType(aMIMEType.get()); nsresult rv = pluginHost->IsPluginEnabledForType(aMIMEType.get());
return NS_SUCCEEDED(rv); return NS_SUCCEEDED(rv);
@ -459,31 +459,31 @@ IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType)
GetExtensionFromURI(uri, ext); GetExtensionFromURI(uri, ext);
if (ext.IsEmpty()) { if (ext.IsEmpty()) {
return false; return PR_FALSE;
} }
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID)); nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get()); nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
if (!pluginHost) { if (!pluginHost) {
return false; return PR_FALSE;
} }
const char* typeFromExt; const char* typeFromExt;
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt))) { if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt))) {
mimeType = typeFromExt; mimeType = typeFromExt;
return true; return PR_TRUE;
} }
return false; return PR_FALSE;
} }
nsObjectLoadingContent::nsObjectLoadingContent() nsObjectLoadingContent::nsObjectLoadingContent()
: mPendingInstantiateEvent(nsnull) : mPendingInstantiateEvent(nsnull)
, mChannel(nsnull) , mChannel(nsnull)
, mType(eType_Loading) , mType(eType_Loading)
, mInstantiating(false) , mInstantiating(PR_FALSE)
, mUserDisabled(false) , mUserDisabled(PR_FALSE)
, mSuppressed(false) , mSuppressed(PR_FALSE)
, mNetworkCreated(true) , mNetworkCreated(PR_TRUE)
, mFallbackReason(ePluginOtherState) , mFallbackReason(ePluginOtherState)
{ {
} }
@ -507,11 +507,11 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
AutoNotifier notifier(this, true); AutoNotifier notifier(this, PR_TRUE);
if (!IsSuccessfulRequest(aRequest)) { if (!IsSuccessfulRequest(aRequest)) {
LOG(("OBJLC [%p]: OnStartRequest: Request failed\n", this)); LOG(("OBJLC [%p]: OnStartRequest: Request failed\n", this));
Fallback(false); Fallback(PR_FALSE);
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
@ -598,7 +598,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
nsIDocument* doc = thisContent->GetOwnerDoc(); nsIDocument* doc = thisContent->GetOwnerDoc();
if (!doc) { if (!doc) {
Fallback(false); Fallback(PR_FALSE);
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
@ -638,16 +638,17 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
break; break;
case eType_Document: { case eType_Document: {
if (!mFrameLoader) { if (!mFrameLoader) {
mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated); mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
mNetworkCreated);
if (!mFrameLoader) { if (!mFrameLoader) {
Fallback(false); Fallback(PR_FALSE);
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
} }
rv = mFrameLoader->CheckForRecursiveLoad(uri); rv = mFrameLoader->CheckForRecursiveLoad(uri);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
Fallback(false); Fallback(PR_FALSE);
return rv; return rv;
} }
@ -687,7 +688,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
break; break;
} }
case eType_Plugin: case eType_Plugin:
mInstantiating = true; mInstantiating = PR_TRUE;
if (mType != newType) { if (mType != newType) {
// This can go away once plugin loading moves to content (bug 90268) // This can go away once plugin loading moves to content (bug 90268)
mType = newType; mType = newType;
@ -699,7 +700,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
// Do nothing in this case: This is probably due to a display:none // 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. // frame. If we ever get a frame, HasNewFrame will do the right thing.
// Abort the load though, we have no use for the data. // Abort the load though, we have no use for the data.
mInstantiating = false; mInstantiating = PR_FALSE;
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
@ -710,7 +711,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
rv = frame->Instantiate(chan, getter_AddRefs(mFinalListener)); rv = frame->Instantiate(chan, getter_AddRefs(mFinalListener));
mInstantiating = false; mInstantiating = PR_FALSE;
if (!weakFrame.IsAlive()) { if (!weakFrame.IsAlive()) {
// The frame was destroyed while instantiating. Abort the load. // 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 // 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 // set mFallbackReason without it being overwritten. This is also why we
// return early. // return early.
Fallback(false); Fallback(PR_FALSE);
PluginSupportState pluginState = GetPluginSupportState(thisContent, PluginSupportState pluginState = GetPluginSupportState(thisContent,
mContentType); mContentType);
@ -753,7 +754,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
#endif #endif
Fallback(false); Fallback(PR_FALSE);
} else if (mType == eType_Plugin) { } else if (mType == eType_Plugin) {
nsIObjectFrame* frame = GetExistingFrame(eFlushContent); nsIObjectFrame* frame = GetExistingFrame(eFlushContent);
if (frame) { if (frame) {
@ -767,7 +768,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
} }
LOG(("OBJLC [%p]: Found no listener, falling back\n", this)); LOG(("OBJLC [%p]: Found no listener, falling back\n", this));
Fallback(false); Fallback(PR_FALSE);
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
@ -874,7 +875,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance)
} }
// Trigger frame construction // Trigger frame construction
mInstantiating = true; mInstantiating = PR_TRUE;
nsCOMPtr<nsIContent> thisContent = nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this)); do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
@ -883,13 +884,13 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance)
nsIDocument* doc = thisContent->GetCurrentDoc(); nsIDocument* doc = thisContent->GetCurrentDoc();
if (!doc) { if (!doc) {
// Nothing we can do while plugin loading is done in layout... // Nothing we can do while plugin loading is done in layout...
mInstantiating = false; mInstantiating = PR_FALSE;
return NS_OK; return NS_OK;
} }
doc->FlushPendingNotifications(Flush_Frames); doc->FlushPendingNotifications(Flush_Frames);
mInstantiating = false; mInstantiating = PR_FALSE;
frame = GetExistingFrame(eFlushContent); frame = GetExistingFrame(eFlushContent);
if (!frame) { if (!frame) {
@ -922,7 +923,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance)
if (NS_SUCCEEDED(rv) && weakFrame.IsAlive()) { if (NS_SUCCEEDED(rv) && weakFrame.IsAlive()) {
rv = frame->GetPluginInstance(aInstance); rv = frame->GetPluginInstance(aInstance);
} else { } else {
Fallback(true); Fallback(PR_TRUE);
} }
} }
return rv; return rv;
@ -1173,10 +1174,10 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
// the AutoNotifier triggers frame construction, events can be posted as // the AutoNotifier triggers frame construction, events can be posted as
// appropriate. // appropriate.
NS_ASSERTION(!mInstantiating, "LoadObject was reentered?"); NS_ASSERTION(!mInstantiating, "LoadObject was reentered?");
mInstantiating = true; mInstantiating = PR_TRUE;
AutoSetInstantiatingToFalse autoset(this); AutoSetInstantiatingToFalse autoset(this);
mUserDisabled = mSuppressed = false; mUserDisabled = mSuppressed = PR_FALSE;
mURI = aURI; mURI = aURI;
mContentType = aTypeHint; mContentType = aTypeHint;
@ -1213,7 +1214,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
// Security checks // Security checks
if (doc->IsLoadedAsData()) { if (doc->IsLoadedAsData()) {
if (!doc->IsStaticDocument()) { if (!doc->IsStaticDocument()) {
Fallback(false); Fallback(PR_FALSE);
} }
return NS_OK; return NS_OK;
} }
@ -1228,7 +1229,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
nsresult rv = nsresult rv =
secMan->CheckLoadURIWithPrincipal(thisContent->NodePrincipal(), aURI, 0); secMan->CheckLoadURIWithPrincipal(thisContent->NodePrincipal(), aURI, 0);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
Fallback(false); Fallback(PR_FALSE);
return NS_OK; return NS_OK;
} }
@ -1277,7 +1278,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
// Must have a frameloader before creating a frame, or the frame will // Must have a frameloader before creating a frame, or the frame will
// create its own. // create its own.
if (!mFrameLoader && newType == eType_Document) { if (!mFrameLoader && newType == eType_Document) {
mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated); mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
mNetworkCreated);
if (!mFrameLoader) { if (!mFrameLoader) {
mURI = nsnull; mURI = nsnull;
return NS_OK; return NS_OK;
@ -1296,7 +1298,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
case eType_Image: case eType_Image:
// Don't notify, because we will take care of that ourselves. // Don't notify, because we will take care of that ourselves.
if (aURI) { if (aURI) {
rv = LoadImage(aURI, aForceLoad, false); rv = LoadImage(aURI, aForceLoad, PR_FALSE);
} else { } else {
rv = NS_ERROR_NOT_AVAILABLE; 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 // If the class ID specifies a supported plugin, or if we have no explicit URI
// but a type, immediately instantiate the plugin. // but a type, immediately instantiate the plugin.
bool isSupportedClassID = false; bool isSupportedClassID = false;
nsCAutoString typeForID; // Will be set iff isSupportedClassID == true nsCAutoString typeForID; // Will be set iff isSupportedClassID == PR_TRUE
bool hasID = false; bool hasID = false;
if (caps & eSupportClassID) { if (caps & eSupportClassID) {
nsAutoString classid; nsAutoString classid;
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classid); thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classid);
if (!classid.IsEmpty()) { if (!classid.IsEmpty()) {
hasID = true; hasID = PR_TRUE;
isSupportedClassID = NS_SUCCEEDED(TypeForClassID(classid, typeForID)); 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 // Set up the channel's principal and such, like nsDocShell::DoURILoad does
nsContentUtils::SetUpChannelOwner(thisContent->NodePrincipal(), nsContentUtils::SetUpChannelOwner(thisContent->NodePrincipal(),
chan, aURI, true); chan, aURI, PR_TRUE);
nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(chan); nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(chan);
if (scriptChannel) { if (scriptChannel) {
@ -1515,7 +1517,7 @@ nsObjectLoadingContent::IsSuccessfulRequest(nsIRequest* aRequest)
nsresult status; nsresult status;
nsresult rv = aRequest->GetStatus(&status); nsresult rv = aRequest->GetStatus(&status);
if (NS_FAILED(rv) || NS_FAILED(status)) { if (NS_FAILED(rv) || NS_FAILED(status)) {
return false; return PR_FALSE;
} }
// This may still be an error page or somesuch // This may still be an error page or somesuch
@ -1524,12 +1526,12 @@ nsObjectLoadingContent::IsSuccessfulRequest(nsIRequest* aRequest)
bool success; bool success;
rv = httpChan->GetRequestSucceeded(&success); rv = httpChan->GetRequestSucceeded(&success);
if (NS_FAILED(rv) || !success) { if (NS_FAILED(rv) || !success) {
return false; return PR_FALSE;
} }
} }
// Otherwise, the request is successful // Otherwise, the request is successful
return true; return PR_TRUE;
} }
/* static */ bool /* static */ bool
@ -1537,17 +1539,17 @@ nsObjectLoadingContent::CanHandleURI(nsIURI* aURI)
{ {
nsCAutoString scheme; nsCAutoString scheme;
if (NS_FAILED(aURI->GetScheme(scheme))) { if (NS_FAILED(aURI->GetScheme(scheme))) {
return false; return PR_FALSE;
} }
nsIIOService* ios = nsContentUtils::GetIOService(); nsIIOService* ios = nsContentUtils::GetIOService();
if (!ios) if (!ios)
return false; return PR_FALSE;
nsCOMPtr<nsIProtocolHandler> handler; nsCOMPtr<nsIProtocolHandler> handler;
ios->GetProtocolHandler(scheme.get(), getter_AddRefs(handler)); ios->GetProtocolHandler(scheme.get(), getter_AddRefs(handler));
if (!handler) { if (!handler) {
return false; return PR_FALSE;
} }
nsCOMPtr<nsIExternalProtocolHandler> extHandler = nsCOMPtr<nsIExternalProtocolHandler> extHandler =
@ -1596,20 +1598,20 @@ nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType)
return supported != nsIWebNavigationInfo::PLUGIN; return supported != nsIWebNavigationInfo::PLUGIN;
} }
return false; return PR_FALSE;
} }
void void
nsObjectLoadingContent::UnloadContent() nsObjectLoadingContent::UnloadContent()
{ {
// Don't notify in CancelImageRequests. We do it ourselves. // Don't notify in CancelImageRequests. We do it ourselves.
CancelImageRequests(false); CancelImageRequests(PR_FALSE);
if (mFrameLoader) { if (mFrameLoader) {
mFrameLoader->Destroy(); mFrameLoader->Destroy();
mFrameLoader = nsnull; mFrameLoader = nsnull;
} }
mType = eType_Null; mType = eType_Null;
mUserDisabled = mSuppressed = false; mUserDisabled = mSuppressed = PR_FALSE;
mFallbackReason = ePluginOtherState; mFallbackReason = ePluginOtherState;
} }
@ -1804,9 +1806,9 @@ nsObjectLoadingContent::HandleBeingBlockedByContentPolicy(nsresult aStatus,
UnloadContent(); UnloadContent();
if (NS_SUCCEEDED(aStatus)) { if (NS_SUCCEEDED(aStatus)) {
if (aRetval == nsIContentPolicy::REJECT_TYPE) { if (aRetval == nsIContentPolicy::REJECT_TYPE) {
mUserDisabled = true; mUserDisabled = PR_TRUE;
} else if (aRetval == nsIContentPolicy::REJECT_SERVER) { } 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 // Mark that we're instantiating now so that we don't end up
// re-entering instantiation code. // re-entering instantiation code.
bool oldInstantiatingValue = mInstantiating; bool oldInstantiatingValue = mInstantiating;
mInstantiating = true; mInstantiating = PR_TRUE;
nsCString typeToUse(aMIMEType); nsCString typeToUse(aMIMEType);
if (typeToUse.IsEmpty() && aURI) { if (typeToUse.IsEmpty() && aURI) {
@ -1936,7 +1938,7 @@ nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
} }
} else if (!hasAlternateContent) { } else if (!hasAlternateContent) {
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) { if (mFrameLoader) {
nsCOMPtr<nsIContent> content = nsCOMPtr<nsIContent> content =
do_QueryInterface(static_cast<nsIImageLoadingContent*>((aDest))); do_QueryInterface(static_cast<nsIImageLoadingContent*>(aDest));
nsFrameLoader* fl = nsFrameLoader::Create(content, false); nsFrameLoader* fl = nsFrameLoader::Create(content->AsElement(), PR_FALSE);
if (fl) { if (fl) {
aDest->mFrameLoader = fl; aDest->mFrameLoader = fl;
mFrameLoader->CreateStaticClone(fl); mFrameLoader->CreateStaticClone(fl);
@ -2001,7 +2003,7 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag,
const nsAString& browserDumpID, const nsAString& browserDumpID,
bool submittedCrashReport) bool submittedCrashReport)
{ {
AutoNotifier notifier(this, true); AutoNotifier notifier(this, PR_TRUE);
UnloadContent(); UnloadContent();
mFallbackReason = ePluginCrashed; mFallbackReason = ePluginCrashed;
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this)); nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));

Просмотреть файл

@ -1401,10 +1401,7 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
if (aUseLSEventWrapper) { if (aUseLSEventWrapper) {
nsCOMPtr<nsIDOMProgressEvent> xhrprogressEvent = nsCOMPtr<nsIDOMProgressEvent> xhrprogressEvent =
new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize); new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize, mOwner);
if (!xhrprogressEvent) {
return;
}
event = xhrprogressEvent; event = xhrprogressEvent;
} }
aTarget->DispatchDOMEvent(nsnull, event, nsnull, nsnull); 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 // DOM event class to handle progress notifications
nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner, nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
PRUint64 aCurrentProgress, PRUint64 aCurrentProgress,
PRUint64 aMaxProgress) PRUint64 aMaxProgress,
nsPIDOMWindow* aWindow)
: mWindow(aWindow)
{ {
mInner = static_cast<nsDOMProgressEvent*>(aInner); mInner = static_cast<nsDOMProgressEvent*>(aInner);
mCurProgress = aCurrentProgress; mCurProgress = aCurrentProgress;
@ -3270,11 +3269,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInner); NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInner);
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mWindow);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mInner, NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mInner,
nsIDOMProgressEvent) nsIDOMProgressEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mWindow);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput) NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
@ -3283,8 +3284,23 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
void
nsXMLHttpProgressEvent::WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations aOperation)
{
if (!mWindow) {
return;
}
nsCOMPtr<nsIDocument> document =
do_QueryInterface(mWindow->GetExtantDocument());
if (!document) {
return;
}
document->WarnOnceAbout(aOperation);
}
NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition) NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition)
{ {
WarnAboutLSProgressEvent(nsIDocument::ePosition);
// XXX can we change the iface? // XXX can we change the iface?
LL_L2UI(*aPosition, mCurProgress); LL_L2UI(*aPosition, mCurProgress);
return NS_OK; return NS_OK;
@ -3292,8 +3308,8 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition)
NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(PRUint32 *aTotalSize) NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(PRUint32 *aTotalSize)
{ {
WarnAboutLSProgressEvent(nsIDocument::eTotalSize);
// XXX can we change the iface? // XXX can we change the iface?
LL_L2UI(*aTotalSize, mMaxProgress); LL_L2UI(*aTotalSize, mMaxProgress);
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -380,7 +380,8 @@ class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
public: public:
nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner, nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
PRUint64 aCurrentProgress, PRUint64 aCurrentProgress,
PRUint64 aMaxProgress); PRUint64 aMaxProgress,
nsPIDOMWindow* aWindow);
virtual ~nsXMLHttpProgressEvent(); virtual ~nsXMLHttpProgressEvent();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -421,9 +422,12 @@ public:
} }
protected: protected:
void WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations);
// Use nsDOMProgressEvent so that we can forward // Use nsDOMProgressEvent so that we can forward
// most of the method calls easily. // most of the method calls easily.
nsRefPtr<nsDOMProgressEvent> mInner; nsRefPtr<nsDOMProgressEvent> mInner;
nsCOMPtr<nsPIDOMWindow> mWindow;
PRUint64 mCurProgress; PRUint64 mCurProgress;
PRUint64 mMaxProgress; PRUint64 mMaxProgress;
}; };

Просмотреть файл

@ -231,7 +231,6 @@ _TEST_FILES1 = \
test_bug438519.html \ test_bug438519.html \
test_bug444722.html \ test_bug444722.html \
test_bug451376.html \ test_bug451376.html \
test_text_replaceWholeText.html \
test_text_wholeText.html \ test_text_wholeText.html \
test_bug433533.html \ test_bug433533.html \
wholeTexty-helper.xml \ wholeTexty-helper.xml \

Просмотреть файл

@ -87,10 +87,32 @@ function testPI(aTarget, aData, aShouldSucceed, aReason)
{ {
try { try {
var pi = document.createProcessingInstruction(aTarget, aData); var pi = document.createProcessingInstruction(aTarget, aData);
ok(0, "Invalid processing instruction creation", var types = [ ProcessingInstruction, Node ];
"Shouldn't create processing instructions in HTML"); 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) { } 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");
}
} }
} }

Просмотреть файл

@ -59,32 +59,31 @@ function xhrDoc(idx) {
} }
// Each row has the document getter function, then the characterSet, // Each row has the document getter function, then the characterSet,
// inputEncoding, xmlEncoding expected for that document. // inputEncoding expected for that document.
var tests = [ var tests = [
[ frameDoc("one"), "ISO-8859-1", "ISO-8859-1", null ], [ frameDoc("one"), "ISO-8859-1", "ISO-8859-1" ],
[ frameDoc("two"), "UTF-8", "UTF-8", null ], [ frameDoc("two"), "UTF-8", "UTF-8" ],
[ frameDoc("three"), "ISO-8859-1", "ISO-8859-1", null ], [ frameDoc("three"), "ISO-8859-1", "ISO-8859-1" ],
[ frameDoc("four"), "UTF-8", "UTF-8", null ], [ frameDoc("four"), "UTF-8", "UTF-8" ],
[ frameDoc("five"), "UTF-8", "UTF-8", null ], [ frameDoc("five"), "UTF-8", "UTF-8" ],
[ frameDoc("six"), "UTF-8", "UTF-8", "UTF-8"], [ frameDoc("six"), "UTF-8", "UTF-8" ],
[ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ], [ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1" ],
[ createDoc, "UTF-8", null, null ], [ createDoc, "UTF-8", null ],
[ xhrDoc(4), "UTF-8", "UTF-8", null ], [ xhrDoc(4), "UTF-8", "UTF-8" ],
[ xhrDoc(5), "UTF-8", "UTF-8", "UTF-8" ], [ xhrDoc(5), "UTF-8", "UTF-8" ],
[ xhrDoc(6), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ], [ xhrDoc(6), "ISO-8859-1", "ISO-8859-1" ],
]; ];
function doTest(idx) { function doTest(idx) {
var [docGetter, expectedCharacterSet, var [docGetter, expectedCharacterSet,
expectedInputEncoding, expectedXMLEncoding] = tests[idx]; expectedInputEncoding] = tests[idx];
var doc = docGetter(); var doc = docGetter();
// Have to be careful here to catch null vs "" // Have to be careful here to catch null vs ""
is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet"); is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet");
is(doc.inputEncoding, expectedInputEncoding, is(doc.inputEncoding, expectedInputEncoding,
"Test " + idx + " inputEncoding"); "Test " + idx + " inputEncoding");
is(doc.xmlEncoding, expectedXMLEncoding, "Test " + idx + " xmlEncoding");
} }
addLoadEvent(function() { addLoadEvent(function() {

Просмотреть файл

@ -35,15 +35,6 @@ function doTest() {
} }
ok(hadException, ok(hadException,
"Should have got an exception when using .wholeText with a text node child of the binding parent"); "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(); SimpleTest.finish();
} }

Просмотреть файл

@ -1,256 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=421765
-->
<head>
<title>Text.replaceWholeText tests</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421765">Mozilla Bug 421765</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<iframe id="xmlDocument" src="wholeTexty-helper.xml"></iframe>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 421765 **/
SimpleTest.waitForExplicitFinish();
var xmlDoc;
function text(t) { return document.createTextNode(t); }
function element() { return document.createElement("div"); }
function cdata(t)
{
xmlDoc = $("xmlDocument").contentDocument;
// document.createCDATASection isn't implemented; clone for the win
var node = xmlDoc.documentElement.firstChild.cloneNode(false);
is(node.nodeType, Node.CDATA_SECTION_NODE,
"er, why isn't this a CDATA section node?");
node.data = t;
return node;
}
function startTests()
{
var outer = element();
var first = text("first");
var second = element();
second.appendChild(text("element contents"));
outer.appendChild(first);
outer.appendChild(second);
is(first.wholeText, "first", "wrong initial wholeText");
is(first.replaceWholeText("start"), first,
"should have gotten first back");
is(first.data, "start", "should have modified first's data");
is(first.wholeText, "start", "should have gotten new wholeText");
var cdataNode = cdata("-cdata");
outer.insertBefore(cdataNode, second);
is(first.wholeText, "start-cdata",
"should have gotten first+cdataNode as wholeText");
var outer2 = outer.cloneNode(true); // save
is(first.replaceWholeText("first"), first,
"replaceWholeText on first returned wrong object");
is(first.nodeType, Node.TEXT_NODE, "node changed type?");
is(first.data, "first", "wrong data in first");
is(first.previousSibling, null, "wrong previousSibling for first");
is(first.nextSibling, second, "wrong nextSibling for first");
is(cdataNode.previousSibling, null, "wrong previousSibling for cdataNode");
is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
ok(first.replaceWholeText("") === null,
"empty string should cause a return of null");
is(first.data, "first", "wrong data after replacing with empty string");
is(outer.firstChild, second, "replaceWholeText('') removes the node");
// switcheroo, with sanity tests
outer = outer2;
is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
first = outer.firstChild;
is(first.nodeType, Node.TEXT_NODE, "first not text?");
cdataNode = first.nextSibling;
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
second = outer.lastChild;
is(second.nodeType, Node.ELEMENT_NODE, "second not element?");
is(cdataNode.replaceWholeText("cdata"), cdataNode,
"replaceWholeText on cdataNode returned wrong object");
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
is(cdataNode.nodeValue, "cdata", "wrong node value?");
is(cdataNode.previousSibling, null, "wrong previousSibling");
is(cdataNode.nextSibling, second, "wrong nextSibling");
ok(cdataNode.replaceWholeText("") === null,
"empty string should cause a return of null");
is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
is(outer.firstChild, second, "should be no more text at start");
}
function middleTests()
{
var outer = element();
var first = element();
var middle = text("middle");
var last = element();
first.appendChild(text("first element contents"));
last.appendChild(text("last element contents"));
outer.appendChild(first);
outer.appendChild(middle);
outer.appendChild(last);
is(middle.wholeText, "middle", "wrong initial wholeText");
is(middle.replaceWholeText("center"), middle,
"should have gotten middle back");
is(middle.data, "center", "should have modified middle's data");
is(middle.wholeText, "center", "should have gotten new wholeText");
var cdataNode = cdata("-cdata");
outer.insertBefore(cdataNode, last);
is(middle.wholeText, "center-cdata",
"should have gotten middle+cdataNode as wholeText");
var outer2 = outer.cloneNode(true); // save
is(middle.replaceWholeText("middle"), middle,
"replaceWholeText on middle returned wrong object");
is(middle.nodeType, Node.TEXT_NODE, "node changed type?");
is(middle.data, "middle", "wrong data in middle");
is(middle.previousSibling, first, "wrong previousSibling");
is(middle.nextSibling, last, "wrong nextSibling");
ok(middle.replaceWholeText("") === null,
"empty string should cause a return of null");
is(middle.data, "middle", "wrong data after replacing with empty string");
// switcheroo, with sanity tests
outer = outer2;
is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
first = outer.firstChild;
is(first.nodeType, Node.ELEMENT_NODE, "first not element?");
middle = first.nextSibling;
is(middle.nodeType, Node.TEXT_NODE, "middle not text?");
cdataNode = middle.nextSibling;
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
last = outer.lastChild;
is(last.nodeType, Node.ELEMENT_NODE, "last not element?");
is(cdataNode.replaceWholeText("cdata"), cdataNode,
"replaceWholeText on cdataNode returned wrong object");
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
is(cdataNode.nodeValue, "cdata", "wrong node value?");
is(cdataNode.previousSibling, first, "wrong previousSibling");
is(cdataNode.nextSibling, last, "wrong nextSibling");
ok(cdataNode.replaceWholeText("") === null,
"empty string should cause a return of null");
is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
is(middle.wholeText, "center", "wrong wholeText after removal");
is(first.nextSibling, last, "wrong nextSibling");
is(last.previousSibling, first, "wrong previousSibling");
}
function endTests()
{
var outer = element();
var first = element();
var second = text("second");
first.appendChild(text("element contents"));
outer.appendChild(first);
outer.appendChild(second);
is(second.wholeText, "second", "wrong initial wholeText");
is(second.replaceWholeText("end"), second,
"should have gotten second back");
is(second.data, "end", "should have modified second's data");
is(second.wholeText, "end", "should have gotten new wholeText");
var cdataNode = cdata("cdata-");
outer.insertBefore(cdataNode, second);
is(second.wholeText, "cdata-end",
"should have gotten cdataNode+second as wholeText");
is(cdataNode.wholeText, "cdata-end",
"should have gotten cdataNode+second as wholeText");
var outer2 = outer.cloneNode(true); // save
is(second.replaceWholeText("second"), second,
"replaceWholeText on second returned wrong object");
is(second.nodeType, Node.TEXT_NODE, "node changed type?");
is(second.data, "second", "wrong data in second");
is(second.previousSibling, first, "wrong previousSibling for second");
is(second.nextSibling, null, "wrong nextSibling for second");
is(cdataNode.previousSibling, null, "wrong previousSibling for cdataNode");
is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
ok(second.replaceWholeText("") === null,
"empty string should cause a return of null");
is(second.data, "second", "wrong data after replacing with empty string");
is(outer.lastChild, first, "replaceWholeText('') removes the node");
// switcheroo, with sanity tests
outer = outer2;
is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
first = outer.firstChild;
is(first.nodeType, Node.ELEMENT_NODE, "first not element?");
cdataNode = first.nextSibling;
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
second = outer.lastChild;
is(second.nodeType, Node.TEXT_NODE, "middle not text?");
is(cdataNode.replaceWholeText("cdata"), cdataNode,
"replaceWholeText on cdataNode returned wrong object");
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
is(cdataNode.nodeValue, "cdata", "wrong node value?");
is(cdataNode.previousSibling, first, "wrong previousSibling for cdataNode");
is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
is(second.previousSibling, null, "wrong previousSibling for second");
is(second.nextSibling, null, "wrong nextSibling for second");
ok(cdataNode.replaceWholeText("") === null,
"empty string should cause a return of null");
is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
is(outer.lastChild, first, "should be no more text at end");
}
function test()
{
try
{
startTests();
middleTests();
endTests();
}
catch (e)
{
ok(false, "exception thrown: " + e);
}
finally
{
SimpleTest.finish();
}
}
window.addEventListener("load", test, false);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -20190,7 +20190,7 @@ function test_size_attributes_parse_badsuffix() {
var canvas = document.getElementById('c637'); var canvas = document.getElementById('c637');
var ctx = canvas.getContext('2d'); 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'); var ctx = canvas.getContext('2d');
canvas.setAttribute('width', '100foo'); canvas.setAttribute('width', '100foo');
todo(canvas.width == 100, "canvas.width == 100"); is(canvas.width, 100, "canvas.width == 100");
} }

Просмотреть файл

@ -209,22 +209,6 @@ check();
is(children.length, 0, "should have received DOMNodeRemoved for all frag children when appending"); 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"); 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();
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@ -68,8 +68,6 @@ public:
TableRowsCollection(nsHTMLTableElement *aParent); TableRowsCollection(nsHTMLTableElement *aParent);
virtual ~TableRowsCollection(); virtual ~TableRowsCollection();
nsresult Init();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMHTMLCOLLECTION NS_DECL_NSIDOMHTMLCOLLECTION
@ -83,13 +81,18 @@ public:
protected: protected:
// Those rows that are not in table sections // Those rows that are not in table sections
nsHTMLTableElement* mParent;
nsRefPtr<nsContentList> mOrphanRows; nsRefPtr<nsContentList> mOrphanRows;
nsHTMLTableElement * mParent;
}; };
TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent) TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent)
: mParent(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_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLCollection)
NS_INTERFACE_MAP_END 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 // 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 // rowgroups. _code should be the code to execute for each rowgroup. The
// rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows". Note // rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows". Note
@ -499,15 +491,7 @@ NS_IMETHODIMP
nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue) nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue)
{ {
if (!mRows) { if (!mRows) {
// XXX why was this here NS_ADDREF(nsGkAtoms::tr);
mRows = new TableRowsCollection(this); 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; *aValue = mRows;

Просмотреть файл

@ -462,11 +462,6 @@ function reflectBoolean(aParameters)
*/ */
function reflectInt(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(). // Expected value returned by .getAttribute() when |value| has been previously passed to .setAttribute().
function expectedGetAttributeResult(value) { function expectedGetAttributeResult(value) {
return (value !== null) ? String(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 //TBD: Bug 586761: .setAttribute(attr, -2147483648) --> element[attr] == defaultValue instead of -2147483648
todo_is(element[attr], intValue, "Bug 586761: " + element.localName + todo_is(element[attr], intValue, "Bug 586761: " + element.localName +
".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] "); ".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] ");
} else if (testExponential(v)) { } else if ((v === "-0" || v == "-0xABCDEF") && nonNegative) {
//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) {
//TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0" //TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0"
todo_is(element[attr], intValue, "Bug 688093: " + element.localName + todo_is(element[attr], intValue, "Bug 688093: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); ".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 { } else {
is(element[attr], intValue, element.localName + is(element[attr], intValue, element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");

Просмотреть файл

@ -139,7 +139,6 @@
#include "nsIDOMDOMStringList.h" #include "nsIDOMDOMStringList.h"
#include "nsIDOMDOMTokenList.h" #include "nsIDOMDOMTokenList.h"
#include "nsIDOMDOMSettableTokenList.h" #include "nsIDOMDOMSettableTokenList.h"
#include "nsIDOMNameList.h"
#include "nsIDOMNSElement.h" #include "nsIDOMNSElement.h"
#include "nsDOMStringMap.h" #include "nsDOMStringMap.h"
@ -1000,9 +999,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH, NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH,
ARRAY_SCRIPTABLE_FLAGS) ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(NameList, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
#ifdef MOZ_XUL #ifdef MOZ_XUL
NS_DEFINE_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH,
DEFAULT_SCRIPTABLE_FLAGS) DEFAULT_SCRIPTABLE_FLAGS)
@ -2996,10 +2992,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(NameList, nsIDOMNameList)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNameList)
DOM_CLASSINFO_MAP_END
#ifdef MOZ_XUL #ifdef MOZ_XUL
DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn) DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn)
DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn) DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn)

Просмотреть файл

@ -220,9 +220,6 @@ DOMCI_CLASS(XULTreeBuilder)
// DOMStringList object // DOMStringList object
DOMCI_CLASS(DOMStringList) DOMCI_CLASS(DOMStringList)
// NameList object used by the DOM
DOMCI_CLASS(NameList)
#ifdef MOZ_XUL #ifdef MOZ_XUL
DOMCI_CLASS(TreeColumn) DOMCI_CLASS(TreeColumn)
DOMCI_CLASS(TreeColumns) DOMCI_CLASS(TreeColumns)

Просмотреть файл

@ -60,7 +60,6 @@ interface nsIDOMProcessingInstruction;
interface nsIDOMText; interface nsIDOMText;
interface nsIDOMDOMStringList; interface nsIDOMDOMStringList;
interface nsIDOMDOMTokenList; interface nsIDOMDOMTokenList;
interface nsIDOMNameList;
interface nsIDOMClientRect; interface nsIDOMClientRect;
interface nsIDOMClientRectList; interface nsIDOMClientRectList;

Просмотреть файл

@ -66,7 +66,6 @@ SDK_XPIDLSRCS = \
$(NULL) $(NULL)
XPIDLSRCS = \ XPIDLSRCS = \
nsIDOMDOMStringList.idl \ nsIDOMDOMStringList.idl \
nsIDOMNameList.idl \
nsIDOMXMLDocument.idl \ nsIDOMXMLDocument.idl \
nsIDOMUserDataHandler.idl \ nsIDOMUserDataHandler.idl \
nsIDOMNSEditableElement.idl \ nsIDOMNSEditableElement.idl \

Просмотреть файл

@ -67,7 +67,7 @@ interface nsIDOMCaretPosition;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html * 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 interface nsIDOMDocument : nsIDOMNode
{ {
readonly attribute nsIDOMDocumentType doctype; readonly attribute nsIDOMDocumentType doctype;
@ -106,8 +106,6 @@ interface nsIDOMDocument : nsIDOMNode
nsIDOMElement getElementById(in DOMString elementId); nsIDOMElement getElementById(in DOMString elementId);
// Introduced in DOM Level 3: // Introduced in DOM Level 3:
readonly attribute DOMString inputEncoding; readonly attribute DOMString inputEncoding;
// Introduced in DOM Level 3:
readonly attribute DOMString xmlEncoding;
// Introduced in DOM Level 3: // Introduced in DOM Level 3:
attribute boolean xmlStandalone; attribute boolean xmlStandalone;
// raises(DOMException) on setting // raises(DOMException) on setting

Просмотреть файл

@ -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 <peterv@netscape.com>
*
*
* 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);
};

Просмотреть файл

@ -47,7 +47,7 @@
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html * 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 interface nsIDOMText : nsIDOMCharacterData
{ {
nsIDOMText splitText(in unsigned long offset) nsIDOMText splitText(in unsigned long offset)
@ -68,12 +68,4 @@ interface nsIDOMText : nsIDOMCharacterData
* passing an element, comment, or processing-instruction boundary. * passing an element, comment, or processing-instruction boundary.
*/ */
readonly attribute DOMString wholeText; 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);
}; };

Просмотреть файл

@ -38,7 +38,7 @@
#include "nsIDOMDocument.idl" #include "nsIDOMDocument.idl"
[scriptable, uuid(0457526E-1FA5-476C-9314-0F704617B9F4)] [scriptable, uuid(8168733e-9cf6-4552-9f03-57de11b87f3f)]
interface nsIDOMXMLDocument : nsIDOMDocument interface nsIDOMXMLDocument : nsIDOMDocument
{ {
// DOM Level 3 Load & Save, DocumentLS // DOM Level 3 Load & Save, DocumentLS

Просмотреть файл

@ -47,7 +47,7 @@
*/ */
interface nsISelection; interface nsISelection;
[scriptable, uuid(DA6A8183-3C50-4F4A-9EFC-0E050B9A856A)] [scriptable, uuid(9a23fb3c-1d25-462e-8e85-c78c9dc61755)]
interface nsIDOMHTMLDocument : nsIDOMDocument interface nsIDOMHTMLDocument : nsIDOMDocument
{ {
readonly attribute DOMString URL; readonly attribute DOMString URL;

Просмотреть файл

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement; interface nsIDOMSVGSVGElement;
[scriptable, uuid(E055EF40-D6BA-443A-B4DB-C1CCFAA6EB31)] [scriptable, uuid(1767ad4f-bb2b-474b-b208-9910ed152605)]
interface nsIDOMSVGDocument : nsIDOMDocument interface nsIDOMSVGDocument : nsIDOMDocument
{ {
readonly attribute DOMString domain; readonly attribute DOMString domain;

Просмотреть файл

@ -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 : */ /* vim: set sw=4 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -98,10 +98,15 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager) 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() return mMessageManager
: NS_ERROR_NULL_POINTER; ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
: NS_ERROR_NULL_POINTER;
} }
NS_IMETHOD GetContent(nsIDOMWindow** aContent); NS_IMETHOD GetContent(nsIDOMWindow** aContent);
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell); NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);

Просмотреть файл

@ -108,12 +108,12 @@ IsSupportedWarning=Use of attributes' isSupported() is deprecated.
IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated. IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated.
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead. 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. 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. nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.parse instead.
nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead. nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead.
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow 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. 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. XmlVersionWarning=Use of xmlVersion is deprecated.
InputEncodingWarning=Use of inputEncoding is deprecated. InputEncodingWarning=Use of inputEncoding is deprecated.
XmlStandaloneWarning=Use of xmlStandalone is deprecated. XmlStandaloneWarning=Use of xmlStandalone is deprecated.

Просмотреть файл

@ -39,9 +39,6 @@ function runTest() {
// doc.xmlStandalone // doc.xmlStandalone
ok(doc.xmlStandalone == clonefalse.xmlStandalone, "xmlStandalone not preserved correctly; " + iframes[i].id); 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 // doc.characterSet
ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id); ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id);

Просмотреть файл

@ -88,7 +88,8 @@ var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr",
var createEntityRef = ["documentinvalidcharacterexceptioncreateentref", var createEntityRef = ["documentinvalidcharacterexceptioncreateentref",
"documentinvalidcharacterexceptioncreateentref1", "documentinvalidcharacterexceptioncreateentref1",
"hc_attrgetvalue2", "hc_nodevalue03"]; "hc_attrgetvalue2", "hc_nodevalue03"];
var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi",
"documentinvalidcharacterexceptioncreatepi1"];
var todoTests = {}; var todoTests = {};
function concat(lst/*...*/) { function concat(lst/*...*/) {
@ -101,5 +102,5 @@ function concat(lst/*...*/) {
} }
return f; 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; } for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; }

Просмотреть файл

@ -148,11 +148,6 @@ members = [
'nsIDOMDOMStringList.*', 'nsIDOMDOMStringList.*',
'nsIDOMDOMTokenList.*', 'nsIDOMDOMTokenList.*',
'nsIDOMDOMSettableTokenList.*', 'nsIDOMDOMSettableTokenList.*',
'nsIDOMNameList.getName',
'nsIDOMNameList.contains',
'nsIDOMNameList.containsNS',
'nsIDOMNameList.length',
'nsIDOMNameList.getNamespaceURI',
'nsIDOMXULDocument.getBoxObjectFor', 'nsIDOMXULDocument.getBoxObjectFor',
'nsIDOMNSElement.*', 'nsIDOMNSElement.*',

Просмотреть файл

@ -3146,12 +3146,11 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll)
} }
} }
} else { } else {
rv = NS_ERROR_FAILURE; //changed to NS_OK in quirks mode if ScrollTo is called rv = NS_ERROR_FAILURE;
NS_NAMED_LITERAL_STRING(top, "top");
// Scroll to the top/left if the anchor can not be if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) {
// found and it is labelled top (quirks mode only). @see bug 80784 // Scroll to the top/left if aAnchorName is "top" and there is no element
if ((NS_LossyConvertUTF16toASCII(aAnchorName).LowerCaseEqualsLiteral("top")) && // with such a name or id.
(mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)) {
rv = NS_OK; rv = NS_OK;
nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable(); nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable();
// Check |aScroll| after setting |rv| so we set |rv| to the same // Check |aScroll| after setting |rv| so we set |rv| to the same

Просмотреть файл

@ -68,6 +68,12 @@ _TEST_FILES = \
test_after_paint_pref.html \ test_after_paint_pref.html \
test_border_radius_hit_testing.html \ test_border_radius_hit_testing.html \
test_bug66619.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 \ test_bug114649.html \
$(warning test_bug369950.html disabled due to random orange; see bug 492575) \ $(warning test_bug369950.html disabled due to random orange; see bug 492575) \
test_bug386575.xhtml \ test_bug386575.xhtml \

Просмотреть файл

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,32 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p id=top>Top</p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#top"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,35 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p><a name=top>Top</a></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#top"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p id=TOP>Top</p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#TOP"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,35 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p><a name=TOP>Top</a></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#TOP"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -6,7 +6,7 @@
<th>0</th> <th>0</th>
<td><table cellpadding="4" border="0"><tr><td>border="0"</td></tr></table></td> <td><table cellpadding="4" border="0"><tr><td>border="0"</td></tr></table></td>
<td><table cellpadding="4" border="0"><tr><td>border="0px"</td></tr></table></td> <td><table cellpadding="4" border="0"><tr><td>border="0px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="0em"</td></tr></table></td> <td><table cellpadding="4" border="0"><tr><td>border="0em"</td></tr></table></td>
</tr> </tr>
<tr> <tr>
<th>1</th> <th>1</th>
@ -18,19 +18,19 @@
<th>2</th> <th>2</th>
<td><table cellpadding="4" border="2"><tr><td>border="2"</td></tr></table></td> <td><table cellpadding="4" border="2"><tr><td>border="2"</td></tr></table></td>
<td><table cellpadding="4" border="2"><tr><td>border="2px"</td></tr></table></td> <td><table cellpadding="4" border="2"><tr><td>border="2px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="2em"</td></tr></table></td> <td><table cellpadding="4" border="2"><tr><td>border="2em"</td></tr></table></td>
</tr> </tr>
<tr> <tr>
<th>3</th> <th>3</th>
<td><table cellpadding="4" border="3"><tr><td>border="3"</td></tr></table></td> <td><table cellpadding="4" border="3"><tr><td>border="3"</td></tr></table></td>
<td><table cellpadding="4" border="3"><tr><td>border="3px"</td></tr></table></td> <td><table cellpadding="4" border="3"><tr><td>border="3px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="3em"</td></tr></table></td> <td><table cellpadding="4" border="3"><tr><td>border="3em"</td></tr></table></td>
</tr> </tr>
<tr> <tr>
<th>10</th> <th>10</th>
<td><table cellpadding="4" border="10"><tr><td>border="10"</td></tr></table></td> <td><table cellpadding="4" border="10"><tr><td>border="10"</td></tr></table></td>
<td><table cellpadding="4" border="10"><tr><td>border="10px"</td></tr></table></td> <td><table cellpadding="4" border="10"><tr><td>border="10px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="10em"</td></tr></table></td> <td><table cellpadding="4" border="10"><tr><td>border="10em"</td></tr></table></td>
</tr> </tr>
</table> </table>

Просмотреть файл

@ -397,23 +397,13 @@ nsProgressNotificationProxy::GetInterface(const nsIID& iid,
return NS_NOINTERFACE; return NS_NOINTERFACE;
} }
static bool NewRequestAndEntry(bool forcePrincipalCheckForCacheEntry, static void NewRequestAndEntry(bool aForcePrincipalCheckForCacheEntry,
imgRequest **request, imgCacheEntry **entry) imgRequest **aRequest, imgCacheEntry **aEntry)
{ {
*request = new imgRequest(); nsRefPtr<imgRequest> request = new imgRequest();
if (!*request) nsRefPtr<imgCacheEntry> entry = new imgCacheEntry(request, aForcePrincipalCheckForCacheEntry);
return PR_FALSE; request.forget(aRequest);
entry.forget(aEntry);
*entry = new imgCacheEntry(*request, forcePrincipalCheckForCacheEntry);
if (!*entry) {
delete *request;
return PR_FALSE;
}
NS_ADDREF(*request);
NS_ADDREF(*entry);
return PR_TRUE;
} }
static bool ShouldRevalidateEntry(imgCacheEntry *aEntry, static bool ShouldRevalidateEntry(imgCacheEntry *aEntry,
@ -1697,9 +1687,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
if (!NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request), NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
getter_AddRefs(entry))) getter_AddRefs(entry));
return NS_ERROR_OUT_OF_MEMORY;
PR_LOG(gImgLog, PR_LOG_DEBUG, PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- Created new imgRequest [request=%p]\n", this, request.get())); ("[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 // Default to doing a principal check because we don't know who
// started that load and whether their principal ended up being // started that load and whether their principal ended up being
// inherited on the channel. // inherited on the channel.
if (!NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), getter_AddRefs(entry));
getter_AddRefs(entry)))
return NS_ERROR_OUT_OF_MEMORY;
// We use originalURI here to fulfil the imgIRequest contract on GetURI. // We use originalURI here to fulfil the imgIRequest contract on GetURI.
nsCOMPtr<nsIURI> originalURI; nsCOMPtr<nsIURI> originalURI;