Merge from mozilla-central (rev 783ef71b479e) to e10s tree; gets xpcshell working again.

This commit is contained in:
Jason Duell 2010-03-18 14:59:34 -07:00
Родитель 1ca1cfe558 3cbbbf8a1e
Коммит f81b2e3733
396 изменённых файлов: 6905 добавлений и 5875 удалений

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

@ -55,6 +55,7 @@ XPIDLSRCS = \
nsIAccessibilityService.idl \
nsIAccessibleRetrieval.idl \
nsIAccessible.idl \
nsIAccessibleApplication.idl \
nsIAccessibleRelation.idl \
nsIAccessibleRole.idl \
nsIAccessibleStates.idl \

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

@ -56,7 +56,7 @@ interface nsIDOMCSSPrimitiveValue;
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(71a3b4e7-e83d-45cf-a20e-9ce292bcf19f)]
[scriptable, uuid(bd458843-1895-42c6-b7f9-f0ca88eeab6b)]
interface nsIAccessNode : nsISupports
{
/**
@ -104,11 +104,15 @@ interface nsIAccessNode : nsISupports
readonly attribute nsIAccessNode nextSiblingNode;
/**
* The nsIAccessibleDocument that this nsIAccessNode
* resides in.
* The document accessible that this access node resides in.
*/
readonly attribute nsIAccessibleDocument accessibleDocument;
readonly attribute nsIAccessibleDocument document;
/**
* The root document accessible that this access node resides in.
*/
readonly attribute nsIAccessibleDocument rootDocument;
/**
* The innerHTML for the DOM node
* This is a text string of all the markup inside the DOM

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

@ -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,17 +15,16 @@
* 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) 2000
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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"),
* 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
@ -39,8 +38,30 @@
#include "nsISupports.idl"
[scriptable, uuid(a6cf911a-15b3-11d2-932e-00805f8add32)]
interface nsIDOMNSHTMLFormControlList : nsISupports
/**
* This interface is implemented by top level accessible object in hierarchy and
* provides information about application.
*/
[scriptable, uuid(79251626-387c-4531-89f3-680d31d6cf05)]
interface nsIAccessibleApplication : nsISupports
{
nsISupports namedItem(in DOMString name);
/**
* Returns the application name.
*/
readonly attribute DOMString appName;
/**
* Returns the application version.
*/
readonly attribute DOMString appVersion;
/**
* Returns the platform name.
*/
readonly attribute DOMString platformName;
/**
* Returns the platform version.
*/
readonly attribute DOMString platformVersion;
};

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

@ -56,9 +56,14 @@ interface nsIDOMDOMStringList;
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(5f5a6f98-835d-4771-8bfe-a0c7cdc85fec)]
[scriptable, uuid(3df14f00-7253-4b9c-97c2-b4632090da23)]
interface nsIAccessibleRetrieval : nsISupports
{
/**
* Return application accessible.
*/
nsIAccessible getApplicationAccessible();
/**
* Return an nsIAccessible for a DOM node in pres shell 0.
* Create a new accessible of the appropriate type if necessary,

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

@ -1095,10 +1095,10 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
nsRefPtr<nsApplicationAccessibleWrap> appAccWrap =
nsApplicationAccessible *applicationAcc =
nsAccessNode::GetApplicationAccessible();
nsAccessibleWrap* tmpAppAccWrap =
static_cast<nsAccessibleWrap*>(appAccWrap.get());
static_cast<nsAccessibleWrap*>(applicationAcc);
if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
return nsnull;

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

@ -446,11 +446,11 @@ mai_util_get_root(void)
return nsnull;
}
nsRefPtr<nsApplicationAccessibleWrap> root =
nsApplicationAccessible *applicationAcc =
nsAccessNode::GetApplicationAccessible();
if (root)
return root->GetAtkObject();
if (applicationAcc)
return applicationAcc->GetAtkObject();
return nsnull;
}

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

@ -679,17 +679,17 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
};
/**
* Universal states:
* Universal (Global) states:
* The following state rules are applied to any accessible element,
* whether there is an ARIA role or not:
*/
eStateMapEntryID nsARIAMap::gWAIUnivStateMap[] = {
eARIARequired,
eARIAInvalid,
eARIAHasPopup,
eARIABusy,
eARIADisabled,
eARIAExpanded,
eARIAExpanded, // Currently under spec review but precedent exists
eARIAHasPopup, // Note this is technically a "property"
eARIAInvalid,
eARIARequired, // XXX not global, Bug 553117
eARIANone
};
@ -703,7 +703,7 @@ nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = {
{&nsAccessibilityAtoms::aria_activedescendant, ATTR_BYPASSOBJ },
{&nsAccessibilityAtoms::aria_atomic, ATTR_VALTOKEN },
{&nsAccessibilityAtoms::aria_busy, ATTR_VALTOKEN },
{&nsAccessibilityAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */
{&nsAccessibilityAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */
{&nsAccessibilityAtoms::aria_controls, ATTR_BYPASSOBJ },
{&nsAccessibilityAtoms::aria_describedby, ATTR_BYPASSOBJ },
{&nsAccessibilityAtoms::aria_disabled, ATTR_BYPASSOBJ | ATTR_VALTOKEN },

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

@ -242,10 +242,10 @@ nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
// XXX: remove this hack during reorganization of 506907. Meanwhile we
// want to get rid an assertion for application accessible events which
// don't have DOM node (see bug 506206).
nsRefPtr<nsApplicationAccessibleWrap> applicationAcc =
nsApplicationAccessible *applicationAcc =
nsAccessNode::GetApplicationAccessible();
if (mAccessible != static_cast<nsIAccessible*>(applicationAcc.get()))
if (mAccessible != static_cast<nsIAccessible*>(applicationAcc))
NS_ASSERTION(targetNode, "There should always be a DOM node for an event");
}
#endif

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

@ -81,7 +81,7 @@ PRBool nsAccessNode::gIsFormFillEnabled = PR_FALSE;
nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible>
nsAccessNode::gGlobalDocAccessibleCache;
nsApplicationAccessibleWrap *nsAccessNode::gApplicationAccessible = nsnull;
nsApplicationAccessible *nsAccessNode::gApplicationAccessible = nsnull;
/*
* Class nsAccessNode
@ -221,7 +221,7 @@ NS_IMETHODIMP nsAccessNode::GetOwnerWindow(void **aWindow)
return docAccessible->GetWindowHandle(aWindow);
}
already_AddRefed<nsApplicationAccessibleWrap>
nsApplicationAccessible*
nsAccessNode::GetApplicationAccessible()
{
NS_ASSERTION(!nsAccessibilityService::gIsShutdown,
@ -239,13 +239,12 @@ nsAccessNode::GetApplicationAccessible()
nsresult rv = gApplicationAccessible->Init();
if (NS_FAILED(rv)) {
gApplicationAccessible->Shutdown();
NS_RELEASE(gApplicationAccessible);
gApplicationAccessible = nsnull;
return nsnull;
}
}
NS_ADDREF(gApplicationAccessible); // Addref because we're a getter
return gApplicationAccessible;
}
@ -298,13 +297,15 @@ void nsAccessNode::ShutdownXPAccessibility()
NS_IF_RELEASE(gKeyStringBundle);
NS_IF_RELEASE(gLastFocusedNode);
nsApplicationAccessibleWrap::Unload();
ClearCache(gGlobalDocAccessibleCache);
// Release gApplicationAccessible after everything else is shutdown
// so we don't accidently create it again while tearing down root accessibles
NS_IF_RELEASE(gApplicationAccessible);
gApplicationAccessible = nsnull;
nsApplicationAccessibleWrap::Unload();
if (gApplicationAccessible) {
gApplicationAccessible->Shutdown();
NS_RELEASE(gApplicationAccessible);
}
NotifyA11yInitOrShutdown(PR_FALSE);
}
@ -427,11 +428,21 @@ nsAccessNode::GetNumChildren(PRInt32 *aNumChildren)
}
NS_IMETHODIMP
nsAccessNode::GetAccessibleDocument(nsIAccessibleDocument **aAccessibleDocument)
nsAccessNode::GetDocument(nsIAccessibleDocument **aDocument)
{
NS_ENSURE_ARG_POINTER(aAccessibleDocument);
NS_ENSURE_ARG_POINTER(aDocument);
NS_IF_ADDREF(*aAccessibleDocument = GetDocAccessibleFor(mWeakShell));
NS_IF_ADDREF(*aDocument = GetDocAccessibleFor(mWeakShell));
return NS_OK;
}
NS_IMETHODIMP
nsAccessNode::GetRootDocument(nsIAccessibleDocument **aRootDocument)
{
NS_ENSURE_ARG_POINTER(aRootDocument);
nsRefPtr<nsRootAccessible> rootDocument = GetRootAccessible();
NS_IF_ADDREF(*aRootDocument = rootDocument.get());
return NS_OK;
}

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

@ -63,7 +63,7 @@ class nsIAccessibleDocument;
class nsIFrame;
class nsIDOMNodeList;
class nsRootAccessible;
class nsApplicationAccessibleWrap;
class nsApplicationAccessible;
class nsIDocShellTreeItem;
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
@ -118,12 +118,20 @@ class nsAccessNode: public nsIAccessNode
static void InitXPAccessibility();
static void ShutdownXPAccessibility();
/**
* Return an application accessible.
*/
static already_AddRefed<nsApplicationAccessibleWrap> GetApplicationAccessible();
/**
* Return an application accessible.
*/
static nsApplicationAccessible* GetApplicationAccessible();
already_AddRefed<nsRootAccessible> GetRootAccessible();
/**
* Return the document accessible for this accesnode.
*/
nsDocAccessible* GetDocAccessible() const;
/**
* Return the root document accessible for this accessnode.
*/
already_AddRefed<nsRootAccessible> GetRootAccessible();
static nsIDOMNode *gLastFocusedNode;
@ -186,11 +194,6 @@ protected:
nsPresContext* GetPresContext();
/**
* Return the document accessible for this accesnode.
*/
nsDocAccessible* GetDocAccessible() const;
void LastRelease();
nsCOMPtr<nsIDOMNode> mDOMNode;
@ -216,7 +219,7 @@ protected:
gGlobalDocAccessibleCache;
private:
static nsApplicationAccessibleWrap *gApplicationAccessible;
static nsApplicationAccessible *gApplicationAccessible;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessNode,

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

@ -960,6 +960,15 @@ nsAccessibilityService::GetCachedAccessNode(nsIDOMNode *aNode,
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleRetrieval
NS_IMETHODIMP
nsAccessibilityService::GetApplicationAccessible(nsIAccessible **aAccessibleApplication)
{
NS_ENSURE_ARG_POINTER(aAccessibleApplication);
NS_IF_ADDREF(*aAccessibleApplication = nsAccessNode::GetApplicationAccessible());
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
{
@ -1625,7 +1634,7 @@ nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
if (!newAcc && content->Tag() != nsAccessibilityAtoms::body && content->GetParent() &&
((weakFrame.GetFrame() && weakFrame.GetFrame()->IsFocusable()) ||
(isHTML && nsCoreUtils::HasClickListener(content)) ||
HasUniversalAriaProperty(content, aWeakShell) || roleMapEntry ||
HasUniversalAriaProperty(content) || roleMapEntry ||
HasRelatedContent(content) || nsCoreUtils::IsXLink(content))) {
// This content is focusable or has an interesting dynamic content accessibility property.
// If it's interesting we need it in the accessibility hierarchy so that events or
@ -1646,26 +1655,26 @@ nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
}
PRBool
nsAccessibilityService::HasUniversalAriaProperty(nsIContent *aContent,
nsIWeakReference *aWeakShell)
nsAccessibilityService::HasUniversalAriaProperty(nsIContent *aContent)
{
// ARIA attributes that take token values (NMTOKEN, bool) are special cased.
// ARIA attributes that take token values (NMTOKEN, bool) are special cased
// because of special value "undefined" (see HasDefinedARIAToken).
return nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_atomic) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_busy) ||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_controls) ||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_describedby) ||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_disabled) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_dropeffect) ||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_flowto) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_grabbed) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_haspopup) ||
// purposely ignore aria-hidden; since we use gecko for detecting this anyways
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_invalid) ||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_label) ||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_labelledby) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_live) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_owns) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_relevant) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_required) ||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_sort);
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_relevant);
}
// nsIAccessibleRetrieval
@ -1990,11 +1999,11 @@ NS_IMETHODIMP nsAccessibilityService::AddNativeRootAccessible(void * aAtkAccessi
*aRootAccessible = static_cast<nsIAccessible*>(rootAccWrap);
NS_ADDREF(*aRootAccessible);
nsRefPtr<nsApplicationAccessibleWrap> appRoot =
nsApplicationAccessible *applicationAcc =
nsAccessNode::GetApplicationAccessible();
NS_ENSURE_STATE(appRoot);
NS_ENSURE_STATE(applicationAcc);
appRoot->AddRootAccessible(*aRootAccessible);
applicationAcc->AddRootAccessible(*aRootAccessible);
return NS_OK;
#else
@ -2008,11 +2017,11 @@ NS_IMETHODIMP nsAccessibilityService::RemoveNativeRootAccessible(nsIAccessible *
void* atkAccessible;
aRootAccessible->GetNativeInterface(&atkAccessible);
nsRefPtr<nsApplicationAccessibleWrap> appRoot =
nsApplicationAccessible *applicationAcc =
nsAccessNode::GetApplicationAccessible();
NS_ENSURE_STATE(appRoot);
NS_ENSURE_STATE(applicationAcc);
appRoot->RemoveRootAccessible(aRootAccessible);
applicationAcc->RemoveRootAccessible(aRootAccessible);
return NS_OK;
#else

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

@ -191,10 +191,9 @@ private:
* A universal ARIA property is one that can be defined on any element even if there is no role.
*
* @param aContent The content node to test
* @param aWeakShell A weak reference to the pres shell
* @return PR_TRUE if there is a universal ARIA property set on the node
*/
PRBool HasUniversalAriaProperty(nsIContent *aContent, nsIWeakReference *aWeakShell);
PRBool HasUniversalAriaProperty(nsIContent *aContent);
/**
* Process the internal doc load event.

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

@ -881,15 +881,10 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, PRBool aDeepestChild,
// therefore accessible for containing block may be different from accessible
// for DOM parent but GetFrameForPoint() should be called for containing block
// to get an out of flow element.
nsCOMPtr<nsIAccessibleDocument> accDocument;
rv = GetAccessibleDocument(getter_AddRefs(accDocument));
NS_ENSURE_SUCCESS(rv, rv);
nsDocAccessible *accDocument = GetDocAccessible();
NS_ENSURE_TRUE(accDocument, NS_ERROR_FAILURE);
nsRefPtr<nsAccessNode> docAccessNode =
nsAccUtils::QueryAccessNode(accDocument);
nsIFrame *frame = docAccessNode->GetFrame();
nsIFrame *frame = accDocument->GetFrame();
NS_ENSURE_STATE(frame);
nsPresContext *presContext = frame->PresContext();

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

@ -55,7 +55,8 @@ nsApplicationAccessible::nsApplicationAccessible() :
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessible, nsAccessible)
NS_IMPL_ISUPPORTS_INHERITED1(nsApplicationAccessible, nsAccessible,
nsIAccessibleApplication)
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible
@ -124,6 +125,64 @@ nsApplicationAccessible::GetParent(nsIAccessible **aAccessible)
return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleApplication
NS_IMETHODIMP
nsApplicationAccessible::GetAppName(nsAString& aName)
{
aName.Truncate();
if (!mAppInfo)
return NS_ERROR_FAILURE;
nsCAutoString cname;
nsresult rv = mAppInfo->GetName(cname);
NS_ENSURE_SUCCESS(rv, rv);
AppendUTF8toUTF16(cname, aName);
return NS_OK;
}
NS_IMETHODIMP
nsApplicationAccessible::GetAppVersion(nsAString& aVersion)
{
aVersion.Truncate();
if (!mAppInfo)
return NS_ERROR_FAILURE;
nsCAutoString cversion;
nsresult rv = mAppInfo->GetVersion(cversion);
NS_ENSURE_SUCCESS(rv, rv);
AppendUTF8toUTF16(cversion, aVersion);
return NS_OK;
}
NS_IMETHODIMP
nsApplicationAccessible::GetPlatformName(nsAString& aName)
{
aName.AssignLiteral("Gecko");
return NS_OK;
}
NS_IMETHODIMP
nsApplicationAccessible::GetPlatformVersion(nsAString& aVersion)
{
aVersion.Truncate();
if (!mAppInfo)
return NS_ERROR_FAILURE;
nsCAutoString cversion;
nsresult rv = mAppInfo->GetPlatformVersion(cversion);
NS_ENSURE_SUCCESS(rv, rv);
AppendUTF8toUTF16(cversion, aVersion);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessNode public methods
@ -136,6 +195,14 @@ nsApplicationAccessible::IsDefunct()
nsresult
nsApplicationAccessible::Init()
{
mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
return NS_OK;
}
nsresult
nsApplicationAccessible::Shutdown()
{
mAppInfo = nsnull;
return NS_OK;
}

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

@ -44,7 +44,10 @@
#define __NS_APPLICATION_ACCESSIBLE_H__
#include "nsAccessibleWrap.h"
#include "nsIAccessibleApplication.h"
#include "nsIMutableArray.h"
#include "nsIXULAppInfo.h"
/**
* nsApplicationAccessible is for the whole application of Mozilla.
@ -56,7 +59,8 @@
* the nsApplicationAccessible instance.
*/
class nsApplicationAccessible: public nsAccessibleWrap
class nsApplicationAccessible: public nsAccessibleWrap,
public nsIAccessibleApplication
{
public:
nsApplicationAccessible();
@ -72,9 +76,13 @@ public:
NS_IMETHOD GetParent(nsIAccessible **aAccessible);
// nsIAccessibleApplication
NS_DECL_NSIACCESSIBLEAPPLICATION
// nsAccessNode
virtual PRBool IsDefunct();
virtual nsresult Init();
virtual nsresult Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
@ -93,6 +101,9 @@ protected:
virtual void CacheChildren();
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
nsresult *aError = nsnull);
private:
nsCOMPtr<nsIXULAppInfo> mAppInfo;
};
#endif

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

@ -1335,11 +1335,6 @@ void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2);
}
void nsDocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
PRInt32 aStateMask)
{
}
void nsDocAccessible::CharacterDataWillChange(nsIDocument *aDocument,
nsIContent* aContent,
CharacterDataChangeInfo* aInfo)

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

