[JAEGER] Merge from Tracemonkey.

This commit is contained in:
David Mandelin 2010-08-30 11:38:48 -07:00
commit cfed7db1c8
1459 changed files with 45272 additions and 17339 deletions

View File

@ -9,7 +9,7 @@
# User files that may appear at the root
^\.mozconfig
^mozconfig
^mozconfig$
^configure$
^config\.cache$
^config\.log$

View File

@ -52,3 +52,4 @@ dba2abb7db57078c5a4810884834d3056a5d56c2 last-mozilla-central
0327e126ea245112c0aa7283fee154e084866fb5 bsmedberg-static-xpcom-registration-base
0327e126ea245112c0aa7283fee154e084866fb5 bsmedberg-static-xpcom-registration-base
2f83edbbeef0de7dd901411d270da61106c8afae bsmedberg-static-xpcom-registration-base
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R12

View File

@ -59,6 +59,7 @@ LOCAL_INCLUDES = -I$(srcdir)/../src
SHARED_LIBRARY_LIBS = \
../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \
../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \
$(NULL)

View File

@ -59,7 +59,7 @@ interface nsIDOMNode;
* if (NS_SUCCEEDED(rv))
* rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
*/
[scriptable, uuid(c68b4386-dca7-4b88-8988-7a95ce7be92f)]
[scriptable, uuid(fd1378c5-c606-4a5e-a321-8e7fc107e5cf)]
interface nsIAccessibleEvent : nsISupports
{
/**
@ -476,7 +476,7 @@ interface nsIAccessibleEvent : nsISupports
* Returns true if the event was caused by explicit user input,
* as opposed to purely originating from a timer or mouse movement
*/
attribute boolean isFromUserInput;
readonly attribute boolean isFromUserInput;
};

View File

@ -62,6 +62,7 @@ DIRS += $(PLATFORM_DIR)
DIRS += \
base \
html \
xpcom \
$(null)
ifdef MOZ_XUL

View File

@ -1050,7 +1050,7 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
}
nsresult
nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
nsresult rv = nsAccessible::HandleAccEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv);
@ -1059,7 +1059,7 @@ nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
}
nsresult
nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
{
nsAccessible *accessible = aEvent->GetAccessible();
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
@ -1097,10 +1097,10 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
if (rootAccWrap && rootAccWrap->mActivated) {
atk_focus_tracker_notify(atkObj);
// Fire state change event for focus
nsRefPtr<nsAccEvent> stateChangeEvent =
new nsAccStateChangeEvent(accessible,
nsIAccessibleStates::STATE_FOCUSED,
PR_FALSE, PR_TRUE);
nsRefPtr<AccEvent> stateChangeEvent =
new AccStateChangeEvent(accessible,
nsIAccessibleStates::STATE_FOCUSED,
PR_FALSE, PR_TRUE);
return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
}
} break;
@ -1130,7 +1130,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
nsAccCaretMoveEvent *caretMoveEvent = downcast_accEvent(aEvent);
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
NS_ASSERTION(caretMoveEvent, "Event needs event data");
if (!caretMoveEvent)
break;
@ -1159,7 +1159,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
PRInt32 rowIndex = tableEvent->GetIndex();
@ -1176,7 +1176,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
PRInt32 rowIndex = tableEvent->GetIndex();
@ -1200,7 +1200,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
PRInt32 colIndex = tableEvent->GetIndex();
@ -1217,7 +1217,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
PRInt32 colIndex = tableEvent->GetIndex();
@ -1320,12 +1320,12 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
}
nsresult
nsAccessibleWrap::FireAtkStateChangeEvent(nsAccEvent *aEvent,
nsAccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
AtkObject *aObject)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
nsAccStateChangeEvent *event = downcast_accEvent(aEvent);
AccStateChangeEvent* event = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
PRUint32 state = event->GetState();
@ -1356,12 +1356,12 @@ nsAccessibleWrap::FireAtkStateChangeEvent(nsAccEvent *aEvent,
}
nsresult
nsAccessibleWrap::FireAtkTextChangedEvent(nsAccEvent *aEvent,
nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
AtkObject *aObject)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_REMOVED/INSERTED\n"));
nsAccTextChangeEvent *event = downcast_accEvent(aEvent);
AccTextChangeEvent* event = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
PRInt32 start = event->GetStartOffset();
@ -1379,7 +1379,7 @@ nsAccessibleWrap::FireAtkTextChangedEvent(nsAccEvent *aEvent,
}
nsresult
nsAccessibleWrap::FireAtkShowHideEvent(nsAccEvent *aEvent,
nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
AtkObject *aObject, PRBool aIsAdded)
{
if (aIsAdded)

View File

@ -100,7 +100,7 @@ public:
// return the atk object for this nsAccessibleWrap
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
virtual nsresult HandleAccEvent(AccEvent* aEvent);
AtkObject * GetAtkObject(void);
static AtkObject * GetAtkObject(nsIAccessible * acc);
@ -118,11 +118,11 @@ public:
}
protected:
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
nsresult FireAtkStateChangeEvent(nsAccEvent *aEvent, AtkObject *aObject);
nsresult FireAtkTextChangedEvent(nsAccEvent *aEvent, AtkObject *aObject);
nsresult FireAtkShowHideEvent(nsAccEvent *aEvent, AtkObject *aObject,
nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
PRBool aIsAdded);
AtkObject *mAtkObject;

View File

@ -20,7 +20,8 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Aaron Leventhal (aaronl@netscape.com)
* Aaron Leventhal <aaronl@netscape.com> <original author>
* Alexander Surkov <surkov.alexander@gmail.com>
*
* 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"),
@ -36,7 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccEvent.h"
#include "AccEvent.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
@ -46,6 +47,7 @@
#ifdef MOZ_XUL
#include "nsXULTreeAccessible.h"
#endif
#include "nsAccEvent.h"
#include "nsIDOMDocument.h"
#include "nsIEventStateManager.h"
@ -55,44 +57,24 @@
#endif
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent
// AccEvent
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent. nsISupports
// AccEvent constructors
NS_IMPL_CYCLE_COLLECTION_CLASS(nsAccEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAccEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAccEvent)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAccessible");
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mAccessible));
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccEvent)
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEvent)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccEvent)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccEvent)
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent. Constructors
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsAccessible *aAccessible,
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
EEventRule aEventRule) :
AccEvent::AccEvent(PRUint32 aEventType, nsAccessible* aAccessible,
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
EEventRule aEventRule) :
mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
mAccessible(aAccessible)
{
CaptureIsFromUserInput(aIsFromUserInput);
}
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsINode *aNode,
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
EEventRule aEventRule) :
AccEvent::AccEvent(PRUint32 aEventType, nsINode* aNode,
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
EEventRule aEventRule) :
mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
mNode(aNode)
{
@ -100,68 +82,10 @@ nsAccEvent::nsAccEvent(PRUint32 aEventType, nsINode *aNode,
}
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent: nsIAccessibleEvent
NS_IMETHODIMP
nsAccEvent::GetIsFromUserInput(PRBool *aIsFromUserInput)
{
*aIsFromUserInput = mIsFromUserInput;
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::SetIsFromUserInput(PRBool aIsFromUserInput)
{
mIsFromUserInput = aIsFromUserInput;
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetEventType(PRUint32 *aEventType)
{
*aEventType = mEventType;
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetAccessible(nsIAccessible **aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nsnull;
NS_IF_ADDREF(*aAccessible = GetAccessible());
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetDOMNode(nsIDOMNode **aDOMNode)
{
NS_ENSURE_ARG_POINTER(aDOMNode);
*aDOMNode = nsnull;
if (!mNode)
mNode = GetNode();
if (mNode)
CallQueryInterface(mNode, aDOMNode);
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument **aDocAccessible)
{
NS_ENSURE_ARG_POINTER(aDocAccessible);
NS_IF_ADDREF(*aDocAccessible = GetDocAccessible());
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent: public methods
// AccEvent public methods
nsAccessible *
nsAccEvent::GetAccessible()
AccEvent::GetAccessible()
{
if (!mAccessible)
mAccessible = GetAccessibleForNode();
@ -170,7 +94,7 @@ nsAccEvent::GetAccessible()
}
nsINode*
nsAccEvent::GetNode()
AccEvent::GetNode()
{
if (!mNode && mAccessible)
mNode = mAccessible->GetNode();
@ -179,7 +103,7 @@ nsAccEvent::GetNode()
}
nsDocAccessible*
nsAccEvent::GetDocAccessible()
AccEvent::GetDocAccessible()
{
nsINode *node = GetNode();
if (node)
@ -188,11 +112,36 @@ nsAccEvent::GetDocAccessible()
return nsnull;
}
already_AddRefed<nsAccEvent>
AccEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccEvent(this);
NS_IF_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent: protected methods
// AccEvent cycle collection
NS_IMPL_CYCLE_COLLECTION_CLASS(AccEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(AccEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(AccEvent)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAccessible");
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mAccessible));
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
////////////////////////////////////////////////////////////////////////////////
// AccEvent protected methods
nsAccessible *
nsAccEvent::GetAccessibleForNode() const
AccEvent::GetAccessibleForNode() const
{
if (!mNode)
return nsnull;
@ -227,7 +176,7 @@ nsAccEvent::GetAccessibleForNode() const
}
void
nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
{
nsINode *targetNode = GetNode();
@ -269,29 +218,26 @@ nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
////////////////////////////////////////////////////////////////////////////////
// nsAccReorderEvent
// AccReorderEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED0(nsAccReorderEvent, nsAccEvent)
nsAccReorderEvent::nsAccReorderEvent(nsAccessible *aAccTarget,
PRBool aIsAsynch,
PRBool aIsUnconditional,
nsINode *aReasonNode) :
nsAccEvent(::nsIAccessibleEvent::EVENT_REORDER, aAccTarget,
aIsAsynch, eAutoDetect, nsAccEvent::eCoalesceFromSameSubtree),
AccReorderEvent::
AccReorderEvent(nsAccessible* aAccTarget, PRBool aIsAsynch,
PRBool aIsUnconditional, nsINode* aReasonNode) :
AccEvent(::nsIAccessibleEvent::EVENT_REORDER, aAccTarget,
aIsAsynch, eAutoDetect, AccEvent::eCoalesceFromSameSubtree),
mUnconditionalEvent(aIsUnconditional), mReasonNode(aReasonNode)
{
}
PRBool
nsAccReorderEvent::IsUnconditionalEvent()
AccReorderEvent::IsUnconditionalEvent()
{
return mUnconditionalEvent;
}
PRBool
nsAccReorderEvent::HasAccessibleInReasonSubtree()
AccReorderEvent::HasAccessibleInReasonSubtree()
{
if (!mReasonNode)
return PR_FALSE;
@ -302,37 +248,34 @@ nsAccReorderEvent::HasAccessibleInReasonSubtree()
////////////////////////////////////////////////////////////////////////////////
// nsAccStateChangeEvent
// AccStateChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
nsIAccessibleStateChangeEvent)
// Note: we pass in eAllowDupes to the base class because we don't currently
// support correct state change coalescence (XXX Bug 569356). Also we need to
// decide how to coalesce events created via accessible (instead of node).
nsAccStateChangeEvent::
nsAccStateChangeEvent(nsAccessible *aAccessible,
PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled, PRBool aIsAsynch,
EIsFromUserInput aIsFromUserInput):
nsAccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsAsynch,
aIsFromUserInput, eAllowDupes),
AccStateChangeEvent::
AccStateChangeEvent(nsAccessible* aAccessible,
PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled, PRBool aIsAsynch,
EIsFromUserInput aIsFromUserInput):
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsAsynch,
aIsFromUserInput, eAllowDupes),
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
{
}
nsAccStateChangeEvent::
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled):
nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
AccStateChangeEvent::
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled):
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
{
}
nsAccStateChangeEvent::
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState) :
nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
AccStateChangeEvent::
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState) :
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
mState(aState), mIsExtraState(aIsExtraState)
{
// Use GetAccessibleForNode() because we do not want to store an accessible
@ -348,37 +291,19 @@ nsAccStateChangeEvent::
}
}
NS_IMETHODIMP
nsAccStateChangeEvent::GetState(PRUint32 *aState)
already_AddRefed<nsAccEvent>
AccStateChangeEvent::CreateXPCOMObject()
{
NS_ENSURE_ARG_POINTER(aState);
*aState = mState;
return NS_OK;
nsAccEvent* event = new nsAccStateChangeEvent(this);
NS_IF_ADDREF(event);
return event;
}
NS_IMETHODIMP
nsAccStateChangeEvent::IsExtraState(PRBool *aIsExtraState)
{
NS_ENSURE_ARG_POINTER(aIsExtraState);
*aIsExtraState = mIsExtraState;
return NS_OK;
}
NS_IMETHODIMP
nsAccStateChangeEvent::IsEnabled(PRBool *aIsEnabled)
{
NS_ENSURE_ARG_POINTER(aIsEnabled);
*aIsEnabled = mIsEnabled;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccTextChangeEvent
// AccTextChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
nsIAccessibleTextChangeEvent)
// Note: we pass in eAllowDupes to the base class because we don't support text
// events coalescence. We fire delayed text change events in nsDocAccessible but
// we continue to base the event off the accessible object rather than just the
@ -387,49 +312,26 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
// if the node was removed from the document. Either way, the AT won't work with
// a defunct accessible so the behaviour should be equivalent.
// XXX revisit this when coalescence is faster (eCoalesceFromSameSubtree)
nsAccTextChangeEvent::
nsAccTextChangeEvent(nsAccessible *aAccessible, PRInt32 aStart,
nsAString& aModifiedText, PRBool aIsInserted,
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput)
: nsAccEvent(aIsInserted ?
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes)
AccTextChangeEvent::
AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
nsAString& aModifiedText, PRBool aIsInserted,
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput)
: AccEvent(aIsInserted ?
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes)
, mStart(aStart)
, mIsInserted(aIsInserted)
, mModifiedText(aModifiedText)
{
}
NS_IMETHODIMP
nsAccTextChangeEvent::GetStart(PRInt32 *aStart)
already_AddRefed<nsAccEvent>
AccTextChangeEvent::CreateXPCOMObject()
{
NS_ENSURE_ARG_POINTER(aStart);
*aStart = mStart;
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::GetLength(PRUint32 *aLength)
{
NS_ENSURE_ARG_POINTER(aLength);
*aLength = GetLength();
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::IsInserted(PRBool *aIsInserted)
{
NS_ENSURE_ARG_POINTER(aIsInserted);
*aIsInserted = mIsInserted;
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
{
aModifiedText = mModifiedText;
return NS_OK;
nsAccEvent* event = new nsAccTextChangeEvent(this);
NS_IF_ADDREF(event);
return event;
}
@ -440,8 +342,8 @@ nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
AccHideEvent::
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode,
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput) :
nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, aTarget, aIsAsynch,
aIsFromUserInput, eCoalesceFromSameSubtree)
AccEvent(nsIAccessibleEvent::EVENT_HIDE, aTarget, aIsAsynch,
aIsFromUserInput, eCoalesceFromSameSubtree)
{
mNode = aTargetNode;
mParent = mAccessible->GetCachedParent();
@ -451,65 +353,50 @@ AccHideEvent::
////////////////////////////////////////////////////////////////////////////////
// nsAccCaretMoveEvent
// AccCaretMoveEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
nsIAccessibleCaretMoveEvent)
nsAccCaretMoveEvent::
nsAccCaretMoveEvent(nsAccessible *aAccessible, PRInt32 aCaretOffset) :
nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, PR_TRUE), // Currently always asynch
AccCaretMoveEvent::
AccCaretMoveEvent(nsAccessible* aAccessible, PRInt32 aCaretOffset) :
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, PR_TRUE), // Currently always asynch
mCaretOffset(aCaretOffset)
{
}
nsAccCaretMoveEvent::
nsAccCaretMoveEvent(nsINode *aNode) :
nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
AccCaretMoveEvent::
AccCaretMoveEvent(nsINode* aNode) :
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
mCaretOffset(-1)
{
}
NS_IMETHODIMP
nsAccCaretMoveEvent::GetCaretOffset(PRInt32* aCaretOffset)
already_AddRefed<nsAccEvent>
AccCaretMoveEvent::CreateXPCOMObject()
{
NS_ENSURE_ARG_POINTER(aCaretOffset);
*aCaretOffset = mCaretOffset;
return NS_OK;
nsAccEvent* event = new nsAccCaretMoveEvent(this);
NS_IF_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccTableChangeEvent
// AccTableChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
nsIAccessibleTableChangeEvent)
nsAccTableChangeEvent::
nsAccTableChangeEvent(nsAccessible *aAccessible, PRUint32 aEventType,
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols, PRBool aIsAsynch):
nsAccEvent(aEventType, aAccessible, aIsAsynch),
AccTableChangeEvent::
AccTableChangeEvent(nsAccessible* aAccessible, PRUint32 aEventType,
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
PRBool aIsAsynch) :
AccEvent(aEventType, aAccessible, aIsAsynch),
mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols)
{
}
NS_IMETHODIMP
nsAccTableChangeEvent::GetRowOrColIndex(PRInt32* aRowOrColIndex)
already_AddRefed<nsAccEvent>
AccTableChangeEvent::CreateXPCOMObject()
{
NS_ENSURE_ARG_POINTER(aRowOrColIndex);
*aRowOrColIndex = mRowOrColIndex;
return NS_OK;
}
NS_IMETHODIMP
nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
{
NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
*aNumRowsOrCols = mNumRowsOrCols;
return NS_OK;
nsAccEvent* event = new nsAccTableChangeEvent(this);
NS_IF_ADDREF(event);
return event;
}

View File

