зеркало из https://github.com/mozilla/pjs.git
Merge mozilla-central to mozilla-inbound
This commit is contained in:
Коммит
3c1bf37929
|
@ -387,15 +387,10 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
|||
NS_ASSERTION(targetDocument, "No document while accessible is in document?!");
|
||||
|
||||
nsINode* targetNode = accessible->GetNode();
|
||||
nsIContent* targetContent = targetNode->IsElement() ?
|
||||
targetNode->AsElement() : nsnull;
|
||||
nsIContent* origTargetContent = origTargetNode->IsElement() ?
|
||||
origTargetNode->AsElement() : nsnull;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
bool isTree = targetContent ?
|
||||
targetContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) :
|
||||
PR_FALSE;
|
||||
bool isTree = targetNode->IsElement() &&
|
||||
targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL);
|
||||
|
||||
if (isTree) {
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
|
||||
|
|
|
@ -71,10 +71,10 @@ DEPRECATED_OPERATION(IsSupported)
|
|||
DEPRECATED_OPERATION(IsEqualNode)
|
||||
DEPRECATED_OPERATION(TextContent)
|
||||
DEPRECATED_OPERATION(EnablePrivilege)
|
||||
DEPRECATED_OPERATION(Position)
|
||||
DEPRECATED_OPERATION(TotalSize)
|
||||
DEPRECATED_OPERATION(IsSameNode)
|
||||
DEPRECATED_OPERATION(ReplaceWholeText)
|
||||
DEPRECATED_OPERATION(GlobalStorage)
|
||||
DEPRECATED_OPERATION(XmlEncoding)
|
||||
DEPRECATED_OPERATION(XmlVersion)
|
||||
DEPRECATED_OPERATION(InputEncoding)
|
||||
DEPRECATED_OPERATION(XmlStandalone)
|
||||
|
|
|
@ -64,24 +64,26 @@ interface nsIFrameMessageListener : nsISupports
|
|||
void receiveMessage();
|
||||
};
|
||||
|
||||
[scriptable, uuid(6b736edb-863d-40bd-bca2-62f44da803c0)]
|
||||
[scriptable, uuid(a27d8fcd-8de9-4a51-87f4-2b83bba901d5)]
|
||||
interface nsIFrameMessageManager : nsISupports
|
||||
{
|
||||
void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
|
||||
void removeMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
|
||||
void sendAsyncMessage(/*in messageName, in JSON*/);
|
||||
[implicit_jscontext,optional_argc]
|
||||
void sendAsyncMessage([optional] in AString messageName, [optional] in jsval obj);
|
||||
};
|
||||
|
||||
[scriptable, uuid(cdb1a40b-9862-426c-ae8a-f5ab84e20e32)]
|
||||
[scriptable, uuid(21e5d940-d457-4c0f-bb5e-35c159ed19e3)]
|
||||
interface nsISyncMessageSender : nsIFrameMessageManager
|
||||
{
|
||||
/**
|
||||
* Returns an array of JSON objects.
|
||||
*/
|
||||
void sendSyncMessage(/*in messageName, in JSON*/);
|
||||
[implicit_jscontext,optional_argc]
|
||||
jsval sendSyncMessage([optional] in AString messageName, [optional] in jsval obj);
|
||||
};
|
||||
|
||||
[scriptable, uuid(6f23339f-2b5c-4f22-a03f-bb7ec101f83d)]
|
||||
[scriptable, uuid(78a1d024-60e3-4b7b-98cd-4c6b84b4f060)]
|
||||
interface nsIContentFrameMessageManager : nsISyncMessageSender
|
||||
{
|
||||
/**
|
||||
|
@ -112,20 +114,20 @@ interface nsIContentFrameMessageManager : nsISyncMessageSender
|
|||
DOMString btoa(in DOMString aBase64Data);
|
||||
};
|
||||
|
||||
[uuid(9c48d557-92fe-4edb-95fc-bfe97e77bdc3)]
|
||||
[uuid(1f7af930-a232-4a84-a049-73eaa45f2db5)]
|
||||
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
||||
{
|
||||
[notxpcom] nsIContent getOwnerContent();
|
||||
};
|
||||
|
||||
[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)]
|
||||
[scriptable, uuid(e91b0939-a74a-4c4f-8cfd-17dd42e8642a)]
|
||||
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
|
||||
{
|
||||
readonly attribute unsigned long childCount;
|
||||
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
|
||||
};
|
||||
|
||||
[scriptable, uuid(9e5c0526-aa4c-49f0-afbb-57f489cd9b59)]
|
||||
[scriptable, uuid(14e1f147-793d-4788-bbbb-ae806ecdddbb)]
|
||||
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1356,70 +1356,70 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
|
|||
bool aCanBePercent,
|
||||
bool* aIsPercent) const
|
||||
{
|
||||
*aStrict = PR_FALSE;
|
||||
*aStrict = true;
|
||||
*aErrorCode = NS_ERROR_ILLEGAL_VALUE;
|
||||
if (aCanBePercent) {
|
||||
*aIsPercent = PR_FALSE;
|
||||
*aIsPercent = false;
|
||||
}
|
||||
|
||||
nsAString::const_iterator iter, end;
|
||||
aValue.BeginReading(iter);
|
||||
aValue.EndReading(end);
|
||||
|
||||
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
|
||||
*aStrict = false;
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (iter == end) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool negate = false;
|
||||
if (*iter == PRUnichar('-')) {
|
||||
negate = true;
|
||||
++iter;
|
||||
} else if (*iter == PRUnichar('+')) {
|
||||
*aStrict = false;
|
||||
++iter;
|
||||
}
|
||||
|
||||
PRInt32 value = 0;
|
||||
if (iter != end) {
|
||||
if (*iter == PRUnichar('-')) {
|
||||
negate = PR_TRUE;
|
||||
PRInt32 pValue = 0; // Previous value, used to check integer overflow
|
||||
while (iter != end) {
|
||||
if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
|
||||
value = (value * 10) + (*iter - PRUnichar('0'));
|
||||
++iter;
|
||||
}
|
||||
if (iter != end) {
|
||||
if ((*iter >= PRUnichar('1') || (*iter == PRUnichar('0') && !negate)) &&
|
||||
*iter <= PRUnichar('9')) {
|
||||
value = *iter - PRUnichar('0');
|
||||
++iter;
|
||||
*aStrict = (value != 0 || iter == end ||
|
||||
(aCanBePercent && *iter == PRUnichar('%')));
|
||||
while (iter != end && *aStrict) {
|
||||
if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
|
||||
value = (value * 10) + (*iter - PRUnichar('0'));
|
||||
++iter;
|
||||
if (iter != end && value > ((PR_INT32_MAX / 10) - 9)) {
|
||||
*aStrict = PR_FALSE;
|
||||
}
|
||||
} else if (aCanBePercent && *iter == PRUnichar('%')) {
|
||||
++iter;
|
||||
if (iter == end) {
|
||||
*aIsPercent = PR_TRUE;
|
||||
} else {
|
||||
*aStrict = PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
*aStrict = PR_FALSE;
|
||||
}
|
||||
}
|
||||
if (*aStrict) {
|
||||
if (negate) {
|
||||
value = -value;
|
||||
}
|
||||
if (!aCanBePercent || !*aIsPercent) {
|
||||
*aErrorCode = NS_OK;
|
||||
#ifdef DEBUG
|
||||
nsAutoString stringValue;
|
||||
stringValue.AppendInt(value);
|
||||
if (aCanBePercent && *aIsPercent) {
|
||||
stringValue.AppendLiteral("%");
|
||||
}
|
||||
NS_ASSERTION(stringValue.Equals(aValue), "Wrong conversion!");
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
}
|
||||
// Checking for integer overflow.
|
||||
if (pValue > value) {
|
||||
*aStrict = false;
|
||||
*aErrorCode = NS_ERROR_ILLEGAL_VALUE;
|
||||
break;
|
||||
} else {
|
||||
pValue = value;
|
||||
*aErrorCode = NS_OK;
|
||||
}
|
||||
} else if (aCanBePercent && *iter == PRUnichar('%')) {
|
||||
++iter;
|
||||
*aIsPercent = true;
|
||||
if (iter != end) {
|
||||
*aStrict = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
*aStrict = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (negate) {
|
||||
value = -value;
|
||||
// Checking the special case of -0.
|
||||
if (!value) {
|
||||
*aStrict = false;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString tmp(aValue);
|
||||
return tmp.ToInteger(aErrorCode);
|
||||
return value;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
|
||||
* DOM3 stuff and some interfaces specified by WHATWG.
|
||||
* Implementation of nsIDOMDOMStringList, used by various DOM stuff.
|
||||
*/
|
||||
|
||||
#include "nsDOMLists.h"
|
||||
|
@ -95,92 +94,3 @@ nsDOMStringList::Contains(const nsAString& aString, bool *aResult)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsNameList::nsNameList()
|
||||
{
|
||||
}
|
||||
|
||||
nsNameList::~nsNameList()
|
||||
{
|
||||
}
|
||||
DOMCI_DATA(NameList, nsNameList)
|
||||
|
||||
NS_IMPL_ADDREF(nsNameList)
|
||||
NS_IMPL_RELEASE(nsNameList)
|
||||
NS_INTERFACE_TABLE_HEAD(nsNameList)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsNameList)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsNameList, nsIDOMNameList)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NameList)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNameList::GetName(PRUint32 aIndex, nsAString& aResult)
|
||||
{
|
||||
if (aIndex >= mNames.Length()) {
|
||||
SetDOMStringToNull(aResult);
|
||||
} else {
|
||||
aResult = mNames[aIndex];
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNameList::GetNamespaceURI(PRUint32 aIndex, nsAString& aResult)
|
||||
{
|
||||
if (aIndex >= mNames.Length()) {
|
||||
SetDOMStringToNull(aResult);
|
||||
} else {
|
||||
aResult = mNamespaceURIs[aIndex];
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNameList::GetLength(PRUint32 *aLength)
|
||||
{
|
||||
*aLength = mNames.Length();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsNameList::Add(const nsAString& aNamespaceURI, const nsAString& aName)
|
||||
{
|
||||
PRUint32 count = mNamespaceURIs.Length();
|
||||
if (mNamespaceURIs.InsertElementAt(count, aNamespaceURI)) {
|
||||
if (mNames.InsertElementAt(count, aName)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
mNamespaceURIs.RemoveElementAt(count);
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNameList::Contains(const nsAString& aName, bool *aResult)
|
||||
{
|
||||
*aResult = mNames.Contains(aName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNameList::ContainsNS(const nsAString& aNamespaceURI, const nsAString& aName,
|
||||
bool *aResult)
|
||||
{
|
||||
PRUint32 index = mNames.IndexOf(aName);
|
||||
if (index != mNames.NoIndex) {
|
||||
*aResult = mNamespaceURIs[index].Equals(aNamespaceURI);
|
||||
}
|
||||
else {
|
||||
*aResult = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -38,15 +38,13 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
|
||||
* DOM3 stuff and some interfaces specified by WHATWG.
|
||||
* Implementation of nsIDOMDOMStringList, used by various DOM stuff.
|
||||
*/
|
||||
|
||||
#ifndef nsDOMLists_h___
|
||||
#define nsDOMLists_h___
|
||||
|
||||
#include "nsIDOMDOMStringList.h"
|
||||
#include "nsIDOMNameList.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
@ -68,20 +66,4 @@ private:
|
|||
nsTArray<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___ */
|
||||
|
|
|
@ -4493,11 +4493,6 @@ nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
|
|||
{
|
||||
*aReturn = nsnull;
|
||||
|
||||
// There are no PIs for HTML
|
||||
if (IsHTML()) {
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -5893,23 +5888,6 @@ nsDocument::GetInputEncoding(nsAString& aInputEncoding)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetXmlEncoding(nsAString& aXmlEncoding)
|
||||
{
|
||||
WarnOnceAbout(eXmlEncoding);
|
||||
if (!IsHTML() &&
|
||||
mXMLDeclarationBits & XML_DECLARATION_BITS_DECLARATION_EXISTS &&
|
||||
mXMLDeclarationBits & XML_DECLARATION_BITS_ENCODING_EXISTS) {
|
||||
// XXX We don't store the encoding given in the xml declaration.
|
||||
// For now, just output the inputEncoding which we do store.
|
||||
GetInputEncoding(aXmlEncoding);
|
||||
} else {
|
||||
SetDOMStringToNull(aXmlEncoding);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetXmlStandalone(bool *aXmlStandalone)
|
||||
{
|
||||
|
@ -8467,114 +8445,114 @@ nsIDocument::SizeOf() const
|
|||
return size;
|
||||
}
|
||||
|
||||
// Returns the root document in a document hierarchy.
|
||||
static nsIDocument*
|
||||
GetRootDocument(nsIDocument* aDoc)
|
||||
{
|
||||
if (!aDoc) {
|
||||
return nsnull;
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> shell = aDoc->GetShell();
|
||||
if (!shell) {
|
||||
return nsnull;
|
||||
}
|
||||
nsPresContext* ctx = shell->GetPresContext();
|
||||
if (!ctx) {
|
||||
return nsnull;
|
||||
}
|
||||
nsRootPresContext* rpc = ctx->GetRootPresContext();
|
||||
if (!rpc) {
|
||||
return nsnull;
|
||||
}
|
||||
return rpc->Document();
|
||||
}
|
||||
|
||||
class nsDispatchFullScreenChange : public nsRunnable
|
||||
{
|
||||
public:
|
||||
nsDispatchFullScreenChange(nsIDocument *aDoc)
|
||||
: mDoc(aDoc)
|
||||
{
|
||||
mTarget = aDoc->GetFullScreenElement();
|
||||
if (!mTarget) {
|
||||
mTarget = aDoc;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsContentUtils::DispatchTrustedEvent(mDoc,
|
||||
mTarget,
|
||||
NS_LITERAL_STRING("mozfullscreenchange"),
|
||||
PR_TRUE,
|
||||
PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> mDoc;
|
||||
nsCOMPtr<nsISupports> mTarget;
|
||||
};
|
||||
|
||||
void
|
||||
nsDocument::UpdateFullScreenStatus(bool aIsFullScreen)
|
||||
{
|
||||
if (mIsFullScreen != aIsFullScreen) {
|
||||
nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this));
|
||||
NS_DispatchToCurrentThread(event);
|
||||
}
|
||||
mIsFullScreen = aIsFullScreen;
|
||||
if (!mIsFullScreen) {
|
||||
// Full-screen is being turned off. Reset the full-screen element, to
|
||||
// save us from having to traverse the document hierarchy again in
|
||||
// MozCancelFullScreen().
|
||||
ResetFullScreenElement();
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
UpdateFullScreenStatus(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData));
|
||||
aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen)
|
||||
{
|
||||
nsIDocument* root = GetRootDocument(aDoc);
|
||||
if (root) {
|
||||
UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ResetFullScreenElement()
|
||||
{
|
||||
// Returns the root document in a document hierarchy.
|
||||
static nsIDocument*
|
||||
GetRootDocument(nsIDocument* aDoc)
|
||||
{
|
||||
if (!aDoc) {
|
||||
return nsnull;
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> shell = aDoc->GetShell();
|
||||
if (!shell) {
|
||||
return nsnull;
|
||||
}
|
||||
nsPresContext* ctx = shell->GetPresContext();
|
||||
if (!ctx) {
|
||||
return nsnull;
|
||||
}
|
||||
nsRootPresContext* rpc = ctx->GetRootPresContext();
|
||||
if (!rpc) {
|
||||
return nsnull;
|
||||
}
|
||||
return rpc->Document();
|
||||
}
|
||||
|
||||
class nsDispatchFullScreenChange : public nsRunnable
|
||||
{
|
||||
public:
|
||||
nsDispatchFullScreenChange(nsIDocument *aDoc)
|
||||
: mDoc(aDoc)
|
||||
{
|
||||
mTarget = aDoc->GetFullScreenElement();
|
||||
if (!mTarget) {
|
||||
mTarget = aDoc;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsContentUtils::DispatchTrustedEvent(mDoc,
|
||||
mTarget,
|
||||
NS_LITERAL_STRING("mozfullscreenchange"),
|
||||
PR_TRUE,
|
||||
PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> mDoc;
|
||||
nsCOMPtr<nsISupports> mTarget;
|
||||
};
|
||||
|
||||
void
|
||||
nsDocument::UpdateFullScreenStatus(bool aIsFullScreen)
|
||||
{
|
||||
if (mIsFullScreen != aIsFullScreen) {
|
||||
nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this));
|
||||
NS_DispatchToCurrentThread(event);
|
||||
}
|
||||
mIsFullScreen = aIsFullScreen;
|
||||
if (!mIsFullScreen) {
|
||||
// Full-screen is being turned off. Reset the full-screen element, to
|
||||
// save us from having to traverse the document hierarchy again in
|
||||
// MozCancelFullScreen().
|
||||
ResetFullScreenElement();
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
UpdateFullScreenStatus(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData));
|
||||
aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen)
|
||||
{
|
||||
nsIDocument* root = GetRootDocument(aDoc);
|
||||
if (root) {
|
||||
UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ResetFullScreenElement()
|
||||
{
|
||||
if (mFullScreenElement) {
|
||||
nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_FALSE);
|
||||
}
|
||||
mFullScreenElement = nsnull;
|
||||
}
|
||||
|
||||
static bool
|
||||
ResetFullScreenElement(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
aDocument->ResetFullScreenElement();
|
||||
aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ResetFullScreenElementInDocTree(nsIDocument* aDoc)
|
||||
{
|
||||
nsIDocument* root = GetRootDocument(aDoc);
|
||||
if (root) {
|
||||
ResetFullScreenElement(root, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
}
|
||||
mFullScreenElement = nsnull;
|
||||
}
|
||||
|
||||
static bool
|
||||
ResetFullScreenElement(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
aDocument->ResetFullScreenElement();
|
||||
aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ResetFullScreenElementInDocTree(nsIDocument* aDoc)
|
||||
{
|
||||
nsIDocument* root = GetRootDocument(aDoc);
|
||||
if (root) {
|
||||
ResetFullScreenElement(root, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::MozCancelFullScreen()
|
||||
{
|
||||
if (!nsContentUtils::IsRequestFullScreenAllowed()) {
|
||||
|
@ -8582,104 +8560,104 @@ nsDocument::MozCancelFullScreen()
|
|||
}
|
||||
CancelFullScreen();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::CancelFullScreen()
|
||||
{
|
||||
if (!nsContentUtils::IsFullScreenApiEnabled() ||
|
||||
!IsFullScreenDoc() ||
|
||||
!GetWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable full-screen mode in all documents in this hierarchy.
|
||||
UpdateFullScreenStatusInDocTree(this, PR_FALSE);
|
||||
|
||||
// Move the window out of full-screen mode.
|
||||
GetWindow()->SetFullScreen(PR_FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::IsFullScreenDoc()
|
||||
{
|
||||
return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RequestFullScreen(Element* aElement)
|
||||
{
|
||||
if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset the full-screen elements of every document in this document
|
||||
// hierarchy.
|
||||
ResetFullScreenElementInDocTree(this);
|
||||
|
||||
if (aElement->IsInDoc()) {
|
||||
// Propagate up the document hierarchy, setting the full-screen element as
|
||||
// the element's container in ancestor documents. Note we don't propagate
|
||||
// down the document hierarchy, the full-screen element (or its container)
|
||||
// is not visible there.
|
||||
mFullScreenElement = aElement;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::CancelFullScreen()
|
||||
{
|
||||
if (!nsContentUtils::IsFullScreenApiEnabled() ||
|
||||
!IsFullScreenDoc() ||
|
||||
!GetWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable full-screen mode in all documents in this hierarchy.
|
||||
UpdateFullScreenStatusInDocTree(this, PR_FALSE);
|
||||
|
||||
// Move the window out of full-screen mode.
|
||||
GetWindow()->SetFullScreen(PR_FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::IsFullScreenDoc()
|
||||
{
|
||||
return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RequestFullScreen(Element* aElement)
|
||||
{
|
||||
if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset the full-screen elements of every document in this document
|
||||
// hierarchy.
|
||||
ResetFullScreenElementInDocTree(this);
|
||||
|
||||
if (aElement->IsInDoc()) {
|
||||
// Propagate up the document hierarchy, setting the full-screen element as
|
||||
// the element's container in ancestor documents. Note we don't propagate
|
||||
// down the document hierarchy, the full-screen element (or its container)
|
||||
// is not visible there.
|
||||
mFullScreenElement = aElement;
|
||||
// Set the full-screen state on the element, so the css-pseudo class
|
||||
// applies to the element.
|
||||
nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE);
|
||||
nsIDocument* child = this;
|
||||
nsIDocument* parent;
|
||||
while (parent = child->GetParentDocument()) {
|
||||
nsIContent* content = parent->FindContentForSubDocument(child);
|
||||
nsCOMPtr<Element> element(do_QueryInterface(content));
|
||||
nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE);
|
||||
nsIDocument* child = this;
|
||||
nsIDocument* parent;
|
||||
while (parent = child->GetParentDocument()) {
|
||||
nsIContent* content = parent->FindContentForSubDocument(child);
|
||||
nsCOMPtr<Element> element(do_QueryInterface(content));
|
||||
// Containing frames also need the css-pseudo class applied.
|
||||
nsEventStateManager::SetFullScreenState(element, PR_TRUE);
|
||||
static_cast<nsDocument*>(parent)->mFullScreenElement = element;
|
||||
child = parent;
|
||||
}
|
||||
}
|
||||
|
||||
// Set all documents in hierarchy to full-screen mode.
|
||||
UpdateFullScreenStatusInDocTree(this, PR_TRUE);
|
||||
|
||||
// Make the window full-screen. Note we must make the state changes above
|
||||
// before making the window full-screen, as then the document reports as
|
||||
// being in full-screen mode when the Chrome "fullscreen" event fires,
|
||||
// enabling browser.js to distinguish between browser and dom full-screen
|
||||
// modes.
|
||||
GetWindow()->SetFullScreen(PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFullScreenElement);
|
||||
if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) {
|
||||
*aFullScreenElement = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement()));
|
||||
NS_IF_ADDREF(*aFullScreenElement = e);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Element*
|
||||
nsDocument::GetFullScreenElement()
|
||||
{
|
||||
if (!nsContentUtils::IsFullScreenApiEnabled() ||
|
||||
(mFullScreenElement && !mFullScreenElement->IsInDoc())) {
|
||||
return nsnull;
|
||||
}
|
||||
return mFullScreenElement;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetMozFullScreen(bool *aFullScreen)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFullScreen);
|
||||
*aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc();
|
||||
return NS_OK;
|
||||
nsEventStateManager::SetFullScreenState(element, PR_TRUE);
|
||||
static_cast<nsDocument*>(parent)->mFullScreenElement = element;
|
||||
child = parent;
|
||||
}
|
||||
}
|
||||
|
||||
// Set all documents in hierarchy to full-screen mode.
|
||||
UpdateFullScreenStatusInDocTree(this, PR_TRUE);
|
||||
|
||||
// Make the window full-screen. Note we must make the state changes above
|
||||
// before making the window full-screen, as then the document reports as
|
||||
// being in full-screen mode when the Chrome "fullscreen" event fires,
|
||||
// enabling browser.js to distinguish between browser and dom full-screen
|
||||
// modes.
|
||||
GetWindow()->SetFullScreen(PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFullScreenElement);
|
||||
if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) {
|
||||
*aFullScreenElement = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement()));
|
||||
NS_IF_ADDREF(*aFullScreenElement = e);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Element*
|
||||
nsDocument::GetFullScreenElement()
|
||||
{
|
||||
if (!nsContentUtils::IsFullScreenApiEnabled() ||
|
||||
(mFullScreenElement && !mFullScreenElement->IsInDoc())) {
|
||||
return nsnull;
|
||||
}
|
||||
return mFullScreenElement;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetMozFullScreen(bool *aFullScreen)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFullScreen);
|
||||
*aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
|
|
|
@ -113,17 +113,17 @@
|
|||
#include "ContentParent.h"
|
||||
#include "TabParent.h"
|
||||
#include "mozilla/layout/RenderFrameParent.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::layout;
|
||||
typedef FrameMetrics::ViewID ViewID;
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsAsyncDocShellDestroyer : public nsRunnable
|
||||
{
|
||||
public:
|
||||
|
@ -315,7 +315,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
|
|||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated)
|
||||
nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
|
||||
: mOwnerContent(aOwner)
|
||||
, mDepthTooGreat(PR_FALSE)
|
||||
, mIsTopLevelContent(PR_FALSE)
|
||||
|
@ -336,7 +336,7 @@ nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated)
|
|||
}
|
||||
|
||||
nsFrameLoader*
|
||||
nsFrameLoader::Create(nsIContent* aOwner, bool aNetworkCreated)
|
||||
nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
|
||||
{
|
||||
NS_ENSURE_TRUE(aOwner, nsnull);
|
||||
nsIDocument* doc = aOwner->GetOwnerDoc();
|
||||
|
@ -962,8 +962,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
"Swapping some sort of random loaders?");
|
||||
NS_ENSURE_STATE(!mInShow && !aOther->mInShow);
|
||||
|
||||
nsIContent* ourContent = mOwnerContent;
|
||||
nsIContent* otherContent = aOther->mOwnerContent;
|
||||
Element* ourContent = mOwnerContent;
|
||||
Element* otherContent = aOther->mOwnerContent;
|
||||
|
||||
if (!ourContent || !otherContent) {
|
||||
// Can't handle this
|
||||
|
@ -1337,7 +1337,7 @@ nsFrameLoader::GetDepthTooGreat(bool* aDepthTooGreat)
|
|||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::SetOwnerContent(nsIContent* aContent)
|
||||
nsFrameLoader::SetOwnerContent(Element* aContent)
|
||||
{
|
||||
mOwnerContent = aContent;
|
||||
if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) {
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "Layers.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsSubDocumentFrame;
|
||||
|
@ -170,7 +170,7 @@ class nsFrameLoader : public nsIFrameLoader,
|
|||
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
|
||||
|
||||
protected:
|
||||
nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated);
|
||||
nsFrameLoader(mozilla::dom::Element* aOwner, bool aNetworkCreated);
|
||||
|
||||
public:
|
||||
~nsFrameLoader() {
|
||||
|
@ -186,7 +186,8 @@ public:
|
|||
return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL);
|
||||
}
|
||||
|
||||
static nsFrameLoader* Create(nsIContent* aOwner, bool aNetworkCreated);
|
||||
static nsFrameLoader* Create(mozilla::dom::Element* aOwner,
|
||||
bool aNetworkCreated);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
|
||||
|
@ -279,8 +280,8 @@ public:
|
|||
}
|
||||
nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
|
||||
|
||||
nsIContent* GetOwnerContent() { return mOwnerContent; }
|
||||
void SetOwnerContent(nsIContent* aContent);
|
||||
mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
|
||||
void SetOwnerContent(mozilla::dom::Element* aContent);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -313,7 +314,7 @@ private:
|
|||
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURIToLoad;
|
||||
nsIContent *mOwnerContent; // WEAK
|
||||
mozilla::dom::Element* mOwnerContent; // WEAK
|
||||
public:
|
||||
// public because a callback needs these.
|
||||
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 *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -15,11 +15,12 @@
|
|||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ms2ger <ms2ger@gmail.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
|
||||
|
@ -188,91 +189,60 @@ static JSBool
|
|||
JSONCreator(const jschar* aBuf, uint32 aLen, void* aData)
|
||||
{
|
||||
nsAString* result = static_cast<nsAString*>(aData);
|
||||
result->Append((PRUnichar*)aBuf, (PRUint32)aLen);
|
||||
return JS_TRUE;
|
||||
result->Append(static_cast<const PRUnichar*>(aBuf),
|
||||
static_cast<PRUint32>(aLen));
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameMessageManager::GetParamsForMessage(nsAString& aMessageName,
|
||||
void
|
||||
nsFrameMessageManager::GetParamsForMessage(const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
nsAString& aJSON)
|
||||
{
|
||||
aMessageName.Truncate();
|
||||
aJSON.Truncate();
|
||||
nsAXPCNativeCallContext* ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_STATE(ncc);
|
||||
|
||||
JSContext* ctx = nsnull;
|
||||
rv = ncc->GetJSContext(&ctx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint32 argc;
|
||||
jsval* argv = nsnull;
|
||||
ncc->GetArgc(&argc);
|
||||
ncc->GetArgvPtr(&argv);
|
||||
|
||||
JSAutoRequest ar(ctx);
|
||||
JSString* str;
|
||||
if (argc && (str = JS_ValueToString(ctx, argv[0])) && str) {
|
||||
nsDependentJSString depStr;
|
||||
if (!depStr.init(ctx, str)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aMessageName.Assign(depStr);
|
||||
}
|
||||
|
||||
if (argc >= 2) {
|
||||
jsval v = argv[1];
|
||||
JS_Stringify(ctx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
|
||||
}
|
||||
return NS_OK;
|
||||
JSAutoRequest ar(aCx);
|
||||
jsval v = aObject;
|
||||
JS_Stringify(aCx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendSyncMessage()
|
||||
nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
PRUint8 aArgc,
|
||||
jsval* aRetval)
|
||||
{
|
||||
NS_ASSERTION(!IsGlobal(), "Should not call SendSyncMessage in chrome");
|
||||
NS_ASSERTION(!IsWindowLevel(), "Should not call SendSyncMessage in chrome");
|
||||
NS_ASSERTION(!mParentManager, "Should not have parent manager in content!");
|
||||
*aRetval = JSVAL_VOID;
|
||||
if (mSyncCallback) {
|
||||
NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
|
||||
nsString messageName;
|
||||
nsString json;
|
||||
nsresult rv = GetParamsForMessage(messageName, json);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (aArgc >= 2) {
|
||||
GetParamsForMessage(aObject, aCx, json);
|
||||
}
|
||||
InfallibleTArray<nsString> retval;
|
||||
if (mSyncCallback(mCallbackData, messageName, json, &retval)) {
|
||||
nsAXPCNativeCallContext* ncc = nsnull;
|
||||
rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_STATE(ncc);
|
||||
|
||||
JSContext* ctx = nsnull;
|
||||
rv = ncc->GetJSContext(&ctx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JSAutoRequest ar(ctx);
|
||||
|
||||
if (mSyncCallback(mCallbackData, aMessageName, json, &retval)) {
|
||||
JSAutoRequest ar(aCx);
|
||||
PRUint32 len = retval.Length();
|
||||
JSObject* dataArray = JS_NewArrayObject(ctx, len, NULL);
|
||||
JSObject* dataArray = JS_NewArrayObject(aCx, len, NULL);
|
||||
NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
for (PRUint32 i = 0; i < len; ++i) {
|
||||
if (retval[i].IsEmpty())
|
||||
if (retval[i].IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
jsval ret = JSVAL_VOID;
|
||||
if (!JS_ParseJSON(ctx, (jschar*)retval[i].get(),
|
||||
(uint32)retval[i].Length(), &ret)) {
|
||||
if (!JS_ParseJSON(aCx, static_cast<const jschar*>(retval[i].get()),
|
||||
retval[i].Length(), &ret)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
NS_ENSURE_TRUE(JS_SetElement(ctx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(JS_SetElement(aCx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
jsval* retvalPtr;
|
||||
ncc->GetRetValPtr(&retvalPtr);
|
||||
*retvalPtr = OBJECT_TO_JSVAL(dataArray);
|
||||
ncc->SetReturnValueWasSet(PR_TRUE);
|
||||
*aRetval = OBJECT_TO_JSVAL(dataArray);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -295,13 +265,16 @@ nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendAsyncMessage()
|
||||
nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
PRUint8 aArgc)
|
||||
{
|
||||
nsString messageName;
|
||||
nsString json;
|
||||
nsresult rv = GetParamsForMessage(messageName, json);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return SendAsyncMessageInternal(messageName, json);
|
||||
if (aArgc >= 2) {
|
||||
GetParamsForMessage(aObject, aCx, json);
|
||||
}
|
||||
return SendAsyncMessageInternal(aMessageName, json);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -428,14 +401,14 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
|
||||
jsval json = JSVAL_NULL;
|
||||
if (!aJSON.IsEmpty()) {
|
||||
if (!JS_ParseJSON(ctx, (jschar*)nsString(aJSON).get(),
|
||||
(uint32)aJSON.Length(), &json)) {
|
||||
if (!JS_ParseJSON(ctx, static_cast<const jschar*>(PromiseFlatString(aJSON).get()),
|
||||
aJSON.Length(), &json)) {
|
||||
json = JSVAL_NULL;
|
||||
}
|
||||
}
|
||||
JSString* jsMessage =
|
||||
JS_NewUCStringCopyN(ctx,
|
||||
reinterpret_cast<const jschar *>(nsString(aMessage).get()),
|
||||
static_cast<const jschar*>(PromiseFlatString(aMessage).get()),
|
||||
aMessage.Length());
|
||||
NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY);
|
||||
JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE);
|
||||
|
|
|
@ -150,7 +150,9 @@ public:
|
|||
|
||||
void Disconnect(bool aRemoveFromParent = true);
|
||||
void SetCallbackData(void* aData, bool aLoadScripts = true);
|
||||
nsresult GetParamsForMessage(nsAString& aMessageName, nsAString& aJSON);
|
||||
void GetParamsForMessage(const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
nsAString& aJSON);
|
||||
nsresult SendAsyncMessageInternal(const nsAString& aMessage,
|
||||
const nsAString& aJSON);
|
||||
JSContext* GetJSContext() { return mContext; }
|
||||
|
|
|
@ -840,81 +840,6 @@ nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMDataNode::ReplaceWholeText(const nsAString& aContent,
|
||||
nsIDOMText **aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
GetOwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceWholeText);
|
||||
|
||||
// Handle parent-less nodes
|
||||
nsCOMPtr<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
|
||||
|
|
|
@ -330,8 +330,6 @@ protected:
|
|||
|
||||
nsresult GetWholeText(nsAString& aWholeText);
|
||||
|
||||
nsresult ReplaceWholeText(const nsAString& aContent, nsIDOMText **aReturn);
|
||||
|
||||
nsresult GetIsElementContentWhitespace(bool *aReturn)
|
||||
{
|
||||
GetOwnerDoc()->WarnOnceAbout(nsIDocument::eIsElementContentWhitespace);
|
||||
|
|
|
@ -66,10 +66,15 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage()
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
PRUint8 aArgc,
|
||||
jsval* aRetval)
|
||||
{
|
||||
return mMessageManager ? mMessageManager->SendSyncMessage()
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
return mMessageManager
|
||||
? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_IMETHOD GetContent(nsIDOMWindow** aContent);
|
||||
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
|
||||
|
|
|
@ -166,7 +166,7 @@ nsAsyncInstantiateEvent::Run()
|
|||
|
||||
nsresult rv = mContent->Instantiate(frame, mContentType, mURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
mContent->Fallback(true);
|
||||
mContent->Fallback(PR_TRUE);
|
||||
}
|
||||
} else {
|
||||
LOG(("OBJLC [%p]: Discarding event, data changed\n", mContent));
|
||||
|
@ -216,7 +216,7 @@ nsPluginErrorEvent::Run()
|
|||
return NS_OK;
|
||||
}
|
||||
nsContentUtils::DispatchTrustedEvent(mContent->GetDocument(), mContent,
|
||||
type, true, true);
|
||||
type, PR_TRUE, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -275,8 +275,8 @@ nsPluginCrashedEvent::Run()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), true, true);
|
||||
privateEvent->SetTrusted(true);
|
||||
event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), PR_TRUE, PR_TRUE);
|
||||
privateEvent->SetTrusted(PR_TRUE);
|
||||
privateEvent->GetInternalNSEvent()->flags |= NS_EVENT_FLAG_ONLY_CHROME_DISPATCH;
|
||||
|
||||
nsCOMPtr<nsIWritableVariant> variant;
|
||||
|
@ -338,7 +338,7 @@ class AutoNotifier {
|
|||
mOldState = aContent->ObjectState();
|
||||
}
|
||||
~AutoNotifier() {
|
||||
mContent->NotifyStateChanged(mOldType, mOldState, false, mNotify);
|
||||
mContent->NotifyStateChanged(mOldType, mOldState, PR_FALSE, mNotify);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -349,7 +349,7 @@ class AutoNotifier {
|
|||
void Notify() {
|
||||
NS_ASSERTION(mNotify, "Should not notify when notify=false");
|
||||
|
||||
mContent->NotifyStateChanged(mOldType, mOldState, true, true);
|
||||
mContent->NotifyStateChanged(mOldType, mOldState, PR_TRUE, PR_TRUE);
|
||||
mOldType = mContent->Type();
|
||||
mOldState = mContent->ObjectState();
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ class AutoFallback {
|
|||
~AutoFallback() {
|
||||
if (NS_FAILED(*mResult)) {
|
||||
LOG(("OBJLC [%p]: rv=%08x, falling back\n", mContent, *mResult));
|
||||
mContent->Fallback(false);
|
||||
mContent->Fallback(PR_FALSE);
|
||||
if (mPluginState != ePluginOtherState) {
|
||||
mContent->mFallbackReason = mPluginState;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ class AutoFallback {
|
|||
class AutoSetInstantiatingToFalse {
|
||||
public:
|
||||
AutoSetInstantiatingToFalse(nsObjectLoadingContent* objlc) : mContent(objlc) {}
|
||||
~AutoSetInstantiatingToFalse() { mContent->mInstantiating = false; }
|
||||
~AutoSetInstantiatingToFalse() { mContent->mInstantiating = PR_FALSE; }
|
||||
private:
|
||||
nsObjectLoadingContent* mContent;
|
||||
};
|
||||
|
@ -411,7 +411,7 @@ IsSupportedImage(const nsCString& aMimeType)
|
|||
{
|
||||
imgILoader* loader = nsContentUtils::GetImgLoader();
|
||||
if (!loader) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
bool supported;
|
||||
|
@ -425,7 +425,7 @@ IsSupportedPlugin(const nsCString& aMIMEType)
|
|||
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
|
||||
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
|
||||
if (!pluginHost) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsresult rv = pluginHost->IsPluginEnabledForType(aMIMEType.get());
|
||||
return NS_SUCCEEDED(rv);
|
||||
|
@ -459,31 +459,31 @@ IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType)
|
|||
GetExtensionFromURI(uri, ext);
|
||||
|
||||
if (ext.IsEmpty()) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
|
||||
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
|
||||
if (!pluginHost) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
const char* typeFromExt;
|
||||
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt))) {
|
||||
mimeType = typeFromExt;
|
||||
return true;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsObjectLoadingContent::nsObjectLoadingContent()
|
||||
: mPendingInstantiateEvent(nsnull)
|
||||
, mChannel(nsnull)
|
||||
, mType(eType_Loading)
|
||||
, mInstantiating(false)
|
||||
, mUserDisabled(false)
|
||||
, mSuppressed(false)
|
||||
, mNetworkCreated(true)
|
||||
, mInstantiating(PR_FALSE)
|
||||
, mUserDisabled(PR_FALSE)
|
||||
, mSuppressed(PR_FALSE)
|
||||
, mNetworkCreated(PR_TRUE)
|
||||
, mFallbackReason(ePluginOtherState)
|
||||
{
|
||||
}
|
||||
|
@ -507,11 +507,11 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
AutoNotifier notifier(this, true);
|
||||
AutoNotifier notifier(this, PR_TRUE);
|
||||
|
||||
if (!IsSuccessfulRequest(aRequest)) {
|
||||
LOG(("OBJLC [%p]: OnStartRequest: Request failed\n", this));
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
|
||||
nsIDocument* doc = thisContent->GetOwnerDoc();
|
||||
if (!doc) {
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
|
@ -638,16 +638,17 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
break;
|
||||
case eType_Document: {
|
||||
if (!mFrameLoader) {
|
||||
mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated);
|
||||
mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
|
||||
mNetworkCreated);
|
||||
if (!mFrameLoader) {
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
rv = mFrameLoader->CheckForRecursiveLoad(uri);
|
||||
if (NS_FAILED(rv)) {
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -687,7 +688,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
break;
|
||||
}
|
||||
case eType_Plugin:
|
||||
mInstantiating = true;
|
||||
mInstantiating = PR_TRUE;
|
||||
if (mType != newType) {
|
||||
// This can go away once plugin loading moves to content (bug 90268)
|
||||
mType = newType;
|
||||
|
@ -699,7 +700,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
// Do nothing in this case: This is probably due to a display:none
|
||||
// frame. If we ever get a frame, HasNewFrame will do the right thing.
|
||||
// Abort the load though, we have no use for the data.
|
||||
mInstantiating = false;
|
||||
mInstantiating = PR_FALSE;
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
|
@ -710,7 +711,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
|
||||
rv = frame->Instantiate(chan, getter_AddRefs(mFinalListener));
|
||||
|
||||
mInstantiating = false;
|
||||
mInstantiating = PR_FALSE;
|
||||
|
||||
if (!weakFrame.IsAlive()) {
|
||||
// The frame was destroyed while instantiating. Abort the load.
|
||||
|
@ -726,7 +727,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
// Need to fallback here (instead of using the case below), so that we can
|
||||
// set mFallbackReason without it being overwritten. This is also why we
|
||||
// return early.
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
|
||||
PluginSupportState pluginState = GetPluginSupportState(thisContent,
|
||||
mContentType);
|
||||
|
@ -753,7 +754,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
#endif
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
} else if (mType == eType_Plugin) {
|
||||
nsIObjectFrame* frame = GetExistingFrame(eFlushContent);
|
||||
if (frame) {
|
||||
|
@ -767,7 +768,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
}
|
||||
|
||||
LOG(("OBJLC [%p]: Found no listener, falling back\n", this));
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
|
@ -874,7 +875,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance)
|
|||
}
|
||||
|
||||
// Trigger frame construction
|
||||
mInstantiating = true;
|
||||
mInstantiating = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
|
@ -883,13 +884,13 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance)
|
|||
nsIDocument* doc = thisContent->GetCurrentDoc();
|
||||
if (!doc) {
|
||||
// Nothing we can do while plugin loading is done in layout...
|
||||
mInstantiating = false;
|
||||
mInstantiating = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
doc->FlushPendingNotifications(Flush_Frames);
|
||||
|
||||
mInstantiating = false;
|
||||
mInstantiating = PR_FALSE;
|
||||
|
||||
frame = GetExistingFrame(eFlushContent);
|
||||
if (!frame) {
|
||||
|
@ -922,7 +923,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance)
|
|||
if (NS_SUCCEEDED(rv) && weakFrame.IsAlive()) {
|
||||
rv = frame->GetPluginInstance(aInstance);
|
||||
} else {
|
||||
Fallback(true);
|
||||
Fallback(PR_TRUE);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
@ -1173,10 +1174,10 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
|||
// the AutoNotifier triggers frame construction, events can be posted as
|
||||
// appropriate.
|
||||
NS_ASSERTION(!mInstantiating, "LoadObject was reentered?");
|
||||
mInstantiating = true;
|
||||
mInstantiating = PR_TRUE;
|
||||
AutoSetInstantiatingToFalse autoset(this);
|
||||
|
||||
mUserDisabled = mSuppressed = false;
|
||||
mUserDisabled = mSuppressed = PR_FALSE;
|
||||
|
||||
mURI = aURI;
|
||||
mContentType = aTypeHint;
|
||||
|
@ -1213,7 +1214,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
|||
// Security checks
|
||||
if (doc->IsLoadedAsData()) {
|
||||
if (!doc->IsStaticDocument()) {
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1228,7 +1229,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
|||
nsresult rv =
|
||||
secMan->CheckLoadURIWithPrincipal(thisContent->NodePrincipal(), aURI, 0);
|
||||
if (NS_FAILED(rv)) {
|
||||
Fallback(false);
|
||||
Fallback(PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1277,7 +1278,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
|||
// Must have a frameloader before creating a frame, or the frame will
|
||||
// create its own.
|
||||
if (!mFrameLoader && newType == eType_Document) {
|
||||
mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated);
|
||||
mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
|
||||
mNetworkCreated);
|
||||
if (!mFrameLoader) {
|
||||
mURI = nsnull;
|
||||
return NS_OK;
|
||||
|
@ -1296,7 +1298,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
|||
case eType_Image:
|
||||
// Don't notify, because we will take care of that ourselves.
|
||||
if (aURI) {
|
||||
rv = LoadImage(aURI, aForceLoad, false);
|
||||
rv = LoadImage(aURI, aForceLoad, PR_FALSE);
|
||||
} else {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
@ -1324,13 +1326,13 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
|||
// If the class ID specifies a supported plugin, or if we have no explicit URI
|
||||
// but a type, immediately instantiate the plugin.
|
||||
bool isSupportedClassID = false;
|
||||
nsCAutoString typeForID; // Will be set iff isSupportedClassID == true
|
||||
nsCAutoString typeForID; // Will be set iff isSupportedClassID == PR_TRUE
|
||||
bool hasID = false;
|
||||
if (caps & eSupportClassID) {
|
||||
nsAutoString classid;
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classid);
|
||||
if (!classid.IsEmpty()) {
|
||||
hasID = true;
|
||||
hasID = PR_TRUE;
|
||||
isSupportedClassID = NS_SUCCEEDED(TypeForClassID(classid, typeForID));
|
||||
}
|
||||
}
|
||||
|
@ -1444,7 +1446,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
|||
|
||||
// Set up the channel's principal and such, like nsDocShell::DoURILoad does
|
||||
nsContentUtils::SetUpChannelOwner(thisContent->NodePrincipal(),
|
||||
chan, aURI, true);
|
||||
chan, aURI, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(chan);
|
||||
if (scriptChannel) {
|
||||
|
@ -1515,7 +1517,7 @@ nsObjectLoadingContent::IsSuccessfulRequest(nsIRequest* aRequest)
|
|||
nsresult status;
|
||||
nsresult rv = aRequest->GetStatus(&status);
|
||||
if (NS_FAILED(rv) || NS_FAILED(status)) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// This may still be an error page or somesuch
|
||||
|
@ -1524,12 +1526,12 @@ nsObjectLoadingContent::IsSuccessfulRequest(nsIRequest* aRequest)
|
|||
bool success;
|
||||
rv = httpChan->GetRequestSucceeded(&success);
|
||||
if (NS_FAILED(rv) || !success) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, the request is successful
|
||||
return true;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
|
@ -1537,17 +1539,17 @@ nsObjectLoadingContent::CanHandleURI(nsIURI* aURI)
|
|||
{
|
||||
nsCAutoString scheme;
|
||||
if (NS_FAILED(aURI->GetScheme(scheme))) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIIOService* ios = nsContentUtils::GetIOService();
|
||||
if (!ios)
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
ios->GetProtocolHandler(scheme.get(), getter_AddRefs(handler));
|
||||
if (!handler) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIExternalProtocolHandler> extHandler =
|
||||
|
@ -1596,20 +1598,20 @@ nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType)
|
|||
return supported != nsIWebNavigationInfo::PLUGIN;
|
||||
}
|
||||
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsObjectLoadingContent::UnloadContent()
|
||||
{
|
||||
// Don't notify in CancelImageRequests. We do it ourselves.
|
||||
CancelImageRequests(false);
|
||||
CancelImageRequests(PR_FALSE);
|
||||
if (mFrameLoader) {
|
||||
mFrameLoader->Destroy();
|
||||
mFrameLoader = nsnull;
|
||||
}
|
||||
mType = eType_Null;
|
||||
mUserDisabled = mSuppressed = false;
|
||||
mUserDisabled = mSuppressed = PR_FALSE;
|
||||
mFallbackReason = ePluginOtherState;
|
||||
}
|
||||
|
||||
|
@ -1804,9 +1806,9 @@ nsObjectLoadingContent::HandleBeingBlockedByContentPolicy(nsresult aStatus,
|
|||
UnloadContent();
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
if (aRetval == nsIContentPolicy::REJECT_TYPE) {
|
||||
mUserDisabled = true;
|
||||
mUserDisabled = PR_TRUE;
|
||||
} else if (aRetval == nsIContentPolicy::REJECT_SERVER) {
|
||||
mSuppressed = true;
|
||||
mSuppressed = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1856,7 +1858,7 @@ nsObjectLoadingContent::Instantiate(nsIObjectFrame* aFrame,
|
|||
// Mark that we're instantiating now so that we don't end up
|
||||
// re-entering instantiation code.
|
||||
bool oldInstantiatingValue = mInstantiating;
|
||||
mInstantiating = true;
|
||||
mInstantiating = PR_TRUE;
|
||||
|
||||
nsCString typeToUse(aMIMEType);
|
||||
if (typeToUse.IsEmpty() && aURI) {
|
||||
|
@ -1936,7 +1938,7 @@ nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
|
|||
}
|
||||
} else if (!hasAlternateContent) {
|
||||
hasAlternateContent =
|
||||
nsStyleUtil::IsSignificantChild(child, true, false);
|
||||
nsStyleUtil::IsSignificantChild(child, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1979,8 +1981,8 @@ nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const
|
|||
|
||||
if (mFrameLoader) {
|
||||
nsCOMPtr<nsIContent> content =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>((aDest)));
|
||||
nsFrameLoader* fl = nsFrameLoader::Create(content, false);
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(aDest));
|
||||
nsFrameLoader* fl = nsFrameLoader::Create(content->AsElement(), PR_FALSE);
|
||||
if (fl) {
|
||||
aDest->mFrameLoader = fl;
|
||||
mFrameLoader->CreateStaticClone(fl);
|
||||
|
@ -2001,7 +2003,7 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag,
|
|||
const nsAString& browserDumpID,
|
||||
bool submittedCrashReport)
|
||||
{
|
||||
AutoNotifier notifier(this, true);
|
||||
AutoNotifier notifier(this, PR_TRUE);
|
||||
UnloadContent();
|
||||
mFallbackReason = ePluginCrashed;
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
|
|
|
@ -1401,10 +1401,7 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
|
|||
|
||||
if (aUseLSEventWrapper) {
|
||||
nsCOMPtr<nsIDOMProgressEvent> xhrprogressEvent =
|
||||
new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize);
|
||||
if (!xhrprogressEvent) {
|
||||
return;
|
||||
}
|
||||
new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize, mOwner);
|
||||
event = xhrprogressEvent;
|
||||
}
|
||||
aTarget->DispatchDOMEvent(nsnull, event, nsnull, nsnull);
|
||||
|
@ -3240,7 +3237,9 @@ nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
|
|||
// DOM event class to handle progress notifications
|
||||
nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
|
||||
PRUint64 aCurrentProgress,
|
||||
PRUint64 aMaxProgress)
|
||||
PRUint64 aMaxProgress,
|
||||
nsPIDOMWindow* aWindow)
|
||||
: mWindow(aWindow)
|
||||
{
|
||||
mInner = static_cast<nsDOMProgressEvent*>(aInner);
|
||||
mCurProgress = aCurrentProgress;
|
||||
|
@ -3270,11 +3269,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXMLHttpProgressEvent)
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInner);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mWindow);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mInner,
|
||||
nsIDOMProgressEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mWindow);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
|
||||
|
@ -3283,8 +3284,23 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpProgressEvent::WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations aOperation)
|
||||
{
|
||||
if (!mWindow) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> document =
|
||||
do_QueryInterface(mWindow->GetExtantDocument());
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
document->WarnOnceAbout(aOperation);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition)
|
||||
{
|
||||
WarnAboutLSProgressEvent(nsIDocument::ePosition);
|
||||
// XXX can we change the iface?
|
||||
LL_L2UI(*aPosition, mCurProgress);
|
||||
return NS_OK;
|
||||
|
@ -3292,8 +3308,8 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition)
|
|||
|
||||
NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(PRUint32 *aTotalSize)
|
||||
{
|
||||
WarnAboutLSProgressEvent(nsIDocument::eTotalSize);
|
||||
// XXX can we change the iface?
|
||||
LL_L2UI(*aTotalSize, mMaxProgress);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -380,7 +380,8 @@ class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
|
|||
public:
|
||||
nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
|
||||
PRUint64 aCurrentProgress,
|
||||
PRUint64 aMaxProgress);
|
||||
PRUint64 aMaxProgress,
|
||||
nsPIDOMWindow* aWindow);
|
||||
virtual ~nsXMLHttpProgressEvent();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
@ -421,9 +422,12 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations);
|
||||
|
||||
// Use nsDOMProgressEvent so that we can forward
|
||||
// most of the method calls easily.
|
||||
nsRefPtr<nsDOMProgressEvent> mInner;
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
PRUint64 mCurProgress;
|
||||
PRUint64 mMaxProgress;
|
||||
};
|
||||
|
|
|
@ -231,7 +231,6 @@ _TEST_FILES1 = \
|
|||
test_bug438519.html \
|
||||
test_bug444722.html \
|
||||
test_bug451376.html \
|
||||
test_text_replaceWholeText.html \
|
||||
test_text_wholeText.html \
|
||||
test_bug433533.html \
|
||||
wholeTexty-helper.xml \
|
||||
|
|
|
@ -87,10 +87,32 @@ function testPI(aTarget, aData, aShouldSucceed, aReason)
|
|||
{
|
||||
try {
|
||||
var pi = document.createProcessingInstruction(aTarget, aData);
|
||||
ok(0, "Invalid processing instruction creation",
|
||||
"Shouldn't create processing instructions in HTML");
|
||||
var types = [ ProcessingInstruction, Node ];
|
||||
checkTypes(pi, "processing instruction", types);
|
||||
|
||||
var interfaces = [ "nsIDOMProcessingInstruction", "nsIDOMNode",
|
||||
"nsIDOMEventTarget" ];
|
||||
checkInterfaces(pi, "processing instruction", interfaces);
|
||||
|
||||
is(pi.target, aTarget, "Check target");
|
||||
is(pi.data, aData, "Check data");
|
||||
is(pi.nodeName, aTarget, "Check nodeName");
|
||||
is(pi.nodeValue, aData, "Check nodeValue");
|
||||
is(pi.localName, null, "Check localName")
|
||||
is(pi.namespaceURI, null, "Check namespaceURI");
|
||||
|
||||
is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType");
|
||||
|
||||
if (!aShouldSucceed) {
|
||||
ok(false, "Invalid processing instruction creation", aReason);
|
||||
}
|
||||
} catch (e) {
|
||||
is(e.code, DOMException.NOT_SUPPORTED_ERR, "Check exception code");
|
||||
if (aShouldSucceed) {
|
||||
ok(false, "Correct functioning of processing instruction stuff",
|
||||
"something broke: " + e);
|
||||
} else {
|
||||
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,32 +59,31 @@ function xhrDoc(idx) {
|
|||
}
|
||||
|
||||
// Each row has the document getter function, then the characterSet,
|
||||
// inputEncoding, xmlEncoding expected for that document.
|
||||
// inputEncoding expected for that document.
|
||||
|
||||
var tests = [
|
||||
[ frameDoc("one"), "ISO-8859-1", "ISO-8859-1", null ],
|
||||
[ frameDoc("two"), "UTF-8", "UTF-8", null ],
|
||||
[ frameDoc("three"), "ISO-8859-1", "ISO-8859-1", null ],
|
||||
[ frameDoc("four"), "UTF-8", "UTF-8", null ],
|
||||
[ frameDoc("five"), "UTF-8", "UTF-8", null ],
|
||||
[ frameDoc("six"), "UTF-8", "UTF-8", "UTF-8"],
|
||||
[ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],
|
||||
[ createDoc, "UTF-8", null, null ],
|
||||
[ xhrDoc(4), "UTF-8", "UTF-8", null ],
|
||||
[ xhrDoc(5), "UTF-8", "UTF-8", "UTF-8" ],
|
||||
[ xhrDoc(6), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],
|
||||
[ frameDoc("one"), "ISO-8859-1", "ISO-8859-1" ],
|
||||
[ frameDoc("two"), "UTF-8", "UTF-8" ],
|
||||
[ frameDoc("three"), "ISO-8859-1", "ISO-8859-1" ],
|
||||
[ frameDoc("four"), "UTF-8", "UTF-8" ],
|
||||
[ frameDoc("five"), "UTF-8", "UTF-8" ],
|
||||
[ frameDoc("six"), "UTF-8", "UTF-8" ],
|
||||
[ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1" ],
|
||||
[ createDoc, "UTF-8", null ],
|
||||
[ xhrDoc(4), "UTF-8", "UTF-8" ],
|
||||
[ xhrDoc(5), "UTF-8", "UTF-8" ],
|
||||
[ xhrDoc(6), "ISO-8859-1", "ISO-8859-1" ],
|
||||
];
|
||||
|
||||
function doTest(idx) {
|
||||
var [docGetter, expectedCharacterSet,
|
||||
expectedInputEncoding, expectedXMLEncoding] = tests[idx];
|
||||
expectedInputEncoding] = tests[idx];
|
||||
var doc = docGetter();
|
||||
|
||||
// Have to be careful here to catch null vs ""
|
||||
is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet");
|
||||
is(doc.inputEncoding, expectedInputEncoding,
|
||||
"Test " + idx + " inputEncoding");
|
||||
is(doc.xmlEncoding, expectedXMLEncoding, "Test " + idx + " xmlEncoding");
|
||||
}
|
||||
|
||||
addLoadEvent(function() {
|
||||
|
|
|
@ -35,15 +35,6 @@ function doTest() {
|
|||
}
|
||||
ok(hadException,
|
||||
"Should have got an exception when using .wholeText with a text node child of the binding parent");
|
||||
|
||||
hadException = false;
|
||||
try {
|
||||
anonTextNode.replaceWholeText("foobar");
|
||||
} catch(e) {
|
||||
hadException = true;
|
||||
}
|
||||
ok(hadException,
|
||||
"Should have got an exception when using .replaceWholeText with a text node child of the binding parent");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ctx = canvas.getContext('2d');
|
||||
|
||||
todo(canvas.width == 100, "canvas.width == 100");
|
||||
is(canvas.width, 100, "canvas.width == 100");
|
||||
|
||||
|
||||
}
|
||||
|
@ -20400,7 +20400,7 @@ var canvas = document.getElementById('c648');
|
|||
var ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.setAttribute('width', '100foo');
|
||||
todo(canvas.width == 100, "canvas.width == 100");
|
||||
is(canvas.width, 100, "canvas.width == 100");
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -209,22 +209,6 @@ check();
|
|||
is(children.length, 0, "should have received DOMNodeRemoved for all frag children when appending");
|
||||
is(frag.childNodes.length, 0, "fragment should be empty when appending");
|
||||
|
||||
testName = "prepare replaceWholeText";
|
||||
var textNode;
|
||||
root.appendChild(document.createTextNode("hello"));
|
||||
root.appendChild(document.createTextNode(""));
|
||||
root.appendChild(textNode = document.createTextNode("world"));
|
||||
root.appendChild(document.createTextNode("fahrvergnugen"));
|
||||
root.appendChild(document.createTextNode(""));
|
||||
root.appendChild(document.createElement("div"));
|
||||
root.appendChild(document.createTextNode("smorgasbord"));
|
||||
root.appendChild(document.createTextNode(""));
|
||||
check();
|
||||
|
||||
testName = "run replaceWholeText";
|
||||
textNode.replaceWholeText("supercalifragilisticexpialidocious");
|
||||
check();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -68,8 +68,6 @@ public:
|
|||
TableRowsCollection(nsHTMLTableElement *aParent);
|
||||
virtual ~TableRowsCollection();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||
|
||||
|
@ -83,13 +81,18 @@ public:
|
|||
|
||||
protected:
|
||||
// Those rows that are not in table sections
|
||||
nsHTMLTableElement* mParent;
|
||||
nsRefPtr<nsContentList> mOrphanRows;
|
||||
nsHTMLTableElement * mParent;
|
||||
};
|
||||
|
||||
|
||||
TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent)
|
||||
: mParent(aParent)
|
||||
, mOrphanRows(new nsContentList(mParent,
|
||||
mParent->NodeInfo()->NamespaceID(),
|
||||
nsGkAtoms::tr,
|
||||
nsGkAtoms::tr,
|
||||
PR_FALSE))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -118,17 +121,6 @@ NS_INTERFACE_TABLE_HEAD(TableRowsCollection)
|
|||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLCollection)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsresult
|
||||
TableRowsCollection::Init()
|
||||
{
|
||||
mOrphanRows = new nsContentList(mParent,
|
||||
mParent->NodeInfo()->NamespaceID(),
|
||||
nsGkAtoms::tr,
|
||||
nsGkAtoms::tr,
|
||||
PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Macro that can be used to avoid copy/pasting code to iterate over the
|
||||
// rowgroups. _code should be the code to execute for each rowgroup. The
|
||||
// rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows". Note
|
||||
|
@ -499,15 +491,7 @@ NS_IMETHODIMP
|
|||
nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue)
|
||||
{
|
||||
if (!mRows) {
|
||||
// XXX why was this here NS_ADDREF(nsGkAtoms::tr);
|
||||
mRows = new TableRowsCollection(this);
|
||||
NS_ENSURE_TRUE(mRows, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = mRows->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
mRows = nsnull;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
*aValue = mRows;
|
||||
|
|
|
@ -462,11 +462,6 @@ function reflectBoolean(aParameters)
|
|||
*/
|
||||
function reflectInt(aParameters)
|
||||
{
|
||||
//TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr]
|
||||
function testExponential(value) {
|
||||
return !!/^[ \t\n\f\r]*[\+\-]?[0-9]+e[0-9]+/.exec(value);
|
||||
}
|
||||
|
||||
// Expected value returned by .getAttribute() when |value| has been previously passed to .setAttribute().
|
||||
function expectedGetAttributeResult(value) {
|
||||
return (value !== null) ? String(value) : "";
|
||||
|
@ -556,34 +551,10 @@ function reflectInt(aParameters)
|
|||
//TBD: Bug 586761: .setAttribute(attr, -2147483648) --> element[attr] == defaultValue instead of -2147483648
|
||||
todo_is(element[attr], intValue, "Bug 586761: " + element.localName +
|
||||
".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else if (testExponential(v)) {
|
||||
//TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr]
|
||||
todo_is(element[attr], intValue, "Bug 673820: " + element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else if (v == "why 567 what") {
|
||||
//TBD: Bug 679672: .setAttribute() is somehow able to parse "why 567 what" into "567"
|
||||
todo_is(element[attr], intValue, "Bug 679672: " + element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else if (v === "-0" && nonNegative) {
|
||||
} else if ((v === "-0" || v == "-0xABCDEF") && nonNegative) {
|
||||
//TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0"
|
||||
todo_is(element[attr], intValue, "Bug 688093: " + element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else if (v == "+42foo") {
|
||||
//TBD: Bug: Unable to correctly parse "+" character in front of string
|
||||
todo_is(element[attr], intValue, "Bug: " + element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else if (v == "0x10FFFF" && defaultValue != 0) {
|
||||
//TBD: Bug: Integer attributes should parse "0x10FFFF" as 0, but instead incorrectly return defaultValue
|
||||
todo_is(element[attr], intValue, "Bug: " + element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else if (v == "-0xABCDEF" && !nonNegative && defaultValue != 0) {
|
||||
//TBD: Bug: Signed integer attributes should parse "-0xABCDEF" as -0, but instead incorrectly return defaultValue
|
||||
todo_is(element[attr], intValue, "Bug: " + element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else if ((v == "++2" || v == "+-2" || v == "--2" || v == "-+2") && element[attr] != defaultValue) {
|
||||
//TBD: Bug: Should not be able to parse strings with multiple sign characters, should return defaultValue
|
||||
todo_is(element[attr], intValue, "Bug: " + element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
} else {
|
||||
is(element[attr], intValue, element.localName +
|
||||
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
|
||||
|
|
|
@ -139,7 +139,6 @@
|
|||
#include "nsIDOMDOMStringList.h"
|
||||
#include "nsIDOMDOMTokenList.h"
|
||||
#include "nsIDOMDOMSettableTokenList.h"
|
||||
#include "nsIDOMNameList.h"
|
||||
#include "nsIDOMNSElement.h"
|
||||
|
||||
#include "nsDOMStringMap.h"
|
||||
|
@ -1000,9 +999,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH,
|
||||
ARRAY_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(NameList, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
NS_DEFINE_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH,
|
||||
DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
@ -2996,10 +2992,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(NameList, nsIDOMNameList)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNameList)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn)
|
||||
|
|
|
@ -220,9 +220,6 @@ DOMCI_CLASS(XULTreeBuilder)
|
|||
// DOMStringList object
|
||||
DOMCI_CLASS(DOMStringList)
|
||||
|
||||
// NameList object used by the DOM
|
||||
DOMCI_CLASS(NameList)
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
DOMCI_CLASS(TreeColumn)
|
||||
DOMCI_CLASS(TreeColumns)
|
||||
|
|
|
@ -60,7 +60,6 @@ interface nsIDOMProcessingInstruction;
|
|||
interface nsIDOMText;
|
||||
interface nsIDOMDOMStringList;
|
||||
interface nsIDOMDOMTokenList;
|
||||
interface nsIDOMNameList;
|
||||
interface nsIDOMClientRect;
|
||||
interface nsIDOMClientRectList;
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ SDK_XPIDLSRCS = \
|
|||
$(NULL)
|
||||
XPIDLSRCS = \
|
||||
nsIDOMDOMStringList.idl \
|
||||
nsIDOMNameList.idl \
|
||||
nsIDOMXMLDocument.idl \
|
||||
nsIDOMUserDataHandler.idl \
|
||||
nsIDOMNSEditableElement.idl \
|
||||
|
|
|
@ -67,7 +67,7 @@ interface nsIDOMCaretPosition;
|
|||
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
|
||||
*/
|
||||
|
||||
[scriptable, uuid(C54536AF-C238-4D8B-A339-54E2A0649FF5)]
|
||||
[scriptable, uuid(489faaa9-c54e-466c-8164-9a5fcc3a7052)]
|
||||
interface nsIDOMDocument : nsIDOMNode
|
||||
{
|
||||
readonly attribute nsIDOMDocumentType doctype;
|
||||
|
@ -106,8 +106,6 @@ interface nsIDOMDocument : nsIDOMNode
|
|||
nsIDOMElement getElementById(in DOMString elementId);
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString inputEncoding;
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString xmlEncoding;
|
||||
// Introduced in DOM Level 3:
|
||||
attribute boolean xmlStandalone;
|
||||
// raises(DOMException) on setting
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
[scriptable, uuid(92b0df87-78a1-4e3b-a23c-d0c5bb2b83f9)]
|
||||
[scriptable, uuid(8a876308-7891-468c-8f7a-9f2b81160c3c)]
|
||||
interface nsIDOMText : nsIDOMCharacterData
|
||||
{
|
||||
nsIDOMText splitText(in unsigned long offset)
|
||||
|
@ -68,12 +68,4 @@ interface nsIDOMText : nsIDOMCharacterData
|
|||
* passing an element, comment, or processing-instruction boundary.
|
||||
*/
|
||||
readonly attribute DOMString wholeText;
|
||||
|
||||
/**
|
||||
* If content is empty, removes all logically adjacent text nodes (including
|
||||
* this node) from the DOM tree, returning null; otherwise, replaces the
|
||||
* contents of this node with aContent and removes all other logically
|
||||
* adjacent text nodes from the DOM tree, returning this node.
|
||||
*/
|
||||
nsIDOMText replaceWholeText(in DOMString content) raises(DOMException);
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "nsIDOMDocument.idl"
|
||||
|
||||
[scriptable, uuid(0457526E-1FA5-476C-9314-0F704617B9F4)]
|
||||
[scriptable, uuid(8168733e-9cf6-4552-9f03-57de11b87f3f)]
|
||||
interface nsIDOMXMLDocument : nsIDOMDocument
|
||||
{
|
||||
// DOM Level 3 Load & Save, DocumentLS
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
*/
|
||||
interface nsISelection;
|
||||
|
||||
[scriptable, uuid(DA6A8183-3C50-4F4A-9EFC-0E050B9A856A)]
|
||||
[scriptable, uuid(9a23fb3c-1d25-462e-8e85-c78c9dc61755)]
|
||||
interface nsIDOMHTMLDocument : nsIDOMDocument
|
||||
{
|
||||
readonly attribute DOMString URL;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
interface nsIDOMSVGSVGElement;
|
||||
|
||||
[scriptable, uuid(E055EF40-D6BA-443A-B4DB-C1CCFAA6EB31)]
|
||||
[scriptable, uuid(1767ad4f-bb2b-474b-b208-9910ed152605)]
|
||||
interface nsIDOMSVGDocument : nsIDOMDocument
|
||||
{
|
||||
readonly attribute DOMString domain;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
|
||||
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
@ -98,10 +98,15 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
|
||||
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage()
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
PRUint8 aArgc,
|
||||
jsval* aRetval)
|
||||
{
|
||||
return mMessageManager ? mMessageManager->SendSyncMessage()
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
return mMessageManager
|
||||
? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_IMETHOD GetContent(nsIDOMWindow** aContent);
|
||||
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
|
||||
|
|
|
@ -108,12 +108,12 @@ IsSupportedWarning=Use of attributes' isSupported() is deprecated.
|
|||
IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated.
|
||||
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
|
||||
EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead.
|
||||
PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated.
|
||||
TotalSizeWarning=Use of XMLHttpRequest's progress events' totalSize attribute is deprecated.
|
||||
nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.parse instead.
|
||||
nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead.
|
||||
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
|
||||
IsSameNodeWarning=Use of isSameNode is deprecated. Please use A == B to test for equality instead.
|
||||
ReplaceWholeTextWarning=Use of replaceWholeText is deprecated. Please call normalize() on the parent and set the data attribute, or use textContent instead.
|
||||
XmlEncodingWarning=Use of xmlEncoding is deprecated.
|
||||
XmlVersionWarning=Use of xmlVersion is deprecated.
|
||||
InputEncodingWarning=Use of inputEncoding is deprecated.
|
||||
XmlStandaloneWarning=Use of xmlStandalone is deprecated.
|
||||
|
|
|
@ -39,9 +39,6 @@ function runTest() {
|
|||
// doc.xmlStandalone
|
||||
ok(doc.xmlStandalone == clonefalse.xmlStandalone, "xmlStandalone not preserved correctly; " + iframes[i].id);
|
||||
|
||||
// doc.xmlEncoding
|
||||
ok(doc.xmlEncoding == clonefalse.xmlEncoding, "xmlEncoding not preserved correctly; " + iframes[i].id);
|
||||
|
||||
// doc.characterSet
|
||||
ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id);
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr",
|
|||
var createEntityRef = ["documentinvalidcharacterexceptioncreateentref",
|
||||
"documentinvalidcharacterexceptioncreateentref1",
|
||||
"hc_attrgetvalue2", "hc_nodevalue03"];
|
||||
|
||||
var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi",
|
||||
"documentinvalidcharacterexceptioncreatepi1"];
|
||||
|
||||
var todoTests = {};
|
||||
function concat(lst/*...*/) {
|
||||
|
@ -101,5 +102,5 @@ function concat(lst/*...*/) {
|
|||
}
|
||||
return f;
|
||||
}
|
||||
var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef);
|
||||
var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef, createProcessingInstructionHTML);
|
||||
for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; }
|
||||
|
|
|
@ -148,11 +148,6 @@ members = [
|
|||
'nsIDOMDOMStringList.*',
|
||||
'nsIDOMDOMTokenList.*',
|
||||
'nsIDOMDOMSettableTokenList.*',
|
||||
'nsIDOMNameList.getName',
|
||||
'nsIDOMNameList.contains',
|
||||
'nsIDOMNameList.containsNS',
|
||||
'nsIDOMNameList.length',
|
||||
'nsIDOMNameList.getNamespaceURI',
|
||||
'nsIDOMXULDocument.getBoxObjectFor',
|
||||
'nsIDOMNSElement.*',
|
||||
|
||||
|
|
|
@ -3146,12 +3146,11 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_FAILURE; //changed to NS_OK in quirks mode if ScrollTo is called
|
||||
|
||||
// Scroll to the top/left if the anchor can not be
|
||||
// found and it is labelled top (quirks mode only). @see bug 80784
|
||||
if ((NS_LossyConvertUTF16toASCII(aAnchorName).LowerCaseEqualsLiteral("top")) &&
|
||||
(mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)) {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
NS_NAMED_LITERAL_STRING(top, "top");
|
||||
if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) {
|
||||
// Scroll to the top/left if aAnchorName is "top" and there is no element
|
||||
// with such a name or id.
|
||||
rv = NS_OK;
|
||||
nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable();
|
||||
// Check |aScroll| after setting |rv| so we set |rv| to the same
|
||||
|
|
|
@ -68,6 +68,12 @@ _TEST_FILES = \
|
|||
test_after_paint_pref.html \
|
||||
test_border_radius_hit_testing.html \
|
||||
test_bug66619.html \
|
||||
test_bug93077-1.html \
|
||||
test_bug93077-2.html \
|
||||
test_bug93077-3.html \
|
||||
test_bug93077-4.html \
|
||||
test_bug93077-5.html \
|
||||
test_bug93077-6.html \
|
||||
test_bug114649.html \
|
||||
$(warning test_bug369950.html disabled due to random orange; see bug 492575) \
|
||||
test_bug386575.xhtml \
|
||||
|
|
|
@ -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>
|
||||
<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="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>
|
||||
<th>1</th>
|
||||
|
@ -18,19 +18,19 @@
|
|||
<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="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>
|
||||
<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="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>
|
||||
<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="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>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -397,23 +397,13 @@ nsProgressNotificationProxy::GetInterface(const nsIID& iid,
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
static bool NewRequestAndEntry(bool forcePrincipalCheckForCacheEntry,
|
||||
imgRequest **request, imgCacheEntry **entry)
|
||||
static void NewRequestAndEntry(bool aForcePrincipalCheckForCacheEntry,
|
||||
imgRequest **aRequest, imgCacheEntry **aEntry)
|
||||
{
|
||||
*request = new imgRequest();
|
||||
if (!*request)
|
||||
return PR_FALSE;
|
||||
|
||||
*entry = new imgCacheEntry(*request, forcePrincipalCheckForCacheEntry);
|
||||
if (!*entry) {
|
||||
delete *request;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*request);
|
||||
NS_ADDREF(*entry);
|
||||
|
||||
return PR_TRUE;
|
||||
nsRefPtr<imgRequest> request = new imgRequest();
|
||||
nsRefPtr<imgCacheEntry> entry = new imgCacheEntry(request, aForcePrincipalCheckForCacheEntry);
|
||||
request.forget(aRequest);
|
||||
entry.forget(aEntry);
|
||||
}
|
||||
|
||||
static bool ShouldRevalidateEntry(imgCacheEntry *aEntry,
|
||||
|
@ -1697,9 +1687,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
|
|||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
|
||||
getter_AddRefs(entry)))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
|
||||
getter_AddRefs(entry));
|
||||
|
||||
PR_LOG(gImgLog, PR_LOG_DEBUG,
|
||||
("[this=%p] imgLoader::LoadImage -- Created new imgRequest [request=%p]\n", this, request.get()));
|
||||
|
@ -1902,9 +1891,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
|
|||
// Default to doing a principal check because we don't know who
|
||||
// started that load and whether their principal ended up being
|
||||
// inherited on the channel.
|
||||
if (!NewRequestAndEntry(PR_TRUE, getter_AddRefs(request),
|
||||
getter_AddRefs(entry)))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), getter_AddRefs(entry));
|
||||
|
||||
// We use originalURI here to fulfil the imgIRequest contract on GetURI.
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
|
|
Загрузка…
Ссылка в новой задаче