@ -550,7 +550,21 @@ nsRootAccessible::FireCurrentFocusEvent()
nsCOMPtr<nsIDOMNode> targetNode;
accService->GetRelevantContentNodeFor(focusedNode,
getter_AddRefs(targetNode));
if (targetNode) {
// If the focused element is document element or HTML body element
// then simulate the focus event for the document.
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(targetNode));
if (targetContent) {
nsCOMPtr<nsIDOMNode> document =
do_QueryInterface(targetContent->GetOwnerDoc());
if (targetContent == nsCoreUtils::GetRoleContent(document)) {
HandleEventWithTarget(event, document);
return;
}
}
// Otherwise simulate the focus event for currently focused node.
HandleEventWithTarget(event, targetNode);
}
}
@ -926,10 +940,10 @@ void nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNo
nsresult
nsRootAccessible::Init()
{
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
NS_ENSURE_STATE(root);
nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
NS_ENSURE_STATE(applicationAcc);
root->AddRootAccessible(this);
applicationAcc->AddRootAccessible(this);
return nsDocAccessibleWrap::Init();
}
@ -942,10 +956,10 @@ nsRootAccessible::Shutdown()
return NS_OK; // Already shutdown
}
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
NS_ENSURE_STATE(root);
nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
NS_ENSURE_STATE(applicationAcc);
root->RemoveRootAccessible(this);
applicationAcc->RemoveRootAccessible(this);
mCurrentARIAMenubar = nsnull;

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

@ -36,9 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleWrap.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleText.h"
#include "nsDocAccessible.h"
#include "nsObjCExceptions.h"
#import "nsRoleMap.h"
@ -92,8 +90,10 @@ void
nsAccessibleWrap::GetNativeWindow (void **aOutNativeWindow)
{
*aOutNativeWindow = nsnull;
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
docAccessible->GetWindowHandle (aOutNativeWindow);
nsDocAccessible *docAcc = GetDocAccessible();
if (docAcc)
docAcc->GetWindowHandle (aOutNativeWindow);
}
// overridden in subclasses to create the right kind of object. by default we create a generic

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

@ -145,9 +145,11 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
// Can get to IAccessibleApplication from any node via QS
if (iid == IID_IAccessibleApplication) {
nsRefPtr<nsApplicationAccessibleWrap> app =
GetApplicationAccessible();
nsresult rv = app->QueryNativeInterface(iid, ppv);
nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
if (!applicationAcc)
return E_NOINTERFACE;
nsresult rv = applicationAcc->QueryNativeInterface(iid, ppv);
return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE;
}

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

@ -1782,8 +1782,7 @@ nsAccessibleWrap::GetHWNDFor(nsIAccessible *aAccessible)
if (!hWnd) {
void* handle = nsnull;
nsCOMPtr<nsIAccessibleDocument> accessibleDoc;
accessNode->GetAccessibleDocument(getter_AddRefs(accessibleDoc));
nsDocAccessible *accessibleDoc = accessNode->GetDocAccessible();
if (!accessibleDoc)
return 0;

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

@ -44,12 +44,12 @@
#include "nsServiceManagerUtils.h"
nsIXULAppInfo* nsApplicationAccessibleWrap::sAppInfo = nsnull;
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessibleWrap,
nsApplicationAccessible)
////////////////////////////////////////////////////////////////////////////////
// IUnknown
STDMETHODIMP
@ -66,6 +66,7 @@ nsApplicationAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
return nsAccessibleWrap::QueryInterface(iid, ppv);
}
////////////////////////////////////////////////////////////////////////////////
// IAccessibleApplication
STDMETHODIMP
@ -74,18 +75,14 @@ nsApplicationAccessibleWrap::get_appName(BSTR *aName)
__try {
*aName = NULL;
if (!sAppInfo)
return E_FAIL;
nsCAutoString cname;
nsresult rv = sAppInfo->GetName(cname);
nsAutoString name;
nsresult rv = GetAppName(name);
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (cname.IsEmpty())
if (name.IsEmpty())
return S_FALSE;
NS_ConvertUTF8toUTF16 name(cname);
*aName = ::SysAllocStringLen(name.get(), name.Length());
return *aName ? S_OK : E_OUTOFMEMORY;
@ -99,18 +96,14 @@ nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
__try {
*aVersion = NULL;
if (!sAppInfo)
return E_FAIL;
nsCAutoString cversion;
nsresult rv = sAppInfo->GetVersion(cversion);
nsAutoString version;
nsresult rv = GetAppVersion(version);
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (cversion.IsEmpty())
if (version.IsEmpty())
return S_FALSE;
NS_ConvertUTF8toUTF16 version(cversion);
*aVersion = ::SysAllocStringLen(version.get(), version.Length());
return *aVersion ? S_OK : E_OUTOFMEMORY;
@ -122,7 +115,15 @@ STDMETHODIMP
nsApplicationAccessibleWrap::get_toolkitName(BSTR *aName)
{
__try {
*aName = ::SysAllocString(L"Gecko");
nsAutoString name;
nsresult rv = GetPlatformName(name);
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (name.IsEmpty())
return S_FALSE;
*aName = ::SysAllocStringLen(name.get(), name.Length());
return *aName ? S_OK : E_OUTOFMEMORY;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@ -135,18 +136,14 @@ nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
__try {
*aVersion = NULL;
if (!sAppInfo)
return E_FAIL;
nsCAutoString cversion;
nsresult rv = sAppInfo->GetPlatformVersion(cversion);
nsAutoString version;
nsresult rv = GetPlatformVersion(version);
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (cversion.IsEmpty())
if (version.IsEmpty())
return S_FALSE;
NS_ConvertUTF8toUTF16 version(cversion);
*aVersion = ::SysAllocStringLen(version.get(), version.Length());
return *aVersion ? S_OK : E_OUTOFMEMORY;
@ -154,18 +151,16 @@ __try {
return E_FAIL;
}
// nsApplicationAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
// nsApplicationAccessibleWrap public static
void
nsApplicationAccessibleWrap::PreCreate()
{
nsresult rv = CallGetService("@mozilla.org/xre/app-info;1", &sAppInfo);
NS_ASSERTION(NS_SUCCEEDED(rv), "No XUL application info service");
}
void
nsApplicationAccessibleWrap::Unload()
{
NS_IF_RELEASE(sAppInfo);
}

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

@ -45,8 +45,6 @@
#include "AccessibleApplication.h"
#include "nsIXULAppInfo.h"
class nsApplicationAccessibleWrap: public nsApplicationAccessible,
public IAccessibleApplication
{
@ -73,9 +71,6 @@ public:
public:
static void PreCreate();
static void Unload();
private:
static nsIXULAppInfo* sAppInfo;
};
#endif

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

@ -84,6 +84,7 @@ _TEST_FILES =\
test_editabletext_2.html \
test_elm_listbox.xul \
$(warning test_elm_media.html temporarily disabled) \
test_elm_nsApplicationAcc.html \
test_elm_plugin.html \
test_invalidate_accessnode.html \
test_name.html \
@ -91,7 +92,6 @@ _TEST_FILES =\
test_name_button.html \
test_name_link.html \
test_name_markup.html \
test_name_nsApplicationAcc.html \
test_name_nsRootAcc.xul \
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
test_nsIAccessible_selects.html \

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

@ -22,6 +22,7 @@ const nsIAccessibleCoordinateType =
Components.interfaces.nsIAccessibleCoordinateType;
const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument;
const nsIAccessibleApplication = Components.interfaces.nsIAccessibleApplication;
const nsIAccessibleText = Components.interfaces.nsIAccessibleText;
const nsIAccessibleEditableText = Components.interfaces.nsIAccessibleEditableText;
@ -261,15 +262,7 @@ function isAccessible(aAccOrElmOrID, aInterfaces)
function getRootAccessible(aAccOrElmOrID)
{
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
while (acc) {
var parent = acc.parent;
if (parent && !parent.parent)
return acc;
acc = parent;
}
return null;
return acc ? acc.rootDocument.QueryInterface(nsIAccessible) : null;
}
/**
@ -277,28 +270,8 @@ function getRootAccessible(aAccOrElmOrID)
*/
function getApplicationAccessible()
{
var acc = getAccessible(document), parent = null;
while (acc) {
try {
parent = acc.parent;
} catch (e) {
ok(false, "Can't get a parent for " + prettyName(acc));
return null;
}
if (!parent) {
if (acc.role == ROLE_APP_ROOT)
return acc;
ok(false, "No application accessible!");
return null;
}
acc = parent;
}
return null;
return gAccRetrieval.getApplicationAccessible().
QueryInterface(nsIAccessibleApplication);
}
/**

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

@ -599,7 +599,8 @@ function synthClick(aNodeOrID, aChecker, aEventType)
this.invoke = function synthClick_invoke()
{
// Scroll the node into view, otherwise synth click may fail.
this.DOMNode.scrollIntoView(true);
if (this.DOMNode instanceof nsIDOMNSHTMLElement)
this.DOMNode.scrollIntoView(true);
synthesizeMouse(this.DOMNode, 1, 1, {});
}
@ -610,6 +611,25 @@ function synthClick(aNodeOrID, aChecker, aEventType)
}
}
/**
* Mouse move invoker.
*/
function synthMouseMove(aNodeOrID, aChecker, aEventType)
{
this.__proto__ = new synthAction(aNodeOrID, aChecker, aEventType);
this.invoke = function synthMouseMove_invoke()
{
synthesizeMouse(this.DOMNode, 1, 1, { type: "mousemove" });
synthesizeMouse(this.DOMNode, 2, 2, { type: "mousemove" });
}
this.getID = function synthMouseMove_getID()
{
return prettyName(aNodeOrID) + " mouse move";
}
}
/**
* General key press invoker.
*/
@ -719,6 +739,25 @@ function synthFocus(aNodeOrID, aChecker, aEventType)
}
}
/**
* Focus invoker. Focus the HTML body of content document of iframe.
*/
function synthFocusOnFrame(aNodeOrID, aChecker, aEventType)
{
this.__proto__ = new synthAction(getNode(aNodeOrID).contentDocument,
aChecker, aEventType);
this.invoke = function synthFocus_invoke()
{
this.DOMNode.body.focus();
}
this.getID = function synthFocus_getID()
{
return prettyName(aNodeOrID) + " frame document focus";
}
}
/**
* Select all invoker.
*/

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

@ -35,21 +35,6 @@
}
}
function focusDocument(aFrameID)
{
this.DOMNode = getNode(aFrameID).contentDocument;
this.invoke = function focusDocument_invoke()
{
this.DOMNode.body.focus();
}
this.getID = function focusDocument_getID()
{
return "Focus document of " + prettyName(aFrameID);
}
}
function focusElmWhileSubdocIsFocused(aID)
{
this.DOMNode = getNode(aID);
@ -92,7 +77,7 @@
gQueue.push(new openCloseDialog("button"));
var frameNode = getNode("editabledoc");
gQueue.push(new focusDocument(frameNode));
gQueue.push(new synthFocusOnFrame(frameNode));
gQueue.push(new openCloseDialog(frameNode.contentDocument));
gQueue.push(new focusElmWhileSubdocIsFocused("button"));

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

@ -10,6 +10,8 @@
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
@ -18,23 +20,29 @@
<script type="application/javascript">
/**
* Focus invoker.
* Click menu item invoker.
*/
function synthFocus(aNodeOrID)
function clickMenuItem(aNodeOrID, aFocusNodeOrID)
{
this.DOMNode = getNode(aNodeOrID);
this.DOMNode = getNode(aFocusNodeOrID);
this.invoke = function synthFocus_invoke()
this.invoke = function clickMenuItem_invoke()
{
this.DOMNode.focus();
synthesizeMouse(getNode(aNodeOrID), 1, 1, {});
}
this.getID = function synthFocus_getID() { return aNodeOrID + " focus"; }
this.getID = function clickMenuItem_getID()
{
return prettyName(aNodeOrID) + " click menu item";
}
}
/**
* Do tests.
*/
// gA11yEventDumpID = "eventdump"; // debug stuff
var gQueue = null;
function doTests()
@ -44,6 +52,11 @@
gQueue.push(new synthFocus("textbox"));
gQueue.push(new synthFocus("scale"));
gQueue.push(new synthFocusOnFrame("editabledoc"));
gQueue.push(new synthClick("menu"));
gQueue.push(new synthMouseMove("menuitem"));
gQueue.push(new clickMenuItem("menuitem",
getNode("editabledoc").contentDocument));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -59,6 +72,11 @@
title="xul:slider accessible of xul:scale is accessible illegally">
Mozilla Bug 492518
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=552368"
title=" fire focus event on document accessible whenever the root or body element is focused">
Mozilla Bug 552368
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -68,6 +86,16 @@
<vbox flex="1">
<textbox id="textbox" value="hello"/>
<scale id="scale" min="0" max="9" value="5"/>
<menubar>
<menu id="menu" label="menu">
<menupopup>
<menuitem id="menuitem" label="menuitem"/>
</menupopup>
</menu>
</menubar>
<iframe id="editabledoc" src="focus.html"/>
<vbox id="eventdump"/>
</vbox>
</hbox>
</window>

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

@ -23,6 +23,7 @@
return;
}
// nsIAccessible::name
var bundleServ = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var bundle = bundleServ.createBundle("chrome://branding/locale/brand.properties");
@ -39,6 +40,16 @@
is (accessible.name, applicationName, "wrong application accessible name");
// nsIAccessibleApplication
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
getService(Components.interfaces.nsIXULAppInfo);
is(accessible.appName, appInfo.name, "Wrong application name");
is(accessible.appVersion, appInfo.version, "Wrong application version");
is(accessible.platformName, "Gecko", "Wrong platform name");
is(accessible.platformVersion, appInfo.platformVersion,
"Wrong platform version");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();

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

@ -102,7 +102,7 @@
do {
docAcc = parentDocAcc;
parentOfDocAcc = getAccessible(docAcc.parent, [nsIAccessNode]);
parentDocAcc = getAccessible(parentOfDocAcc.accessibleDocument,
parentDocAcc = getAccessible(parentOfDocAcc.document,
[nsIAccessible]);
} while (getRole(parentDocAcc) != ROLE_CHROME_WINDOW)

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

@ -93,7 +93,7 @@
do {
docAcc = parentDocAcc;
parentOfDocAcc = getAccessible(docAcc.parent, [nsIAccessNode]);
parentDocAcc = getAccessible(parentOfDocAcc.accessibleDocument,
parentDocAcc = getAccessible(parentOfDocAcc.document,
[nsIAccessible]);
} while (getRole(parentDocAcc) != ROLE_CHROME_WINDOW)

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

@ -46,6 +46,7 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES =\
test_aria_globals.html \
test_button.xul \
test_colorpicker.xul \
test_combobox.xul \

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

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Global ARIA States and Accessible Creation</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
function doTest()
{
var accTree = {
role: ROLE_GROUPING,
children: [
{ role: ROLE_TEXT_CONTAINER }, // pawn
{ role: ROLE_TEXT_CONTAINER }, // aria-atomic
{ role: ROLE_TEXT_CONTAINER }, // aria-busy
{ role: ROLE_TEXT_CONTAINER }, // aria-controls
{ role: ROLE_TEXT_CONTAINER }, // aria-describedby
{ role: ROLE_TEXT_CONTAINER }, // aria-disabled
{ role: ROLE_TEXT_CONTAINER }, // aria-dropeffect
{ role: ROLE_TEXT_CONTAINER }, // aria-flowto
{ role: ROLE_TEXT_CONTAINER }, // aria-grabbed
{ role: ROLE_TEXT_CONTAINER }, // aria-haspopup
{ role: ROLE_TEXT_CONTAINER }, // aria-invalid
{ role: ROLE_TEXT_CONTAINER }, // aria-label
{ role: ROLE_TEXT_CONTAINER }, // aria-labelledby
{ role: ROLE_TEXT_CONTAINER }, // aria-live
{ role: ROLE_TEXT_CONTAINER }, // aria-owns
{ role: ROLE_TEXT_CONTAINER } // aria-relevant
]
};
testAccessibleTree("global_aria_states_and_props", accTree);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Update universal ARIA attribute support to latest spec"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=551978">
Mozilla Bug 551978
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- Test that global aria states and properties are enough to cause the
creation of accessible objects -->
<div id="global_aria_states_and_props" role="group">
<span id="pawn"></span>
<span id="atomic" aria-atomic="true"></span>
<span id="busy" aria-busy="false"></span>
<span id="controls" aria-controls="pawn"></span>
<span id="describedby" aria-describedby="pawn"></span>
<span id="disabled" aria-disabled="true"></span>
<span id="dropeffect" aria-dropeffect="move"></span>
<span id="flowto" aria-flowto="pawn"></span>
<span id="grabbed" aria-grabbed="false"></span>
<span id="haspopup" aria-haspopup="false"></span>
<!-- we use gecko to detect hidden-ness so we currently ignore aria-hidden
we might want to special case for aria-hidden="false", but we would need
a good case for it. aria-hidden is only in spec as an author aid to DOM
based AT -->
<span id="invalid" aria-invalid="false"></span>
<span id="label" aria-label="hi"></span>
<span id="labelledby" aria-labelledby="label"></span>
<span id="live" aria-live="polite"></span>
<span id="owns" aria-owns="pawn"></span>
<span id="relevant" aria-relevant="additions"></span>
</div>
</body>
</html>

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

@ -38,14 +38,6 @@
function doTest()
{
if (LINUX) {
// XXX: bug 540529
todo(false, "Failure on Linux.");
SimpleTest.finish();
return;
}
var tabBrowser = document.getElementById("tabbrowser");
var progressListener =

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

@ -906,7 +906,11 @@ pref("toolbar.customization.usesheet", true);
pref("toolbar.customization.usesheet", false);
#endif
#ifdef XP_MACOSX
pref("dom.ipc.plugins.enabled", false);
#else
pref("dom.ipc.plugins.enabled", true);
#endif
#ifdef XP_WIN
#ifndef WINCE

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

@ -1341,6 +1341,13 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
// Initialize the downloads monitor panel listener
DownloadMonitorPanel.init();
if (Win7Features) {
let tempScope = {};
Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm",
tempScope);
tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
}
}, 10000);
// Delayed initialization of PlacesDBUtils.

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

@ -950,7 +950,7 @@
crop = "center";
} else // Still no title? Fall back to our untitled string.
title = this.mStringBundle.getString("tabs.untitled");
title = this.mStringBundle.getString("tabs.emptyTabTitle");
}
aTab.label = title;
@ -1134,7 +1134,7 @@
var blank = !aURI || (aURI == "about:blank");
if (blank)
t.setAttribute("label", this.mStringBundle.getString("tabs.untitled"));
t.setAttribute("label", this.mStringBundle.getString("tabs.emptyTabTitle"));
else
t.setAttribute("label", aURI);
@ -2477,7 +2477,7 @@
var tab = this.firstChild;
tab.setAttribute("label",
this.tabbrowser.mStringBundle.getString("tabs.untitled"));
this.tabbrowser.mStringBundle.getString("tabs.emptyTabTitle"));
tab.minWidth = this.mTabMinWidth;
tab.maxWidth = this.mTabMaxWidth;
tab.width = 0;
@ -2738,15 +2738,7 @@
<method name="_getDragTargetTab">
<parameter name="event"/>
<body><![CDATA[
var node = event.originalTarget;
if (node.localName == "tab")
return node;
node = document.getBindingParent(node);
if (node.localName == "tab")
return node;
return null;
return event.target.localName == "tab" ? event.target : null;
]]></body>
</method>

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