@ -38,13 +38,12 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsAccEvent_H_
#define _nsAccEvent_H_
#include "nsIAccessibleEvent.h"
#ifndef _AccEvent_H_
#define _AccEvent_H_
#include "nsAccessible.h"
class nsAccEvent;
class nsDocAccessible;
// Constants used to point whether the event is from user input.
@ -61,7 +60,7 @@ enum EIsFromUserInput
/**
* Generic accessible event.
*/
class nsAccEvent: public nsIAccessibleEvent
class AccEvent
{
public:
@ -90,22 +89,17 @@ public:
};
// Initialize with an nsIAccessible
nsAccEvent(PRUint32 aEventType, nsAccessible *aAccessible,
PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect,
EEventRule aEventRule = eRemoveDupes);
AccEvent(PRUint32 aEventType, nsAccessible* aAccessible,
PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect,
EEventRule aEventRule = eRemoveDupes);
// Initialize with an nsIDOMNode
nsAccEvent(PRUint32 aEventType, nsINode *aNode, PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect,
EEventRule aEventRule = eRemoveDupes);
virtual ~nsAccEvent() {}
AccEvent(PRUint32 aEventType, nsINode* aNode, PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect,
EEventRule aEventRule = eRemoveDupes);
virtual ~AccEvent() {}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsAccEvent)
NS_DECL_NSIACCESSIBLEEVENT
// nsAccEvent
// AccEvent
PRUint32 GetEventType() const { return mEventType; }
EEventRule GetEventRule() const { return mEventRule; }
PRBool IsAsync() const { return mIsAsync; }
@ -115,6 +109,14 @@ public:
nsDocAccessible* GetDocAccessible();
nsINode* GetNode();
/**
* Create and return an XPCOM object for accessible event object.
*/
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
/**
* Down casting.
*/
enum EventGroup {
eGenericEvent,
eReorderEvent,
@ -131,6 +133,12 @@ public:
return 1U << eGenericEvent;
}
/**
* Reference counting and cycle collection.
*/
NS_INLINE_DECL_REFCOUNTING(AccEvent)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AccEvent)
protected:
/**
* Get an accessible from event target node.
@ -144,7 +152,6 @@ protected:
void CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput);
PRBool mIsFromUserInput;
PRUint32 mEventType;
EEventRule mEventRule;
PRPackedBool mIsAsync;
@ -158,22 +165,20 @@ protected:
/**
* Accessible reorder event.
*/
class nsAccReorderEvent : public nsAccEvent
class AccReorderEvent : public AccEvent
{
public:
nsAccReorderEvent(nsAccessible *aAccTarget, PRBool aIsAsynch,
PRBool aIsUnconditional, nsINode *aReasonNode);
AccReorderEvent(nsAccessible* aAccTarget, PRBool aIsAsynch,
PRBool aIsUnconditional, nsINode* aReasonNode);
NS_DECL_ISUPPORTS_INHERITED
// nsAccEvent
// AccEvent
static const EventGroup kEventGroup = eReorderEvent;
virtual unsigned int GetEventGroups() const
{
return nsAccEvent::GetEventGroups() | (1U << eReorderEvent);
return AccEvent::GetEventGroups() | (1U << eReorderEvent);
}
// nsAccReorderEvent
// AccReorderEvent
/**
* Return true if event is unconditional, i.e. must be fired.
*/
@ -193,31 +198,29 @@ private:
/**
* Accessible state change event.
*/
class nsAccStateChangeEvent: public nsAccEvent,
public nsIAccessibleStateChangeEvent
class AccStateChangeEvent: public AccEvent
{
public:
nsAccStateChangeEvent(nsAccessible *aAccessible,
PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect);
AccStateChangeEvent(nsAccessible* aAccessible,
PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect);
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled);
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled);
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState);
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
// nsAccEvent
static const EventGroup kEventGroup = eStateChangeEvent;
virtual unsigned int GetEventGroups() const
{
return nsAccEvent::GetEventGroups() | (1U << eStateChangeEvent);
return AccEvent::GetEventGroups() | (1U << eStateChangeEvent);
}
// nsAccStateChangeEvent
// AccStateChangeEvent
PRUint32 GetState() const { return mState; }
PRBool IsExtraState() const { return mIsExtraState; }
PRBool IsStateEnabled() const { return mIsEnabled; }
@ -232,29 +235,29 @@ private:
/**
* Accessible text change event.
*/
class nsAccTextChangeEvent: public nsAccEvent,
public nsIAccessibleTextChangeEvent
class AccTextChangeEvent: public AccEvent
{
public:
nsAccTextChangeEvent(nsAccessible *aAccessible, PRInt32 aStart,
nsAString& aModifiedText,
PRBool aIsInserted, PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect);
AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
nsAString& aModifiedText,
PRBool aIsInserted, PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
// nsAccEvent
static const EventGroup kEventGroup = eTextChangeEvent;
virtual unsigned int GetEventGroups() const
{
return nsAccEvent::GetEventGroups() | (1U << eTextChangeEvent);
return AccEvent::GetEventGroups() | (1U << eTextChangeEvent);
}
// nsAccTextChangeEvent
// AccTextChangeEvent
PRInt32 GetStartOffset() const { return mStart; }
PRUint32 GetLength() const { return mModifiedText.Length(); }
PRBool IsTextInserted() const { return mIsInserted; }
void GetModifiedText(nsAString& aModifiedText)
{ aModifiedText = mModifiedText; }
private:
PRInt32 mStart;
@ -268,24 +271,24 @@ private:
/**
* Accessible hide events.
*/
class AccHideEvent : public nsAccEvent
class AccHideEvent : public AccEvent
{
public:
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode,
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput);
// nsAccEvent
// Event
static const EventGroup kEventGroup = eHideEvent;
virtual unsigned int GetEventGroups() const
{
return nsAccEvent::GetEventGroups() | (1U << eHideEvent);
return AccEvent::GetEventGroups() | (1U << eHideEvent);
}
protected:
nsRefPtr<nsAccessible> mParent;
nsRefPtr<nsAccessible> mNextSibling;
nsRefPtr<nsAccessible> mPrevSibling;
nsRefPtr<nsAccTextChangeEvent> mTextChangeEvent;
nsRefPtr<AccTextChangeEvent> mTextChangeEvent;
friend class nsAccEventQueue;
};
@ -294,24 +297,22 @@ protected:
/**
* Accessible caret move event.
*/
class nsAccCaretMoveEvent: public nsAccEvent,
public nsIAccessibleCaretMoveEvent
class AccCaretMoveEvent: public AccEvent
{
public:
nsAccCaretMoveEvent(nsAccessible *aAccessible, PRInt32 aCaretOffset);
nsAccCaretMoveEvent(nsINode *aNode);
AccCaretMoveEvent(nsAccessible* aAccessible, PRInt32 aCaretOffset);
AccCaretMoveEvent(nsINode* aNode);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
// nsAccEvent
static const EventGroup kEventGroup = eCaretMoveEvent;
virtual unsigned int GetEventGroups() const
{
return nsAccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
return AccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
}
// nsAccCaretMoveEvent
// AccCaretMoveEvent
PRInt32 GetCaretOffset() const { return mCaretOffset; }
private:
@ -322,25 +323,23 @@ private:
/**
* Accessible table change event.
*/
class nsAccTableChangeEvent : public nsAccEvent,
public nsIAccessibleTableChangeEvent
class AccTableChangeEvent : public AccEvent
{
public:
nsAccTableChangeEvent(nsAccessible *aAccessible, PRUint32 aEventType,
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
PRBool aIsAsynch);
AccTableChangeEvent(nsAccessible* aAccessible, PRUint32 aEventType,
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
PRBool aIsAsynch);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
// nsAccEvent
static const EventGroup kEventGroup = eTableChangeEvent;
virtual unsigned int GetEventGroups() const
{
return nsAccEvent::GetEventGroups() | (1U << eTableChangeEvent);
return AccEvent::GetEventGroups() | (1U << eTableChangeEvent);
}
// nsAccTableChangeEvent
// AccTableChangeEvent
PRUint32 GetIndex() const { return mRowOrColIndex; }
PRUint32 GetCount() const { return mNumRowsOrCols; }
@ -356,7 +355,7 @@ private:
class downcast_accEvent
{
public:
downcast_accEvent(nsAccEvent *e) : mRawPtr(e) { }
downcast_accEvent(AccEvent* e) : mRawPtr(e) { }
template<class Destination>
operator Destination*() {
@ -368,7 +367,7 @@ public:
}
private:
nsAccEvent *mRawPtr;
AccEvent* mRawPtr;
};
#endif

View File

@ -49,12 +49,12 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
AccCollector.cpp \
AccEvent.cpp \
AccGroupInfo.cpp \
AccIterator.cpp \
filters.cpp \
nsAccDocManager.cpp \
nsAccessNode.cpp \
nsAccEvent.cpp \
nsARIAGridAccessible.cpp \
nsARIAMap.cpp \
nsDocAccessible.cpp \
@ -91,6 +91,7 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(srcdir) \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../html \
-I$(srcdir)/../xul \
-I$(srcdir)/../../../layout/generic \

View File

@ -235,16 +235,16 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
loadType == LOAD_RELOAD_BYPASS_PROXY_AND_CACHE) {
// Fire reload event.
nsRefPtr<nsAccEvent> reloadEvent =
new nsAccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, docAcc);
nsRefPtr<AccEvent> reloadEvent =
new AccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, docAcc);
nsEventShell::FireEvent(reloadEvent);
}
// Fire state busy change event. Use delayed event since we don't care
// actually if event isn't delivered when the document goes away like a shot.
nsRefPtr<nsAccEvent> stateEvent =
new nsAccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
PR_FALSE, PR_TRUE);
nsRefPtr<AccEvent> stateEvent =
new AccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
PR_FALSE, PR_TRUE);
docAcc->FireDelayedAccessibleEvent(stateEvent);
return NS_OK;
@ -378,14 +378,14 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
// Fire complete/load stopped if the load event type is given.
if (aLoadEventType) {
nsRefPtr<nsAccEvent> loadEvent = new nsAccEvent(aLoadEventType, aDocument);
nsRefPtr<AccEvent> loadEvent = new AccEvent(aLoadEventType, aDocument);
docAcc->FireDelayedAccessibleEvent(loadEvent);
}
// Fire busy state change event.
nsRefPtr<nsAccEvent> stateEvent =
new nsAccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
PR_FALSE, PR_FALSE);
nsRefPtr<AccEvent> stateEvent =
new AccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
PR_FALSE, PR_FALSE);
docAcc->FireDelayedAccessibleEvent(stateEvent);
}

View File

