mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central and tracemonkey.
This commit is contained in:
commit
31076ac1d6
@ -450,10 +450,9 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
|
||||
interfacesBits |= 1 << MAI_INTERFACE_IMAGE;
|
||||
}
|
||||
|
||||
// HyperLinkAccessible
|
||||
if (IsHyperLink()) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
|
||||
}
|
||||
// HyperLinkAccessible
|
||||
if (IsLink())
|
||||
interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
|
||||
|
||||
if (!nsAccUtils::MustPrune(this)) { // These interfaces require children
|
||||
//nsIAccessibleHypertext
|
||||
@ -1077,6 +1076,16 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||
}
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_NAME_CHANGE:
|
||||
{
|
||||
nsString newName;
|
||||
accessible->GetName(newName);
|
||||
NS_ConvertUTF16toUTF8 utf8Name(newName);
|
||||
if (!utf8Name.Equals(atkObj->name))
|
||||
atk_object_set_name(atkObj, utf8Name.get());
|
||||
|
||||
break;
|
||||
}
|
||||
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n"));
|
||||
|
@ -705,7 +705,7 @@ nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
|
||||
PRBool
|
||||
nsApplicationAccessibleWrap::RemoveChild(nsAccessible* aChild)
|
||||
{
|
||||
PRInt32 index = aChild->GetIndexInParent();
|
||||
PRInt32 index = aChild->IndexInParent();
|
||||
|
||||
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aChild);
|
||||
atk_object_set_parent(atkAccessible, NULL);
|
||||
|
@ -135,16 +135,16 @@ MaiHyperlink::~MaiHyperlink()
|
||||
}
|
||||
}
|
||||
|
||||
AtkHyperlink *
|
||||
AtkHyperlink*
|
||||
MaiHyperlink::GetAtkHyperlink(void)
|
||||
{
|
||||
NS_ENSURE_TRUE(mHyperlink, nsnull);
|
||||
NS_ENSURE_TRUE(mHyperlink, nsnull);
|
||||
|
||||
if (mMaiAtkHyperlink)
|
||||
return mMaiAtkHyperlink;
|
||||
if (mMaiAtkHyperlink)
|
||||
return mMaiAtkHyperlink;
|
||||
|
||||
if (!mHyperlink->IsHyperLink())
|
||||
return nsnull;
|
||||
if (!mHyperlink->IsLink())
|
||||
return nsnull;
|
||||
|
||||
mMaiAtkHyperlink =
|
||||
reinterpret_cast<AtkHyperlink *>
|
||||
@ -215,9 +215,7 @@ getUriCB(AtkHyperlink *aLink, gint aLinkIndex)
|
||||
nsAccessible* hyperlink = get_accessible_hyperlink(aLink);
|
||||
NS_ENSURE_TRUE(hyperlink, nsnull);
|
||||
|
||||
MaiAtkHyperlink *maiAtkHyperlink = MAI_ATK_HYPERLINK(aLink);
|
||||
|
||||
nsCOMPtr<nsIURI> uri = hyperlink->GetAnchorURI(aLinkIndex);
|
||||
nsCOMPtr<nsIURI> uri = hyperlink->AnchorURIAt(aLinkIndex);
|
||||
if (!uri)
|
||||
return nsnull;
|
||||
|
||||
@ -234,7 +232,7 @@ getObjectCB(AtkHyperlink *aLink, gint aLinkIndex)
|
||||
nsAccessible* hyperlink = get_accessible_hyperlink(aLink);
|
||||
NS_ENSURE_TRUE(hyperlink, nsnull);
|
||||
|
||||
nsAccessible* anchor = hyperlink->GetAnchor(aLinkIndex);
|
||||
nsAccessible* anchor = hyperlink->AnchorAt(aLinkIndex);
|
||||
NS_ENSURE_TRUE(anchor, nsnull);
|
||||
|
||||
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(anchor);
|
||||
@ -266,7 +264,7 @@ isValidCB(AtkHyperlink *aLink)
|
||||
nsAccessible* hyperlink = get_accessible_hyperlink(aLink);
|
||||
NS_ENSURE_TRUE(hyperlink, FALSE);
|
||||
|
||||
return static_cast<gboolean>(hyperlink->IsValid());
|
||||
return static_cast<gboolean>(hyperlink->IsLinkValid());
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -58,9 +58,8 @@ public:
|
||||
|
||||
public:
|
||||
AtkHyperlink *GetAtkHyperlink(void);
|
||||
nsAccessible* GetAccHyperlink(void) {
|
||||
return mHyperlink && mHyperlink->IsHyperLink() ? mHyperlink : nsnull;
|
||||
}
|
||||
nsAccessible* GetAccHyperlink()
|
||||
{ return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nsnull; }
|
||||
|
||||
protected:
|
||||
nsAccessible* mHyperlink;
|
||||
|
@ -98,7 +98,7 @@ refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap, gint aX, gint aY,
|
||||
if (!aAccWrap || aAccWrap->IsDefunct() || nsAccUtils::MustPrune(aAccWrap))
|
||||
return nsnull;
|
||||
|
||||
// nsAccessible::GetChildAtPoint(x,y) is in screen pixels.
|
||||
// nsAccessible::ChildAtPoint(x,y) is in screen pixels.
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
nsIntPoint winCoords =
|
||||
nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
|
||||
@ -106,8 +106,8 @@ refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap, gint aX, gint aY,
|
||||
aY += winCoords.y;
|
||||
}
|
||||
|
||||
nsAccessible* accAtPoint = aAccWrap->GetChildAtPoint(aX, aY,
|
||||
nsAccessible::eDirectChild);
|
||||
nsAccessible* accAtPoint = aAccWrap->ChildAtPoint(aX, aY,
|
||||
nsAccessible::eDirectChild);
|
||||
if (!accAtPoint)
|
||||
return nsnull;
|
||||
|
||||
|
@ -49,16 +49,15 @@ hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface)
|
||||
}
|
||||
|
||||
AtkHyperlink*
|
||||
getHyperlinkCB(AtkHyperlinkImpl *aImpl)
|
||||
getHyperlinkCB(AtkHyperlinkImpl* aImpl)
|
||||
{
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
|
||||
if (!accWrap)
|
||||
return nsnull;
|
||||
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
|
||||
if (!accWrap)
|
||||
return nsnull;
|
||||
|
||||
NS_ENSURE_TRUE(accWrap->IsHyperLink(), nsnull);
|
||||
|
||||
MaiHyperlink *maiHyperlink = accWrap->GetMaiHyperlink();
|
||||
NS_ENSURE_TRUE(maiHyperlink, nsnull);
|
||||
return maiHyperlink->GetAtkHyperlink();
|
||||
NS_ENSURE_TRUE(accWrap->IsLink(), nsnull);
|
||||
|
||||
MaiHyperlink* maiHyperlink = accWrap->GetMaiHyperlink();
|
||||
NS_ENSURE_TRUE(maiHyperlink, nsnull);
|
||||
return maiHyperlink->GetAtkHyperlink();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
|
||||
if (!parent)
|
||||
return;
|
||||
|
||||
PRInt32 indexInParent = aItem->GetIndexInParent();
|
||||
PRInt32 indexInParent = aItem->IndexInParent();
|
||||
PRInt32 level = nsAccUtils::GetARIAOrDefaultLevel(aItem);
|
||||
|
||||
// Compute position in set.
|
||||
|
@ -87,6 +87,7 @@ EXPORTS = \
|
||||
nsAccessible.h \
|
||||
nsAccessNode.h \
|
||||
nsARIAMap.h \
|
||||
States.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
@ -515,14 +515,14 @@ NotificationController::CoalesceTextChangeEventsFor(AccShowEvent* aTailEvent,
|
||||
if (!textEvent)
|
||||
return;
|
||||
|
||||
if (aTailEvent->mAccessible->GetIndexInParent() ==
|
||||
aThisEvent->mAccessible->GetIndexInParent() + 1) {
|
||||
if (aTailEvent->mAccessible->IndexInParent() ==
|
||||
aThisEvent->mAccessible->IndexInParent() + 1) {
|
||||
// If tail target was inserted after this target, i.e. tail target is next
|
||||
// sibling of this target.
|
||||
aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText);
|
||||
|
||||
} else if (aTailEvent->mAccessible->GetIndexInParent() ==
|
||||
aThisEvent->mAccessible->GetIndexInParent() -1) {
|
||||
} else if (aTailEvent->mAccessible->IndexInParent() ==
|
||||
aThisEvent->mAccessible->IndexInParent() -1) {
|
||||
// If tail target was inserted before this target, i.e. tail target is
|
||||
// previous sibling of this target.
|
||||
nsAutoString startText;
|
||||
|
@ -981,7 +981,7 @@ nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
|
||||
|
||||
*aColumnIndex = 0;
|
||||
|
||||
PRInt32 indexInRow = GetIndexInParent();
|
||||
PRInt32 indexInRow = IndexInParent();
|
||||
for (PRInt32 idx = 0; idx < indexInRow; idx++) {
|
||||
nsAccessible* cell = row->GetChildAt(idx);
|
||||
PRUint32 role = cell->Role();
|
||||
@ -1013,7 +1013,7 @@ nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
|
||||
|
||||
*aRowIndex = 0;
|
||||
|
||||
PRInt32 indexInTable = row->GetIndexInParent();
|
||||
PRInt32 indexInTable = row->IndexInParent();
|
||||
for (PRInt32 idx = 0; idx < indexInTable; idx++) {
|
||||
row = table->GetChildAt(idx);
|
||||
if (row->Role() == nsIAccessibleRole::ROLE_ROW)
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
@ -391,16 +391,16 @@ nsAccDocManager::AddListeners(nsIDocument *aDocument,
|
||||
PRBool aAddDOMContentLoadedListener)
|
||||
{
|
||||
nsPIDOMWindow *window = aDocument->GetWindow();
|
||||
nsPIDOMEventTarget *target = window->GetChromeEventHandler();
|
||||
nsIEventListenerManager* elm = target->GetListenerManager(PR_TRUE);
|
||||
nsIDOMEventTarget *target = window->GetChromeEventHandler();
|
||||
nsEventListenerManager* elm = target->GetListenerManager(PR_TRUE);
|
||||
elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
|
||||
NS_EVENT_FLAG_CAPTURE, nsnull);
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
|
||||
NS_LOG_ACCDOCCREATE_TEXT(" added 'pagehide' listener")
|
||||
|
||||
if (aAddDOMContentLoadedListener) {
|
||||
elm->AddEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
|
||||
NS_EVENT_FLAG_CAPTURE, nsnull);
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
NS_LOG_ACCDOCCREATE_TEXT(" added 'DOMContentLoaded' listener")
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperLink))) {
|
||||
if (IsHyperLink()) {
|
||||
if (IsLink()) {
|
||||
*aInstancePtr = static_cast<nsIAccessibleHyperLink*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
@ -588,7 +588,7 @@ nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIndexInParent);
|
||||
|
||||
*aIndexInParent = GetIndexInParent();
|
||||
*aIndexInParent = IndexInParent();
|
||||
return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -772,10 +772,10 @@ nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsAccessible::GetChildAtPoint()
|
||||
// nsAccessible::ChildAtPoint()
|
||||
nsAccessible*
|
||||
nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
// If we can't find the point in a child, we will return the fallback answer:
|
||||
// we return |this| if the point is within it, otherwise nsnull.
|
||||
@ -839,7 +839,7 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
(child->State() & states::INVISIBLE) == 0) {
|
||||
|
||||
if (aWhichChild == eDeepestChild)
|
||||
return child->GetChildAtPoint(aX, aY, eDeepestChild);
|
||||
return child->ChildAtPoint(aX, aY, eDeepestChild);
|
||||
|
||||
return child;
|
||||
}
|
||||
@ -881,7 +881,7 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = GetChildAtPoint(aX, aY, eDirectChild));
|
||||
NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDirectChild));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -896,7 +896,7 @@ nsAccessible::GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = GetChildAtPoint(aX, aY, eDeepestChild));
|
||||
NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDeepestChild));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2581,7 +2581,7 @@ nsAccessible::GetURI(PRInt32 aIndex, nsIURI **aURI)
|
||||
if (aIndex < 0 || aIndex >= static_cast<PRInt32>(AnchorCount()))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
*aURI = GetAnchorURI(aIndex).get();
|
||||
*aURI = AnchorURIAt(aIndex).get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2598,7 +2598,7 @@ nsAccessible::GetAnchor(PRInt32 aIndex, nsIAccessible** aAccessible)
|
||||
if (aIndex < 0 || aIndex >= static_cast<PRInt32>(AnchorCount()))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = GetAnchor(aIndex));
|
||||
NS_IF_ADDREF(*aAccessible = AnchorAt(aIndex));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2612,7 +2612,7 @@ nsAccessible::GetValid(PRBool *aValid)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aValid = IsValid();
|
||||
*aValid = IsLinkValid();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2626,7 +2626,7 @@ nsAccessible::GetSelected(PRBool *aSelected)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aSelected = IsSelected();
|
||||
*aSelected = IsLinkSelected();
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
@ -2844,11 +2844,11 @@ nsAccessible::GetChildCount()
|
||||
PRInt32
|
||||
nsAccessible::GetIndexOf(nsAccessible* aChild)
|
||||
{
|
||||
return (aChild->mParent != this) ? -1 : aChild->GetIndexInParent();
|
||||
return (aChild->mParent != this) ? -1 : aChild->IndexInParent();
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccessible::GetIndexInParent() const
|
||||
nsAccessible::IndexInParent() const
|
||||
{
|
||||
return mIndexInParent;
|
||||
}
|
||||
@ -2895,7 +2895,7 @@ nsAccessible::GetIndexOfEmbeddedChild(nsAccessible* aChild)
|
||||
// HyperLinkAccessible methods
|
||||
|
||||
bool
|
||||
nsAccessible::IsHyperLink()
|
||||
nsAccessible::IsLink()
|
||||
{
|
||||
// Every embedded accessible within hypertext accessible implements
|
||||
// hyperlink interface.
|
||||
@ -2905,7 +2905,7 @@ nsAccessible::IsHyperLink()
|
||||
PRUint32
|
||||
nsAccessible::StartOffset()
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "StartOffset is called not on hyper link!");
|
||||
NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
|
||||
|
||||
nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
|
||||
return hyperText ? hyperText->GetChildOffset(this) : 0;
|
||||
@ -2914,49 +2914,30 @@ nsAccessible::StartOffset()
|
||||
PRUint32
|
||||
nsAccessible::EndOffset()
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "EndOffset is called on not hyper link!");
|
||||
NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
|
||||
|
||||
nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
|
||||
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccessible::IsValid()
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "IsValid is called on not hyper link!");
|
||||
|
||||
return (0 == (State() & states::INVALID));
|
||||
// XXX In order to implement this we would need to follow every link
|
||||
// Perhaps we can get information about invalid links from the cache
|
||||
// In the mean time authors can use role="link" aria-invalid="true"
|
||||
// to force it for links they internally know to be invalid
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccessible::IsSelected()
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "IsSelected is called on not hyper link!");
|
||||
return (gLastFocusedNode == GetNode());
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsAccessible::AnchorCount()
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "AnchorCount is called on not hyper link!");
|
||||
NS_PRECONDITION(IsLink(), "AnchorCount is called on not hyper link!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsAccessible::GetAnchor(PRUint32 aAnchorIndex)
|
||||
nsAccessible::AnchorAt(PRUint32 aAnchorIndex)
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "GetAnchor is called on not hyper link!");
|
||||
NS_PRECONDITION(IsLink(), "GetAnchor is called on not hyper link!");
|
||||
return aAnchorIndex == 0 ? this : nsnull;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsAccessible::GetAnchorURI(PRUint32 aAnchorIndex)
|
||||
nsAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "GetAnchorURI is called on not hyper link!");
|
||||
NS_PRECONDITION(IsLink(), "AnchorURIAt is called on not hyper link!");
|
||||
|
||||
if (aAnchorIndex != 0)
|
||||
return nsnull;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsAccessNodeWrap.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleHyperLink.h"
|
||||
@ -197,7 +198,7 @@ public:
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
/**
|
||||
* Used by GetChildAtPoint() method to get direct or deepest child at point.
|
||||
* Used by ChildAtPoint() method to get direct or deepest child at point.
|
||||
*/
|
||||
enum EWhichChildAtPoint {
|
||||
eDirectChild,
|
||||
@ -212,8 +213,8 @@ public:
|
||||
* @param aWhichChild [in] flag points if deepest or direct child
|
||||
* should be returned
|
||||
*/
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
/**
|
||||
* Return calculated group level based on accessible hierarchy.
|
||||
@ -297,7 +298,7 @@ public:
|
||||
/**
|
||||
* Return index in parent accessible.
|
||||
*/
|
||||
virtual PRInt32 GetIndexInParent() const;
|
||||
virtual PRInt32 IndexInParent() const;
|
||||
|
||||
/**
|
||||
* Return true if accessible has children;
|
||||
@ -406,7 +407,7 @@ public:
|
||||
/**
|
||||
* Return true if the accessible is hyper link accessible.
|
||||
*/
|
||||
virtual bool IsHyperLink();
|
||||
virtual bool IsLink();
|
||||
|
||||
/**
|
||||
* Return the start offset of the link within the parent accessible.
|
||||
@ -421,12 +422,26 @@ public:
|
||||
/**
|
||||
* Return true if the link is valid (e. g. points to a valid URL).
|
||||
*/
|
||||
virtual bool IsValid();
|
||||
inline bool IsLinkValid()
|
||||
{
|
||||
NS_PRECONDITION(IsLink(), "IsLinkValid is called on not hyper link!");
|
||||
|
||||
// XXX In order to implement this we would need to follow every link
|
||||
// Perhaps we can get information about invalid links from the cache
|
||||
// In the mean time authors can use role="link" aria-invalid="true"
|
||||
// to force it for links they internally know to be invalid
|
||||
return (0 == (State() & states::INVALID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the link currently has the focus.
|
||||
*/
|
||||
virtual bool IsSelected();
|
||||
inline bool IsLinkSelected()
|
||||
{
|
||||
NS_PRECONDITION(IsLink(),
|
||||
"IsLinkSelected() called on something that is not a hyper link!");
|
||||
return gLastFocusedNode == GetNode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of anchors within the link.
|
||||
@ -436,12 +451,12 @@ public:
|
||||
/**
|
||||
* Returns an anchor accessible at the given index.
|
||||
*/
|
||||
virtual nsAccessible* GetAnchor(PRUint32 aAnchorIndex);
|
||||
virtual nsAccessible* AnchorAt(PRUint32 aAnchorIndex);
|
||||
|
||||
/**
|
||||
* Returns an anchor URI at the given index.
|
||||
*/
|
||||
virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
|
||||
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// SelectAccessible
|
||||
|
@ -169,8 +169,8 @@ nsApplicationAccessible::GroupPosition(PRInt32 *aGroupLevel,
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsApplicationAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
nsApplicationAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -63,7 +63,6 @@ class nsApplicationAccessible: public nsAccessibleWrap,
|
||||
public nsIAccessibleApplication
|
||||
{
|
||||
public:
|
||||
using nsAccessible::GetChildAtPoint;
|
||||
|
||||
nsApplicationAccessible();
|
||||
|
||||
@ -126,8 +125,8 @@ public:
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 State();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
|
@ -69,8 +69,8 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsLeafAccessible, nsAccessible)
|
||||
// nsLeafAccessible: nsAccessible public
|
||||
|
||||
nsAccessible*
|
||||
nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
nsLeafAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
// Don't walk into leaf accessibles.
|
||||
return this;
|
||||
@ -200,14 +200,14 @@ nsLinkableAccessible::Shutdown()
|
||||
// nsLinkableAccessible: HyperLinkAccessible
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsLinkableAccessible::GetAnchorURI(PRUint32 aAnchorIndex)
|
||||
nsLinkableAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
|
||||
{
|
||||
if (mIsLink) {
|
||||
NS_ASSERTION(mActionAcc->IsHyperLink(),
|
||||
NS_ASSERTION(mActionAcc->IsLink(),
|
||||
"nsIAccessibleHyperLink isn't implemented.");
|
||||
|
||||
if (mActionAcc->IsHyperLink())
|
||||
return mActionAcc->GetAnchorURI(aAnchorIndex);
|
||||
if (mActionAcc->IsLink())
|
||||
return mActionAcc->AnchorURIAt(aAnchorIndex);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
@ -55,7 +55,6 @@
|
||||
class nsLeafAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
using nsAccessible::GetChildAtPoint;
|
||||
|
||||
nsLeafAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
@ -63,8 +62,8 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsAccessible
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
protected:
|
||||
|
||||
@ -102,7 +101,7 @@ public:
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
|
||||
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
@ -78,7 +78,7 @@ PRBool
|
||||
nsCoreUtils::HasClickListener(nsIContent *aContent)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent, PR_FALSE);
|
||||
nsIEventListenerManager* listenerManager =
|
||||
nsEventListenerManager* listenerManager =
|
||||
aContent->GetListenerManager(PR_FALSE);
|
||||
|
||||
return listenerManager &&
|
||||
|
@ -74,8 +74,8 @@ nsOuterDocAccessible::NativeState()
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsOuterDocAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
PRInt32 docX = 0, docY = 0, docWidth = 0, docHeight = 0;
|
||||
nsresult rv = GetBounds(&docX, &docY, &docWidth, &docHeight);
|
||||
@ -90,7 +90,7 @@ nsOuterDocAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
NS_ENSURE_TRUE(child, nsnull);
|
||||
|
||||
if (aWhichChild == eDeepestChild)
|
||||
return child->GetChildAtPoint(aX, aY, eDeepestChild);
|
||||
return child->ChildAtPoint(aX, aY, eDeepestChild);
|
||||
return child;
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ public:
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
virtual void InvalidateChildren();
|
||||
virtual PRBool AppendChild(nsAccessible *aAccessible);
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIMenuFrame.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
@ -76,7 +76,6 @@
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsIDOMNSEventTarget.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
||||
@ -251,11 +250,11 @@ const char* const docEvents[] = {
|
||||
|
||||
nsresult nsRootAccessible::AddEventListeners()
|
||||
{
|
||||
// nsIDOMNSEventTarget interface allows to register event listeners to
|
||||
// nsIDOMEventTarget interface allows to register event listeners to
|
||||
// receive untrusted events (synthetic events generated by untrusted code).
|
||||
// For example, XBL bindings implementations for elements that are hosted in
|
||||
// non chrome document fire untrusted events.
|
||||
nsCOMPtr<nsIDOMNSEventTarget> nstarget(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMEventTarget> nstarget(do_QueryInterface(mDocument));
|
||||
|
||||
if (nstarget) {
|
||||
for (const char* const* e = docEvents,
|
||||
|
@ -519,7 +519,7 @@ PRUint32 nsTextEquivUtils::gRoleToNameRulesMap[] =
|
||||
eNoRule, // ROLE_AUTOCOMPLETE
|
||||
eNoRule, // ROLE_EDITBAR
|
||||
eFromValue, // ROLE_ENTRY
|
||||
eNoRule, // ROLE_CAPTION
|
||||
eFromSubtreeIfRec, // ROLE_CAPTION
|
||||
eNoRule, // ROLE_DOCUMENT_FRAME
|
||||
eFromSubtreeIfRec, // ROLE_HEADING
|
||||
eNoRule, // ROLE_PAGE
|
||||
|
@ -85,13 +85,13 @@ nsHTMLImageMapAccessible::AnchorCount()
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsHTMLImageMapAccessible::GetAnchor(PRUint32 aAnchorIndex)
|
||||
nsHTMLImageMapAccessible::AnchorAt(PRUint32 aAnchorIndex)
|
||||
{
|
||||
return GetChildAt(aAnchorIndex);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsHTMLImageMapAccessible::GetAnchorURI(PRUint32 aAnchorIndex)
|
||||
nsHTMLImageMapAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
|
||||
{
|
||||
nsAccessible* area = GetChildAt(aAnchorIndex);
|
||||
if (!area)
|
||||
@ -243,8 +243,8 @@ nsHTMLAreaAccessible::NativeState()
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsHTMLAreaAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
nsHTMLAreaAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
// Don't walk into area accessibles.
|
||||
return this;
|
||||
@ -261,13 +261,13 @@ nsHTMLAreaAccessible::StartOffset()
|
||||
// We return index in parent because image map contains area links only which
|
||||
// are embedded objects.
|
||||
// XXX: image map should be a hypertext accessible.
|
||||
return GetIndexInParent();
|
||||
return IndexInParent();
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsHTMLAreaAccessible::EndOffset()
|
||||
{
|
||||
return GetIndexInParent() + 1;
|
||||
return IndexInParent() + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -62,8 +62,8 @@ public:
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual PRUint32 AnchorCount();
|
||||
virtual nsAccessible* GetAnchor(PRUint32 aAnchorIndex);
|
||||
virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
|
||||
virtual nsAccessible* AnchorAt(PRUint32 aAnchorIndex);
|
||||
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
|
||||
|
||||
protected:
|
||||
|
||||
@ -82,7 +82,6 @@ private:
|
||||
class nsHTMLAreaAccessible : public nsHTMLLinkAccessible
|
||||
{
|
||||
public:
|
||||
using nsAccessible::GetChildAtPoint;
|
||||
|
||||
nsHTMLAreaAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
@ -94,8 +93,8 @@ public:
|
||||
virtual void Description(nsString& aDescription);
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual PRUint32 StartOffset();
|
||||
|
@ -166,14 +166,14 @@ nsHTMLLinkAccessible::DoAction(PRUint8 aIndex)
|
||||
// HyperLinkAccessible
|
||||
|
||||
bool
|
||||
nsHTMLLinkAccessible::IsHyperLink()
|
||||
nsHTMLLinkAccessible::IsLink()
|
||||
{
|
||||
// Expose HyperLinkAccessible unconditionally.
|
||||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsHTMLLinkAccessible::GetAnchorURI(PRUint32 aAnchorIndex)
|
||||
nsHTMLLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
|
||||
{
|
||||
return aAnchorIndex == 0 ? mContent->GetHrefURI() : nsnull;
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ public:
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual bool IsHyperLink();
|
||||
virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
|
||||
virtual bool IsLink();
|
||||
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
|
||||
|
||||
protected:
|
||||
enum { eAction_Jump = 0 };
|
||||
|
@ -313,19 +313,19 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
|
||||
nsCOMPtr<nsIMutableArray> headerCells =
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint32 desiredRole = -1;
|
||||
if (aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells)
|
||||
desiredRole = nsIAccessibleRole::ROLE_ROWHEADER;
|
||||
else if (aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells)
|
||||
desiredRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
|
||||
|
||||
do {
|
||||
nsAccessible* headerCell =
|
||||
GetAccService()->GetAccessibleInWeakShell(headerCellElm, mWeakShell);
|
||||
|
||||
if (headerCell &&
|
||||
(aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells &&
|
||||
headerCell->Role() == nsIAccessibleRole::ROLE_ROWHEADER ||
|
||||
aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells &&
|
||||
headerCell->Role() == nsIAccessibleRole::ROLE_COLUMNHEADER)) {
|
||||
if (headerCell && headerCell->Role() == desiredRole)
|
||||
headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell),
|
||||
PR_FALSE);
|
||||
}
|
||||
} while ((headerCellElm = iter.NextElem()));
|
||||
|
||||
NS_ADDREF(*aHeaderCells = headerCells);
|
||||
@ -464,10 +464,22 @@ nsresult
|
||||
nsHTMLTableAccessible::GetNameInternal(nsAString& aName)
|
||||
{
|
||||
nsAccessible::GetNameInternal(aName);
|
||||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
if (aName.IsEmpty())
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName);
|
||||
// Use table caption as a name.
|
||||
nsAccessible* caption = Caption();
|
||||
if (caption) {
|
||||
nsIContent* captionContent = caption->GetContent();
|
||||
if (captionContent) {
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(this, captionContent, &aName);
|
||||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// If no caption then use summary as a name.
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -499,11 +511,8 @@ nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
aRelation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIBED_BY) {
|
||||
nsCOMPtr<nsIAccessible> accCaption;
|
||||
GetCaption(getter_AddRefs(accCaption));
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, accCaption);
|
||||
}
|
||||
if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIBED_BY)
|
||||
return nsRelUtils::AddTarget(aRelationType, aRelation, Caption());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -514,10 +523,9 @@ nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
|
||||
{
|
||||
nsAccessible* firstChild = GetChildAt(0);
|
||||
if (firstChild && firstChild->Role() == nsIAccessibleRole::ROLE_CAPTION)
|
||||
NS_ADDREF(*aCaption = firstChild);
|
||||
NS_ENSURE_ARG_POINTER(aCaption);
|
||||
|
||||
NS_IF_ADDREF(*aCaption = Caption());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1204,13 +1212,9 @@ nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
|
||||
const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
|
||||
|
||||
PRBool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRInt32 count = 0;
|
||||
if (doUnselectRow)
|
||||
rv = GetColumnCount(&count);
|
||||
else
|
||||
rv = GetRowCount(&count);
|
||||
nsresult rv = doUnselectRow ? GetColumnCount(&count) : GetRowCount(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 startRowIdx = doUnselectRow ? aIndex : 0;
|
||||
PRInt32 endRowIdx = doUnselectRow ? aIndex : count - 1;
|
||||
@ -1268,17 +1272,23 @@ nsHTMLTableAccessible::Description(nsString& aDescription)
|
||||
if (!aDescription.IsEmpty())
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessible> captionAccessible;
|
||||
GetCaption(getter_AddRefs(captionAccessible));
|
||||
nsCOMPtr<nsIAccessNode> captionAccessNode = do_QueryInterface(captionAccessible);
|
||||
if (captionAccessNode) {
|
||||
nsCOMPtr<nsIDOMNode> captionNode;
|
||||
captionAccessNode->GetDOMNode(getter_AddRefs(captionNode));
|
||||
nsCOMPtr<nsIContent> captionContent = do_QueryInterface(captionNode);
|
||||
if (captionContent)
|
||||
// Use summary as description if it weren't used as a name.
|
||||
// XXX: get rid code duplication with NameInternal().
|
||||
nsAccessible* caption = Caption();
|
||||
if (caption) {
|
||||
nsIContent* captionContent = caption->GetContent();
|
||||
if (captionContent) {
|
||||
nsAutoString captionText;
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(this, captionContent,
|
||||
&aDescription);
|
||||
&captionText);
|
||||
|
||||
if (!captionText.IsEmpty()) { // summary isn't used as a name.
|
||||
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary,
|
||||
aDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SHOW_LAYOUT_HEURISTIC
|
||||
if (aDescription.IsEmpty()) {
|
||||
PRBool isProbablyForLayout;
|
||||
|
@ -141,6 +141,14 @@ public:
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
// TableAccessible
|
||||
inline nsAccessible* Caption() const
|
||||
{
|
||||
nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
|
||||
return child && child->Role() == nsIAccessibleRole::ROLE_CAPTION ?
|
||||
child : nsnull;
|
||||
}
|
||||
|
||||
// nsHTMLTableAccessible
|
||||
|
||||
/**
|
||||
|
@ -1154,7 +1154,7 @@ nsHyperTextAccessible::GetTextAttributes(PRBool aIncludeDefAttrs,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
PRInt32 accAtOffsetIdx = accAtOffset->GetIndexInParent();
|
||||
PRInt32 accAtOffsetIdx = accAtOffset->IndexInParent();
|
||||
PRInt32 startOffset = GetChildOffset(accAtOffsetIdx);
|
||||
PRInt32 endOffset = GetChildOffset(accAtOffsetIdx + 1);
|
||||
PRInt32 offsetInAcc = aOffset - startOffset;
|
||||
@ -2093,7 +2093,7 @@ nsHyperTextAccessible::InvalidateChildren()
|
||||
PRBool
|
||||
nsHyperTextAccessible::RemoveChild(nsAccessible* aAccessible)
|
||||
{
|
||||
PRInt32 childIndex = aAccessible->GetIndexInParent();
|
||||
PRInt32 childIndex = aAccessible->IndexInParent();
|
||||
PRInt32 count = mOffsets.Length() - childIndex;
|
||||
if (count > 0)
|
||||
mOffsets.RemoveElementsAt(childIndex, count);
|
||||
|
@ -56,7 +56,7 @@ CAccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
|
||||
|
||||
if (IID_IAccessibleHyperlink == iid) {
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (!thisObj->IsHyperLink())
|
||||
if (!thisObj->IsLink())
|
||||
return E_NOINTERFACE;
|
||||
|
||||
*ppv = static_cast<IAccessibleHyperlink*>(this);
|
||||
@ -76,13 +76,13 @@ __try {
|
||||
VariantInit(aAnchor);
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
|
||||
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsAccessible* anchor = thisObj->GetAnchor(aIndex);
|
||||
nsAccessible* anchor = thisObj->AnchorAt(aIndex);
|
||||
if (!anchor)
|
||||
return S_FALSE;
|
||||
|
||||
@ -111,13 +111,13 @@ __try {
|
||||
VariantInit(aAnchorTarget);
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
|
||||
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsCOMPtr<nsIURI> uri = thisObj->GetAnchorURI(aIndex);
|
||||
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
|
||||
if (!uri)
|
||||
return S_FALSE;
|
||||
|
||||
@ -151,7 +151,7 @@ __try {
|
||||
*aIndex = 0;
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
|
||||
*aIndex = thisObj->StartOffset();
|
||||
@ -168,7 +168,7 @@ __try {
|
||||
*aIndex = 0;
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
|
||||
*aIndex = thisObj->EndOffset();
|
||||
@ -185,10 +185,10 @@ __try {
|
||||
*aValid = false;
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
|
||||
*aValid = thisObj->IsValid();
|
||||
*aValid = thisObj->IsLinkValid();
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -899,38 +899,20 @@ STDMETHODIMP nsAccessibleWrap::accHitTest(
|
||||
{
|
||||
__try {
|
||||
VariantInit(pvarChild);
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
// convert to window coords
|
||||
nsCOMPtr<nsIAccessible> xpAccessible;
|
||||
|
||||
xLeft = xLeft;
|
||||
yTop = yTop;
|
||||
|
||||
if (nsAccUtils::MustPrune(this)) {
|
||||
xpAccessible = this;
|
||||
}
|
||||
else {
|
||||
GetChildAtPoint(xLeft, yTop, getter_AddRefs(xpAccessible));
|
||||
}
|
||||
nsAccessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
|
||||
|
||||
// if we got a child
|
||||
if (xpAccessible) {
|
||||
if (accessible) {
|
||||
// if the child is us
|
||||
if (xpAccessible == static_cast<nsIAccessible*>(this)) {
|
||||
if (accessible == this) {
|
||||
pvarChild->vt = VT_I4;
|
||||
pvarChild->lVal = CHILDID_SELF;
|
||||
} else { // its not create an Accessible for it.
|
||||
pvarChild->vt = VT_DISPATCH;
|
||||
pvarChild->pdispVal = NativeAccessible(xpAccessible);
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(xpAccessible));
|
||||
NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode");
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(domNode));
|
||||
if (!domNode) {
|
||||
// Has already been shut down
|
||||
pvarChild->vt = VT_EMPTY;
|
||||
return E_FAIL;
|
||||
}
|
||||
pvarChild->pdispVal = NativeAccessible(accessible);
|
||||
}
|
||||
} else {
|
||||
// no child at that point
|
||||
@ -1382,19 +1364,18 @@ STDMETHODIMP
|
||||
nsAccessibleWrap::get_indexInParent(long *aIndexInParent)
|
||||
{
|
||||
__try {
|
||||
if (!aIndexInParent)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aIndexInParent = -1;
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
PRInt32 index = -1;
|
||||
nsresult rv = GetIndexInParent(&index);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (index == -1)
|
||||
*aIndexInParent = IndexInParent();
|
||||
if (*aIndexInParent == -1)
|
||||
return S_FALSE;
|
||||
|
||||
*aIndexInParent = index;
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "nsWinUtils.h"
|
||||
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor/desctructor
|
||||
|
@ -562,8 +562,8 @@ nsXFormsSelectableItemAccessible::DoAction(PRUint8 aIndex)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXFormsSelectableItemAccessible::IsItemSelected()
|
||||
bool
|
||||
nsXFormsSelectableItemAccessible::IsSelected()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -194,7 +194,7 @@ public:
|
||||
NS_IMETHOD DoAction(PRUint8 aIndex);
|
||||
|
||||
protected:
|
||||
PRBool IsItemSelected();
|
||||
bool IsSelected();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -502,7 +502,7 @@ nsXFormsItemCheckgroupAccessible::NativeState()
|
||||
{
|
||||
PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
|
||||
|
||||
if (IsItemSelected())
|
||||
if (IsSelected())
|
||||
state |= states::CHECKED;
|
||||
|
||||
return state;
|
||||
@ -514,7 +514,7 @@ nsXFormsItemCheckgroupAccessible::GetActionName(PRUint8 aIndex, nsAString& aName
|
||||
if (aIndex != eAction_Click)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (IsItemSelected())
|
||||
if (IsSelected())
|
||||
aName.AssignLiteral("uncheck");
|
||||
else
|
||||
aName.AssignLiteral("check");
|
||||
@ -544,7 +544,7 @@ nsXFormsItemRadiogroupAccessible::NativeState()
|
||||
{
|
||||
PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
|
||||
|
||||
if (IsItemSelected())
|
||||
if (IsSelected())
|
||||
state |= states::CHECKED;
|
||||
|
||||
return state;
|
||||
@ -627,7 +627,7 @@ nsXFormsItemComboboxAccessible::NativeState()
|
||||
return state;
|
||||
|
||||
state |= states::SELECTABLE;
|
||||
if (IsItemSelected())
|
||||
if (IsSelected())
|
||||
state |= states::SELECTED;
|
||||
|
||||
return state;
|
||||
|
@ -1025,7 +1025,7 @@ nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
|
||||
|
||||
*aColumnIndex = 0;
|
||||
|
||||
PRInt32 indexInRow = GetIndexInParent();
|
||||
PRInt32 indexInRow = IndexInParent();
|
||||
for (PRInt32 idx = 0; idx < indexInRow; idx++) {
|
||||
nsAccessible* cell = row->GetChildAt(idx);
|
||||
PRUint32 role = cell->Role();
|
||||
@ -1058,7 +1058,7 @@ nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
|
||||
|
||||
*aRowIndex = 0;
|
||||
|
||||
PRInt32 indexInTable = row->GetIndexInParent();
|
||||
PRInt32 indexInTable = row->IndexInParent();
|
||||
for (PRInt32 idx = 0; idx < indexInTable; idx++) {
|
||||
row = table->GetChildAt(idx);
|
||||
if (row->Role() == nsIAccessibleRole::ROLE_ROW)
|
||||
|
@ -225,7 +225,7 @@ nsXULLinkAccessible::DoAction(PRUint8 aIndex)
|
||||
// nsXULLinkAccessible: HyperLinkAccessible
|
||||
|
||||
bool
|
||||
nsXULLinkAccessible::IsHyperLink()
|
||||
nsXULLinkAccessible::IsLink()
|
||||
{
|
||||
// Expose HyperLinkAccessible unconditionally.
|
||||
return true;
|
||||
@ -239,21 +239,21 @@ nsXULLinkAccessible::StartOffset()
|
||||
// a text.
|
||||
// XXX: accessible parent of XUL link accessible should be a hypertext
|
||||
// accessible.
|
||||
if (nsAccessible::IsHyperLink())
|
||||
if (nsAccessible::IsLink())
|
||||
return nsAccessible::StartOffset();
|
||||
return GetIndexInParent();
|
||||
return IndexInParent();
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsXULLinkAccessible::EndOffset()
|
||||
{
|
||||
if (nsAccessible::IsHyperLink())
|
||||
if (nsAccessible::IsLink())
|
||||
return nsAccessible::EndOffset();
|
||||
return GetIndexInParent() + 1;
|
||||
return IndexInParent() + 1;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsXULLinkAccessible::GetAnchorURI(PRUint32 aAnchorIndex)
|
||||
nsXULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
|
||||
{
|
||||
if (aAnchorIndex != 0)
|
||||
return nsnull;
|
||||
|
@ -97,10 +97,10 @@ public:
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual bool IsHyperLink();
|
||||
virtual bool IsLink();
|
||||
virtual PRUint32 StartOffset();
|
||||
virtual PRUint32 EndOffset();
|
||||
virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
|
||||
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
|
||||
|
||||
protected:
|
||||
enum { eAction_Jump = 0 };
|
||||
|
@ -228,8 +228,8 @@ nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
// nsXULTreeAccessible: nsAccessible implementation (DON'T put methods here)
|
||||
|
||||
nsAccessible*
|
||||
nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
nsXULTreeAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame)
|
||||
@ -255,7 +255,7 @@ nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
// If we failed to find tree cell for the given point then it might be
|
||||
// tree columns.
|
||||
if (row == -1 || !column)
|
||||
return nsAccessibleWrap::GetChildAtPoint(aX, aY, aWhichChild);
|
||||
return nsAccessibleWrap::ChildAtPoint(aX, aY, aWhichChild);
|
||||
|
||||
nsAccessible *child = GetTreeItemAccessible(row);
|
||||
if (aWhichChild == eDeepestChild && child) {
|
||||
@ -986,7 +986,7 @@ nsXULTreeItemAccessibleBase::NativeState()
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXULTreeItemAccessibleBase::GetIndexInParent() const
|
||||
nsXULTreeItemAccessibleBase::IndexInParent() const
|
||||
{
|
||||
return mParent ? mParent->ContentChildCount() + mRow : -1;
|
||||
}
|
||||
@ -1030,7 +1030,7 @@ nsXULTreeItemAccessibleBase::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
|
||||
return mParent->GetChildAt(GetIndexInParent() + aOffset);
|
||||
return mParent->GetChildAt(IndexInParent() + aOffset);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -66,7 +66,6 @@ class nsXULTreeAccessible : public nsAccessibleWrap
|
||||
public:
|
||||
using nsAccessible::GetChildCount;
|
||||
using nsAccessible::GetChildAt;
|
||||
using nsAccessible::GetChildAtPoint;
|
||||
|
||||
nsXULTreeAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
@ -86,8 +85,8 @@ public:
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
virtual nsAccessible* GetChildAt(PRUint32 aIndex);
|
||||
virtual PRInt32 GetChildCount();
|
||||
@ -209,7 +208,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRInt32 GetIndexInParent() const;
|
||||
virtual PRInt32 IndexInParent() const;
|
||||
|
||||
// nsXULTreeItemAccessibleBase
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID)
|
||||
|
@ -685,8 +685,8 @@ nsXULTreeGridRowAccessible::GetName(nsAString& aName)
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsXULTreeGridRowAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
nsXULTreeGridRowAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame)
|
||||
@ -1230,7 +1230,7 @@ nsXULTreeGridCellAccessible::NativeState()
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXULTreeGridCellAccessible::GetIndexInParent() const
|
||||
nsXULTreeGridCellAccessible::IndexInParent() const
|
||||
{
|
||||
return GetColumnIndex();
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ class nsXULTreeGridRowAccessible : public nsXULTreeItemAccessibleBase
|
||||
public:
|
||||
using nsAccessible::GetChildCount;
|
||||
using nsAccessible::GetChildAt;
|
||||
using nsAccessible::GetChildAtPoint;
|
||||
|
||||
nsXULTreeGridRowAccessible(nsIContent *aContent, nsIWeakReference *aShell,
|
||||
nsAccessible *aParent, nsITreeBoxObject *aTree,
|
||||
@ -94,8 +93,8 @@ public:
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
virtual nsAccessible* GetChildAt(PRUint32 aIndex);
|
||||
virtual PRInt32 GetChildCount();
|
||||
@ -166,7 +165,7 @@ public:
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRInt32 GetIndexInParent() const;
|
||||
virtual PRInt32 IndexInParent() const;
|
||||
|
||||
// nsXULTreeGridCellAccessible
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
|
||||
|
@ -7,7 +7,6 @@ var gRuleDoc = null;
|
||||
|
||||
// Debuggin stuff.
|
||||
var gDumpToConsole = false;
|
||||
gA11yEventDumpToConsole = gDumpToConsole;
|
||||
|
||||
/**
|
||||
* Start name tests. Run through markup elements and test names for test
|
||||
@ -149,7 +148,7 @@ function testNameForRule(aElm, aRuleElm)
|
||||
|
||||
testNameForAttrRule(aElm, aRuleElm);
|
||||
|
||||
} else if (aRuleElm.hasAttribute("elm") && aRuleElm.hasAttribute("elmattr")) {
|
||||
} else if (aRuleElm.hasAttribute("elm")) {
|
||||
if (gDumpToConsole) {
|
||||
dump("\nProcessing rule { elm: " + aRuleElm.getAttribute("elm") +
|
||||
", elmattr: " + aRuleElm.getAttribute("elmattr") +" }\n");
|
||||
@ -178,7 +177,7 @@ function testNameForAttrRule(aElm, aRule)
|
||||
if (type == "string") {
|
||||
name = attrValue;
|
||||
|
||||
} else if (type == "ref") {
|
||||
} else if (type == "ref" && attrValue) {
|
||||
var ids = attrValue.split(/\s+/);
|
||||
for (var idx = 0; idx < ids.length; idx++) {
|
||||
var labelElm = getNode(ids[idx]);
|
||||
@ -197,37 +196,53 @@ function testNameForAttrRule(aElm, aRule)
|
||||
}
|
||||
|
||||
function testNameForElmRule(aElm, aRule)
|
||||
{
|
||||
var elm = aRule.getAttribute("elm");
|
||||
var elmattr = aRule.getAttribute("elmattr");
|
||||
{
|
||||
var labelElm;
|
||||
|
||||
var filter = {
|
||||
acceptNode: function filter_acceptNode(aNode)
|
||||
{
|
||||
if (aNode.localName == this.mLocalName &&
|
||||
aNode.getAttribute(this.mAttrName) == this.mAttrValue)
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
var tagname = aRule.getAttribute("elm");
|
||||
var attrname = aRule.getAttribute("elmattr");
|
||||
if (attrname) {
|
||||
var filter = {
|
||||
acceptNode: function filter_acceptNode(aNode)
|
||||
{
|
||||
if (aNode.localName == this.mLocalName &&
|
||||
aNode.getAttribute(this.mAttrName) == this.mAttrValue)
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
},
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
},
|
||||
|
||||
mLocalName: elm,
|
||||
mAttrName: elmattr,
|
||||
mAttrValue: aElm.getAttribute("id")
|
||||
};
|
||||
mLocalName: tagname,
|
||||
mAttrName: attrname,
|
||||
mAttrValue: aElm.getAttribute("id")
|
||||
};
|
||||
|
||||
var treeWalker = document.createTreeWalker(document.body,
|
||||
NodeFilter.SHOW_ELEMENT,
|
||||
filter, false);
|
||||
var labelElm = treeWalker.nextNode();
|
||||
var msg = "Element '" + elm + "' test.";
|
||||
var treeWalker = document.createTreeWalker(document.body,
|
||||
NodeFilter.SHOW_ELEMENT,
|
||||
filter, false);
|
||||
labelElm = treeWalker.nextNode();
|
||||
|
||||
} else {
|
||||
// if attrname is empty then look for the element in subtree.
|
||||
labelElm = aElm.getElementsByTagName(tagname)[0];
|
||||
if (!labelElm)
|
||||
labelElm = aElm.getElementsByTagName("html:" + tagname)[0];
|
||||
}
|
||||
|
||||
if (!labelElm) {
|
||||
ok(false, msg + " Failed to find '" + tagname + "' element.");
|
||||
gTestIterator.iterateNext();
|
||||
return;
|
||||
}
|
||||
|
||||
var msg = "Element '" + tagname + "' test.";
|
||||
testName(aElm, labelElm.getAttribute("a11yname"), msg);
|
||||
|
||||
var parentNode = labelElm.parentNode;
|
||||
|
||||
if (gDumpToConsole) {
|
||||
dump("\nProcessed elm rule. Wait for reorder event on " +
|
||||
prettyName(parentNode) + "'\n");
|
||||
prettyName(parentNode) + "\n");
|
||||
}
|
||||
waitForEvent(EVENT_REORDER, parentNode,
|
||||
gTestIterator.iterateNext, gTestIterator);
|
||||
|
@ -1,31 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
This XML file is used to create sequence of accessible name tests. It consist of
|
||||
two sections. The first section 'ruledfn' declares name computation rules.
|
||||
The second section 'rulesample' defines markup samples we need to check name
|
||||
computation rules for.
|
||||
This XML file is used to create sequence of accessible name tests. It consist
|
||||
of two sections. The first section 'ruledfn' declares name computation rules.
|
||||
The second section 'rulesample' defines markup samples we need to check name
|
||||
computation rules for.
|
||||
|
||||
Section 'ruledfn' consist of 'ruleset' elements. Every 'ruleset' element is
|
||||
<ruledfn>
|
||||
<ruleset>
|
||||
<rule>
|
||||
|
||||
Section 'ruledfn' contains 'ruleset' elements. Every 'ruleset' element is
|
||||
presented by 'rule' elements so that sequence of 'rule' elements gives the
|
||||
sequence of name computations rules. Every 'rule' element can be one of four
|
||||
types.
|
||||
* name is equal to the value of attribute presented on the element. Example,
|
||||
'aria-label' attribute. In this case 'rule' element has 'attr' attribute
|
||||
pointing to attribute name and 'type' attribute with 'string' value. For
|
||||
example, <rule attr="aria-label" type="string"/>.
|
||||
* name is calculated from elements that are pointed to by attribute value on
|
||||
the element. Example is 'aria-labelledby'. In this case 'rule' element
|
||||
has 'attr' attribute holding the sequence of IDs of elements used to
|
||||
compute the name, in addition the 'rule' element has 'type' attribute with
|
||||
'ref' value. For example, <rule attr="aria-labelledby" type="ref"/>.
|
||||
* name is calculated from another element. Example, html:label@for element.
|
||||
In this case 'rule' element has 'elm' and 'elmattr' attributes. These
|
||||
attributes are used to find an element by tagname and attribute with value
|
||||
equaled to ID of the element. For example, <rule elm="label" elmattr="for"/>.
|
||||
* name is computed from subtree. Example, html:button. In this case 'rule'
|
||||
element has 'fromsubtree' attribute with 'true' value. For example,
|
||||
<rule fromsubtree="true"/>
|
||||
|
||||
* <rule attr='' type='string'/> used when name is equal to the value of
|
||||
attribute presented on the element.
|
||||
|
||||
Example, 'aria-label' attribute. In this case 'rule' element has 'attr'
|
||||
attribute pointing to attribute name and 'type' attribute with 'string'
|
||||
value. For example, <rule attr="aria-label" type="string"/>.
|
||||
|
||||
* <rule attr='' type='ref'/> used when name is calculated from elements that
|
||||
are pointed to by attribute value on the element.
|
||||
|
||||
Example is 'aria-labelledby'. In this case 'rule' element has 'attr'
|
||||
attribute holding the sequence of IDs of elements used to compute the name,
|
||||
in addition the 'rule' element has 'type' attribute with 'ref' value.
|
||||
For example, <rule attr="aria-labelledby" type="ref"/>.
|
||||
|
||||
* <rule elm='' elmattr=''/> used when name is calculated from another
|
||||
element. These attributes are used to find an element by tagname and
|
||||
attribute with value equaled to ID of the element. If 'elmattr' is missed
|
||||
then element from subtree with the given tagname is used.
|
||||
|
||||
Example, html:label@for element, <rule elm="label" elmattr="for"/>.
|
||||
Example, html:caption element, <rule elm="caption"/>
|
||||
|
||||
* <rule fromsubtree='true'/> used when name is computed from subtree.
|
||||
|
||||
Example, html:button. In this case 'rule' element has 'fromsubtree'
|
||||
attribute with 'true' value.
|
||||
|
||||
<rulesample>
|
||||
<markup ruleset=''>
|
||||
|
||||
Section 'rulesample' provides set of markup samples ('markup' elements). Every
|
||||
'markup' element contains an element that accessible name will be computed for
|
||||
@ -120,6 +139,12 @@
|
||||
<rule attr="title" type="string"/>
|
||||
</ruleset>
|
||||
|
||||
<ruleset id="htmltable">
|
||||
<ruleset ref="htmlelm_start"/>
|
||||
<rule elm="caption"/>
|
||||
<rule attr="summary" type="string"/>
|
||||
<ruleset ref="htmlelm_end"/>
|
||||
</ruleset>
|
||||
</ruledfn>
|
||||
|
||||
<rulesample>
|
||||
@ -210,6 +235,25 @@
|
||||
</html:table>
|
||||
</markup>
|
||||
|
||||
<markup ref="html:table" ruleset="htmltable"
|
||||
id="markup6test">
|
||||
<html:span id="l1" a11yname="lby_tst6_1">lby_tst6_1</html:span>
|
||||
<html:span id="l2" a11yname="lby_tst6_2">lby_tst6_2</html:span>
|
||||
<html:label for="t" a11yname="label_tst6">label_tst6</html:label>
|
||||
<!-- layout frame are recreated due to varous reasons, here's text frame
|
||||
placed after caption frame triggres table frame recreation when
|
||||
caption element is removed from DOM; get rid text node after caption
|
||||
node to make the test working -->
|
||||
<html:table id="t" aria-label="arialabel_tst6"
|
||||
aria-labelledby="l1 l2"
|
||||
summary="summary_tst6"
|
||||
title="title_tst6">
|
||||
<html:caption a11yname="caption_tst6">caption_tst6</html:caption><html:tr>
|
||||
<html:td>cell1</html:td>
|
||||
<html:td>cell2</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</markup>
|
||||
</rulesample>
|
||||
|
||||
</rules>
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
<script type="application/javascript">
|
||||
// gA11yEventDumpID = "eventdump";
|
||||
//gDumpToConsole = true;
|
||||
//gA11yEventDumpToConsole = true;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(testNames);
|
||||
@ -35,6 +37,12 @@
|
||||
title="nsIAccessible::name calculation for elements">
|
||||
Mozilla Bug 459635
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=666212"
|
||||
title="summary attribute content mapped to accessible name in MSAA">
|
||||
Mozilla Bug 666212
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
@ -38,6 +38,15 @@
|
||||
// Description from content of h2.
|
||||
testDescr("p", "heading");
|
||||
|
||||
// From table summary (caption is used as a name)
|
||||
testDescr("table1", "summary");
|
||||
|
||||
// Empty (summary is used as a name)
|
||||
testDescr("table2", "");
|
||||
|
||||
// From title (summary is used as a name)
|
||||
testDescr("table3", "title");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -54,6 +63,11 @@
|
||||
title="@title attribute no longer exposed on accDescription">
|
||||
Mozilla Bug 489944
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=666212"
|
||||
title="summary attribute content mapped to accessible name in MSAA">
|
||||
Mozilla Bug 666212
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
@ -66,5 +80,18 @@
|
||||
|
||||
<h2 id="heading">heading</h2>
|
||||
<p id="p" aria-describedby="heading" role="button">click me</p>
|
||||
|
||||
<table id="table1" summary="summary">
|
||||
<caption>caption</caption>
|
||||
<tr><td>cell</td></tr>
|
||||
</table>
|
||||
|
||||
<table id="table2" summary="summary">
|
||||
<tr><td>cell</td></tr>
|
||||
</table>
|
||||
|
||||
<table id="table3" summary="summary" title="title">
|
||||
<tr><td>cell</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -23,6 +23,7 @@
|
||||
# Jonathan Wilson <jonwil@tpgi.com.au>
|
||||
# Dan Mosedale <dmose@mozilla.org>
|
||||
# Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
# Jared Wein <jwein@mozilla.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
|
||||
@ -107,10 +108,6 @@ LIBS += \
|
||||
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_JPROF
|
||||
LIBS += -ljprof
|
||||
endif
|
||||
|
||||
ifndef MOZ_WINCONSOLE
|
||||
ifdef MOZ_DEBUG
|
||||
MOZ_WINCONSOLE = 1
|
||||
@ -203,7 +200,6 @@ endif
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
libs::
|
||||
$(INSTALL) $(IFLAGS1) $(DIST)/branding/mozicon128.png $(DIST)/bin/icons
|
||||
$(INSTALL) $(IFLAGS1) $(DIST)/branding/document.png $(DIST)/bin/icons
|
||||
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
|
||||
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
|
||||
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
|
||||
|
@ -38,9 +38,12 @@
|
||||
|
||||
#include "nsXPCOMGlue.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#ifdef XP_WIN
|
||||
#if defined(XP_WIN)
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#elif defined(XP_UNIX)
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -65,6 +68,8 @@
|
||||
|
||||
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
static void Output(const char *fmt, ... )
|
||||
{
|
||||
va_list ap;
|
||||
@ -117,6 +122,7 @@ XRE_FreeAppDataType XRE_FreeAppData;
|
||||
#ifdef XRE_HAS_DLL_BLOCKLIST
|
||||
XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
|
||||
#endif
|
||||
XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
|
||||
XRE_mainType XRE_main;
|
||||
|
||||
static const nsDynamicFunctionLoad kXULFuncs[] = {
|
||||
@ -126,6 +132,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
|
||||
#ifdef XRE_HAS_DLL_BLOCKLIST
|
||||
{ "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
|
||||
#endif
|
||||
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
|
||||
{ "XRE_main", (NSFuncPtr*) &XRE_main },
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
@ -209,15 +216,19 @@ int main(int argc, char* argv[])
|
||||
|
||||
strcpy(++lastSlash, XPCOM_DLL);
|
||||
|
||||
#ifdef XP_WIN
|
||||
int gotCounters;
|
||||
#if defined(XP_UNIX)
|
||||
struct rusage initialRUsage;
|
||||
gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
|
||||
#elif defined(XP_WIN)
|
||||
// GetProcessIoCounters().ReadOperationCount seems to have little to
|
||||
// do with actual read operations. It reports 0 or 1 at this stage
|
||||
// in the program. Luckily 1 coincides with when prefetch is
|
||||
// enabled. If Windows prefetch didn't happen we can do our own
|
||||
// faster dll preloading.
|
||||
IO_COUNTERS ioCounters;
|
||||
if (GetProcessIoCounters(GetCurrentProcess(), &ioCounters)
|
||||
&& !ioCounters.ReadOperationCount)
|
||||
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
|
||||
if (gotCounters && !ioCounters.ReadOperationCount)
|
||||
#endif
|
||||
{
|
||||
XPCOMGlueEnablePreload();
|
||||
@ -240,6 +251,30 @@ int main(int argc, char* argv[])
|
||||
XRE_SetupDllBlocklist();
|
||||
#endif
|
||||
|
||||
if (gotCounters) {
|
||||
#if defined(XP_WIN)
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
|
||||
int(ioCounters.ReadOperationCount));
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_TRANSFER,
|
||||
int(ioCounters.ReadTransferCount / 1024));
|
||||
IO_COUNTERS newIoCounters;
|
||||
if (GetProcessIoCounters(GetCurrentProcess(), &newIoCounters)) {
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_OPS,
|
||||
int(newIoCounters.ReadOperationCount - ioCounters.ReadOperationCount));
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_TRANSFER,
|
||||
int((newIoCounters.ReadTransferCount - ioCounters.ReadTransferCount) / 1024));
|
||||
}
|
||||
#elif defined(XP_UNIX)
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
|
||||
int(initialRUsage.ru_majflt));
|
||||
struct rusage newRUsage;
|
||||
if (!getrusage(RUSAGE_SELF, &newRUsage)) {
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
|
||||
int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int result;
|
||||
{
|
||||
ScopedLogging log;
|
||||
|
@ -166,10 +166,6 @@ pref("app.update.url", "https://aus3.mozilla.org/update/3/%PRODUCT%/%VERSION%/%B
|
||||
|
||||
// app.update.interval is in branding section
|
||||
|
||||
// Interval: Time before prompting the user again to restart to install the
|
||||
// latest download (in seconds) default=1 day
|
||||
pref("app.update.nagTimer.restart", 86400);
|
||||
|
||||
// Give the user x seconds to react before showing the big UI. default=12 hours
|
||||
pref("app.update.promptWaitTime", 43200);
|
||||
// Show the Update Checking/Ready UI when the user was idle for x seconds
|
||||
@ -301,6 +297,7 @@ pref("browser.urlbar.match.url", "@");
|
||||
pref("browser.urlbar.default.behavior", 0);
|
||||
|
||||
pref("browser.urlbar.formatting.enabled", true);
|
||||
pref("browser.urlbar.trimURLs", true);
|
||||
|
||||
// Number of milliseconds to wait for the http headers (and thus
|
||||
// the Content-Disposition filename) before giving up and falling back to
|
||||
@ -1002,9 +999,11 @@ pref("services.sync.prefs.sync.spellchecker.dictionary", true);
|
||||
pref("services.sync.prefs.sync.xpinstall.whitelist.required", true);
|
||||
#endif
|
||||
|
||||
// Disable the error console and inspector
|
||||
// Disable the error console
|
||||
pref("devtools.errorconsole.enabled", false);
|
||||
pref("devtools.inspector.enabled", false);
|
||||
|
||||
// Enable the Inspector
|
||||
pref("devtools.inspector.enabled", true);
|
||||
|
||||
// Enable the Scratchpad tool.
|
||||
pref("devtools.scratchpad.enabled", true);
|
||||
@ -1030,6 +1029,12 @@ pref("devtools.hud.loglimit.cssparser", 200);
|
||||
pref("devtools.hud.loglimit.exception", 200);
|
||||
pref("devtools.hud.loglimit.console", 200);
|
||||
|
||||
// The developer tools editor configuration:
|
||||
// - tabsize: how many spaces to use when a Tab character is displayed.
|
||||
// - expandtab: expand Tab characters to spaces.
|
||||
pref("devtools.editor.tabsize", 4);
|
||||
pref("devtools.editor.expandtab", true);
|
||||
|
||||
// Whether the character encoding menu is under the main Firefox button. This
|
||||
// preference is a string so that localizers can alter it.
|
||||
pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
|
||||
|
@ -242,7 +242,7 @@
|
||||
<key id="key_errorConsole" key="&errorConsoleCmd.commandkey;" oncommand="toJavaScriptConsole();" modifiers="accel,shift" disabled="true"/>
|
||||
<key id="key_webConsole" key="&webConsoleCmd.commandkey;" oncommand="HUDConsoleUI.toggleHUD();" modifiers="accel,shift"/>
|
||||
<key id="key_inspect" key="&inspectMenu.commandkey;" command="Tools:Inspect" modifiers="accel,shift"/>
|
||||
<key id="key_scratchpad" keycode="&scratchpad.keycode;"
|
||||
<key id="key_scratchpad" keycode="&scratchpad.keycode;" modifiers="shift"
|
||||
keytext="&scratchpad.keytext;" command="Tools:Scratchpad"/>
|
||||
<key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/>
|
||||
<key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
|
||||
|
@ -5919,10 +5919,6 @@ var BrowserOffline = {
|
||||
}
|
||||
|
||||
ioService.offline = !ioService.offline;
|
||||
|
||||
// Save the current state for later use as the initial state
|
||||
// (if there is no netLinkService)
|
||||
gPrefService.setBoolPref("browser.offline", ioService.offline);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -224,15 +224,6 @@
|
||||
</hbox>
|
||||
</panel>
|
||||
|
||||
<panel id="highlighter-panel"
|
||||
hidden="true"
|
||||
ignorekeys="true"
|
||||
noautofocus="true"
|
||||
noautohide="true"
|
||||
onclick="InspectorUI.stopInspecting();"
|
||||
onmousemove="InspectorUI.highlighter.handleMouseMove(event);"
|
||||
onMozMousePixelScroll="InspectorUI.highlighter.handlePixelScroll(event);"/>
|
||||
|
||||
<panel id="inspector-tree-panel"
|
||||
orient="vertical"
|
||||
hidden="true"
|
||||
@ -1033,6 +1024,12 @@
|
||||
#endif
|
||||
|
||||
</vbox>
|
||||
# <iframe id="highlighter-frame"
|
||||
# transparent="true"
|
||||
# type="content"
|
||||
# src="chrome://content/base/highlighter.html"/> is dynamically appended as
|
||||
# the last child of #tab-view-deck, only when it is needed, for minimal
|
||||
# performance impact.
|
||||
# <iframe id="tab-view"> is dynamically appended as the 2nd child of #tab-view-deck.
|
||||
# Introducing the iframe dynamically, as needed, was found to be better than
|
||||
# starting with an empty iframe here in browser.xul from a Ts standpoint.
|
||||
|
63
browser/base/content/highlighter.xhtml
Normal file
63
browser/base/content/highlighter.xhtml
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<!-- ***** 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 Highlighter code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2011
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Rob Campbell <rcampbell@mozilla.com> (Original Author)
|
||||
- Paul Rouget <paul@mozilla.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 LGPL or the GPL. 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 ***** -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="stylesheet" href="chrome://browser/skin/highlighter.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="close-button" role="button" class="clickable"/>
|
||||
|
||||
<!--
|
||||
To darken the page around the selected node, we use black-transparent
|
||||
divs, organized in 3 rows, keeping the div in the middle transparent.
|
||||
-->
|
||||
<div id="veil-container">
|
||||
<div id="veil">
|
||||
<div id="veil-topbox" class="veil"/>
|
||||
<div id="veil-middlebox">
|
||||
<div id="veil-leftbox" class="veil"/>
|
||||
<div id="veil-transparentbox"/>
|
||||
<div id="veil-rightbox" class="veil"/>
|
||||
</div>
|
||||
<div id="veil-bottombox" class="veil"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -192,12 +192,19 @@ InsideOutBox.prototype =
|
||||
* Force the object box open by expanding all elements in the tree?
|
||||
* @param scrollIntoView
|
||||
* Scroll the objectBox into view?
|
||||
* @returns objectBox
|
||||
* @returns nsIDOMNode|null
|
||||
* A DOM node that represents the "object box", the element that
|
||||
* holds/displays the given aObject representation in the tree. If
|
||||
* the object cannot be selected, if it is a stale object, null is
|
||||
* returned.
|
||||
*/
|
||||
select:
|
||||
function IOBox_select(aObject, makeBoxVisible, forceOpen, scrollIntoView)
|
||||
{
|
||||
let objectBox = this.createObjectBox(aObject);
|
||||
if (!objectBox) {
|
||||
return null;
|
||||
}
|
||||
this.selectObjectBox(objectBox, forceOpen);
|
||||
if (makeBoxVisible) {
|
||||
this.openObjectBox(objectBox);
|
||||
|
@ -25,6 +25,7 @@
|
||||
* Rob Campbell <rcampbell@mozilla.com> (original author)
|
||||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
* Julian Viereck <jviereck@mozilla.com>
|
||||
* Paul Rouget <paul@mozilla.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
|
||||
@ -55,152 +56,256 @@ const INSPECTOR_INVISIBLE_ELEMENTS = {
|
||||
"title": true,
|
||||
};
|
||||
|
||||
// Inspector notifications dispatched through the nsIObserverService.
|
||||
const INSPECTOR_NOTIFICATIONS = {
|
||||
// Fires once the Inspector highlighter is initialized and ready for use.
|
||||
HIGHLIGHTER_READY: "highlighter-ready",
|
||||
|
||||
// Fires once the Inspector highlights an element in the page.
|
||||
HIGHLIGHTING: "inspector-highlighting",
|
||||
|
||||
// Fires once the Inspector stops highlighting any element.
|
||||
UNHIGHLIGHTING: "inspector-unhighlighting",
|
||||
|
||||
// Fires once the Inspector completes the initialization and opens up on
|
||||
// screen.
|
||||
OPENED: "inspector-opened",
|
||||
|
||||
// Fires once the Inspector is closed.
|
||||
CLOSED: "inspector-closed",
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// PanelHighlighter
|
||||
//// IFrameHighlighter
|
||||
|
||||
/**
|
||||
* A highlighter mechanism using xul panels.
|
||||
* A highlighter mechanism using a transparent xul iframe.
|
||||
*
|
||||
* @param aBrowser
|
||||
* The XUL browser object for the content window being highlighted.
|
||||
* @param nsIDOMNode aBrowser
|
||||
* The xul:browser object for the content window being highlighted.
|
||||
*/
|
||||
function PanelHighlighter(aBrowser)
|
||||
function IFrameHighlighter(aBrowser)
|
||||
{
|
||||
this.panel = document.getElementById("highlighter-panel");
|
||||
this.panel.hidden = false;
|
||||
this.browser = aBrowser;
|
||||
this.win = this.browser.contentWindow;
|
||||
this._init(aBrowser);
|
||||
}
|
||||
|
||||
PanelHighlighter.prototype = {
|
||||
IFrameHighlighter.prototype = {
|
||||
|
||||
_init: function IFH__init(aBrowser)
|
||||
{
|
||||
this.browser = aBrowser;
|
||||
let stack = this.browser.parentNode;
|
||||
this.win = this.browser.contentWindow;
|
||||
this._highlighting = false;
|
||||
|
||||
let div = document.createElement("div");
|
||||
div.flex = 1;
|
||||
div.setAttribute("style", "pointer-events: none; -moz-user-focus: ignore");
|
||||
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.setAttribute("id", "highlighter-frame");
|
||||
iframe.setAttribute("transparent", "true");
|
||||
iframe.setAttribute("type", "content");
|
||||
iframe.addEventListener("DOMTitleChanged", function(aEvent) {
|
||||
aEvent.stopPropagation();
|
||||
}, true);
|
||||
iframe.flex = 1;
|
||||
iframe.setAttribute("style", "-moz-user-focus: ignore");
|
||||
|
||||
this.listenOnce(iframe, "load", (function iframeLoaded() {
|
||||
this.iframeDoc = iframe.contentDocument;
|
||||
|
||||
this.veilTopDiv = this.iframeDoc.getElementById("veil-topbox");
|
||||
this.veilLeftDiv = this.iframeDoc.getElementById("veil-leftbox");
|
||||
this.veilMiddleDiv = this.iframeDoc.getElementById("veil-middlebox");
|
||||
this.veilTransparentDiv = this.iframeDoc.getElementById("veil-transparentbox");
|
||||
|
||||
let closeButton = this.iframeDoc.getElementById("close-button");
|
||||
this.listenOnce(closeButton, "click",
|
||||
InspectorUI.closeInspectorUI.bind(InspectorUI, false), false);
|
||||
|
||||
this.browser.addEventListener("click", this, true);
|
||||
iframe.contentWindow.addEventListener("resize", this, false);
|
||||
this.handleResize();
|
||||
Services.obs.notifyObservers(null,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTER_READY, null);
|
||||
}).bind(this), true);
|
||||
|
||||
iframe.setAttribute("src", "chrome://browser/content/highlighter.xhtml");
|
||||
|
||||
div.appendChild(iframe);
|
||||
stack.appendChild(div);
|
||||
this.iframe = iframe;
|
||||
this.iframeContainer = div;
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the iframe and its nodes.
|
||||
*/
|
||||
destroy: function IFH_destroy()
|
||||
{
|
||||
this.browser.removeEventListener("click", this, true);
|
||||
this._highlightRect = null;
|
||||
this._highlighting = false;
|
||||
this.veilTopDiv = null;
|
||||
this.veilLeftDiv = null;
|
||||
this.veilMiddleDiv = null;
|
||||
this.veilTransparentDiv = null;
|
||||
this.node = null;
|
||||
this.iframeDoc = null;
|
||||
this.browser.parentNode.removeChild(this.iframeContainer);
|
||||
this.iframeContainer = null;
|
||||
this.iframe = null;
|
||||
this.win = null
|
||||
this.browser = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the highlighter highlighting? Public method for querying the state
|
||||
* of the highlighter.
|
||||
*/
|
||||
get isHighlighting() {
|
||||
return this._highlighting;
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight this.node, unhilighting first if necessary.
|
||||
*
|
||||
* @param scroll
|
||||
* @param boolean aScroll
|
||||
* Boolean determining whether to scroll or not.
|
||||
*/
|
||||
highlight: function PanelHighlighter_highlight(scroll)
|
||||
highlight: function IFH_highlight(aScroll)
|
||||
{
|
||||
// node is not set or node is not highlightable, bail
|
||||
if (!this.isNodeHighlightable()) {
|
||||
if (!this.node || !this.isNodeHighlightable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.unhighlight();
|
||||
let clientRect = this.node.getBoundingClientRect();
|
||||
|
||||
let rect = this.node.getBoundingClientRect();
|
||||
// clientRect is read-only, we need to be able to change properties.
|
||||
let rect = {top: clientRect.top,
|
||||
left: clientRect.left,
|
||||
width: clientRect.width,
|
||||
height: clientRect.height};
|
||||
let oldRect = this._highlightRect;
|
||||
|
||||
if (scroll) {
|
||||
if (oldRect && rect.top == oldRect.top && rect.left == oldRect.left &&
|
||||
rect.width == oldRect.width && rect.height == oldRect.height) {
|
||||
return; // same rectangle
|
||||
}
|
||||
|
||||
if (aScroll) {
|
||||
this.node.scrollIntoView();
|
||||
}
|
||||
|
||||
if (this.viewContainsRect(rect)) {
|
||||
// TODO check for offscreen boundaries, bug565301
|
||||
this.panel.openPopup(this.node, "overlap", 0, 0, false, false);
|
||||
this.panel.sizeTo(rect.width, rect.height);
|
||||
} else {
|
||||
this.highlightVisibleRegion(rect);
|
||||
// Go up in the tree of frames to determine the correct rectangle
|
||||
// coordinates and size.
|
||||
let frameWin = this.node.ownerDocument.defaultView;
|
||||
do {
|
||||
let frameRect = frameWin.frameElement ?
|
||||
frameWin.frameElement.getBoundingClientRect() :
|
||||
{top: 0, left: 0};
|
||||
|
||||
if (rect.top < 0) {
|
||||
rect.height += rect.top;
|
||||
rect.top = 0;
|
||||
}
|
||||
|
||||
if (rect.left < 0) {
|
||||
rect.width += rect.left;
|
||||
rect.left = 0;
|
||||
}
|
||||
|
||||
let diffx = frameWin.innerWidth - rect.left - rect.width;
|
||||
if (diffx < 0) {
|
||||
rect.width += diffx;
|
||||
}
|
||||
let diffy = frameWin.innerHeight - rect.top - rect.height;
|
||||
if (diffy < 0) {
|
||||
rect.height += diffy;
|
||||
}
|
||||
|
||||
rect.left += frameRect.left;
|
||||
rect.top += frameRect.top;
|
||||
|
||||
frameWin = frameWin.parent;
|
||||
} while (frameWin != this.win);
|
||||
|
||||
this.highlightRectangle(rect);
|
||||
|
||||
if (this._highlighting) {
|
||||
Services.obs.notifyObservers(null,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, null);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight the given node.
|
||||
*
|
||||
* @param aNode
|
||||
* @param nsIDOMNode aNode
|
||||
* a DOM element to be highlighted
|
||||
* @param aParams
|
||||
* @param object aParams
|
||||
* extra parameters object
|
||||
*/
|
||||
highlightNode: function PanelHighlighter_highlightNode(aNode, aParams)
|
||||
highlightNode: function IFH_highlightNode(aNode, aParams)
|
||||
{
|
||||
this.node = aNode;
|
||||
this.highlight(aParams && aParams.scroll);
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight the visible region of the region described by aRect, if any.
|
||||
* Highlight a rectangular region.
|
||||
*
|
||||
* @param aRect
|
||||
* @param object aRect
|
||||
* The rectangle region to highlight.
|
||||
* @returns boolean
|
||||
* was a region highlighted?
|
||||
* True if the rectangle was highlighted, false otherwise.
|
||||
*/
|
||||
highlightVisibleRegion: function PanelHighlighter_highlightVisibleRegion(aRect)
|
||||
highlightRectangle: function IFH_highlightRectangle(aRect)
|
||||
{
|
||||
let offsetX = 0;
|
||||
let offsetY = 0;
|
||||
let width = 0;
|
||||
let height = 0;
|
||||
let visibleWidth = this.win.innerWidth;
|
||||
let visibleHeight = this.win.innerHeight;
|
||||
if (aRect.left >= 0 && aRect.top >= 0 &&
|
||||
aRect.width > 0 && aRect.height > 0) {
|
||||
// The bottom div and the right div are flexibles (flex=1).
|
||||
// We don't need to resize them.
|
||||
this.veilTopDiv.style.height = aRect.top + "px";
|
||||
this.veilLeftDiv.style.width = aRect.left + "px";
|
||||
this.veilMiddleDiv.style.height = aRect.height + "px";
|
||||
this.veilTransparentDiv.style.width = aRect.width + "px";
|
||||
|
||||
// If any of these edges are out-of-bounds, the node's rectangle is
|
||||
// completely out-of-view and we can return.
|
||||
if (aRect.top > visibleHeight || aRect.left > visibleWidth ||
|
||||
aRect.bottom < 0 || aRect.right < 0) {
|
||||
return false;
|
||||
this._highlighting = true;
|
||||
} else {
|
||||
this.unhighlight();
|
||||
}
|
||||
|
||||
// Calculate node offsets, if values are negative, then start the offsets
|
||||
// at their absolute values from node origin. The delta should be the edge
|
||||
// of view.
|
||||
offsetX = aRect.left < 0 ? Math.abs(aRect.left) : 0;
|
||||
offsetY = aRect.top < 0 ? Math.abs(aRect.top) : 0;
|
||||
this._highlightRect = aRect;
|
||||
|
||||
// Calculate actual node width, taking into account the available visible
|
||||
// width and then subtracting the offset for the final dimension.
|
||||
width = aRect.right > visibleWidth ? visibleWidth - aRect.left :
|
||||
aRect.width;
|
||||
width -= offsetX;
|
||||
|
||||
// Calculate actual node height using the same formula as above for width.
|
||||
height = aRect.bottom > visibleHeight ? visibleHeight - aRect.top :
|
||||
aRect.height;
|
||||
height -= offsetY;
|
||||
|
||||
// If width and height are non-negative, open the highlighter popup over the
|
||||
// node and sizeTo width and height.
|
||||
if (width > 0 && height > 0) {
|
||||
this.panel.openPopup(this.node, "overlap", offsetX, offsetY, false,
|
||||
false);
|
||||
this.panel.sizeTo(width, height);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return this._highlighting;
|
||||
},
|
||||
|
||||
/**
|
||||
* Close the highlighter panel.
|
||||
* Clear the highlighter surface.
|
||||
*/
|
||||
unhighlight: function PanelHighlighter_unhighlight()
|
||||
unhighlight: function IFH_unhighlight()
|
||||
{
|
||||
if (this.isHighlighting) {
|
||||
this.panel.hidePopup();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the highlighter panel open?
|
||||
*
|
||||
* @returns boolean
|
||||
*/
|
||||
get isHighlighting()
|
||||
{
|
||||
return this.panel.state == "open";
|
||||
this._highlighting = false;
|
||||
this.veilMiddleDiv.style.height = 0;
|
||||
this.veilTransparentDiv.style.width = 0;
|
||||
Services.obs.notifyObservers(null,
|
||||
INSPECTOR_NOTIFICATIONS.UNHIGHLIGHTING, null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the midpoint of a line from pointA to pointB.
|
||||
*
|
||||
* @param aPointA
|
||||
* @param object aPointA
|
||||
* An object with x and y properties.
|
||||
* @param aPointB
|
||||
* @param object aPointB
|
||||
* An object with x and y properties.
|
||||
* @returns aPoint
|
||||
* @returns object
|
||||
* An object with x and y properties.
|
||||
*/
|
||||
midPoint: function PanelHighlighter_midPoint(aPointA, aPointB)
|
||||
midPoint: function IFH_midPoint(aPointA, aPointB)
|
||||
{
|
||||
let pointC = { };
|
||||
pointC.x = (aPointB.x - aPointA.x) / 2 + aPointA.x;
|
||||
@ -213,28 +318,25 @@ PanelHighlighter.prototype = {
|
||||
* Calculation based on midpoint of diagonal from top left to bottom right
|
||||
* of panel.
|
||||
*
|
||||
* @returns a DOM node or null if none
|
||||
* @returns nsIDOMNode|null
|
||||
* Returns the node under the current highlighter rectangle. Null is
|
||||
* returned if there is no node highlighted.
|
||||
*/
|
||||
get highlitNode()
|
||||
{
|
||||
// No highlighter panel? Bail.
|
||||
if (!this.isHighlighting) {
|
||||
// Not highlighting? Bail.
|
||||
if (!this._highlighting || !this._highlightRect) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let browserRect = this.browser.getBoundingClientRect();
|
||||
let clientRect = this.panel.getBoundingClientRect();
|
||||
|
||||
// Calculate top left point offset minus browser chrome.
|
||||
let a = {
|
||||
x: clientRect.left - browserRect.left,
|
||||
y: clientRect.top - browserRect.top
|
||||
x: this._highlightRect.left,
|
||||
y: this._highlightRect.top
|
||||
};
|
||||
|
||||
// Calculate bottom right point minus browser chrome.
|
||||
let b = {
|
||||
x: clientRect.right - browserRect.left,
|
||||
y: clientRect.bottom - browserRect.top
|
||||
x: a.x + this._highlightRect.width,
|
||||
y: a.y + this._highlightRect.height
|
||||
};
|
||||
|
||||
// Get midpoint of diagonal line.
|
||||
@ -248,80 +350,195 @@ PanelHighlighter.prototype = {
|
||||
* Is this.node highlightable?
|
||||
*
|
||||
* @returns boolean
|
||||
* True if the node is highlightable or false otherwise.
|
||||
*/
|
||||
isNodeHighlightable: function PanelHighlighter_isNodeHighlightable()
|
||||
isNodeHighlightable: function IFH_isNodeHighlightable()
|
||||
{
|
||||
if (!this.node) {
|
||||
if (!this.node || this.node.nodeType != Node.ELEMENT_NODE) {
|
||||
return false;
|
||||
}
|
||||
let nodeName = this.node.nodeName.toLowerCase();
|
||||
if (nodeName[0] == '#') {
|
||||
return false;
|
||||
}
|
||||
return !INSPECTOR_INVISIBLE_ELEMENTS[nodeName];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the given viewport-relative rect is within the visible area
|
||||
* of the window.
|
||||
*
|
||||
* @param aRect
|
||||
* a CSS rectangle object
|
||||
* @returns boolean
|
||||
*/
|
||||
viewContainsRect: function PanelHighlighter_viewContainsRect(aRect)
|
||||
{
|
||||
let visibleWidth = this.win.innerWidth;
|
||||
let visibleHeight = this.win.innerHeight;
|
||||
|
||||
return ((0 <= aRect.left) && (aRect.right <= visibleWidth) &&
|
||||
(0 <= aRect.top) && (aRect.bottom <= visibleHeight))
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//// Event Handling
|
||||
|
||||
attachInspectListeners: function IFH_attachInspectListeners()
|
||||
{
|
||||
this.browser.addEventListener("mousemove", this, true);
|
||||
this.browser.addEventListener("dblclick", this, true);
|
||||
this.browser.addEventListener("mousedown", this, true);
|
||||
this.browser.addEventListener("mouseup", this, true);
|
||||
},
|
||||
|
||||
detachInspectListeners: function IFH_detachInspectListeners()
|
||||
{
|
||||
this.browser.removeEventListener("mousemove", this, true);
|
||||
this.browser.removeEventListener("dblclick", this, true);
|
||||
this.browser.removeEventListener("mousedown", this, true);
|
||||
this.browser.removeEventListener("mouseup", this, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Generic event handler.
|
||||
*
|
||||
* @param nsIDOMEvent aEvent
|
||||
* The DOM event object.
|
||||
*/
|
||||
handleEvent: function IFH_handleEvent(aEvent)
|
||||
{
|
||||
switch (aEvent.type) {
|
||||
case "click":
|
||||
this.handleClick(aEvent);
|
||||
break;
|
||||
case "mousemove":
|
||||
this.handleMouseMove(aEvent);
|
||||
break;
|
||||
case "resize":
|
||||
this.handleResize(aEvent);
|
||||
break;
|
||||
case "dblclick":
|
||||
case "mousedown":
|
||||
case "mouseup":
|
||||
aEvent.stopPropagation();
|
||||
aEvent.preventDefault();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle clicks on the iframe.
|
||||
*
|
||||
* @param nsIDOMEvent aEvent
|
||||
* The DOM event.
|
||||
*/
|
||||
handleClick: function IFH_handleClick(aEvent)
|
||||
{
|
||||
// Proxy the click event to the iframe.
|
||||
let x = aEvent.clientX;
|
||||
let y = aEvent.clientY;
|
||||
let frameWin = aEvent.view;
|
||||
while (frameWin != this.win) {
|
||||
if (frameWin.frameElement) {
|
||||
let frameRect = frameWin.frameElement.getBoundingClientRect();
|
||||
x += frameRect.left;
|
||||
y += frameRect.top;
|
||||
}
|
||||
frameWin = frameWin.parent;
|
||||
}
|
||||
|
||||
let element = this.iframeDoc.elementFromPoint(x, y);
|
||||
if (element && element.classList &&
|
||||
element.classList.contains("clickable")) {
|
||||
let newEvent = this.iframeDoc.createEvent("MouseEvents");
|
||||
newEvent.initMouseEvent(aEvent.type, aEvent.bubbles, aEvent.cancelable,
|
||||
this.iframeDoc.defaultView, aEvent.detail, aEvent.screenX,
|
||||
aEvent.screenY, x, y, aEvent.ctrlKey, aEvent.altKey, aEvent.shiftKey,
|
||||
aEvent.metaKey, aEvent.button, null);
|
||||
element.dispatchEvent(newEvent);
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop inspection when the user clicks on a node.
|
||||
if (InspectorUI.inspecting) {
|
||||
if (aEvent.button == 0) {
|
||||
let win = aEvent.target.ownerDocument.defaultView;
|
||||
InspectorUI.stopInspecting();
|
||||
win.focus();
|
||||
}
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle mousemoves in panel when InspectorUI.inspecting is true.
|
||||
*
|
||||
* @param aEvent
|
||||
* @param nsiDOMEvent aEvent
|
||||
* The MouseEvent triggering the method.
|
||||
*/
|
||||
handleMouseMove: function PanelHighlighter_handleMouseMove(aEvent)
|
||||
handleMouseMove: function IFH_handleMouseMove(aEvent)
|
||||
{
|
||||
if (!InspectorUI.inspecting) {
|
||||
return;
|
||||
}
|
||||
let browserRect = this.browser.getBoundingClientRect();
|
||||
let element = InspectorUI.elementFromPoint(this.win.document,
|
||||
aEvent.clientX - browserRect.left, aEvent.clientY - browserRect.top);
|
||||
|
||||
let element = InspectorUI.elementFromPoint(aEvent.target.ownerDocument,
|
||||
aEvent.clientX, aEvent.clientY);
|
||||
if (element && element != this.node) {
|
||||
InspectorUI.inspectNode(element);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle MozMousePixelScroll in panel when InspectorUI.inspecting is true.
|
||||
* Handle window resize events.
|
||||
*/
|
||||
handleResize: function IFH_handleResize()
|
||||
{
|
||||
let style = this.iframeContainer.style;
|
||||
if (this.win.scrollMaxY && this.win.scrollbars.visible) {
|
||||
style.paddingRight = this.getScrollbarWidth() + "px";
|
||||
} else {
|
||||
style.paddingRight = 0;
|
||||
}
|
||||
if (this.win.scrollMaxX && this.win.scrollbars.visible) {
|
||||
style.paddingBottom = this.getScrollbarWidth() + "px";
|
||||
} else {
|
||||
style.paddingBottom = 0;
|
||||
}
|
||||
|
||||
this.highlight();
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine the scrollbar width in the current document.
|
||||
*
|
||||
* @param aEvent
|
||||
* The onMozMousePixelScrollEvent triggering the method.
|
||||
* @returns number
|
||||
* The scrollbar width in pixels.
|
||||
*/
|
||||
getScrollbarWidth: function IFH_getScrollbarWidth()
|
||||
{
|
||||
if (this._scrollbarWidth) {
|
||||
return this._scrollbarWidth;
|
||||
}
|
||||
|
||||
let hbox = document.createElement("hbox");
|
||||
hbox.setAttribute("style", "height: 0%; overflow: hidden");
|
||||
|
||||
let scrollbar = document.createElement("scrollbar");
|
||||
scrollbar.setAttribute("orient", "vertical");
|
||||
hbox.appendChild(scrollbar);
|
||||
|
||||
document.documentElement.appendChild(hbox);
|
||||
this._scrollbarWidth = scrollbar.clientWidth;
|
||||
document.documentElement.removeChild(hbox);
|
||||
|
||||
return this._scrollbarWidth;
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper to listen for an event only once.
|
||||
*
|
||||
* @param nsIDOMEventTarget aTarget
|
||||
* The DOM event target you want to add an event listener to.
|
||||
* @param string aName
|
||||
* The event name you want to listen for.
|
||||
* @param function aCallback
|
||||
* The function you want to execute once for the given event.
|
||||
* @param boolean aCapturing
|
||||
* Tells if you want to use capture for the event listener.
|
||||
* @returns void
|
||||
*/
|
||||
handlePixelScroll: function PanelHighlighter_handlePixelScroll(aEvent) {
|
||||
if (!InspectorUI.inspecting) {
|
||||
return;
|
||||
}
|
||||
let browserRect = this.browser.getBoundingClientRect();
|
||||
let element = InspectorUI.elementFromPoint(this.win.document,
|
||||
aEvent.clientX - browserRect.left, aEvent.clientY - browserRect.top);
|
||||
let win = element.ownerDocument.defaultView;
|
||||
|
||||
if (aEvent.axis == aEvent.HORIZONTAL_AXIS) {
|
||||
win.scrollBy(aEvent.detail, 0);
|
||||
} else {
|
||||
win.scrollBy(0, aEvent.detail);
|
||||
}
|
||||
}
|
||||
listenOnce: function IFH_listenOnce(aTarget, aName, aCallback, aCapturing)
|
||||
{
|
||||
aTarget.addEventListener(aName, function listenOnce_handler(aEvent) {
|
||||
aTarget.removeEventListener(aName, listenOnce_handler, aCapturing);
|
||||
aCallback.call(this, aEvent);
|
||||
}, aCapturing);
|
||||
},
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -332,7 +549,6 @@ PanelHighlighter.prototype = {
|
||||
*/
|
||||
var InspectorUI = {
|
||||
browser: null,
|
||||
selectEventsSuppressed: false,
|
||||
showTextNodesWithWhitespace: false,
|
||||
inspecting: false,
|
||||
treeLoaded: false,
|
||||
@ -395,16 +611,8 @@ var InspectorUI = {
|
||||
this.ioBox.createObjectBox(this.win.document.documentElement);
|
||||
this.treeLoaded = true;
|
||||
|
||||
// setup highlighter and start inspecting
|
||||
// initialize the highlighter
|
||||
this.initializeHighlighter();
|
||||
|
||||
// Setup the InspectorStore or restore state
|
||||
this.initializeStore();
|
||||
|
||||
if (InspectorStore.getValue(this.winID, "inspecting"))
|
||||
this.startInspecting();
|
||||
|
||||
this.notifyReady();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -584,11 +792,9 @@ var InspectorUI = {
|
||||
this.domplateUtils.setDOM(window);
|
||||
}
|
||||
|
||||
// open inspector UI
|
||||
this.openTreePanel();
|
||||
|
||||
this.win.document.addEventListener("scroll", this, false);
|
||||
this.win.addEventListener("resize", this, false);
|
||||
this.browser.addEventListener("scroll", this, true);
|
||||
this.inspectCmd.setAttribute("checked", true);
|
||||
},
|
||||
|
||||
@ -597,7 +803,9 @@ var InspectorUI = {
|
||||
*/
|
||||
initializeHighlighter: function IUI_initializeHighlighter()
|
||||
{
|
||||
this.highlighter = new PanelHighlighter(this.browser);
|
||||
Services.obs.addObserver(this.highlighterReady,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTER_READY, false);
|
||||
this.highlighter = new IFrameHighlighter(this.browser);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -658,11 +866,11 @@ var InspectorUI = {
|
||||
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
|
||||
}
|
||||
|
||||
this.win.document.removeEventListener("scroll", this, false);
|
||||
this.win.removeEventListener("resize", this, false);
|
||||
this.browser.removeEventListener("scroll", this, true);
|
||||
this.stopInspecting();
|
||||
if (this.highlighter && this.highlighter.isHighlighting) {
|
||||
this.highlighter.unhighlight();
|
||||
if (this.highlighter) {
|
||||
this.highlighter.destroy();
|
||||
this.highlighter = null;
|
||||
}
|
||||
|
||||
if (this.treePanelDiv) {
|
||||
@ -692,7 +900,7 @@ var InspectorUI = {
|
||||
|
||||
this.treePanel.addEventListener("popuphidden", function treePanelHidden() {
|
||||
InspectorUI.closing = false;
|
||||
Services.obs.notifyObservers(null, "inspector-closed", null);
|
||||
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.CLOSED, null);
|
||||
}, false);
|
||||
|
||||
this.treePanel.hidePopup();
|
||||
@ -715,12 +923,16 @@ var InspectorUI = {
|
||||
*/
|
||||
stopInspecting: function IUI_stopInspecting()
|
||||
{
|
||||
if (!this.inspecting)
|
||||
if (!this.inspecting) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.detachPageListeners();
|
||||
this.inspecting = false;
|
||||
if (this.highlighter.node) {
|
||||
this.select(this.highlighter.node, true, true);
|
||||
} else {
|
||||
this.select(null, true, true);
|
||||
}
|
||||
},
|
||||
|
||||
@ -740,11 +952,10 @@ var InspectorUI = {
|
||||
|
||||
if (forceUpdate || aNode != this.selection) {
|
||||
this.selection = aNode;
|
||||
let box = this.ioBox.createObjectBox(this.selection);
|
||||
if (!this.inspecting) {
|
||||
this.highlighter.highlightNode(this.selection);
|
||||
}
|
||||
this.ioBox.select(aNode, true, true, aScroll);
|
||||
this.ioBox.select(this.selection, true, true, aScroll);
|
||||
}
|
||||
},
|
||||
|
||||
@ -753,7 +964,22 @@ var InspectorUI = {
|
||||
|
||||
notifyReady: function IUI_notifyReady()
|
||||
{
|
||||
Services.obs.notifyObservers(null, "inspector-opened", null);
|
||||
// Setup the InspectorStore or restore state
|
||||
this.initializeStore();
|
||||
|
||||
if (InspectorStore.getValue(this.winID, "inspecting")) {
|
||||
this.startInspecting();
|
||||
}
|
||||
|
||||
this.win.focus();
|
||||
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.OPENED, null);
|
||||
},
|
||||
|
||||
highlighterReady: function IUI_highlighterReady()
|
||||
{
|
||||
Services.obs.removeObserver(InspectorUI.highlighterReady,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTER_READY, false);
|
||||
InspectorUI.notifyReady();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -780,9 +1006,10 @@ var InspectorUI = {
|
||||
if (inspectorClosed && this.closing) {
|
||||
Services.obs.addObserver(function reopenInspectorForTab() {
|
||||
Services.obs.removeObserver(reopenInspectorForTab,
|
||||
"inspector-closed", false);
|
||||
INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
|
||||
InspectorUI.openInspectorUI();
|
||||
}, "inspector-closed", false);
|
||||
}, INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
} else {
|
||||
this.openInspectorUI();
|
||||
}
|
||||
@ -814,22 +1041,15 @@ var InspectorUI = {
|
||||
switch (event.keyCode) {
|
||||
case KeyEvent.DOM_VK_RETURN:
|
||||
case KeyEvent.DOM_VK_ESCAPE:
|
||||
this.stopInspecting();
|
||||
if (this.inspecting) {
|
||||
this.stopInspecting();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "mousemove":
|
||||
let element = this.elementFromPoint(event.target.ownerDocument,
|
||||
event.clientX, event.clientY);
|
||||
if (element && element != this.node) {
|
||||
this.inspectNode(element);
|
||||
}
|
||||
break;
|
||||
case "click":
|
||||
this.stopInspecting();
|
||||
break;
|
||||
case "scroll":
|
||||
case "resize":
|
||||
this.highlighter.highlight();
|
||||
break;
|
||||
}
|
||||
@ -865,9 +1085,8 @@ var InspectorUI = {
|
||||
*/
|
||||
attachPageListeners: function IUI_attachPageListeners()
|
||||
{
|
||||
this.win.addEventListener("keypress", this, true);
|
||||
this.browser.addEventListener("mousemove", this, true);
|
||||
this.browser.addEventListener("click", this, true);
|
||||
this.browser.addEventListener("keypress", this, true);
|
||||
this.highlighter.attachInspectListeners();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -876,9 +1095,8 @@ var InspectorUI = {
|
||||
*/
|
||||
detachPageListeners: function IUI_detachPageListeners()
|
||||
{
|
||||
this.win.removeEventListener("keypress", this, true);
|
||||
this.browser.removeEventListener("mousemove", this, true);
|
||||
this.browser.removeEventListener("click", this, true);
|
||||
this.browser.removeEventListener("keypress", this, true);
|
||||
this.highlighter.detachInspectListeners();
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@ -893,10 +1111,8 @@ var InspectorUI = {
|
||||
*/
|
||||
inspectNode: function IUI_inspectNode(aNode)
|
||||
{
|
||||
this.highlighter.highlightNode(aNode);
|
||||
this.selectEventsSuppressed = true;
|
||||
this.select(aNode, true, true);
|
||||
this.selectEventsSuppressed = false;
|
||||
this.highlighter.highlightNode(aNode);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -125,7 +125,7 @@ nsContextMenu.prototype = {
|
||||
} catch (ex) {}
|
||||
}
|
||||
// Check if this could be a valid url, just missing the protocol.
|
||||
else if (/^(?:\w+\.)+\D\S*$/.test(linkText)) {
|
||||
else if (/^(?:[a-z\d-]+\.)+[a-z]+$/i.test(linkText)) {
|
||||
// Now let's see if this is an intentional link selection. Our guess is
|
||||
// based on whether the selection begins/ends with whitespace or is
|
||||
// preceded/followed by a non-word character.
|
||||
|
@ -64,6 +64,9 @@ const SCRATCHPAD_L10N = "chrome://browser/locale/scratchpad.properties";
|
||||
const SCRATCHPAD_WINDOW_FEATURES = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
|
||||
const DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
|
||||
|
||||
const PREF_TABSIZE = "devtools.editor.tabsize";
|
||||
const PREF_EXPANDTAB = "devtools.editor.expandtab";
|
||||
|
||||
/**
|
||||
* The scratchpad object handles the Scratchpad window functionality.
|
||||
*/
|
||||
@ -628,7 +631,53 @@ var Scratchpad = {
|
||||
errorConsoleCommand.removeAttribute("disabled");
|
||||
chromeContextCommand.removeAttribute("disabled");
|
||||
}
|
||||
|
||||
let tabsize = Services.prefs.getIntPref(PREF_TABSIZE);
|
||||
if (tabsize < 1) {
|
||||
// tabsize is invalid, clear back to the default value.
|
||||
Services.prefs.clearUserPref(PREF_TABSIZE);
|
||||
tabsize = Services.prefs.getIntPref(PREF_TABSIZE);
|
||||
}
|
||||
|
||||
let expandtab = Services.prefs.getBoolPref(PREF_EXPANDTAB);
|
||||
this._tabCharacter = expandtab ? (new Array(tabsize + 1)).join(" ") : "\t";
|
||||
this.textbox.style.MozTabSize = tabsize;
|
||||
|
||||
this.insertIntro();
|
||||
|
||||
// Make the Tab key work.
|
||||
this.textbox.addEventListener("keypress", this.onKeypress.bind(this), false);
|
||||
|
||||
this.textbox.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* The textbox keypress event handler which allows users to indent code using
|
||||
* the Tab key.
|
||||
*
|
||||
* @param nsIDOMEvent aEvent
|
||||
*/
|
||||
onKeypress: function SP_onKeypress(aEvent)
|
||||
{
|
||||
if (aEvent.keyCode == aEvent.DOM_VK_TAB) {
|
||||
this.insertTextAtCaret(this._tabCharacter);
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert text at the current caret location.
|
||||
*
|
||||
* @param string aText
|
||||
*/
|
||||
insertTextAtCaret: function SP_insertTextAtCaret(aText)
|
||||
{
|
||||
let firstPiece = this.textbox.value.substring(0, this.textbox.selectionStart);
|
||||
let lastPiece = this.textbox.value.substring(this.textbox.selectionEnd);
|
||||
this.textbox.value = firstPiece + aText + lastPiece;
|
||||
|
||||
let newCaretPosition = firstPiece.length + aText.length;
|
||||
this.selectRange(newCaretPosition, newCaretPosition);
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -554,8 +554,7 @@ var gSyncSetup = {
|
||||
else
|
||||
gSyncUtils.openAddedClientFirstrun();
|
||||
}
|
||||
|
||||
Weave.Service.syncOnIdle(1);
|
||||
Weave.Utils.nextTick(Weave.Service.sync, Weave.Service);
|
||||
},
|
||||
|
||||
onWizardCancel: function () {
|
||||
|
@ -1178,7 +1178,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
||||
|
||||
let targetIndex = xulTab._tPos;
|
||||
|
||||
$icon.remove();
|
||||
$icon.remove({ preserveEventHandlers: true });
|
||||
if (targetIndex < (length - 1))
|
||||
self.$appTabTray[0].insertBefore(
|
||||
icon,
|
||||
|
@ -336,7 +336,9 @@ iQClass.prototype = {
|
||||
// ----------
|
||||
// Function: remove
|
||||
// Removes the receiver from the DOM.
|
||||
remove: function iQClass_remove() {
|
||||
remove: function iQClass_remove(options) {
|
||||
if (!options || !options.preserveEventHandlers)
|
||||
this.unbindAll();
|
||||
for (let i = 0; this[i] != null; i++) {
|
||||
let elem = this[i];
|
||||
if (elem.parentNode) {
|
||||
@ -353,6 +355,7 @@ iQClass.prototype = {
|
||||
for (let i = 0; this[i] != null; i++) {
|
||||
let elem = this[i];
|
||||
while (elem.firstChild) {
|
||||
iQ(elem.firstChild).unbindAll();
|
||||
elem.removeChild(elem.firstChild);
|
||||
}
|
||||
}
|
||||
@ -746,6 +749,28 @@ iQClass.prototype = {
|
||||
elem.removeEventListener(type, handler, false);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: unbindAll
|
||||
// Unbinds all event handlers.
|
||||
unbindAll: function iQClass_unbindAll() {
|
||||
for (let i = 0; this[i] != null; i++) {
|
||||
let elem = this[i];
|
||||
|
||||
for (let j = 0; j < elem.childElementCount; j++)
|
||||
iQ(elem.children[j]).unbindAll();
|
||||
|
||||
if (!elem.iQEventData)
|
||||
continue;
|
||||
|
||||
for (let type in elem.iQEventData) {
|
||||
while (elem.iQEventData[type].length)
|
||||
this.unbind(type, elem.iQEventData[type][0].original);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
@ -40,7 +40,10 @@ srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = browser/base/content/test
|
||||
|
||||
DIRS += tabview
|
||||
DIRS += \
|
||||
tabview \
|
||||
inspector \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@ -184,16 +187,6 @@ _BROWSER_FILES = \
|
||||
browser_gestureSupport.js \
|
||||
browser_getshortcutoruri.js \
|
||||
browser_hide_removing.js \
|
||||
browser_inspector_initialization.js \
|
||||
browser_inspector_treeSelection.js \
|
||||
browser_inspector_highlighter.js \
|
||||
browser_inspector_iframeTest.js \
|
||||
browser_inspector_scrolling.js \
|
||||
browser_inspector_store.js \
|
||||
browser_inspector_tab_switch.js \
|
||||
browser_inspector_treePanel_output.js \
|
||||
browser_inspector_treePanel_input.html \
|
||||
browser_inspector_treePanel_result.html \
|
||||
browser_scratchpad_initialization.js \
|
||||
browser_scratchpad_contexts.js \
|
||||
browser_scratchpad_tab_switch.js \
|
||||
@ -202,6 +195,7 @@ _BROWSER_FILES = \
|
||||
browser_scratchpad_files.js \
|
||||
browser_scratchpad_ui.js \
|
||||
browser_scratchpad_bug_646070_chrome_context_pref.js \
|
||||
browser_scratchpad_bug_660560_tab.js \
|
||||
browser_overflowScroll.js \
|
||||
browser_locationBarExternalLoad.js \
|
||||
browser_pageInfo.js \
|
||||
@ -226,6 +220,7 @@ _BROWSER_FILES = \
|
||||
browser_tabfocus.js \
|
||||
browser_tabs_isActive.js \
|
||||
browser_tabs_owner.js \
|
||||
browser_urlbarTrimURLs.js \
|
||||
browser_urlHighlight.js \
|
||||
browser_visibleFindSelection.js \
|
||||
browser_visibleTabs.js \
|
||||
|
@ -149,7 +149,7 @@ function test() {
|
||||
|
||||
let tab_A2 = gBrowser.addTab("http://example.com");
|
||||
tab_A2.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||
tab_A2.removeEventListener("load", arguments.callee, true);
|
||||
tab_A2.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
gBrowser.selectedTab = tab_A2;
|
||||
is(getPriority(tab_A1), Ci.nsISupportsPriority.PRIORITY_LOWEST - PRIORITY_DELTA,
|
||||
"Can adjust priority beyond 'lowest'");
|
||||
|
@ -46,8 +46,6 @@ function test() {
|
||||
partialURLTab = gBrowser.addTab();
|
||||
testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
|
||||
|
||||
testPartialURL = testURL.substr(0, (testURL.length - charsToDelete));
|
||||
|
||||
function cleanUp() {
|
||||
gBrowser.removeTab(fullURLTab);
|
||||
gBrowser.removeTab(partialURLTab);
|
||||
@ -135,6 +133,9 @@ function test() {
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
testURL = gURLBar.trimValue(testURL);
|
||||
testPartialURL = testURL.substr(0, (testURL.length - charsToDelete));
|
||||
|
||||
// prepare the three tabs required by this test
|
||||
prepareFullURLTab(function () {
|
||||
preparePartialURLTab(function () {
|
||||
|
@ -26,25 +26,22 @@ function next() {
|
||||
|
||||
function detach() {
|
||||
var win = gBrowser.replaceTabWithWindow(tab);
|
||||
win.addEventListener("load", function () {
|
||||
win.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
var _delayedStartup = win.delayedStartup;
|
||||
win.delayedStartup = function delayedStartup() {
|
||||
_delayedStartup.apply(win, arguments);
|
||||
win.delayedStartup = _delayedStartup;
|
||||
Services.obs.addObserver(function (subject, topic, data) {
|
||||
if (subject != win)
|
||||
return;
|
||||
Services.obs.removeObserver(arguments.callee, topic);
|
||||
|
||||
is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
|
||||
is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
|
||||
is(win.gURLBar.value, "", uri + ": urlbar is empty");
|
||||
ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
|
||||
is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
|
||||
is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
|
||||
is(win.gURLBar.value, "", uri + ": urlbar is empty");
|
||||
ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
|
||||
|
||||
win.close();
|
||||
if (uris.length)
|
||||
next();
|
||||
else
|
||||
executeSoon(finish);
|
||||
};
|
||||
}, false);
|
||||
win.close();
|
||||
if (uris.length)
|
||||
next();
|
||||
else
|
||||
executeSoon(finish);
|
||||
}, "browser-delayed-startup-finished", false);
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
let testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
|
||||
let testActionURL = "moz-action:switchtab," + testURL;
|
||||
testURL = gURLBar.trimValue(testURL);
|
||||
let testTab;
|
||||
|
||||
function runNextTest() {
|
||||
|
@ -1,5 +1,10 @@
|
||||
let doc, range, selection;
|
||||
function setSelection(el1, el2, index1, index2) {
|
||||
while (el1.nodeType != Node.TEXT_NODE)
|
||||
el1 = el1.firstChild;
|
||||
while (el2.nodeType != Node.TEXT_NODE)
|
||||
el2 = el2.firstChild;
|
||||
|
||||
selection.removeAllRanges();
|
||||
range.setStart(el1, index1);
|
||||
range.setEnd(el2, index2);
|
||||
@ -82,6 +87,14 @@ function runSelectionTests() {
|
||||
testExpected(false, "Link options should show for triple-click selections");
|
||||
selection.selectAllChildren(span4);
|
||||
testLinkExpected("http://www.example.com/", "Linkified text should open the correct link", span4.firstChild);
|
||||
|
||||
mainDiv.innerHTML = "(open-suse.ru)";
|
||||
setSelection(mainDiv, mainDiv, 1, 13);
|
||||
testExpected(false, "Link options should show for open-suse.ru");
|
||||
testLinkExpected("http://open-suse.ru/", "Linkified text should open the correct link");
|
||||
setSelection(mainDiv, mainDiv, 1, 14);
|
||||
testExpected(true, "Link options should not show for 'open-suse.ru)'");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
@ -98,5 +111,5 @@ function test() {
|
||||
}, true);
|
||||
|
||||
content.location =
|
||||
"data:text/html,Test For Non-Hyperlinked url selection";
|
||||
"data:text/html;charset=UTF-8,Test For Non-Hyperlinked url selection";
|
||||
}
|
||||
|
116
browser/base/content/test/browser_scratchpad_bug_660560_tab.js
Normal file
116
browser/base/content/test/browser_scratchpad_bug_660560_tab.js
Normal file
@ -0,0 +1,116 @@
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Reference to the Scratchpad chrome window object.
|
||||
let gScratchpadWindow;
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
ok(window.Scratchpad, "Scratchpad variable exists");
|
||||
|
||||
Services.prefs.setIntPref("devtools.editor.tabsize", 5);
|
||||
|
||||
gScratchpadWindow = Scratchpad.openScratchpad();
|
||||
gScratchpadWindow.addEventListener("load", runTests, false);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,Scratchpad test for the Tab key, bug 660560";
|
||||
}
|
||||
|
||||
function runTests()
|
||||
{
|
||||
gScratchpadWindow.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
let sp = gScratchpadWindow.Scratchpad;
|
||||
ok(sp, "Scratchpad object exists in new window");
|
||||
|
||||
is(gScratchpadWindow.document.activeElement, sp.textbox.inputField,
|
||||
"The textbox has focus");
|
||||
|
||||
is(sp.textbox.style.MozTabSize, 5, "-moz-tab-size is correct");
|
||||
|
||||
sp.textbox.value = "window.foo;";
|
||||
sp.selectRange(1, 3);
|
||||
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, gScratchpadWindow);
|
||||
|
||||
is(sp.textbox.value, "w dow.foo;",
|
||||
"Tab key added 5 spaces");
|
||||
|
||||
is(sp.textbox.selectionStart, 6, "caret location is correct");
|
||||
|
||||
is(sp.textbox.selectionStart, sp.textbox.selectionEnd,
|
||||
"caret location is correct, confirmed");
|
||||
|
||||
// Test the new insertTextAtCaret() method.
|
||||
|
||||
sp.insertTextAtCaret("omg");
|
||||
|
||||
is(sp.textbox.value, "w omgdow.foo;", "insertTextAtCaret() works");
|
||||
|
||||
is(sp.textbox.selectionStart, 9, "caret location is correct after update");
|
||||
|
||||
is(sp.textbox.selectionStart, sp.textbox.selectionEnd,
|
||||
"caret location is correct, confirmed");
|
||||
|
||||
gScratchpadWindow.close();
|
||||
|
||||
Services.prefs.setIntPref("devtools.editor.tabsize", 6);
|
||||
Services.prefs.setBoolPref("devtools.editor.expandtab", false);
|
||||
gScratchpadWindow = Scratchpad.openScratchpad();
|
||||
gScratchpadWindow.addEventListener("load", runTests2, false);
|
||||
}
|
||||
|
||||
function runTests2()
|
||||
{
|
||||
gScratchpadWindow.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
let sp = gScratchpadWindow.Scratchpad;
|
||||
|
||||
is(sp.textbox.style.MozTabSize, 6, "-moz-tab-size is correct");
|
||||
|
||||
sp.textbox.value = "window.foo;";
|
||||
sp.selectRange(1, 3);
|
||||
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, gScratchpadWindow);
|
||||
|
||||
is(sp.textbox.value, "w\tdow.foo;", "Tab key added the tab character");
|
||||
|
||||
is(sp.textbox.selectionStart, 2, "caret location is correct");
|
||||
|
||||
is(sp.textbox.selectionStart, sp.textbox.selectionEnd,
|
||||
"caret location is correct, confirmed");
|
||||
|
||||
gScratchpadWindow.close();
|
||||
|
||||
// check with an invalid tabsize value.
|
||||
Services.prefs.setIntPref("devtools.editor.tabsize", 0);
|
||||
Services.prefs.setBoolPref("devtools.editor.expandtab", true);
|
||||
gScratchpadWindow = Scratchpad.openScratchpad();
|
||||
gScratchpadWindow.addEventListener("load", runTests3, false);
|
||||
}
|
||||
|
||||
function runTests3()
|
||||
{
|
||||
gScratchpadWindow.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
let sp = gScratchpadWindow.Scratchpad;
|
||||
|
||||
is(sp.textbox.style.MozTabSize, 4, "-moz-tab-size is correct");
|
||||
|
||||
Services.prefs.clearUserPref("devtools.editor.tabsize");
|
||||
Services.prefs.clearUserPref("devtools.editor.expandtab");
|
||||
|
||||
gScratchpadWindow.close();
|
||||
gScratchpadWindow = null;
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
function testVal(aExpected) {
|
||||
gURLBar.value = aExpected.replace(/[<>]/g, "");
|
||||
|
||||
@ -27,41 +31,79 @@ function test() {
|
||||
|
||||
gURLBar.focus();
|
||||
|
||||
testVal("http://mozilla.org/");
|
||||
testVal("https://mozilla.org");
|
||||
|
||||
gBrowser.selectedBrowser.focus();
|
||||
|
||||
testVal("<http://>mozilla.org");
|
||||
testVal("<http://>mozilla.org</>");
|
||||
testVal("<http://>mözilla.org</>");
|
||||
testVal("<http://>mozilla.imaginatory</>");
|
||||
testVal("<http://www.>mozilla.org</>");
|
||||
testVal("<http://sub.>mozilla.org</>");
|
||||
testVal("<http://sub1.sub2.sub3.>mozilla.org</>");
|
||||
testVal("<http://ftp.>mozilla.org</>");
|
||||
testVal("<ftp://ftp.>mozilla.org</>");
|
||||
testVal("<https://>mozilla.org");
|
||||
testVal("<https://>mözilla.org");
|
||||
testVal("<https://>mozilla.imaginatory");
|
||||
|
||||
testVal("<https://sub.>mozilla.org</>");
|
||||
testVal("<https://sub1.sub2.sub3.>mozilla.org</>");
|
||||
testVal("<https://user:pass@sub1.sub2.sub3.>mozilla.org</>");
|
||||
testVal("<https://user:pass@>mozilla.org</>");
|
||||
testVal("<https://www.>mozilla.org");
|
||||
testVal("<https://sub.>mozilla.org");
|
||||
testVal("<https://sub1.sub2.sub3.>mozilla.org");
|
||||
testVal("<www.>mozilla.org");
|
||||
testVal("<sub.>mozilla.org");
|
||||
testVal("<sub1.sub2.sub3.>mozilla.org");
|
||||
|
||||
testVal("<http://>mozilla.org</file.ext>");
|
||||
testVal("<http://>mozilla.org</sub/file.ext>");
|
||||
testVal("<http://>mozilla.org</sub/file.ext?foo>");
|
||||
testVal("<http://>mozilla.org</sub/file.ext?foo&bar>");
|
||||
testVal("<http://>mozilla.org</sub/file.ext?foo&bar#top>");
|
||||
testVal("<http://ftp.>mozilla.org");
|
||||
testVal("<ftp://ftp.>mozilla.org");
|
||||
|
||||
testVal("<http://sub.>mozilla.org<:666/file.ext>");
|
||||
testVal("<https://sub.>mozilla.org");
|
||||
testVal("<https://sub1.sub2.sub3.>mozilla.org");
|
||||
testVal("<https://user:pass@sub1.sub2.sub3.>mozilla.org");
|
||||
testVal("<https://user:pass@>mozilla.org");
|
||||
|
||||
testVal("<http://>[fe80::222:19ff:fe11:8c76]</file.ext>");
|
||||
testVal("<http://user:pass@>[fe80::222:19ff:fe11:8c76]<:666/file.ext>");
|
||||
testVal("<https://>mozilla.org</file.ext>");
|
||||
testVal("<https://>mozilla.org</sub/file.ext>");
|
||||
testVal("<https://>mozilla.org</sub/file.ext?foo>");
|
||||
testVal("<https://>mozilla.org</sub/file.ext?foo&bar>");
|
||||
testVal("<https://>mozilla.org</sub/file.ext?foo&bar#top>");
|
||||
testVal("<https://>mozilla.org</sub/file.ext?foo&bar#top>");
|
||||
|
||||
testVal("<https://sub.>mozilla.org<:666/file.ext>");
|
||||
|
||||
let IPs = ["192.168.1.1",
|
||||
"[::]",
|
||||
"[::1]",
|
||||
"[1::]",
|
||||
"[::]",
|
||||
"[::1]",
|
||||
"[1::]",
|
||||
"[1:2:3:4:5:6:7::]",
|
||||
"[::1:2:3:4:5:6:7]",
|
||||
"[1:2:a:B:c:D:e:F]",
|
||||
"[1::8]",
|
||||
"[1:2::8]",
|
||||
"[fe80::222:19ff:fe11:8c76]",
|
||||
"[0000:0123:4567:89AB:CDEF:abcd:ef00:0000]",
|
||||
"[::192.168.1.1]",
|
||||
"[1::0.0.0.0]",
|
||||
"[1:2::255.255.255.255]",
|
||||
"[1:2:3::255.255.255.255]",
|
||||
"[1:2:3:4::255.255.255.255]",
|
||||
"[1:2:3:4:5::255.255.255.255]",
|
||||
"[1:2:3:4:5:6:255.255.255.255]"];
|
||||
IPs.forEach(function (IP) {
|
||||
testVal(IP);
|
||||
testVal(IP + "</file.ext>");
|
||||
testVal("<https://>" + IP);
|
||||
testVal("<https://>" + IP + "</file.ext>");
|
||||
testVal("<https://user:pass@>" + IP + "<:666/file.ext>");
|
||||
testVal("<http://user:pass@>" + IP + "<:666/file.ext>");
|
||||
});
|
||||
|
||||
testVal("mailto:admin@mozilla.org");
|
||||
testVal("gopher://mozilla.org/");
|
||||
testVal("about:config");
|
||||
testVal("jar:http://mozilla.org/example.jar!/");
|
||||
testVal("view-source:http://mozilla.org/");
|
||||
testVal("foo9://mozilla.org/");
|
||||
testVal("foo+://mozilla.org/");
|
||||
testVal("foo.://mozilla.org/");
|
||||
testVal("foo-://mozilla.org/");
|
||||
|
||||
Services.prefs.setBoolPref(prefname, false);
|
||||
|
||||
testVal("http://mozilla.org/");
|
||||
testVal("https://mozilla.org");
|
||||
}
|
||||
|
81
browser/base/content/test/browser_urlbarTrimURLs.js
Normal file
81
browser/base/content/test/browser_urlbarTrimURLs.js
Normal file
@ -0,0 +1,81 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
function testVal(originalValue, targetValue) {
|
||||
gURLBar.value = originalValue;
|
||||
is(gURLBar.value, targetValue || originalValue, "original value: " + originalValue);
|
||||
}
|
||||
|
||||
function test() {
|
||||
const prefname = "browser.urlbar.trimURLs";
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gBrowser.removeCurrentTab();
|
||||
Services.prefs.clearUserPref(prefname);
|
||||
URLBarSetURI();
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref(prefname, true);
|
||||
|
||||
testVal("http://mozilla.org/", "mozilla.org");
|
||||
testVal("https://mozilla.org/", "https://mozilla.org");
|
||||
testVal("http://mözilla.org/", "mözilla.org");
|
||||
testVal("http://mozilla.imaginatory/", "mozilla.imaginatory");
|
||||
testVal("http://www.mozilla.org/", "www.mozilla.org");
|
||||
testVal("http://sub.mozilla.org/", "sub.mozilla.org");
|
||||
testVal("http://sub1.sub2.sub3.mozilla.org/", "sub1.sub2.sub3.mozilla.org");
|
||||
testVal("http://mozilla.org/file.ext", "mozilla.org/file.ext");
|
||||
testVal("http://mozilla.org/sub/", "mozilla.org/sub/");
|
||||
|
||||
testVal("http://ftp.mozilla.org/", "http://ftp.mozilla.org");
|
||||
testVal("ftp://ftp.mozilla.org/", "ftp://ftp.mozilla.org");
|
||||
|
||||
testVal("https://user:pass@mozilla.org/", "https://user:pass@mozilla.org");
|
||||
testVal("http://user:pass@mozilla.org/", "http://user:pass@mozilla.org");
|
||||
testVal("http://sub.mozilla.org:666/", "sub.mozilla.org:666");
|
||||
|
||||
testVal("https://[fe80::222:19ff:fe11:8c76]/file.ext");
|
||||
testVal("http://[fe80::222:19ff:fe11:8c76]/", "[fe80::222:19ff:fe11:8c76]");
|
||||
testVal("https://user:pass@[fe80::222:19ff:fe11:8c76]:666/file.ext");
|
||||
testVal("http://user:pass@[fe80::222:19ff:fe11:8c76]:666/file.ext");
|
||||
|
||||
testVal("mailto:admin@mozilla.org");
|
||||
testVal("gopher://mozilla.org/");
|
||||
testVal("about:config");
|
||||
testVal("jar:http://mozilla.org/example.jar!/");
|
||||
testVal("view-source:http://mozilla.org/");
|
||||
|
||||
Services.prefs.setBoolPref(prefname, false);
|
||||
|
||||
testVal("http://mozilla.org/");
|
||||
|
||||
Services.prefs.setBoolPref(prefname, true);
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
is(gBrowser.currentURI.spec, "http://example.com/", "expected page should have loaded");
|
||||
|
||||
testCopy("example.com", "http://example.com/", function () {
|
||||
SetPageProxyState("invalid");
|
||||
testCopy("example.com", "example.com", finish);
|
||||
});
|
||||
}, true);
|
||||
|
||||
gBrowser.loadURI("http://example.com/");
|
||||
}
|
||||
|
||||
function testCopy(originalValue, targetValue, cb) {
|
||||
waitForClipboard(targetValue, function () {
|
||||
is(gURLBar.value, originalValue);
|
||||
|
||||
gURLBar.focus();
|
||||
gURLBar.select();
|
||||
goDoCommand("cmd_copy");
|
||||
}, cb, cb);
|
||||
}
|
@ -11,14 +11,14 @@
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Storage code.
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# The Initial Developer of the Original Code is
|
||||
# Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2007
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Brett Wilson <brettw@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"),
|
||||
@ -34,4 +34,27 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
storageWriteError=There was an error writing data to the disk. This error is sometimes caused by a full disk.\n\nPlease restart this application
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = browser/base/content/test/inspector
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_BROWSER_FILES = \
|
||||
browser_inspector_initialization.js \
|
||||
browser_inspector_treeSelection.js \
|
||||
browser_inspector_highlighter.js \
|
||||
browser_inspector_iframeTest.js \
|
||||
browser_inspector_scrolling.js \
|
||||
browser_inspector_store.js \
|
||||
browser_inspector_tab_switch.js \
|
||||
browser_inspector_treePanel_output.js \
|
||||
browser_inspector_treePanel_input.html \
|
||||
browser_inspector_treePanel_result.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
|
@ -22,6 +22,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
* Mihai Sucan <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
|
||||
@ -78,35 +79,40 @@ function setupHighlighterTests()
|
||||
{
|
||||
h1 = doc.querySelectorAll("h1")[0];
|
||||
ok(h1, "we have the header node");
|
||||
Services.obs.addObserver(runSelectionTests, "inspector-opened", false);
|
||||
Services.obs.addObserver(runSelectionTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.toggleInspectorUI();
|
||||
}
|
||||
|
||||
function runSelectionTests()
|
||||
{
|
||||
Services.obs.removeObserver(runSelectionTests, "inspector-opened", false);
|
||||
document.addEventListener("popupshown", performTestComparisons, false);
|
||||
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
|
||||
Services.obs.removeObserver(runSelectionTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
|
||||
executeSoon(function() {
|
||||
Services.obs.addObserver(performTestComparisons,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
|
||||
});
|
||||
}
|
||||
|
||||
function performTestComparisons(evt)
|
||||
{
|
||||
if (evt.target.id != "highlighter-panel")
|
||||
return true;
|
||||
document.removeEventListener("popupshown", performTestComparisons, false);
|
||||
is(h1, InspectorUI.selection, "selection matches node");
|
||||
ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting");
|
||||
is(InspectorUI.highlighter.highlitNode, h1, "highlighter matches selection");
|
||||
Services.obs.removeObserver(performTestComparisons,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
|
||||
Services.obs.addObserver(finishUp, "inspector-closed", false);
|
||||
InspectorUI.closeInspectorUI();
|
||||
InspectorUI.stopInspecting();
|
||||
ok(InspectorUI.highlighter.isHighlighting, "highlighter is highlighting");
|
||||
is(InspectorUI.highlighter.highlitNode, h1, "highlighter matches selection")
|
||||
is(InspectorUI.selection, h1, "selection matches node");
|
||||
is(InspectorUI.selection, InspectorUI.highlighter.highlitNode, "selection matches highlighter");
|
||||
|
||||
doc = h1 = null;
|
||||
executeSoon(finishUp);
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
Services.obs.removeObserver(finishUp, "inspector-closed", false);
|
||||
|
||||
ok(!InspectorUI.highlighter.isHighlighting, "panel is not highlighting");
|
||||
doc = h1 = null;
|
||||
InspectorUI.closeInspectorUI();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
@ -120,7 +126,7 @@ function test()
|
||||
doc = content.document;
|
||||
waitForFocus(createDocument, content);
|
||||
}, true);
|
||||
|
||||
|
||||
content.location = "data:text/html,basic tests for inspector";
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ let div1;
|
||||
let div2;
|
||||
let iframe1;
|
||||
let iframe2;
|
||||
let highlighterFrame;
|
||||
|
||||
function createDocument()
|
||||
{
|
||||
@ -77,67 +78,71 @@ function createDocument()
|
||||
doc.body.appendChild(iframe1);
|
||||
}
|
||||
|
||||
function moveMouseOver(aElement)
|
||||
{
|
||||
EventUtils.synthesizeMouse(aElement, 2, 2, {type: "mousemove"},
|
||||
aElement.ownerDocument.defaultView);
|
||||
}
|
||||
|
||||
function setupIframeTests()
|
||||
{
|
||||
Services.obs.addObserver(runIframeTests, "inspector-opened", false);
|
||||
Services.obs.addObserver(runIframeTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.openInspectorUI();
|
||||
}
|
||||
|
||||
function runIframeTests()
|
||||
{
|
||||
Services.obs.removeObserver(runIframeTests, "inspector-opened", false);
|
||||
document.addEventListener("popupshown", performTestComparisons1, false);
|
||||
EventUtils.synthesizeMouse(div1, 2, 2, {type: "mousemove"},
|
||||
iframe1.contentWindow);
|
||||
Services.obs.removeObserver(runIframeTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
|
||||
Services.obs.addObserver(performTestComparisons1,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
|
||||
highlighterFrame = InspectorUI.highlighter.iframe;
|
||||
executeSoon(moveMouseOver.bind(this, div1));
|
||||
}
|
||||
|
||||
function performTestComparisons1(evt)
|
||||
function performTestComparisons1()
|
||||
{
|
||||
if (evt.target.id != "highlighter-panel") {
|
||||
return true;
|
||||
}
|
||||
|
||||
document.removeEventListener(evt.type, arguments.callee, false);
|
||||
Services.obs.removeObserver(performTestComparisons1,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
Services.obs.addObserver(performTestComparisons2,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
|
||||
is(InspectorUI.selection, div1, "selection matches div1 node");
|
||||
is(InspectorUI.highlighter.highlitNode, div1, "highlighter matches selection");
|
||||
|
||||
document.addEventListener("popupshown", performTestComparisons2, false);
|
||||
|
||||
EventUtils.synthesizeMouse(div2, 2, 2, {type: "mousemove"},
|
||||
iframe2.contentWindow);
|
||||
executeSoon(moveMouseOver.bind(this, div2));
|
||||
}
|
||||
|
||||
function performTestComparisons2(evt)
|
||||
function performTestComparisons2()
|
||||
{
|
||||
if (evt.target.id != "highlighter-panel") {
|
||||
return true;
|
||||
}
|
||||
|
||||
document.removeEventListener(evt.type, arguments.callee, false);
|
||||
Services.obs.removeObserver(performTestComparisons2,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
|
||||
is(InspectorUI.selection, div2, "selection matches div2 node");
|
||||
is(InspectorUI.highlighter.highlitNode, div2, "highlighter matches selection");
|
||||
|
||||
executeSoon(finishUp);
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
InspectorUI.closeInspectorUI();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
doc = content.document;
|
||||
waitForFocus(createDocument, content);
|
||||
gBrowser.selectedBrowser.focus();
|
||||
createDocument();
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,iframe tests for inspector";
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
InspectorUI.closeInspectorUI(true);
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
}
|
||||
|
@ -37,31 +37,41 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
let doc;
|
||||
|
||||
function startInspectorTests()
|
||||
{
|
||||
ok(InspectorUI, "InspectorUI variable exists");
|
||||
Services.obs.addObserver(runInspectorTests, "inspector-opened", false);
|
||||
Services.obs.addObserver(runInspectorTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.toggleInspectorUI();
|
||||
}
|
||||
|
||||
function runInspectorTests()
|
||||
{
|
||||
Services.obs.removeObserver(runInspectorTests, "inspector-opened", false);
|
||||
Services.obs.addObserver(finishInspectorTests, "inspector-closed", false);
|
||||
Services.obs.removeObserver(runInspectorTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
Services.obs.addObserver(finishInspectorTests,
|
||||
INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
|
||||
let iframe = document.getElementById("inspector-tree-iframe");
|
||||
is(InspectorUI.treeIFrame, iframe, "Inspector IFrame matches");
|
||||
ok(InspectorUI.inspecting, "Inspector is highlighting");
|
||||
ok(InspectorUI.inspecting, "Inspector is inspecting");
|
||||
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
|
||||
InspectorUI.closeInspectorUI();
|
||||
ok(InspectorUI.highlighter, "Highlighter is up");
|
||||
|
||||
executeSoon(function() {
|
||||
InspectorUI.closeInspectorUI();
|
||||
});
|
||||
}
|
||||
|
||||
function finishInspectorTests()
|
||||
{
|
||||
Services.obs.removeObserver(finishInspectorTests, "inspector-closed", false);
|
||||
Services.obs.removeObserver(finishInspectorTests,
|
||||
INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
|
||||
ok(!InspectorUI.highlighter, "Highlighter is gone");
|
||||
ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed");
|
||||
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
|
||||
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
@ -72,10 +82,9 @@ function test()
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
doc = content.document;
|
||||
waitForFocus(startInspectorTests, content);
|
||||
}, true);
|
||||
|
||||
|
||||
content.location = "data:text/html,basic tests for inspector";
|
||||
}
|
||||
|
@ -65,34 +65,42 @@ function createDocument()
|
||||
|
||||
function toggleInspector()
|
||||
{
|
||||
Services.obs.addObserver(inspectNode, "inspector-opened", false);
|
||||
Services.obs.addObserver(inspectNode, INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.toggleInspectorUI();
|
||||
}
|
||||
|
||||
function inspectNode()
|
||||
{
|
||||
Services.obs.removeObserver(inspectNode, "inspector-opened", false);
|
||||
document.addEventListener("popupshown", performScrollingTest, false);
|
||||
Services.obs.removeObserver(inspectNode,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
Services.obs.addObserver(performScrollingTest,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
|
||||
InspectorUI.inspectNode(div)
|
||||
executeSoon(function() {
|
||||
InspectorUI.inspectNode(div);
|
||||
});
|
||||
}
|
||||
|
||||
function performScrollingTest(aEvent)
|
||||
function performScrollingTest()
|
||||
{
|
||||
if (aEvent.target.id != "highlighter-panel") {
|
||||
return true;
|
||||
}
|
||||
Services.obs.removeObserver(performScrollingTest,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
|
||||
document.removeEventListener("popupshown", performScrollingTest, false);
|
||||
EventUtils.synthesizeMouseScroll(div, 10, 10,
|
||||
{axis:"vertical", delta:50, type:"MozMousePixelScroll"},
|
||||
iframe.contentWindow);
|
||||
|
||||
EventUtils.synthesizeMouseScroll(aEvent.target, 10, 10,
|
||||
{axis:"vertical", delta:50, type:"MozMousePixelScroll"}, window);
|
||||
gBrowser.selectedBrowser.addEventListener("scroll", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("scroll", arguments.callee,
|
||||
false);
|
||||
|
||||
is(iframe.contentDocument.body.scrollTop, 50, "inspected iframe scrolled");
|
||||
is(iframe.contentDocument.body.scrollTop, 50, "inspected iframe scrolled");
|
||||
|
||||
InspectorUI.closeInspectorUI();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
div = iframe = doc = null;
|
||||
InspectorUI.closeInspectorUI();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}, false);
|
||||
}
|
||||
|
||||
function test()
|
@ -39,7 +39,7 @@
|
||||
|
||||
function test()
|
||||
{
|
||||
ok(InspectorUI, "InspectorUI variable exists");
|
||||
ok(window.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)");
|
@ -45,17 +45,19 @@ let tab1window;
|
||||
|
||||
function inspectorTabOpen1()
|
||||
{
|
||||
ok(InspectorUI, "InspectorUI variable exists");
|
||||
ok(window.InspectorUI, "InspectorUI variable exists");
|
||||
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
|
||||
ok(InspectorStore.isEmpty(), "InspectorStore is empty");
|
||||
|
||||
Services.obs.addObserver(inspectorUIOpen1, "inspector-opened", false);
|
||||
Services.obs.addObserver(inspectorUIOpen1,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.openInspectorUI();
|
||||
}
|
||||
|
||||
function inspectorUIOpen1()
|
||||
{
|
||||
Services.obs.removeObserver(inspectorUIOpen1, "inspector-opened", false);
|
||||
Services.obs.removeObserver(inspectorUIOpen1,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
|
||||
// Make sure the inspector is open.
|
||||
ok(InspectorUI.inspecting, "Inspector is highlighting");
|
||||
@ -90,14 +92,16 @@ function inspectorTabOpen2()
|
||||
|
||||
// Activate the inspector again.
|
||||
executeSoon(function() {
|
||||
Services.obs.addObserver(inspectorUIOpen2, "inspector-opened", false);
|
||||
Services.obs.addObserver(inspectorUIOpen2,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.openInspectorUI();
|
||||
});
|
||||
}
|
||||
|
||||
function inspectorUIOpen2()
|
||||
{
|
||||
Services.obs.removeObserver(inspectorUIOpen2, "inspector-opened", false);
|
||||
Services.obs.removeObserver(inspectorUIOpen2,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
|
||||
// Make sure the inspector is open.
|
||||
ok(InspectorUI.inspecting, "Inspector is highlighting");
|
||||
@ -110,14 +114,16 @@ function inspectorUIOpen2()
|
||||
|
||||
// Switch back to tab 1.
|
||||
executeSoon(function() {
|
||||
Services.obs.addObserver(inspectorFocusTab1, "inspector-opened", false);
|
||||
Services.obs.addObserver(inspectorFocusTab1,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
gBrowser.selectedTab = tab1;
|
||||
});
|
||||
}
|
||||
|
||||
function inspectorFocusTab1()
|
||||
{
|
||||
Services.obs.removeObserver(inspectorFocusTab1, "inspector-opened", false);
|
||||
Services.obs.removeObserver(inspectorFocusTab1,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
|
||||
// Make sure the inspector is still open.
|
||||
ok(InspectorUI.inspecting, "Inspector is highlighting");
|
||||
@ -126,13 +132,15 @@ function inspectorFocusTab1()
|
||||
is(InspectorUI.selection, div, "selection matches the div element");
|
||||
|
||||
// Switch back to tab 2.
|
||||
Services.obs.addObserver(inspectorFocusTab2, "inspector-opened", false);
|
||||
Services.obs.addObserver(inspectorFocusTab2,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
gBrowser.selectedTab = tab2;
|
||||
}
|
||||
|
||||
function inspectorFocusTab2()
|
||||
{
|
||||
Services.obs.removeObserver(inspectorFocusTab2, "inspector-opened", false);
|
||||
Services.obs.removeObserver(inspectorFocusTab2,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
|
||||
// Make sure the inspector is still open.
|
||||
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
|
@ -15,17 +15,17 @@
|
||||
<body arbitrary:attribute="value">
|
||||
<p>Inspector tree panel test.</p>
|
||||
|
||||
<div id="foo" class="foo bar baz" style="border:1px solid red;
|
||||
<div id="foo" class="foo bar baz" style="border:1px solid red;
|
||||
unknownProperty: unknownValue; color: withUnkownValue">
|
||||
<unknownTag unknownAttribute="fooBar">
|
||||
<p unknownAttribute="fooBar" data-test1="value">hello world!</p>
|
||||
</unknownTag>
|
||||
</div>
|
||||
|
||||
<div id="duplicate" id="duplicate" id="different" class="test" class="foo"
|
||||
<div id="duplicate" id="duplicate" id="different" class="test" class="foo"
|
||||
fooBar="baz" fooBar="bazbaz">test</div>
|
||||
|
||||
<iframe src="data:text/html,<div>hello from an iframe!</div>">no
|
||||
<iframe src="data:text/html,<div>hello from an iframe!</div>">no
|
||||
frames!</iframe>
|
||||
|
||||
<!-- hello world from a comment! -->
|
@ -42,8 +42,8 @@ let doc = null;
|
||||
let xhr = null;
|
||||
let expectedResult = "";
|
||||
|
||||
const TEST_URI = "http://mochi.test:8888/browser/browser/base/content/test/browser_inspector_treePanel_input.html";
|
||||
const RESULT_URI = "http://mochi.test:8888/browser/browser/base/content/test/browser_inspector_treePanel_result.html";
|
||||
const TEST_URI = "http://mochi.test:8888/browser/browser/base/content/test/inspector/browser_inspector_treePanel_input.html";
|
||||
const RESULT_URI = "http://mochi.test:8888/browser/browser/base/content/test/inspector/browser_inspector_treePanel_result.html";
|
||||
|
||||
function tabFocused()
|
||||
{
|
||||
@ -63,13 +63,15 @@ function xhr_onReadyStateChange() {
|
||||
expectedResult = xhr.responseText.replace(/^\s+|\s+$/mg, '');
|
||||
xhr = null;
|
||||
|
||||
Services.obs.addObserver(inspectorOpened, "inspector-opened", false);
|
||||
Services.obs.addObserver(inspectorOpened,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.openInspectorUI();
|
||||
}
|
||||
|
||||
function inspectorOpened()
|
||||
{
|
||||
Services.obs.removeObserver(inspectorOpened, "inspector-opened", false);
|
||||
Services.obs.removeObserver(inspectorOpened,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
|
||||
ok(InspectorUI.inspecting, "Inspector is highlighting");
|
||||
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
|
||||
@ -94,13 +96,15 @@ function inspectorOpened()
|
||||
expectedResult, "treePanelDiv.innerHTML is correct");
|
||||
expectedResult = null;
|
||||
|
||||
Services.obs.addObserver(inspectorClosed, "inspector-closed", false);
|
||||
Services.obs.addObserver(inspectorClosed,
|
||||
INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
InspectorUI.closeInspectorUI();
|
||||
}
|
||||
|
||||
function inspectorClosed()
|
||||
{
|
||||
Services.obs.removeObserver(inspectorClosed, "inspector-closed", false);
|
||||
Services.obs.removeObserver(inspectorClosed,
|
||||
INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
|
||||
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
|
||||
ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is not open");
|
||||
@ -118,6 +122,6 @@ function test()
|
||||
doc = content.document;
|
||||
waitForFocus(tabFocused, content);
|
||||
}, true);
|
||||
|
||||
|
||||
content.location = TEST_URI;
|
||||
}
|
@ -59,7 +59,6 @@ function createDocument()
|
||||
div.appendChild(h1);
|
||||
div.appendChild(p1);
|
||||
div.appendChild(p2);
|
||||
// doc.body.addEventListener("DOMSubtreeModified", , false);
|
||||
doc.body.appendChild(div);
|
||||
setupSelectionTests();
|
||||
}
|
||||
@ -68,31 +67,37 @@ function setupSelectionTests()
|
||||
{
|
||||
h1 = doc.querySelectorAll("h1")[0];
|
||||
ok(h1, "we have the header node");
|
||||
Services.obs.addObserver(runSelectionTests, "inspector-opened", false);
|
||||
Services.obs.addObserver(runSelectionTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.openInspectorUI();
|
||||
}
|
||||
|
||||
function runSelectionTests()
|
||||
{
|
||||
Services.obs.removeObserver(runSelectionTests, "inspector-opened", false);
|
||||
InspectorUI.stopInspecting();
|
||||
document.addEventListener("popupshown", performTestComparisons, false);
|
||||
InspectorUI.inspectNode(h1);
|
||||
Services.obs.removeObserver(runSelectionTests,
|
||||
INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
Services.obs.addObserver(performTestComparisons,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
executeSoon(function() {
|
||||
InspectorUI.inspectNode(h1);
|
||||
});
|
||||
}
|
||||
|
||||
function performTestComparisons(evt)
|
||||
{
|
||||
if (evt.target.id != "highlighter-panel")
|
||||
return true;
|
||||
document.removeEventListener("popupshown", performTestComparisons, false);
|
||||
Services.obs.removeObserver(performTestComparisons,
|
||||
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
|
||||
|
||||
is(h1, InspectorUI.selection, "selection matches node");
|
||||
ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting");
|
||||
is(h1, InspectorUI.highlighter.highlitNode, "highlighter highlighting correct node");
|
||||
ok(InspectorUI.highlighter.isHighlighting, "highlighter is highlighting");
|
||||
is(InspectorUI.highlighter.highlitNode, h1, "highlighter highlighting correct node");
|
||||
|
||||
finishUp();
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
InspectorUI.closeInspectorUI();
|
||||
doc = h1 = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
@ -106,7 +111,7 @@ function test()
|
||||
doc = content.document;
|
||||
waitForFocus(createDocument, content);
|
||||
}, true);
|
||||
|
||||
|
||||
content.location = "data:text/html,basic tests for inspector";
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ function test() {
|
||||
|
||||
hideTabView(function () {
|
||||
assertWindowTitle(win, "new-title");
|
||||
waitForFocus(finish);
|
||||
finish();
|
||||
}, win);
|
||||
}, win);
|
||||
};
|
||||
|
@ -293,6 +293,18 @@ function whenWindowStateReady(win, callback) {
|
||||
}, false);
|
||||
}
|
||||
|
||||
// ----------
|
||||
function whenDelayedStartupFinished(win, callback) {
|
||||
let topic = "browser-delayed-startup-finished";
|
||||
Services.obs.addObserver(function onStartup(aSubject) {
|
||||
if (win != aSubject)
|
||||
return;
|
||||
|
||||
Services.obs.removeObserver(onStartup, topic, false);
|
||||
executeSoon(callback);
|
||||
}, topic, false);
|
||||
}
|
||||
|
||||
// ----------
|
||||
function newWindowWithState(state, callback) {
|
||||
const ss = Cc["@mozilla.org/browser/sessionstore;1"]
|
||||
@ -302,12 +314,20 @@ function newWindowWithState(state, callback) {
|
||||
let win = window.openDialog(getBrowserURL(), "_blank", opts);
|
||||
|
||||
whenWindowLoaded(win, function () {
|
||||
whenWindowStateReady(win, function () {
|
||||
afterAllTabsLoaded(check, win);
|
||||
});
|
||||
|
||||
ss.setWindowState(win, JSON.stringify(state), true);
|
||||
whenDelayedStartupFinished(win, check);
|
||||
});
|
||||
|
||||
whenWindowStateReady(win, function () {
|
||||
afterAllTabsLoaded(function () callback(win), win);
|
||||
});
|
||||
|
||||
let numConditions = 2;
|
||||
let check = function () {
|
||||
if (!--numConditions)
|
||||
callback(win);
|
||||
};
|
||||
}
|
||||
|
||||
// ----------
|
||||
|
@ -91,6 +91,7 @@
|
||||
this.completeDefaultIndex = this._prefs.getBoolPref("autoFill");
|
||||
this.timeout = this._prefs.getIntPref("delay");
|
||||
this._formattingEnabled = this._prefs.getBoolPref("formatting.enabled");
|
||||
this._mayTrimURLs = this._prefs.getBoolPref("trimURLs");
|
||||
|
||||
this._urlTooltip = document.getElementById("urlTooltip");
|
||||
|
||||
@ -180,6 +181,14 @@
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_mayTrimURLs">true</field>
|
||||
<method name="trimValue">
|
||||
<parameter name="aURL"/>
|
||||
<body><![CDATA[
|
||||
return this._mayTrimURLs ? trimURL(aURL) : aURL;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_formattingEnabled">true</field>
|
||||
<method name="formatValue">
|
||||
<body><![CDATA[
|
||||
@ -192,27 +201,41 @@
|
||||
|
||||
let textNode = this.editor.rootElement.firstChild;
|
||||
let value = textNode.textContent;
|
||||
let matchedURL = value.match(/^((?:http|https|ftp):\/\/(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
|
||||
|
||||
let protocol = value.match(/^[a-z\d.+\-]+:/);
|
||||
if (protocol &&
|
||||
["http:", "https:", "ftp:"].indexOf(protocol[0]) == -1)
|
||||
return;
|
||||
let matchedURL = value.match(/^((?:[a-z]+:\/\/)?(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
|
||||
if (!matchedURL)
|
||||
return;
|
||||
|
||||
let [, preDomain, domain] = matchedURL;
|
||||
let baseDomain = domain;
|
||||
try {
|
||||
baseDomain = Services.eTLD.getBaseDomainFromHost(domain);
|
||||
} catch (e) {}
|
||||
let segments = function (s) s.replace(/[^.]*/g, "").length + 1;
|
||||
let subSegments = segments(domain) - segments(baseDomain);
|
||||
let subDomain = domain.match(new RegExp("(?:[^.]*\.){" + subSegments + "}"))[0];
|
||||
let subDomain = "";
|
||||
// getBaseDomainFromHost doesn't recognize IPv6 literals in brackets as IPs (bug 667159)
|
||||
if (domain[0] != "[") {
|
||||
try {
|
||||
baseDomain = Services.eTLD.getBaseDomainFromHost(domain);
|
||||
} catch (e) {}
|
||||
}
|
||||
if (baseDomain != domain) {
|
||||
let segments = function (s) s.replace(/[^.]*/g, "").length + 1;
|
||||
let subSegments = segments(domain) - segments(baseDomain);
|
||||
subDomain = domain.match(new RegExp("(?:[^.]*\.){" + subSegments + "}"))[0];
|
||||
}
|
||||
|
||||
let range = document.createRange();
|
||||
range.setStart(textNode, 0);
|
||||
range.setEnd(textNode, preDomain.length + subDomain.length);
|
||||
selection.addRange(range);
|
||||
let rangeLength = preDomain.length + subDomain.length;
|
||||
if (rangeLength) {
|
||||
let range = document.createRange();
|
||||
range.setStart(textNode, 0);
|
||||
range.setEnd(textNode, rangeLength);
|
||||
selection.addRange(range);
|
||||
}
|
||||
|
||||
let startRest = preDomain.length + domain.length;
|
||||
if (startRest < value.length) {
|
||||
range = document.createRange();
|
||||
let range = document.createRange();
|
||||
range.setStart(textNode, startRest);
|
||||
range.setEnd(textNode, value.length);
|
||||
selection.addRange(range);
|
||||
@ -467,7 +490,7 @@
|
||||
SetPageProxyState("invalid");
|
||||
this.focus();
|
||||
try {
|
||||
urlSecurityCheck(this.value,
|
||||
urlSecurityCheck(url,
|
||||
gBrowser.contentPrincipal,
|
||||
Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
|
||||
} catch (ex) {
|
||||
@ -488,10 +511,7 @@
|
||||
// non-data URI, encode it.
|
||||
if (val == inputVal &&
|
||||
this.getAttribute("pageproxystate") == "valid") {
|
||||
let uri;
|
||||
try {
|
||||
uri = makeURI(val);
|
||||
} catch (e) {}
|
||||
let uri = gBrowser.currentURI;
|
||||
|
||||
if (uri && !uri.schemeIs("javascript") && !uri.schemeIs("data")) {
|
||||
val = uri.spec;
|
||||
@ -565,6 +585,9 @@
|
||||
case "formatting.enabled":
|
||||
this._formattingEnabled = this._prefs.getBoolPref(aData);
|
||||
break;
|
||||
case "trimURLs":
|
||||
this._mayTrimURLs = this._prefs.getBoolPref(aData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
@ -1288,9 +1311,9 @@
|
||||
<xul:hbox align="center" flex="1">
|
||||
<xul:image class="panel-promo-icon"/>
|
||||
<xul:description anonid="promo-message" class="panel-promo-message" flex="1">
|
||||
placeholder <xul:description anonid="promo-link"
|
||||
class="plain text-link inline-link"
|
||||
onclick="document.getBindingParent(this).onLinkClick();"/>
|
||||
<xul:description anonid="promo-link"
|
||||
class="plain text-link inline-link"
|
||||
onclick="document.getBindingParent(this).onLinkClick();"/>
|
||||
</xul:description>
|
||||
</xul:hbox>
|
||||
<xul:toolbarbutton class="panel-promo-closebutton"
|
||||
@ -1352,7 +1375,7 @@
|
||||
<property name="_notificationMessage">
|
||||
<getter><![CDATA[
|
||||
return gNavigatorBundle.getFormattedString(
|
||||
"syncPromoNotification." + this._notificationType + ".label",
|
||||
"syncPromoNotification." + this._notificationType + ".description",
|
||||
[this._brandBundle.GetStringFromName("syncBrandShortName")]
|
||||
);
|
||||
]]></getter>
|
||||
@ -1407,12 +1430,15 @@
|
||||
|
||||
// HACK: The description element doesn't wrap correctly in panels,
|
||||
// thus set a width on it, based on the available space, before
|
||||
// setting its textContent.
|
||||
// setting its textContent. Then set its height as well, to
|
||||
// fix wrong height calculation on Linux (bug 659578).
|
||||
let self = this;
|
||||
this._panel.addEventListener("popupshown", function (evt) {
|
||||
this._panel.removeEventListener("popupshown", arguments.callee, true);
|
||||
this._promomessage.width = this._promomessage.getBoundingClientRect().width;
|
||||
this._promomessage.firstChild.textContent = this._notificationMessage;
|
||||
}.bind(this), true);
|
||||
self._panel.removeEventListener("popupshown", arguments.callee, true);
|
||||
self._promomessage.width = self._promomessage.getBoundingClientRect().width;
|
||||
self._promomessage.firstChild.textContent = self._notificationMessage;
|
||||
self._promomessage.height = self._promomessage.getBoundingClientRect().height;
|
||||
}, true);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -23,6 +23,7 @@
|
||||
# Alec Flett <alecf@netscape.com>
|
||||
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
# Gavin Sharp <gavin@gavinsharp.com>
|
||||
# Dão Gottwald <dao@design-noir.de>
|
||||
#
|
||||
# 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
|
||||
@ -617,3 +618,10 @@ function openPrefsHelp() {
|
||||
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.helpTopic;
|
||||
openHelpLink(helpTopic, !instantApply);
|
||||
}
|
||||
|
||||
function trimURL(aURL) {
|
||||
return aURL /* remove single trailing slash for http/https/ftp URLs */
|
||||
.replace(/^((?:http|https|ftp):\/\/[^/]+)\/$/, "$1")
|
||||
/* remove http:// unless the host starts with "ftp." or contains "@" */
|
||||
.replace(/^http:\/\/((?!ftp\.)[^\/@]+(?:\/|$))/, "$1");
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ browser.jar:
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
|
||||
* content/browser/fullscreen-video.xhtml (content/fullscreen-video.xhtml)
|
||||
content/browser/highlighter.xhtml (content/highlighter.xhtml)
|
||||
* content/browser/inspector.html (content/inspector.html)
|
||||
* content/browser/scratchpad.xul (content/scratchpad.xul)
|
||||
* content/browser/scratchpad.js (content/scratchpad.js)
|
||||
|
@ -19,6 +19,7 @@
|
||||
#
|
||||
# Contributor(s):
|
||||
# Justin Dolske <dolske@mozilla.com> (original author)
|
||||
# Jared Wein <jwein@mozilla.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
|
||||
@ -75,7 +76,6 @@ LINUX_BRANDING_FILES = \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
document.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
@ -19,6 +19,7 @@
|
||||
#
|
||||
# Contributor(s):
|
||||
# Justin Dolske <dolske@mozilla.com> (original author)
|
||||
# Jared Wein <jwein@mozilla.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
|
||||
@ -75,7 +76,6 @@ LINUX_BRANDING_FILES = \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
document.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
@ -19,6 +19,7 @@
|
||||
#
|
||||
# Contributor(s):
|
||||
# Justin Dolske <dolske@mozilla.com> (original author)
|
||||
# Jared Wein <jwein@mozilla.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
|
||||
@ -75,7 +76,6 @@ LINUX_BRANDING_FILES = \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
document.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
@ -19,6 +19,7 @@
|
||||
#
|
||||
# Contributor(s):
|
||||
# Justin Dolske <dolske@mozilla.com> (original author)
|
||||
# Jared Wein <jwein@mozilla.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
|
||||
@ -75,7 +76,6 @@ LINUX_BRANDING_FILES = \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
document.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
@ -62,7 +62,6 @@ const nsIURIFixup = Components.interfaces.nsIURIFixup;
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
|
||||
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
|
||||
const nsICategoryManager = Components.interfaces.nsICategoryManager;
|
||||
const nsIWebNavigationInfo = Components.interfaces.nsIWebNavigationInfo;
|
||||
const nsIBrowserSearchService = Components.interfaces.nsIBrowserSearchService;
|
||||
const nsICommandLineValidator = Components.interfaces.nsICommandLineValidator;
|
||||
@ -740,8 +739,6 @@ nsBrowserContentHandler.prototype = {
|
||||
};
|
||||
var gBrowserContentHandler = new nsBrowserContentHandler();
|
||||
|
||||
const CONTRACTID_PREFIX = "@mozilla.org/uriloader/content-handler;1?type=";
|
||||
|
||||
function handURIToExistingBrowser(uri, location, cmdLine)
|
||||
{
|
||||
if (!shouldLoadURI(uri))
|
||||
|
@ -350,19 +350,6 @@ BrowserGlue.prototype = {
|
||||
// handle any UI migration
|
||||
this._migrateUI();
|
||||
|
||||
// if ioService is managing the offline status, then ioservice.offline
|
||||
// is already set correctly. We will continue to allow the ioService
|
||||
// to manage its offline state until the user uses the "Work Offline" UI.
|
||||
if (!Services.io.manageOfflineStatus) {
|
||||
// set the initial state
|
||||
try {
|
||||
Services.io.offline = Services.prefs.getBoolPref("browser.offline");
|
||||
}
|
||||
catch (e) {
|
||||
Services.io.offline = false;
|
||||
}
|
||||
}
|
||||
|
||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||
},
|
||||
|
||||
@ -389,8 +376,13 @@ BrowserGlue.prototype = {
|
||||
// Browser startup complete. All initial windows have opened.
|
||||
_onBrowserStartup: function BG__onBrowserStartup() {
|
||||
// Show about:rights notification, if needed.
|
||||
if (this._shouldShowRights())
|
||||
if (this._shouldShowRights()) {
|
||||
this._showRightsNotification();
|
||||
} else {
|
||||
// Only show telemetry notification when about:rights notification is not shown.
|
||||
this._showTelemetryNotification();
|
||||
}
|
||||
|
||||
|
||||
// Show update notification, if needed.
|
||||
if (Services.prefs.prefHasUserValue("app.update.postupdate"))
|
||||
@ -748,6 +740,72 @@ BrowserGlue.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_showTelemetryNotification: function BG__showTelemetryNotification() {
|
||||
const PREF_TELEMETRY_PROMPTED = "toolkit.telemetry.prompted";
|
||||
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
|
||||
const PREF_TELEMETRY_INFOURL = "toolkit.telemetry.infoURL";
|
||||
const PREF_TELEMETRY_SERVER_OWNER = "toolkit.telemetry.server_owner";
|
||||
|
||||
try {
|
||||
// If the user hasn't already been prompted, ask if they want to
|
||||
// send telemetry data.
|
||||
if (Services.prefs.getBoolPref(PREF_TELEMETRY_ENABLED) ||
|
||||
Services.prefs.getBoolPref(PREF_TELEMETRY_PROMPTED))
|
||||
return;
|
||||
} catch(e) {}
|
||||
|
||||
// Stick the notification onto the selected tab of the active browser window.
|
||||
var win = this.getMostRecentBrowserWindow();
|
||||
var browser = win.gBrowser; // for closure in notification bar callback
|
||||
var notifyBox = browser.getNotificationBox();
|
||||
|
||||
var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
|
||||
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
||||
|
||||
var productName = brandBundle.GetStringFromName("brandFullName");
|
||||
var serverOwner = Services.prefs.getCharPref(PREF_TELEMETRY_SERVER_OWNER);
|
||||
var telemetryText = browserBundle.formatStringFromName("telemetryText", [productName, serverOwner], 2);
|
||||
|
||||
var buttons = [
|
||||
{
|
||||
label: browserBundle.GetStringFromName("telemetryYesButtonLabel"),
|
||||
accessKey: browserBundle.GetStringFromName("telemetryYesButtonAccessKey"),
|
||||
popup: null,
|
||||
callback: function(aNotificationBar, aButton) {
|
||||
Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: browserBundle.GetStringFromName("telemetryNoButtonLabel"),
|
||||
accessKey: browserBundle.GetStringFromName("telemetryNoButtonAccessKey"),
|
||||
popup: null,
|
||||
callback: function(aNotificationBar, aButton) {}
|
||||
}
|
||||
];
|
||||
|
||||
// Set pref to indicate we've shown the notification.
|
||||
Services.prefs.setBoolPref(PREF_TELEMETRY_PROMPTED, true);
|
||||
|
||||
var notification = notifyBox.appendNotification(telemetryText, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
|
||||
notification.persistence = 3; // arbitrary number, just so bar sticks around for a bit
|
||||
|
||||
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
let link = notification.ownerDocument.createElementNS(XULNS, "label");
|
||||
link.className = "text-link telemetry-text-link";
|
||||
link.setAttribute("value", browserBundle.GetStringFromName("telemetryLinkLabel"));
|
||||
link.addEventListener('click', function() {
|
||||
// Open the learn more url in a new tab
|
||||
browser.selectedTab = browser.addTab(Services.prefs.getCharPref(PREF_TELEMETRY_INFOURL));
|
||||
// Remove the notification on which the user clicked
|
||||
notification.parentNode.removeNotification(notification, true);
|
||||
// Add a new notification to that tab, with no "Learn more" link
|
||||
var notifyBox = browser.getNotificationBox();
|
||||
notifyBox.appendNotification(telemetryText, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
|
||||
}, false);
|
||||
let description = notification.ownerDocument.getAnonymousElementByAttribute(notification, "anonid", "messageText");
|
||||
description.appendChild(link);
|
||||
},
|
||||
|
||||
_showPluginUpdatePage: function BG__showPluginUpdatePage() {
|
||||
Services.prefs.setBoolPref(PREF_PLUGINS_NOTIFYUSER, false);
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
// Load DownloadUtils module for convertByteUnits
|
||||
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var gAdvancedPane = {
|
||||
_inited: false,
|
||||
@ -179,8 +178,9 @@ var gAdvancedPane = {
|
||||
updateHardwareAcceleration: function()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
var pref = document.getElementById("layers.acceleration.disabled");
|
||||
Services.prefs.setBoolPref("gfx.direct2d.disabled", !pref.value);
|
||||
var fromPref = document.getElementById("layers.acceleration.disabled");
|
||||
var toPref = document.getElementById("gfx.direct2d.disabled");
|
||||
toPref.value = fromPref.value;
|
||||
#endif
|
||||
},
|
||||
|
||||
|
@ -70,6 +70,9 @@
|
||||
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
|
||||
<preference id="layers.acceleration.disabled" name="layers.acceleration.disabled" type="bool" inverted="true"
|
||||
onchange="gAdvancedPane.updateHardwareAcceleration()"/>
|
||||
#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
|
||||
@ -82,6 +85,10 @@
|
||||
type="bool"/>
|
||||
#endif
|
||||
|
||||
<preference id="toolkit.telemetry.enabled"
|
||||
name="toolkit.telemetry.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Network tab -->
|
||||
<preference id="browser.cache.disk.capacity" name="browser.cache.disk.capacity" type="int"/>
|
||||
<preference id="browser.offline-apps.notify" name="browser.offline-apps.notify" type="bool"/>
|
||||
@ -193,11 +200,11 @@
|
||||
preference="layout.spellcheckDefault"/>
|
||||
</groupbox>
|
||||
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
<!-- System Defaults -->
|
||||
<groupbox id="systemDefaultsGroup" orient="vertical">
|
||||
<caption label="&systemDefaults.label;"/>
|
||||
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
<hbox id="checkDefaultBox" align="center" flex="1">
|
||||
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
|
||||
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
|
||||
@ -212,8 +219,11 @@
|
||||
oncommand="gAdvancedPane.updateSubmitCrashes();"
|
||||
label="&submitCrashes.label;" accesskey="&submitCrashes.accesskey;"/>
|
||||
#endif
|
||||
</groupbox>
|
||||
#endif
|
||||
<checkbox id="submitTelemetryBox" flex="1"
|
||||
preference="toolkit.telemetry.enabled"
|
||||
label="&submitTelemetry.label;" accesskey="&submitTelemetry.accesskey;"/>
|
||||
</groupbox>
|
||||
</tabpanel>
|
||||
|
||||
<!-- Network -->
|
||||
|
@ -110,12 +110,13 @@ XXX keep these in sync with all the attributes starting
|
||||
*/
|
||||
const CAPABILITIES = [
|
||||
"Subframes", "Plugins", "Javascript", "MetaRedirects", "Images",
|
||||
"DNSPrefetch", "Auth"
|
||||
"DNSPrefetch", "Auth", "WindowControl"
|
||||
];
|
||||
|
||||
// These keys are for internal use only - they shouldn't be part of the JSON
|
||||
// that gets saved to disk nor part of the strings returned by the API.
|
||||
const INTERNAL_KEYS = ["_tabStillLoading", "_hosts", "_formDataSaved"];
|
||||
const INTERNAL_KEYS = ["_tabStillLoading", "_hosts", "_formDataSaved",
|
||||
"_shouldRestore"];
|
||||
|
||||
// These are tab events that we listen to.
|
||||
const TAB_EVENTS = ["TabOpen", "TabClose", "TabSelect", "TabShow", "TabHide",
|
||||
@ -195,7 +196,11 @@ SessionStoreService.prototype = {
|
||||
_browserSetState: false,
|
||||
|
||||
// time in milliseconds (Date.now()) when the session was last written to file
|
||||
_lastSaveTime: 0,
|
||||
_lastSaveTime: 0,
|
||||
|
||||
// time in milliseconds when the session was started (saved across sessions),
|
||||
// defaults to now if no session was restored or timestamp doesn't exist
|
||||
_sessionStartTime: Date.now(),
|
||||
|
||||
// states for all currently opened windows
|
||||
_windows: {},
|
||||
@ -342,7 +347,12 @@ SessionStoreService.prototype = {
|
||||
this._initialState = { windows: [{ tabs: [{ entries: [pageData] }] }] };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load the session start time from the previous state
|
||||
this._sessionStartTime = this._initialState.session &&
|
||||
this._initialState.session.startTime ||
|
||||
this._sessionStartTime;
|
||||
|
||||
// make sure that at least the first window doesn't have anything hidden
|
||||
delete this._initialState.windows[0].hidden;
|
||||
// Since nothing is hidden in the first window, it cannot be a popup
|
||||
@ -515,6 +525,8 @@ SessionStoreService.prototype = {
|
||||
// Delete the private browsing backed up state, if any
|
||||
if ("_stateBackup" in this)
|
||||
delete this._stateBackup;
|
||||
|
||||
this._clearRestoringWindows();
|
||||
break;
|
||||
case "browser:purge-domain-data":
|
||||
// does a session history entry contain a url for the given domain?
|
||||
@ -565,6 +577,8 @@ SessionStoreService.prototype = {
|
||||
}
|
||||
if (this._loadState == STATE_RUNNING)
|
||||
this.saveState(true);
|
||||
|
||||
this._clearRestoringWindows();
|
||||
break;
|
||||
case "nsPref:changed": // catch pref changes
|
||||
switch (aData) {
|
||||
@ -640,6 +654,8 @@ SessionStoreService.prototype = {
|
||||
delete this._stateBackup;
|
||||
break;
|
||||
}
|
||||
|
||||
this._clearRestoringWindows();
|
||||
break;
|
||||
case "private-browsing-change-granted":
|
||||
if (aData == "enter") {
|
||||
@ -652,6 +668,8 @@ SessionStoreService.prototype = {
|
||||
// Make sure _tabsToRestore is cleared. It will be repopulated when
|
||||
// entering/exiting private browsing (by calls to setBrowserState).
|
||||
this._resetRestoringState();
|
||||
|
||||
this._clearRestoringWindows();
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -702,6 +720,8 @@ SessionStoreService.prototype = {
|
||||
this.saveStateDelayed(win);
|
||||
break;
|
||||
}
|
||||
|
||||
this._clearRestoringWindows();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -901,7 +921,13 @@ SessionStoreService.prototype = {
|
||||
tabbrowser.selectedTab);
|
||||
this._updateCookies([winData]);
|
||||
}
|
||||
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
// Until we decide otherwise elsewhere, this window is part of a series
|
||||
// of closing windows to quit.
|
||||
winData._shouldRestore = true;
|
||||
#endif
|
||||
|
||||
// save the window if it has multiple tabs or a single saveable tab
|
||||
if (winData.tabs.length > 1 ||
|
||||
(winData.tabs.length == 1 && this._shouldSaveTabState(winData.tabs[0]))) {
|
||||
@ -1492,9 +1518,13 @@ SessionStoreService.prototype = {
|
||||
this._closedWindows = this._closedWindows.concat(lastSessionState._closedWindows);
|
||||
this._capClosedWindows();
|
||||
}
|
||||
// Set recent crashes
|
||||
|
||||
// Set data that persists between sessions
|
||||
this._recentCrashes = lastSessionState.session &&
|
||||
lastSessionState.session.recentCrashes || 0;
|
||||
this._sessionStartTime = lastSessionState.session &&
|
||||
lastSessionState.session.startTime ||
|
||||
this._sessionStartTime;
|
||||
|
||||
this._lastSessionState = null;
|
||||
},
|
||||
@ -2903,8 +2933,7 @@ SessionStoreService.prototype = {
|
||||
// force session history to update its internal index and call reload
|
||||
// instead of gotoIndex. See bug 597315.
|
||||
browser.webNavigation.sessionHistory.getEntryAtIndex(activeIndex, true);
|
||||
browser.webNavigation.sessionHistory.
|
||||
QueryInterface(Ci.nsISHistory).reloadCurrentEntry();
|
||||
browser.webNavigation.sessionHistory.reloadCurrentEntry();
|
||||
}
|
||||
catch (ex) {
|
||||
// ignore page load errors
|
||||
@ -3372,6 +3401,22 @@ SessionStoreService.prototype = {
|
||||
if (!oState)
|
||||
return;
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
// We want to restore closed windows that are marked with _shouldRestore.
|
||||
// We're doing this here because we want to control this only when saving
|
||||
// the file.
|
||||
while (oState._closedWindows.length) {
|
||||
let i = oState._closedWindows.length - 1;
|
||||
if (oState._closedWindows[i]._shouldRestore) {
|
||||
oState.windows.unshift(oState._closedWindows.pop());
|
||||
}
|
||||
else {
|
||||
// We only need to go until we hit !needsRestore since we're going in reverse
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pinnedOnly) {
|
||||
// Save original resume_session_once preference for when quiting browser,
|
||||
// otherwise session will be restored next time browser starts and we
|
||||
@ -3387,7 +3432,8 @@ SessionStoreService.prototype = {
|
||||
|
||||
oState.session = {
|
||||
state: this._loadState == STATE_RUNNING ? STATE_RUNNING_STR : STATE_STOPPED_STR,
|
||||
lastUpdate: Date.now()
|
||||
lastUpdate: Date.now(),
|
||||
startTime: this._sessionStartTime
|
||||
};
|
||||
if (this._recentCrashes)
|
||||
oState.session.recentCrashes = this._recentCrashes;
|
||||
@ -3959,6 +4005,12 @@ SessionStoreService.prototype = {
|
||||
this._closedWindows.splice(spliceTo);
|
||||
},
|
||||
|
||||
_clearRestoringWindows: function sss__clearRestoringWindows() {
|
||||
for (let i = 0; i < this._closedWindows.length; i++) {
|
||||
delete this._closedWindows[i]._shouldRestore;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Reset state to prepare for a new session state to be restored.
|
||||
*/
|
||||
|
@ -62,7 +62,9 @@ _BROWSER_TEST_FILES = \
|
||||
browser_354894.js \
|
||||
browser_367052.js \
|
||||
browser_393716.js \
|
||||
browser_394759.js \
|
||||
browser_394759_basic.js \
|
||||
browser_394759_behavior.js \
|
||||
browser_394759_purge.js \
|
||||
browser_394759_privatebrowsing.js \
|
||||
browser_408470.js \
|
||||
browser_408470_sample.html \
|
||||
@ -153,6 +155,7 @@ _BROWSER_TEST_FILES = \
|
||||
ifneq ($(OS_ARCH),Darwin)
|
||||
_BROWSER_TEST_FILES += \
|
||||
browser_597071.js \
|
||||
browser_625016.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -152,9 +152,6 @@ function test() {
|
||||
}, true);
|
||||
}
|
||||
|
||||
// sessionstore service
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
|
||||
getService(Ci.nsISessionStore);
|
||||
// Remove the sessionstore.js file before setting the interval to 0
|
||||
let sessionStoreJS = getSessionstoreFile();
|
||||
if (sessionStoreJS.exists())
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user