@ -579,12 +579,11 @@ PrivateBrowsingService.prototype = {
// Cookies
let (cm = Cc["@mozilla.org/cookiemanager;1"].
getService(Ci.nsICookieManager)) {
let enumerator = cm.enumerator;
getService(Ci.nsICookieManager2)) {
let enumerator = cm.getCookiesFromHost(aDomain);
while (enumerator.hasMoreElements()) {
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
if (cookie.host.hasRootDomain(aDomain))
cm.remove(cookie.host, cookie.name, cookie.path, false);
cm.remove(cookie.host, cookie.name, cookie.path, false);
}
}

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

@ -203,28 +203,47 @@ function test() {
for (let i = 0; i < 25; i++)
uris.push("http://example.com/" + i);
// We're listening for the first load event, which should
// indicate one of the tabs has loaded and the others haven't. So one should
// We're waiting for the first location change, which should indicate
// one of the tabs has loaded and the others haven't. So one should
// be in a non-userTypedValue case, while others should still have
// userTypedValue and userTypedClear set.
gBrowser.addEventListener("load", function(aEvent) {
gBrowser.removeEventListener("load", arguments.callee, true);
gBrowser.addTabsProgressListener({
onLocationChange: function (aBrowser) {
if (uris.indexOf(aBrowser.currentURI.spec) > -1) {
gBrowser.removeTabsProgressListener(this);
firstLocationChange();
}
},
onProgressChange: function () {},
onSecurityChange: function () {},
onStateChange: function () {},
onStatusChange: function () {}
});
function firstLocationChange() {
let state = JSON.parse(ss.getBrowserState());
let hasSH = state.windows[0].tabs.some(function(aTab) {
return !("userTypedValue" in aTab) && aTab.entries[0].url;
});
let hasUTV = state.windows[0].tabs.some(function(aTab) {
return aTab.userTypedValue && aTab.userTypedClear && !aTab.entries.length;
});
ok(hasUTV, "At least one tab has a userTypedValue with userTypedClear with no loaded URL");
gBrowser.addEventListener("load", firstLoad, true);
}
function firstLoad() {
gBrowser.removeEventListener("load", firstLoad, true);
let state = JSON.parse(ss.getBrowserState());
let hasSH = state.windows[0].tabs.some(function(aTab) {
return !("userTypedValue" in aTab) && aTab.entries[0].url;
});
ok(hasSH, "At least one tab has its entry in SH");
//ok(hasUTV, "At least one tab has a userTypedValue with userTypedClear with no loaded URL");
runNextTest();
}
}, true);
gBrowser.loadTabs(uris);
}

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

@ -180,6 +180,12 @@ PreviewController.prototype = {
this.linkedBrowser.removeEventListener("pageshow", this, false);
this.linkedBrowser.removeEventListener("DOMTitleChanged", this, false);
this.linkedBrowser.removeEventListener("MozAfterPaint", this, false);
// Break cycles, otherwise we end up leaking the window with everything
// attached to it.
delete this.win;
delete this.preview;
delete this.dirtyRegion;
},
get wrappedJSObject() {
return this;
@ -383,7 +389,6 @@ function TabWindow(win) {
this.tabbrowser.tabContainer.addEventListener(this.events[i], this, false);
this.tabbrowser.addTabsProgressListener(this);
AeroPeek.windows.push(this);
let tabs = this.tabbrowser.mTabs;
for (let i = 0; i < tabs.length; i++)
@ -402,6 +407,8 @@ TabWindow.prototype = {
let tabs = this.tabbrowser.mTabs;
this.tabbrowser.removeTabsProgressListener(this);
for (let i = 0; i < this.events.length; i++)
this.tabbrowser.tabContainer.removeEventListener(this.events[i], this, false);
@ -589,6 +596,17 @@ var AeroPeek = {
this.enabled = this._prefenabled = this.prefs.getBoolPref(TOGGLE_PREF_NAME);
},
destroy: function destroy() {
this._enabled = false;
this.prefs.removeObserver(TOGGLE_PREF_NAME, this);
this.prefs.removeObserver(DISABLE_THRESHOLD_PREF_NAME, this);
this.prefs.removeObserver(CACHE_EXPIRATION_TIME_PREF_NAME, this);
if (this.cacheTimer)
this.cacheTimer.cancel();
},
get enabled() {
return this._enabled;
},
@ -636,7 +654,10 @@ var AeroPeek = {
return;
win.gTaskbarTabGroup.destroy();
win.gTaskbarTabGroup = null;
delete win.gTaskbarTabGroup;
if (this.windows.length == 0)
this.destroy();
},
resetCacheTimer: function () {

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

@ -1,5 +1,5 @@
tabs.loading=Loading…
tabs.untitled=(Untitled)
tabs.emptyTabTitle=New Tab
tabs.closeTab=Close Tab
tabs.close=Close
tabs.closeWarningTitle=Confirm close

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

@ -1114,7 +1114,7 @@ statusbarpanel#statusbar-display {
.tabbrowser-tab {
border: none !important;
padding: 0px;
padding: 0 2px;
margin-bottom: 1px;
}
@ -1125,8 +1125,8 @@ statusbarpanel#statusbar-display {
.tab-icon-image {
width: 16px;
height: 16px;
-moz-margin-start: 4px;
-moz-margin-end: 3px;
-moz-margin-start: 1px;
-moz-margin-end: 4px;
list-style-image: url("chrome://global/skin/icons/folder-item.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
@ -1205,7 +1205,6 @@ statusbarpanel#statusbar-display {
}
.tab-close-button {
-moz-margin-end: 6px;
padding: 0px;
border: none;
list-style-image: url("moz-icon://stock/gtk-close?size=menu");

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

@ -121,6 +121,40 @@
border-top: 1px solid rgba(0,0,0,0.65);
}
/* ----- INACTIVE WINDOW ----- */
#main-window:not([active="true"]) > #navigator-toolbox > #nav-bar {
background-image: url("chrome://global/skin/toolbar/toolbar-background-inactive.png");
}
#main-window:not([active="true"]) > #navigator-toolbox > #PersonalToolbar {
background-color: -moz-mac-chrome-inactive;
border-bottom-color: rgba(0, 0, 0, 0.32);
}
#main-window:not([active="true"]) > #navigator-toolbox > #TabsToolbar:not(:-moz-lwtheme) {
background-color: #e2e2e2;
}
#main-window:not([active="true"]) > #navigator-toolbox > toolbar > toolbaritem,
#main-window:not([active="true"]) > #navigator-toolbox > toolbar > toolbarbutton,
#main-window:not([active="true"]) .tabs-newtab-button > .toolbarbutton-icon {
opacity: 0.75;
}
#main-window:not([active="true"]) > #browser > vbox > #sidebar,
#main-window:not([active="true"]) > #browser > vbox > sidebarheader {
background-color: #e8e8e8;
}
#main-window:not([active="true"]) .tabbrowser-tab {
color: #575757;
}
#main-window:not([active="true"]) .tabbrowser-tab[selected="true"] {
background-color: -moz-mac-chrome-inactive;
}
/* ----- BOOKMARK TOOLBAR ----- */
#PersonalToolbar {
@ -133,11 +167,6 @@
-moz-box-align: center;
}
#PersonalToolbar:-moz-window-inactive {
background-color: -moz-mac-chrome-inactive;
border-bottom-color: rgba(0, 0, 0, 0.32);
}
#personal-bookmarks {
-moz-box-align: center;
}
@ -310,11 +339,6 @@ toolbar[mode="text"] .toolbarbutton-1 > .toolbarbutton-text {
padding-bottom: 0;
}
#navigator-toolbox > toolbar > toolbaritem:-moz-window-inactive,
#navigator-toolbox > toolbar > toolbarbutton:-moz-window-inactive {
opacity: 0.75;
}
#back-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
#forward-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
#back-forward-dropmarker:-moz-locale-dir(rtl) > .toolbarbutton-icon {
@ -1340,17 +1364,12 @@ richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
/* ----- SIDEBAR ELEMENTS ----- */
#sidebar,
sidebarheader {
#sidebar {
background-color: #d4dde5;
}
#sidebar:-moz-window-inactive,
sidebarheader:-moz-window-inactive {
background-color: #e8e8e8;
}
sidebarheader {
sidebarheader {
background-color: #d4dde5;
padding: 2px;
text-shadow: none;
}
@ -1440,6 +1459,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
}
#nav-bar {
background-color: #9e9e9e;
background-image: url("chrome://global/skin/toolbar/toolbar-background.gif");
background-repeat: repeat-x;
background-position: top right;
padding: 0 4px;
}
@ -1537,10 +1560,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
padding-top: 1px;
}
.tabs-newtab-button > .toolbarbutton-icon:-moz-window-inactive {
opacity: 0.75;
}
.tabbrowser-tab[selected="true"] {
padding: 0 6px 1px;
border-width: 2px;
@ -1551,10 +1570,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
background-color: -moz-mac-chrome-active;
}
.tabbrowser-tab[selected="true"]:-moz-window-inactive {
background-color: -moz-mac-chrome-inactive;
}
.tabbrowser-tab:focus > .tab-text {
-moz-box-shadow: @focusRingShadow@;
}
@ -1564,11 +1579,8 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
color: #000000;
}
.tabbrowser-tab:-moz-window-inactive {
color: #575757;
}
.tabbrowser-tab:-moz-lwtheme {
.tabbrowser-tab:-moz-lwtheme,
#main-window:not([active="true"]) .tabbrowser-tab:-moz-lwtheme {
color: inherit;
text-shadow: inherit;
}
@ -1583,10 +1595,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
background: #9B9B9B url("chrome://browser/skin/tabbrowser/tabbrowser-tabs-bkgnd.png") repeat-x;
}
#TabsToolbar:not(:-moz-lwtheme):-moz-window-inactive {
background-color: #e2e2e2;
}
.tabbrowser-tabs {
-moz-box-align: stretch;
height: 25px;

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

@ -33,7 +33,7 @@
border-top: @sidebarItemGraphiteFocusedBorderTop@;
}
#placesList > treechildren:-moz-window-inactive::-moz-tree-row(selected) {
window:not([active="true"]) #placesList > treechildren::-moz-tree-row(selected) {
background: @sidebarItemInactiveBackground@;
border-top: @sidebarItemInactiveBorderTop@;
}
@ -103,14 +103,14 @@
inset 0 0 0 20px @toolbarbuttonPressedBackgroundColor@;
}
#placesToolbar > toolbarbutton:-moz-window-inactive {
:root:not([active]) #placesToolbar > toolbarbutton {
border-color: @toolbarbuttonInactiveBorderColor@;
background-image: @toolbarbuttonInactiveBackgroundImage@;
}
#placesToolbar > toolbarbutton[disabled="true"] > .toolbarbutton-icon,
#placesToolbar > toolbarbutton > .toolbarbutton-icon:-moz-window-inactive,
#placesToolbar > toolbarbutton > .toolbarbutton-menu-dropmarker:-moz-window-inactive {
:root:not([active]) #placesToolbar > toolbarbutton > .toolbarbutton-icon,
:root:not([active]) #placesToolbar > toolbarbutton > .toolbarbutton-menu-dropmarker {
opacity: 0.5; /* remove the second and third selector when we support click-through (bug 392188) */
}
@ -177,7 +177,7 @@
/* Search field */
#searchFilter:-moz-window-inactive {
:root:not([active="true"]) #searchFilter {
opacity: 0.7; /* remove this when we support click-through (bug 392188) */
}
@ -200,7 +200,7 @@
border: 0px;
}
#placesList:-moz-window-inactive {
#places:not([active="true"]) > #placesView > #placesList {
background-color: #e8e8e8;
}

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

@ -136,6 +136,7 @@ check::
fi
# try building an x86-64 binary. if that succeeds, try unifying it
# with an i386 binary
rm -f unify-test-x86_64 unify-test-universal-64
-$(HOST_CC) -arch x86_64 $(srcdir)/unify-test.c -o unify-test-x86_64
@if test -f ./unify-test-x86_64; then \
if ! $(srcdir)/macosx/universal/unify ./unify-test-x86_64 ./unify-test-i386 \

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