@ -386,7 +386,7 @@ private:
} else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD) { \
strEventType.AssignLiteral("reload"); \
} else if (type == nsIAccessibleEvent::EVENT_STATE_CHANGE) { \
nsAccStateChangeEvent *event = downcast_accEvent(aEvent); \
AccStateChangeEvent* event = downcast_accEvent(aEvent); \
if (event->GetState() == nsIAccessibleStates::STATE_BUSY) { \
strEventType.AssignLiteral("busy "); \
if (event->IsStateEnabled()) \

View File

@ -745,6 +745,9 @@ nsAccUtils::GetHeaderCellsFor(nsIAccessibleTable *aTable,
nsCOMPtr<nsIAccessibleTableCell> tableCellAcc =
do_QueryInterface(cell);
// GetCellAt should always return an nsIAccessibleTableCell (XXX Bug 587529)
NS_ENSURE_STATE(tableCellAcc);
PRInt32 origIdx = 1;
if (moveToLeft)
rv = tableCellAcc->GetColumnIndex(&origIdx);

View File

@ -48,6 +48,7 @@
#include "nsDocAccessible.h"
#include "nsEventShell.h"
#include "nsAccEvent.h"
#include "nsAccessibilityService.h"
#include "nsAccTreeWalker.h"
#include "nsRelUtils.h"
@ -1240,7 +1241,7 @@ nsAccessible::GetXULName(nsAString& aLabel)
}
nsresult
nsAccessible::HandleAccEvent(nsAccEvent *aEvent)
nsAccessible::HandleAccEvent(AccEvent* aEvent)
{
NS_ENSURE_ARG_POINTER(aEvent);
@ -1248,7 +1249,20 @@ nsAccessible::HandleAccEvent(nsAccEvent *aEvent)
mozilla::services::GetObserverService();
NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
return obsService->NotifyObservers(aEvent, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
nsCOMPtr<nsISimpleEnumerator> observers;
obsService->EnumerateObservers(NS_ACCESSIBLE_EVENT_TOPIC,
getter_AddRefs(observers));
NS_ENSURE_STATE(observers);
PRBool hasObservers = PR_FALSE;
observers->HasMoreElements(&hasObservers);
if (hasObservers) {
nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
}
return NS_OK;
}
NS_IMETHODIMP

View File

@ -55,7 +55,7 @@
class AccGroupInfo;
class EmbeddedObjCollector;
class nsAccessible;
class nsAccEvent;
class AccEvent;
struct nsRoleMapEntry;
struct nsRect;
@ -303,7 +303,7 @@ public:
* Handle accessible event, i.e. process it, notifies observers and fires
* platform specific event.
*/
virtual nsresult HandleAccEvent(nsAccEvent *aAccEvent);
virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
/**
* Return true if there are accessible children in anonymous content
@ -454,7 +454,7 @@ protected:
*
* @param aEvent the accessible event to fire.
*/
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) = 0;
virtual nsresult FirePlatformEvent(AccEvent* aEvent) = 0;
// Data Members
nsRefPtr<nsAccessible> mParent;

View File

@ -264,8 +264,7 @@ nsCaretAccessible::NormalSelectionChanged(nsIDOMDocument *aDoc,
mLastCaretOffset = caretOffset;
mLastTextAccessible.swap(textAcc);
nsRefPtr<nsAccEvent> event =
new nsAccCaretMoveEvent(textNode);
nsRefPtr<AccEvent> event = new AccCaretMoveEvent(textNode);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
return mRootAccessible->FireDelayedAccessibleEvent(event);
@ -285,9 +284,9 @@ nsCaretAccessible::SpellcheckSelectionChanged(nsIDOMDocument *aDoc,
nsAccUtils::GetTextAccessibleFromSelection(aSel);
NS_ENSURE_STATE(textAcc);
nsRefPtr<nsAccEvent> event =
new nsAccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
textAcc, nsnull);
nsRefPtr<AccEvent> event =
new AccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
textAcc, nsnull);
nsEventShell::FireEvent(event);
return NS_OK;

View File

@ -73,10 +73,13 @@
#include "nsIURI.h"
#include "nsIWebNavigation.h"
#include "nsFocusManager.h"
#include "mozilla/dom/Element.h"
#ifdef MOZ_XUL
#include "nsIXULDocument.h"
#endif
namespace dom = mozilla::dom;
////////////////////////////////////////////////////////////////////////////////
// Static member initialization
@ -608,8 +611,8 @@ nsDocAccessible::Init()
// Fire reorder event to notify new accessible document has been created and
// attached to the tree.
nsRefPtr<nsAccEvent> reorderEvent =
new nsAccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
nsRefPtr<AccEvent> reorderEvent =
new AccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
if (!reorderEvent)
return PR_FALSE;
@ -875,11 +878,11 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) {
// State editable will now be set, readonly is now clear
// Normally we only fire delayed events created from the node, not an
// accessible object. See the nsAccStateChangeEvent constructor for details
// accessible object. See the AccStateChangeEvent constructor for details
// about this exceptional case.
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
PR_TRUE, PR_TRUE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
PR_TRUE, PR_TRUE);
FireDelayedAccessibleEvent(event);
}
@ -895,7 +898,8 @@ NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsDocAccessible)
void
nsDocAccessible::AttributeWillChange(nsIDocument *aDocument,
nsIContent* aContent, PRInt32 aNameSpaceID,
dom::Element* aElement,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute, PRInt32 aModType)
{
// XXX TODO: bugs 381599 467143 472142 472143
@ -905,15 +909,16 @@ nsDocAccessible::AttributeWillChange(nsIDocument *aDocument,
}
void
nsDocAccessible::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
nsDocAccessible::AttributeChanged(nsIDocument *aDocument,
dom::Element* aElement,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType)
{
AttributeChangedImpl(aContent, aNameSpaceID, aAttribute);
AttributeChangedImpl(aElement, aNameSpaceID, aAttribute);
// If it was the focused node, cache the new state
if (aContent == gLastFocusedNode) {
nsAccessible *focusedAccessible = GetAccService()->GetAccessible(aContent);
if (aElement == gLastFocusedNode) {
nsAccessible *focusedAccessible = GetAccService()->GetAccessible(aElement);
if (focusedAccessible)
gLastFocusedAccessiblesState = nsAccUtils::State(focusedAccessible);
}
@ -967,17 +972,17 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
// Note. We use the attribute instead of the disabled state bit because
// ARIA's aria-disabled does not affect the disabled state bit.
nsRefPtr<nsAccEvent> enabledChangeEvent =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::EXT_STATE_ENABLED,
PR_TRUE);
nsRefPtr<AccEvent> enabledChangeEvent =
new AccStateChangeEvent(aContent,
nsIAccessibleStates::EXT_STATE_ENABLED,
PR_TRUE);
FireDelayedAccessibleEvent(enabledChangeEvent);
nsRefPtr<nsAccEvent> sensitiveChangeEvent =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::EXT_STATE_SENSITIVE,
PR_TRUE);
nsRefPtr<AccEvent> sensitiveChangeEvent =
new AccStateChangeEvent(aContent,
nsIAccessibleStates::EXT_STATE_SENSITIVE,
PR_TRUE);
FireDelayedAccessibleEvent(sensitiveChangeEvent);
return;
@ -1028,7 +1033,7 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
// seem right but we had started using it for something else
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
multiSelect->GetNode(),
nsAccEvent::eAllowDupes);
AccEvent::eAllowDupes);
static nsIContent::AttrValuesArray strings[] =
{&nsAccessibilityAtoms::_empty, &nsAccessibilityAtoms::_false, nsnull};
@ -1045,10 +1050,10 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
}
if (aAttribute == nsAccessibilityAtoms::contenteditable) {
nsRefPtr<nsAccEvent> editableChangeEvent =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::EXT_STATE_EDITABLE,
PR_TRUE);
nsRefPtr<AccEvent> editableChangeEvent =
new AccStateChangeEvent(aContent,
nsIAccessibleStates::EXT_STATE_EDITABLE,
PR_TRUE);
FireDelayedAccessibleEvent(editableChangeEvent);
return;
}
@ -1062,19 +1067,17 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
// there is an ARIA role present or not.
if (aAttribute == nsAccessibilityAtoms::aria_required) {
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::STATE_REQUIRED,
PR_FALSE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_REQUIRED,
PR_FALSE);
FireDelayedAccessibleEvent(event);
return;
}
if (aAttribute == nsAccessibilityAtoms::aria_invalid) {
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::STATE_INVALID,
PR_FALSE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_INVALID,
PR_FALSE);
FireDelayedAccessibleEvent(event);
return;
}
@ -1102,10 +1105,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
// We treat aria-expanded as a global ARIA state for historical reasons
if (aAttribute == nsAccessibilityAtoms::aria_expanded) {
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE);
FireDelayedAccessibleEvent(event);
return;
}
@ -1124,8 +1126,8 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
const PRUint32 kState = (aAttribute == nsAccessibilityAtoms::aria_checked) ?
nsIAccessibleStates::STATE_CHECKED :
nsIAccessibleStates::STATE_PRESSED;
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(aContent, kState, PR_FALSE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(aContent, kState, PR_FALSE);
FireDelayedAccessibleEvent(event);
if (aContent == gLastFocusedNode) {
// State changes for MIXED state currently only supported for focused item, because
@ -1138,10 +1140,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
PRBool isMixed =
(nsAccUtils::State(accessible) & nsIAccessibleStates::STATE_MIXED) != 0;
if (wasMixed != isMixed) {
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::STATE_MIXED,
PR_FALSE, isMixed);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_MIXED,
PR_FALSE, isMixed);
FireDelayedAccessibleEvent(event);
}
}
@ -1150,10 +1151,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
}
if (aAttribute == nsAccessibilityAtoms::aria_readonly) {
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(aContent,
nsIAccessibleStates::STATE_READONLY,
PR_FALSE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_READONLY,
PR_FALSE);
FireDelayedAccessibleEvent(event);
return;
}
@ -1272,7 +1272,7 @@ nsDocAccessible::ParentChainChanged(nsIContent *aContent)
#ifdef DEBUG_ACCDOCMGR
nsresult
nsDocAccessible::HandleAccEvent(nsAccEvent *aAccEvent)
nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent)
{
NS_LOG_ACCDOCLOAD_HANDLEEVENT(aAccEvent)
@ -1295,9 +1295,9 @@ nsDocAccessible::FireValueChangeForTextFields(nsAccessible *aAccessible)
return;
// Dependent value change event for text changes in textfields
nsRefPtr<nsAccEvent> valueChangeEvent =
new nsAccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
PR_FALSE, eAutoDetect, nsAccEvent::eRemoveDupes);
nsRefPtr<AccEvent> valueChangeEvent =
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
PR_FALSE, eAutoDetect, AccEvent::eRemoveDupes);
FireDelayedAccessibleEvent(valueChangeEvent);
}
@ -1350,17 +1350,17 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
return;
// Normally we only fire delayed events created from the node, not an
// accessible object. See the nsAccTextChangeEvent constructor for details
// accessible object. See the AccTextChangeEvent constructor for details
// about this exceptional case.
nsRefPtr<nsAccEvent> event =
new nsAccTextChangeEvent(textAccessible, offset + textOffset, text,
aIsInserted, PR_FALSE);
nsRefPtr<AccEvent> event =
new AccTextChangeEvent(textAccessible, offset + textOffset, text,
aIsInserted, PR_FALSE);
FireDelayedAccessibleEvent(event);
FireValueChangeForTextFields(textAccessible);
}
already_AddRefed<nsAccEvent>
already_AddRefed<AccEvent>
nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
nsIContent *aChangeNode,
nsAccessible *aChangeChild,
@ -1427,9 +1427,9 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
if (text.IsEmpty())
return nsnull;
nsAccEvent *event =
new nsAccTextChangeEvent(aContainerAccessible, offset, text,
aIsInserting, aIsAsynch, aIsFromUserInput);
AccEvent* event = new AccTextChangeEvent(aContainerAccessible, offset, text,
aIsInserting, aIsAsynch,
aIsFromUserInput);
NS_IF_ADDREF(event);
return event;
@ -1438,12 +1438,12 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
// nsDocAccessible public member
nsresult
nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
nsAccEvent::EEventRule aAllowDupes,
AccEvent::EEventRule aAllowDupes,
PRBool aIsAsynch,
EIsFromUserInput aIsFromUserInput)
{
nsRefPtr<nsAccEvent> event =
new nsAccEvent(aEventType, aNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
nsRefPtr<AccEvent> event =
new AccEvent(aEventType, aNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
return FireDelayedAccessibleEvent(event);
@ -1451,7 +1451,7 @@ nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
// nsDocAccessible public member
nsresult
nsDocAccessible::FireDelayedAccessibleEvent(nsAccEvent *aEvent)
nsDocAccessible::FireDelayedAccessibleEvent(AccEvent* aEvent)
{
NS_ENSURE_ARG(aEvent);
NS_LOG_ACCDOCLOAD_FIREEVENT(aEvent)
@ -1463,7 +1463,7 @@ nsDocAccessible::FireDelayedAccessibleEvent(nsAccEvent *aEvent)
}
void
nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
nsDocAccessible::ProcessPendingEvent(AccEvent* aEvent)
{
nsAccessible *accessible = aEvent->GetAccessible();
nsINode *node = aEvent->GetNode();
@ -1530,7 +1530,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
// the offset, length and text for the text change.
if (node && node != mDocument) {
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
nsRefPtr<nsAccEvent> textChangeEvent =
nsRefPtr<AccEvent> textChangeEvent =
CreateTextChangeEventForNode(containerAccessible, content, accessible,
PR_TRUE, PR_TRUE, isFromUserInput);
if (textChangeEvent) {
@ -1564,8 +1564,8 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
GetAccService()->GetAccessible(gLastFocusedNode);
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, focusedAcc);
#endif
nsRefPtr<nsAccEvent> caretMoveEvent =
new nsAccCaretMoveEvent(accessible, caretOffset);
nsRefPtr<AccEvent> caretMoveEvent =
new AccCaretMoveEvent(accessible, caretOffset);
if (!caretMoveEvent)
return;
@ -1583,7 +1583,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
// Fire reorder event if it's unconditional (see InvalidateCacheSubtree
// method) or if changed node (that is the reason of this reorder event)
// is accessible or has accessible children.
nsAccReorderEvent *reorderEvent = downcast_accEvent(aEvent);
AccReorderEvent* reorderEvent = downcast_accEvent(aEvent);
if (reorderEvent->IsUnconditionalEvent() ||
reorderEvent->HasAccessibleInReasonSubtree()) {
nsEventShell::FireEvent(aEvent);
@ -1852,7 +1852,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
// nsIAccessibleStates::STATE_INVISIBLE for the event's accessible object.
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SHOW, childNode,
nsAccEvent::eCoalesceFromSameSubtree,
AccEvent::eCoalesceFromSameSubtree,
isAsynch);
// Check to see change occurred in an ARIA menu, and fire
@ -1860,7 +1860,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(childNode);
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_MENUPOPUP) {
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
childNode, nsAccEvent::eRemoveDupes,
childNode, AccEvent::eRemoveDupes,
isAsynch);
}
@ -1869,7 +1869,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
while (PR_TRUE) {
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_ALERT) {
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor,
nsAccEvent::eRemoveDupes, isAsynch);
AccEvent::eRemoveDupes, isAsynch);
break;
}
ancestor = ancestor->GetParent();
@ -1897,10 +1897,9 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
PRBool isUnconditionalEvent = childAccessible ||
aChild && nsAccUtils::HasAccessibleChildren(childNode);
nsRefPtr<nsAccEvent> reorderEvent =
new nsAccReorderEvent(containerAccessible, isAsynch,
isUnconditionalEvent,
aChild ? aChild : nsnull);
nsRefPtr<AccEvent> reorderEvent =
new AccReorderEvent(containerAccessible, isAsynch, isUnconditionalEvent,
aChild ? aChild : nsnull);
NS_ENSURE_TRUE(reorderEvent,);
FireDelayedAccessibleEvent(reorderEvent);
@ -1930,7 +1929,7 @@ nsDocAccessible::FireShowHideEvents(nsINode *aNode,
if (accessible) {
// Found an accessible, so fire the show/hide on it and don't look further
// into this subtree.
nsRefPtr<nsAccEvent> event;
nsRefPtr<AccEvent> event;
if (aDelayedOrNormal == eDelayedEvent &&
aEventType == nsIAccessibleEvent::EVENT_HIDE) {
// Use AccHideEvent for delayed hide events to coalesce text change events
@ -1939,9 +1938,9 @@ nsDocAccessible::FireShowHideEvents(nsINode *aNode,
aIsAsyncChange, aIsFromUserInput);
} else {
event = new nsAccEvent(aEventType, accessible, aIsAsyncChange,
aIsFromUserInput,
nsAccEvent::eCoalesceFromSameSubtree);
event = new AccEvent(aEventType, accessible, aIsAsyncChange,
aIsFromUserInput,
AccEvent::eCoalesceFromSameSubtree);
}
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);

View File

@ -117,7 +117,7 @@ public:
virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
#ifdef DEBUG_ACCDOCMGR
virtual nsresult HandleAccEvent(nsAccEvent *aAccEvent);
virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
#endif
// nsIAccessibleText
@ -151,7 +151,7 @@ public:
* code synchronous with a DOM event
*/
nsresult FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
nsAccEvent::EEventRule aAllowDupes = nsAccEvent::eRemoveDupes,
AccEvent::EEventRule aAllowDupes = AccEvent::eRemoveDupes,
PRBool aIsAsynch = PR_FALSE,
EIsFromUserInput aIsFromUserInput = eAutoDetect);
@ -160,7 +160,7 @@ public:
*
* @param aEvent [in] the event to fire
*/
nsresult FireDelayedAccessibleEvent(nsAccEvent *aEvent);
nsresult FireDelayedAccessibleEvent(AccEvent* aEvent);
/**
* Find the accessible object in the accessibility cache that corresponds to
@ -207,7 +207,7 @@ public:
* Process the event when the queue of pending events is untwisted. Fire
* accessible events as result of the processing.
*/
void ProcessPendingEvent(nsAccEvent* aEvent);
void ProcessPendingEvent(AccEvent* aEvent);
protected:
@ -276,7 +276,7 @@ protected:
* @param aIsAsync [in] whether casual change is async
* @param aIsFromUserInput [in] the event is known to be from user input
*/
already_AddRefed<nsAccEvent>
already_AddRefed<AccEvent>
CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
nsIContent *aChangeNode,
nsAccessible *aAccessible,

View File

@ -47,7 +47,7 @@
////////////////////////////////////////////////////////////////////////////////
void
nsEventShell::FireEvent(nsAccEvent *aEvent)
nsEventShell::FireEvent(AccEvent* aEvent)
{
if (!aEvent)
return;
@ -72,8 +72,8 @@ nsEventShell::FireEvent(PRUint32 aEventType, nsAccessible *aAccessible,
{
NS_ENSURE_TRUE(aAccessible,);
nsRefPtr<nsAccEvent> event = new nsAccEvent(aEventType, aAccessible,
aIsAsynch, aIsFromUserInput);
nsRefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
aIsAsynch, aIsFromUserInput);
FireEvent(event);
}
@ -123,12 +123,7 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAccEventQueue)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mDocument");
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mDocument.get()));
PRUint32 i, length = tmp->mEvents.Length();
for (i = 0; i < length; ++i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvents[i]");
cb.NoteXPCOMChild(tmp->mEvents[i].get());
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_MEMBER(mEvents, AccEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAccEventQueue)
@ -143,7 +138,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccEventQueue)
// nsAccEventQueue: public
void
nsAccEventQueue::Push(nsAccEvent *aEvent)
nsAccEventQueue::Push(AccEvent* aEvent)
{
mEvents.AppendElement(aEvent);
@ -203,15 +198,15 @@ nsAccEventQueue::WillRefresh(mozilla::TimeStamp aTime)
// Process only currently queued events. Newly appended events during events
// flushing won't be processed.
nsTArray < nsRefPtr<nsAccEvent> > events;
nsTArray < nsRefPtr<AccEvent> > events;
events.SwapElements(mEvents);
PRUint32 length = events.Length();
NS_ASSERTION(length, "How did we get here without events to fire?");
for (PRUint32 index = 0; index < length; index ++) {
nsAccEvent *accEvent = events[index];
if (accEvent->mEventRule != nsAccEvent::eDoNotEmit) {
AccEvent* accEvent = events[index];
if (accEvent->mEventRule != AccEvent::eDoNotEmit) {
mDocument->ProcessPendingEvent(accEvent);
AccHideEvent* hideEvent = downcast_accEvent(accEvent);
@ -240,7 +235,7 @@ nsAccEventQueue::CoalesceEvents()
{
PRUint32 numQueuedEvents = mEvents.Length();
PRInt32 tail = numQueuedEvents - 1;
nsAccEvent* tailEvent = mEvents[tail];
AccEvent* tailEvent = mEvents[tail];
// No node means this is application accessible (which can be a subject
// of reorder events), we do not coalesce events for it currently.
@ -248,10 +243,10 @@ nsAccEventQueue::CoalesceEvents()
return;
switch(tailEvent->mEventRule) {
case nsAccEvent::eCoalesceFromSameSubtree:
case AccEvent::eCoalesceFromSameSubtree:
{
for (PRInt32 index = tail - 1; index >= 0; index--) {
nsAccEvent* thisEvent = mEvents[index];
AccEvent* thisEvent = mEvents[index];
if (thisEvent->mEventType != tailEvent->mEventType)
continue; // Different type
@ -280,7 +275,7 @@ nsAccEventQueue::CoalesceEvents()
tailEvent->mEventRule = thisEvent->mEventRule;
// Coalesce text change events for hide events.
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
CoalesceTextChangeEventsFor(tailHideEvent, thisHideEvent);
return;
@ -302,7 +297,7 @@ nsAccEventQueue::CoalesceEvents()
PRBool thisCanBeDescendantOfTail = PR_FALSE;
// Coalesce depending on whether this event was coalesced or not.
if (thisEvent->mEventRule == nsAccEvent::eDoNotEmit) {
if (thisEvent->mEventRule == AccEvent::eDoNotEmit) {
// If this event was coalesced then do not emit tail event iff tail
// event has the same target or its target is contained by this event
// target. Note, we don't need to check whether tail event target
@ -313,7 +308,7 @@ nsAccEventQueue::CoalesceEvents()
// node siblings while this event was coalesced.
if (thisEvent->mNode == tailEvent->mNode) {
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
thisEvent->mEventRule = AccEvent::eDoNotEmit;
return;
}
@ -331,11 +326,11 @@ nsAccEventQueue::CoalesceEvents()
// be conditional events (be or not be fired in the end).
if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
CoalesceReorderEventsFromSameSource(thisEvent, tailEvent);
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
continue;
}
else {
tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
tailEvent->mEventRule = AccEvent::eDoNotEmit;
}
return;
@ -367,13 +362,13 @@ nsAccEventQueue::CoalesceEvents()
if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
CoalesceReorderEventsFromSameTree(thisEvent, tailEvent);
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
continue;
return;
}
tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
tailEvent->mEventRule = AccEvent::eDoNotEmit;
return;
}
@ -391,7 +386,7 @@ nsAccEventQueue::CoalesceEvents()
if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
CoalesceReorderEventsFromSameTree(tailEvent, thisEvent);
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
continue;
return;
@ -399,9 +394,9 @@ nsAccEventQueue::CoalesceEvents()
// Do not emit thisEvent, also apply this result to sibling nodes of
// thisNode.
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
thisEvent->mEventRule = AccEvent::eDoNotEmit;
ApplyToSiblings(0, index, thisEvent->mEventType,
thisEvent->mNode, nsAccEvent::eDoNotEmit);
thisEvent->mNode, AccEvent::eDoNotEmit);
continue;
}
@ -416,32 +411,32 @@ nsAccEventQueue::CoalesceEvents()
} break; // case eCoalesceFromSameSubtree
case nsAccEvent::eCoalesceFromSameDocument:
case AccEvent::eCoalesceFromSameDocument:
{
// Used for focus event, coalesce more older event since focus event
// for accessible can be duplicated by event for its document, we are
// interested in focus event for accessible.
for (PRInt32 index = tail - 1; index >= 0; index--) {
nsAccEvent* thisEvent = mEvents[index];
AccEvent* thisEvent = mEvents[index];
if (thisEvent->mEventType == tailEvent->mEventType &&
thisEvent->mEventRule == tailEvent->mEventRule &&
thisEvent->GetDocAccessible() == tailEvent->GetDocAccessible()) {
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
thisEvent->mEventRule = AccEvent::eDoNotEmit;
return;
}
}
} break; // case eCoalesceFromSameDocument
case nsAccEvent::eRemoveDupes:
case AccEvent::eRemoveDupes:
{
// Check for repeat events, coalesce newly appended event by more older
// event.
for (PRInt32 index = tail - 1; index >= 0; index--) {
nsAccEvent* accEvent = mEvents[index];
AccEvent* accEvent = mEvents[index];
if (accEvent->mEventType == tailEvent->mEventType &&
accEvent->mEventRule == tailEvent->mEventRule &&
accEvent->mNode == tailEvent->mNode) {
tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
tailEvent->mEventRule = AccEvent::eDoNotEmit;
return;
}
}
@ -455,12 +450,12 @@ nsAccEventQueue::CoalesceEvents()
void
nsAccEventQueue::ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
PRUint32 aEventType, nsINode* aNode,
nsAccEvent::EEventRule aEventRule)
AccEvent::EEventRule aEventRule)
{
for (PRUint32 index = aStart; index < aEnd; index ++) {
nsAccEvent* accEvent = mEvents[index];
AccEvent* accEvent = mEvents[index];
if (accEvent->mEventType == aEventType &&
accEvent->mEventRule != nsAccEvent::eDoNotEmit &&
accEvent->mEventRule != AccEvent::eDoNotEmit &&
accEvent->mNode->GetNodeParent() == aNode->GetNodeParent()) {
accEvent->mEventRule = aEventRule;
}
@ -468,38 +463,38 @@ nsAccEventQueue::ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
}
void
nsAccEventQueue::CoalesceReorderEventsFromSameSource(nsAccEvent *aAccEvent1,
nsAccEvent *aAccEvent2)
nsAccEventQueue::CoalesceReorderEventsFromSameSource(AccEvent* aAccEvent1,
AccEvent* aAccEvent2)
{
// Do not emit event2 if event1 is unconditional.
nsAccReorderEvent *reorderEvent1 = downcast_accEvent(aAccEvent1);
AccReorderEvent* reorderEvent1 = downcast_accEvent(aAccEvent1);
if (reorderEvent1->IsUnconditionalEvent()) {
aAccEvent2->mEventRule = nsAccEvent::eDoNotEmit;
aAccEvent2->mEventRule = AccEvent::eDoNotEmit;
return;
}
// Do not emit event1 if event2 is unconditional.
nsAccReorderEvent *reorderEvent2 = downcast_accEvent(aAccEvent2);
AccReorderEvent* reorderEvent2 = downcast_accEvent(aAccEvent2);
if (reorderEvent2->IsUnconditionalEvent()) {
aAccEvent1->mEventRule = nsAccEvent::eDoNotEmit;
aAccEvent1->mEventRule = AccEvent::eDoNotEmit;
return;
}
// Do not emit event2 if event1 is valid, otherwise do not emit event1.
if (reorderEvent1->HasAccessibleInReasonSubtree())
aAccEvent2->mEventRule = nsAccEvent::eDoNotEmit;
aAccEvent2->mEventRule = AccEvent::eDoNotEmit;
else
aAccEvent1->mEventRule = nsAccEvent::eDoNotEmit;
aAccEvent1->mEventRule = AccEvent::eDoNotEmit;
}
void
nsAccEventQueue::CoalesceReorderEventsFromSameTree(nsAccEvent *aAccEvent,
nsAccEvent *aDescendantAccEvent)
nsAccEventQueue::CoalesceReorderEventsFromSameTree(AccEvent* aAccEvent,
AccEvent* aDescendantAccEvent)
{
// Do not emit descendant event if this event is unconditional.
nsAccReorderEvent *reorderEvent = downcast_accEvent(aAccEvent);
AccReorderEvent* reorderEvent = downcast_accEvent(aAccEvent);
if (reorderEvent->IsUnconditionalEvent())
aDescendantAccEvent->mEventRule = nsAccEvent::eDoNotEmit;
aDescendantAccEvent->mEventRule = AccEvent::eDoNotEmit;
}
void
@ -509,7 +504,7 @@ nsAccEventQueue::CoalesceTextChangeEventsFor(AccHideEvent* aTailEvent,
// XXX: we need a way to ignore SplitNode and JoinNode() when they do not
// affect the text within the hypertext.
nsAccTextChangeEvent* textEvent = aThisEvent->mTextChangeEvent;
AccTextChangeEvent* textEvent = aThisEvent->mTextChangeEvent;
if (!textEvent)
return;
@ -557,7 +552,7 @@ nsAccEventQueue::CreateTextChangeEventFor(AccHideEvent* aEvent)
return;
aEvent->mTextChangeEvent =
new nsAccTextChangeEvent(textAccessible, offset, text, PR_FALSE,
aEvent->mIsAsync,
aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
new AccTextChangeEvent(textAccessible, offset, text, PR_FALSE,
aEvent->mIsAsync,
aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
}

View File

@ -39,7 +39,7 @@
#ifndef _nsEventShell_H_
#define _nsEventShell_H_
#include "nsAccEvent.h"
#include "AccEvent.h"
#include "a11yGeneric.h"
@ -59,7 +59,7 @@ public:
/**
* Fire the accessible event.
*/
static void FireEvent(nsAccEvent *aEvent);
static void FireEvent(AccEvent* aEvent);
/**
* Fire accessible event of the given type for the given accessible.
@ -105,7 +105,7 @@ public:
/**
* Push event to queue, coalesce it if necessary. Start pending processing.
*/
void Push(nsAccEvent *aEvent);
void Push(AccEvent* aEvent);
/**
* Shutdown the queue.
@ -142,20 +142,20 @@ private:
*/
void ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
PRUint32 aEventType, nsINode* aNode,
nsAccEvent::EEventRule aEventRule);
AccEvent::EEventRule aEventRule);
/**
* Do not emit one of two given reorder events fired for the same DOM node.
*/
void CoalesceReorderEventsFromSameSource(nsAccEvent *aAccEvent1,
nsAccEvent *aAccEvent2);
void CoalesceReorderEventsFromSameSource(AccEvent* aAccEvent1,
AccEvent* aAccEvent2);
/**
* Do not emit one of two given reorder events fired for DOM nodes in the case
* when one DOM node is in parent chain of second one.
*/
void CoalesceReorderEventsFromSameTree(nsAccEvent *aAccEvent,
nsAccEvent *aDescendantAccEvent);
void CoalesceReorderEventsFromSameTree(AccEvent* aAccEvent,
AccEvent* aDescendantAccEvent);
/**
* Coalesce text change events caused by sibling hide events.
@ -186,7 +186,7 @@ private:
* Pending events array. Don't make this an nsAutoTArray; we use
* SwapElements() on it.
*/
nsTArray<nsRefPtr<nsAccEvent> > mEvents;
nsTArray<nsRefPtr<AccEvent> > mEvents;
};
#endif

View File

@ -403,10 +403,10 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
if (menuBarAccessible) {
mCurrentARIAMenubar = menuBarAccessible->GetNode();
if (mCurrentARIAMenubar) {
nsRefPtr<nsAccEvent> menuStartEvent =
new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_START,
menuBarAccessible, PR_FALSE, aIsFromUserInput,
nsAccEvent::eAllowDupes);
nsRefPtr<AccEvent> menuStartEvent =
new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
menuBarAccessible, PR_FALSE, aIsFromUserInput,
AccEvent::eAllowDupes);
if (menuStartEvent) {
FireDelayedAccessibleEvent(menuStartEvent);
}
@ -416,9 +416,9 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
}
}
else if (mCurrentARIAMenubar) {
nsRefPtr<nsAccEvent> menuEndEvent =
new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
PR_FALSE, aIsFromUserInput, nsAccEvent::eAllowDupes);
nsRefPtr<AccEvent> menuEndEvent =
new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
PR_FALSE, aIsFromUserInput, AccEvent::eAllowDupes);
if (menuEndEvent) {
FireDelayedAccessibleEvent(menuEndEvent);
}
@ -446,7 +446,7 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
// Coalesce focus events from the same document, because DOM focus event might
// be fired for the document node and then for the focused DOM element.
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_FOCUS,
finalFocusNode, nsAccEvent::eCoalesceFromSameDocument,
finalFocusNode, AccEvent::eCoalesceFromSameDocument,
aIsAsynch, aIsFromUserInput);
return PR_TRUE;
@ -549,9 +549,9 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
PRBool isEnabled = (state & (nsIAccessibleStates::STATE_CHECKED |
nsIAccessibleStates::STATE_SELECTED)) != 0;
nsRefPtr<nsAccEvent> accEvent =
new nsAccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
PR_FALSE, isEnabled);
nsRefPtr<AccEvent> accEvent =
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
PR_FALSE, isEnabled);
nsEventShell::FireEvent(accEvent);
if (isEnabled)
@ -565,10 +565,9 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
PRBool isEnabled = !!(state & nsIAccessibleStates::STATE_CHECKED);
nsRefPtr<nsAccEvent> accEvent =
new nsAccStateChangeEvent(accessible,
nsIAccessibleStates::STATE_CHECKED,
PR_FALSE, isEnabled);
nsRefPtr<AccEvent> accEvent =
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
PR_FALSE, isEnabled);
nsEventShell::FireEvent(accEvent);
return NS_OK;
@ -600,9 +599,9 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
PRUint32 state = nsAccUtils::State(accessible); // collapsed/expanded changed
PRBool isEnabled = (state & nsIAccessibleStates::STATE_EXPANDED) != 0;
nsRefPtr<nsAccEvent> accEvent =
new nsAccStateChangeEvent(accessible, nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, isEnabled);
nsRefPtr<AccEvent> accEvent =
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, isEnabled);
nsEventShell::FireEvent(accEvent);
return NS_OK;
}
@ -723,7 +722,8 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
}
if (!fireFocus) {
nsCOMPtr<nsINode> realFocusedNode = GetCurrentFocus();
nsIContent* realFocusedContent = realFocusedNode->AsElement();
nsIContent* realFocusedContent =
realFocusedNode->IsElement() ? realFocusedNode->AsElement() : nsnull;
nsIContent* containerContent = targetContent;
while (containerContent) {
nsCOMPtr<nsIDOMXULPopupElement> popup = do_QueryInterface(containerContent);
@ -753,7 +753,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
}
else if (eventType.EqualsLiteral("ValueChange")) {
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
targetNode, nsAccEvent::eRemoveDupes);
targetNode, AccEvent::eRemoveDupes);
}
#ifdef DEBUG
else if (eventType.EqualsLiteral("mouseover")) {
@ -887,10 +887,10 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(comboboxAcc,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_TRUE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(comboboxAcc,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_TRUE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
nsEventShell::FireEvent(event);
@ -929,10 +929,10 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode *aNode,
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
nsRefPtr<nsAccEvent> event =
new nsAccStateChangeEvent(comboboxAcc,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_FALSE);
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(comboboxAcc,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_FALSE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
nsEventShell::FireEvent(event);

View File

@ -763,8 +763,8 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti
return;
nsRefPtr<nsAccEvent> selWithinEvent =
new nsAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, multiSelect);
nsRefPtr<AccEvent> selWithinEvent =
new AccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, multiSelect);
if (!selWithinEvent)
return;
@ -780,8 +780,7 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti
eventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
}
nsRefPtr<nsAccEvent> selAddRemoveEvent =
new nsAccEvent(eventType, option);
nsRefPtr<AccEvent> selAddRemoveEvent = new AccEvent(eventType, option);
if (selAddRemoveEvent)
option->GetDocAccessible()->FireDelayedAccessibleEvent(selAddRemoveEvent);

View File

@ -131,7 +131,7 @@ public:
inline PRInt32 GetLinkIndexAtOffset(PRUint32 aOffset)
{
nsAccessible* child = GetChildAtOffset(aOffset);
return GetLinkIndex(child);
return child ? GetLinkIndex(child) : -1;
}
/**

View File

@ -78,7 +78,7 @@ class nsAccessibleWrap : public nsAccessible
virtual void Shutdown ();
virtual void InvalidateChildren();
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
virtual nsresult HandleAccEvent(AccEvent* aEvent);
// ignored means that the accessible might still have children, but is not displayed
// to the user. it also has no native accessible object represented for it.
@ -98,7 +98,7 @@ class nsAccessibleWrap : public nsAccessible
protected:
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
/**
* Return true if the parent doesn't have children to expose to AT.

View File

@ -161,7 +161,7 @@ nsAccessibleWrap::Shutdown ()
}
nsresult
nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -174,7 +174,7 @@ nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
}
nsresult
nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;

View File

@ -70,7 +70,7 @@ PRBool nsAccessNodeWrap::gIsEnumVariantSupportDisabled = 0;
// Used to determine whether an IAccessible2 compatible screen reader is loaded.
PRBool nsAccessNodeWrap::gIsIA2Disabled = PR_FALSE;
nsAccTextChangeEvent *nsAccessNodeWrap::gTextEvent = nsnull;
AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
// Pref to disallow CtrlTab preview functionality if JAWS or Window-Eyes are
// running.

View File

@ -71,7 +71,7 @@
typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
class nsAccTextChangeEvent;
class AccTextChangeEvent;
class nsAccessNodeWrap : public nsAccessNode,
public nsIWinAccessNode,
@ -187,7 +187,7 @@ protected:
* It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
* implementation.
*/
static nsAccTextChangeEvent *gTextEvent;
static AccTextChangeEvent* gTextEvent;
};
/**

View File

@ -1582,7 +1582,7 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
// nsAccessible
nsresult
nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
nsresult rv = nsAccessible::HandleAccEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv);
@ -1591,7 +1591,7 @@ nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
}
nsresult
nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
{
PRUint32 eventType = aEvent->GetEventType();

View File

@ -307,7 +307,7 @@ public: // construction, destruction
UINT *puArgErr);
// nsAccessible
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
virtual nsresult HandleAccEvent(AccEvent* aEvent);
// Helper methods
static PRInt32 GetChildIDFor(nsIAccessible* aAccessible);
@ -346,7 +346,7 @@ public: // construction, destruction
void UnattachIEnumVariant();
protected:
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
// mEnumVARIANTPosition not the current accessible's position, but a "cursor" of
// where we are in the current list of children, with respect to

View File

@ -51,7 +51,7 @@ IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
CAccessibleEditableText);
nsresult
nsHyperTextAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
PRUint32 eventType = aEvent->GetEventType();
@ -100,6 +100,8 @@ nsHyperTextAccessibleWrap::GetModifiedText(PRBool aGetInsertedText,
*aStartOffset = gTextEvent->GetStartOffset();
*aEndOffset = *aStartOffset + gTextEvent->GetLength();
return gTextEvent->GetModifiedText(aText);
gTextEvent->GetModifiedText(aText);
return NS_OK;
}

View File

@ -61,7 +61,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsAccessible
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
virtual nsresult HandleAccEvent(AccEvent* aEvent);
protected:
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,

View File

@ -53,7 +53,8 @@ public: // construction, destruction
virtual ~nsAccessibleWrap();
protected:
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) {
virtual nsresult FirePlatformEvent(AccEvent* aEvent)
{
return NS_OK;
}
};

View File

@ -0,0 +1,61 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# 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"),
# 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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
LIBRARY_NAME = accessibility_xpcom_s
LIBXUL_LIBRARY = 1
CPPSRCS = \
nsAccEvent.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \
-I$(srcdir)/../base \
$(NULL)

View File

@ -0,0 +1,206 @@
/* -*- 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
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* 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"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccEvent.h"
#include "nsDocAccessible.h"
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
NS_IMETHODIMP
nsAccEvent::GetIsFromUserInput(PRBool* aIsFromUserInput)
{
*aIsFromUserInput = mEvent->IsFromUserInput();
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetEventType(PRUint32* aEventType)
{
*aEventType = mEvent->GetEventType();
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nsnull;
NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
{
NS_ENSURE_ARG_POINTER(aDOMNode);
*aDOMNode = nsnull;
nsINode* node = mEvent->GetNode();
if (node)
CallQueryInterface(node, aDOMNode);
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument** aDocAccessible)
{
NS_ENSURE_ARG_POINTER(aDocAccessible);
NS_IF_ADDREF(*aDocAccessible = mEvent->GetDocAccessible());
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccStateChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
nsIAccessibleStateChangeEvent)
NS_IMETHODIMP
nsAccStateChangeEvent::GetState(PRUint32* aState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
return NS_OK;
}
NS_IMETHODIMP
nsAccStateChangeEvent::IsExtraState(PRBool* aIsExtraState)
{
NS_ENSURE_ARG_POINTER(aIsExtraState);
*aIsExtraState = static_cast<AccStateChangeEvent*>(mEvent.get())->IsExtraState();
return NS_OK;
}
NS_IMETHODIMP
nsAccStateChangeEvent::IsEnabled(PRBool* aIsEnabled)
{
NS_ENSURE_ARG_POINTER(aIsEnabled);
*aIsEnabled = static_cast<AccStateChangeEvent*>(mEvent.get())->IsStateEnabled();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccTextChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
nsIAccessibleTextChangeEvent)
NS_IMETHODIMP
nsAccTextChangeEvent::GetStart(PRInt32* aStart)
{
NS_ENSURE_ARG_POINTER(aStart);
*aStart = static_cast<AccTextChangeEvent*>(mEvent.get())->GetStartOffset();
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::GetLength(PRUint32* aLength)
{
NS_ENSURE_ARG_POINTER(aLength);
*aLength = static_cast<AccTextChangeEvent*>(mEvent.get())->GetLength();
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::IsInserted(PRBool* aIsInserted)
{
NS_ENSURE_ARG_POINTER(aIsInserted);
*aIsInserted = static_cast<AccTextChangeEvent*>(mEvent.get())->IsTextInserted();
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
{
static_cast<AccTextChangeEvent*>(mEvent.get())->GetModifiedText(aModifiedText);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccCaretMoveEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
nsIAccessibleCaretMoveEvent)
NS_IMETHODIMP
nsAccCaretMoveEvent::GetCaretOffset(PRInt32 *aCaretOffset)
{
NS_ENSURE_ARG_POINTER(aCaretOffset);
*aCaretOffset = static_cast<AccCaretMoveEvent*>(mEvent.get())->GetCaretOffset();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccTableChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
nsIAccessibleTableChangeEvent)
NS_IMETHODIMP
nsAccTableChangeEvent::GetRowOrColIndex(PRInt32 *aRowOrColIndex)
{
NS_ENSURE_ARG_POINTER(aRowOrColIndex);
*aRowOrColIndex =
static_cast<AccTableChangeEvent*>(mEvent.get())->GetIndex();
return NS_OK;
}
NS_IMETHODIMP
nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
{
NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
*aNumRowsOrCols = static_cast<AccTableChangeEvent*>(mEvent.get())->GetCount();
return NS_OK;
}

View File

@ -0,0 +1,148 @@
/* -*- 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
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* 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"),
* 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 ***** */
#ifndef _nsAccEvent_H_
#define _nsAccEvent_H_
#include "nsIAccessibleEvent.h"
#include "AccEvent.h"
/**
* Generic accessible event.
*/
class nsAccEvent: public nsIAccessibleEvent
{
public:
nsAccEvent(AccEvent* aEvent) : mEvent(aEvent) { }
virtual ~nsAccEvent() { }
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLEEVENT
protected:
nsRefPtr<AccEvent> mEvent;
private:
nsAccEvent();
nsAccEvent(const nsAccEvent&);
nsAccEvent& operator =(const nsAccEvent&);
};
/**
* Accessible state change event.
*/
class nsAccStateChangeEvent: public nsAccEvent,
public nsIAccessibleStateChangeEvent
{
public:
nsAccStateChangeEvent(AccStateChangeEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccStateChangeEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
private:
nsAccStateChangeEvent();
nsAccStateChangeEvent(const nsAccStateChangeEvent&);
nsAccStateChangeEvent& operator =(const nsAccStateChangeEvent&);
};
/**
* Accessible text change event.
*/
class nsAccTextChangeEvent: public nsAccEvent,
public nsIAccessibleTextChangeEvent
{
public:
nsAccTextChangeEvent(AccTextChangeEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccTextChangeEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
private:
nsAccTextChangeEvent();
nsAccTextChangeEvent(const nsAccTextChangeEvent&);
nsAccTextChangeEvent& operator =(const nsAccTextChangeEvent&);
};
/**
* Accessible caret move event.
*/
class nsAccCaretMoveEvent: public nsAccEvent,
public nsIAccessibleCaretMoveEvent
{
public:
nsAccCaretMoveEvent(AccCaretMoveEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccCaretMoveEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
private:
nsAccCaretMoveEvent();
nsAccCaretMoveEvent(const nsAccCaretMoveEvent&);
nsAccCaretMoveEvent& operator =(const nsAccCaretMoveEvent&);
};
/**
* Accessible table change event.
*/
class nsAccTableChangeEvent : public nsAccEvent,
public nsIAccessibleTableChangeEvent
{
public:
nsAccTableChangeEvent(AccTableChangeEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccTableChangeEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
private:
nsAccTableChangeEvent();
nsAccTableChangeEvent(const nsAccTableChangeEvent&);
nsAccTableChangeEvent& operator =(const nsAccTableChangeEvent&);
};
#endif

View File

@ -521,8 +521,8 @@ nsXULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
nsAccessible *accessible = mAccessibleCache.GetWeak(key);
if (accessible) {
nsRefPtr<nsAccEvent> event =
new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, accessible, PR_FALSE);
nsRefPtr<AccEvent> event =
new AccEvent(nsIAccessibleEvent::EVENT_HIDE, accessible, PR_FALSE);
nsEventShell::FireEvent(event);
accessible->Shutdown();
@ -622,8 +622,8 @@ nsXULTreeAccessible::TreeViewChanged()
// Fire only notification destroy/create events on accessible tree to lie to
// AT because it should be expensive to fire destroy events for each tree item
// in cache.
nsRefPtr<nsAccEvent> eventDestroy =
new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
nsRefPtr<AccEvent> eventDestroy =
new AccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
if (!eventDestroy)
return;
@ -633,8 +633,8 @@ nsXULTreeAccessible::TreeViewChanged()
mTree->GetView(getter_AddRefs(mTreeView));
nsRefPtr<nsAccEvent> eventCreate =
new nsAccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
nsRefPtr<AccEvent> eventCreate =
new AccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
if (!eventCreate)
return;

View File

@ -1238,9 +1238,9 @@ nsXULTreeGridCellAccessible::CellInvalidated()
mTreeView->GetCellValue(mRow, mColumn, textEquiv);
if (mCachedTextEquiv != textEquiv) {
PRBool isEnabled = textEquiv.EqualsLiteral("true");
nsRefPtr<nsAccEvent> accEvent =
new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_CHECKED,
PR_FALSE, isEnabled);
nsRefPtr<AccEvent> accEvent =
new AccStateChangeEvent(this, nsIAccessibleStates::STATE_CHECKED,
PR_FALSE, isEnabled);
nsEventShell::FireEvent(accEvent);
mCachedTextEquiv = textEquiv;

View File

@ -59,8 +59,6 @@ DEFINES += -DAB_CD=$(AB_CD)
APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
DEFINES += -DAPP_VERSION="$(APP_VERSION)"
APP_UA_NAME = $(shell echo $(MOZ_APP_DISPLAYNAME) | sed -e's/[^A-Za-z]//g')
DEFINES += -DAPP_UA_NAME="$(APP_UA_NAME)"
DIST_FILES = application.ini

View File

@ -136,5 +136,12 @@
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.5</string>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>i386</key>
<string>10.5.0</string>
<key>x86_64</key>
<string>10.6.0</string>
</dict>
</dict>
</plist>

View File

@ -216,6 +216,7 @@ var TestPilotXulWindow = {
},
onUnload: function() {
document.getElementById("settings-pane").writePreferences(true);
Observers.remove("testpilot:task:changed", this._onTaskStatusChanged, this);
},

View File

@ -175,6 +175,15 @@ var TestPilotMenuUtils;
return;
}
let firefoxnav = window.document.getElementById("nav-bar");
/* This is sometimes called for windows that don't have a navbar - in
* that case, do nothing. */
if (!firefoxnav) {
return;
}
// TODO if the user has removed the feedback button via customization
// interface, we don't want to add it back in. Use a pref to store whether
// this setup was done or not.
let curSet = firefoxnav.currentSet;
if (-1 == curSet.indexOf("feedback-menu-button")) {

View File

@ -4,7 +4,7 @@
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>testpilot@labs.mozilla.com</em:id>
<em:version>1.0.2</em:version>
<em:version>1.0.3</em:version>
<em:type>2</em:type>
<!-- Target Application this extension can install into,
@ -13,7 +13,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.5</em:minVersion>
<em:maxVersion>4.0b4</em:maxVersion>
<em:maxVersion>4.0b5</em:maxVersion>
</Description>
</em:targetApplication>

View File

@ -56,8 +56,10 @@ pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindow.xul
// Enables some extra Extension System Logging (can reduce performance)
pref("extensions.logging.enabled", false);
// Preferences for the Get Add-ons pane
// Preferences for the Addon Repository
pref("extensions.getAddons.cache.enabled", true);
pref("extensions.getAddons.maxResults", 15);
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/guid:%IDS%");
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%");
// Preferences for AMO integration
@ -189,7 +191,6 @@ pref("keyword.URL", "");
pref("general.useragent.locale", "@AB_CD@");
pref("general.skins.selectedSkin", "classic/1.0");
pref("general.useragent.extra.firefox", "@APP_UA_NAME@/@APP_VERSION@");
pref("general.smoothScroll", false);
#ifdef UNIX_BUT_NOT_MAC

View File

@ -0,0 +1,109 @@
%if 0
/* ***** 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 aboutHome.xhtml.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77@bonardo.net> (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 ***** */
%endif
html {
font: message-box;
background: -moz-Field;
color: -moz-FieldText;
}
#topSection,
#bottomSection {
position: relative;
margin: 1em auto;
padding: 25px;
width: 560px;
}
#brandStart {
background: -moz-linear-gradient(top, #42607C, #1E4262 30%, #1E4262 80%, #143552 98%, #244665);
-moz-border-radius: 1%;
padding-bottom: 0.2em;
-moz-padding-start: 0.5em;
font-size: 250%;
font-weight: bold;
color: #688196;
margin-top: 18px;
margin-bottom: 6px;
}
#brandStart > span {
color: white;
}
#brandLogo {
position: absolute;
top: 0;
}
body[dir="ltr"] #brandLogo {
right: 0;
}
body[dir="rtl"] #brandLogo {
left: -15px;
}
#searchContainer {
border: 1px solid ThreeDShadow;
-moz-border-radius: 1%;
padding: 3em;
}
#searchEngineLinks {
font-size: 80%;
}
#searchEngineLinks > a {
-moz-margin-start: 1em;
}
body[dir="ltr"] #searchEngineLinks {
float: right;
}
body[dir="rtl"] #searchEngineLinks {
float: left;
}
#searchEngineLogo {
margin: 5px;
}
#searchText {
width: 100%;
}
#aboutMozilla {
text-align: center;
}