@ -51,6 +51,10 @@ import sys
import threading
import tempfile
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
sys.path.insert(0, SCRIPT_DIR)
import automationutils
_DEFAULT_WEB_SERVER = "127.0.0.1"
_DEFAULT_HTTP_PORT = 8888
_DEFAULT_SSL_PORT = 4443
@ -74,6 +78,22 @@ _IS_CYGWIN = False
#expand _IS_DEBUG_BUILD = __IS_DEBUG_BUILD__
#expand _CRASHREPORTER = __CRASHREPORTER__ == 1
if _IS_WIN32:
import ctypes, ctypes.wintypes, time, msvcrt
else:
import errno
# We use the logging system here primarily because it'll handle multiple
# threads, which is needed to process the output of the server and application
# processes simultaneously.
_log = logging.getLogger()
handler = logging.StreamHandler(sys.stdout)
_log.setLevel(logging.INFO)
_log.addHandler(handler)
#################
# PROFILE SETUP #
#################
@ -126,26 +146,14 @@ class Automation(object):
IS_DEBUG_BUILD = _IS_DEBUG_BUILD
CRASHREPORTER = _CRASHREPORTER
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
sys.path.insert(0, SCRIPT_DIR)
automationutils = __import__('automationutils')
# timeout, in seconds
DEFAULT_TIMEOUT = 60.0
DEFAULT_WEB_SERVER = _DEFAULT_WEB_SERVER
DEFAULT_HTTP_PORT = _DEFAULT_HTTP_PORT
DEFAULT_SSL_PORT = _DEFAULT_SSL_PORT
log = logging.getLogger()
def __init__(self):
# We use the logging system here primarily because it'll handle multiple
# threads, which is needed to process the output of the server and application
# processes simultaneously.
handler = logging.StreamHandler(sys.stdout)
self.log.setLevel(logging.INFO)
self.log.addHandler(handler)
self.log = _log
def setServerInfo(self, webServer = _DEFAULT_WEB_SERVER, httpPort = _DEFAULT_HTTP_PORT, sslPort = _DEFAULT_SSL_PORT):
self.webServer = webServer
@ -178,6 +186,28 @@ class Automation(object):
It adds a kill() method which allows it to be stopped explicitly.
"""
def __init__(self,
args,
bufsize=0,
executable=None,
stdin=None,
stdout=None,
stderr=None,
preexec_fn=None,
close_fds=False,
shell=False,
cwd=None,
env=None,
universal_newlines=False,
startupinfo=None,
creationflags=0):
subprocess.Popen.__init__(self, args, bufsize, executable,
stdin, stdout, stderr,
preexec_fn, close_fds,
shell, cwd, env,
universal_newlines, startupinfo, creationflags)
self.log = _log
def kill(self):
if Automation().IS_WIN32:
import platform
@ -466,7 +496,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
if env == None:
env = dict(os.environ)
ldLibraryPath = os.path.abspath(os.path.join(self.SCRIPT_DIR, xrePath))
ldLibraryPath = os.path.abspath(os.path.join(SCRIPT_DIR, xrePath))
if self.UNIXISH or self.IS_MAC:
envVar = "LD_LIBRARY_PATH"
if self.IS_MAC:
@ -490,10 +520,6 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
return env
if IS_WIN32:
ctypes = __import__('ctypes')
wintypes = __import__('ctypes.wintypes')
time = __import__('time')
msvcrt = __import__('msvcrt')
PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe
GetLastError = ctypes.windll.kernel32.GetLastError
@ -507,11 +533,11 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
if timeout is None:
# shortcut to allow callers to pass in "None" for no timeout.
return (f.readline(), False)
x = self.msvcrt.get_osfhandle(f.fileno())
l = self.ctypes.c_long()
done = self.time.time() + timeout
while self.time.time() < done:
if self.PeekNamedPipe(x, None, 0, None, self.ctypes.byref(l), None) == 0:
x = msvcrt.get_osfhandle(f.fileno())
l = ctypes.c_long()
done = time.time() + timeout
while time.time() < done:
if self.PeekNamedPipe(x, None, 0, None, ctypes.byref(l), None) == 0:
err = self.GetLastError()
if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE
return ('', False)
@ -521,18 +547,18 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
# we're assuming that the output is line-buffered,
# which is not unreasonable
return (f.readline(), False)
self.time.sleep(0.01)
time.sleep(0.01)
return ('', True)
def isPidAlive(self, pid):
STILL_ACTIVE = 259
PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
pHandle = self.ctypes.windll.kernel32.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid)
pHandle = ctypes.windll.kernel32.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid)
if not pHandle:
return False
pExitCode = ctypes.wintypes.DWORD()
self.ctypes.windll.kernel32.GetExitCodeProcess(pHandle, self.ctypes.byref(pExitCode))
self.ctypes.windll.kernel32.CloseHandle(pHandle)
ctypes.windll.kernel32.GetExitCodeProcess(pHandle, self.ctypes.byref(pExitCode))
ctypes.windll.kernel32.CloseHandle(pHandle)
if (pExitCode.value == STILL_ACTIVE):
return True
else:
@ -540,14 +566,13 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
def killPid(self, pid):
PROCESS_TERMINATE = 0x0001
pHandle = self.ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid)
pHandle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid)
if not pHandle:
return
success = self.ctypes.windll.kernel32.TerminateProcess(pHandle, 1)
self.ctypes.windll.kernel32.CloseHandle(pHandle)
success = ctypes.windll.kernel32.TerminateProcess(pHandle, 1)
ctypes.windll.kernel32.CloseHandle(pHandle)
else:
errno = __import__('errno')
def readWithTimeout(self, f, timeout):
"""Try to read a line of output from the file object |f|. If no output
@ -575,7 +600,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
except OSError, err:
# Catch the errors we might expect from os.kill/os.waitpid,
# and re-raise any others
if err.errno == self.errno.ESRCH or err.errno == self.errno.ECHILD:
if err.errno == errno.ESRCH or err.errno == errno.ECHILD:
return False
raise
@ -761,7 +786,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
# Do a final check for zombie child processes.
self.checkForZombies(processLog)
self.automationutils.checkForCrashes(os.path.join(profileDir, "minidumps"), symbolsPath)
automationutils.checkForCrashes(os.path.join(profileDir, "minidumps"), symbolsPath)
if os.path.exists(processLog):
os.unlink(processLog)

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

@ -67,7 +67,7 @@ ifeq ($(MOZ_BUILD_APP),camino) # {
INSTALLER_DIR = camino/installer
MOZ_PKG_APPNAME = camino
APPNAME = Camino.app
BUILDCONFIG_JAR = Contents/MacOS/chrome/embed.jar
BUILDCONFIG_JAR = Contents/MacOS/chrome/toolkit.jar
else # } {
MOZ_PKG_APPNAME = $(MOZ_APP_NAME)
APPNAME = $(MOZ_APP_DISPLAYNAME)$(DBGTAG).app

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

@ -1,95 +1,7 @@
# ***** 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 the Mozilla Mac OS X Universal Binary Packaging System
#
# The Initial Developer of the Original Code is Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mark Mentovai <mark@moxienet.com> (Original Author)
#
# 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 *****
# ppc/i386 Universal Build mozconfig
# As used here, arguments in $MOZ_BUILD_PROJECTS are suitable as arguments
# to gcc's -arch parameter.
mk_add_options MOZ_BUILD_PROJECTS="ppc i386"
mk_add_options MOZ_UNIFY_BDATE=1
mk_add_options MOZ_POSTFLIGHT_ALL+=build/macosx/universal/flight.mk
DARWIN_VERSION=`uname -r`
ac_add_app_options ppc --target=powerpc-apple-darwin$DARWIN_VERSION
ac_add_app_options i386 --target=i386-apple-darwin$DARWIN_VERSION
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
# $MOZ_BUILD_APP is only defined when sourced by configure. That's not a
# problem, because the variables it affects only need to be set for
# configure.
if test -n "$MOZ_BUILD_APP" ; then
if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "ppc"; then
TARGET_CPU=$MOZ_BUILD_APP
GCC_VERSION=4.2
# It's not strictly necessary to specify -arch during native builds, but it
# makes the merged about:buildconfig easier to follow, and it reduces
# conditionalized differences between builds.
CC="gcc-$GCC_VERSION -arch $TARGET_CPU"
CXX="g++-$GCC_VERSION -arch $TARGET_CPU"
# $HOST_CXX is presently unused. $HOST_CC will only be used during a cross
# compile. Always use the 4.2 compiler, since it will always be present and
# will always work.
HOST_CC=gcc-4.2
HOST_CXX=g++-4.2
# These must be set for cross builds, and don't hurt straight builds.
RANLIB=ranlib
AR=ar
AS=$CC
LD=ld
STRIP="strip -x -S"
NATIVE_CPU=`uname -p`
if test "$NATIVE_CPU" = "powerpc" ; then
NATIVE_CPU=ppc
fi
# Let configure know that we mean business.
if test "$NATIVE_CPU" != "$TARGET_CPU" ; then
CROSS_COMPILE=1
fi
# Each per-CPU build should be entirely oblivious to the fact that a
# universal binary will be produced. The exception is packager.mk, which
# needs to know to look for universal bits when building the .dmg.
UNIVERSAL_BINARY=1
export CC CXX HOST_CC HOST_CXX RANLIB AR AS LD STRIP
fi
fi
. $topsrcdir/build/macosx/universal/mozconfig.common

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

@ -0,0 +1,7 @@
# i386/x86-64 Universal Build mozconfig
# As used here, arguments in $MOZ_BUILD_PROJECTS are suitable as arguments
# to gcc's -arch parameter.
mk_add_options MOZ_BUILD_PROJECTS="i386 x86_64"
. $topsrcdir/build/macosx/universal/mozconfig.common

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

@ -0,0 +1,94 @@
# ***** 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 the Mozilla Mac OS X Universal Binary Packaging System
#
# The Initial Developer of the Original Code is Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mark Mentovai <mark@moxienet.com> (Original Author)
#
# 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 *****
mk_add_options MOZ_UNIFY_BDATE=1
mk_add_options MOZ_POSTFLIGHT_ALL+=build/macosx/universal/flight.mk
DARWIN_VERSION=`uname -r`
ac_add_app_options ppc --target=powerpc-apple-darwin$DARWIN_VERSION
ac_add_app_options i386 --target=i386-apple-darwin$DARWIN_VERSION
ac_add_app_options x86_64 --target=x86_64-apple-darwin$DARWIN_VERSION
ac_add_app_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
ac_add_app_options i386 --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
ac_add_app_options x86_64 --with-macos-sdk=/Developer/SDKs/MacOSX10.6.sdk
# $MOZ_BUILD_APP is only defined when sourced by configure. That's not a
# problem, because the variables it affects only need to be set for
# configure.
if test -n "$MOZ_BUILD_APP" ; then
if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "ppc" -o "$MOZ_BUILD_APP" = "x86_64"; then
TARGET_CPU=$MOZ_BUILD_APP
GCC_VERSION=4.2
# It's not strictly necessary to specify -arch during native builds, but it
# makes the merged about:buildconfig easier to follow, and it reduces
# conditionalized differences between builds.
CC="gcc-$GCC_VERSION -arch $TARGET_CPU"
CXX="g++-$GCC_VERSION -arch $TARGET_CPU"
# $HOST_CXX is presently unused. $HOST_CC will only be used during a cross
# compile. Always use the 4.2 compiler, since it will always be present and
# will always work.
HOST_CC=gcc-4.2
HOST_CXX=g++-4.2
# These must be set for cross builds, and don't hurt straight builds.
RANLIB=ranlib
AR=ar
AS=$CC
LD=ld
STRIP="strip -x -S"
NATIVE_CPU=`$topsrcdir/build/autoconf/config.guess | cut -f1 -d-`
if test "$NATIVE_CPU" = "powerpc" ; then
NATIVE_CPU=ppc
fi
# Let configure know that we mean business.
if test "$NATIVE_CPU" != "$TARGET_CPU" ; then
CROSS_COMPILE=1
fi
# Each per-CPU build should be entirely oblivious to the fact that a
# universal binary will be produced. The exception is packager.mk, which
# needs to know to look for universal bits when building the .dmg.
UNIVERSAL_BINARY=1
export CC CXX HOST_CC HOST_CXX RANLIB AR AS LD STRIP
fi
fi

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

@ -5469,7 +5469,10 @@ dnl ========================================================
dnl = Disable IPC support for tabs and plugins
dnl ========================================================
case "${target}" in
*-apple-darwin*)
powerpc-apple-darwin*)
MOZ_IPC=
;;
i386-apple-darwin*)
MOZ_IPC=
;;
*-wince*)

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