View File

@ -0,0 +1,114 @@
/* ***** 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 aboutHome.xhtml.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77@bonardo.net> (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 ***** */
// If a definition requires additional params, check that the final search url
// is handled correctly by the engine.
const SEARCH_ENGINES = {
"Google": {
image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAYCAMAAABwdHsxAAADAFBMVEVogZYwjM9NtOspS2u0KAfYZBb3rRTiurCMjYrUWhIaPlzDNgfVRgjaVgvoizTI9f2ta17/9Wzrs0v46M/+7VOW6vrJQAsBLochdr+nmF/++o+UDQK88vzaYQarq6scarXT+f68vLzjdRrjewp5d3WqGATkUwaTq9uk7PnUaydkICTJSBD4uCDgZAz9+LiK6PjRZFH33Xv01qbrlxznhgvwx5gCBCbOUhLjfCzhaxHztXG8RhX93UP5yTRGl9QhRGT5wigkRmXniRj70zoKWrT2yUdqjs3UhzXvl0JwU0teu+EBElGD2fH83FZo1vTPilT0vDmd0Z3dbhrWrHLhcQir8PzTTDfPrVGrajv03cf5+vkwUG6z8PrSUw571uzvpCGPTzBsPDMxMEcHagXrkg7voBHf/P8FGHHhzrbyryOQZAeDNCudnZyTJBL2zlT+xByoUCG1wspyY1nRiH7STA3yiB7Jjx/pqT/Pz8/7lhDvfBxTUkl95PY/RE0DI2SQbT7LzJjxdg1OMTzutynnm2v+5DWsNBX+/tVDqOa7tnX57OPGYSHysziEo5a3XBe3l3j+0SXCoaCsjTL++fMgQmLmxXdv0ezsv0ycQxf8p0X1hwrenDU/Tnj9//tkyNj3+fX89fDv22QXHEWQydee7/xEdKG84uRWi5bwaxyK3/L++/iU5PMWM2Q6GS7UXg81l9gmSGgXOVewsKO3x+ECK8h8x3j7/fs5bMBke6kuTmwoRV/SbArKeSrB1snY373x5aSIRz85YIvragDD5+lnorUvSWF80PCQr6o4KGKysrIeQmIgXJ1Vb4j///8+XXjs7ewaUZSutsKFkqY4T3IhXqgYSHtwiJwUNVLExcbk5eU4SGcrcLEsP1wPKV77+/vy8/NBkcBmrN+drLklNGIONHQ5WXVxyuk0VXHHz9dmxuonZahTrNqPobEcP19CVXMURIljzvE/odz29vYcP3VieZHo6OhCYHxOW29y2vNYwe79/f33+PnU2eExgcLX2Nje397NKLzjAAACjElEQVR42q2UMWvbQBTHPRgro6CDKIJOPQSeVH+CDuZ2E3BIVmNkBB5agTF0NYV00y7jdMji0XqxvNljAzmEPASrQ0Vwhk41tPZiC6l3OjmNXYeYujfo3nF3v/fe/+le5hX5HyOTzv1Of88bnXelq0q8C9NRHMcpFrHd3gPTD0qV17uisWeDqE269gyguU88pcrRDowNXrqYTt1/xkQwXi8mZ2Q/TO9vDNa2FVkJLUPocDsYDoe1lB6EURzZ4RrDThHi0RF7mRh+bFGirCEYCJnMLpzUase5XI2aZxhjKM6wS64YJlDZqWxAPEq6ztjFm01KEzGdTxGirgoNFpRfrU7IEg8IiQFoqRlmqYp0p4VGDEO8zB1sYoLyKJlFVCdxjotwntNpISJqYfjKMQKi1fDVvJlqg2G6gWmh98l8iuRoWL1O7Bc53b2TJoSFc88xquwKqig8SGyDFvxRMGyriEdDUF140+DR9HN6hGHOBJIsjinLpvHoV84EIPGCL/ClAzOiojzfKeejz9WX3H6ru98Td6GWaqOi3lbBQQsTlyzzOU1ajjimTgpUkxRDN7Uvtl1kmTGMgT5+28BcAAC/SBSJBl7mWS1kkwRVnpWvs8n1HP6nMswFQmJyp71+DK4mgZ0ssEarFsiyQe0sg9V03acnG2luClgcQx+DKaOyTwTjAUNiS5OKWFGwZbGYw5GsiqKYNI6erp8XTo7TGigAToecVSofjvrEzMuyPBIe9xvXux2MvXCZZroQhNU6a7/mJ5VsK87l+FaD2TLpTvTTbTbj7bb13PiJZ0zAT+u6PtH9nhuKxD270s0hGAfSBOCgaJLHxDrlffcQzOoXSKyYjksOwdDWOLcG2H5i8zf27La6kVLrqwAAAABJRU5ErkJggg=="
, params: "source=hp"
, links: {
advanced: "http://www.google.com/advanced_search"
, preferences: "http://www.google.com/preferences"
}
}
, "Яндекс":
{
image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAArCAMAAAC5Mt3fAAABnlBMVEX/////AAD/AwP/Bgb/CQn/DAz/Dw//EhL/FRX/GBj/Gxv/Hh7/ISH/JCT/Jyf/MDD/MzP/Pz//QkL/SEj/S0v/Tk7/UVH/YGD/Zmb/aWn/bGz/cnL/dXX/eHj/e3v/fn7/hIT/jY3/k5P/lpb/mZn/nJz/n5//paX/q6v/rq7/tLT/w8P/xsb/z8//1dX/2Nj/29v/3t7/4eH/5OT/7e3/8PD/8/P/9vb/+fn//Pz8/Pz5+fn29vbz8/Pw8PDt7e3q6urn5+fk5OTh4eHe3t7b29vY2NjS0tLPz8/MzMzJycnGxsbDw8PAwMC9vb26urq0tLSurq6rq6uoqKilpaWioqKfn5+cnJyZmZmWlpaTk5ONjY2KioqHh4eEhISBgYF+fn57e3t4eHh1dXVycnJvb29sbGxpaWlmZmZjY2NgYGBdXV1aWlpXV1dUVFRRUVFOTk5LS0tISEhFRUVCQkI/Pz88PDw5OTk2NjYzMzMwMDAtLS0qKionJyckJCQhISEeHh4bGxsVFRUSEhIPDw8MDAwJCQkGBgYDAwMAAABXxKaDAAAAAXRSTlMAQObYZgAAA3pJREFUWMPt1ulbG1UUx/HfQVsUrK1a9612c6t16SZBlkpTKLIkiG26KBSLoTVUdpiUQiIJyfe/9sXcYZJJSFsfx1c9b5J57p18cu5y7pWex/OIPS6cPHrkBTOzQ/EZp9rNxcHYjPfMzOzVI50xIifN7OXPz0sn4kO+e9Hs8DkpVuQDs7azihfpajd7SzEjZ8zsdNzIcTM7Gzfyvpldiht5x8z0L5BE6s6t4f2bhzJTmSt1SDSTMvwiSXdhw28aJAj35vAmwGKPJOkeLEvSzyUYk6S+BQBWRh3yoZl9HUGAm5KUhUd+08geMuj/0ZL/tCTXb01Sd8H/VN9j1/meQ043WV1NkarnPQ6QRB7WU9O4jB1yAxiWpAXYuTGeo9gTbHgze/NpkJKfz6AkXYdSn3QfNkMksQ3zkjQO1VFJ6bG9SXnNrO3Mk5AUFGuQDXgg6RqQ3EMmoZKUpFVYiKyDL82s85snI1shMgCkJSXKkAmQxCbMyrWmmhQvO3js25bIBGyEyKTLQHn4I0DS/hBKN6H6Q8Oaftes/tBqRDLwV4jMQiUhScv++srCmjz4VZL0595bdfFpRwOSy2QymdW97lOQDZEFKEqSFmHdISkodsul93C/KvlKeDIShkPmYDpE8rDrVcIOWfDybjlLJTc30XjD7MD5ujmJIEswESKFSIcs7AK3/HoDzDQxvjCzj+snPjJcBUiGyN9QmHvoeZ7nefNuuBZxe6+3OdJ12Kz9QqvV1QvlRIjswGLtD2RhbRi4I0l9NB2uE2Z2rOU+GYdVhci2q1G1iJZhp9cN13yDcbHD7KWLLZEZf3kGyDpsNyAjwLT8PPMNyEdm9knrHe/5JT5A7gP9UUQrUO6XtALVvohx7oBZx6WWSBJWpPodf7sBGXO1fQa/2NTG22Z2vHWBvOvOogDp2YXiQBTRBlR+lIaAYn0qX7WZdX7fEukpuXkeCQ6MLFC4GkVSwJykNWBjoBZ53cxOtTxPbm9B0fM8/9AqPpB0uQSwPDfvlSdCRB5Uk9JQBagszS3mC+E+PNTVEslRFwVJGqsEj7M1SBrISRrdCVovS5KOmrV9Fp7E7ZKkKkyGF4lmiIYeAVD6vd+/SKwEBbN6VdLgll9y0k99+cm5vNytxQ2BfspMXb/Wvd9LY5nfJpLPcDPbB/lv439BspTHg+9XKv417hniH6z+4JNllI0iAAAAAElFTkSuQmCC"
}
};
let gSearchEngine;
function onLoad(event)
{
setupSearchEngine();
document.getElementById("searchText").focus();
}
function onSearchSubmit(aEvent) {
let searchTerms = document.getElementById("searchText").value;
if (gSearchEngine && searchTerms.length > 0) {
const SEARCH_TOKENS = {
"_searchTerms_": encodeURIComponent(searchTerms)
}
let url = gSearchEngine.searchUrl;
for (let key in SEARCH_TOKENS) {
url = url.replace(key, SEARCH_TOKENS[key]);
}
window.location.href = url;
}
aEvent.preventDefault();
}
function setupSearchEngine() {
gSearchEngine = JSON.parse(localStorage["search-engine"]);
// Look for extended information, like logo and links.
let searchEngineInfo = SEARCH_ENGINES[gSearchEngine.name];
if (searchEngineInfo) {
for (let prop in searchEngineInfo)
gSearchEngine[prop] = searchEngineInfo[prop];
}
// Enqueue additional params if required by the engine definition.
if (gSearchEngine.params)
gSearchEngine.searchUrl += "&" + gSearchEngine.params;
// Add search engine logo.
if (gSearchEngine.image)
document.getElementById("searchEngineLogo").src = gSearchEngine.image;
if (gSearchEngine.links) {
// Add search engine links.
if (gSearchEngine.links.advanced) {
let advancedLink = document.getElementById("searchEngineAdvancedLink");
advancedLink.setAttribute("href", gSearchEngine.links.advanced);
advancedLink.hidden = false;
}
if (gSearchEngine.links.preferences) {
let prefsLink = document.getElementById("searchEngineAdvancedPreferences");
prefsLink.setAttribute("href", gSearchEngine.links.preferences);
prefsLink.hidden = false;
}
}
}

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
# ***** 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 aboutHome.xhtml.
#
# The Initial Developer of the Original Code is the Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Marco Bonardo <mak77@bonardo.net> (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 *****
<!DOCTYPE html [
<!ENTITY % htmlDTD
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%aboutHomeDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&abouthome.pageTitle;</title>
<link rel="icon" type="image/png" id="favicon"
href="chrome://branding/content/icon16.png"/>
<link rel="stylesheet" type="text/css" media="all"
href="chrome://browser/content/aboutHome.css"/>
<script type="text/javascript;version=1.8"
src="chrome://browser/content/aboutHome.js"/>
</head>
<body dir="&locale.dir;" onload="onLoad(event)">
<div id="pageContainer">
<div id="topSection">
<img id="brandLogo" src="chrome://branding/content/icon128.png"
title="&abouthome.brandLogo.title;"/>
<div id="brandStart">
&abouthome.brandStart;
</div>
<div id ="searchContainer">
<img id="searchEngineLogo" title="&abouthome.searchEngineLogo.title;"/>
<form name="searchForm" onsubmit="onSearchSubmit(event)">
<input type="text" name="searchText" value="" id="searchText" maxLength="256"/>
<br/>
<input type="submit" value="&abouthome.searchEngineButton.label;"/>
<span id="searchEngineLinks">
<a hidden="true" id="searchEngineAdvancedLink">&abouthome.searchEngineLinks.advanced;</a>
<a hidden="true" id="searchEngineAdvancedPreferences">&abouthome.searchEngineLinks.preferences;</a>
</span>
</form>
</div>
</div>
<div id="bottomSection">
<div id="aboutMozilla">
<a href="http://www.mozilla.com/about/">&abouthome.aboutMozilla;</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -103,6 +103,11 @@
label="&helpReleaseNotes.label;"
oncommand="openReleaseNotes()"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="feedbackPage"
accesskey="&helpFeedbackPage.accesskey;"
label="&helpFeedbackPage.label;"
oncommand="openFeedbackPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuseparator id="updateSeparator"/>
#ifdef MOZ_UPDATER
<menuitem id="checkForUpdates"

View File

@ -196,8 +196,8 @@ let TabView = {
if (!event.ctrlKey && !event.metaKey && !event.shiftKey &&
charCode == 160) { // alt + space
#else
if (event.ctrlKey && !event.metaKey && !event.shiftKey &&
!event.altKey && charCode == 32) { // ctrl + space
if (event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey &&
charCode == KeyEvent.DOM_VK_SPACE) { // ctrl + space
#endif
// Don't handle this event if it's coming from a node that might allow

View File

@ -83,9 +83,13 @@ toolbar[printpreview="true"] {
}
%ifdef MENUBAR_CAN_AUTOHIDE
#main-window[inFullscreen] > #appmenu-button-container {
#main-window[inFullscreen] > #titlebar {
display: none;
}
#titlebar {
-moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
}
%endif
toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {
@ -135,7 +139,7 @@ toolbar[mode="icons"] > #reload-button[displaystop] {
/* For results that are actions, their description text is shown instead of
the URL - this needs to follow the locale's direction, unlike URLs. */
richlistitem[type="action"]:-moz-locale-dir(rtl) > .ac-url-box {
richlistitem[type~="action"]:-moz-locale-dir(rtl) > .ac-url-box {
direction: rtl;
}

View File

@ -505,6 +505,10 @@ const gPopupBlockerObserver = {
var pageReport = gBrowser.pageReport;
if (pageReport) {
for (var i = 0; i < pageReport.length; ++i) {
// popupWindowURI will be null if the file picker popup is blocked.
// xxxdz this should make the option say "Show file picker" and do it (Bug 590306)
if (!pageReport[i].popupWindowURI)
continue;
var popupURIspec = pageReport[i].popupWindowURI.spec;
// Sometimes the popup URI that we get back from the pageReport
@ -678,8 +682,6 @@ const gXPInstallObserver = {
if (!enabled) {
notificationID = "xpinstall-disabled"
if (PopupNotifications.getNotification(notificationID, browser))
return;
if (gPrefService.prefIsLocked("xpinstall.enabled")) {
messageString = gNavigatorBundle.getString("xpinstallDisabledMessageLocked");
@ -698,9 +700,6 @@ const gXPInstallObserver = {
}
}
else {
if (PopupNotifications.getNotification(notificationID, browser))
return;
messageString = gNavigatorBundle.getFormattedString("xpinstallPromptWarning",
[brandShortName, installInfo.originatingURI.host]);
@ -745,10 +744,6 @@ const gXPInstallObserver = {
});
break;
case "addon-install-complete":
var notification = PopupNotifications.getNotification(notificationID, browser);
if (notification)
PopupNotifications.remove(notification);
var needsRestart = installInfo.installs.some(function(i) {
return i.addon.pendingOperations != AddonManager.PENDING_NONE;
});
@ -1347,10 +1342,6 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
PlacesStarButton.init();
// called when we go into full screen, even if it is
// initiated by a web page script
window.addEventListener("fullscreen", onFullScreen, true);
if (isLoadingBlank && gURLBar && isElementVisible(gURLBar))
gURLBar.focus();
else
@ -1514,6 +1505,12 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
if (Win7Features)
Win7Features.onOpenWindow();
// called when we go into full screen, even if it is
// initiated by a web page script
window.addEventListener("fullscreen", onFullScreen, true);
if (window.fullScreen)
onFullScreen();
#ifdef MOZ_SERVICES_SYNC
// initialize the sync UI
gSyncUI.init();
@ -2635,9 +2632,8 @@ function BrowserFullScreen()
window.fullScreen = !window.fullScreen;
}
function onFullScreen()
{
FullScreen.toggle();
function onFullScreen(event) {
FullScreen.toggle(event);
}
function getWebNavigation()
@ -2788,6 +2784,17 @@ function FillInHTMLTooltip(tipElement)
#endif // MOZ_SVG
var direction = tipElement.ownerDocument.dir;
// If the element is invalid per HTML5 Forms specifications,
// show the constraint validation error message instead of @tooltip.
if (tipElement instanceof HTMLInputElement ||
tipElement instanceof HTMLTextAreaElement ||
tipElement instanceof HTMLSelectElement ||
tipElement instanceof HTMLButtonElement) {
// If the element is barred from constraint validation or valid,
// the validation message will be the empty string.
titleText = tipElement.validationMessage;
}
while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) {
if (tipElement.nodeType == Node.ELEMENT_NODE) {
titleText = tipElement.getAttribute("title");
@ -3070,15 +3077,16 @@ const DOMLinkHandler = {
break;
// Verify that the load of this icon is legal.
// error pages can load their favicon, to be on the safe side,
// only allow chrome:// favicons
const aboutNeterr = /^about:neterror\?/;
const aboutBlocked = /^about:blocked\?/;
const aboutCert = /^about:certerror\?/;
if (!(aboutNeterr.test(targetDoc.documentURI) ||
aboutBlocked.test(targetDoc.documentURI) ||
aboutCert.test(targetDoc.documentURI)) ||
!uri.schemeIs("chrome")) {
// Some error or special pages can load their favicon.
// To be on the safe side, only allow chrome:// favicons.
var isAllowedPage = [
/^about:neterror\?/,
/^about:blocked\?/,
/^about:certerror\?/,
/^about:home$/,
].some(function (re) re.test(targetDoc.documentURI));
if (!isAllowedPage || !uri.schemeIs("chrome")) {
var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].
getService(Ci.nsIScriptSecurityManager);
try {
@ -3619,17 +3627,21 @@ function updateEditUIVisibility()
#endif
}
var FullScreen =
{
var FullScreen = {
_XULNS: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
toggle: function()
{
// show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
this.showXULChrome("toolbar", window.fullScreen);
this.showXULChrome("statusbar", window.fullScreen);
document.getElementById("View:FullScreen").setAttribute("checked", !window.fullScreen);
toggle: function (event) {
var enterFS = window.fullScreen;
if (!window.fullScreen) {
// We get the fullscreen event _before_ the window transitions into or out of FS mode.
if (event && event.type == "fullscreen")
enterFS = !enterFS;
// show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
this.showXULChrome("toolbar", !enterFS);
this.showXULChrome("statusbar", !enterFS);
document.getElementById("View:FullScreen").setAttribute("checked", enterFS);
if (enterFS) {
// Add a tiny toolbar to receive mouseover and dragenter events, and provide affordance.
// This will help simulate the "collapse" metaphor while also requiring less code and
// events than raw listening of mouse coords.
@ -4777,13 +4789,20 @@ function updateAppButtonDisplay() {
window.menubar.visible &&
document.getElementById("toolbar-menubar").getAttribute("autohide") == "true";
document.getElementById("appmenu-button-container").hidden = !displayAppButton;
document.getElementById("titlebar").hidden = !displayAppButton;
if (displayAppButton)
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
else
document.documentElement.removeAttribute("chromemargin");
}
function onTitlebarMaxClick() {
if (window.windowState == window.STATE_MAXIMIZED)
window.restore();
else
window.maximize();
}
#endif
function displaySecurityInfo()
@ -6985,8 +7004,13 @@ var gIdentityHandler = {
if (!this._eTLDService)
this._eTLDService = Cc["@mozilla.org/network/effective-tld-service;1"]
.getService(Ci.nsIEffectiveTLDService);
if (!this._IDNService)
this._IDNService = Cc["@mozilla.org/network/idn-service;1"]
.getService(Ci.nsIIDNService);
try {
return this._eTLDService.getBaseDomainFromHost(this._lastLocation.hostname);
let baseDomain =
this._eTLDService.getBaseDomainFromHost(this._lastLocation.hostname);
return this._IDNService.convertToDisplayIDN(baseDomain, {});
} catch (e) {
// If something goes wrong (e.g. hostname is an IP address) just fail back
// to the full domain.

View File

@ -263,10 +263,10 @@
label="&inspectStyleButton.label;"
accesskey="&inspectStyleButton.accesskey;"
class="toolbarbutton-text"
oncommand="InspectorUI.toggleStylePanel();'"/>
oncommand="InspectorUI.toggleStylePanel();"/>
<toolbarbutton id="inspector-dom-toolbutton"
label="&inspectDOMButton.label;"
accesskey="&inspectDOMButton.accesskey;"
label="&inspectObjectButton.label;"
accesskey="&inspectObjectButton.accesskey;"
class="toolbarbutton-text"
oncommand="InspectorUI.toggleDOMPanel();"/>
</toolbar>
@ -449,7 +449,9 @@
</popupset>
#ifdef MENUBAR_CAN_AUTOHIDE
<hbox id="appmenu-button-container">
<vbox id="titlebar">
<hbox id="titlebar-content">
<hbox id="appmenu-button-container" align="start">
<button id="appmenu-button"
type="menu"
label="&brandShortName;"
@ -483,11 +485,10 @@
<menuitem id="appmenu_privateBrowsing"
class="menuitem-iconic"
label="&privateBrowsingCmd.start.label;"
accesskey="&privateBrowsingCmd.start.accesskey;"
startlabel="&privateBrowsingCmd.start.label;"
stoplabel="&privateBrowsingCmd.stop.label;"
command="Tools:PrivateBrowsing"/>
<menuseparator class="menu-seperator"/>
<menuseparator/>
<hbox class="split-menuitem">
<menuitem id="appmenu-edit-menuitem"
label="&editMenu.label;"
@ -558,7 +559,6 @@
command="View:PageSource"/>
<menuseparator/>
<menuitem label="&goOfflineCmd.label;"
accesskey="&goOfflineCmd.accesskey;"
type="checkbox"
oncommand="BrowserOffline.toggleOfflineStatus();"/>
</menupopup>
@ -746,7 +746,15 @@
</hbox>
</menupopup>
</button>
</hbox>
</hbox>
<spacer id="titlebar-spacer" flex="1"/>
<hbox id="titlebar-buttonbox">
<toolbarbutton id="titlebar-min" oncommand="window.minimize();"/>
<toolbarbutton id="titlebar-max" oncommand="onTitlebarMaxClick();"/>
<toolbarbutton id="titlebar-close" oncommand="window.close();"/>
</hbox>
</hbox>
</vbox>
#endif
<deck flex="1" id="tab-view-deck">
@ -1065,7 +1073,7 @@
iconsize="small" defaulticonsize="small" lockiconsize="true"
aria-label="&tabsToolbar.label;"
context="toolbar-context-menu"
defaultset="tabbrowser-tabs,new-tab-button,tabview-button,alltabs-button,tabs-closebutton"
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button,tabview-button,tabs-closebutton"
collapsed="true">
<tabs id="tabbrowser-tabs"
@ -1115,6 +1123,9 @@
<toolbarpalette id="BrowserToolbarPalette">
# Update primaryToolbarButtons in browser/themes/browserShared.inc when adding
# or removing default items with the toolbarbutton-1 class.
<toolbarbutton id="print-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&printButton.label;" command="cmd_print"
tooltiptext="&printButton.tooltip;"/>
@ -1200,7 +1211,7 @@
</vbox>
</hbox>
<vbox id="browser-bottombox">
<vbox id="browser-bottombox" layer="true">
<statusbar class="chromeclass-status" id="status-bar"
#ifdef WINCE
hidden="true"

View File

@ -377,22 +377,22 @@ InspectorTreeView.prototype = {
/**
* Get the index of the selected row.
*
* @returns number
* @returns number -1 if there is no row selected.
*/
get selectionIndex()
{
return this.selection.currentIndex;
return this.selection ? this.selection.currentIndex : -1;
},
/**
* Get the corresponding node for the currently-selected row in the tree.
*
* @returns DOMNode
* @returns DOMNode|null
*/
get selectedNode()
{
let rowIndex = this.selectionIndex;
return this.view.getNodeFromRowIndex(rowIndex);
return rowIndex > -1 ? this.view.getNodeFromRowIndex(rowIndex) : null;
},
/**
@ -505,7 +505,7 @@ var InspectorUI = {
toggleInspectorUI: function IUI_toggleInspectorUI(aEvent)
{
if (this.isPanelOpen) {
this.closeInspectorUI();
this.closeInspectorUI(true);
} else {
this.openInspectorUI();
}
@ -547,6 +547,7 @@ var InspectorUI = {
if (this.isDOMPanelOpen) {
this.domPanel.hidePopup();
} else {
this.clearDOMPanel();
this.openDOMPanel();
if (this.treeView.selectedNode) {
this.updateDOMPanel(this.treeView.selectedNode);
@ -628,6 +629,7 @@ var InspectorUI = {
openDOMPanel: function IUI_openDOMPanel()
{
if (!this.isDOMPanelOpen) {
this.domPanel.hidden = false;
// open at middle right of browser panel, offset by 20px from middle.
this.domPanel.openPopup(this.browser, "end_before", 0,
this.win.outerHeight / 2 - 20, false, false);
@ -654,18 +656,21 @@ var InspectorUI = {
/**
* Open inspector UI. tree, style and DOM panels if enabled. Add listeners for
* document scrolling, resize and tabContainer.TabSelect.
* document scrolling, resize, tabContainer.TabSelect and others.
*/
openInspectorUI: function IUI_openInspectorUI()
{
// initialization
this.browser = gBrowser.selectedBrowser;
this.win = this.browser.contentWindow;
this.winID = this.getWindowID(this.win);
// DOM panel initialization and loading (via PropertyPanel.jsm)
let domPanelTitle = this.strings.GetStringFromName("dom.domPanelTitle");
let objectPanelTitle = this.strings.
GetStringFromName("object.objectPanelTitle");
let parent = document.getElementById("inspector-style-panel").parentNode;
this.propertyPanel = new (this.PropertyPanel)(parent, document, domPanelTitle, {});
this.propertyPanel = new (this.PropertyPanel)(parent, document,
objectPanelTitle, {});
// additional DOM panel setup needed for unittest identification and use
this.domPanel = this.propertyPanel.panel;
@ -687,11 +692,30 @@ var InspectorUI = {
// setup highlighter and start inspecting
this.initializeHighlighter();
this.startInspecting();
if (!InspectorStore.hasID(this.winID) ||
InspectorStore.getValue(this.winID, "inspecting")) {
this.startInspecting();
}
this.win.document.addEventListener("scroll", this, false);
this.win.addEventListener("resize", this, false);
gBrowser.tabContainer.addEventListener("TabSelect", this, false);
this.inspectCmd.setAttribute("checked", true);
if (InspectorStore.isEmpty()) {
gBrowser.tabContainer.addEventListener("TabSelect", this, false);
}
if (InspectorStore.hasID(this.winID)) {
let selectedNode = InspectorStore.getValue(this.winID, "selectedNode");
if (selectedNode) {
this.inspectNode(selectedNode);
}
} else {
InspectorStore.addStore(this.winID);
InspectorStore.setValue(this.winID, "selectedNode", null);
this.win.addEventListener("pagehide", this, true);
}
},
/**
@ -704,14 +728,30 @@ var InspectorUI = {
/**
* Close inspector UI and associated panels. Unhighlight and stop inspecting.
* Remove event listeners for document scrolling, resize and
* tabContainer.TabSelect.
* Remove event listeners for document scrolling, resize,
* tabContainer.TabSelect and others.
*
* @param boolean aClearStore tells if you want the store associated to the
* current tab/window to be cleared or not.
*/
closeInspectorUI: function IUI_closeInspectorUI()
closeInspectorUI: function IUI_closeInspectorUI(aClearStore)
{
if (aClearStore) {
InspectorStore.deleteStore(this.winID);
this.win.removeEventListener("pagehide", this, true);
} else {
// Update the store before closing.
InspectorStore.setValue(this.winID, "selectedNode",
this.treeView.selectedNode);
InspectorStore.setValue(this.winID, "inspecting", this.inspecting);
}
if (InspectorStore.isEmpty()) {
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
}
this.win.document.removeEventListener("scroll", this, false);
this.win.removeEventListener("resize", this, false);
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
this.stopInspecting();
if (this.highlighter && this.highlighter.isHighlighting) {
this.highlighter.unhighlight();
@ -731,6 +771,7 @@ var InspectorUI = {
}
this.inspectCmd.setAttribute("checked", false);
this.browser = this.win = null; // null out references to browser and window
this.winID = null;
},
/**
@ -911,9 +952,41 @@ var InspectorUI = {
*/
handleEvent: function IUI_handleEvent(event)
{
let winID = null;
let win = null;
switch (event.type) {
case "TabSelect":
this.closeInspectorUI();
winID = this.getWindowID(gBrowser.selectedBrowser.contentWindow);
if (this.isPanelOpen && winID != this.winID) {
this.closeInspectorUI(false);
}
if (winID && InspectorStore.hasID(winID)) {
this.openInspectorUI();
}
if (InspectorStore.isEmpty()) {
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
}
break;
case "pagehide":
win = event.originalTarget.defaultView;
// Skip iframes/frames.
if (!win || win.frameElement || win.top != win) {
break;
}
win.removeEventListener(event.type, this, true);
winID = this.getWindowID(win);
if (winID && winID != this.winID) {
InspectorStore.deleteStore(winID);
}
if (InspectorStore.isEmpty()) {
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
}
break;
case "keypress":
switch (event.keyCode) {
@ -1031,6 +1104,28 @@ var InspectorUI = {
///////////////////////////////////////////////////////////////////////////
//// Utility functions
/**
* Retrieve the unique ID of a window object.
*
* @param nsIDOMWindow aWindow
* @returns integer ID
*/
getWindowID: function IUI_getWindowID(aWindow)
{
if (!aWindow) {
return null;
}
let util = {};
try {
util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
} catch (ex) { }
return util.currentInnerWindowID;
},
/**
* debug logging facility
* @param msg
@ -1042,6 +1137,129 @@ var InspectorUI = {
},
}
/**
* The Inspector store is used for storing data specific to each tab window.
*/
var InspectorStore = {
store: {},
length: 0,
/**
* Check if there is any data recorded for any tab/window.
*
* @returns boolean True if there are no stores for any window/tab, or false
* otherwise.
*/
isEmpty: function IS_isEmpty()
{
return this.length == 0 ? true : false;
},
/**
* Add a new store.
*
* @param string aID The Store ID you want created.
* @returns boolean True if the store was added successfully, or false
* otherwise.
*/
addStore: function IS_addStore(aID)
{
let result = false;
if (!(aID in this.store)) {
this.store[aID] = {};
this.length++;
result = true;
}
return result;
},
/**
* Delete a store by ID.
*
* @param string aID The store ID you want deleted.
* @returns boolean True if the store was removed successfully, or false
* otherwise.
*/
deleteStore: function IS_deleteStore(aID)
{
let result = false;
if (aID in this.store) {
delete this.store[aID];
this.length--;
result = true;
}
return result;
},
/**
* Check store existence.
*
* @param string aID The store ID you want to check.
* @returns boolean True if the store ID is registered, or false otherwise.
*/
hasID: function IS_hasID(aID)
{
return (aID in this.store);
},
/**
* Retrieve a value from a store for a given key.
*
* @param string aID The store ID you want to read the value from.
* @param string aKey The key name of the value you want.
* @returns mixed the value associated to your store and key.
*/
getValue: function IS_getValue(aID, aKey)
{
return aID in this.store ? this.store[aID][aKey] : null;
},
/**
* Set a value for a given key and store.
*
* @param string aID The store ID where you want to store the value into.
* @param string aKey The key name for which you want to save the value.
* @param mixed aValue The value you want stored.
* @returns boolean True if the value was stored successfully, or false
* otherwise.
*/
setValue: function IS_setValue(aID, aKey, aValue)
{
let result = false;
if (aID in this.store) {
this.store[aID][aKey] = aValue;
result = true;
}
return result;
},
/**
* Delete a value for a given key and store.
*
* @param string aID The store ID where you want to store the value into.
* @param string aKey The key name for which you want to save the value.
* @returns boolean True if the value was removed successfully, or false
* otherwise.
*/
deleteValue: function IS_deleteValue(aID, aKey)
{
let result = false;
if (aID in this.store && aKey in this.store[aID]) {
delete this.store[aID][aKey];
result = true;
}
return result;
}
};
/////////////////////////////////////////////////////////////////////////
//// Initializors

View File

@ -184,6 +184,7 @@
this.moveTabTo(aTab, this._numPinnedTabs);
aTab.setAttribute("pinned", "true");
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
]]></body>
</method>
@ -198,6 +199,7 @@
aTab.removeAttribute("pinned");
aTab.style.MozMarginStart = "";
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
]]></body>
</method>
@ -2648,9 +2650,12 @@
this.setAttribute("closebuttons", "activetab");
break;
case 1:
if (this.childNodes.length == 1 && this._closeWindowWithLastTab)
this.setAttribute("closebuttons", "noclose");
else {
if (this.childNodes.length == 1) {
if (this._closeWindowWithLastTab)
this.setAttribute("closebuttons", "noclose");
else
this.setAttribute("closebuttons", "alltabs");
} else {
let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs];
if (tab && tab.getBoundingClientRect().width > this.mTabClipWidth)
this.setAttribute("closebuttons", "alltabs");
@ -2864,6 +2869,15 @@
this.mTabstrip._updateScrollButtonsDisabledState();
]]></body>
</method>
<method name="_canAdvanceToTab">
<parameter name="aTab"/>
<body>
<![CDATA[
return this.tabbrowser._removingTabs.indexOf(aTab) == -1;
]]>
</body>
</method>
<!-- Deprecated stuff, implemented for backwards compatibility. -->
<property name="mTabstripClosebutton" readonly="true"

View File

@ -109,7 +109,7 @@ Drag.prototype = {
// checkItemStatus - (boolean) make sure this is a valid item which should be snapped
snapBounds: function Drag_snapBounds(bounds, stationaryCorner, assumeConstantSize, keepProportional, checkItemStatus) {
if (!stationaryCorner)
stationaryCorner || 'topleft';
stationaryCorner = 'topleft';
var update = false; // need to update
var updateX = false;
var updateY = false;

View File

@ -722,19 +722,6 @@ window.GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
});
},
// ----------
// Function: setNewTabButtonBounds
// Used for positioning the "new tab" button in the "new tabs" groupItem.
setNewTabButtonBounds: function(box, immediately) {
if (!immediately)
this.$ntb.animate(box.css(), {
duration: 320,
easing: "tabviewBounce"
});
else
this.$ntb.css(box.css());
},
// ----------
// Function: hideExpandControl
// Hide the control which expands a stacked groupItem into a quick-look view.
@ -1604,15 +1591,13 @@ window.GroupItems = {
},
// ----------
// Function: updateTabBar
// Function: _updateTabBar
// Hides and shows tabs in the tab bar based on the active groupItem or
// currently active orphan tabItem
updateTabBar: function() {
_updateTabBar: function() {
if (!window.UI)
return; // called too soon
// Utils.log('updateTabBar', this._activeGroupItem, this._activeOrphanTab);
if (!this._activeGroupItem && !this._activeOrphanTab) {
Utils.assert(false, "There must be something to show in the tab bar!");
return;
@ -1623,6 +1608,21 @@ window.GroupItems = {
gBrowser.showOnlyTheseTabs(tabItems.map(function(item) item.tab));
},
// ----------
// Function: updateActiveGroupItemAndTabBar
// Sets active group item and updates tab bar
updateActiveGroupItemAndTabBar: function(tabItem) {
if (tabItem.parent) {
let groupItem = tabItem.parent;
this.setActiveGroupItem(groupItem);
groupItem.setActiveTab(tabItem);
} else {
this.setActiveGroupItem(null);
this.setActiveOrphanTab(tabItem);
}
this._updateTabBar();
},
// ----------
// Function: getOrphanedTabs
// Returns an array of all tabs that aren't in a groupItem.
@ -1641,15 +1641,15 @@ window.GroupItems = {
// Returns the <tabItem>. If nothing is found, return null.
getNextGroupItemTab: function(reverse) {
var groupItems = Utils.copy(GroupItems.groupItems);
if (reverse)
groupItems = groupItems.reverse();
var activeGroupItem = GroupItems.getActiveGroupItem();
var activeOrphanTab = GroupItems.getActiveOrphanTab();
var tabItem = null;
if (reverse)
groupItems = groupItems.reverse();
if (!activeGroupItem) {
if (groupItems.length > 0) {
groupItems.some(function(groupItem) {
var child = groupItem.getChild(0);
if (child) {
@ -1660,9 +1660,6 @@ window.GroupItems = {
});
}
} else {
if (reverse)
groupItems = groupItems.reverse();
var currentIndex;
groupItems.some(function(groupItem, index) {
if (groupItem == activeGroupItem) {
@ -1749,7 +1746,7 @@ window.GroupItems = {
}
if (shouldUpdateTabBar)
this.updateTabBar();
this._updateTabBar();
else if (shouldShowTabView) {
tab.tabItem.setZoomPrep(false);
UI.showTabView();

View File

@ -523,28 +523,16 @@ window.TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
function onZoomDone() {
TabItems.resumePainting();
// If it's not focused, the onFocus lsitener would handle it.
if (gBrowser.selectedTab == tab)
UI.tabOnFocus(tab);
else
gBrowser.selectedTab = tab;
$tabEl
.css(orig.css())
.removeClass("front");
// If the tab is in a groupItem set then set the active
// groupItem to the tab's parent.
if (self.parent) {
var gID = self.parent.id;
var groupItem = GroupItems.groupItem(gID);
GroupItems.setActiveGroupItem(groupItem);
groupItem.setActiveTab(self);
} else {
GroupItems.setActiveGroupItem(null);
GroupItems.setActiveOrphanTab(self);
}
GroupItems.updateTabBar();
// If it's not focused, the onFocus lsitener would handle it.
if (gBrowser.selectedTab == tab)
UI.onTabSelect(tab);
else
gBrowser.selectedTab = tab;
if (isNewBlankTab)
gWindow.gURLBar.focus();
@ -602,15 +590,12 @@ window.TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
duration: 300,
easing: 'cubic-bezier', // note that this is legal easing, even without parameters
complete: function() { // note that this will happen on the DOM thread
$tab.removeClass('front');
self.setZoomPrep(false);
GroupItems.setActiveOrphanTab(null);
TabItems.resumePainting();
self._zoomPrep = false;
self.setBounds(self.getBounds(), true, {force: true});
if (typeof complete == "function")
complete();
}

View File

@ -453,19 +453,17 @@ var UIManager = {
if (tab.ownerDocument.defaultView != gWindow)
return;
self.tabOnFocus(tab);
self.onTabSelect(tab);
});
},
// ----------
// Function: tabOnFocus
// Function: onTabSelect
// Called when the user switches from one tab to another outside of the TabView UI.
tabOnFocus: function(tab) {
var self = this;
var focusTab = tab;
var currentTab = this._currentTab;
onTabSelect: function(tab) {
let currentTab = this._currentTab;
this._currentTab = tab;
this._currentTab = focusTab;
// if the last visible tab has just been closed, don't show the chrome UI.
if (this._isTabViewVisible() &&
(this._closedLastVisibleTab || this._closedSelectedTabInTabView)) {
@ -473,50 +471,33 @@ var UIManager = {
this._closedSelectedTabInTabView = false;
return;
}
// reset these vars, just in case.
this._closedLastVisibleTab = false;
this._closedSelectedTabInTabView = false;
// if TabView is visible but we didn't just close the last tab or
// selected tab, show chrome.
if (this._isTabViewVisible())
this.hideTabView();
// reset these vars, just in case.
this._closedLastVisibleTab = false;
this._closedSelectedTabInTabView = false;
// have things have changed while we were in timeout?
if (focusTab != self._currentTab)
return;
let oldItem = null;
let newItem = null;
if (focusTab && focusTab.tabItem) {
newItem = focusTab.tabItem;
if (newItem.parent)
GroupItems.setActiveGroupItem(newItem.parent);
else {
GroupItems.setActiveGroupItem(null);
GroupItems.setActiveOrphanTab(newItem);
}
GroupItems.updateTabBar();
if (currentTab && currentTab.tabItem)
oldItem = currentTab.tabItem;
if (tab && tab.tabItem) {
newItem = tab.tabItem;
GroupItems.updateActiveGroupItemAndTabBar(newItem);
}
// ___ prepare for when we return to TabView
let oldItem = null;
if (currentTab && currentTab.tabItem)
oldItem = currentTab.tabItem;
if (newItem != oldItem) {
if (oldItem)
oldItem.setZoomPrep(false);
// if the last visible tab is removed, don't set zoom prep because
// we should be in the TabView interface.
let visibleTabCount = gBrowser.visibleTabs.length;
if (visibleTabCount > 0 && newItem && !self._isTabViewVisible())
if (newItem)
newItem.setZoomPrep(true);
}
// the tab is already focused so the new and old items are the same.
else if (oldItem)
oldItem.setZoomPrep(!self._isTabViewVisible());
} else if (oldItem)
oldItem.setZoomPrep(true);
},
// ----------
@ -563,7 +544,7 @@ var UIManager = {
if (!self.getActiveTab() || iQ(":focus").length > 0) {
// prevent the default action when tab is pressed so it doesn't gives
// us problem with content focus.
if (event.which == 9) {
if (event.keyCode == KeyEvent.DOM_VK_TAB) {
event.stopPropagation();
event.preventDefault();
}
@ -585,17 +566,17 @@ var UIManager = {
}
var norm = null;
switch (event.which) {
case 39: // Right
switch (event.keyCode) {
case KeyEvent.DOM_VK_RIGHT:
norm = function(a, me){return a.x > me.x};
break;
case 37: // Left
case KeyEvent.DOM_VK_LEFT:
norm = function(a, me){return a.x < me.x};
break;
case 40: // Down
case KeyEvent.DOM_VK_DOWN:
norm = function(a, me){return a.y > me.y};
break;
case 38: // Up
case KeyEvent.DOM_VK_UP:
norm = function(a, me){return a.y < me.y}
break;
}
@ -609,7 +590,7 @@ var UIManager = {
}
event.stopPropagation();
event.preventDefault();
} else if (event.which == 32) {
} else if (event.keyCode == KeyEvent.DOM_VK_SPACE) {
// alt/control + space to zoom into the active tab.
#ifdef XP_MACOSX
if (event.altKey && !event.metaKey && !event.shiftKey &&
@ -624,14 +605,21 @@ var UIManager = {
event.stopPropagation();
event.preventDefault();
}
} else if (event.which == 27 || event.which == 13) {
// esc or return to zoom into the active tab.
var activeTab = self.getActiveTab();
if (activeTab)
activeTab.zoomIn();
} else if (event.keyCode == KeyEvent.DOM_VK_ESCAPE ||
event.keyCode == KeyEvent.DOM_VK_RETURN ||
event.keyCode == KeyEvent.DOM_VK_ENTER) {
let activeTab = self.getActiveTab();
let activeGroupItem = GroupItems.getActiveGroupItem();
if (activeGroupItem && activeGroupItem.expanded &&
event.keyCode == KeyEvent.DOM_VK_ESCAPE)
activeGroupItem.collapse();
else if (activeTab)
activeTab.zoomIn();
event.stopPropagation();
event.preventDefault();
} else if (event.which == 9) {
} else if (event.keyCode == KeyEvent.DOM_VK_TAB) {
// tab/shift + tab to go to the next tab.
var activeTab = self.getActiveTab();
if (activeTab) {

View File

@ -142,6 +142,8 @@ _BROWSER_FILES = \
browser_bug577121.js \
browser_bug580956.js \
browser_bug581242.js \
browser_bug581947.js \
browser_bug585830.js \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \
browser_discovery.js \
@ -157,6 +159,8 @@ _BROWSER_FILES = \
browser_inspector_domPanel.js \
browser_inspector_iframeTest.js \
browser_inspector_scrolling.js \
browser_inspector_store.js \
browser_inspector_tab_switch.js \
browser_pageInfo.js \
browser_page_style_menu.js \
browser_pinnedTabs.js \

View File

@ -13,7 +13,10 @@ function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("browser.tabs.animate", true);
preperForNextText();
// preperForNextText();
todo(false, "async tests disabled because of intermittent failures (bug 585361)");
cleanup();
}
function tabAdded() {

View File

@ -18,10 +18,21 @@ function test() {
content.location = "http://test1.example.org/";
}
// Greek IDN for 'example.test'.
var idnDomain = "\u03C0\u03B1\u03C1\u03AC\u03B4\u03B5\u03B9\u03B3\u03BC\u03B1.\u03B4\u03BF\u03BA\u03B9\u03BC\u03AE";
function testNormalDomain() {
is(gIdentityHandler._lastLocation.host, 'test1.example.org', "Identity handler is getting the full location");
is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for test1.example.org");
listener.testFunction = testIDNDomain;
content.location = "http://sub1." + idnDomain + "/";
}
function testIDNDomain() {
is(gIdentityHandler._lastLocation.host, "sub1." + idnDomain, "Identity handler is getting the full location");
is(gIdentityHandler.getEffectiveHost(), idnDomain, "getEffectiveHost should return the IDN base domain in UTF-8");
listener.testFunction = testNormalDomainWithPort;
content.location = "http://sub1.test1.example.org:8000/";
}

View File

@ -59,7 +59,7 @@ function test_blocked_install() {
// Wait for the blocked notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-blocked", "Should have seen the install blocked");
is(notification.id, "addon-install-blocked-notification", "Should have seen the install blocked");
is(notification.button.label, "Allow", "Should have seen the right button");
is(notification.getAttribute("label"),
gApp + " prevented this site (example.com) from asking you to install " +
@ -76,7 +76,7 @@ function test_blocked_install() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"XPI Test will be installed after you restart " + gApp + ".",
@ -111,7 +111,7 @@ function test_whitelisted_install() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"XPI Test will be installed after you restart " + gApp + ".",
@ -142,7 +142,7 @@ function test_failed_download() {
// Wait for the failed notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-failed", "Should have seen the install fail");
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
is(notification.getAttribute("label"),
"The add-on could not be downloaded because of a connection failure " +
"on example.com.",
@ -167,7 +167,7 @@ function test_corrupt_file() {
// Wait for the failed notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-failed", "Should have seen the install fail");
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
is(notification.getAttribute("label"),
"The add-on downloaded from example.com could not be installed " +
"because it appears to be corrupt.",
@ -192,7 +192,7 @@ function test_incompatible() {
// Wait for the failed notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-failed", "Should have seen the install fail");
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
is(notification.getAttribute("label"),
"XPI Test could not be installed because it is not compatible with " +
gApp + " " + gVersion + ".",
@ -221,7 +221,7 @@ function test_restartless() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
is(notification.button.label, "Open Add-ons Manager", "Should have seen the right button");
is(notification.getAttribute("label"),
"XPI Test has been installed successfully.",
@ -260,7 +260,7 @@ function test_multiple() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"2 add-ons will be installed after you restart " + gApp + ".",
@ -293,7 +293,7 @@ function test_url() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"XPI Test will be installed after you restart " + gApp + ".",
@ -321,7 +321,7 @@ function test_localfile() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-failed", "Should have seen the install fail");
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
is(notification.getAttribute("label"),
"This add-on could not be installed because it appears to be corrupt.",
"Should have seen the right message");
@ -344,7 +344,7 @@ function test_wronghost() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-failed", "Should have seen the install fail");
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
is(notification.getAttribute("label"),
"The add-on downloaded from example.com could not be installed " +
"because it appears to be corrupt.",
@ -374,7 +374,7 @@ function test_reload() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"XPI Test will be installed after you restart " + gApp + ".",
@ -425,7 +425,7 @@ function test_theme() {
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete", "Should have seen the install complete");
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"Theme Test will be installed after you restart " + gApp + ".",
@ -436,6 +436,105 @@ function test_theme() {
runNextTest();
});
});
},
function test_renotify_blocked() {
var triggers = encodeURIComponent(JSON.stringify({
"XPI": "unsigned.xpi"
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
// Wait for the blocked notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-blocked-notification", "Should have seen the install blocked");
aPanel.addEventListener("popuphidden", function () {
aPanel.removeEventListener("popuphidden", arguments.callee, false);
info("Timeouts after this probably mean bug 589954 regressed");
executeSoon(function () {
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-blocked-notification",
"Should have seen the install blocked - 2nd time");
AddonManager.getAllInstalls(function(aInstalls) {
is(aInstalls.length, 2, "Should be two pending installs");
aInstalls[0].cancel();
aInstalls[1].cancel();
info("Closing browser tab");
gBrowser.removeTab(gBrowser.selectedTab);
runNextTest();
});
});
});
}, false);
// hide the panel (this simulates the user dismissing it)
aPanel.hidePopup();
});
},
function test_renotify_installed() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"XPI": "unsigned.xpi"
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
// Wait for the install confirmation dialog
wait_for_install_dialog(function(aWindow) {
aWindow.document.documentElement.acceptDialog();
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
// Dismiss the notification
aPanel.addEventListener("popuphidden", function () {
aPanel.removeEventListener("popuphidden", arguments.callee, false);
// Install another
executeSoon(function () {
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
// Wait for the install confirmation dialog
wait_for_install_dialog(function(aWindow) {
aWindow.document.documentElement.acceptDialog();
info("Timeouts after this probably mean bug 589954 regressed");
// Wait for the complete notification
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-install-complete-notification", "Should have seen the second install complete");
AddonManager.getAllInstalls(function(aInstalls) {
is(aInstalls.length, 2, "Should be two pending installs");
aInstalls[0].cancel();
aInstalls[1].cancel();
gBrowser.removeTab(gBrowser.selectedTab);
runNextTest();
});
});
});
});
}, false);
// hide the panel (this simulates the user dismissing it)
aPanel.hidePopup();
});
});
}
];

View File

@ -0,0 +1,85 @@
function check(aElementName, aBarred, aType) {
let doc = gBrowser.contentDocument;
let tooltip = document.getElementById("aHTMLTooltip");
let content = doc.getElementById('content');
let e = doc.createElement(aElementName);
content.appendChild(e);
if (aType) {
e.type = aType;
}
ok(!FillInHTMLTooltip(e),
"No tooltip should be shown when the element is valid");
e.setCustomValidity('foo');
if (aBarred) {
ok(!FillInHTMLTooltip(e),
"No tooltip should be shown when the element is barred from constraint validation");
} else {
ok(FillInHTMLTooltip(e),
"A tooltip should be shown when the element isn't valid");
}
content.removeChild(e);
}
function todo_check(aElementName, aBarred) {
let doc = gBrowser.contentDocument;
let tooltip = document.getElementById("aHTMLTooltip");
let content = doc.getElementById('content');
let e = doc.createElement(aElementName);
content.appendChild(e);
let cought = false;
try {
e.setCustomValidity('foo');
} catch (e) {
cought = true;
}
todo(!cought, "setCustomValidity should exist for " + aElementName);
content.removeChild(e);
}
function test () {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
let testData = [
/* element name, barred, type */
[ 'input', false, null],
[ 'textarea', false, null],
[ 'button', true, 'button'],
[ 'button', false, 'submit' ],
[ 'select', false, null],
[ 'output', true, null],
[ 'fieldset', true, null],
[ 'object', 'false' ],
];
for each (let data in testData) {
check(data[0], data[1], data[2]);
}
let todo_testData = [
[ 'keygen', 'false' ],
];
for each(let data in todo_testData) {
todo_check(data[0], data[1]);
}
gBrowser.removeCurrentTab();
finish();
}, true);
content.location =
"data:text/html,<!DOCTYPE html><html><body><div id='content'></div></body></html>";
}

View File

@ -0,0 +1,57 @@
/* ***** 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 bug 585830 test.
*
* The Initial Developer of the Original Code is
* Sindre Dammann <sindrebugzilla@gmail.com>
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function test() {
let tab1 = gBrowser.selectedTab;
let tab2 = gBrowser.addTab("about:blank", {skipAnimation: true});
let tab3 = gBrowser.addTab();
gBrowser.selectedTab = tab2;
gBrowser.removeCurrentTab({animate: true});
gBrowser.tabContainer.advanceSelectedTab(-1, true);
is(gBrowser.selectedTab, tab1, "First tab should be selected");
gBrowser.removeTab(tab2);
// test for "null has no properties" fix. See Bug 585830 Comment 13
gBrowser.removeCurrentTab({animate: true});
try {
gBrowser.tabContainer.advanceSelectedTab(-1, false);
} catch(err) {
ok(false, "Shouldn't throw");
}
gBrowser.removeTab(tab1);
}

View File

@ -0,0 +1,106 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** 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 Inspector Store Tests.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mihai Șucan <mihai.sucan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* 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 ***** */
function test()
{
ok(InspectorUI, "InspectorUI variable exists");
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
is(InspectorStore.length, 0, "InspectorStore is empty");
ok(InspectorStore.isEmpty(), "InspectorStore is empty (confirmed)");
is(typeof InspectorStore.store, "object",
"InspectorStore.store is an object");
ok(InspectorStore.addStore("foo"), "addStore('foo') returns true");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
ok(!InspectorStore.isEmpty(), "InspectorStore is not empty");
is(typeof InspectorStore.store.foo, "object", "store.foo is an object");
ok(InspectorStore.addStore("fooBar"), "addStore('fooBar') returns true");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
is(typeof InspectorStore.store.fooBar, "object", "store.fooBar is an object");
ok(!InspectorStore.addStore("fooBar"), "addStore('fooBar') returns false");
ok(InspectorStore.deleteStore("fooBar"),
"deleteStore('fooBar') returns true");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
ok(!InspectorStore.store.fooBar, "store.fooBar is deleted");
ok(!InspectorStore.deleteStore("fooBar"),
"deleteStore('fooBar') returns false");
ok(!InspectorStore.hasID("fooBar"), "hasID('fooBar') returns false");
ok(InspectorStore.hasID("foo"), "hasID('foo') returns true");
ok(InspectorStore.setValue("foo", "key1", "val1"), "setValue() returns true");
ok(!InspectorStore.setValue("fooBar", "key1", "val1"),
"setValue() returns false");
is(InspectorStore.getValue("foo", "key1"), "val1",
"getValue() returns the correct value");
is(InspectorStore.store.foo.key1, "val1", "store.foo.key1 = 'val1'");
ok(!InspectorStore.getValue("fooBar", "key1"),
"getValue() returns null for unknown store");
ok(!InspectorStore.getValue("fooBar", "key1"),
"getValue() returns null for unknown store");
ok(InspectorStore.deleteValue("foo", "key1"),
"deleteValue() returns true for known value");
ok(!InspectorStore.store.foo.key1, "deleteValue() removed the value.");
ok(!InspectorStore.deleteValue("fooBar", "key1"),
"deleteValue() returns false for unknown store.");
ok(!InspectorStore.deleteValue("foo", "key1"),
"deleteValue() returns false for unknown value.");
ok(InspectorStore.deleteStore("foo"), "deleteStore('foo') returns true");
ok(InspectorStore.isEmpty(), "InspectorStore is empty");
}

View File

@ -0,0 +1,198 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** 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 Inspector Tab Switch Tests.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Campbell <rcampbell@mozilla.com>
* Mihai Șucan <mihai.sucan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* 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 ***** */
let div;
let tab1;
let tab2;
let tab1window;
function inspectorTabOpen1()
{
ok(InspectorUI, "InspectorUI variable exists");
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorStore.isEmpty(), "InspectorStore is empty");
document.addEventListener("popupshown", inspectorUIOpen1, false);
InspectorUI.toggleInspectorUI();
}
function inspectorUIOpen1(evt)
{
if (evt.target.id != "inspector-style-panel") {
return true;
}
document.removeEventListener(evt.type, arguments.callee, false);
// Make sure the inspector is open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isPanelOpen, "Inspector Tree Panel is open");
ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
ok(!InspectorStore.isEmpty(), "InspectorStore is not empty");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
// Highlight a node.
div = content.document.getElementsByTagName("div")[0];
InspectorUI.inspectNode(div);
is(InspectorUI.treeView.selectedNode, div,
"selection matches the div element");
// Open the second tab.
tab2 = gBrowser.addTab();
gBrowser.selectedTab = tab2;
gBrowser.selectedBrowser.addEventListener("load", function(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
true);
waitForFocus(inspectorTabOpen2, content);
}, true);
content.location = "data:text/html,<p>tab 2: the inspector should close now";
}
function inspectorTabOpen2()
{
// Make sure the inspector is closed.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(!InspectorUI.isPanelOpen, "Inspector Tree Panel is closed");
ok(!InspectorUI.isStylePanelOpen, "Inspector Style Panel is closed");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
// Activate the inspector again.
document.addEventListener("popupshown", inspectorUIOpen2, false);
InspectorUI.toggleInspectorUI();
}
function inspectorUIOpen2(evt)
{
if (evt.target.id != "inspector-style-panel") {
return true;
}
document.removeEventListener(evt.type, arguments.callee, false);
// Make sure the inspector is open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isPanelOpen, "Inspector Tree Panel is open");
ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
// Disable highlighting.
InspectorUI.toggleInspection();
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
// Switch back to tab 1.
document.addEventListener("popupshown", inspectorFocusTab1, false);
gBrowser.selectedTab = tab1;
}
function inspectorFocusTab1(evt)
{
if (evt.target.id != "inspector-style-panel") {
return true;
}
document.removeEventListener(evt.type, arguments.callee, false);
// Make sure the inspector is still open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isPanelOpen, "Inspector Tree Panel is open");
ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
is(InspectorUI.treeView.selectedNode, div,
"selection matches the div element");
// Switch back to tab 2.
document.addEventListener("popupshown", inspectorFocusTab2, false);
gBrowser.selectedTab = tab2;
}
function inspectorFocusTab2(evt)
{
if (evt.target.id != "inspector-style-panel") {
return true;
}
document.removeEventListener(evt.type, arguments.callee, false);
// Make sure the inspector is still open.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorUI.isPanelOpen, "Inspector Tree Panel is open");
ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
isnot(InspectorUI.treeView.selectedNode, div,
"selection does not match the div element");
// Remove tab 1.
tab1window = gBrowser.getBrowserForTab(tab1).contentWindow;
tab1window.addEventListener("unload", inspectorTabUnload1, false);
gBrowser.removeTab(tab1);
}
function inspectorTabUnload1(evt)
{
tab1window.removeEventListener(evt.type, arguments.callee, false);
tab1window = tab1 = tab2 = div = null;
// Make sure the Inspector is still open and that the state is correct.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorUI.isPanelOpen, "Inspector Tree Panel is open");
ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
gBrowser.removeCurrentTab();
finish();
}
function test()
{
waitForExplicitFinish();
tab1 = gBrowser.addTab();
gBrowser.selectedTab = tab1;
gBrowser.selectedBrowser.addEventListener("load", function(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
true);
waitForFocus(inspectorTabOpen1, content);
}, true);
content.location = "data:text/html,<p>tab switching tests for inspector" +
"<div>tab 1</div>";
}

View File

@ -327,10 +327,11 @@ var tests = [
this.notification.remove();
}
},
// Test that anchor icon appears
// Test that icons appear
{ // Test #11
run: function () {
this.notifyObj = new basicNotification();
this.notifyObj.id = "geolocation";
this.notifyObj.anchorID = "geo-notification-icon";
this.notification = showNotification(this.notifyObj);
},
@ -477,8 +478,11 @@ function checkPopup(popup, notificationObj) {
is(notifications.length, 1, "only one notification displayed");
let notification = notifications[0];
let icon = document.getAnonymousElementByAttribute(notification, "class", "popup-notification-icon");
if (notificationObj.id == "geolocation")
isnot(icon.boxObject.width, 0, "icon for geo displayed");
is(notification.getAttribute("label"), notificationObj.message, "message matches");
is(notification.id, notificationObj.id, "id matches");
is(notification.id, notificationObj.id + "-notification", "id matches");
if (notificationObj.mainAction) {
is(notification.getAttribute("buttonlabel"), notificationObj.mainAction.label, "main action label matches");
is(notification.getAttribute("buttonaccesskey"), notificationObj.mainAction.accessKey, "main action accesskey matches");

View File

@ -47,9 +47,9 @@ $(warning All TabView tests are disabled for now while we iterate on the UI)
_BROWSER_FILES = \
browser_tabview_launch.js \
$(NULL)
# browser_tabview_dragdrop.js \
# browser_tabview_group.js \
browser_tabview_dragdrop.js \
browser_tabview_group.js \
$(NULL)
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

View File

@ -39,7 +39,7 @@ function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
setTimeout(function() { TabView.toggle(); }, 0);
TabView.toggle();
}
function onTabViewWindowLoaded() {
@ -48,6 +48,7 @@ function onTabViewWindowLoaded() {
ok(TabView.isVisible(), "Tab View is visible");
let contentWindow = document.getElementById("tab-view").contentWindow;
let [originalTab] = gBrowser.visibleTabs;
// create group one and two
let padding = 10;
@ -65,29 +66,29 @@ function onTabViewWindowLoaded() {
groupOne.addSubscriber(groupOne, "tabAdded", function() {
groupOne.removeSubscriber(groupOne, "tabAdded");
groupTwo.newTab("");
});
groupTwo.addSubscriber(groupTwo, "tabAdded", function() {
groupTwo.removeSubscriber(groupTwo, "tabAdded");
// carry on testing
addTest(contentWindow, groupOne.id, groupTwo.id);
groupTwo.newTab();
});
let count = 0;
let onTabViewHidden = function() {
// show the tab view.
TabView.toggle();
if (++count == 2) {
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
let onTabViewShown = function() {
if (count == 2) {
window.removeEventListener("tabviewshown", onTabViewShown, false);
addTest(contentWindow, groupOne.id, groupTwo.id, originalTab);
}
};
let onTabViewHidden = function() {
TabView.toggle();
if (++count == 2)
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
};
window.addEventListener("tabviewshown", onTabViewShown, false);
window.addEventListener("tabviewhidden", onTabViewHidden, false);
// open tab in group
groupOne.newTab("");
groupOne.newTab();
}
function addTest(contentWindow, groupOneId, groupTwoId) {
function addTest(contentWindow, groupOneId, groupTwoId, originalTab) {
let groupOne = contentWindow.GroupItems.groupItem(groupOneId);
let groupTwo = contentWindow.GroupItems.groupItem(groupTwoId);
let groupOneTabItemCount = groupOne.getChildren().length;
@ -115,15 +116,14 @@ function addTest(contentWindow, groupOneId, groupTwoId) {
let onTabViewHidden = function() {
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
finish();
groupTwo.closeAll();
};
window.addEventListener("tabviewhidden", onTabViewHidden, false);
groupTwo.addSubscriber(groupTwo, "close", function() {
groupTwo.removeSubscriber(groupTwo, "close");
contentWindow.UI.hideTabView();
finish();
});
groupTwo.closeAll();
window.addEventListener("tabviewhidden", onTabViewHidden, false);
gBrowser.selectedTab = originalTab;
}
function simulateDragDrop(srcElement, offsetX, offsetY, contentWindow) {

View File

@ -95,19 +95,19 @@ function testGroupItemWithTabItem(contentWindow) {
let tabItem = groupItem.getChild(groupItem.getChildren().length - 1);
ok(tabItem, "Tab item exists");
let tabRemoved = false;
let tabItemClosed = false;
tabItem.addSubscriber(tabItem, "close", function() {
tabItem.removeSubscriber(tabItem, "close");
ok(tabRemoved, "Tab is removed");
// tabItem would get destroyed after the close event is sent so we have a 0 delay here.
is(groupItem.getChildren().length, --tabItemCount,
"The number of children in new tab group is decreased by 1");
finish();
tabItemClosed = true;
});
tabItem.addSubscriber(tabItem, "tabRemoved", function() {
tabItem.removeSubscriber(tabItem, "tabRemoved");
tabRemoved = true;
ok(tabItemClosed, "The tab item is closed");
is(groupItem.getChildren().length, --tabItemCount,
"The number of children in new tab group is decreased by 1");
finish();
});
// remove the tab item. The code detects mousedown and mouseup so we stimulate here

View File

@ -452,6 +452,15 @@ function openTroubleshootingPage()
openUILinkIn("about:support", "tab");
}
/**
* Opens the feedback page for this version of the application.
*/
function openFeedbackPage()
{
openUILinkIn("http://input.mozilla.com/sad", "tab");
}
#ifdef MOZ_UPDATER
/**
* Opens the update manager and checks for updates to the application.

View File

@ -17,6 +17,9 @@ browser.jar:
* content/browser/aboutDialog.js (content/aboutDialog.js)
content/browser/aboutDialog.css (content/aboutDialog.css)
* content/browser/aboutRobots.xhtml (content/aboutRobots.xhtml)
* content/browser/aboutHome.xhtml (content/aboutHome.xhtml)
* content/browser/aboutHome.js (content/aboutHome.js)
* content/browser/aboutHome.css (content/aboutHome.css)
content/browser/aboutRobots-icon.png (content/aboutRobots-icon.png)
content/browser/aboutRobots-icon-rtl.png (content/aboutRobots-icon-rtl.png)
content/browser/aboutRobots-widget-left.png (content/aboutRobots-widget-left.png)

View File

@ -1,7 +1,9 @@
browser.jar:
% content branding %content/branding/
% content branding %content/branding/ contentaccessible=yes
content/branding/about.png (about.png)
content/branding/aboutCredits.png (aboutCredits.png)
content/branding/aboutFooter.png (aboutFooter.png)
content/branding/icon48.png (icon48.png)
content/branding/icon64.png (icon64.png)
content/branding/icon128.png (../mozicon128.png)
content/branding/icon16.png (../default16.png)

View File

@ -1 +1 @@
MOZ_APP_DISPLAYNAME="MozillaDeveloperPreview"
MOZ_APP_DISPLAYNAME=MozillaDeveloperPreview

View File

@ -1,7 +1,9 @@
browser.jar:
% content branding %content/branding/
% content branding %content/branding/ contentaccessible=yes
content/branding/about.png (about.png)
content/branding/aboutCredits.png (aboutCredits.png)
content/branding/aboutFooter.png (aboutFooter.png)
content/branding/icon48.png (icon48.png)
content/branding/icon64.png (icon64.png)
content/branding/icon128.png (../mozicon128.png)
content/branding/icon16.png (../default16.png)

View File

@ -100,6 +100,9 @@ static RedirEntry kRedirMap[] = {
{ "sync-tabs", "chrome://browser/content/aboutSyncTabs.xul",
nsIAboutModule::ALLOW_SCRIPT },
#endif
{ "home", "chrome://browser/content/aboutHome.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT },
};
static const int kRedirTotal = NS_ARRAY_LENGTH(kRedirMap);

View File

@ -205,6 +205,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
#ifdef MOZ_SERVICES_SYNC
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "sync-tabs", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#ifndef WINCE
{ NS_PROFILEMIGRATOR_CONTRACTID, &kNS_FIREFOX_PROFILEMIGRATOR_CID },
#if defined(XP_WIN) && !defined(__MINGW32__)

View File

@ -23,6 +23,7 @@
* Steven Garrity <steven@silverorange.com>
* Henrik Skupin <mozilla@hskupin.info>
* Johnathan Nightingale <johnath@mozilla.com>
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -48,11 +49,17 @@
#technicalContent > h2, #expertContent > h2 {
cursor: pointer;
padding-left: 20px;
-moz-padding-start: 20px;
position: relative;
left: -20px;
}
body[dir="rtl"] #technicalContent > h2,
body[dir="rtl"] #expertContent > h2 {
left: auto;
right: -20px;
}
div[collapsed] > p,
div[collapsed] > div {
display: none;

View File

@ -122,6 +122,13 @@
toggle('technicalContent');
toggle('expertContent');
}
// if this is a Strict-Transport-Security host and the cert
// is bad, don't allow overrides (STS Spec section 7.3).
if (getCSSClass() == "badStsCert") {
var ec = document.getElementById('expertContent');
document.getElementById('errorLongContent').removeChild(ec);
}
var tech = document.getElementById("technicalContentText");
if (tech)

View File

@ -37,6 +37,7 @@
# ***** END LICENSE BLOCK *****
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
const nsISupports = Components.interfaces.nsISupports;
@ -65,6 +66,7 @@ const nsICategoryManager = Components.interfaces.nsICategoryManager;
const nsIWebNavigationInfo = Components.interfaces.nsIWebNavigationInfo;
const nsIBrowserSearchService = Components.interfaces.nsIBrowserSearchService;
const nsICommandLineValidator = Components.interfaces.nsICommandLineValidator;
const nsIXULAppInfo = Components.interfaces.nsIXULAppInfo;
const NS_BINDING_ABORTED = Components.results.NS_BINDING_ABORTED;
const NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
@ -116,12 +118,15 @@ function resolveURIInternal(aCmdLine, aArgument) {
const OVERRIDE_NONE = 0;
const OVERRIDE_NEW_PROFILE = 1;
const OVERRIDE_NEW_MSTONE = 2;
const OVERRIDE_NEW_BUILD_ID = 3;
/**
* Determines whether a home page override is needed.
* Returns:
* OVERRIDE_NEW_PROFILE if this is the first run with a new profile.
* OVERRIDE_NEW_MSTONE if this is the first run with a build with a different
* Gecko milestone (i.e. right after an upgrade).
* OVERRIDE_NEW_BUILD_ID if this is the first run with a new build ID of the
* same Gecko milestone (i.e. after a nightly upgrade).
* OVERRIDE_NONE otherwise.
*/
function needHomepageOverride(prefb) {
@ -136,6 +141,14 @@ function needHomepageOverride(prefb) {
var mstone = Components.classes["@mozilla.org/network/protocol;1?name=http"]
.getService(nsIHttpProtocolHandler).misc;
var savedBuildID = null;
try {
savedBuildID = prefb.getCharPref("browser.startup.homepage_override.buildID");
} catch (e) {}
var buildID = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(nsIXULAppInfo).platformBuildID;
if (mstone != savedmstone) {
// Bug 462254. Previous releases had a default pref to suppress the EULA
// agreement if the platform's installer had already shown one. Now with
@ -145,9 +158,15 @@ function needHomepageOverride(prefb) {
prefb.setBoolPref("browser.rights.3.shown", true);
prefb.setCharPref("browser.startup.homepage_override.mstone", mstone);
prefb.setCharPref("browser.startup.homepage_override.buildID", buildID);
return (savedmstone ? OVERRIDE_NEW_MSTONE : OVERRIDE_NEW_PROFILE);
}
if (buildID != savedBuildID) {
prefb.setCharPref("browser.startup.homepage_override.buildID", buildID);
return OVERRIDE_NEW_BUILD_ID;
}
return OVERRIDE_NONE;
}
@ -562,24 +581,30 @@ nsBrowserContentHandler.prototype = {
var overridePage = "";
var haveUpdateSession = false;
try {
switch (needHomepageOverride(prefb)) {
case OVERRIDE_NEW_PROFILE:
// New profile
overridePage = formatter.formatURLPref("startup.homepage_welcome_url");
break;
case OVERRIDE_NEW_MSTONE:
// Existing profile, new build
copyPrefOverride();
let override = needHomepageOverride(prefb);
if (override != OVERRIDE_NONE) {
// Setup the default search engine to about:home page.
AboutHomeUtils.loadDefaultSearchEngine();
// Check whether we have a session to restore. If we do, we assume
// that this is an "update" session.
var ss = Components.classes["@mozilla.org/browser/sessionstartup;1"]
.getService(Components.interfaces.nsISessionStartup);
haveUpdateSession = ss.doRestore();
overridePage = formatter.formatURLPref("startup.homepage_override_url");
if (prefb.prefHasUserValue("app.update.postupdate"))
overridePage = getPostUpdateOverridePage(overridePage);
break;
switch (override) {
case OVERRIDE_NEW_PROFILE:
// New profile.
overridePage = formatter.formatURLPref("startup.homepage_welcome_url");
break;
case OVERRIDE_NEW_MSTONE:
// Existing profile, new milestone build.
copyPrefOverride();
// Check whether we have a session to restore. If we do, we assume
// that this is an "update" session.
var ss = Components.classes["@mozilla.org/browser/sessionstartup;1"]
.getService(Components.interfaces.nsISessionStartup);
haveUpdateSession = ss.doRestore();
overridePage = formatter.formatURLPref("startup.homepage_override_url");
if (prefb.prefHasUserValue("app.update.postupdate"))
overridePage = getPostUpdateOverridePage(overridePage);
break;
}
}
} catch (ex) {}
@ -856,5 +881,30 @@ nsDefaultCommandLineHandler.prototype = {
helpInfo : "",
};
let AboutHomeUtils = {
get _storage() {
let aboutHomeURI = Services.io.newURI("moz-safe-about:home", null, null);
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
getService(Components.interfaces.nsIScriptSecurityManager).
getCodebasePrincipal(aboutHomeURI);
let dsm = Components.classes["@mozilla.org/dom/storagemanager;1"].
getService(Components.interfaces.nsIDOMStorageManager);
return dsm.getLocalStorageForPrincipal(principal, "");
},
loadDefaultSearchEngine: function AHU_loadDefaultSearchEngine()
{
let defaultEngine = Services.search.originalDefaultEngine;
let submission = defaultEngine.getSubmission("_searchTerms_");
if (submission.postData)
throw new Error("Home page does not support POST search engines.");
let engine = {
name: defaultEngine.name
, searchUrl: submission.uri.spec
}
this._storage.setItem("search-engine", JSON.stringify(engine));
}
};
var components = [nsBrowserContentHandler, nsDefaultCommandLineHandler];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);

View File

@ -225,8 +225,7 @@ BrowserGlue.prototype = {
Services.obs.removeObserver(this, "places-shutdown");
this._isPlacesShutdownObserver = false;
}
// places-shutdown is fired on profile-before-change, but before
// Places executes the last flush and closes connection.
// places-shutdown is fired when the profile is about to disappear.
this._onProfileShutdown();
break;
case "idle":

View File

@ -546,7 +546,7 @@ var BookmarkPropertiesPanel = {
try {
var value = this._element(aTextboxID).value;
if (value) {
var uri = PlacesUIUtils.createFixedURI(value);
PlacesUIUtils.createFixedURI(value);
return true;
}
} catch (e) { }

View File

@ -1,7 +1,3 @@
#contentTitle {
width: 0px;
}
#searchFilter {
width: 23em;
}

View File

@ -391,8 +391,7 @@ var PlacesOrganizer = {
if (fp.file) {
var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
getService(Ci.nsIPlacesImportExportService);
var file = fp.file.QueryInterface(Ci.nsILocalFile);
importer.importHTMLFromFile(file, false);
importer.importHTMLFromFile(fp.file, false);
}
}
},

View File

@ -40,6 +40,7 @@ DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/components/places/tests
include $(DEPTH)/config/autoconf.mk

View File

@ -1 +1 @@
{"title":"","id":1,"dateAdded":1233157910552624,"lastModified":1233157955206833,"type":"text/x-moz-place-container","root":"placesRoot","children":[{"title":"Bookmarks Menu","id":2,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157993171424,"type":"text/x-moz-place-container","root":"bookmarksMenuFolder","children":[{"title":"examplejson","id":27,"parent":2,"dateAdded":1233157972101126,"lastModified":1233157984999673,"type":"text/x-moz-place","uri":"http://example.com/"}]},{"index":1,"title":"Bookmarks Toolbar","id":3,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157972101126,"annos":[{"name":"bookmarkProperties/description","flags":0,"expires":4,"mimeType":null,"type":3,"value":"Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar"}],"type":"text/x-moz-place-container","root":"toolbarFolder","children":[{"title":"examplejson","id":26,"parent":3,"dateAdded":1233157972101126,"lastModified":1233157984999673,"type":"text/x-moz-place","uri":"http://example.com/"}]},{"index":2,"title":"Tags","id":4,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157910582667,"type":"text/x-moz-place-container","root":"tagsFolder","children":[]},{"index":3,"title":"Unsorted Bookmarks","id":5,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157911033315,"type":"text/x-moz-place-container","root":"unfiledBookmarksFolder","children":[]}]}
{"title":"","id":1,"dateAdded":1233157910552624,"lastModified":1233157955206833,"type":"text/x-moz-place-container","root":"placesRoot","children":[{"title":"Bookmarks Menu","id":2,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157993171424,"type":"text/x-moz-place-container","root":"bookmarksMenuFolder","children":[{"title":"examplejson","id":27,"parent":2,"dateAdded":1233157972101126,"lastModified":1233157984999673,"type":"text/x-moz-place","uri":"http://example.com/"}]},{"index":1,"title":"Bookmarks Toolbar","id":3,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157972101126,"annos":[{"name":"bookmarkProperties/description","flags":0,"expires":4,"mimeType":null,"type":3,"value":"Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar"}],"type":"text/x-moz-place-container","root":"toolbarFolder","children":[{"title":"examplejson","id":26,"parent":3,"dateAdded":1233157972101126,"lastModified":1233157984999673,"type":"text/x-moz-place","uri":"http://example.com/"}]},{"index":2,"title":"Tags","id":4,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157910582667,"type":"text/x-moz-place-container","root":"tagsFolder","children":[]},{"index":3,"title":"Unsorted Bookmarks","id":5,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157911033315,"type":"text/x-moz-place-container","root":"unfiledBookmarksFolder","children":[]},]}

View File

@ -45,7 +45,7 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
// Import common head.
let (commonFile = do_get_file("../../test_places/head_common.js", false)) {
let (commonFile = do_get_file("../../../../../toolkit/components/places/tests/head_common.js", false)) {
let uri = Services.io.newFileURI(commonFile);
Services.scriptloader.loadSubScript(uri.spec, this);
}

View File

@ -47,20 +47,47 @@ const URIS = [
, "http://c.example3.com/"
];
let expirationObserver = {
observe: function observe(aSubject, aTopic, aData) {
print("Finished expiration.");
Services.obs.removeObserver(expirationObserver,
PlacesUtils.TOPIC_EXPIRATION_FINISHED);
let db = PlacesUtils.history
.QueryInterface(Ci.nsPIPlacesDatabase)
.DBConnection;
const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
let stmt = db.createStatement(
"SELECT id FROM moz_places_temp WHERE url = :page_url "
+ "UNION ALL "
+ "SELECT id FROM moz_places WHERE url = :page_url "
let EXPECTED_NOTIFICATIONS = [
"places-shutdown"
, "places-will-close-connection"
, "places-connection-closing"
, "places-sync-finished"
, "places-expiration-finished"
, "places-sync-finished"
, "places-connection-closed"
];
const UNEXPECTED_NOTIFICATIONS = [
"xpcom-shutdown"
];
const URL = "ftp://localhost/clearHistoryOnShutdown/";
let notificationIndex = 0;
let notificationsObserver = {
observe: function observe(aSubject, aTopic, aData) {
print("Received notification: " + aTopic);
// Note that some of these notifications could arrive multiple times, for
// example in case of sync, we allow that.
if (EXPECTED_NOTIFICATIONS[notificationIndex] != aTopic)
notificationIndex++;
do_check_eq(EXPECTED_NOTIFICATIONS[notificationIndex], aTopic);
if (aTopic != TOPIC_CONNECTION_CLOSED)
return;
getDistinctNotifications().forEach(
function (topic) Services.obs.removeObserver(notificationsObserver, topic)
);
print("Looking for uncleared stuff.");
let stmt = DBConn().createStatement(
"SELECT id FROM moz_places WHERE url = :page_url "
);
try {
@ -73,6 +100,9 @@ let expirationObserver = {
stmt.finalize();
}
// Check cache.
do_check_false(cacheExists(URL));
do_test_finished();
}
}
@ -104,11 +134,60 @@ function run_test() {
PlacesUtils.history.TRANSITION_TYPED,
false, 0);
});
print("Add cache.");
storeCache(URL, "testData");
print("Wait expiration.");
Services.obs.addObserver(expirationObserver,
PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
print("Simulate shutdown.");
PlacesUtils.history.QueryInterface(Ci.nsIObserver)
.observe(null, TOPIC_GLOBAL_SHUTDOWN, null);
print("Simulate and wait shutdown.");
getDistinctNotifications().forEach(
function (topic)
Services.obs.addObserver(notificationsObserver, topic, false)
);
shutdownPlaces();
}
function getDistinctNotifications() {
let ar = EXPECTED_NOTIFICATIONS.concat(UNEXPECTED_NOTIFICATIONS);
return [ar[i] for (i in ar) if (ar.slice(0, i).indexOf(ar[i]) == -1)];
}
function storeCache(aURL, aContent) {
let cache = Cc["@mozilla.org/network/cache-service;1"].
getService(Ci.nsICacheService);
let session = cache.createSession("FTP", Ci.nsICache.STORE_ANYWHERE,
Ci.nsICache.STREAM_BASED);
let cacheEntry =
session.openCacheEntry(aURL, Ci.nsICache.ACCESS_READ_WRITE, false);
cacheEntry.setMetaDataElement("servertype", "0");
var oStream = cacheEntry.openOutputStream(0);
var written = oStream.write(aContent, aContent.length);
if (written != aContent.length) {
do_throw("oStream.write has not written all data!\n" +
" Expected: " + written + "\n" +
" Actual: " + aContent.length + "\n");
}
oStream.close();
cacheEntry.close();
}
function cacheExists(aURL) {
let cache = Cc["@mozilla.org/network/cache-service;1"].
getService(Ci.nsICacheService);
let session = cache.createSession("FTP", Ci.nsICache.STORE_ANYWHERE,
Ci.nsICache.STREAM_BASED);
try {
let cacheEntry =
session.openCacheEntry(aURL, Ci.nsICache.ACCESS_READ, true);
} catch (e) {
if (e.result == Cr.NS_ERROR_CACHE_KEY_NOT_FOUND ||
e.result == Cr.NS_ERROR_FAILURE)
return false;
// Throw the textual error description.
do_throw(e);
}
cacheEntry.close();
return true;
}

View File

@ -68,6 +68,9 @@
<preference id="general.autoScroll" name="general.autoScroll" type="bool"/>
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
#ifdef XP_WIN
<preference id="gfx.direct2d.disabled" name="gfx.direct2d.disabled" type="bool" inverted="true"/>
#endif
<preference id="layout.spellcheckDefault" name="layout.spellcheckDefault" type="int"/>
#ifdef HAVE_SHELL_SERVICE
@ -174,6 +177,12 @@
label="&useSmoothScrolling.label;"
accesskey="&useSmoothScrolling.accesskey;"
preference="general.smoothScroll"/>
#ifdef XP_WIN
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="gfx.direct2d.disabled"/>
#endif
<checkbox id="checkSpelling"
label="&checkSpelling.label;"
accesskey="&checkSpelling.accesskey;"

View File

@ -143,6 +143,14 @@ function restoreSession() {
}, true);
}
function startNewSession() {
var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
if (prefBranch.getIntPref("browser.startup.page") == 0)
getBrowserWindow().gBrowser.loadURI("about:blank");
else
getBrowserWindow().BrowserHome();
}
function onListClick(aEvent) {
// don't react to right-clicks
if (aEvent.button == 2)

View File

@ -103,9 +103,21 @@
<!-- Buttons -->
<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="buttons">
#ifdef XP_UNIX
<button id="errorCancel" label="&restorepage.cancelButton;"
accesskey="&restorepage.cancel.access;"
oncommand="startNewSession();"/>
<button id="errorTryAgain" label="&restorepage.tryagainButton;"
accesskey="&restorepage.restore.access;"
oncommand="restoreSession();"/>
#else
<button id="errorTryAgain" label="&restorepage.tryagainButton;"
accesskey="&restorepage.restore.access;"
oncommand="restoreSession();"/>
<button id="errorCancel" label="&restorepage.cancelButton;"
accesskey="&restorepage.cancel.access;"
oncommand="startNewSession();"/>
#endif
</hbox>
<!-- holds the session data for when the tab is closed -->
<input type="text" id="sessionData" style="display: none;"/>

View File

@ -1,3 +1,3 @@
browser.jar:
content/browser/aboutSessionRestore.xhtml (content/aboutSessionRestore.xhtml)
* content/browser/aboutSessionRestore.xhtml (content/aboutSessionRestore.xhtml)
* content/browser/aboutSessionRestore.js (content/aboutSessionRestore.js)

View File

@ -2078,19 +2078,33 @@ SessionStoreService.prototype = {
}
if (aTabs.length > 0) {
// Load hidden tabs last, by pushing them to the end of the list
let unhiddenTabs = aTabs.length;
for (let t = 0; t < unhiddenTabs; ) {
if (aTabs[t].hidden) {
aTabs = aTabs.concat(aTabs.splice(t, 1));
aTabData = aTabData.concat(aTabData.splice(t, 1));
if (aSelectTab > t)
--aSelectTab;
--unhiddenTabs;
continue;
}
++t;
}
// Determine if we can optimize & load visible tabs first
let maxVisibleTabs = Math.ceil(tabbrowser.tabContainer.mTabstrip.scrollClientSize /
aTabs[aTabs.length - 1].clientWidth);
aTabs[unhiddenTabs - 1].clientWidth);
// make sure we restore visible tabs first, if there are enough
if (maxVisibleTabs < aTabs.length && aSelectTab > 1) {
if (maxVisibleTabs < unhiddenTabs && aSelectTab > 1) {
let firstVisibleTab = 0;
if (aTabs.length - maxVisibleTabs > aSelectTab) {
if (unhiddenTabs - maxVisibleTabs > aSelectTab) {
// aSelectTab is leftmost since we scroll to it when possible
firstVisibleTab = aSelectTab - 1;
} else {
// aSelectTab is rightmost or no more room to scroll right
firstVisibleTab = aTabs.length - maxVisibleTabs;
firstVisibleTab = unhiddenTabs - maxVisibleTabs;
}
aTabs = aTabs.splice(firstVisibleTab, maxVisibleTabs).concat(aTabs);
aTabData = aTabData.splice(firstVisibleTab, maxVisibleTabs).concat(aTabData);

View File

@ -99,6 +99,7 @@ _BROWSER_TEST_FILES = \
browser_476161_sample.html \
browser_477657.js \
browser_480148.js \
browser_480893.js \
browser_483330.js \
browser_485482.js \
browser_485482_sample.html \

View File

@ -52,10 +52,16 @@ function test() {
waitForExplicitFinish();
// builds the tests state based on a few parameters
function buildTestState(num, selected) {
function buildTestState(num, selected, hidden) {
let state = { windows: [ { "tabs": [], "selected": selected } ] };
while (num--)
while (num--) {
state.windows[0].tabs.push({entries: [{url: "http://example.com/"}]});
let i = state.windows[0].tabs.length - 1;
if (hidden.length > 0 && i == hidden[0]) {
state.windows[0].tabs[i].hidden = true;
hidden.splice(0, 1);
}
}
return state;
}
@ -80,17 +86,17 @@ function test() {
}
// the number of tests we're running
let numTests = 4;
let numTests = 6;
let completedTests = 0;
let tabMinWidth = parseInt(getComputedStyle(gBrowser.selectedTab, null).minWidth);
function runTest(testNum, totalTabs, selectedTab, shownTabs, order) {
function runTest(testNum, totalTabs, selectedTab, shownTabs, hiddenTabs, order) {
let test = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener,
Ci.nsISupportsWeakReference]),
state: buildTestState(totalTabs, selectedTab),
state: buildTestState(totalTabs, selectedTab, hiddenTabs),
numTabsToShow: shownTabs,
expectedOrder: order,
actualOrder: [],
@ -157,10 +163,12 @@ function test() {
}
// actually create & run the tests
runTest(1, 13, 1, 6, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
runTest(2, 13, 13, 6, [12, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6]);
runTest(3, 13, 4, 6, [3, 4, 5, 6, 7, 8, 0, 1, 2, 9, 10, 11, 12]);
runTest(4, 13, 11, 6, [10, 7, 8, 9, 11, 12, 0, 1, 2, 3, 4, 5, 6]);
runTest(1, 13, 1, 6, [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
runTest(2, 13, 13, 6, [], [12, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6]);
runTest(3, 13, 4, 6, [], [3, 4, 5, 6, 7, 8, 0, 1, 2, 9, 10, 11, 12]);
runTest(4, 13, 11, 6, [], [10, 7, 8, 9, 11, 12, 0, 1, 2, 3, 4, 5, 6]);
runTest(5, 13, 13, 6, [0, 4, 9], [12, 6, 7, 8, 10, 11, 1, 2, 3, 5, 0, 4, 9]);
runTest(6, 13, 4, 6, [1, 7, 12], [3, 4, 5, 6, 8, 9, 0, 2, 10, 11, 1, 7, 12]);
// finish() is run by the last test to finish, so no cleanup down here
}

View File

@ -0,0 +1,90 @@
/* ***** 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 sessionstore test code.
*
* The Initial Developer of the Original Code is
* Michael Kohler <michaelkohler@live.com>.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function test() {
/** Test for Bug 480893 **/
waitForExplicitFinish();
// Test that starting a new session loads a blank page if Firefox is
// configured to display a blank page at startup (browser.startup.page = 0)
gPrefService.setIntPref("browser.startup.page", 0);
let tab = gBrowser.addTab("about:sessionrestore");
gBrowser.selectedTab = tab;
let browser = tab.linkedBrowser;
browser.addEventListener("load", function(aEvent) {
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
// click on the "Start New Session" button after about:sessionrestore is loaded
doc.getElementById("errorCancel").click();
browser.addEventListener("load", function(aEvent) {
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
is(doc.URL, "about:blank", "loaded page is about:blank");
// Test that starting a new session loads the homepage (set to http://mochi.test:8888)
// if Firefox is configured to display a homepage at startup (browser.startup.page = 1)
let homepage = "http://mochi.test:8888/";
gPrefService.setCharPref("browser.startup.homepage", homepage);
gPrefService.setIntPref("browser.startup.page", 1);
gBrowser.loadURI("about:sessionrestore");
browser.addEventListener("load", function(aEvent) {
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
// click on the "Start New Session" button after about:sessionrestore is loaded
doc.getElementById("errorCancel").click();
browser.addEventListener("load", function(aEvent) {
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
is(doc.URL, homepage, "loaded page is the homepage");
// close tab, restore default values and finish the test
gBrowser.removeTab(tab);
// we need this if-statement because if there is no user set value,
// clearUserPref throws a uncatched exception and finish is not called
if (gPrefService.prefHasUserValue("browser.startup.page"))
gPrefService.clearUserPref("browser.startup.page");
gPrefService.clearUserPref("browser.startup.homepage");
finish();
}, true);
}, true);
}, true);
}, true);
}

View File

@ -48,7 +48,7 @@ MOZ_MORKREADER=1
MOZ_SAFE_BROWSING=1
MOZ_SERVICES_SYNC=1
MOZ_APP_VERSION=$FIREFOX_VERSION
MOZ_EXTENSIONS_DEFAULT=" gnomevfs reporter"
MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
MOZ_BRANDING_DIRECTORY=browser/branding/nightly
MOZ_OFFICIAL_BRANDING_DIRECTORY=other-licenses/branding/firefox

View File

@ -412,7 +412,6 @@
#endif
@BINPATH@/chrome/toolkit@JAREXT@
@BINPATH@/chrome/toolkit.manifest
@BINPATH@/@PREF_DIR@/reporter.js
#ifdef XP_UNIX
#ifndef XP_MACOSX
@BINPATH@/chrome/icons/default/default16.png

View File

@ -74,6 +74,7 @@ components/xptitemp.dat
defaults/pref/all.js
defaults/pref/bug259708.js
defaults/pref/bug307259.js
defaults/pref/reporter.js
defaults/pref/security-prefs.js
defaults/pref/winpref.js
defaults/pref/xpinstall.js
@ -629,7 +630,6 @@ xpicleanup@BIN_SUFFIX@
defaults/pref/firefox-branding.js
defaults/pref/firefox.js
defaults/pref/firefox-l10n.js
defaults/pref/reporter.js
defaults/pref/services-sync.js
defaults/profile/bookmarks.html
defaults/profile/chrome/userChrome-example.css
@ -672,6 +672,7 @@ xpicleanup@BIN_SUFFIX@
modules/PluginProvider.jsm
modules/PluralForm.jsm
modules/PopupNotifications.jsm
modules/PropertyPanel.jsm
modules/Services.jsm
modules/services-sync/auth.js
modules/services-sync/base_records/collection.js
@ -736,6 +737,9 @@ xpicleanup@BIN_SUFFIX@
res/fonts/mathfontSTIXNonUnicode.properties
res/fonts/mathfontSTIXSize1.properties
res/fonts/mathfontSTIXSizeOneSym.properties
#ifdef XP_WIN
res/fonts/mathfontSymbol.properties
#endif
res/fonts/mathfontUnicode.properties
res/grabber.gif
res/html/folder.png

View File

@ -16,7 +16,6 @@
!define WindowClass "FirefoxMessageWindow"
!define DDEApplication "Firefox"
!define AppRegName "Firefox"
!define MinSupportedVer "Microsoft Windows 2000"
!define BrandShortName "@MOZ_APP_DISPLAYNAME@"
!define PreReleaseSuffix "@PRE_RELEASE_SUFFIX@"
@ -38,3 +37,14 @@
!if "@PRE_RELEASE_SUFFIX@" != ""
!define NO_INSTDIR_FROM_REG
!endif
# ARCH is used when it is necessary to differentiate the x64 registry keys from
# the x86 registry keys (e.g. the uninstall registry key).
#ifdef HAVE_64BIT_OS
!define HAVE_64BIT_OS
!define ARCH "x64"
!define MinSupportedVer "Microsoft Windows Vista x64"
#else
!define ARCH "x86"
!define MinSupportedVer "Microsoft Windows 2000"
#endif

View File

@ -134,8 +134,11 @@ VIAddVersionKey "OriginalFilename" "setup.exe"
Name "${BrandFullName}"
OutFile "setup.exe"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" "InstallLocation"
InstallDir "$PROGRAMFILES\${BrandFullName}\"
!ifdef HAVE_64BIT_OS
InstallDir "$PROGRAMFILES64\${BrandFullName}\"
!else
InstallDir "$PROGRAMFILES32\${BrandFullName}\"
!endif
ShowInstDetails nevershow
################################################################################
@ -248,7 +251,7 @@ Section "-Application" APP_IDX
; registered. bug 338878
${LogHeader} "DLL Registration"
ClearErrors
RegDLL "$INSTDIR\AccessibleMarshal.dll"
${RegisterDLL} "$INSTDIR\AccessibleMarshal.dll"
${If} ${Errors}
${LogMsg} "** ERROR Registering: $INSTDIR\AccessibleMarshal.dll **"
${Else}
@ -551,7 +554,7 @@ Function CustomAbort
${Else}
UAC::ExecCodeSegment $0
${EndIf}
CustomAbort_finish:
Return
${EndUnless}
@ -1002,8 +1005,7 @@ Function .onInit
; There must always be a core directory.
${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8
IntOp $R8 $R5 + $R6
SectionSetSize ${APP_IDX} $R8
SectionSetSize ${APP_IDX} $R5
; Initialize $hHeaderBitmap to prevent redundant changing of the bitmap if
; the user clicks the back button

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