@ -1549,6 +1549,28 @@ public:
}
static void StripNullChars(const nsAString& aInStr, nsAString& aOutStr);
/**
* Creates a structured clone of the given jsval according to the algorithm
* at:
* http://www.whatwg.org/specs/web-apps/current-work/multipage/
* urls.html#safe-passing-of-structured-data
*
* If the function returns a success code then rval is set to point at the
* cloned jsval. rval is not set if the function returns a failure code.
*/
static nsresult CreateStructuredClone(JSContext* cx, jsval val, jsval* rval);
/**
* Reparents the given object and all subobjects to the given scope. Also
* fixes all the prototypes. Assumes obj is properly rooted, that obj has no
* getter functions that can cause side effects, and that the only types of
* objects nested within obj are the types that are cloneable via the
* CreateStructuredClone function above.
*/
static nsresult ReparentClonedObjectToScope(JSContext* cx, JSObject* obj,
JSObject* scope);
private:
static PRBool InitializeEventTable();
@ -1738,9 +1760,6 @@ private:
nsAutoGCRoot NS_AUTO_GCROOT_PASTE(_autoGCRoot_, __LINE__) \
(ptr, result)
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(_class) \
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(_class)
#define NS_INTERFACE_MAP_ENTRY_TEAROFF(_interface, _allocator) \
if (aIID.Equals(NS_GET_IID(_interface))) { \
foundInterface = static_cast<_interface *>(_allocator); \

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

@ -115,19 +115,12 @@ class Link;
} // namespace mozilla
#define NS_IDOCUMENT_IID \
{ 0x94fb5716, 0xff00, 0x4b97, \
{ 0x90, 0x01, 0x91, 0x65, 0x1a, 0x5f, 0xbe, 0x64 } }
{ 0x36f0a42c, 0x089b, 0x4909, \
{ 0xb3, 0xee, 0xc5, 0xa4, 0x00, 0x90, 0x30, 0x02 } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
// Document states
// RTL locale: specific to the XUL localedir attribute
#define NS_DOCUMENT_STATE_RTL_LOCALE (1 << 0)
// Window activation status
#define NS_DOCUMENT_STATE_WINDOW_INACTIVE (1 << 1)
//----------------------------------------------------------------------
// Document interface. This is implemented by all document objects in
@ -684,11 +677,6 @@ public:
nsIContent* aContent2,
PRInt32 aStateMask) = 0;
// Notify that a document state has changed.
// This should only be called by callers whose state is also reflected in the
// implementation of nsDocument::GetDocumentState.
virtual void DocumentStatesChanged(PRInt32 aStateMask) = 0;
// Observation hooks for style data to propagate notifications
// to document observers
virtual void StyleRuleChanged(nsIStyleSheet* aStyleSheet,
@ -1294,13 +1282,6 @@ public:
*/
virtual int GetDocumentLWTheme() { return Doc_Theme_None; }
/**
* Returns the document state.
* Document state bits have the form NS_DOCUMENT_STATE_* and are declared in
* nsIDocument.h.
*/
virtual PRInt32 GetDocumentState() = 0;
/**
* Gets the document's cached pointer to the first <base> element in this
* document which has an href attribute. If the document doesn't contain any
@ -1379,7 +1360,7 @@ protected:
#ifdef MOZ_SMIL
// SMIL Animation Controller, lazily-initialized in GetAnimationController
nsRefPtr<nsSMILAnimationController> mAnimationController;
nsAutoPtr<nsSMILAnimationController> mAnimationController;
#endif // MOZ_SMIL
// Table of element properties for this document.

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

@ -137,7 +137,7 @@ interface nsIDocumentEncoder : nsISupports
* This is a catch-all flag for documents with mixed contents. Beware of
* interoperability issues. See below for other flags which might likely
* do what you want.
* XHTML/HTML output only.
* HTML output only.
*/
const unsigned long OutputEncodeW3CEntities = (1 << 8);
@ -180,7 +180,7 @@ interface nsIDocumentEncoder : nsISupports
* E.g. If set, we'll output &nbsp; if clear, we'll output 0xa0.
* The basic set is just &nbsp; &amp; &lt; &gt; &quot; for interoperability
* with older products that don't support &alpha; and friends.
* XHTML/HTML output only.
* HTML output only.
*/
const unsigned long OutputEncodeBasicEntities = (1 << 14);
@ -188,7 +188,7 @@ interface nsIDocumentEncoder : nsISupports
* Encode entities when outputting to a string.
* The Latin1 entity set additionally includes 8bit accented letters
* between 128 and 255.
* XHTML/HTML output only.
* HTML output only.
*/
const unsigned long OutputEncodeLatin1Entities = (1 << 15);
@ -196,7 +196,7 @@ interface nsIDocumentEncoder : nsISupports
* Encode entities when outputting to a string.
* The HTML entity set additionally includes accented letters, greek
* letters, and other special markup symbols as defined in HTML4.
* XHTML/HTML output only.
* HTML output only.
*/
const unsigned long OutputEncodeHTMLEntities = (1 << 16);

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

@ -118,15 +118,6 @@ public:
nsIContent* aContent2,
PRInt32 aStateMask) = 0;
/**
* Notification that the state of the document has changed.
*
* @param aDocument The document being observed
* @param aStateMask the state that changed
*/
virtual void DocumentStatesChanged(nsIDocument* aDocument,
PRInt32 aStateMask) = 0;
/**
* A StyleSheet has just been added to the document. This method is
* called automatically when a StyleSheet gets added to the
@ -243,8 +234,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
nsIContent* aContent1, \
nsIContent* aContent2, \
PRInt32 aStateMask); \
virtual void DocumentStatesChanged(nsIDocument* aDocument, \
PRInt32 aStateMask); \
virtual void StyleSheetAdded(nsIDocument* aDocument, \
nsIStyleSheet* aStyleSheet, \
PRBool aDocumentSheet); \
@ -295,12 +284,6 @@ _class::ContentStatesChanged(nsIDocument* aDocument, \
nsIContent* aContent2, \
PRInt32 aStateMask) \
{ \
} \
\
void \
_class::DocumentStatesChanged(nsIDocument* aDocument, \
PRInt32 aStateMask) \
{ \
}
#define NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(_class) \

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

@ -46,6 +46,7 @@
#include "nsCOMPtr.h"
#include "nsWrapperCache.h"
#include "nsIProgrammingLanguage.h" // for ::JAVASCRIPT
#include "nsDOMError.h"
class nsIContent;
class nsIDocument;
@ -242,8 +243,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0x7244fd04, 0xa8e9, 0x4839, \
{ 0x92, 0x48, 0xb2, 0xe0, 0xd8, 0xd8, 0x85, 0x0d } }
{ 0xe71b48a8, 0xeead, 0x4320, \
{ 0xb4, 0xb0, 0x15, 0xcd, 0x7c, 0x53, 0x96, 0x8c } }
/**
* An internal interface that abstracts some DOMNode-related parts that both
@ -378,6 +379,38 @@ public:
return IsInDoc() ? GetOwnerDoc() : nsnull;
}
NS_IMETHOD GetNodeType(PRUint16* aNodeType) = 0;
nsINode*
InsertBefore(nsINode *aNewChild, nsINode *aRefChild, nsresult *aReturn)
{
return ReplaceOrInsertBefore(PR_FALSE, aNewChild, aRefChild, aReturn);
}
nsINode*
ReplaceChild(nsINode *aNewChild, nsINode *aOldChild, nsresult *aReturn)
{
return ReplaceOrInsertBefore(PR_TRUE, aNewChild, aOldChild, aReturn);
}
nsINode*
AppendChild(nsINode *aNewChild, nsresult *aReturn)
{
return InsertBefore(aNewChild, nsnull, aReturn);
}
nsresult RemoveChild(nsINode *aOldChild)
{
if (!aOldChild) {
return NS_ERROR_NULL_POINTER;
}
PRInt32 index = IndexOf(aOldChild);
if (index == -1) {
// aOldChild isn't one of our children.
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
return RemoveChildAt(index, PR_TRUE);
}
/**
* Insert a content node at a particular index. This method handles calling
* BindToTree on the child appropriately.
@ -938,6 +971,22 @@ protected:
nsresult GetNextSibling(nsIDOMNode** aNextSibling);
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
nsresult ReplaceOrInsertBefore(PRBool aReplace, nsIDOMNode *aNewChild,
nsIDOMNode *aRefChild, nsIDOMNode **aReturn);
nsINode* ReplaceOrInsertBefore(PRBool aReplace, nsINode *aNewChild,
nsINode *aRefChild, nsresult *aReturn)
{
*aReturn = ReplaceOrInsertBefore(aReplace, aNewChild, aRefChild);
if (NS_FAILED(*aReturn)) {
return nsnull;
}
return aReplace ? aRefChild : aNewChild;
}
virtual nsresult ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
nsINode* aRefChild);
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
nsCOMPtr<nsINodeInfo> mNodeInfo;
enum { PARENT_BIT_INDOCUMENT = 1 << 0, PARENT_BIT_PARENT_IS_CONTENT = 1 << 1 };

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

@ -111,7 +111,7 @@ nsCommentNode::~nsCommentNode()
NS_INTERFACE_TABLE_HEAD(nsCommentNode)
NS_NODE_INTERFACE_TABLE3(nsCommentNode, nsIDOMNode, nsIDOMCharacterData,
nsIDOMComment)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Comment)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Comment)
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)

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

@ -91,7 +91,7 @@ NS_INTERFACE_TABLE_HEAD(nsBaseContentList)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsBaseContentList)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NodeList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NodeList)
NS_INTERFACE_MAP_END
@ -451,7 +451,7 @@ NS_INTERFACE_TABLE_HEAD(nsContentList)
NS_INTERFACE_TABLE_ENTRY(nsContentList, nsIMutationObserver)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ContentList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentList)
NS_INTERFACE_MAP_END_INHERITING(nsBaseContentList)

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

@ -42,6 +42,8 @@
/* A namespace class for static layout utilities. */
#include "jscntxt.h"
#include "nsJSUtils.h"
#include "nsCOMPtr.h"
#include "nsAString.h"
@ -185,6 +187,9 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "mozAutoDocUpdate.h"
#include "imgICache.h"
#include "jsinterp.h"
#include "jsarray.h"
#include "jsdate.h"
#include "jsregexp.h"
const char kLoadAsData[] = "loadAsData";
@ -5394,6 +5399,438 @@ nsContentUtils::StripNullChars(const nsAString& aInStr, nsAString& aOutStr)
}
}
namespace {
const int kCloneStackFrameStackSize = 20;
class CloneStackFrame
{
friend class CloneStack;
public:
// These three jsvals must all stick together as they're treated as a jsval
// array!
jsval source;
jsval clone;
jsval temp;
JSAutoIdArray ids;
jsuint index;
private:
// Only let CloneStack access these.
CloneStackFrame(JSContext* aCx, jsval aSource, jsval aClone, JSIdArray* aIds)
: source(aSource), clone(aClone), temp(JSVAL_NULL), ids(aCx, aIds), index(0),
prevFrame(nsnull), tvrVals(aCx, 3, &source)
{
MOZ_COUNT_CTOR(CloneStackFrame);
}
~CloneStackFrame()
{
MOZ_COUNT_DTOR(CloneStackFrame);
}
CloneStackFrame* prevFrame;
JSAutoTempValueRooter tvrVals;
};
class CloneStack
{
public:
CloneStack(JSContext* cx)
: mCx(cx), mLastFrame(nsnull) {
mObjectSet.Init();
}
~CloneStack() {
while (!IsEmpty()) {
Pop();
}
}
PRBool
Push(jsval source, jsval clone, JSIdArray* ids) {
NS_ASSERTION(!JSVAL_IS_PRIMITIVE(source) && !JSVAL_IS_PRIMITIVE(clone),
"Must be an object!");
if (!ids) {
return PR_FALSE;
}
CloneStackFrame* newFrame;
if (mObjectSet.Count() < kCloneStackFrameStackSize) {
// If the object can fit in our stack space then use that.
CloneStackFrame* buf = reinterpret_cast<CloneStackFrame*>(mStackFrames);
newFrame = new (buf + mObjectSet.Count())
CloneStackFrame(mCx, source, clone, ids);
}
else {
// Use the heap.
newFrame = new CloneStackFrame(mCx, source, clone, ids);
}
mObjectSet.PutEntry(JSVAL_TO_OBJECT(source));
newFrame->prevFrame = mLastFrame;
mLastFrame = newFrame;
return PR_TRUE;
}
CloneStackFrame*
Peek() {
return mLastFrame;
}
void
Pop() {
if (IsEmpty()) {
NS_ERROR("Empty stack!");
return;
}
CloneStackFrame* lastFrame = mLastFrame;
mObjectSet.RemoveEntry(JSVAL_TO_OBJECT(lastFrame->source));
mLastFrame = lastFrame->prevFrame;
if (mObjectSet.Count() >= kCloneStackFrameStackSize) {
// Only delete if this was a heap object.
delete lastFrame;
}
else {
// Otherwise just run the destructor.
lastFrame->~CloneStackFrame();
}
}
PRBool
IsEmpty() {
NS_ASSERTION((!mLastFrame && !mObjectSet.Count()) ||
(mLastFrame && mObjectSet.Count()),
"Hashset is out of sync!");
return mObjectSet.Count() == 0;
}
PRBool
Search(JSObject* obj) {
return !!mObjectSet.GetEntry(obj);
}
private:
JSContext* mCx;
CloneStackFrame* mLastFrame;
nsTHashtable<nsVoidPtrHashKey> mObjectSet;
// Use a char array instead of CloneStackFrame array to prevent the JSAuto*
// helpers from running until we're ready for them.
char mStackFrames[kCloneStackFrameStackSize * sizeof(CloneStackFrame)];
};
struct ReparentObjectData {
ReparentObjectData(JSContext* cx, JSObject* obj)
: cx(cx), obj(obj), ids(nsnull), index(0) { }
~ReparentObjectData() {
if (ids) {
JS_DestroyIdArray(cx, ids);
}
}
JSContext* cx;
JSObject* obj;
JSIdArray* ids;
jsint index;
};
inline nsresult
SetPropertyOnValueOrObject(JSContext* cx,
jsval val,
jsval* rval,
JSObject* obj,
jsid id)
{
NS_ASSERTION((rval && !obj) || (!rval && obj), "Can only clone to one dest!");
if (rval) {
*rval = val;
return NS_OK;
}
if (!JS_DefinePropertyById(cx, obj, id, val, nsnull, nsnull,
JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
inline JSObject*
CreateEmptyObjectOrArray(JSContext* cx,
JSObject* obj)
{
if (JS_IsArrayObject(cx, obj)) {
jsuint length;
if (!JS_GetArrayLength(cx, obj, &length)) {
NS_ERROR("Failed to get array length?!");
return nsnull;
}
return JS_NewArrayObject(cx, length, NULL);
}
return JS_NewObject(cx, NULL, NULL, NULL);
}
nsresult
CloneSimpleValues(JSContext* cx,
jsval val,
jsval* rval,
PRBool* wasCloned,
JSObject* robj = nsnull,
jsid rid = INT_TO_JSID(0))
{
*wasCloned = PR_TRUE;
// No cloning necessary for these non-GC'd jsvals.
if (!JSVAL_IS_GCTHING(val) || JSVAL_IS_NULL(val)) {
return SetPropertyOnValueOrObject(cx, val, rval, robj, rid);
}
// Clone doubles.
if (JSVAL_IS_DOUBLE(val)) {
jsval newVal;
if (!JS_NewDoubleValue(cx, *JSVAL_TO_DOUBLE(val), &newVal)) {
return NS_ERROR_OUT_OF_MEMORY;
}
return SetPropertyOnValueOrObject(cx, newVal, rval, robj, rid);
}
// We'll use immutable strings to prevent copying if we can.
if (JSVAL_IS_STRING(val)) {
if (!JS_MakeStringImmutable(cx, JSVAL_TO_STRING(val))) {
return NS_ERROR_FAILURE;
}
return SetPropertyOnValueOrObject(cx, val, rval, robj, rid);
}
NS_ASSERTION(JSVAL_IS_OBJECT(val), "Not an object!");
JSObject* obj = JSVAL_TO_OBJECT(val);
// See if this JSObject is backed by some C++ object. If it is then we assume
// that it is inappropriate to clone.
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
nsContentUtils::XPConnect()->
GetWrappedNativeOfJSObject(cx, obj, getter_AddRefs(wrapper));
if (wrapper) {
return SetPropertyOnValueOrObject(cx, JSVAL_NULL, rval, robj, rid);
}
// Security wrapped objects are auto-nulled as well.
JSClass* clasp = JS_GET_CLASS(cx, obj);
if ((clasp->flags & JSCLASS_IS_EXTENDED) &&
((JSExtendedClass*)clasp)->wrappedObject) {
return SetPropertyOnValueOrObject(cx, JSVAL_NULL, rval, robj, rid);
}
// Function objects don't get cloned.
if (JS_ObjectIsFunction(cx, obj)) {
return SetPropertyOnValueOrObject(cx, JSVAL_NULL, rval, robj, rid);
}
// Date objects.
if (js_DateIsValid(cx, obj)) {
jsdouble msec = js_DateGetMsecSinceEpoch(cx, obj);
JSObject* newDate;
if (!(msec && (newDate = js_NewDateObjectMsec(cx, msec)))) {
return NS_ERROR_OUT_OF_MEMORY;
}
return SetPropertyOnValueOrObject(cx, OBJECT_TO_JSVAL(newDate), rval, robj,
rid);
}
// RegExp objects.
if (js_ObjectIsRegExp(obj)) {
JSObject* proto;
if (!js_GetClassPrototype(cx, JS_GetScopeChain(cx), JSProto_RegExp,
&proto)) {
return NS_ERROR_FAILURE;
}
JSObject* newRegExp = js_CloneRegExpObject(cx, obj, proto);
if (!newRegExp) {
return NS_ERROR_FAILURE;
}
return SetPropertyOnValueOrObject(cx, OBJECT_TO_JSVAL(newRegExp), rval,
robj, rid);
}
// ImageData is just a normal JSObject with some properties in our impl.
// Do we support File?
// Do we support Blob?
// Do we support FileList?
*wasCloned = PR_FALSE;
return NS_OK;
}
} // anonymous namespace
// static
nsresult
nsContentUtils::CreateStructuredClone(JSContext* cx,
jsval val,
jsval* rval)
{
JSAutoRequest ar(cx);
nsCOMPtr<nsIXPConnect> xpconnect(sXPConnect);
NS_ENSURE_STATE(xpconnect);
PRBool wasCloned;
nsresult rv = CloneSimpleValues(cx, val, rval, &wasCloned);
if (NS_FAILED(rv)) {
return rv;
}
if (wasCloned) {
return NS_OK;
}
NS_ASSERTION(JSVAL_IS_OBJECT(val), "Not an object?!");
JSObject* obj = CreateEmptyObjectOrArray(cx, JSVAL_TO_OBJECT(val));
if (!obj) {
return NS_ERROR_OUT_OF_MEMORY;
}
jsval output = OBJECT_TO_JSVAL(obj);
JSAutoTempValueRooter tvr(cx, output);
CloneStack stack(cx);
if (!stack.Push(val, OBJECT_TO_JSVAL(obj),
JS_Enumerate(cx, JSVAL_TO_OBJECT(val)))) {
return NS_ERROR_OUT_OF_MEMORY;
}
while (!stack.IsEmpty()) {
CloneStackFrame* frame = stack.Peek();
NS_ASSERTION(!!frame->ids &&
frame->ids.length() >= frame->index &&
!JSVAL_IS_PRIMITIVE(frame->source) &&
!JSVAL_IS_PRIMITIVE(frame->clone),
"Bad frame state!");
if (frame->index == frame->ids.length()) {
// Done cloning this object, pop the frame.
stack.Pop();
continue;
}
// Get the current id and increment the index.
jsid id = frame->ids[frame->index++];
if (!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(frame->source), id,
&frame->temp)) {
return NS_ERROR_FAILURE;
}
if (!JSVAL_IS_PRIMITIVE(frame->temp) &&
stack.Search(JSVAL_TO_OBJECT(frame->temp))) {
// Spec says to throw this particular exception for cyclical references.
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
JSObject* clone = JSVAL_TO_OBJECT(frame->clone);
PRBool wasCloned;
nsresult rv = CloneSimpleValues(cx, frame->temp, nsnull, &wasCloned, clone,
id);
if (NS_FAILED(rv)) {
return rv;
}
if (!wasCloned) {
NS_ASSERTION(JSVAL_IS_OBJECT(frame->temp), "Not an object?!");
obj = CreateEmptyObjectOrArray(cx, JSVAL_TO_OBJECT(frame->temp));
if (!obj ||
!stack.Push(frame->temp, OBJECT_TO_JSVAL(obj),
JS_Enumerate(cx, JSVAL_TO_OBJECT(frame->temp)))) {
return NS_ERROR_OUT_OF_MEMORY;
}
// Set the new object as a property of the clone. We'll fill it on the
// next iteration.
if (!JS_DefinePropertyById(cx, clone, id, OBJECT_TO_JSVAL(obj), nsnull,
nsnull, JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
}
}
}
*rval = output;
return NS_OK;
}
// static
nsresult
nsContentUtils::ReparentClonedObjectToScope(JSContext* cx,
JSObject* obj,
JSObject* scope)
{
JSAutoRequest ar(cx);
scope = JS_GetGlobalForObject(cx, scope);
nsAutoTArray<ReparentObjectData, 20> objectData;
objectData.AppendElement(ReparentObjectData(cx, obj));
while (!objectData.IsEmpty()) {
ReparentObjectData& data = objectData[objectData.Length() - 1];
if (!data.ids && !data.index) {
// First, fix the prototype of the object.
JSClass* clasp = JS_GET_CLASS(cx, data.obj);
JSProtoKey protoKey = JSCLASS_CACHED_PROTO_KEY(clasp);
if (!protoKey) {
// We should never be reparenting an object that doesn't have a standard
// proto key.
return NS_ERROR_FAILURE;
}
JSObject* proto;
if (!js_GetClassPrototype(cx, scope, protoKey, &proto) ||
!JS_SetPrototype(cx, data.obj, proto)) {
return NS_ERROR_FAILURE;
}
// Adjust the parent.
if (!JS_SetParent(cx, data.obj, scope)) {
return NS_ERROR_FAILURE;
}
// And now enumerate the object's properties.
if (!(data.ids = JS_Enumerate(cx, data.obj))) {
return NS_ERROR_FAILURE;
}
}
// If we've gone through all the object's properties then we're done with
// this frame.
if (data.index == data.ids->length) {
objectData.RemoveElementAt(objectData.Length() - 1);
continue;
}
// Get the id and increment!
jsid id = data.ids->vector[data.index++];
jsval prop;
if (!JS_GetPropertyById(cx, data.obj, id, &prop)) {
return NS_ERROR_FAILURE;
}
// Push a new frame if this property is an object.
if (!JSVAL_IS_PRIMITIVE(prop)) {
objectData.AppendElement(ReparentObjectData(cx, JSVAL_TO_OBJECT(prop)));
}
}
return NS_OK;
}
#ifdef DEBUG
class DebugWrapperTraversalCallback : public nsCycleCollectionTraversalCallback
{

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

@ -124,7 +124,7 @@ NS_INTERFACE_TABLE_HEAD(nsDOMAttribute)
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Attr)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Attr)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDOMAttribute, nsIDOMAttr)
@ -384,10 +384,7 @@ nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDO
NS_IMETHODIMP
nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(aOldChild);
PRInt32 index = IndexOf(content);
return (index == -1) ? NS_ERROR_DOM_NOT_FOUND_ERR :
RemoveChildAt(index, PR_TRUE);
return nsINode::RemoveChild(aOldChild, aReturn);
}
NS_IMETHODIMP

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

@ -123,7 +123,7 @@ NS_INTERFACE_TABLE_HEAD(nsDOMAttributeMap)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMAttributeMap)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NamedNodeMap)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NamedNodeMap)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMAttributeMap)

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

@ -126,7 +126,7 @@ nsDOMDocumentType::~nsDOMDocumentType()
NS_INTERFACE_TABLE_HEAD(nsDOMDocumentType)
NS_NODE_INTERFACE_TABLE2(nsDOMDocumentType, nsIDOMNode, nsIDOMDocumentType)
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMDocumentType)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DocumentType)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DocumentType)
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
@ -252,7 +252,7 @@ nsDOMDocumentType::BindToTree(nsIDocument *aDocument, nsIContent *aParent,
// case.
// XXX We may want to move this to nsDOMImplementation::CreateDocument if
// we want to rely on the nodeinfo and wrappers being right before
// getting into doReplaceOrInsertBefore or doInsertChildAt. That would
// getting into ReplaceOrInsertBefore or doInsertChildAt. That would
// break inserting DOMDocumentType nodes through other DOM methods
// though.
nsNodeInfoManager *nimgr = aParent ?

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

@ -117,7 +117,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMFileReader)
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_ENTRY(nsICharsetDetectionObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(FileReader)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(FileReader)
NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
NS_IMPL_ADDREF_INHERITED(nsDOMFileReader, nsXHREventTarget)

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

@ -63,7 +63,7 @@ NS_INTERFACE_TABLE_HEAD(nsDOMStringList)
NS_INTERFACE_TABLE_ENTRY(nsDOMStringList, nsIDOMDOMStringList)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMStringList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMStringList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
@ -110,7 +110,7 @@ NS_INTERFACE_TABLE_HEAD(nsNameList)
NS_INTERFACE_TABLE_ENTRY(nsNameList, nsIDOMNameList)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NameList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NameList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP

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

@ -126,7 +126,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMParser)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMParser)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMParser)
NS_INTERFACE_MAP_END

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

@ -63,7 +63,7 @@ nsDOMSerializer::~nsDOMSerializer()
NS_INTERFACE_MAP_BEGIN(nsDOMSerializer)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIDOMSerializer)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XMLSerializer)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLSerializer)
NS_INTERFACE_MAP_END

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

@ -61,7 +61,7 @@ NS_INTERFACE_TABLE_HEAD(nsDOMTokenList)
NS_INTERFACE_TABLE1(nsDOMTokenList,
nsIDOMDOMTokenList)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMTokenList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMTokenList)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsDOMTokenList)

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

@ -485,7 +485,7 @@ NS_INTERFACE_TABLE_HEAD(nsDOMStyleSheetList)
nsIDocumentObserver,
nsIMutationObserver)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(StyleSheetList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StyleSheetList)
NS_INTERFACE_MAP_END
@ -1137,7 +1137,7 @@ NS_INTERFACE_TABLE_HEAD(nsDOMStyleSheetSetList)
NS_INTERFACE_TABLE_ENTRY(nsDOMStyleSheetSetList, nsIDOMDOMStringList)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMStringList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMStringList)
NS_INTERFACE_MAP_END
nsDOMStyleSheetSetList::nsDOMStyleSheetSetList(nsIDocument* aDocument)
@ -1274,7 +1274,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMImplementation)
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMImplementation)
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMImplementation)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDOMImplementation)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMImplementation)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMImplementation)
NS_INTERFACE_MAP_END
@ -4055,16 +4055,6 @@ nsDocument::ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2,
(this, aContent1, aContent2, aStateMask));
}
void
nsDocument::DocumentStatesChanged(PRInt32 aStateMask)
{
// Invalidate our cached state.
mGotDocumentState &= ~aStateMask;
mDocumentState &= ~aStateMask;
NS_DOCUMENT_NOTIFY_OBSERVERS(DocumentStatesChanged, (this, aStateMask));
}
void
nsDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aOldStyleRule,
@ -5555,22 +5545,20 @@ NS_IMETHODIMP
nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn)
{
return nsGenericElement::doReplaceOrInsertBefore(PR_FALSE, aNewChild, aRefChild, nsnull, this,
aReturn);
return ReplaceOrInsertBefore(PR_FALSE, aNewChild, aRefChild, aReturn);
}
NS_IMETHODIMP
nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn)
{
return nsGenericElement::doReplaceOrInsertBefore(PR_TRUE, aNewChild, aOldChild, nsnull, this,
aReturn);
return ReplaceOrInsertBefore(PR_TRUE, aNewChild, aOldChild, aReturn);
}
NS_IMETHODIMP
nsDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsGenericElement::doRemoveChild(aOldChild, nsnull, this, aReturn);
return nsINode::RemoveChild(aOldChild, aReturn);
}
NS_IMETHODIMP
@ -6066,6 +6054,10 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
if (adoptedNode->GetOwnerDoc() != this) {
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}
return CallQueryInterface(adoptedNode, aResult);
}
@ -7625,26 +7617,6 @@ nsDocument::MaybePreLoadImage(nsIURI* uri)
}
}
PRInt32
nsDocument::GetDocumentState()
{
if (!(mGotDocumentState & NS_DOCUMENT_STATE_RTL_LOCALE)) {
if (IsDocumentRightToLeft()) {
mDocumentState |= NS_DOCUMENT_STATE_RTL_LOCALE;
}
mGotDocumentState |= NS_DOCUMENT_STATE_RTL_LOCALE;
}
if (!(mGotDocumentState & NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
nsIPresShell* shell = GetPrimaryShell();
if (shell && shell->GetPresContext() &&
shell->GetPresContext()->IsTopLevelWindowInactive()) {
mDocumentState |= NS_DOCUMENT_STATE_WINDOW_INACTIVE;
}
mGotDocumentState |= NS_DOCUMENT_STATE_WINDOW_INACTIVE;
}
return mDocumentState;
}
namespace {
/**

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

@ -693,7 +693,6 @@ public:
virtual void ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2,
PRInt32 aStateMask);
virtual void DocumentStatesChanged(PRInt32 aStateMask);
virtual void StyleRuleChanged(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aOldStyleRule,
@ -940,8 +939,6 @@ public:
virtual nsISupports* GetCurrentContentSink();
virtual PRInt32 GetDocumentState();
virtual void RegisterFileDataUri(nsACString& aUri);
protected:
@ -1137,9 +1134,6 @@ protected:
nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
PRInt32 mDocumentState;
PRInt32 mGotDocumentState;
private:
friend class nsUnblockOnloadEvent;

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

@ -198,7 +198,7 @@ nsDocumentFragment::IsNodeOfType(PRUint32 aFlags) const
NS_INTERFACE_TABLE_HEAD(nsDocumentFragment)
NS_NODE_INTERFACE_TABLE2(nsDocumentFragment, nsIDOMNode,
nsIDOMDocumentFragment)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DocumentFragment)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DocumentFragment)
NS_INTERFACE_MAP_END_INHERITING(nsGenericElement)

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

@ -54,7 +54,7 @@ NS_IMPL_RELEASE(nsFormData)
NS_INTERFACE_MAP_BEGIN(nsFormData)
NS_INTERFACE_MAP_ENTRY(nsIDOMFormData)
NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(FormData)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(FormData)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormData)
NS_INTERFACE_MAP_END

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

@ -567,6 +567,38 @@ nsINode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
return ownerDoc ? CallQueryInterface(ownerDoc, aOwnerDocument) : NS_OK;
}
nsresult
nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsIDOMNode* aNewChild,
nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
{
nsCOMPtr<nsINode> newChild = do_QueryInterface(aNewChild);
nsresult rv;
nsCOMPtr<nsINode> refChild;
if (aRefChild) {
refChild = do_QueryInterface(aRefChild, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
rv = ReplaceOrInsertBefore(aReplace, newChild, refChild);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*aReturn = aReplace ? aRefChild : aNewChild);
}
return rv;
}
nsresult
nsINode::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
nsCOMPtr<nsIContent> oldChild = do_QueryInterface(aOldChild);
nsresult rv = RemoveChild(oldChild);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*aReturn = aOldChild);
}
return rv;
}
//----------------------------------------------------------------------
PRInt32
@ -611,7 +643,7 @@ NS_INTERFACE_TABLE_HEAD(nsChildContentList)
NS_INTERFACE_TABLE_ENTRY(nsChildContentList, nsIDOMNodeList)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NodeList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NodeList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
@ -3516,45 +3548,22 @@ nsGenericElement::SaveSubtreeState()
// Generic DOMNode implementations
/*
* This helper function checks if aChild is the same as aNode or if
* aChild is one of aNode's ancestors. -- jst@citec.fi
*/
NS_IMETHODIMP
nsGenericElement::InsertBefore(nsIDOMNode *aNewChild, nsIDOMNode *aRefChild,
nsIDOMNode **aReturn)
{
return doReplaceOrInsertBefore(PR_FALSE, aNewChild, aRefChild, this, GetCurrentDoc(),
aReturn);
}
NS_IMETHODIMP
nsGenericElement::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn)
{
return doReplaceOrInsertBefore(PR_TRUE, aNewChild, aOldChild, this, GetCurrentDoc(),
aReturn);
}
NS_IMETHODIMP
nsGenericElement::RemoveChild(nsIDOMNode *aOldChild, nsIDOMNode **aReturn)
{
return doRemoveChild(aOldChild, this, GetCurrentDoc(),
aReturn);
}
// When replacing, aRefContent is the content being replaced; when
// inserting it's the content before which we're inserting. In the
// latter case it may be null.
static
PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
nsIContent* aParent, nsIDocument* aDocument,
PRBool aIsReplace, nsIContent* aRefContent)
nsINode* aParent, PRBool aIsReplace,
nsIContent* aRefContent)
{
NS_PRECONDITION(aNewChild, "Must have new child");
NS_PRECONDITION(!aIsReplace || aRefContent,
"Must have ref content for replace");
NS_PRECONDITION(aParent->IsNodeOfType(nsINode::eDOCUMENT) ||
aParent->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT) ||
aParent->IsNodeOfType(nsINode::eELEMENT),
"Nodes that are not documents, document fragments or "
"elements can't be parents!");
#ifdef DEBUG
PRUint16 debugNodeType = 0;
nsCOMPtr<nsIDOMNode> debugNode(do_QueryInterface(aNewChild));
@ -3581,12 +3590,13 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
return aParent != nsnull;
case nsIDOMNode::ELEMENT_NODE :
{
if (aParent) {
// Always ok to have elements under other elements
if (!aParent->IsNodeOfType(nsINode::eDOCUMENT)) {
// Always ok to have elements under other elements or document fragments
return PR_TRUE;
}
nsIContent* rootContent = aDocument->GetRootContent();
nsIContent* rootContent =
static_cast<nsIDocument*>(aParent)->GetRootContent();
if (rootContent) {
// Already have a documentElement, so this is only OK if we're
// replacing it.
@ -3601,7 +3611,7 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
}
// Now grovel for a doctype
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(aDocument);
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(aParent);
NS_ASSERTION(doc, "Shouldn't happen");
nsCOMPtr<nsIDOMDocumentType> docType;
doc->GetDoctype(getter_AddRefs(docType));
@ -3612,8 +3622,8 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
return PR_TRUE;
}
PRInt32 doctypeIndex = aDocument->IndexOf(docTypeContent);
PRInt32 insertIndex = aDocument->IndexOf(aRefContent);
PRInt32 doctypeIndex = aParent->IndexOf(docTypeContent);
PRInt32 insertIndex = aParent->IndexOf(aRefContent);
// Now we're OK in the following two cases only:
// 1) We're replacing something that's not before the doctype
@ -3623,12 +3633,12 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
}
case nsIDOMNode::DOCUMENT_TYPE_NODE :
{
if (aParent) {
// no doctypes allowed under elements
if (!aParent->IsNodeOfType(nsINode::eDOCUMENT)) {
// doctypes only allowed under documents
return PR_FALSE;
}
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(aDocument);
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(aParent);
NS_ASSERTION(doc, "Shouldn't happen");
nsCOMPtr<nsIDOMDocumentType> docType;
doc->GetDoctype(getter_AddRefs(docType));
@ -3640,7 +3650,8 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
// We don't have a doctype yet. Our one remaining constraint is
// that the doctype must come before the documentElement.
nsIContent* rootContent = aDocument->GetRootContent();
nsIContent* rootContent =
static_cast<nsIDocument*>(aParent)->GetRootContent();
if (!rootContent) {
// It's all good
return PR_TRUE;
@ -3651,8 +3662,8 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
return PR_FALSE;
}
PRInt32 rootIndex = aDocument->IndexOf(rootContent);
PRInt32 insertIndex = aDocument->IndexOf(aRefContent);
PRInt32 rootIndex = aParent->IndexOf(rootContent);
PRInt32 insertIndex = aParent->IndexOf(aRefContent);
// Now we're OK if and only if insertIndex <= rootIndex. Indeed, either
// we end up replacing aRefContent or we end up before it. Either one is
@ -3664,7 +3675,7 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
// Note that for now we only allow nodes inside document fragments if
// they're allowed inside elements. If we ever change this to allow
// doctype nodes in document fragments, we'll need to update this code
if (aParent) {
if (!aParent->IsNodeOfType(nsINode::eDOCUMENT)) {
// All good here
return PR_TRUE;
}
@ -3686,8 +3697,8 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
nsCOMPtr<nsIDOMNode> childNode(do_QueryInterface(childContent));
PRUint16 type;
childNode->GetNodeType(&type);
if (!IsAllowedAsChild(childContent, type, aParent, aDocument,
aIsReplace, aRefContent)) {
if (!IsAllowedAsChild(childContent, type, aParent, aIsReplace,
aRefContent)) {
return PR_FALSE;
}
}
@ -3705,111 +3716,102 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
return PR_FALSE;
}
/* static */
nsresult
nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
nsIDOMNode* aNewChild,
nsIDOMNode* aRefChild,
nsIContent* aParent,
nsIDocument* aDocument,
nsIDOMNode** aReturn)
nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
nsINode* aRefChild)
{
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION(!aParent || aParent->GetCurrentDoc() == aDocument,
"Incorrect aDocument");
*aReturn = nsnull;
if (!aNewChild || (aReplace && !aRefChild)) {
return NS_ERROR_NULL_POINTER;
}
// Keep a strong reference to the node that we'll return to ensure it
// doesn't go away.
nsCOMPtr<nsIDOMNode> returnVal = aReplace ? aRefChild : aNewChild;
nsCOMPtr<nsIContent> refContent;
nsIContent* refContent;
nsresult res = NS_OK;
PRInt32 insPos;
nsINode* container = NODE_FROM(aParent, aDocument);
// Figure out which index to insert at
if (aRefChild) {
refContent = do_QueryInterface(aRefChild);
insPos = container->IndexOf(refContent);
insPos = IndexOf(aRefChild);
if (insPos < 0) {
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
if (aRefChild == aNewChild) {
NS_ADDREF(*aReturn = aNewChild);
return NS_OK;
}
} else {
insPos = container->GetChildCount();
NS_ASSERTION(aRefChild->IsNodeOfType(eCONTENT),
"A child node must be nsIContent!");
refContent = static_cast<nsIContent*>(aRefChild);
}
else {
insPos = GetChildCount();
refContent = nsnull;
}
nsCOMPtr<nsIContent> newContent = do_QueryInterface(aNewChild);
if (!newContent) {
if (!aNewChild->IsNodeOfType(eCONTENT)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsIContent* newContent = static_cast<nsIContent*>(aNewChild);
PRUint16 nodeType = 0;
res = aNewChild->GetNodeType(&nodeType);
NS_ENSURE_SUCCESS(res, res);
// Make sure that the inserted node is allowed as a child of its new parent.
if (!IsAllowedAsChild(newContent, nodeType, aParent, aDocument, aReplace,
refContent)) {
if (!IsAllowedAsChild(newContent, nodeType, this, aReplace, refContent)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsIDocument *doc = GetOwnerDoc();
// DocumentType nodes are the only nodes that can have a null
// ownerDocument according to the DOM spec, and we need to allow
// inserting them w/o calling AdoptNode().
if (!container->HasSameOwnerDoc(newContent) &&
if (!HasSameOwnerDoc(newContent) &&
(nodeType != nsIDOMNode::DOCUMENT_TYPE_NODE ||
newContent->GetOwnerDoc())) {
nsCOMPtr<nsIDOM3Document> domDoc = do_QueryInterface(aDocument);
nsCOMPtr<nsIDOM3Document> domDoc = do_QueryInterface(doc);
if (domDoc) {
nsCOMPtr<nsIDOMNode> adoptedKid;
nsresult rv = domDoc->AdoptNode(aNewChild, getter_AddRefs(adoptedKid));
nsresult rv;
nsCOMPtr<nsIDOMNode> newChild = do_QueryInterface(aNewChild, &rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(adoptedKid == aNewChild, "Uh, adopt node changed nodes?");
nsCOMPtr<nsIDOMNode> adoptedKid;
rv = domDoc->AdoptNode(newChild, getter_AddRefs(adoptedKid));
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(adoptedKid == newChild, "Uh, adopt node changed nodes?");
NS_ASSERTION(HasSameOwnerDoc(newContent) && doc == GetOwnerDoc(),
"ownerDocument changed again after adopting!");
}
}
// We want an update batch when we expect several mutations to be performed,
// which is when we're replacing a node, or when we're inserting a fragment.
mozAutoDocConditionalContentUpdateBatch batch(aDocument,
mozAutoDocConditionalContentUpdateBatch batch(GetCurrentDoc(),
aReplace || nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE);
// If we're replacing
if (aReplace) {
// Getting (and addrefing) the following child here is sort of wasteful
// in the common case, but really, it's not that expensive. Get over it.
refContent = container->GetChildAt(insPos + 1);
refContent = GetChildAt(insPos + 1);
nsMutationGuard guard;
res = container->RemoveChildAt(insPos, PR_TRUE);
res = RemoveChildAt(insPos, PR_TRUE);
NS_ENSURE_SUCCESS(res, res);
if (guard.Mutated(1)) {
insPos = refContent ? container->IndexOf(refContent) :
container->GetChildCount();
insPos = refContent ? IndexOf(refContent) : GetChildCount();
if (insPos < 0) {
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
// Passing PR_FALSE for aIsReplace since we now have removed the node
// to be replaced.
if (!IsAllowedAsChild(newContent, nodeType, aParent, aDocument,
PR_FALSE, refContent)) {
if (!IsAllowedAsChild(newContent, nodeType, this, PR_FALSE, refContent)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
}
@ -3824,8 +3826,6 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
PRUint32 count = newContent->GetChildCount();
if (!count) {
returnVal.swap(*aReturn);
return NS_OK;
}
@ -3854,26 +3854,29 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
mutated = mutated || guard.Mutated(1);
}
// If we've had any unexpeted mutations so far we need to recheck that
// If we've had any unexpected mutations so far we need to recheck that
// the child can still be inserted.
if (mutated) {
for (i = 0; i < count; ++i) {
// Get the n:th child from the array.
nsIContent* childContent = fragChildren[i];
if (!HasSameOwnerDoc(childContent) ||
doc != childContent->GetOwnerDoc()) {
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}
nsCOMPtr<nsIDOMNode> tmpNode = do_QueryInterface(childContent);
PRUint16 tmpType = 0;
tmpNode->GetNodeType(&tmpType);
if (childContent->GetNodeParent() ||
!IsAllowedAsChild(childContent, tmpType, aParent, aDocument, PR_FALSE,
!IsAllowedAsChild(childContent, tmpType, this, PR_FALSE,
refContent)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
}
insPos = refContent ? container->IndexOf(refContent) :
container->GetChildCount();
insPos = refContent ? IndexOf(refContent) : GetChildCount();
if (insPos < 0) {
// Someone seriously messed up the childlist. We have no idea
// where to insert the remaining children, so just bail.
@ -3881,7 +3884,7 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
}
}
PRBool appending = aParent && (insPos == container->GetChildCount());
PRBool appending = !IsNodeOfType(eDOCUMENT) && insPos == GetChildCount();
PRBool firstInsPos = insPos;
// Iterate through the fragment's children, and insert them in the new
@ -3891,27 +3894,27 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
// XXXbz how come no reparenting here? That seems odd...
// Insert the child.
res = container->InsertChildAt(childContent, insPos, PR_FALSE);
res = InsertChildAt(childContent, insPos, PR_FALSE);
if (NS_FAILED(res)) {
// Make sure to notify on any children that we did succeed to insert
if (appending && i != 0) {
nsNodeUtils::ContentAppended(aParent, firstInsPos);
nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this),
firstInsPos);
}
return res;
}
if (!appending) {
nsNodeUtils::ContentInserted(container, childContent, insPos);
nsNodeUtils::ContentInserted(this, childContent, insPos);
}
}
// Notify
if (appending) {
nsNodeUtils::ContentAppended(aParent, firstInsPos);
nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this), firstInsPos);
}
// Fire mutation events. Optimize for the case when there are no listeners
nsIDocument* doc = container->GetOwnerDoc();
nsPIDOMWindow* window = nsnull;
if (doc && (window = doc->GetInnerWindow()) &&
window->HasMutationListeners(NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
@ -3920,13 +3923,13 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
nsIContent* childContent = fragChildren[i];
if (nsContentUtils::HasMutationListeners(childContent,
NS_EVENT_BITS_MUTATION_NODEINSERTED, container)) {
mozAutoRemovableBlockerRemover blockerRemover(container->GetOwnerDoc());
NS_EVENT_BITS_MUTATION_NODEINSERTED, this)) {
mozAutoRemovableBlockerRemover blockerRemover(doc);
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEINSERTED);
mutation.mRelatedNode = do_QueryInterface(container);
mutation.mRelatedNode = do_QueryInterface(this);
mozAutoSubtreeModified subtree(container->GetOwnerDoc(), container);
mozAutoSubtreeModified subtree(doc, this);
nsEventDispatcher::Dispatch(childContent, nsnull, &mutation);
}
}
@ -3954,7 +3957,7 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
NS_ASSERTION(!(oldParent == container && removeIndex == insPos),
NS_ASSERTION(!(oldParent == this && removeIndex == insPos),
"invalid removeIndex");
nsMutationGuard guard;
@ -3964,13 +3967,16 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
// Adjust insert index if the node we ripped out was a sibling
// of the node we're inserting before
if (oldParent == container && removeIndex < insPos) {
if (oldParent == this && removeIndex < insPos) {
--insPos;
}
if (guard.Mutated(1)) {
insPos = refContent ? container->IndexOf(refContent) :
container->GetChildCount();
if (doc != newContent->GetOwnerDoc()) {
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}
insPos = refContent ? IndexOf(refContent) : GetChildCount();
if (insPos < 0) {
// Someone seriously messed up the childlist. We have no idea
// where to insert the new child, so just bail.
@ -3978,8 +3984,8 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
}
if (newContent->GetNodeParent() ||
!IsAllowedAsChild(newContent, nodeType, aParent, aDocument,
PR_FALSE, refContent)) {
!IsAllowedAsChild(newContent, nodeType, this, PR_FALSE,
refContent)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
}
@ -3990,45 +3996,13 @@ nsGenericElement::doReplaceOrInsertBefore(PRBool aReplace,
// wrapper is not the wrapper for their ownerDocument (XUL elements,
// form controls, ...).
res = container->InsertChildAt(newContent, insPos, PR_TRUE);
res = InsertChildAt(newContent, insPos, PR_TRUE);
NS_ENSURE_SUCCESS(res, res);
}
returnVal.swap(*aReturn);
return res;
}
/* static */
nsresult
nsGenericElement::doRemoveChild(nsIDOMNode* aOldChild, nsIContent* aParent,
nsIDocument* aDocument, nsIDOMNode** aReturn)
{
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION(!aParent || aParent->GetCurrentDoc() == aDocument,
"Incorrect aDocument");
*aReturn = nsnull;
NS_ENSURE_TRUE(aOldChild, NS_ERROR_NULL_POINTER);
nsINode* container = NODE_FROM(aParent, aDocument);
nsCOMPtr<nsIContent> content = do_QueryInterface(aOldChild);
// fix children to be a passed argument
PRInt32 index = container->IndexOf(content);
if (index == -1) {
// aOldChild isn't one of our children.
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
nsresult rv = container->RemoveChildAt(index, PR_TRUE);
*aReturn = aOldChild;
NS_ADDREF(aOldChild);
return rv;
}
//----------------------------------------------------------------------
// nsISupports implementation

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

@ -493,12 +493,21 @@ public:
const nsAString& aVersion, PRBool* aReturn);
NS_IMETHOD HasAttributes(PRBool* aHasAttributes);
NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes);
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn);
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn);
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(PR_FALSE, aNewChild, aRefChild, aReturn);
}
nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn)
{
return ReplaceOrInsertBefore(PR_TRUE, aNewChild, aOldChild, aReturn);
}
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsINode::RemoveChild(aOldChild, aReturn);
}
nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return InsertBefore(aNewChild, nsnull, aReturn);
}
@ -589,39 +598,6 @@ public:
static PRBool ShouldBlur(nsIContent *aContent);
/**
* Actual implementation of the DOM InsertBefore and ReplaceChild methods.
* Shared by nsDocument. When called from nsDocument, aParent will be null.
*
* @param aReplace True if aNewChild should replace aRefChild. False if
* aNewChild should be inserted before aRefChild.
* @param aNewChild The child to insert
* @param aRefChild The child to insert before or replace
* @param aParent The parent to use for the new child
* @param aDocument The document to use for the new child.
* Must be non-null, if aParent is null and must match
* aParent->GetCurrentDoc() if aParent is not null.
* @param aReturn [out] the child we insert
*/
static nsresult doReplaceOrInsertBefore(PRBool aReplace, nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIContent* aParent, nsIDocument* aDocument,
nsIDOMNode** aReturn);
/**
* Actual implementation of the DOM RemoveChild method. Shared by
* nsDocument. When called from nsDocument, aParent will be null.
*
* @param aOldChild The child to remove
* @param aParent The parent to use for the new child
* @param aDocument The document to use for the new child.
* Must be non-null if aParent is null and must match
* aParent->GetCurrentDoc() if aParent is not null.
* @param aReturn [out] the child we remove
*/
static nsresult doRemoveChild(nsIDOMNode* aOldChild,
nsIContent* aParent, nsIDocument* aDocument,
nsIDOMNode** aReturn);
/**
* Most of the implementation of the nsINode InsertChildAt method. Shared by
* nsDocument. When called from nsDocument, aParent will be null.

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

@ -393,3 +393,140 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
return NS_OK;
}
static const PRUint16 kValNBSP = 160;
static const char kEntityNBSP[] = "nbsp";
static const PRUint16 kGTVal = 62;
static const char* kEntities[] = {
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "amp", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"lt", "", "gt"
};
static const char* kAttrEntities[] = {
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "quot", "", "", "", "amp", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"lt", "", "gt"
};
void
nsHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr)
{
if (mBodyOnly && !mInBody) {
return;
}
if (mDisableEntityEncoding) {
aOutputStr.Append(aStr);
return;
}
if (mFlags & (nsIDocumentEncoder::OutputEncodeBasicEntities |
nsIDocumentEncoder::OutputEncodeLatin1Entities |
nsIDocumentEncoder::OutputEncodeHTMLEntities |
nsIDocumentEncoder::OutputEncodeW3CEntities)) {
nsIParserService* parserService = nsContentUtils::GetParserService();
if (!parserService) {
NS_ERROR("Can't get parser service");
return;
}
nsReadingIterator<PRUnichar> done_reading;
aStr.EndReading(done_reading);
// for each chunk of |aString|...
PRUint32 advanceLength = 0;
nsReadingIterator<PRUnichar> iter;
const char **entityTable = mInAttribute ? kAttrEntities : kEntities;
for (aStr.BeginReading(iter);
iter != done_reading;
iter.advance(PRInt32(advanceLength))) {
PRUint32 fragmentLength = iter.size_forward();
PRUint32 lengthReplaced = 0; // the number of UTF-16 codepoints
// replaced by a particular entity
const PRUnichar* c = iter.get();
const PRUnichar* fragmentStart = c;
const PRUnichar* fragmentEnd = c + fragmentLength;
const char* entityText = nsnull;
nsCAutoString entityReplacement;
char* fullEntityText = nsnull;
advanceLength = 0;
// for each character in this chunk, check if it
// needs to be replaced
for (; c < fragmentEnd; c++, advanceLength++) {
PRUnichar val = *c;
if (val == kValNBSP) {
entityText = kEntityNBSP;
break;
}
else if ((val <= kGTVal) && (entityTable[val][0] != 0)) {
entityText = entityTable[val];
break;
} else if (val > 127 &&
((val < 256 &&
mFlags & nsIDocumentEncoder::OutputEncodeLatin1Entities) ||
mFlags & nsIDocumentEncoder::OutputEncodeHTMLEntities)) {
parserService->HTMLConvertUnicodeToEntity(val, entityReplacement);
if (!entityReplacement.IsEmpty()) {
entityText = entityReplacement.get();
break;
}
}
else if (val > 127 &&
mFlags & nsIDocumentEncoder::OutputEncodeW3CEntities &&
mEntityConverter) {
if (NS_IS_HIGH_SURROGATE(val) &&
c + 1 < fragmentEnd &&
NS_IS_LOW_SURROGATE(*(c + 1))) {
PRUint32 valUTF32 = SURROGATE_TO_UCS4(val, *(++c));
if (NS_SUCCEEDED(mEntityConverter->ConvertUTF32ToEntity(valUTF32,
nsIEntityConverter::entityW3C, &fullEntityText))) {
lengthReplaced = 2;
break;
}
else {
advanceLength++;
}
}
else if (NS_SUCCEEDED(mEntityConverter->ConvertToEntity(val,
nsIEntityConverter::entityW3C,
&fullEntityText))) {
lengthReplaced = 1;
break;
}
}
}
aOutputStr.Append(fragmentStart, advanceLength);
if (entityText) {
aOutputStr.Append(PRUnichar('&'));
AppendASCIItoUTF16(entityText, aOutputStr);
aOutputStr.Append(PRUnichar(';'));
advanceLength++;
}
// if it comes from nsIEntityConverter, it already has '&' and ';'
else if (fullEntityText) {
AppendASCIItoUTF16(fullEntityText, aOutputStr);
nsMemory::Free(fullEntityText);
advanceLength += lengthReplaced;
}
}
} else {
nsXMLContentSerializer::AppendAndTranslateEntities(aStr, aOutputStr);
}
}

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

@ -74,6 +74,10 @@ class nsHTMLContentSerializer : public nsXHTMLContentSerializer {
const nsAString& aTagNamespaceURI,
nsIAtom* aTagName,
nsAString& aStr);
virtual void AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr);
};
nsresult

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

@ -236,7 +236,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeIterator)
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeIterator)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNodeIterator)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NodeIterator)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NodeIterator)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeIterator)

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

@ -41,16 +41,14 @@
#include "nsDOMAttributeMap.h"
#include "nsIDOMNode.h"
#include "nsIMutationObserver.h"
#include "nsINode.h"
struct JSContext;
struct JSObject;
class nsINode;
class nsNodeInfoManager;
class nsIVariant;
class nsIDOMUserDataHandler;
template<class E> class nsCOMArray;
class nsCycleCollectionTraversalCallback;
struct CharacterDataChangeInfo;
class nsNodeUtils
{
@ -193,8 +191,14 @@ public:
JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties)
{
return CloneAndAdopt(aNode, PR_FALSE, PR_TRUE, aNewNodeInfoManager, aCx,
aOldScope, aNewScope, aNodesWithProperties, nsnull);
nsresult rv = CloneAndAdopt(aNode, PR_FALSE, PR_TRUE, aNewNodeInfoManager,
aCx, aOldScope, aNewScope, aNodesWithProperties,
nsnull);
if (NS_SUCCEEDED(rv)) {
nsMutationGuard::DidMutate();
}
return rv;
}
/**

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

@ -245,7 +245,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsRange)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSRange)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRange)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Range)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Range)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsRange)

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

@ -158,7 +158,7 @@ NS_INTERFACE_TABLE_HEAD(nsTextNode)
nsIDOMCharacterData)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Text, new nsText3Tearoff(this))
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsTextNode)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Text)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Text)
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
NS_IMETHODIMP

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

@ -81,7 +81,7 @@ NS_IMPL_CYCLE_COLLECTION_3(nsTreeWalker, mFilter, mCurrentNode, mRoot)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTreeWalker)
NS_INTERFACE_MAP_ENTRY(nsIDOMTreeWalker)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTreeWalker)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(TreeWalker)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TreeWalker)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTreeWalker)

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

@ -659,31 +659,6 @@ nsXHTMLContentSerializer::AppendToString(const nsAString& aStr,
nsXMLContentSerializer::AppendToString(aStr, aOutputStr);
}
static const PRUint16 kValNBSP = 160;
static const char kEntityNBSP[] = "nbsp";
static const PRUint16 kGTVal = 62;
static const char* kEntities[] = {
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "amp", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"lt", "", "gt"
};
static const char* kAttrEntities[] = {
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "quot", "", "", "", "amp", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"lt", "", "gt"
};
void
nsXHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr)
@ -696,105 +671,8 @@ nsXHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
aOutputStr.Append(aStr);
return;
}
if (mFlags & (nsIDocumentEncoder::OutputEncodeBasicEntities |
nsIDocumentEncoder::OutputEncodeLatin1Entities |
nsIDocumentEncoder::OutputEncodeHTMLEntities |
nsIDocumentEncoder::OutputEncodeW3CEntities)) {
nsIParserService* parserService = nsContentUtils::GetParserService();
if (!parserService) {
NS_ERROR("Can't get parser service");
return;
}
nsReadingIterator<PRUnichar> done_reading;
aStr.EndReading(done_reading);
// for each chunk of |aString|...
PRUint32 advanceLength = 0;
nsReadingIterator<PRUnichar> iter;
const char **entityTable = mInAttribute ? kAttrEntities : kEntities;
for (aStr.BeginReading(iter);
iter != done_reading;
iter.advance(PRInt32(advanceLength))) {
PRUint32 fragmentLength = iter.size_forward();
PRUint32 lengthReplaced = 0; // the number of UTF-16 codepoints
// replaced by a particular entity
const PRUnichar* c = iter.get();
const PRUnichar* fragmentStart = c;
const PRUnichar* fragmentEnd = c + fragmentLength;
const char* entityText = nsnull;
nsCAutoString entityReplacement;
char* fullEntityText = nsnull;
advanceLength = 0;
// for each character in this chunk, check if it
// needs to be replaced
for (; c < fragmentEnd; c++, advanceLength++) {
PRUnichar val = *c;
if (val == kValNBSP) {
entityText = kEntityNBSP;
break;
}
else if ((val <= kGTVal) && (entityTable[val][0] != 0)) {
entityText = entityTable[val];
break;
} else if (val > 127 &&
((val < 256 &&
mFlags & nsIDocumentEncoder::OutputEncodeLatin1Entities) ||
mFlags & nsIDocumentEncoder::OutputEncodeHTMLEntities)) {
parserService->HTMLConvertUnicodeToEntity(val, entityReplacement);
if (!entityReplacement.IsEmpty()) {
entityText = entityReplacement.get();
break;
}
}
else if (val > 127 &&
mFlags & nsIDocumentEncoder::OutputEncodeW3CEntities &&
mEntityConverter) {
if (NS_IS_HIGH_SURROGATE(val) &&
c + 1 < fragmentEnd &&
NS_IS_LOW_SURROGATE(*(c + 1))) {
PRUint32 valUTF32 = SURROGATE_TO_UCS4(val, *(++c));
if (NS_SUCCEEDED(mEntityConverter->ConvertUTF32ToEntity(valUTF32,
nsIEntityConverter::entityW3C, &fullEntityText))) {
lengthReplaced = 2;
break;
}
else {
advanceLength++;
}
}
else if (NS_SUCCEEDED(mEntityConverter->ConvertToEntity(val,
nsIEntityConverter::entityW3C,
&fullEntityText))) {
lengthReplaced = 1;
break;
}
}
}
aOutputStr.Append(fragmentStart, advanceLength);
if (entityText) {
aOutputStr.Append(PRUnichar('&'));
AppendASCIItoUTF16(entityText, aOutputStr);
aOutputStr.Append(PRUnichar(';'));
advanceLength++;
}
// if it comes from nsIEntityConverter, it already has '&' and ';'
else if (fullEntityText) {
AppendASCIItoUTF16(fullEntityText, aOutputStr);
nsMemory::Free(fullEntityText);
advanceLength += lengthReplaced;
}
}
} else {
nsXMLContentSerializer::AppendAndTranslateEntities(aStr, aOutputStr);
}
nsXMLContentSerializer::AppendAndTranslateEntities(aStr, aOutputStr);
}
PRBool

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

@ -619,7 +619,7 @@ nsXMLHttpRequestUpload::~nsXMLHttpRequestUpload()
NS_INTERFACE_MAP_BEGIN(nsXMLHttpRequestUpload)
NS_INTERFACE_MAP_ENTRY(nsIXMLHttpRequestUpload)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XMLHttpRequestUpload)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpRequestUpload)
NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
NS_IMPL_ADDREF_INHERITED(nsXMLHttpRequestUpload, nsXHREventTarget)
@ -1025,7 +1025,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXMLHttpRequest)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XMLHttpRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpRequest)
NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
NS_IMPL_ADDREF_INHERITED(nsXMLHttpRequest, nsXHREventTarget)
@ -3278,7 +3278,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpProgressEvent)
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMProgressEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMLSProgressEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XMLHttpProgressEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpProgressEvent)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXMLHttpProgressEvent)

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

@ -358,6 +358,9 @@ _TEST_FILES = test_bug5141.html \
file_CSP_evalscript_main.js \
test_bug540854.html \
bug540854.sjs \
test_bug548463.html \
test_bug545644.html \
test_bug545644.xhtml \
$(NULL)
# This test fails on the Mac for some reason

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

@ -6,7 +6,7 @@
</head>
<body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; &quot; for interoperability with older products that don't support &alpha; and friends.</p>
<p>The basic set is just "&nbsp;" &amp; &lt; &gt; &quot; for interoperability with older products that don't support &alpha; and friends.</p>
<p>latin1 &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml; &copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2; &sup3; &acute;
&micro; &para; &middot; &cedil; &sup1; &ordm; &raquo; &frac14; &frac12; &frac34; &iquest; &Agrave; &Aacute; &Acirc; &Atilde; &Auml; &Aring; &AElig;

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

@ -7,8 +7,8 @@
</head>
<body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support α and friends.</p>
<p>The basic set is just " " &amp; &lt; &gt; " for interoperability with
older products that don't support α and friends.</p>
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´
µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ

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

@ -61,7 +61,7 @@ function testHtmlSerializer_1 () {
//------------ OutputEncodeW3CEntities
encoder.init(doc, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputEncodeW3CEntities);
out = encoder.encodeToString();
expected = loadFileContent("file_xhtmlserializer_2_entw3c.xhtml");
expected = loadFileContent("file_xhtmlserializer_2_basic.xhtml");
is(out, expected, "test OutputEncodeW3CEntities");
//------------ OutputEncodeBasicEntities
@ -73,13 +73,13 @@ function testHtmlSerializer_1 () {
//------------ OutputEncodeLatin1Entities
encoder.init(doc, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputEncodeLatin1Entities);
out = encoder.encodeToString();
expected = loadFileContent("file_xhtmlserializer_2_latin1.xhtml");
expected = loadFileContent("file_xhtmlserializer_2_basic.xhtml");
is(out, expected, "test OutputEncodeLatin1Entities");
//------------ OutputEncodeHTMLEntities
encoder.init(doc, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputEncodeHTMLEntities);
out = encoder.encodeToString();
expected = loadFileContent("file_xhtmlserializer_2_enthtml.xhtml");
expected = loadFileContent("file_xhtmlserializer_2_basic.xhtml");
is(out, expected, "test OutputEncodeHTMLEntities");
// tests on the serialization of selections

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

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<title>Test for HTML serializer + innerHtml, bug 545644</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<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=545644">Mozilla Bug </a>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="text/javascript">
function testInner () {
var div = document.getElementById("test_inner");
try {
div.innerHTML = "some \u00A0 &nbsp; text";
div.innerHTML += "!";
ok (true, "innerHTML in html", "test ok");
} catch (e) {
ok(false, "innerHTML in html", "test failed, unwanted exception "+e);
}
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(testInner);
</script>
</pre>
<div id="test_inner"></div>
</body>
</html>

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

@ -0,0 +1,50 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
-->
<head>
<title>Test for XHTML serializer + innerHtml, bug 545644</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<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=545644">Mozilla Bug </a>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="text/javascript">
function testInner () {
var div = document.getElementById("test_inner");
try {
div.innerHTML = "some \u00A0 &amp;nbsp; text";
ok(false, "innerHTML in xhtml", "test failed, no exception by the parser when giving an unexpected entity"+e);
} catch (e) {
ok (true, "innerHTML in xhtml", "test ok");
}
try {
div.innerHTML = "some \u00A0 text";
div.innerHTML += "!";
ok (true, "innerHTML in xhtml", "test ok");
} catch (e) {
ok(false, "innerHTML in xhtml", "test failed, unexpected exception "+e);
}
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(testInner);
</script>
</pre>
<div id="test_inner"></div>
</body>
</html>

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

@ -0,0 +1,84 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=548463
-->
<head>
<title>Test for Bug 548463</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"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=548463">Mozilla Bug 548463</a>
<p id="display"></p>
<iframe id="otherDoc"></iframe>
<div id="content" style="display: none">
<p id="elem1"></p>
<p id="elem2"></p>
</div>
<div id="otherContent" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 548463 **/
var otherDoc = document.getElementById("otherDoc").contentDocument;
var content = document.getElementById("content");
var elem1 = document.getElementById("elem1");
var elem2 = document.getElementById("elem2");
function testAdoptFromDOMNodeRemoved(nodeToAppend, nodeRemoved, nodeToAdopt)
{
function reparent(event)
{
if (event.target == nodeRemoved) {
nodeRemoved.removeEventListener("DOMNodeRemoved", arguments.callee, false);
otherDoc.adoptNode(nodeToAdopt);
}
}
nodeRemoved.addEventListener("DOMNodeRemoved", reparent, false);
var thrown = false;
try {
document.getElementById("otherContent").appendChild(nodeToAppend);
}
catch (e) {
thrown = true;
}
ok(thrown, "adoptNode while appending should throw");
}
var frag = document.createDocumentFragment();
frag.appendChild(elem1);
frag.appendChild(elem2);
testAdoptFromDOMNodeRemoved(frag, elem1, elem2);
content.appendChild(elem1);
testAdoptFromDOMNodeRemoved(elem1, elem1, content);
content.appendChild(elem1);
var thrown = false;
function changeOwnerDocument()
{
elem1.setUserData("foo", null, null);
otherDoc.adoptNode(elem1);
}
elem1.setUserData("foo", "bar", changeOwnerDocument);
try {
document.adoptNode(elem1);
}
catch (e) {
thrown = true;
}
ok(thrown, "adoptNode while adopting should throw");
</script>
</pre>
</body>
</html>

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

@ -19,11 +19,6 @@
function testCopyPaste () {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// selection of the node
var node = document.getElementById('draggable');
window.getSelection().selectAllChildren(node);
// let's copy the selection
var webnav = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
@ -31,41 +26,97 @@ function testCopyPaste () {
var documentViewer = docShell.contentViewer
.QueryInterface(Components.interfaces.nsIContentViewerEdit);
documentViewer.copySelection();
//--------- now check the content of the clipboard
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
.getService(Components.interfaces.nsIClipboard);
var transferable, node;
var data = {};
var textarea = document.getElementById('input');
// ============ copy paste test from a simple text content to a textarea
// selection of the node
node = document.getElementById('draggable');
window.getSelection().selectAllChildren(node);
// let's copy the selection
documentViewer.copySelection();
is(clipboard.hasDataMatchingFlavors(["text/unicode"], 1,1), true);
is(clipboard.hasDataMatchingFlavors(["text/html"], 1,1), true);
// is the clipboard contain a text/unicode data ?
var transferable = Components.classes['@mozilla.org/widget/transferable;1']
.createInstance(Components.interfaces.nsITransferable);
transferable = Components.classes['@mozilla.org/widget/transferable;1']
.createInstance(Components.interfaces.nsITransferable);
transferable.addDataFlavor("text/unicode");
clipboard.getData(transferable, 1);
var data = {}
transferable.getTransferData ("text/unicode", data, {} ) ;
is (data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
"This is a draggable bit of text.");
"This is a draggable bit of text.",
"text/unicode value in the clipboard");
// is the clipboard contain a text/html data ?
transferable = Components.classes['@mozilla.org/widget/transferable;1']
.createInstance(Components.interfaces.nsITransferable);
.createInstance(Components.interfaces.nsITransferable);
transferable.addDataFlavor("text/html");
clipboard.getData(transferable, 1);
clipboard.getData(transferable, 1);
transferable.getTransferData ("text/html", data, {} ) ;
is (data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
"<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em>\n bit of text.</div>");
"<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em>\n bit of text.</div>",
"text/html value in the clipboard");
//------ let's paste now in the textarea and verify its content
var textarea = document.getElementById('input');
// let's paste now in the textarea and verify its content
textarea.focus();
textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement)
.editor.paste(1);
is(textarea.value, "This is a draggable bit of text.");
is(textarea.value, "This is a draggable bit of text.", "value of the textarea after the paste");
// test copy/paste from/to textarea
var val = "1\n 2\n 3"
// ============ copy paste test from a piece of HTML to a textarea
textarea.blur();
node = document.getElementById('alist');
window.getSelection().selectAllChildren(node);
documentViewer.copySelection();
is(clipboard.hasDataMatchingFlavors(["text/unicode"], 1,1), true);
is(clipboard.hasDataMatchingFlavors(["text/html"], 1,1), true);
// let's verify the clipboard content for the text/unicode flavor
transferable = Components.classes['@mozilla.org/widget/transferable;1']
.createInstance(Components.interfaces.nsITransferable);
transferable.addDataFlavor("text/unicode");
clipboard.getData(transferable, 1);
data = {};
transferable.getTransferData ("text/unicode", data, {} ) ;
is (data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
" bla\n\n * foo\n * bar\n\n",
"text/unicode value in the clipboard (html piece)");
// let's verify the clipboard content for the text/html flavor
transferable = Components.classes['@mozilla.org/widget/transferable;1']
.createInstance(Components.interfaces.nsITransferable);
transferable.addDataFlavor("text/html");
clipboard.getData(transferable, 1);
data = {};
transferable.getTransferData ("text/html", data, {} ) ;
is (data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
"<div id=\"alist\">\n bla\n <ul>\n <li>foo</li>\n <li>bar</li>\n </ul>\n </div>",
"text/html value in the clipboard (html piece)");
// let's paste now in the textarea and verify its content
textarea.value="";
textarea.focus();
textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement)
.editor.paste(1);
is(textarea.value, " bla\n\n * foo\n * bar\n\n", "value of the textarea after the paste (html piece)");
// ============ copy/paste test from/to a textarea
var val = "1\n 2\n 3";
textarea.value=val;
textarea.select();
textarea.editor.copy();
@ -73,6 +124,7 @@ function testCopyPaste () {
textarea.value="";
textarea.editor.paste(1);
is(textarea.value, val);
textarea.value="";
SimpleTest.finish();
}
@ -87,7 +139,15 @@ addLoadEvent(testCopyPaste);
<div>
<div id="draggable" title="title to have a long HTML line">This is a <em>draggable</em> bit of text.</div>
<textarea id="input"></textarea>
<textarea id="input" cols="40" rows="10"></textarea>
<div id="alist">
bla
<ul>
<li>foo</li>
<li>bar</li>
</ul>
</div>
</div>
</body>

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

@ -372,7 +372,7 @@ NS_INTERFACE_MAP_BEGIN(WebGLContext)
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICanvasRenderingContextWebGL)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CanvasRenderingContextWebGL)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContextWebGL)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLBuffer)
@ -381,7 +381,7 @@ NS_IMPL_RELEASE(WebGLBuffer)
NS_INTERFACE_MAP_BEGIN(WebGLBuffer)
NS_INTERFACE_MAP_ENTRY(nsIWebGLBuffer)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLBuffer)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLBuffer)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLTexture)
@ -390,7 +390,7 @@ NS_IMPL_RELEASE(WebGLTexture)
NS_INTERFACE_MAP_BEGIN(WebGLTexture)
NS_INTERFACE_MAP_ENTRY(nsIWebGLTexture)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLTexture)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLTexture)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLProgram)
@ -399,7 +399,7 @@ NS_IMPL_RELEASE(WebGLProgram)
NS_INTERFACE_MAP_BEGIN(WebGLProgram)
NS_INTERFACE_MAP_ENTRY(nsIWebGLProgram)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLProgram)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLProgram)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLShader)
@ -408,7 +408,7 @@ NS_IMPL_RELEASE(WebGLShader)
NS_INTERFACE_MAP_BEGIN(WebGLShader)
NS_INTERFACE_MAP_ENTRY(nsIWebGLShader)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLShader)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLShader)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLFramebuffer)
@ -417,7 +417,7 @@ NS_IMPL_RELEASE(WebGLFramebuffer)
NS_INTERFACE_MAP_BEGIN(WebGLFramebuffer)
NS_INTERFACE_MAP_ENTRY(nsIWebGLFramebuffer)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLFramebuffer)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLFramebuffer)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLRenderbuffer)
@ -426,7 +426,7 @@ NS_IMPL_RELEASE(WebGLRenderbuffer)
NS_INTERFACE_MAP_BEGIN(WebGLRenderbuffer)
NS_INTERFACE_MAP_ENTRY(nsIWebGLRenderbuffer)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLRenderbuffer)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderbuffer)
NS_INTERFACE_MAP_END
/* [noscript] attribute GLuint name; */

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

@ -227,7 +227,7 @@ NS_IMPL_RELEASE(nsCanvasGradient)
NS_INTERFACE_MAP_BEGIN(nsCanvasGradient)
NS_INTERFACE_MAP_ENTRY(nsCanvasGradient)
NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasGradient)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CanvasGradient)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasGradient)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
@ -273,7 +273,7 @@ NS_IMPL_RELEASE(nsCanvasPattern)
NS_INTERFACE_MAP_BEGIN(nsCanvasPattern)
NS_INTERFACE_MAP_ENTRY(nsCanvasPattern)
NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasPattern)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CanvasPattern)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasPattern)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
@ -310,7 +310,7 @@ NS_IMPL_RELEASE(nsTextMetrics)
NS_INTERFACE_MAP_BEGIN(nsTextMetrics)
NS_INTERFACE_MAP_ENTRY(nsTextMetrics)
NS_INTERFACE_MAP_ENTRY(nsIDOMTextMetrics)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(TextMetrics)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TextMetrics)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
@ -672,7 +672,7 @@ NS_INTERFACE_MAP_BEGIN(nsCanvasRenderingContext2D)
NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D)
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCanvasRenderingContext2D)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CanvasRenderingContext2D)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D)
NS_INTERFACE_MAP_END
/**

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

@ -44,7 +44,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMBeforeUnloadEvent, nsDOMEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMBeforeUnloadEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMBeforeUnloadEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(BeforeUnloadEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(BeforeUnloadEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMETHODIMP

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

@ -61,7 +61,7 @@ nsDOMCommandEvent::~nsDOMCommandEvent()
NS_INTERFACE_MAP_BEGIN(nsDOMCommandEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMCommandEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CommandEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CommandEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMCommandEvent, nsDOMEvent)

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

@ -65,7 +65,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMDataContainerEvent, nsDOMEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMDataContainerEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMDataContainerEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DataContainerEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DataContainerEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMETHODIMP

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

@ -72,7 +72,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMDragEvent, nsDOMMouseEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMDragEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMDragEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DragEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DragEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
NS_IMETHODIMP

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

@ -172,7 +172,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Event)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Event)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMEvent)

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

@ -69,7 +69,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMKeyboardEvent, nsDOMUIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMKeyboardEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(KeyboardEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(KeyboardEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_IMETHODIMP

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

@ -51,7 +51,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMMessageEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMessageEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(MessageEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MessageEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMMessageEvent, nsDOMEvent)

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

@ -94,7 +94,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMMouseEvent, nsDOMUIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMMouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSMouseEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(MouseEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MouseEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_IMETHODIMP

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

@ -81,7 +81,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMMouseScrollEvent, nsDOMMouseEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMMouseScrollEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseScrollEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(MouseScrollEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MouseScrollEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
NS_IMETHODIMP

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше