зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to b2g-inbound
This commit is contained in:
Коммит
55e715b3b4
|
@ -1042,14 +1042,17 @@ refRelationSetCB(AtkObject *aAtkObj)
|
||||||
AccessibleWrap*
|
AccessibleWrap*
|
||||||
GetAccessibleWrap(AtkObject* aAtkObj)
|
GetAccessibleWrap(AtkObject* aAtkObj)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nullptr);
|
bool isMAIObject = IS_MAI_OBJECT(aAtkObj);
|
||||||
|
NS_ENSURE_TRUE(isMAIObject || MAI_IS_ATK_SOCKET(aAtkObj),
|
||||||
|
nullptr);
|
||||||
|
|
||||||
// Make sure its native is an AccessibleWrap not a proxy.
|
uintptr_t accWrapPtr = isMAIObject ?
|
||||||
if (MAI_ATK_OBJECT(aAtkObj)->accWrap & IS_PROXY)
|
MAI_ATK_OBJECT(aAtkObj)->accWrap :
|
||||||
|
reinterpret_cast<uintptr_t>(MAI_ATK_SOCKET(aAtkObj)->accWrap);
|
||||||
|
if (accWrapPtr & IS_PROXY)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
AccessibleWrap* accWrap =
|
AccessibleWrap* accWrap = reinterpret_cast<AccessibleWrap*>(accWrapPtr);
|
||||||
reinterpret_cast<AccessibleWrap*>(MAI_ATK_OBJECT(aAtkObj)->accWrap);
|
|
||||||
|
|
||||||
// Check if the accessible was deconstructed.
|
// Check if the accessible was deconstructed.
|
||||||
if (!accWrap)
|
if (!accWrap)
|
||||||
|
@ -1067,7 +1070,8 @@ GetAccessibleWrap(AtkObject* aAtkObj)
|
||||||
ProxyAccessible*
|
ProxyAccessible*
|
||||||
GetProxy(AtkObject* aObj)
|
GetProxy(AtkObject* aObj)
|
||||||
{
|
{
|
||||||
if (!aObj || !(MAI_ATK_OBJECT(aObj)->accWrap & IS_PROXY))
|
if (!aObj || !IS_MAI_OBJECT(aObj) ||
|
||||||
|
!(MAI_ATK_OBJECT(aObj)->accWrap & IS_PROXY))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return reinterpret_cast<ProxyAccessible*>(MAI_ATK_OBJECT(aObj)->accWrap
|
return reinterpret_cast<ProxyAccessible*>(MAI_ATK_OBJECT(aObj)->accWrap
|
||||||
|
|
|
@ -21,35 +21,6 @@ const char* AtkSocketAccessible::sATKSocketGetTypeSymbol = "atk_socket_get_type"
|
||||||
bool AtkSocketAccessible::gCanEmbed = FALSE;
|
bool AtkSocketAccessible::gCanEmbed = FALSE;
|
||||||
|
|
||||||
extern "C" void mai_atk_component_iface_init(AtkComponentIface* aIface);
|
extern "C" void mai_atk_component_iface_init(AtkComponentIface* aIface);
|
||||||
extern "C" GType mai_atk_socket_get_type(void);
|
|
||||||
|
|
||||||
/* MaiAtkSocket */
|
|
||||||
|
|
||||||
#define MAI_TYPE_ATK_SOCKET (mai_atk_socket_get_type ())
|
|
||||||
#define MAI_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
|
|
||||||
MAI_TYPE_ATK_SOCKET, MaiAtkSocket))
|
|
||||||
#define MAI_IS_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
|
|
||||||
MAI_TYPE_ATK_SOCKET))
|
|
||||||
#define MAI_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
|
|
||||||
MAI_TYPE_ATK_SOCKET,\
|
|
||||||
MaiAtkSocketClass))
|
|
||||||
#define MAI_IS_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
|
|
||||||
MAI_TYPE_ATK_SOCKET))
|
|
||||||
#define MAI_ATK_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
|
|
||||||
MAI_TYPE_ATK_SOCKET,\
|
|
||||||
MaiAtkSocketClass))
|
|
||||||
|
|
||||||
typedef struct _MaiAtkSocket
|
|
||||||
{
|
|
||||||
AtkSocket parent;
|
|
||||||
|
|
||||||
AccessibleWrap* accWrap;
|
|
||||||
} MaiAtkSocket;
|
|
||||||
|
|
||||||
typedef struct _MaiAtkSocketClass
|
|
||||||
{
|
|
||||||
AtkSocketClass parent_class;
|
|
||||||
} MaiAtkSocketClass;
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_EXTENDED(MaiAtkSocket, mai_atk_socket,
|
G_DEFINE_TYPE_EXTENDED(MaiAtkSocket, mai_atk_socket,
|
||||||
AtkSocketAccessible::g_atk_socket_type, 0,
|
AtkSocketAccessible::g_atk_socket_type, 0,
|
||||||
|
@ -86,7 +57,7 @@ RefAccessibleAtPoint(AtkComponent* aComponent, gint aX, gint aY,
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nullptr);
|
NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nullptr);
|
||||||
|
|
||||||
return refAccessibleAtPointHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
|
return refAccessibleAtPointHelper(ATK_OBJECT(MAI_ATK_SOCKET(aComponent)),
|
||||||
aX, aY, aCoordType);
|
aX, aY, aCoordType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +70,7 @@ GetExtents(AtkComponent* aComponent, gint* aX, gint* aY, gint* aWidth,
|
||||||
if (!MAI_IS_ATK_SOCKET(aComponent))
|
if (!MAI_IS_ATK_SOCKET(aComponent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getExtentsHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
|
getExtentsHelper(ATK_OBJECT(MAI_ATK_SOCKET(aComponent)),
|
||||||
aX, aY, aWidth, aHeight, aCoordType);
|
aX, aY, aWidth, aHeight, aCoordType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ void valueInterfaceInitCB(AtkValueIface *aIface);
|
||||||
/**
|
/**
|
||||||
* XXX these should live in a file of utils for atk.
|
* XXX these should live in a file of utils for atk.
|
||||||
*/
|
*/
|
||||||
AtkObject* refAccessibleAtPointHelper(mozilla::a11y::AccessibleWrap* aAccWrap,
|
AtkObject* refAccessibleAtPointHelper(AtkObject* aAtkObj,
|
||||||
gint aX, gint aY, AtkCoordType aCoordType);
|
gint aX, gint aY, AtkCoordType aCoordType);
|
||||||
void getExtentsHelper(mozilla::a11y::AccessibleWrap* aAccWrap,
|
void getExtentsHelper(AtkObject* aAtkObj,
|
||||||
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
|
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
|
||||||
AtkCoordType aCoordType);
|
AtkCoordType aCoordType);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,36 @@ class ProxyAccessible;
|
||||||
MaiAtkObjectClass))
|
MaiAtkObjectClass))
|
||||||
GType mai_atk_object_get_type(void);
|
GType mai_atk_object_get_type(void);
|
||||||
GType mai_util_get_type();
|
GType mai_util_get_type();
|
||||||
|
extern "C" GType mai_atk_socket_get_type(void);
|
||||||
|
|
||||||
|
/* MaiAtkSocket */
|
||||||
|
|
||||||
|
#define MAI_TYPE_ATK_SOCKET (mai_atk_socket_get_type ())
|
||||||
|
#define MAI_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
|
||||||
|
MAI_TYPE_ATK_SOCKET, MaiAtkSocket))
|
||||||
|
#define MAI_IS_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
|
||||||
|
MAI_TYPE_ATK_SOCKET))
|
||||||
|
#define MAI_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
|
||||||
|
MAI_TYPE_ATK_SOCKET,\
|
||||||
|
MaiAtkSocketClass))
|
||||||
|
#define MAI_IS_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
|
||||||
|
MAI_TYPE_ATK_SOCKET))
|
||||||
|
#define MAI_ATK_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
|
||||||
|
MAI_TYPE_ATK_SOCKET,\
|
||||||
|
MaiAtkSocketClass))
|
||||||
|
|
||||||
|
typedef struct _MaiAtkSocket
|
||||||
|
{
|
||||||
|
AtkSocket parent;
|
||||||
|
|
||||||
|
mozilla::a11y::AccessibleWrap* accWrap;
|
||||||
|
} MaiAtkSocket;
|
||||||
|
|
||||||
|
typedef struct _MaiAtkSocketClass
|
||||||
|
{
|
||||||
|
AtkSocketClass parent_class;
|
||||||
|
} MaiAtkSocketClass;
|
||||||
|
|
||||||
mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
|
mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
|
||||||
mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
|
mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
|
||||||
AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
|
AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "nsCoreUtils.h"
|
#include "nsCoreUtils.h"
|
||||||
#include "nsMai.h"
|
#include "nsMai.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
|
#include "mozilla/a11y/ProxyAccessible.h"
|
||||||
|
|
||||||
using namespace mozilla::a11y;
|
using namespace mozilla::a11y;
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ static AtkObject*
|
||||||
refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
|
refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
|
||||||
AtkCoordType aCoordType)
|
AtkCoordType aCoordType)
|
||||||
{
|
{
|
||||||
return refAccessibleAtPointHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
|
return refAccessibleAtPointHelper(ATK_OBJECT(aComponent),
|
||||||
aAccX, aAccY, aCoordType);
|
aAccX, aAccY, aCoordType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,65 +29,95 @@ static void
|
||||||
getExtentsCB(AtkComponent* aComponent, gint* aX, gint* aY,
|
getExtentsCB(AtkComponent* aComponent, gint* aX, gint* aY,
|
||||||
gint* aWidth, gint* aHeight, AtkCoordType aCoordType)
|
gint* aWidth, gint* aHeight, AtkCoordType aCoordType)
|
||||||
{
|
{
|
||||||
getExtentsHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
|
getExtentsHelper(ATK_OBJECT(aComponent),
|
||||||
aX, aY, aWidth, aHeight, aCoordType);
|
aX, aY, aWidth, aHeight, aCoordType);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
grabFocusCB(AtkComponent* aComponent)
|
grabFocusCB(AtkComponent* aComponent)
|
||||||
{
|
{
|
||||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
|
AtkObject* atkObject = ATK_OBJECT(aComponent);
|
||||||
if (!accWrap)
|
AccessibleWrap* accWrap = GetAccessibleWrap(atkObject);
|
||||||
return FALSE;
|
if (accWrap) {
|
||||||
|
|
||||||
accWrap->TakeFocus();
|
accWrap->TakeFocus();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProxyAccessible* proxy = GetProxy(atkObject);
|
||||||
|
if (proxy) {
|
||||||
|
proxy->TakeFocus();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AtkObject*
|
AtkObject*
|
||||||
refAccessibleAtPointHelper(AccessibleWrap* aAccWrap, gint aX, gint aY,
|
refAccessibleAtPointHelper(AtkObject* aAtkObj, gint aX, gint aY,
|
||||||
AtkCoordType aCoordType)
|
AtkCoordType aCoordType)
|
||||||
{
|
{
|
||||||
if (!aAccWrap || aAccWrap->IsDefunct() || nsAccUtils::MustPrune(aAccWrap))
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||||
|
if (accWrap) {
|
||||||
|
if (accWrap->IsDefunct() || nsAccUtils::MustPrune(accWrap)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Accessible::ChildAtPoint(x,y) is in screen pixels.
|
// Accessible::ChildAtPoint(x,y) is in screen pixels.
|
||||||
if (aCoordType == ATK_XY_WINDOW) {
|
if (aCoordType == ATK_XY_WINDOW) {
|
||||||
nsIntPoint winCoords =
|
nsIntPoint winCoords =
|
||||||
nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
|
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
|
||||||
aX += winCoords.x;
|
aX += winCoords.x;
|
||||||
aY += winCoords.y;
|
aY += winCoords.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
Accessible* accAtPoint = aAccWrap->ChildAtPoint(aX, aY,
|
Accessible* accAtPoint = accWrap->ChildAtPoint(aX, aY,
|
||||||
Accessible::eDirectChild);
|
Accessible::eDirectChild);
|
||||||
if (!accAtPoint)
|
if (!accAtPoint) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
AtkObject* atkObj = AccessibleWrap::GetAtkObject(accAtPoint);
|
AtkObject* atkObj = AccessibleWrap::GetAtkObject(accAtPoint);
|
||||||
if (atkObj)
|
if (atkObj) {
|
||||||
g_object_ref(atkObj);
|
g_object_ref(atkObj);
|
||||||
|
}
|
||||||
|
|
||||||
return atkObj;
|
return atkObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
|
||||||
|
ProxyAccessible* result =
|
||||||
|
proxy->AccessibleAtPoint(aX, aY, aCoordType == ATK_XY_WINDOW);
|
||||||
|
AtkObject* atkObj = result ? GetWrapperFor(result) : nullptr;
|
||||||
|
if (atkObj) {
|
||||||
|
g_object_ref(atkObj);
|
||||||
|
}
|
||||||
|
return atkObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
getExtentsHelper(AccessibleWrap* aAccWrap,
|
getExtentsHelper(AtkObject* aAtkObj,
|
||||||
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
|
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
|
||||||
AtkCoordType aCoordType)
|
AtkCoordType aCoordType)
|
||||||
{
|
{
|
||||||
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||||
*aX = *aY = *aWidth = *aHeight = 0;
|
*aX = *aY = *aWidth = *aHeight = 0;
|
||||||
|
|
||||||
if (!aAccWrap || aAccWrap->IsDefunct())
|
if (accWrap) {
|
||||||
|
if (accWrap->IsDefunct()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsIntRect screenRect = aAccWrap->Bounds();
|
nsIntRect screenRect = accWrap->Bounds();
|
||||||
if (screenRect.IsEmpty())
|
if (screenRect.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (aCoordType == ATK_XY_WINDOW) {
|
if (aCoordType == ATK_XY_WINDOW) {
|
||||||
nsIntPoint winCoords =
|
nsIntPoint winCoords =
|
||||||
nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
|
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
|
||||||
screenRect.x -= winCoords.x;
|
screenRect.x -= winCoords.x;
|
||||||
screenRect.y -= winCoords.y;
|
screenRect.y -= winCoords.y;
|
||||||
}
|
}
|
||||||
|
@ -95,6 +126,12 @@ getExtentsHelper(AccessibleWrap* aAccWrap,
|
||||||
*aY = screenRect.y;
|
*aY = screenRect.y;
|
||||||
*aWidth = screenRect.width;
|
*aWidth = screenRect.width;
|
||||||
*aHeight = screenRect.height;
|
*aHeight = screenRect.height;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
|
||||||
|
proxy->Extents(aCoordType == ATK_XY_WINDOW, aX, aY, aWidth, aHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1792,42 +1792,6 @@ DocAccessibleChild::RecvFocusedChild(const uint64_t& aID,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
DocAccessibleChild::RecvChildAtPoint(const uint64_t& aID,
|
|
||||||
const int32_t& aX,
|
|
||||||
const int32_t& aY,
|
|
||||||
const uint32_t& aWhich,
|
|
||||||
uint64_t* aChild,
|
|
||||||
bool* aOk)
|
|
||||||
{
|
|
||||||
*aChild = 0;
|
|
||||||
*aOk = false;
|
|
||||||
Accessible* acc = IdToAccessible(aID);
|
|
||||||
if (acc && !acc->IsDefunct() && !nsAccUtils::MustPrune(acc)) {
|
|
||||||
Accessible* child =
|
|
||||||
acc->ChildAtPoint(aX, aY,
|
|
||||||
static_cast<Accessible::EWhichChildAtPoint>(aWhich));
|
|
||||||
if (child) {
|
|
||||||
*aChild = reinterpret_cast<uint64_t>(child->UniqueID());
|
|
||||||
*aOk = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
DocAccessibleChild::RecvBounds(const uint64_t& aID,
|
|
||||||
nsIntRect* aRect)
|
|
||||||
{
|
|
||||||
Accessible* acc = IdToAccessible(aID);
|
|
||||||
if (acc && !acc->IsDefunct()) {
|
|
||||||
*aRect = acc->Bounds();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DocAccessibleChild::RecvLanguage(const uint64_t& aID,
|
DocAccessibleChild::RecvLanguage(const uint64_t& aID,
|
||||||
nsString* aLocale)
|
nsString* aLocale)
|
||||||
|
@ -1906,5 +1870,71 @@ DocAccessibleChild::RecvURLDocTypeMimeType(const uint64_t& aID,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DocAccessibleChild::RecvAccessibleAtPoint(const uint64_t& aID,
|
||||||
|
const int32_t& aX,
|
||||||
|
const int32_t& aY,
|
||||||
|
const bool& aNeedsScreenCoords,
|
||||||
|
const uint32_t& aWhich,
|
||||||
|
uint64_t* aResult,
|
||||||
|
bool* aOk)
|
||||||
|
{
|
||||||
|
*aResult = 0;
|
||||||
|
*aOk = false;
|
||||||
|
Accessible* acc = IdToAccessible(aID);
|
||||||
|
if (acc && !acc->IsDefunct() && !nsAccUtils::MustPrune(acc)) {
|
||||||
|
int32_t x = aX;
|
||||||
|
int32_t y = aY;
|
||||||
|
if (aNeedsScreenCoords) {
|
||||||
|
nsIntPoint winCoords =
|
||||||
|
nsCoreUtils::GetScreenCoordsForWindow(acc->GetNode());
|
||||||
|
x += winCoords.x;
|
||||||
|
y += winCoords.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
Accessible* result =
|
||||||
|
acc->ChildAtPoint(x, y,
|
||||||
|
static_cast<Accessible::EWhichChildAtPoint>(aWhich));
|
||||||
|
if (result) {
|
||||||
|
*aResult = reinterpret_cast<uint64_t>(result->UniqueID());
|
||||||
|
*aOk = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DocAccessibleChild::RecvExtents(const uint64_t& aID,
|
||||||
|
const bool& aNeedsScreenCoords,
|
||||||
|
int32_t* aX,
|
||||||
|
int32_t* aY,
|
||||||
|
int32_t* aWidth,
|
||||||
|
int32_t* aHeight)
|
||||||
|
{
|
||||||
|
*aX = 0;
|
||||||
|
*aY = 0;
|
||||||
|
*aWidth = 0;
|
||||||
|
*aHeight = 0;
|
||||||
|
Accessible* acc = IdToAccessible(aID);
|
||||||
|
if (acc && !acc->IsDefunct() && !nsAccUtils::MustPrune(acc)) {
|
||||||
|
nsIntRect screenRect = acc->Bounds();
|
||||||
|
if (!screenRect.IsEmpty()) {
|
||||||
|
if (aNeedsScreenCoords) {
|
||||||
|
nsIntPoint winCoords =
|
||||||
|
nsCoreUtils::GetScreenCoordsForWindow(acc->GetNode());
|
||||||
|
screenRect.x -= winCoords.x;
|
||||||
|
screenRect.y -= winCoords.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
*aX = screenRect.x;
|
||||||
|
*aY = screenRect.y;
|
||||||
|
*aWidth = screenRect.width;
|
||||||
|
*aHeight = screenRect.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,15 +448,6 @@ public:
|
||||||
uint64_t* aChild,
|
uint64_t* aChild,
|
||||||
bool* aOk) override;
|
bool* aOk) override;
|
||||||
|
|
||||||
virtual bool RecvChildAtPoint(const uint64_t& aID,
|
|
||||||
const int32_t& aX,
|
|
||||||
const int32_t& aY,
|
|
||||||
const uint32_t& aWhich,
|
|
||||||
uint64_t* aChild,
|
|
||||||
bool* aOk) override;
|
|
||||||
|
|
||||||
virtual bool RecvBounds(const uint64_t& aID, nsIntRect* aRect) override;
|
|
||||||
|
|
||||||
virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
|
virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
|
||||||
virtual bool RecvDocType(const uint64_t& aID, nsString* aType) override;
|
virtual bool RecvDocType(const uint64_t& aID, nsString* aType) override;
|
||||||
virtual bool RecvTitle(const uint64_t& aID, nsString* aTitle) override;
|
virtual bool RecvTitle(const uint64_t& aID, nsString* aTitle) override;
|
||||||
|
@ -466,6 +457,21 @@ public:
|
||||||
nsString* aURL,
|
nsString* aURL,
|
||||||
nsString* aDocType,
|
nsString* aDocType,
|
||||||
nsString* aMimeType) override;
|
nsString* aMimeType) override;
|
||||||
|
|
||||||
|
virtual bool RecvAccessibleAtPoint(const uint64_t& aID,
|
||||||
|
const int32_t& aX,
|
||||||
|
const int32_t& aY,
|
||||||
|
const bool& aNeedsScreenCoords,
|
||||||
|
const uint32_t& aWhich,
|
||||||
|
uint64_t* aResult,
|
||||||
|
bool* aOk) override;
|
||||||
|
|
||||||
|
virtual bool RecvExtents(const uint64_t& aID,
|
||||||
|
const bool& aNeedsScreenCoords,
|
||||||
|
int32_t* aX,
|
||||||
|
int32_t* aY,
|
||||||
|
int32_t* aWidth,
|
||||||
|
int32_t* aHeight) override;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Accessible* IdToAccessible(const uint64_t& aID) const;
|
Accessible* IdToAccessible(const uint64_t& aID) const;
|
||||||
|
|
|
@ -233,9 +233,6 @@ child:
|
||||||
returns(uint64_t aChild);
|
returns(uint64_t aChild);
|
||||||
prio(high) sync FocusedChild(uint64_t aID)
|
prio(high) sync FocusedChild(uint64_t aID)
|
||||||
returns(uint64_t aChild, bool aOk);
|
returns(uint64_t aChild, bool aOk);
|
||||||
prio(high) sync ChildAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aWhich)
|
|
||||||
returns(uint64_t aChild, bool aOk);
|
|
||||||
prio(high) sync Bounds(uint64_t aID) returns(nsIntRect aRect);
|
|
||||||
|
|
||||||
prio(high) sync Language(uint64_t aID) returns(nsString aLocale);
|
prio(high) sync Language(uint64_t aID) returns(nsString aLocale);
|
||||||
prio(high) sync DocType(uint64_t aID) returns(nsString aType);
|
prio(high) sync DocType(uint64_t aID) returns(nsString aType);
|
||||||
|
@ -243,6 +240,12 @@ child:
|
||||||
prio(high) sync URL(uint64_t aID) returns(nsString aURL);
|
prio(high) sync URL(uint64_t aID) returns(nsString aURL);
|
||||||
prio(high) sync MimeType(uint64_t aID) returns(nsString aMime);
|
prio(high) sync MimeType(uint64_t aID) returns(nsString aMime);
|
||||||
prio(high) sync URLDocTypeMimeType(uint64_t aID) returns(nsString aURL, nsString aDocType, nsString aMimeType);
|
prio(high) sync URLDocTypeMimeType(uint64_t aID) returns(nsString aURL, nsString aDocType, nsString aMimeType);
|
||||||
|
|
||||||
|
prio(high) sync AccessibleAtPoint(uint64_t aID, int32_t aX, int32_t aY, bool aNeedsScreenCoords, uint32_t aWhich)
|
||||||
|
returns(uint64_t aResult, bool aOk);
|
||||||
|
|
||||||
|
prio(high) sync Extents(uint64_t aID, bool aNeedsScreenCoords)
|
||||||
|
returns(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ ProxyAccessible::ChildAtPoint(int32_t aX, int32_t aY,
|
||||||
{
|
{
|
||||||
uint64_t childID = 0;
|
uint64_t childID = 0;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
unused << mDoc->SendChildAtPoint(mID, aX, aY,
|
unused << mDoc->SendAccessibleAtPoint(mID, aX, aY, false,
|
||||||
static_cast<uint32_t>(aWhichChild),
|
static_cast<uint32_t>(aWhichChild),
|
||||||
&childID, &ok);
|
&childID, &ok);
|
||||||
return ok ? mDoc->GetAccessible(childID) : nullptr;
|
return ok ? mDoc->GetAccessible(childID) : nullptr;
|
||||||
|
@ -1029,7 +1029,9 @@ nsIntRect
|
||||||
ProxyAccessible::Bounds()
|
ProxyAccessible::Bounds()
|
||||||
{
|
{
|
||||||
nsIntRect rect;
|
nsIntRect rect;
|
||||||
unused << mDoc->SendBounds(mID, &rect);
|
unused << mDoc->SendExtents(mID, false,
|
||||||
|
&(rect.x), &(rect.y),
|
||||||
|
&(rect.width), &(rect.height));
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,6 +1072,26 @@ ProxyAccessible::URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
||||||
unused << mDoc->SendURLDocTypeMimeType(mID, &aURL, &aDocType, &aMimeType);
|
unused << mDoc->SendURLDocTypeMimeType(mID, &aURL, &aDocType, &aMimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProxyAccessible*
|
||||||
|
ProxyAccessible::AccessibleAtPoint(int32_t aX, int32_t aY,
|
||||||
|
bool aNeedsScreenCoords)
|
||||||
|
{
|
||||||
|
uint64_t childID = 0;
|
||||||
|
bool ok = false;
|
||||||
|
unused <<
|
||||||
|
mDoc->SendAccessibleAtPoint(mID, aX, aY, aNeedsScreenCoords,
|
||||||
|
static_cast<uint32_t>(Accessible::eDirectChild),
|
||||||
|
&childID, &ok);
|
||||||
|
return ok ? mDoc->GetAccessible(childID) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ProxyAccessible::Extents(bool aNeedsScreenCoords, int32_t* aX, int32_t* aY,
|
||||||
|
int32_t* aWidth, int32_t* aHeight)
|
||||||
|
{
|
||||||
|
unused << mDoc->SendExtents(mID, aNeedsScreenCoords, aX, aY, aWidth, aHeight);
|
||||||
|
}
|
||||||
|
|
||||||
Accessible*
|
Accessible*
|
||||||
ProxyAccessible::OuterDocOfRemoteBrowser() const
|
ProxyAccessible::OuterDocOfRemoteBrowser() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -319,6 +319,12 @@ public:
|
||||||
void URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
void URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
||||||
nsString& aMimeType);
|
nsString& aMimeType);
|
||||||
|
|
||||||
|
ProxyAccessible* AccessibleAtPoint(int32_t aX, int32_t aY,
|
||||||
|
bool aNeedsScreenCoords);
|
||||||
|
|
||||||
|
void Extents(bool aNeedsScreenCoords, int32_t* aX, int32_t* aY,
|
||||||
|
int32_t* aWidth, int32_t* aHeight);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow the platform to store a pointers worth of data on us.
|
* Allow the platform to store a pointers worth of data on us.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -419,9 +419,14 @@
|
||||||
oncommand="gContextMenu.switchPageDirection();"/>
|
oncommand="gContextMenu.switchPageDirection();"/>
|
||||||
<menuseparator id="fill-login-separator" hidden="true"/>
|
<menuseparator id="fill-login-separator" hidden="true"/>
|
||||||
<menu id="fill-login"
|
<menu id="fill-login"
|
||||||
label="&fillPasswordMenu.label;"
|
label="&fillLoginMenu.label;"
|
||||||
class="menu-iconic"
|
label-login="&fillLoginMenu.label;"
|
||||||
accesskey="&fillPasswordMenu.accesskey;"
|
label-password="&fillPasswordMenu.label;"
|
||||||
|
label-username="&fillUsernameMenu.label;"
|
||||||
|
accesskey="&fillLoginMenu.accesskey;"
|
||||||
|
accesskey-login="&fillLoginMenu.accesskey;"
|
||||||
|
accesskey-password="&fillPasswordMenu.accesskey;"
|
||||||
|
accesskey-username="&fillUsernameMenu.accesskey;"
|
||||||
hidden="true">
|
hidden="true">
|
||||||
<menupopup id="fill-login-popup">
|
<menupopup id="fill-login-popup">
|
||||||
<menuitem id="fill-login-no-logins"
|
<menuitem id="fill-login-no-logins"
|
||||||
|
|
|
@ -107,6 +107,7 @@ let handleContentContextMenu = function (event) {
|
||||||
let frameOuterWindowID = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
|
let frameOuterWindowID = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils)
|
.getInterface(Ci.nsIDOMWindowUtils)
|
||||||
.outerWindowID;
|
.outerWindowID;
|
||||||
|
let loginFillInfo = LoginManagerContent.getFieldContext(event.target);
|
||||||
|
|
||||||
// get referrer attribute from clicked link and parse it
|
// get referrer attribute from clicked link and parse it
|
||||||
// if per element referrer is enabled, the element referrer overrules
|
// if per element referrer is enabled, the element referrer overrules
|
||||||
|
@ -168,7 +169,8 @@ let handleContentContextMenu = function (event) {
|
||||||
{ editFlags, spellInfo, customMenuItems, addonInfo,
|
{ editFlags, spellInfo, customMenuItems, addonInfo,
|
||||||
principal, docLocation, charSet, baseURI, referrer,
|
principal, docLocation, charSet, baseURI, referrer,
|
||||||
referrerPolicy, contentType, contentDisposition,
|
referrerPolicy, contentType, contentDisposition,
|
||||||
frameOuterWindowID, selectionInfo, disableSetDesktopBg },
|
frameOuterWindowID, selectionInfo, disableSetDesktopBg,
|
||||||
|
loginFillInfo, },
|
||||||
{ event, popupNode: event.target });
|
{ event, popupNode: event.target });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -190,6 +192,7 @@ let handleContentContextMenu = function (event) {
|
||||||
contentDisposition: contentDisposition,
|
contentDisposition: contentDisposition,
|
||||||
selectionInfo: selectionInfo,
|
selectionInfo: selectionInfo,
|
||||||
disableSetDesktopBackground: disableSetDesktopBg,
|
disableSetDesktopBackground: disableSetDesktopBg,
|
||||||
|
loginFillInfo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -506,13 +506,35 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
initPasswordManagerItems: function() {
|
initPasswordManagerItems: function() {
|
||||||
let showFillPassword = this.onPassword;
|
let loginFillInfo = gContextMenuContentData && gContextMenuContentData.loginFillInfo;
|
||||||
let disableFillPassword = !Services.logins.isLoggedIn || this.target.disabled || this.target.readOnly;
|
|
||||||
this.showItem("fill-login-separator", showFillPassword);
|
|
||||||
this.showItem("fill-login", showFillPassword);
|
|
||||||
this.setItemAttr("fill-login", "disabled", disableFillPassword);
|
|
||||||
|
|
||||||
if (!showFillPassword || disableFillPassword) {
|
// If we could not find a password field we
|
||||||
|
// don't want to show the form fill option.
|
||||||
|
let showFill = loginFillInfo && loginFillInfo.passwordField.found;
|
||||||
|
|
||||||
|
// Disable the fill option if the user has set a master password
|
||||||
|
// or if the password field or target field are disabled.
|
||||||
|
let disableFill = !loginFillInfo ||
|
||||||
|
!Services.logins ||
|
||||||
|
!Services.logins.isLoggedIn ||
|
||||||
|
loginFillInfo.passwordField.disabled ||
|
||||||
|
(!this.onPassword && loginFillInfo.usernameField.disabled);
|
||||||
|
|
||||||
|
this.showItem("fill-login-separator", showFill);
|
||||||
|
this.showItem("fill-login", showFill);
|
||||||
|
this.setItemAttr("fill-login", "disabled", disableFill);
|
||||||
|
|
||||||
|
// Set the correct label for the fill menu
|
||||||
|
let fillMenu = document.getElementById("fill-login");
|
||||||
|
if (this.onPassword) {
|
||||||
|
fillMenu.setAttribute("label", fillMenu.getAttribute("label-password"));
|
||||||
|
fillMenu.setAttribute("accesskey", fillMenu.getAttribute("accesskey-password"));
|
||||||
|
} else {
|
||||||
|
fillMenu.setAttribute("label", fillMenu.getAttribute("label-login"));
|
||||||
|
fillMenu.setAttribute("accesskey", fillMenu.getAttribute("accesskey-login"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!showFill || disableFill) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let documentURI = gContextMenuContentData.documentURIObject;
|
let documentURI = gContextMenuContentData.documentURIObject;
|
||||||
|
|
|
@ -4056,6 +4056,7 @@
|
||||||
frameOuterWindowID: aMessage.data.frameOuterWindowID,
|
frameOuterWindowID: aMessage.data.frameOuterWindowID,
|
||||||
selectionInfo: aMessage.data.selectionInfo,
|
selectionInfo: aMessage.data.selectionInfo,
|
||||||
disableSetDesktopBackground: aMessage.data.disableSetDesktopBg,
|
disableSetDesktopBackground: aMessage.data.disableSetDesktopBg,
|
||||||
|
loginFillInfo: aMessage.data.loginFillInfo,
|
||||||
};
|
};
|
||||||
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
||||||
let event = gContextMenuContentData.event;
|
let event = gContextMenuContentData.event;
|
||||||
|
|
|
@ -80,7 +80,7 @@ function runTest(testNum) {
|
||||||
"context-inspect", true];
|
"context-inspect", true];
|
||||||
}
|
}
|
||||||
|
|
||||||
var passwordFillItems = [
|
var loginFillItems = [
|
||||||
"---", null,
|
"---", null,
|
||||||
"fill-login", null,
|
"fill-login", null,
|
||||||
[
|
[
|
||||||
|
@ -652,7 +652,8 @@ function runTest(testNum) {
|
||||||
"context-searchselect",true,
|
"context-searchselect",true,
|
||||||
"---", null,
|
"---", null,
|
||||||
"spell-check-enabled", true
|
"spell-check-enabled", true
|
||||||
].concat(inspectItems));
|
].concat(loginFillItems)
|
||||||
|
.concat(inspectItems));
|
||||||
closeContextMenu();
|
closeContextMenu();
|
||||||
selectInputText(select_inputtext_password); // Select text prior to opening context menu.
|
selectInputText(select_inputtext_password); // Select text prior to opening context menu.
|
||||||
openContextMenuFor(select_inputtext_password); // Invoke context menu for next test.
|
openContextMenuFor(select_inputtext_password); // Invoke context menu for next test.
|
||||||
|
@ -675,7 +676,7 @@ function runTest(testNum) {
|
||||||
["spell-check-dictionary-en-US", true,
|
["spell-check-dictionary-en-US", true,
|
||||||
"---", null,
|
"---", null,
|
||||||
"spell-add-dictionaries", true], null
|
"spell-add-dictionaries", true], null
|
||||||
].concat(passwordFillItems)
|
].concat(loginFillItems)
|
||||||
.concat(inspectItems));
|
.concat(inspectItems));
|
||||||
closeContextMenu();
|
closeContextMenu();
|
||||||
subwindow.getSelection().removeAllRanges();
|
subwindow.getSelection().removeAllRanges();
|
||||||
|
|
|
@ -193,8 +193,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
case KeyEvent.DOM_VK_LEFT:
|
case KeyEvent.DOM_VK_LEFT:
|
||||||
case KeyEvent.DOM_VK_RIGHT:
|
case KeyEvent.DOM_VK_RIGHT:
|
||||||
case KeyEvent.DOM_VK_HOME:
|
case KeyEvent.DOM_VK_HOME:
|
||||||
this.popup.hidePopup();
|
// Reset the selected index so that nsAutoCompleteController
|
||||||
return;
|
// simply closes the popup without trying to fill anything.
|
||||||
|
this.popup.selectedIndex = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ const BREAKPOINT_LINE_TOOLTIP_MAX_LENGTH = 1000; // chars
|
||||||
const BREAKPOINT_CONDITIONAL_POPUP_POSITION = "before_start";
|
const BREAKPOINT_CONDITIONAL_POPUP_POSITION = "before_start";
|
||||||
const BREAKPOINT_CONDITIONAL_POPUP_OFFSET_X = 7; // px
|
const BREAKPOINT_CONDITIONAL_POPUP_OFFSET_X = 7; // px
|
||||||
const BREAKPOINT_CONDITIONAL_POPUP_OFFSET_Y = -3; // px
|
const BREAKPOINT_CONDITIONAL_POPUP_OFFSET_Y = -3; // px
|
||||||
|
const BREAKPOINT_SMALL_WINDOW_WIDTH = 850; // px
|
||||||
const RESULTS_PANEL_POPUP_POSITION = "before_end";
|
const RESULTS_PANEL_POPUP_POSITION = "before_end";
|
||||||
const RESULTS_PANEL_MAX_RESULTS = 10;
|
const RESULTS_PANEL_MAX_RESULTS = 10;
|
||||||
const FILE_SEARCH_ACTION_MAX_DELAY = 300; // ms
|
const FILE_SEARCH_ACTION_MAX_DELAY = 300; // ms
|
||||||
|
@ -30,6 +31,7 @@ const SEARCH_AUTOFILL = [SEARCH_GLOBAL_FLAG, SEARCH_FUNCTION_FLAG, SEARCH_TOKEN_
|
||||||
const EDITOR_VARIABLE_HOVER_DELAY = 750; // ms
|
const EDITOR_VARIABLE_HOVER_DELAY = 750; // ms
|
||||||
const EDITOR_VARIABLE_POPUP_POSITION = "topcenter bottomleft";
|
const EDITOR_VARIABLE_POPUP_POSITION = "topcenter bottomleft";
|
||||||
const TOOLBAR_ORDER_POPUP_POSITION = "topcenter bottomleft";
|
const TOOLBAR_ORDER_POPUP_POSITION = "topcenter bottomleft";
|
||||||
|
const RESIZE_REFRESH_RATE = 50; // ms
|
||||||
const PROMISE_DEBUGGER_URL =
|
const PROMISE_DEBUGGER_URL =
|
||||||
"chrome://browser/content/devtools/promisedebugger/promise-debugger.xhtml";
|
"chrome://browser/content/devtools/promisedebugger/promise-debugger.xhtml";
|
||||||
|
|
||||||
|
@ -93,6 +95,8 @@ let DebuggerView = {
|
||||||
return this._shutdown;
|
return this._shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.removeEventListener("resize", this._onResize, false);
|
||||||
|
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
this._shutdown = deferred.promise;
|
this._shutdown = deferred.promise;
|
||||||
|
|
||||||
|
@ -141,10 +145,10 @@ let DebuggerView = {
|
||||||
this._instrumentsPane.setAttribute("width", Prefs.instrumentsWidth);
|
this._instrumentsPane.setAttribute("width", Prefs.instrumentsWidth);
|
||||||
this.toggleInstrumentsPane({ visible: Prefs.panesVisibleOnStartup });
|
this.toggleInstrumentsPane({ visible: Prefs.panesVisibleOnStartup });
|
||||||
|
|
||||||
// Side hosts requires a different arrangement of the debugger widgets.
|
this.updateLayoutMode();
|
||||||
if (gHostType == "side") {
|
|
||||||
this.handleHostChanged(gHostType);
|
this._onResize = this._onResize.bind(this);
|
||||||
}
|
window.addEventListener("resize", this._onResize, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -214,6 +218,17 @@ let DebuggerView = {
|
||||||
_initializePromiseDebugger: function() {
|
_initializePromiseDebugger: function() {
|
||||||
let iframe = this._promiseDebuggerIframe = document.createElement("iframe");
|
let iframe = this._promiseDebuggerIframe = document.createElement("iframe");
|
||||||
iframe.setAttribute("flex", 1);
|
iframe.setAttribute("flex", 1);
|
||||||
|
|
||||||
|
let onLoad = (event) => {
|
||||||
|
iframe.removeEventListener("load", onLoad, true);
|
||||||
|
|
||||||
|
let doc = event.target;
|
||||||
|
let win = doc.defaultView;
|
||||||
|
|
||||||
|
win.setPanel(DebuggerController._toolbox);
|
||||||
|
};
|
||||||
|
|
||||||
|
iframe.addEventListener("load", onLoad, true);
|
||||||
iframe.setAttribute("src", PROMISE_DEBUGGER_URL);
|
iframe.setAttribute("src", PROMISE_DEBUGGER_URL);
|
||||||
this._promisePane.appendChild(iframe);
|
this._promisePane.appendChild(iframe);
|
||||||
},
|
},
|
||||||
|
@ -223,6 +238,8 @@ let DebuggerView = {
|
||||||
*/
|
*/
|
||||||
_destroyPromiseDebugger: function() {
|
_destroyPromiseDebugger: function() {
|
||||||
if (this._promiseDebuggerIframe) {
|
if (this._promiseDebuggerIframe) {
|
||||||
|
this._promiseDebuggerIframe.contentWindow.destroy();
|
||||||
|
|
||||||
this._promiseDebuggerIframe.parentNode.removeChild(
|
this._promiseDebuggerIframe.parentNode.removeChild(
|
||||||
this._promiseDebuggerIframe);
|
this._promiseDebuggerIframe);
|
||||||
|
|
||||||
|
@ -619,24 +636,64 @@ let DebuggerView = {
|
||||||
* @param string aType
|
* @param string aType
|
||||||
* The host type, either "bottom", "side" or "window".
|
* The host type, either "bottom", "side" or "window".
|
||||||
*/
|
*/
|
||||||
handleHostChanged: function(aType) {
|
handleHostChanged: function(hostType) {
|
||||||
let newLayout = "";
|
this._hostType = hostType;
|
||||||
|
this.updateLayoutMode();
|
||||||
if (aType == "side") {
|
|
||||||
newLayout = "vertical";
|
|
||||||
this._enterVerticalLayout();
|
|
||||||
} else {
|
|
||||||
newLayout = "horizontal";
|
|
||||||
this._enterHorizontalLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._hostType = aType;
|
|
||||||
this._body.setAttribute("layout", newLayout);
|
|
||||||
window.emit(EVENTS.LAYOUT_CHANGED, newLayout);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switches the debugger widgets to a horizontal layout.
|
* Resize handler for this container's window.
|
||||||
|
*/
|
||||||
|
_onResize: function (evt) {
|
||||||
|
// Allow requests to settle down first.
|
||||||
|
setNamedTimeout(
|
||||||
|
"resize-events", RESIZE_REFRESH_RATE, () => this.updateLayoutMode());
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the layout to "vertical" or "horizontal" depending on the host type.
|
||||||
|
*/
|
||||||
|
updateLayoutMode: function() {
|
||||||
|
if (this._isSmallWindowHost() || this._hostType == "side") {
|
||||||
|
this._setLayoutMode("vertical");
|
||||||
|
} else {
|
||||||
|
this._setLayoutMode("horizontal");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the current host is in window mode and is
|
||||||
|
* too small for horizontal layout
|
||||||
|
*/
|
||||||
|
_isSmallWindowHost: function() {
|
||||||
|
if (this._hostType != "window") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window.outerWidth <= BREAKPOINT_SMALL_WINDOW_WIDTH;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter the provided layoutMode. Do nothing if the layout is the same as the current one.
|
||||||
|
* @param {String} layoutMode new layout ("vertical" or "horizontal")
|
||||||
|
*/
|
||||||
|
_setLayoutMode: function(layoutMode) {
|
||||||
|
if (this._body.getAttribute("layout") == layoutMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (layoutMode == "vertical") {
|
||||||
|
this._enterVerticalLayout();
|
||||||
|
} else {
|
||||||
|
this._enterHorizontalLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._body.setAttribute("layout", layoutMode);
|
||||||
|
window.emit(EVENTS.LAYOUT_CHANGED, layoutMode);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switches the debugger widgets to a vertical layout.
|
||||||
*/
|
*/
|
||||||
_enterVerticalLayout: function() {
|
_enterVerticalLayout: function() {
|
||||||
let vertContainer = document.getElementById("vertical-layout-panes-container");
|
let vertContainer = document.getElementById("vertical-layout-panes-container");
|
||||||
|
@ -653,7 +710,7 @@ let DebuggerView = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switches the debugger widgets to a vertical layout.
|
* Switches the debugger widgets to a horizontal layout.
|
||||||
*/
|
*/
|
||||||
_enterHorizontalLayout: function() {
|
_enterHorizontalLayout: function() {
|
||||||
let normContainer = document.getElementById("debugger-widgets");
|
let normContainer = document.getElementById("debugger-widgets");
|
||||||
|
|
|
@ -26,7 +26,7 @@ function DebuggerPanel(iframeWindow, toolbox) {
|
||||||
this.unhighlightWhenResumed = this.unhighlightWhenResumed.bind(this);
|
this.unhighlightWhenResumed = this.unhighlightWhenResumed.bind(this);
|
||||||
|
|
||||||
EventEmitter.decorate(this);
|
EventEmitter.decorate(this);
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.DebuggerPanel = DebuggerPanel;
|
exports.DebuggerPanel = DebuggerPanel;
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,22 @@
|
||||||
* host changes.
|
* host changes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
let gDefaultHostType = Services.prefs.getCharPref("devtools.toolbox.host");
|
let gDefaultHostType = Services.prefs.getCharPref("devtools.toolbox.host");
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
|
// test is too slow on some platforms due to the number of test cases
|
||||||
|
requestLongerTimeout(2);
|
||||||
|
|
||||||
Task.spawn(function*() {
|
Task.spawn(function*() {
|
||||||
yield testHosts(["bottom", "side", "window"], ["horizontal", "vertical", "horizontal"]);
|
yield testHosts(["bottom", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
|
||||||
yield testHosts(["side", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
|
yield testHosts(["side", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
|
||||||
yield testHosts(["bottom", "side", "bottom"], ["horizontal", "vertical", "horizontal"]);
|
yield testHosts(["bottom", "side", "bottom"], ["horizontal", "vertical", "horizontal"]);
|
||||||
yield testHosts(["side", "window", "side"], ["vertical", "horizontal", "vertical"]);
|
yield testHosts(["side", "window:big", "side"], ["vertical", "horizontal", "vertical"]);
|
||||||
yield testHosts(["window", "side", "window"], ["horizontal", "vertical", "horizontal"]);
|
yield testHosts(["window:big", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
|
||||||
|
yield testHosts(["window:small", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
|
||||||
|
yield testHosts(["window:small", "window:big", "window:small"], ["vertical", "horizontal", "vertical"]);
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -23,11 +30,15 @@ function testHosts(aHostTypes, aLayoutTypes) {
|
||||||
let [firstHost, secondHost, thirdHost] = aHostTypes;
|
let [firstHost, secondHost, thirdHost] = aHostTypes;
|
||||||
let [firstLayout, secondLayout, thirdLayout] = aLayoutTypes;
|
let [firstLayout, secondLayout, thirdLayout] = aLayoutTypes;
|
||||||
|
|
||||||
Services.prefs.setCharPref("devtools.toolbox.host", firstHost);
|
Services.prefs.setCharPref("devtools.toolbox.host", getHost(firstHost));
|
||||||
|
|
||||||
return Task.spawn(function*() {
|
return Task.spawn(function*() {
|
||||||
let [tab, debuggee, panel] = yield initDebugger("about:blank");
|
let [tab, debuggee, panel] = yield initDebugger("about:blank");
|
||||||
yield testHost(tab, panel, firstHost, firstLayout);
|
if (getHost(firstHost) === "window") {
|
||||||
|
yield resizeToolboxWindow(panel, firstHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
yield testHost(panel, getHost(firstHost), firstLayout);
|
||||||
yield switchAndTestHost(tab, panel, secondHost, secondLayout);
|
yield switchAndTestHost(tab, panel, secondHost, secondLayout);
|
||||||
yield switchAndTestHost(tab, panel, thirdHost, thirdLayout);
|
yield switchAndTestHost(tab, panel, thirdHost, thirdLayout);
|
||||||
yield teardown(panel);
|
yield teardown(panel);
|
||||||
|
@ -39,26 +50,63 @@ function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
|
||||||
let gDebugger = aPanel.panelWin;
|
let gDebugger = aPanel.panelWin;
|
||||||
|
|
||||||
return Task.spawn(function*() {
|
return Task.spawn(function*() {
|
||||||
let layoutChanged = once(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
|
let layoutChanged = waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
|
||||||
let hostChanged = gToolbox.switchHost(aHostType);
|
let hostChanged = gToolbox.switchHost(getHost(aHostType));
|
||||||
|
|
||||||
yield hostChanged;
|
yield hostChanged;
|
||||||
ok(true, "The toolbox's host has changed.");
|
info("The toolbox's host has changed.");
|
||||||
|
|
||||||
|
if (getHost(aHostType) === "window") {
|
||||||
|
yield resizeToolboxWindow(aPanel, aHostType);
|
||||||
|
}
|
||||||
|
|
||||||
yield layoutChanged;
|
yield layoutChanged;
|
||||||
ok(true, "The debugger's layout has changed.");
|
info("The debugger's layout has changed.");
|
||||||
|
|
||||||
yield testHost(aTab, aPanel, aHostType, aLayoutType);
|
yield testHost(aPanel, getHost(aHostType), aLayoutType);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function once(aTarget, aEvent) {
|
function waitEventOnce(aTarget, aEvent) {
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
aTarget.once(aEvent, deferred.resolve);
|
aTarget.once(aEvent, deferred.resolve);
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHost(host) {
|
||||||
|
if (host.indexOf("window") == 0) {
|
||||||
|
return "window";
|
||||||
|
}
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resizeToolboxWindow(panel, host) {
|
||||||
|
let sizeOption = host.split(":")[1];
|
||||||
|
let win = panel._toolbox._host._window;
|
||||||
|
|
||||||
|
// should be the same value as BREAKPOINT_SMALL_WINDOW_WIDTH in debugger-view.js
|
||||||
|
let breakpoint = 850;
|
||||||
|
|
||||||
|
if (sizeOption == "big" && win.outerWidth <= breakpoint) {
|
||||||
|
yield resizeAndWaitForLayoutChange(panel, breakpoint + 300);
|
||||||
|
} else if (sizeOption == "small" && win.outerWidth >= breakpoint) {
|
||||||
|
yield resizeAndWaitForLayoutChange(panel, breakpoint - 300);
|
||||||
|
} else {
|
||||||
|
info("Window resize unnecessary for host " + host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testHost(aTab, aPanel, aHostType, aLayoutType) {
|
function resizeAndWaitForLayoutChange(panel, width) {
|
||||||
|
info("Updating toolbox window width to " + width);
|
||||||
|
|
||||||
|
let win = panel._toolbox._host._window;
|
||||||
|
let gDebugger = panel.panelWin;
|
||||||
|
|
||||||
|
win.resizeTo(width, window.screen.availHeight);
|
||||||
|
yield waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testHost(aPanel, aHostType, aLayoutType) {
|
||||||
let gDebugger = aPanel.panelWin;
|
let gDebugger = aPanel.panelWin;
|
||||||
let gView = gDebugger.DebuggerView;
|
let gView = gDebugger.DebuggerView;
|
||||||
|
|
||||||
|
|
|
@ -621,8 +621,10 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||||
let promisePane = this.DebuggerView._promisePane;
|
let promisePane = this.DebuggerView._promisePane;
|
||||||
promisePane.hidden = !promisePane.hidden;
|
promisePane.hidden = !promisePane.hidden;
|
||||||
|
|
||||||
|
if (!this.DebuggerView._promiseDebuggerIframe) {
|
||||||
this.DebuggerView._initializePromiseDebugger();
|
this.DebuggerView._initializePromiseDebugger();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hidePrettyPrinting: function() {
|
hidePrettyPrinting: function() {
|
||||||
|
|
|
@ -110,7 +110,8 @@ browser.jar:
|
||||||
content/browser/devtools/performance/views/details-memory-flamegraph.js (performance/views/details-memory-flamegraph.js)
|
content/browser/devtools/performance/views/details-memory-flamegraph.js (performance/views/details-memory-flamegraph.js)
|
||||||
content/browser/devtools/performance/views/optimizations-list.js (performance/views/optimizations-list.js)
|
content/browser/devtools/performance/views/optimizations-list.js (performance/views/optimizations-list.js)
|
||||||
content/browser/devtools/performance/views/recordings.js (performance/views/recordings.js)
|
content/browser/devtools/performance/views/recordings.js (performance/views/recordings.js)
|
||||||
content/browser/devtools/promisedebugger/promise-debugger.js (promisedebugger/promise-debugger.js)
|
content/browser/devtools/promisedebugger/promise-controller.js (promisedebugger/promise-controller.js)
|
||||||
|
content/browser/devtools/promisedebugger/promise-panel.js (promisedebugger/promise-panel.js)
|
||||||
content/browser/devtools/promisedebugger/promise-debugger.xhtml (promisedebugger/promise-debugger.xhtml)
|
content/browser/devtools/promisedebugger/promise-debugger.xhtml (promisedebugger/promise-debugger.xhtml)
|
||||||
content/browser/devtools/commandline.css (commandline/commandline.css)
|
content/browser/devtools/commandline.css (commandline/commandline.css)
|
||||||
content/browser/devtools/commandlineoutput.xhtml (commandline/commandlineoutput.xhtml)
|
content/browser/devtools/commandlineoutput.xhtml (commandline/commandlineoutput.xhtml)
|
||||||
|
|
|
@ -259,17 +259,34 @@ MarkupView.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseUp: function() {
|
_onMouseUp: function() {
|
||||||
if (this._lastDropTarget) {
|
|
||||||
this.indicateDropTarget(null);
|
this.indicateDropTarget(null);
|
||||||
}
|
|
||||||
if (this._lastDragTarget) {
|
|
||||||
this.indicateDragTarget(null);
|
this.indicateDragTarget(null);
|
||||||
}
|
|
||||||
if (this._scrollInterval) {
|
if (this._scrollInterval) {
|
||||||
clearInterval(this._scrollInterval);
|
clearInterval(this._scrollInterval);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cancelDragging: function() {
|
||||||
|
if (!this.isDragging) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let [, container] of this._containers) {
|
||||||
|
if (container.isDragging) {
|
||||||
|
container.cancelDragging();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.indicateDropTarget(null);
|
||||||
|
this.indicateDragTarget(null);
|
||||||
|
if (this._scrollInterval) {
|
||||||
|
clearInterval(this._scrollInterval);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_hoveredNode: null,
|
_hoveredNode: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -632,6 +649,12 @@ MarkupView.prototype = {
|
||||||
this.beginEditingOuterHTML(this._selectedContainer.node);
|
this.beginEditingOuterHTML(this._selectedContainer.node);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE: {
|
||||||
|
if (this.isDragging) {
|
||||||
|
this.cancelDragging();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
handled = false;
|
handled = false;
|
||||||
}
|
}
|
||||||
|
@ -1927,6 +1950,18 @@ MarkupContainer.prototype = {
|
||||||
return this._isDragging;
|
return this._isDragging;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if element is draggable
|
||||||
|
*/
|
||||||
|
isDraggable: function(target) {
|
||||||
|
return this._isMouseDown &&
|
||||||
|
this.markup._dragStartEl === target &&
|
||||||
|
!this.node.isPseudoElement &&
|
||||||
|
!this.node.isAnonymous &&
|
||||||
|
this.win.getSelection().isCollapsed &&
|
||||||
|
this.node.parentNode().tagName !== null;
|
||||||
|
},
|
||||||
|
|
||||||
_onMouseDown: function(event) {
|
_onMouseDown: function(event) {
|
||||||
let target = event.target;
|
let target = event.target;
|
||||||
|
|
||||||
|
@ -1964,9 +1999,7 @@ MarkupContainer.prototype = {
|
||||||
this.markup._dragStartEl = target;
|
this.markup._dragStartEl = target;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Make sure the mouse is still down and on target.
|
// Make sure the mouse is still down and on target.
|
||||||
if (!this._isMouseDown || this.markup._dragStartEl !== target ||
|
if (!this.isDraggable(target)) {
|
||||||
this.node.isPseudoElement || this.node.isAnonymous ||
|
|
||||||
!this.win.getSelection().isCollapsed) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isDragging = true;
|
this.isDragging = true;
|
||||||
|
@ -1990,8 +2023,7 @@ MarkupContainer.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isDragging = false;
|
this.cancelDragging();
|
||||||
this.elt.style.removeProperty("top");
|
|
||||||
|
|
||||||
let dropTargetNodes = this.markup.dropTargetNodes;
|
let dropTargetNodes = this.markup.dropTargetNodes;
|
||||||
|
|
||||||
|
@ -2021,6 +2053,16 @@ MarkupContainer.prototype = {
|
||||||
this.markup.indicateDropTarget(el);
|
this.markup.indicateDropTarget(el);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cancelDragging: function() {
|
||||||
|
if (!this.isDragging) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isMouseDown = false;
|
||||||
|
this.isDragging = false;
|
||||||
|
this.elt.style.removeProperty("top");
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporarily flash the container to attract attention.
|
* Temporarily flash the container to attract attention.
|
||||||
* Used for markup mutations.
|
* Used for markup mutations.
|
||||||
|
|
|
@ -45,6 +45,8 @@ skip-if = e10s # scratchpad.xul is not loading in e10s window
|
||||||
[browser_markupview_copy_image_data.js]
|
[browser_markupview_copy_image_data.js]
|
||||||
[browser_markupview_css_completion_style_attribute.js]
|
[browser_markupview_css_completion_style_attribute.js]
|
||||||
[browser_markupview_dragdrop_autoscroll.js]
|
[browser_markupview_dragdrop_autoscroll.js]
|
||||||
|
[browser_markupview_dragdrop_dragRootNode.js]
|
||||||
|
[browser_markupview_dragdrop_escapeKeyPress.js]
|
||||||
[browser_markupview_dragdrop_invalidNodes.js]
|
[browser_markupview_dragdrop_invalidNodes.js]
|
||||||
[browser_markupview_dragdrop_isDragging.js]
|
[browser_markupview_dragdrop_isDragging.js]
|
||||||
[browser_markupview_dragdrop_reorder.js]
|
[browser_markupview_dragdrop_reorder.js]
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Test if html root node is draggable
|
||||||
|
|
||||||
|
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop.html";
|
||||||
|
const GRAB_DELAY = 400;
|
||||||
|
|
||||||
|
add_task(function*() {
|
||||||
|
let {inspector} = yield addTab(TEST_URL).then(openInspector);
|
||||||
|
|
||||||
|
let el = yield getContainerForSelector("html", inspector);
|
||||||
|
let rect = el.tagLine.getBoundingClientRect();
|
||||||
|
|
||||||
|
info("Simulating mouseDown on html root node");
|
||||||
|
el._onMouseDown({
|
||||||
|
target: el.tagLine,
|
||||||
|
pageX: rect.x,
|
||||||
|
pageY: rect.y,
|
||||||
|
stopPropagation: function() {},
|
||||||
|
preventDefault: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
|
info("Waiting for a little bit more than the markup-view grab delay");
|
||||||
|
yield wait(GRAB_DELAY + 1);
|
||||||
|
is(el.isDragging, false, "isDragging is false");
|
||||||
|
});
|
|
@ -0,0 +1,34 @@
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Test whether ESCAPE keypress cancels dragging of an element
|
||||||
|
|
||||||
|
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop.html";
|
||||||
|
const GRAB_DELAY = 400;
|
||||||
|
|
||||||
|
add_task(function*() {
|
||||||
|
let {inspector} = yield addTab(TEST_URL).then(openInspector);
|
||||||
|
|
||||||
|
let el = yield getContainerForSelector("#test", inspector);
|
||||||
|
let rect = el.tagLine.getBoundingClientRect();
|
||||||
|
|
||||||
|
info("Simulating mouseDown on #test");
|
||||||
|
el._onMouseDown({
|
||||||
|
target: el.tagLine,
|
||||||
|
pageX: rect.x,
|
||||||
|
pageY: rect.y,
|
||||||
|
stopPropagation: function() {},
|
||||||
|
preventDefault: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
|
info("Waiting for a little bit more than the markup-view grab delay");
|
||||||
|
yield wait(GRAB_DELAY + 1);
|
||||||
|
ok(el.isDragging, "isDragging true after mouseDown");
|
||||||
|
|
||||||
|
info("Simulating ESCAPE keypress");
|
||||||
|
EventUtils.sendKey("escape", inspector.panelWin);
|
||||||
|
is(el.isDragging, false, "isDragging false after ESCAPE keypress");
|
||||||
|
});
|
|
@ -7,5 +7,4 @@
|
||||||
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
|
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
|
||||||
|
|
||||||
EXTRA_JS_MODULES.devtools.promisedebugger += [
|
EXTRA_JS_MODULES.devtools.promisedebugger += [
|
||||||
'promise-debugger.js'
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||||
|
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
/* global promise, PromisesPanel, PromisesFront, DevToolsUtils */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const { utils: Cu } = Components;
|
||||||
|
const { loader, require } =
|
||||||
|
Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||||
|
|
||||||
|
const { Task } = require("resource://gre/modules/Task.jsm");
|
||||||
|
|
||||||
|
loader.lazyRequireGetter(this, "promise");
|
||||||
|
loader.lazyRequireGetter(this, "EventEmitter",
|
||||||
|
"devtools/toolkit/event-emitter");
|
||||||
|
loader.lazyRequireGetter(this, "DevToolsUtils",
|
||||||
|
"devtools/toolkit/DevToolsUtils");
|
||||||
|
loader.lazyRequireGetter(this, "PromisesFront",
|
||||||
|
"devtools/server/actors/promises", true);
|
||||||
|
|
||||||
|
// Global toolbox, set when startup is called.
|
||||||
|
let gToolbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the promise debugger controller and view upon loading the iframe.
|
||||||
|
*/
|
||||||
|
let startup = Task.async(function*(toolbox) {
|
||||||
|
gToolbox = toolbox;
|
||||||
|
|
||||||
|
yield PromisesController.initialize(toolbox);
|
||||||
|
yield PromisesPanel.initialize();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy the promise debugger controller and view when unloading the iframe.
|
||||||
|
*/
|
||||||
|
let shutdown = Task.async(function*() {
|
||||||
|
yield PromisesController.destroy();
|
||||||
|
yield PromisesPanel.destroy();
|
||||||
|
|
||||||
|
gToolbox = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
function setPanel(toolbox) {
|
||||||
|
return startup(toolbox).catch(e =>
|
||||||
|
DevToolsUtils.reportException("setPanel", e));
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy() {
|
||||||
|
return shutdown().catch(e => DevToolsUtils.reportException("destroy", e));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The promisedebugger controller's job is to retrieve PromisesFronts from the
|
||||||
|
* server.
|
||||||
|
*/
|
||||||
|
let PromisesController = {
|
||||||
|
initialize: Task.async(function*() {
|
||||||
|
if (this.initialized) {
|
||||||
|
return this.initialized.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initialized = promise.defer();
|
||||||
|
|
||||||
|
let target = gToolbox.target;
|
||||||
|
this.promisesFront = new PromisesFront(target.client, target.form);
|
||||||
|
yield this.promisesFront.attach();
|
||||||
|
|
||||||
|
if (this.destroyed) {
|
||||||
|
console.warn("Could not fully initialize the PromisesController");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initialized.resolve();
|
||||||
|
}),
|
||||||
|
|
||||||
|
destroy: Task.async(function*() {
|
||||||
|
if (!this.initialized) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.destroyed) {
|
||||||
|
return this.destroyed.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.destroyed = promise.defer();
|
||||||
|
|
||||||
|
if (this.promisesFront) {
|
||||||
|
yield this.promisesFront.detach();
|
||||||
|
this.promisesFront.destroy();
|
||||||
|
this.promisesFront = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.destroyed.resolve();
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
EventEmitter.decorate(PromisesController);
|
|
@ -1,7 +0,0 @@
|
||||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
||||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
"use strict";
|
|
|
@ -17,6 +17,7 @@
|
||||||
<script type="application/javascript;version=1.8" src="chrome://browser/content/devtools/theme-switching.js"/>
|
<script type="application/javascript;version=1.8" src="chrome://browser/content/devtools/theme-switching.js"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="devtools-monospace" role="application">
|
<body class="devtools-monospace" role="application">
|
||||||
<script type="application/javascript;version=1.8" src="promise-debugger.js"></script>
|
<script type="application/javascript;version=1.8" src="promise-controller.js"></script>
|
||||||
|
<script type="application/javascript;version=1.8" src="promise-panel.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||||
|
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
/* global PromisesController, promise */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main promise debugger UI.
|
||||||
|
*/
|
||||||
|
let PromisesPanel = {
|
||||||
|
PANEL_INITIALIZED: "panel-initialized",
|
||||||
|
|
||||||
|
initialize: Task.async(function*() {
|
||||||
|
if (PromisesController.destroyed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (this.initialized) {
|
||||||
|
return this.initialized.promise;
|
||||||
|
}
|
||||||
|
this.initialized = promise.defer();
|
||||||
|
|
||||||
|
this.initialized.resolve();
|
||||||
|
|
||||||
|
this.emit(this.PANEL_INITIALIZED);
|
||||||
|
}),
|
||||||
|
|
||||||
|
destroy: Task.async(function*() {
|
||||||
|
if (!this.initialized) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (this.destroyed) {
|
||||||
|
return this.destroyed.promise;
|
||||||
|
}
|
||||||
|
this.destroyed = promise.defer();
|
||||||
|
|
||||||
|
this.destroyed.resolve();
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
EventEmitter.decorate(PromisesPanel);
|
|
@ -95,13 +95,3 @@
|
||||||
#context-media-eme-learnmore {
|
#context-media-eme-learnmore {
|
||||||
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains");
|
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains");
|
||||||
}
|
}
|
||||||
|
|
||||||
#fill-login {
|
|
||||||
list-style-image: url("chrome://mozapps/skin/passwordmgr/key-16.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-resolution: 1.1dppx) {
|
|
||||||
#fill-login {
|
|
||||||
list-style-image: url("chrome://mozapps/skin/passwordmgr/key-16@2x.png");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1019,13 +1019,7 @@ DiagnosticsMatcher::DiagnosticsMatcher() {
|
||||||
// lambda, where the declaration they reference is not inside the lambda.
|
// lambda, where the declaration they reference is not inside the lambda.
|
||||||
// This excludes arguments and local variables, leaving only captured
|
// This excludes arguments and local variables, leaving only captured
|
||||||
// variables.
|
// variables.
|
||||||
astMatcher.addMatcher(
|
astMatcher.addMatcher(lambdaExpr().bind("lambda"), &refCountedInsideLambdaChecker);
|
||||||
lambdaExpr(hasDescendant(
|
|
||||||
declRefExpr(hasType(pointerType(pointee(isRefCounted()))),
|
|
||||||
to(decl().bind("decl")))
|
|
||||||
.bind("declref")),
|
|
||||||
unless(hasDescendant(decl(equalsBoundNode("decl"))))),
|
|
||||||
&refCountedInsideLambdaChecker);
|
|
||||||
|
|
||||||
// Older clang versions such as the ones used on the infra recognize these
|
// Older clang versions such as the ones used on the infra recognize these
|
||||||
// conversions as 'operator _Bool', but newer clang versions recognize these
|
// conversions as 'operator _Bool', but newer clang versions recognize these
|
||||||
|
@ -1252,11 +1246,19 @@ void DiagnosticsMatcher::RefCountedInsideLambdaChecker::run(
|
||||||
"Refcounted variable %0 of type %1 cannot be captured by a lambda");
|
"Refcounted variable %0 of type %1 cannot be captured by a lambda");
|
||||||
unsigned noteID = Diag.getDiagnosticIDs()->getCustomDiagID(
|
unsigned noteID = Diag.getDiagnosticIDs()->getCustomDiagID(
|
||||||
DiagnosticIDs::Note, "Please consider using a smart pointer");
|
DiagnosticIDs::Note, "Please consider using a smart pointer");
|
||||||
const DeclRefExpr *declref = Result.Nodes.getNodeAs<DeclRefExpr>("declref");
|
const LambdaExpr *Lambda = Result.Nodes.getNodeAs<LambdaExpr>("lambda");
|
||||||
|
|
||||||
Diag.Report(declref->getLocStart(), errorID)
|
for (const LambdaCapture Capture : Lambda->captures()) {
|
||||||
<< declref->getFoundDecl() << declref->getType()->getPointeeType();
|
if (Capture.capturesVariable()) {
|
||||||
Diag.Report(declref->getLocStart(), noteID);
|
QualType Pointee = Capture.getCapturedVar()->getType()->getPointeeType();
|
||||||
|
|
||||||
|
if (!Pointee.isNull() && isClassRefCounted(Pointee)) {
|
||||||
|
Diag.Report(Capture.getLocation(), errorID)
|
||||||
|
<< Capture.getCapturedVar() << Pointee;
|
||||||
|
Diag.Report(Capture.getLocation(), noteID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagnosticsMatcher::ExplicitOperatorBoolChecker::run(
|
void DiagnosticsMatcher::ExplicitOperatorBoolChecker::run(
|
||||||
|
|
|
@ -67,9 +67,9 @@ void foo() {
|
||||||
take(argsp);
|
take(argsp);
|
||||||
take(localsp);
|
take(localsp);
|
||||||
});
|
});
|
||||||
take([ptr](R* argptr) {
|
take([ptr](R* argptr) { // expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
|
||||||
R* localptr;
|
R* localptr;
|
||||||
ptr->method(); // expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
|
ptr->method();
|
||||||
argptr->method();
|
argptr->method();
|
||||||
localptr->method();
|
localptr->method();
|
||||||
});
|
});
|
||||||
|
@ -79,9 +79,9 @@ void foo() {
|
||||||
argsp->method();
|
argsp->method();
|
||||||
localsp->method();
|
localsp->method();
|
||||||
});
|
});
|
||||||
take([ptr](R* argptr) {
|
take([ptr](R* argptr) { // expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
|
||||||
R* localptr;
|
R* localptr;
|
||||||
take(ptr); // expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
|
take(ptr);
|
||||||
take(argptr);
|
take(argptr);
|
||||||
take(localptr);
|
take(localptr);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2852,7 +2852,7 @@ Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
|
||||||
(!aVisitor.mEvent->mFlags.mIsTrusted &&
|
(!aVisitor.mEvent->mFlags.mIsTrusted &&
|
||||||
(aVisitor.mEvent->mMessage != eMouseClick) &&
|
(aVisitor.mEvent->mMessage != eMouseClick) &&
|
||||||
(aVisitor.mEvent->mMessage != eKeyPress) &&
|
(aVisitor.mEvent->mMessage != eKeyPress) &&
|
||||||
(aVisitor.mEvent->mMessage != NS_UI_ACTIVATE)) ||
|
(aVisitor.mEvent->mMessage != eLegacyDOMActivate)) ||
|
||||||
!aVisitor.mPresContext ||
|
!aVisitor.mPresContext ||
|
||||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
|
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2869,9 +2869,9 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
|
||||||
// IMPORTANT: this switch and the switch below it must be kept in sync!
|
// IMPORTANT: this switch and the switch below it must be kept in sync!
|
||||||
switch (aVisitor.mEvent->mMessage) {
|
switch (aVisitor.mEvent->mMessage) {
|
||||||
case eMouseOver:
|
case eMouseOver:
|
||||||
case NS_FOCUS_CONTENT:
|
case eFocus:
|
||||||
case eMouseOut:
|
case eMouseOut:
|
||||||
case NS_BLUR_CONTENT:
|
case eBlur:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2892,7 +2892,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
|
||||||
case eMouseOver:
|
case eMouseOver:
|
||||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
// FALL THROUGH
|
// FALL THROUGH
|
||||||
case NS_FOCUS_CONTENT: {
|
case eFocus: {
|
||||||
InternalFocusEvent* focusEvent = aVisitor.mEvent->AsFocusEvent();
|
InternalFocusEvent* focusEvent = aVisitor.mEvent->AsFocusEvent();
|
||||||
if (!focusEvent || !focusEvent->isRefocus) {
|
if (!focusEvent || !focusEvent->isRefocus) {
|
||||||
nsAutoString target;
|
nsAutoString target;
|
||||||
|
@ -2907,7 +2907,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
|
||||||
case eMouseOut:
|
case eMouseOut:
|
||||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
// FALL THROUGH
|
// FALL THROUGH
|
||||||
case NS_BLUR_CONTENT:
|
case eBlur:
|
||||||
rv = LeaveLink(aVisitor.mPresContext);
|
rv = LeaveLink(aVisitor.mPresContext);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||||
|
@ -2931,7 +2931,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||||
switch (aVisitor.mEvent->mMessage) {
|
switch (aVisitor.mEvent->mMessage) {
|
||||||
case eMouseDown:
|
case eMouseDown:
|
||||||
case eMouseClick:
|
case eMouseClick:
|
||||||
case NS_UI_ACTIVATE:
|
case eLegacyDOMActivate:
|
||||||
case eKeyPress:
|
case eKeyPress:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2985,7 +2985,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
// DOMActive event should be trusted since the activation is actually
|
// DOMActive event should be trusted since the activation is actually
|
||||||
// occurred even if the cause is an untrusted click event.
|
// occurred even if the cause is an untrusted click event.
|
||||||
InternalUIEvent actEvent(true, NS_UI_ACTIVATE, mouseEvent);
|
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
||||||
actEvent.detail = 1;
|
actEvent.detail = 1;
|
||||||
|
|
||||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||||
|
@ -2996,7 +2996,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NS_UI_ACTIVATE:
|
case eLegacyDOMActivate:
|
||||||
{
|
{
|
||||||
if (aVisitor.mEvent->originalTarget == this) {
|
if (aVisitor.mEvent->originalTarget == this) {
|
||||||
nsAutoString target;
|
nsAutoString target;
|
||||||
|
|
|
@ -69,6 +69,7 @@ EventSource::EventSource(nsPIDOMWindow* aOwnerWindow) :
|
||||||
mLastConvertionResult(NS_OK),
|
mLastConvertionResult(NS_OK),
|
||||||
mReadyState(CONNECTING),
|
mReadyState(CONNECTING),
|
||||||
mScriptLine(0),
|
mScriptLine(0),
|
||||||
|
mScriptColumn(0),
|
||||||
mInnerWindowID(0)
|
mInnerWindowID(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -205,7 +206,8 @@ EventSource::Init(nsISupports* aOwner,
|
||||||
|
|
||||||
// The conditional here is historical and not necessarily sane.
|
// The conditional here is historical and not necessarily sane.
|
||||||
if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
|
if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
|
||||||
nsJSUtils::GetCallingLocation(cx, mScriptFile, &mScriptLine);
|
nsJSUtils::GetCallingLocation(cx, mScriptFile, &mScriptLine,
|
||||||
|
&mScriptColumn);
|
||||||
mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx);
|
mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,7 +989,7 @@ EventSource::PrintErrorOnConsole(const char *aBundleURI,
|
||||||
rv = errObj->InitWithWindowID(message,
|
rv = errObj->InitWithWindowID(message,
|
||||||
mScriptFile,
|
mScriptFile,
|
||||||
EmptyString(),
|
EmptyString(),
|
||||||
mScriptLine, 0,
|
mScriptLine, mScriptColumn,
|
||||||
nsIScriptError::errorFlag,
|
nsIScriptError::errorFlag,
|
||||||
"Event Source", mInnerWindowID);
|
"Event Source", mInnerWindowID);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
|
@ -255,12 +255,14 @@ protected:
|
||||||
|
|
||||||
// Event Source owner information:
|
// Event Source owner information:
|
||||||
// - the script file name
|
// - the script file name
|
||||||
// - source code line number where the Event Source object was constructed.
|
// - source code line number and column number where the Event Source object
|
||||||
|
// was constructed.
|
||||||
// - the ID of the inner window where the script lives. Note that this may not
|
// - the ID of the inner window where the script lives. Note that this may not
|
||||||
// be the same as the Event Source owner window.
|
// be the same as the Event Source owner window.
|
||||||
// These attributes are used for error reporting.
|
// These attributes are used for error reporting.
|
||||||
nsString mScriptFile;
|
nsString mScriptFile;
|
||||||
uint32_t mScriptLine;
|
uint32_t mScriptLine;
|
||||||
|
uint32_t mScriptColumn;
|
||||||
uint64_t mInnerWindowID;
|
uint64_t mInnerWindowID;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -806,12 +806,12 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
// selectstart
|
// selectstart
|
||||||
bool stopEvent = false;
|
bool stopEvent = false;
|
||||||
switch (aVisitor.mEvent->mMessage) {
|
switch (aVisitor.mEvent->mMessage) {
|
||||||
case NS_IMAGE_ABORT:
|
case eImageAbort:
|
||||||
case NS_LOAD_ERROR:
|
case eLoadError:
|
||||||
case NS_FORM_SELECTED:
|
case eFormSelect:
|
||||||
case NS_FORM_CHANGE:
|
case eFormChange:
|
||||||
case NS_LOAD:
|
case eLoad:
|
||||||
case NS_FORM_RESET:
|
case eFormReset:
|
||||||
case eResize:
|
case eResize:
|
||||||
case eScroll:
|
case eScroll:
|
||||||
stopEvent = true;
|
stopEvent = true;
|
||||||
|
@ -843,7 +843,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
// The load event is special in that we don't ever propagate it
|
// The load event is special in that we don't ever propagate it
|
||||||
// to chrome.
|
// to chrome.
|
||||||
nsCOMPtr<nsPIDOMWindow> win = OwnerDoc()->GetWindow();
|
nsCOMPtr<nsPIDOMWindow> win = OwnerDoc()->GetWindow();
|
||||||
EventTarget* parentTarget = win && aVisitor.mEvent->mMessage != NS_LOAD
|
EventTarget* parentTarget = win && aVisitor.mEvent->mMessage != eLoad
|
||||||
? win->GetParentTarget() : nullptr;
|
? win->GetParentTarget() : nullptr;
|
||||||
|
|
||||||
aVisitor.mParentTarget = parentTarget;
|
aVisitor.mParentTarget = parentTarget;
|
||||||
|
|
|
@ -92,6 +92,7 @@ public:
|
||||||
, mCloseEventWasClean(false)
|
, mCloseEventWasClean(false)
|
||||||
, mCloseEventCode(nsIWebSocketChannel::CLOSE_ABNORMAL)
|
, mCloseEventCode(nsIWebSocketChannel::CLOSE_ABNORMAL)
|
||||||
, mScriptLine(0)
|
, mScriptLine(0)
|
||||||
|
, mScriptColumn(0)
|
||||||
, mInnerWindowID(0)
|
, mInnerWindowID(0)
|
||||||
, mWorkerPrivate(nullptr)
|
, mWorkerPrivate(nullptr)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -121,6 +122,7 @@ public:
|
||||||
nsTArray<nsString>& aProtocolArray,
|
nsTArray<nsString>& aProtocolArray,
|
||||||
const nsACString& aScriptFile,
|
const nsACString& aScriptFile,
|
||||||
uint32_t aScriptLine,
|
uint32_t aScriptLine,
|
||||||
|
uint32_t aScriptColumn,
|
||||||
ErrorResult& aRv,
|
ErrorResult& aRv,
|
||||||
bool* aConnectionFailed);
|
bool* aConnectionFailed);
|
||||||
|
|
||||||
|
@ -197,12 +199,14 @@ public:
|
||||||
|
|
||||||
// Web Socket owner information:
|
// Web Socket owner information:
|
||||||
// - the script file name, UTF8 encoded.
|
// - the script file name, UTF8 encoded.
|
||||||
// - source code line number where the Web Socket object was constructed.
|
// - source code line number and column number where the Web Socket object
|
||||||
|
// was constructed.
|
||||||
// - the ID of the inner window where the script lives. Note that this may not
|
// - the ID of the inner window where the script lives. Note that this may not
|
||||||
// be the same as the Web Socket owner window.
|
// be the same as the Web Socket owner window.
|
||||||
// These attributes are used for error reporting.
|
// These attributes are used for error reporting.
|
||||||
nsCString mScriptFile;
|
nsCString mScriptFile;
|
||||||
uint32_t mScriptLine;
|
uint32_t mScriptLine;
|
||||||
|
uint32_t mScriptColumn;
|
||||||
uint64_t mInnerWindowID;
|
uint64_t mInnerWindowID;
|
||||||
|
|
||||||
WorkerPrivate* mWorkerPrivate;
|
WorkerPrivate* mWorkerPrivate;
|
||||||
|
@ -370,13 +374,14 @@ WebSocketImpl::PrintErrorOnConsole(const char *aBundleURI,
|
||||||
if (mInnerWindowID) {
|
if (mInnerWindowID) {
|
||||||
rv = errorObject->InitWithWindowID(message,
|
rv = errorObject->InitWithWindowID(message,
|
||||||
NS_ConvertUTF8toUTF16(mScriptFile),
|
NS_ConvertUTF8toUTF16(mScriptFile),
|
||||||
EmptyString(), mScriptLine, 0,
|
EmptyString(), mScriptLine,
|
||||||
|
mScriptColumn,
|
||||||
nsIScriptError::errorFlag, "Web Socket",
|
nsIScriptError::errorFlag, "Web Socket",
|
||||||
mInnerWindowID);
|
mInnerWindowID);
|
||||||
} else {
|
} else {
|
||||||
rv = errorObject->Init(message,
|
rv = errorObject->Init(message,
|
||||||
NS_ConvertUTF8toUTF16(mScriptFile),
|
NS_ConvertUTF8toUTF16(mScriptFile),
|
||||||
EmptyString(), mScriptLine, 0,
|
EmptyString(), mScriptLine, mScriptColumn,
|
||||||
nsIScriptError::errorFlag, "Web Socket");
|
nsIScriptError::errorFlag, "Web Socket");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1036,6 +1041,7 @@ public:
|
||||||
InitRunnable(WebSocketImpl* aImpl, const nsAString& aURL,
|
InitRunnable(WebSocketImpl* aImpl, const nsAString& aURL,
|
||||||
nsTArray<nsString>& aProtocolArray,
|
nsTArray<nsString>& aProtocolArray,
|
||||||
const nsACString& aScriptFile, uint32_t aScriptLine,
|
const nsACString& aScriptFile, uint32_t aScriptLine,
|
||||||
|
uint32_t aScriptColumn,
|
||||||
ErrorResult& aRv, bool* aConnectionFailed)
|
ErrorResult& aRv, bool* aConnectionFailed)
|
||||||
: WebSocketMainThreadRunnable(aImpl->mWorkerPrivate)
|
: WebSocketMainThreadRunnable(aImpl->mWorkerPrivate)
|
||||||
, mImpl(aImpl)
|
, mImpl(aImpl)
|
||||||
|
@ -1043,6 +1049,7 @@ public:
|
||||||
, mProtocolArray(aProtocolArray)
|
, mProtocolArray(aProtocolArray)
|
||||||
, mScriptFile(aScriptFile)
|
, mScriptFile(aScriptFile)
|
||||||
, mScriptLine(aScriptLine)
|
, mScriptLine(aScriptLine)
|
||||||
|
, mScriptColumn(aScriptColumn)
|
||||||
, mRv(aRv)
|
, mRv(aRv)
|
||||||
, mConnectionFailed(aConnectionFailed)
|
, mConnectionFailed(aConnectionFailed)
|
||||||
{
|
{
|
||||||
|
@ -1074,7 +1081,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
mImpl->Init(jsapi.cx(), principal, mURL, mProtocolArray, mScriptFile,
|
mImpl->Init(jsapi.cx(), principal, mURL, mProtocolArray, mScriptFile,
|
||||||
mScriptLine, mRv, mConnectionFailed);
|
mScriptLine, mScriptColumn, mRv, mConnectionFailed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1084,7 +1091,7 @@ protected:
|
||||||
MOZ_ASSERT(aTopLevelWorkerPrivate && !aTopLevelWorkerPrivate->GetWindow());
|
MOZ_ASSERT(aTopLevelWorkerPrivate && !aTopLevelWorkerPrivate->GetWindow());
|
||||||
|
|
||||||
mImpl->Init(nullptr, aTopLevelWorkerPrivate->GetPrincipal(), mURL,
|
mImpl->Init(nullptr, aTopLevelWorkerPrivate->GetPrincipal(), mURL,
|
||||||
mProtocolArray, mScriptFile, mScriptLine, mRv,
|
mProtocolArray, mScriptFile, mScriptLine, mScriptColumn, mRv,
|
||||||
mConnectionFailed);
|
mConnectionFailed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1096,6 +1103,7 @@ protected:
|
||||||
nsTArray<nsString>& mProtocolArray;
|
nsTArray<nsString>& mProtocolArray;
|
||||||
nsCString mScriptFile;
|
nsCString mScriptFile;
|
||||||
uint32_t mScriptLine;
|
uint32_t mScriptLine;
|
||||||
|
uint32_t mScriptColumn;
|
||||||
ErrorResult& mRv;
|
ErrorResult& mRv;
|
||||||
bool* mConnectionFailed;
|
bool* mConnectionFailed;
|
||||||
};
|
};
|
||||||
|
@ -1217,7 +1225,7 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
|
||||||
|
|
||||||
if (NS_IsMainThread()) {
|
if (NS_IsMainThread()) {
|
||||||
webSocket->mImpl->Init(aGlobal.Context(), principal, aUrl, protocolArray,
|
webSocket->mImpl->Init(aGlobal.Context(), principal, aUrl, protocolArray,
|
||||||
EmptyCString(), 0, aRv, &connectionFailed);
|
EmptyCString(), 0, 0, aRv, &connectionFailed);
|
||||||
} else {
|
} else {
|
||||||
// In workers we have to keep the worker alive using a feature in order to
|
// In workers we have to keep the worker alive using a feature in order to
|
||||||
// dispatch messages correctly.
|
// dispatch messages correctly.
|
||||||
|
@ -1226,15 +1234,16 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned lineno;
|
unsigned lineno, column;
|
||||||
JS::AutoFilename file;
|
JS::AutoFilename file;
|
||||||
if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno)) {
|
if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno,
|
||||||
|
&column)) {
|
||||||
NS_WARNING("Failed to get line number and filename in workers.");
|
NS_WARNING("Failed to get line number and filename in workers.");
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<InitRunnable> runnable =
|
nsRefPtr<InitRunnable> runnable =
|
||||||
new InitRunnable(webSocket->mImpl, aUrl, protocolArray,
|
new InitRunnable(webSocket->mImpl, aUrl, protocolArray,
|
||||||
nsAutoCString(file.get()), lineno, aRv,
|
nsAutoCString(file.get()), lineno, column, aRv,
|
||||||
&connectionFailed);
|
&connectionFailed);
|
||||||
runnable->Dispatch(aGlobal.Context());
|
runnable->Dispatch(aGlobal.Context());
|
||||||
}
|
}
|
||||||
|
@ -1395,6 +1404,7 @@ WebSocketImpl::Init(JSContext* aCx,
|
||||||
nsTArray<nsString>& aProtocolArray,
|
nsTArray<nsString>& aProtocolArray,
|
||||||
const nsACString& aScriptFile,
|
const nsACString& aScriptFile,
|
||||||
uint32_t aScriptLine,
|
uint32_t aScriptLine,
|
||||||
|
uint32_t aScriptColumn,
|
||||||
ErrorResult& aRv,
|
ErrorResult& aRv,
|
||||||
bool* aConnectionFailed)
|
bool* aConnectionFailed)
|
||||||
{
|
{
|
||||||
|
@ -1434,14 +1444,16 @@ WebSocketImpl::Init(JSContext* aCx,
|
||||||
if (mWorkerPrivate) {
|
if (mWorkerPrivate) {
|
||||||
mScriptFile = aScriptFile;
|
mScriptFile = aScriptFile;
|
||||||
mScriptLine = aScriptLine;
|
mScriptLine = aScriptLine;
|
||||||
|
mScriptColumn = aScriptColumn;
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(aCx);
|
MOZ_ASSERT(aCx);
|
||||||
|
|
||||||
unsigned lineno;
|
unsigned lineno, column;
|
||||||
JS::AutoFilename file;
|
JS::AutoFilename file;
|
||||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineno)) {
|
if (JS::DescribeScriptedCaller(aCx, &file, &lineno, &column)) {
|
||||||
mScriptFile = file.get();
|
mScriptFile = file.get();
|
||||||
mScriptLine = lineno;
|
mScriptLine = lineno;
|
||||||
|
mScriptColumn = column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3502,7 +3502,7 @@ nsContentUtils::ReportToConsoleNonLocalized(const nsAString& aErrorText,
|
||||||
if (!aLineNumber) {
|
if (!aLineNumber) {
|
||||||
JSContext *cx = GetCurrentJSContext();
|
JSContext *cx = GetCurrentJSContext();
|
||||||
if (cx) {
|
if (cx) {
|
||||||
nsJSUtils::GetCallingLocation(cx, spec, &aLineNumber);
|
nsJSUtils::GetCallingLocation(cx, spec, &aLineNumber, &aColumnNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (spec.IsEmpty() && aURI)
|
if (spec.IsEmpty() && aURI)
|
||||||
|
@ -5464,8 +5464,8 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
||||||
// For draggesture and dragstart events, the data transfer object is
|
// For draggesture and dragstart events, the data transfer object is
|
||||||
// created before the event fires, so it should already be set. For other
|
// created before the event fires, so it should already be set. For other
|
||||||
// drag events, get the object from the drag session.
|
// drag events, get the object from the drag session.
|
||||||
NS_ASSERTION(aDragEvent->mMessage != NS_DRAGDROP_GESTURE &&
|
NS_ASSERTION(aDragEvent->mMessage != eLegacyDragGesture &&
|
||||||
aDragEvent->mMessage != NS_DRAGDROP_START,
|
aDragEvent->mMessage != eDragStart,
|
||||||
"draggesture event created without a dataTransfer");
|
"draggesture event created without a dataTransfer");
|
||||||
|
|
||||||
nsCOMPtr<nsIDragSession> dragSession = GetDragSession();
|
nsCOMPtr<nsIDragSession> dragSession = GetDragSession();
|
||||||
|
@ -5492,8 +5492,8 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCrossDomainSubFrameDrop = false;
|
bool isCrossDomainSubFrameDrop = false;
|
||||||
if (aDragEvent->mMessage == NS_DRAGDROP_DROP ||
|
if (aDragEvent->mMessage == eDrop ||
|
||||||
aDragEvent->mMessage == NS_DRAGDROP_DRAGDROP) {
|
aDragEvent->mMessage == eLegacyDragDrop) {
|
||||||
isCrossDomainSubFrameDrop = CheckForSubFrameDrop(dragSession, aDragEvent);
|
isCrossDomainSubFrameDrop = CheckForSubFrameDrop(dragSession, aDragEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5507,16 +5507,15 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
||||||
// for the dragenter and dragover events, initialize the drop effect
|
// for the dragenter and dragover events, initialize the drop effect
|
||||||
// from the drop action, which platform specific widget code sets before
|
// from the drop action, which platform specific widget code sets before
|
||||||
// the event is fired based on the keyboard state.
|
// the event is fired based on the keyboard state.
|
||||||
if (aDragEvent->mMessage == NS_DRAGDROP_ENTER ||
|
if (aDragEvent->mMessage == eDragEnter || aDragEvent->mMessage == eDragOver) {
|
||||||
aDragEvent->mMessage == NS_DRAGDROP_OVER) {
|
|
||||||
uint32_t action, effectAllowed;
|
uint32_t action, effectAllowed;
|
||||||
dragSession->GetDragAction(&action);
|
dragSession->GetDragAction(&action);
|
||||||
aDragEvent->dataTransfer->GetEffectAllowedInt(&effectAllowed);
|
aDragEvent->dataTransfer->GetEffectAllowedInt(&effectAllowed);
|
||||||
aDragEvent->dataTransfer->SetDropEffectInt(FilterDropEffect(action, effectAllowed));
|
aDragEvent->dataTransfer->SetDropEffectInt(FilterDropEffect(action, effectAllowed));
|
||||||
}
|
}
|
||||||
else if (aDragEvent->mMessage == NS_DRAGDROP_DROP ||
|
else if (aDragEvent->mMessage == eDrop ||
|
||||||
aDragEvent->mMessage == NS_DRAGDROP_DRAGDROP ||
|
aDragEvent->mMessage == eLegacyDragDrop ||
|
||||||
aDragEvent->mMessage == NS_DRAGDROP_END) {
|
aDragEvent->mMessage == eDragEnd) {
|
||||||
// For the drop and dragend events, set the drop effect based on the
|
// For the drop and dragend events, set the drop effect based on the
|
||||||
// last value that the dropEffect had. This will have been set in
|
// last value that the dropEffect had. This will have been set in
|
||||||
// EventStateManager::PostHandleEvent for the last dragenter or
|
// EventStateManager::PostHandleEvent for the last dragenter or
|
||||||
|
|
|
@ -299,25 +299,6 @@ nsDOMWindowUtils::UpdateLayerTree()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMWindowUtils::SetCSSViewport(float aWidthPx, float aHeightPx)
|
|
||||||
{
|
|
||||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
|
||||||
|
|
||||||
if (!(aWidthPx >= 0.0 && aHeightPx >= 0.0)) {
|
|
||||||
return NS_ERROR_ILLEGAL_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIPresShell* presShell = GetPresShell();
|
|
||||||
if (!presShell) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsLayoutUtils::SetCSSViewport(presShell, CSSSize(aWidthPx, aHeightPx));
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
||||||
uint32_t aDisplayHeight,
|
uint32_t aDisplayHeight,
|
||||||
|
|
|
@ -8146,7 +8146,7 @@ nsDocument::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
aVisitor.mForceContentDispatch = true;
|
aVisitor.mForceContentDispatch = true;
|
||||||
|
|
||||||
// Load events must not propagate to |window| object, see bug 335251.
|
// Load events must not propagate to |window| object, see bug 335251.
|
||||||
if (aVisitor.mEvent->mMessage != NS_LOAD) {
|
if (aVisitor.mEvent->mMessage != eLoad) {
|
||||||
nsGlobalWindow* window = static_cast<nsGlobalWindow*>(GetWindow());
|
nsGlobalWindow* window = static_cast<nsGlobalWindow*>(GetWindow());
|
||||||
aVisitor.mParentTarget =
|
aVisitor.mParentTarget =
|
||||||
window ? window->GetTargetForEventTargetChain() : nullptr;
|
window ? window->GetTargetForEventTargetChain() : nullptr;
|
||||||
|
|
|
@ -966,7 +966,7 @@ nsFocusManager::WindowHidden(nsIDOMWindow* aWindow)
|
||||||
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
||||||
|
|
||||||
if (presShell) {
|
if (presShell) {
|
||||||
SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell,
|
SendFocusOrBlurEvent(eBlur, presShell,
|
||||||
oldFocusedContent->GetComposedDoc(),
|
oldFocusedContent->GetComposedDoc(),
|
||||||
oldFocusedContent, 1, false);
|
oldFocusedContent, 1, false);
|
||||||
}
|
}
|
||||||
|
@ -1682,7 +1682,7 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear,
|
||||||
if (mActiveWindow)
|
if (mActiveWindow)
|
||||||
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
||||||
|
|
||||||
SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell,
|
SendFocusOrBlurEvent(eBlur, presShell,
|
||||||
content->GetComposedDoc(), content, 1, false);
|
content->GetComposedDoc(), content, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1729,9 +1729,9 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear,
|
||||||
// the document isn't null in case someone closed it during the blur above
|
// the document isn't null in case someone closed it during the blur above
|
||||||
nsIDocument* doc = window->GetExtantDoc();
|
nsIDocument* doc = window->GetExtantDoc();
|
||||||
if (doc)
|
if (doc)
|
||||||
SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell, doc, doc, 1, false);
|
SendFocusOrBlurEvent(eBlur, presShell, doc, doc, 1, false);
|
||||||
if (mFocusedWindow == nullptr)
|
if (mFocusedWindow == nullptr)
|
||||||
SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell, doc, window, 1, false);
|
SendFocusOrBlurEvent(eBlur, presShell, doc, window, 1, false);
|
||||||
|
|
||||||
// check if a different window was focused
|
// check if a different window was focused
|
||||||
result = (mFocusedWindow == nullptr && mActiveWindow);
|
result = (mFocusedWindow == nullptr && mActiveWindow);
|
||||||
|
@ -1857,10 +1857,10 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
|
||||||
GetFocusMoveActionCause(aFlags));
|
GetFocusMoveActionCause(aFlags));
|
||||||
}
|
}
|
||||||
if (doc)
|
if (doc)
|
||||||
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
|
SendFocusOrBlurEvent(eFocus, presShell, doc,
|
||||||
doc, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
|
doc, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
|
||||||
if (mFocusedWindow == aWindow && mFocusedContent == nullptr)
|
if (mFocusedWindow == aWindow && mFocusedContent == nullptr)
|
||||||
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
|
SendFocusOrBlurEvent(eFocus, presShell, doc,
|
||||||
aWindow, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
|
aWindow, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1908,7 +1908,7 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
|
||||||
if (!aWindowRaised)
|
if (!aWindowRaised)
|
||||||
aWindow->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
aWindow->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
||||||
|
|
||||||
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell,
|
SendFocusOrBlurEvent(eFocus, presShell,
|
||||||
aContent->GetComposedDoc(),
|
aContent->GetComposedDoc(),
|
||||||
aContent, aFlags & FOCUSMETHOD_MASK,
|
aContent, aFlags & FOCUSMETHOD_MASK,
|
||||||
aWindowRaised, isRefocus);
|
aWindowRaised, isRefocus);
|
||||||
|
@ -2001,8 +2001,7 @@ nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
|
||||||
bool aWindowRaised,
|
bool aWindowRaised,
|
||||||
bool aIsRefocus)
|
bool aIsRefocus)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aEventMessage == NS_FOCUS_CONTENT ||
|
NS_ASSERTION(aEventMessage == eFocus || aEventMessage == eBlur,
|
||||||
aEventMessage == NS_BLUR_CONTENT,
|
|
||||||
"Wrong event type for SendFocusOrBlurEvent");
|
"Wrong event type for SendFocusOrBlurEvent");
|
||||||
|
|
||||||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||||
|
@ -2042,7 +2041,7 @@ nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
nsAccessibilityService* accService = GetAccService();
|
nsAccessibilityService* accService = GetAccService();
|
||||||
if (accService) {
|
if (accService) {
|
||||||
if (aEventMessage == NS_FOCUS_CONTENT) {
|
if (aEventMessage == eFocus) {
|
||||||
accService->NotifyOfDOMFocus(aTarget);
|
accService->NotifyOfDOMFocus(aTarget);
|
||||||
} else {
|
} else {
|
||||||
accService->NotifyOfDOMBlur(aTarget);
|
accService->NotifyOfDOMBlur(aTarget);
|
||||||
|
|
|
@ -280,7 +280,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Fires a focus or blur event at aTarget.
|
* Fires a focus or blur event at aTarget.
|
||||||
*
|
*
|
||||||
* aEventMessage should be either NS_FOCUS_CONTENT or NS_BLUR_CONTENT.
|
* aEventMessage should be either eFocus or eBlur.
|
||||||
* For blur events, aFocusMethod should normally be non-zero.
|
* For blur events, aFocusMethod should normally be non-zero.
|
||||||
*
|
*
|
||||||
* aWindowRaised should only be true if called from WindowRaised.
|
* aWindowRaised should only be true if called from WindowRaised.
|
||||||
|
|
|
@ -157,7 +157,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
|
||||||
, mObservingOwnerContent(false)
|
, mObservingOwnerContent(false)
|
||||||
, mVisible(true)
|
, mVisible(true)
|
||||||
{
|
{
|
||||||
ResetPermissionManagerStatus();
|
|
||||||
mRemoteFrame = ShouldUseRemoteProcess();
|
mRemoteFrame = ShouldUseRemoteProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,6 +408,9 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||||
mURIToLoad = nullptr;
|
mURIToLoad = nullptr;
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
// Track the appId's reference count if this frame is in-process
|
||||||
|
ResetPermissionManagerStatus();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2705,7 +2707,9 @@ nsFrameLoader::ResetPermissionManagerStatus()
|
||||||
{
|
{
|
||||||
// The resetting of the permissions status can run only
|
// The resetting of the permissions status can run only
|
||||||
// in the main process.
|
// in the main process.
|
||||||
if (XRE_IsContentProcess()) {
|
// only in-main-process && in-process frame is handled here and all other
|
||||||
|
// cases are handled by ContentParent.
|
||||||
|
if (XRE_IsContentProcess() || mRemoteFrame) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -663,12 +663,12 @@ GetParamsForMessage(JSContext* aCx,
|
||||||
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||||
if (console) {
|
if (console) {
|
||||||
nsAutoString filename;
|
nsAutoString filename;
|
||||||
uint32_t lineno = 0;
|
uint32_t lineno = 0, column = 0;
|
||||||
nsJSUtils::GetCallingLocation(aCx, filename, &lineno);
|
nsJSUtils::GetCallingLocation(aCx, filename, &lineno, &column);
|
||||||
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||||
error->Init(NS_LITERAL_STRING("Sending message that cannot be cloned. Are you trying to send an XPCOM object?"),
|
error->Init(NS_LITERAL_STRING("Sending message that cannot be cloned. Are you trying to send an XPCOM object?"),
|
||||||
filename, EmptyString(),
|
filename, EmptyString(), lineno, column,
|
||||||
lineno, 0, nsIScriptError::warningFlag, "chrome javascript");
|
nsIScriptError::warningFlag, "chrome javascript");
|
||||||
console->LogMessage(error);
|
console->LogMessage(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ public:
|
||||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override
|
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsInNativeAnonymousSubtree());
|
MOZ_ASSERT(IsInNativeAnonymousSubtree());
|
||||||
if (aVisitor.mEvent->mMessage == NS_LOAD ||
|
if (aVisitor.mEvent->mMessage == eLoad ||
|
||||||
aVisitor.mEvent->mMessage == NS_LOAD_ERROR) {
|
aVisitor.mEvent->mMessage == eLoadError) {
|
||||||
// Don't propagate the events to the parent.
|
// Don't propagate the events to the parent.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3086,7 +3086,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
} else if (msg == eMouseDown && aVisitor.mEvent->mFlags.mIsTrusted) {
|
} else if (msg == eMouseDown && aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||||
gMouseDown = true;
|
gMouseDown = true;
|
||||||
} else if ((msg == eMouseUp || msg == NS_DRAGDROP_END) &&
|
} else if ((msg == eMouseUp || msg == eDragEnd) &&
|
||||||
aVisitor.mEvent->mFlags.mIsTrusted) {
|
aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||||
gMouseDown = false;
|
gMouseDown = false;
|
||||||
if (gDragServiceDisabled) {
|
if (gDragServiceDisabled) {
|
||||||
|
@ -3265,8 +3265,8 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
// Return early if there is nothing to do.
|
// Return early if there is nothing to do.
|
||||||
switch (aVisitor.mEvent->mMessage) {
|
switch (aVisitor.mEvent->mMessage) {
|
||||||
case eResize:
|
case eResize:
|
||||||
case NS_PAGE_UNLOAD:
|
case eUnload:
|
||||||
case NS_LOAD:
|
case eLoad:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -3280,7 +3280,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
|
|
||||||
if (aVisitor.mEvent->mMessage == eResize) {
|
if (aVisitor.mEvent->mMessage == eResize) {
|
||||||
mIsHandlingResizeEvent = false;
|
mIsHandlingResizeEvent = false;
|
||||||
} else if (aVisitor.mEvent->mMessage == NS_PAGE_UNLOAD &&
|
} else if (aVisitor.mEvent->mMessage == eUnload &&
|
||||||
aVisitor.mEvent->mFlags.mIsTrusted) {
|
aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||||
// Execute bindingdetached handlers before we tear ourselves
|
// Execute bindingdetached handlers before we tear ourselves
|
||||||
// down.
|
// down.
|
||||||
|
@ -3288,7 +3288,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
mDoc->BindingManager()->ExecuteDetachedHandlers();
|
mDoc->BindingManager()->ExecuteDetachedHandlers();
|
||||||
}
|
}
|
||||||
mIsDocumentLoaded = false;
|
mIsDocumentLoaded = false;
|
||||||
} else if (aVisitor.mEvent->mMessage == NS_LOAD &&
|
} else if (aVisitor.mEvent->mMessage == eLoad &&
|
||||||
aVisitor.mEvent->mFlags.mIsTrusted) {
|
aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||||
// This is page load event since load events don't propagate to |window|.
|
// This is page load event since load events don't propagate to |window|.
|
||||||
// @see nsDocument::PreHandleEvent.
|
// @see nsDocument::PreHandleEvent.
|
||||||
|
@ -3302,7 +3302,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
// onload event for the frame element.
|
// onload event for the frame element.
|
||||||
|
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
WidgetEvent event(aVisitor.mEvent->mFlags.mIsTrusted, NS_LOAD);
|
WidgetEvent event(aVisitor.mEvent->mFlags.mIsTrusted, eLoad);
|
||||||
event.mFlags.mBubbles = false;
|
event.mFlags.mBubbles = false;
|
||||||
|
|
||||||
// Most of the time we could get a pres context to pass in here,
|
// Most of the time we could get a pres context to pass in here,
|
||||||
|
|
|
@ -35,10 +35,10 @@ using namespace mozilla::dom;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
||||||
uint32_t* aLineno)
|
uint32_t* aLineno, uint32_t* aColumn)
|
||||||
{
|
{
|
||||||
JS::AutoFilename filename;
|
JS::AutoFilename filename;
|
||||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
|
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,10 +48,10 @@ nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
|
nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
|
||||||
uint32_t* aLineno)
|
uint32_t* aLineno, uint32_t* aColumn)
|
||||||
{
|
{
|
||||||
JS::AutoFilename filename;
|
JS::AutoFilename filename;
|
||||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
|
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,11 @@ class nsJSUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
static bool GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
||||||
uint32_t* aLineno);
|
uint32_t* aLineno = nullptr,
|
||||||
|
uint32_t* aColumn = nullptr);
|
||||||
static bool GetCallingLocation(JSContext* aContext, nsAString& aFilename,
|
static bool GetCallingLocation(JSContext* aContext, nsAString& aFilename,
|
||||||
uint32_t* aLineno);
|
uint32_t* aLineno = nullptr,
|
||||||
|
uint32_t* aColumn = nullptr);
|
||||||
|
|
||||||
static nsIScriptGlobalObject *GetStaticScriptGlobal(JSObject* aObj);
|
static nsIScriptGlobalObject *GetStaticScriptGlobal(JSObject* aObj);
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,10 @@ nsScriptElement::ScriptEvaluated(nsresult aResult,
|
||||||
nsContentUtils::GetContextForContent(cont);
|
nsContentUtils::GetContextForContent(cont);
|
||||||
|
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
EventMessage message = NS_SUCCEEDED(aResult) ? NS_LOAD : NS_LOAD_ERROR;
|
EventMessage message = NS_SUCCEEDED(aResult) ? eLoad : eLoadError;
|
||||||
WidgetEvent event(true, message);
|
WidgetEvent event(true, message);
|
||||||
// Load event doesn't bubble.
|
// Load event doesn't bubble.
|
||||||
event.mFlags.mBubbles = (message != NS_LOAD);
|
event.mFlags.mBubbles = (message != eLoad);
|
||||||
|
|
||||||
EventDispatcher::Dispatch(cont, presContext, &event, nullptr, &status);
|
EventDispatcher::Dispatch(cont, presContext, &event, nullptr, &status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,6 @@ UNIFIED_SOURCES += [
|
||||||
]
|
]
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
'../..', # Support `#include "mfbt/RefPtr.h"`
|
|
||||||
'/js/xpconnect/wrappers',
|
'/js/xpconnect/wrappers',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -68,40 +68,41 @@ const char DataTransfer::sEffects[8][9] = {
|
||||||
"none", "copy", "move", "copyMove", "link", "copyLink", "linkMove", "all"
|
"none", "copy", "move", "copyMove", "link", "copyLink", "linkMove", "all"
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTransfer::DataTransfer(nsISupports* aParent, uint32_t aEventType,
|
DataTransfer::DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
|
||||||
bool aIsExternal, int32_t aClipboardType)
|
bool aIsExternal, int32_t aClipboardType)
|
||||||
: mParent(aParent),
|
: mParent(aParent)
|
||||||
mEventType(aEventType),
|
, mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE)
|
||||||
mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE),
|
, mEffectAllowed(nsIDragService::DRAGDROP_ACTION_UNINITIALIZED)
|
||||||
mEffectAllowed(nsIDragService::DRAGDROP_ACTION_UNINITIALIZED),
|
, mEventMessage(aEventMessage)
|
||||||
mCursorState(false),
|
, mCursorState(false)
|
||||||
mReadOnly(true),
|
, mReadOnly(true)
|
||||||
mIsExternal(aIsExternal),
|
, mIsExternal(aIsExternal)
|
||||||
mUserCancelled(false),
|
, mUserCancelled(false)
|
||||||
mIsCrossDomainSubFrameDrop(false),
|
, mIsCrossDomainSubFrameDrop(false)
|
||||||
mClipboardType(aClipboardType),
|
, mClipboardType(aClipboardType)
|
||||||
mDragImageX(0),
|
, mDragImageX(0)
|
||||||
mDragImageY(0)
|
, mDragImageY(0)
|
||||||
{
|
{
|
||||||
// For these events, we want to be able to add data to the data transfer, so
|
// For these events, we want to be able to add data to the data transfer, so
|
||||||
// clear the readonly state. Otherwise, the data is already present. For
|
// clear the readonly state. Otherwise, the data is already present. For
|
||||||
// external usage, cache the data from the native clipboard or drag.
|
// external usage, cache the data from the native clipboard or drag.
|
||||||
if (aEventType == NS_CUT ||
|
if (aEventMessage == NS_CUT ||
|
||||||
aEventType == NS_COPY ||
|
aEventMessage == NS_COPY ||
|
||||||
aEventType == NS_DRAGDROP_START ||
|
aEventMessage == eDragStart ||
|
||||||
aEventType == NS_DRAGDROP_GESTURE) {
|
aEventMessage == eLegacyDragGesture) {
|
||||||
mReadOnly = false;
|
mReadOnly = false;
|
||||||
} else if (mIsExternal) {
|
} else if (mIsExternal) {
|
||||||
if (aEventType == NS_PASTE) {
|
if (aEventMessage == NS_PASTE) {
|
||||||
CacheExternalClipboardFormats();
|
CacheExternalClipboardFormats();
|
||||||
} else if (aEventType >= NS_DRAGDROP_EVENT_START && aEventType <= NS_DRAGDROP_LEAVE) {
|
} else if (aEventMessage >= eDragDropEventFirst &&
|
||||||
|
aEventMessage <= eDragDropEventLast) {
|
||||||
CacheExternalDragFormats();
|
CacheExternalDragFormats();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTransfer::DataTransfer(nsISupports* aParent,
|
DataTransfer::DataTransfer(nsISupports* aParent,
|
||||||
uint32_t aEventType,
|
EventMessage aEventMessage,
|
||||||
const uint32_t aEffectAllowed,
|
const uint32_t aEffectAllowed,
|
||||||
bool aCursorState,
|
bool aCursorState,
|
||||||
bool aIsExternal,
|
bool aIsExternal,
|
||||||
|
@ -112,20 +113,20 @@ DataTransfer::DataTransfer(nsISupports* aParent,
|
||||||
Element* aDragImage,
|
Element* aDragImage,
|
||||||
uint32_t aDragImageX,
|
uint32_t aDragImageX,
|
||||||
uint32_t aDragImageY)
|
uint32_t aDragImageY)
|
||||||
: mParent(aParent),
|
: mParent(aParent)
|
||||||
mEventType(aEventType),
|
, mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE)
|
||||||
mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE),
|
, mEffectAllowed(aEffectAllowed)
|
||||||
mEffectAllowed(aEffectAllowed),
|
, mEventMessage(aEventMessage)
|
||||||
mCursorState(aCursorState),
|
, mCursorState(aCursorState)
|
||||||
mReadOnly(true),
|
, mReadOnly(true)
|
||||||
mIsExternal(aIsExternal),
|
, mIsExternal(aIsExternal)
|
||||||
mUserCancelled(aUserCancelled),
|
, mUserCancelled(aUserCancelled)
|
||||||
mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop),
|
, mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop)
|
||||||
mClipboardType(aClipboardType),
|
, mClipboardType(aClipboardType)
|
||||||
mItems(aItems),
|
, mItems(aItems)
|
||||||
mDragImage(aDragImage),
|
, mDragImage(aDragImage)
|
||||||
mDragImageX(aDragImageX),
|
, mDragImageX(aDragImageX)
|
||||||
mDragImageY(aDragImageY)
|
, mDragImageY(aDragImageY)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mParent);
|
MOZ_ASSERT(mParent);
|
||||||
// The items are copied from aItems into mItems. There is no need to copy
|
// The items are copied from aItems into mItems. There is no need to copy
|
||||||
|
@ -133,8 +134,8 @@ DataTransfer::DataTransfer(nsISupports* aParent,
|
||||||
// draggesture and dragstart events are the only times when items are
|
// draggesture and dragstart events are the only times when items are
|
||||||
// modifiable, but those events should have been using the first constructor
|
// modifiable, but those events should have been using the first constructor
|
||||||
// above.
|
// above.
|
||||||
NS_ASSERTION(aEventType != NS_DRAGDROP_GESTURE &&
|
NS_ASSERTION(aEventMessage != eLegacyDragGesture &&
|
||||||
aEventType != NS_DRAGDROP_START,
|
aEventMessage != eDragStart,
|
||||||
"invalid event type for DataTransfer constructor");
|
"invalid event type for DataTransfer constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,8 +269,9 @@ DataTransfer::GetMozUserCancelled(bool* aUserCancelled)
|
||||||
FileList*
|
FileList*
|
||||||
DataTransfer::GetFiles(ErrorResult& aRv)
|
DataTransfer::GetFiles(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
|
if (mEventMessage != eDrop &&
|
||||||
mEventType != NS_PASTE) {
|
mEventMessage != eLegacyDragDrop &&
|
||||||
|
mEventMessage != NS_PASTE) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +543,8 @@ DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventType == NS_CUT || mEventType == NS_COPY || mEventType == NS_PASTE)) {
|
(mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
|
||||||
|
mEventMessage == NS_PASTE)) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -581,7 +584,8 @@ DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
|
||||||
|
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventType == NS_CUT || mEventType == NS_COPY || mEventType == NS_PASTE)) {
|
(mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
|
||||||
|
mEventMessage == NS_PASTE)) {
|
||||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,8 +603,8 @@ DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
|
||||||
// only allow access to the data with the same principal.
|
// only allow access to the data with the same principal.
|
||||||
nsIPrincipal* principal = nullptr;
|
nsIPrincipal* principal = nullptr;
|
||||||
if (mIsCrossDomainSubFrameDrop ||
|
if (mIsCrossDomainSubFrameDrop ||
|
||||||
(mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
|
(mEventMessage != eDrop && mEventMessage != eLegacyDragDrop &&
|
||||||
mEventType != NS_PASTE &&
|
mEventMessage != NS_PASTE &&
|
||||||
!nsContentUtils::IsCallerChrome())) {
|
!nsContentUtils::IsCallerChrome())) {
|
||||||
principal = nsContentUtils::SubjectPrincipal();
|
principal = nsContentUtils::SubjectPrincipal();
|
||||||
}
|
}
|
||||||
|
@ -692,7 +696,8 @@ DataTransfer::MozSetDataAt(const nsAString& aFormat, nsIVariant* aData,
|
||||||
|
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventType == NS_CUT || mEventType == NS_COPY || mEventType == NS_PASTE)) {
|
(mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
|
||||||
|
mEventMessage == NS_PASTE)) {
|
||||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +742,8 @@ DataTransfer::MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,
|
||||||
|
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventType == NS_CUT || mEventType == NS_COPY || mEventType == NS_PASTE)) {
|
(mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
|
||||||
|
mEventMessage == NS_PASTE)) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -752,8 +758,8 @@ DataTransfer::MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
|
||||||
MOZ_ASSERT(!mReadOnly);
|
MOZ_ASSERT(!mReadOnly);
|
||||||
MOZ_ASSERT(aIndex < mItems.Length());
|
MOZ_ASSERT(aIndex < mItems.Length());
|
||||||
MOZ_ASSERT(aIndex == 0 ||
|
MOZ_ASSERT(aIndex == 0 ||
|
||||||
(mEventType != NS_CUT && mEventType != NS_COPY &&
|
(mEventMessage != NS_CUT && mEventMessage != NS_COPY &&
|
||||||
mEventType != NS_PASTE));
|
mEventMessage != NS_PASTE));
|
||||||
|
|
||||||
nsAutoString format;
|
nsAutoString format;
|
||||||
GetRealFormat(aFormat, format);
|
GetRealFormat(aFormat, format);
|
||||||
|
@ -938,12 +944,12 @@ DataTransfer::AddElement(nsIDOMElement* aElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
DataTransfer::Clone(nsISupports* aParent, uint32_t aEventType,
|
DataTransfer::Clone(nsISupports* aParent, EventMessage aEventMessage,
|
||||||
bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
|
bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
|
||||||
DataTransfer** aNewDataTransfer)
|
DataTransfer** aNewDataTransfer)
|
||||||
{
|
{
|
||||||
DataTransfer* newDataTransfer =
|
DataTransfer* newDataTransfer =
|
||||||
new DataTransfer(aParent, aEventType, mEffectAllowed, mCursorState,
|
new DataTransfer(aParent, aEventMessage, mEffectAllowed, mCursorState,
|
||||||
mIsExternal, aUserCancelled, aIsCrossDomainSubFrameDrop,
|
mIsExternal, aUserCancelled, aIsCrossDomainSubFrameDrop,
|
||||||
mClipboardType, mItems, mDragImage, mDragImageX,
|
mClipboardType, mItems, mDragImage, mDragImageX,
|
||||||
mDragImageY);
|
mDragImageY);
|
||||||
|
@ -1252,7 +1258,8 @@ DataTransfer::CacheExternalDragFormats()
|
||||||
void
|
void
|
||||||
DataTransfer::CacheExternalClipboardFormats()
|
DataTransfer::CacheExternalClipboardFormats()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mEventType == NS_PASTE, "caching clipboard data for invalid event");
|
NS_ASSERTION(mEventMessage == NS_PASTE,
|
||||||
|
"caching clipboard data for invalid event");
|
||||||
|
|
||||||
// Called during the constructor for paste events to cache the formats
|
// Called during the constructor for paste events to cache the formats
|
||||||
// available on the clipboard. As with CacheExternalDragFormats, the
|
// available on the clipboard. As with CacheExternalDragFormats, the
|
||||||
|
@ -1293,7 +1300,7 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
// only drag and paste events should be calling FillInExternalData
|
// only drag and paste events should be calling FillInExternalData
|
||||||
NS_ASSERTION(mEventType != NS_CUT && mEventType != NS_COPY,
|
NS_ASSERTION(mEventMessage != NS_CUT && mEventMessage != NS_COPY,
|
||||||
"clipboard event with empty data");
|
"clipboard event with empty data");
|
||||||
|
|
||||||
NS_ConvertUTF16toUTF8 utf8format(aItem.mFormat);
|
NS_ConvertUTF16toUTF8 utf8format(aItem.mFormat);
|
||||||
|
@ -1311,7 +1318,7 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
|
||||||
trans->Init(nullptr);
|
trans->Init(nullptr);
|
||||||
trans->AddDataFlavor(format);
|
trans->AddDataFlavor(format);
|
||||||
|
|
||||||
if (mEventType == NS_PASTE) {
|
if (mEventMessage == NS_PASTE) {
|
||||||
MOZ_ASSERT(aIndex == 0, "index in clipboard must be 0");
|
MOZ_ASSERT(aIndex == 0, "index in clipboard must be 0");
|
||||||
|
|
||||||
nsCOMPtr<nsIClipboard> clipboard = do_GetService("@mozilla.org/widget/clipboard;1");
|
nsCOMPtr<nsIClipboard> clipboard = do_GetService("@mozilla.org/widget/clipboard;1");
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "mozilla/EventForwards.h"
|
||||||
#include "mozilla/dom/File.h"
|
#include "mozilla/dom/File.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ protected:
|
||||||
// this constructor is used only by the Clone method to copy the fields as
|
// this constructor is used only by the Clone method to copy the fields as
|
||||||
// needed to a new data transfer.
|
// needed to a new data transfer.
|
||||||
DataTransfer(nsISupports* aParent,
|
DataTransfer(nsISupports* aParent,
|
||||||
uint32_t aEventType,
|
EventMessage aEventMessage,
|
||||||
const uint32_t aEffectAllowed,
|
const uint32_t aEffectAllowed,
|
||||||
bool aCursorState,
|
bool aCursorState,
|
||||||
bool aIsExternal,
|
bool aIsExternal,
|
||||||
|
@ -95,8 +96,6 @@ public:
|
||||||
|
|
||||||
// Constructor for DataTransfer.
|
// Constructor for DataTransfer.
|
||||||
//
|
//
|
||||||
// aEventType is an event constant (such as NS_DRAGDROP_START)
|
|
||||||
//
|
|
||||||
// aIsExternal must only be true when used to create a dataTransfer for a
|
// aIsExternal must only be true when used to create a dataTransfer for a
|
||||||
// paste or a drag that was started without using a data transfer. The
|
// paste or a drag that was started without using a data transfer. The
|
||||||
// latter will occur when an external drag occurs, that is, a drag where the
|
// latter will occur when an external drag occurs, that is, a drag where the
|
||||||
|
@ -104,8 +103,8 @@ public:
|
||||||
// service directly. For clipboard operations, aClipboardType indicates
|
// service directly. For clipboard operations, aClipboardType indicates
|
||||||
// which clipboard to use, from nsIClipboard, or -1 for non-clipboard operations,
|
// which clipboard to use, from nsIClipboard, or -1 for non-clipboard operations,
|
||||||
// or if access to the system clipboard should not be allowed.
|
// or if access to the system clipboard should not be allowed.
|
||||||
DataTransfer(nsISupports* aParent, uint32_t aEventType, bool aIsExternal,
|
DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
|
||||||
int32_t aClipboardType);
|
bool aIsExternal, int32_t aClipboardType);
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
nsISupports* GetParentObject()
|
nsISupports* GetParentObject()
|
||||||
|
@ -222,8 +221,9 @@ public:
|
||||||
return mDragImage;
|
return mDragImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult Clone(nsISupports* aParent, uint32_t aEventType, bool aUserCancelled,
|
nsresult Clone(nsISupports* aParent, EventMessage aEventMessage,
|
||||||
bool aIsCrossDomainSubFrameDrop, DataTransfer** aResult);
|
bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
|
||||||
|
DataTransfer** aResult);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -254,14 +254,15 @@ protected:
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> mParent;
|
nsCOMPtr<nsISupports> mParent;
|
||||||
|
|
||||||
// the event type this data transfer is for. This will correspond to an
|
|
||||||
// event->mMessage value.
|
|
||||||
uint32_t mEventType;
|
|
||||||
|
|
||||||
// the drop effect and effect allowed
|
// the drop effect and effect allowed
|
||||||
uint32_t mDropEffect;
|
uint32_t mDropEffect;
|
||||||
uint32_t mEffectAllowed;
|
uint32_t mEffectAllowed;
|
||||||
|
|
||||||
|
// the event message this data transfer is for. This will correspond to an
|
||||||
|
// event->mMessage value.
|
||||||
|
EventMessage mEventMessage;
|
||||||
|
|
||||||
// Indicates the behavior of the cursor during drag operations
|
// Indicates the behavior of the cursor during drag operations
|
||||||
bool mCursorState;
|
bool mCursorState;
|
||||||
|
|
||||||
|
|
|
@ -716,12 +716,12 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||||
// nsPresShell::HandleEventInternal() for details.
|
// nsPresShell::HandleEventInternal() for details.
|
||||||
if (EventStateManager::IsHandlingUserInput()) {
|
if (EventStateManager::IsHandlingUserInput()) {
|
||||||
switch(aEvent->mMessage) {
|
switch(aEvent->mMessage) {
|
||||||
case NS_FORM_SELECTED :
|
case eFormSelect:
|
||||||
if (PopupAllowedForEvent("select")) {
|
if (PopupAllowedForEvent("select")) {
|
||||||
abuse = openControlled;
|
abuse = openControlled;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NS_FORM_CHANGE :
|
case eFormChange:
|
||||||
if (PopupAllowedForEvent("change")) {
|
if (PopupAllowedForEvent("change")) {
|
||||||
abuse = openControlled;
|
abuse = openControlled;
|
||||||
}
|
}
|
||||||
|
@ -753,7 +753,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||||
// nsPresShell::HandleEventInternal() for details.
|
// nsPresShell::HandleEventInternal() for details.
|
||||||
if (EventStateManager::IsHandlingUserInput()) {
|
if (EventStateManager::IsHandlingUserInput()) {
|
||||||
switch(aEvent->mMessage) {
|
switch(aEvent->mMessage) {
|
||||||
case NS_FORM_CHANGE :
|
case eFormChange:
|
||||||
if (PopupAllowedForEvent("change")) {
|
if (PopupAllowedForEvent("change")) {
|
||||||
abuse = openControlled;
|
abuse = openControlled;
|
||||||
}
|
}
|
||||||
|
@ -853,12 +853,12 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||||
// nsPresShell::HandleEventInternal() for details.
|
// nsPresShell::HandleEventInternal() for details.
|
||||||
if (EventStateManager::IsHandlingUserInput()) {
|
if (EventStateManager::IsHandlingUserInput()) {
|
||||||
switch(aEvent->mMessage) {
|
switch(aEvent->mMessage) {
|
||||||
case NS_FORM_SUBMIT :
|
case eFormSubmit:
|
||||||
if (PopupAllowedForEvent("submit")) {
|
if (PopupAllowedForEvent("submit")) {
|
||||||
abuse = openControlled;
|
abuse = openControlled;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NS_FORM_RESET :
|
case eFormReset:
|
||||||
if (PopupAllowedForEvent("reset")) {
|
if (PopupAllowedForEvent("reset")) {
|
||||||
abuse = openControlled;
|
abuse = openControlled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1339,8 +1339,8 @@ EventListenerManager::HasUnloadListeners()
|
||||||
uint32_t count = mListeners.Length();
|
uint32_t count = mListeners.Length();
|
||||||
for (uint32_t i = 0; i < count; ++i) {
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
Listener* listener = &mListeners.ElementAt(i);
|
Listener* listener = &mListeners.ElementAt(i);
|
||||||
if (listener->mEventMessage == NS_PAGE_UNLOAD ||
|
if (listener->mEventMessage == eUnload ||
|
||||||
listener->mEventMessage == NS_BEFORE_PAGE_UNLOAD) {
|
listener->mEventMessage == eBeforeUnload) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
#endif /* BEFOREUNLOAD_EVENT */
|
#endif /* BEFOREUNLOAD_EVENT */
|
||||||
|
|
||||||
EVENT(abort,
|
EVENT(abort,
|
||||||
NS_IMAGE_ABORT,
|
eImageAbort,
|
||||||
EventNameType_All,
|
EventNameType_All,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(canplay,
|
EVENT(canplay,
|
||||||
|
@ -161,7 +161,7 @@ EVENT(canplaythrough,
|
||||||
EventNameType_HTML,
|
EventNameType_HTML,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(change,
|
EVENT(change,
|
||||||
NS_FORM_CHANGE,
|
eFormChange,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(click,
|
EVENT(click,
|
||||||
|
@ -179,31 +179,31 @@ EVENT(dblclick,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eMouseEventClass)
|
eMouseEventClass)
|
||||||
EVENT(drag,
|
EVENT(drag,
|
||||||
NS_DRAGDROP_DRAG,
|
eDrag,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
EVENT(dragend,
|
EVENT(dragend,
|
||||||
NS_DRAGDROP_END,
|
eDragEnd,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
EVENT(dragenter,
|
EVENT(dragenter,
|
||||||
NS_DRAGDROP_ENTER,
|
eDragEnter,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
EVENT(dragleave,
|
EVENT(dragleave,
|
||||||
NS_DRAGDROP_LEAVE,
|
eDragLeave,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
EVENT(dragover,
|
EVENT(dragover,
|
||||||
NS_DRAGDROP_OVER,
|
eDragOver,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
EVENT(dragstart,
|
EVENT(dragstart,
|
||||||
NS_DRAGDROP_START,
|
eDragStart,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
EVENT(drop,
|
EVENT(drop,
|
||||||
NS_DRAGDROP_DROP,
|
eDrop,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
EVENT(durationchange,
|
EVENT(durationchange,
|
||||||
|
@ -223,7 +223,7 @@ EVENT(input,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eEditorInputEventClass)
|
eEditorInputEventClass)
|
||||||
EVENT(invalid,
|
EVENT(invalid,
|
||||||
NS_FORM_INVALID,
|
eFormInvalid,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(keydown,
|
EVENT(keydown,
|
||||||
|
@ -374,7 +374,7 @@ EVENT(ratechange,
|
||||||
EventNameType_HTML,
|
EventNameType_HTML,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(reset,
|
EVENT(reset,
|
||||||
NS_FORM_RESET,
|
eFormReset,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(seeked,
|
EVENT(seeked,
|
||||||
|
@ -386,7 +386,7 @@ EVENT(seeking,
|
||||||
EventNameType_HTML,
|
EventNameType_HTML,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(select,
|
EVENT(select,
|
||||||
NS_FORM_SELECTED,
|
eFormSelect,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(show,
|
EVENT(show,
|
||||||
|
@ -398,7 +398,7 @@ EVENT(stalled,
|
||||||
EventNameType_HTML,
|
EventNameType_HTML,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(submit,
|
EVENT(submit,
|
||||||
NS_FORM_SUBMIT,
|
eFormSubmit,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
EVENT(suspend,
|
EVENT(suspend,
|
||||||
|
@ -444,19 +444,19 @@ EVENT(afterscriptexecute,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
|
|
||||||
FORWARDED_EVENT(blur,
|
FORWARDED_EVENT(blur,
|
||||||
NS_BLUR_CONTENT,
|
eBlur,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eFocusEventClass)
|
eFocusEventClass)
|
||||||
ERROR_EVENT(error,
|
ERROR_EVENT(error,
|
||||||
NS_LOAD_ERROR,
|
eLoadError,
|
||||||
EventNameType_All,
|
EventNameType_All,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
FORWARDED_EVENT(focus,
|
FORWARDED_EVENT(focus,
|
||||||
NS_FOCUS_CONTENT,
|
eFocus,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eFocusEventClass)
|
eFocusEventClass)
|
||||||
FORWARDED_EVENT(load,
|
FORWARDED_EVENT(load,
|
||||||
NS_LOAD,
|
eLoad,
|
||||||
EventNameType_All,
|
EventNameType_All,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
FORWARDED_EVENT(resize,
|
FORWARDED_EVENT(resize,
|
||||||
|
@ -477,11 +477,11 @@ WINDOW_EVENT(beforeprint,
|
||||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
BEFOREUNLOAD_EVENT(beforeunload,
|
BEFOREUNLOAD_EVENT(beforeunload,
|
||||||
NS_BEFORE_PAGE_UNLOAD,
|
eBeforeUnload,
|
||||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
WINDOW_EVENT(hashchange,
|
WINDOW_EVENT(hashchange,
|
||||||
NS_HASHCHANGE,
|
eHashChange,
|
||||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
WINDOW_EVENT(languagechange,
|
WINDOW_EVENT(languagechange,
|
||||||
|
@ -512,7 +512,7 @@ WINDOW_EVENT(pageshow,
|
||||||
EventNameType_HTMLBodyOrFramesetOnly,
|
EventNameType_HTMLBodyOrFramesetOnly,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
WINDOW_EVENT(popstate,
|
WINDOW_EVENT(popstate,
|
||||||
NS_POPSTATE,
|
ePopState,
|
||||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
// Not supported yet
|
// Not supported yet
|
||||||
|
@ -522,7 +522,7 @@ WINDOW_EVENT(popstate,
|
||||||
// Not supported yet
|
// Not supported yet
|
||||||
// WINDOW_EVENT(undo)
|
// WINDOW_EVENT(undo)
|
||||||
WINDOW_EVENT(unload,
|
WINDOW_EVENT(unload,
|
||||||
NS_PAGE_UNLOAD,
|
eUnload,
|
||||||
(EventNameType_XUL | EventNameType_SVGSVG |
|
(EventNameType_XUL | EventNameType_SVGSVG |
|
||||||
EventNameType_HTMLBodyOrFramesetOnly),
|
EventNameType_HTMLBodyOrFramesetOnly),
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
|
@ -581,7 +581,7 @@ TOUCH_EVENT(touchcancel,
|
||||||
eTouchEventClass)
|
eTouchEventClass)
|
||||||
|
|
||||||
DOCUMENT_ONLY_EVENT(readystatechange,
|
DOCUMENT_ONLY_EVENT(readystatechange,
|
||||||
NS_READYSTATECHANGE,
|
eReadyStateChange,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
|
|
||||||
|
@ -620,15 +620,15 @@ NON_IDL_EVENT(DOMSubtreeModified,
|
||||||
eMutationEventClass)
|
eMutationEventClass)
|
||||||
|
|
||||||
NON_IDL_EVENT(DOMActivate,
|
NON_IDL_EVENT(DOMActivate,
|
||||||
NS_UI_ACTIVATE,
|
eLegacyDOMActivate,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eUIEventClass)
|
eUIEventClass)
|
||||||
NON_IDL_EVENT(DOMFocusIn,
|
NON_IDL_EVENT(DOMFocusIn,
|
||||||
NS_UI_FOCUSIN,
|
eLegacyDOMFocusIn,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eUIEventClass)
|
eUIEventClass)
|
||||||
NON_IDL_EVENT(DOMFocusOut,
|
NON_IDL_EVENT(DOMFocusOut,
|
||||||
NS_UI_FOCUSOUT,
|
eLegacyDOMFocusOut,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eUIEventClass)
|
eUIEventClass)
|
||||||
|
|
||||||
|
@ -720,15 +720,15 @@ NON_IDL_EVENT(commandupdate,
|
||||||
EventNameType_XUL,
|
EventNameType_XUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
NON_IDL_EVENT(dragexit,
|
NON_IDL_EVENT(dragexit,
|
||||||
NS_DRAGDROP_EXIT,
|
eDragExit,
|
||||||
EventNameType_XUL,
|
EventNameType_XUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
NON_IDL_EVENT(dragdrop,
|
NON_IDL_EVENT(dragdrop,
|
||||||
NS_DRAGDROP_DRAGDROP,
|
eLegacyDragDrop,
|
||||||
EventNameType_XUL,
|
EventNameType_XUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
NON_IDL_EVENT(draggesture,
|
NON_IDL_EVENT(draggesture,
|
||||||
NS_DRAGDROP_GESTURE,
|
eLegacyDragGesture,
|
||||||
EventNameType_XUL,
|
EventNameType_XUL,
|
||||||
eDragEventClass)
|
eDragEventClass)
|
||||||
NON_IDL_EVENT(overflow,
|
NON_IDL_EVENT(overflow,
|
||||||
|
|
|
@ -646,16 +646,16 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||||
FlushPendingEvents(aPresContext);
|
FlushPendingEvents(aPresContext);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NS_DRAGDROP_GESTURE:
|
case eLegacyDragGesture:
|
||||||
if (Prefs::ClickHoldContextMenu()) {
|
if (Prefs::ClickHoldContextMenu()) {
|
||||||
// an external drag gesture event came in, not generated internally
|
// an external drag gesture event came in, not generated internally
|
||||||
// by Gecko. Make sure we get rid of the click-hold timer.
|
// by Gecko. Make sure we get rid of the click-hold timer.
|
||||||
KillClickHoldTimer();
|
KillClickHoldTimer();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NS_DRAGDROP_OVER:
|
case eDragOver:
|
||||||
// NS_DRAGDROP_DROP is fired before NS_DRAGDROP_DRAGDROP so send
|
// eDrop is fired before eLegacyDragDrop so send the enter/exit events
|
||||||
// the enter/exit events before NS_DRAGDROP_DROP.
|
// before eDrop.
|
||||||
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
|
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1193,9 +1193,9 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
|
||||||
}
|
}
|
||||||
case eDragEventClass:
|
case eDragEventClass:
|
||||||
switch (aEvent.mMessage) {
|
switch (aEvent.mMessage) {
|
||||||
case NS_DRAGDROP_OVER:
|
case eDragOver:
|
||||||
case NS_DRAGDROP_EXIT:
|
case eDragExit:
|
||||||
case NS_DRAGDROP_DROP:
|
case eDrop:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1637,7 +1637,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsRefPtr<DataTransfer> dataTransfer =
|
nsRefPtr<DataTransfer> dataTransfer =
|
||||||
new DataTransfer(window, NS_DRAGDROP_START, false, -1);
|
new DataTransfer(window, eDragStart, false, -1);
|
||||||
|
|
||||||
nsCOMPtr<nsISelection> selection;
|
nsCOMPtr<nsISelection> selection;
|
||||||
nsCOMPtr<nsIContent> eventContent, targetContent;
|
nsCOMPtr<nsIContent> eventContent, targetContent;
|
||||||
|
@ -1663,11 +1663,11 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||||
|
|
||||||
// get the widget from the target frame
|
// get the widget from the target frame
|
||||||
WidgetDragEvent startEvent(aEvent->mFlags.mIsTrusted,
|
WidgetDragEvent startEvent(aEvent->mFlags.mIsTrusted,
|
||||||
NS_DRAGDROP_START, widget);
|
eDragStart, widget);
|
||||||
FillInEventFromGestureDown(&startEvent);
|
FillInEventFromGestureDown(&startEvent);
|
||||||
|
|
||||||
WidgetDragEvent gestureEvent(aEvent->mFlags.mIsTrusted,
|
WidgetDragEvent gestureEvent(aEvent->mFlags.mIsTrusted,
|
||||||
NS_DRAGDROP_GESTURE, widget);
|
eLegacyDragGesture, widget);
|
||||||
FillInEventFromGestureDown(&gestureEvent);
|
FillInEventFromGestureDown(&gestureEvent);
|
||||||
|
|
||||||
startEvent.dataTransfer = gestureEvent.dataTransfer = dataTransfer;
|
startEvent.dataTransfer = gestureEvent.dataTransfer = dataTransfer;
|
||||||
|
@ -1726,7 +1726,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that frame event handling doesn't care about NS_DRAGDROP_GESTURE,
|
// Note that frame event handling doesn't care about eLegacyDragGesture,
|
||||||
// which is just as well since we don't really know which frame to
|
// which is just as well since we don't really know which frame to
|
||||||
// send it to
|
// send it to
|
||||||
|
|
||||||
|
@ -3171,8 +3171,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_DRAGDROP_ENTER:
|
case eDragEnter:
|
||||||
case NS_DRAGDROP_OVER:
|
case eDragOver:
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aEvent->mClass == eDragEventClass, "Expected a drag event");
|
NS_ASSERTION(aEvent->mClass == eDragEventClass, "Expected a drag event");
|
||||||
|
|
||||||
|
@ -3261,13 +3261,13 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||||
|
|
||||||
// For now, do this only for dragover.
|
// For now, do this only for dragover.
|
||||||
//XXXsmaug dragenter needs some more work.
|
//XXXsmaug dragenter needs some more work.
|
||||||
if (aEvent->mMessage == NS_DRAGDROP_OVER && !isChromeDoc) {
|
if (aEvent->mMessage == eDragOver && !isChromeDoc) {
|
||||||
// Someone has called preventDefault(), check whether is was on
|
// Someone has called preventDefault(), check whether is was on
|
||||||
// content or chrome.
|
// content or chrome.
|
||||||
dragSession->SetOnlyChromeDrop(
|
dragSession->SetOnlyChromeDrop(
|
||||||
!dragEvent->mDefaultPreventedOnContent);
|
!dragEvent->mDefaultPreventedOnContent);
|
||||||
}
|
}
|
||||||
} else if (aEvent->mMessage == NS_DRAGDROP_OVER && !isChromeDoc) {
|
} else if (aEvent->mMessage == eDragOver && !isChromeDoc) {
|
||||||
// No one called preventDefault(), so handle drop only in chrome.
|
// No one called preventDefault(), so handle drop only in chrome.
|
||||||
dragSession->SetOnlyChromeDrop(true);
|
dragSession->SetOnlyChromeDrop(true);
|
||||||
}
|
}
|
||||||
|
@ -3286,7 +3286,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_DRAGDROP_DROP:
|
case eDrop:
|
||||||
{
|
{
|
||||||
// now fire the dragdrop event, for compatibility with XUL
|
// now fire the dragdrop event, for compatibility with XUL
|
||||||
if (mCurrentTarget && nsEventStatus_eConsumeNoDefault != *aStatus) {
|
if (mCurrentTarget && nsEventStatus_eConsumeNoDefault != *aStatus) {
|
||||||
|
@ -3296,7 +3296,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||||
|
|
||||||
nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
|
nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
|
||||||
WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
|
WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
|
||||||
NS_DRAGDROP_DRAGDROP, widget);
|
eLegacyDragDrop, widget);
|
||||||
|
|
||||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||||
event.refPoint = mouseEvent->refPoint;
|
event.refPoint = mouseEvent->refPoint;
|
||||||
|
@ -3319,9 +3319,9 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||||
ClearGlobalActiveContent(this);
|
ClearGlobalActiveContent(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NS_DRAGDROP_EXIT:
|
case eDragExit:
|
||||||
// make sure to fire the enter and exit_synth events after the
|
// make sure to fire the enter and exit_synth events after the
|
||||||
// NS_DRAGDROP_EXIT event, otherwise we'll clean up too early
|
// eDragExit event, otherwise we'll clean up too early
|
||||||
GenerateDragDropEnterExit(presContext, aEvent->AsDragEvent());
|
GenerateDragDropEnterExit(presContext, aEvent->AsDragEvent());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -4299,7 +4299,7 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||||
|
|
||||||
switch(aDragEvent->mMessage) {
|
switch(aDragEvent->mMessage) {
|
||||||
case NS_DRAGDROP_OVER:
|
case eDragOver:
|
||||||
{
|
{
|
||||||
// when dragging from one frame to another, events are fired in the
|
// when dragging from one frame to another, events are fired in the
|
||||||
// order: dragexit, dragenter, dragleave
|
// order: dragexit, dragenter, dragleave
|
||||||
|
@ -4316,16 +4316,16 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||||
getter_AddRefs(lastContent));
|
getter_AddRefs(lastContent));
|
||||||
|
|
||||||
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
||||||
aDragEvent, NS_DRAGDROP_EXIT,
|
aDragEvent, eDragExit,
|
||||||
targetContent, lastContent, sLastDragOverFrame);
|
targetContent, lastContent, sLastDragOverFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
FireDragEnterOrExit(aPresContext, aDragEvent, NS_DRAGDROP_ENTER,
|
FireDragEnterOrExit(aPresContext, aDragEvent, eDragEnter,
|
||||||
lastContent, targetContent, mCurrentTarget);
|
lastContent, targetContent, mCurrentTarget);
|
||||||
|
|
||||||
if (sLastDragOverFrame) {
|
if (sLastDragOverFrame) {
|
||||||
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
||||||
aDragEvent, NS_DRAGDROP_LEAVE,
|
aDragEvent, eDragLeave,
|
||||||
targetContent, lastContent, sLastDragOverFrame);
|
targetContent, lastContent, sLastDragOverFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4334,7 +4334,7 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_DRAGDROP_EXIT:
|
case eDragExit:
|
||||||
{
|
{
|
||||||
//This is actually the window mouse exit event.
|
//This is actually the window mouse exit event.
|
||||||
if (sLastDragOverFrame) {
|
if (sLastDragOverFrame) {
|
||||||
|
@ -4344,10 +4344,10 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||||
|
|
||||||
nsRefPtr<nsPresContext> lastDragOverFramePresContext = sLastDragOverFrame->PresContext();
|
nsRefPtr<nsPresContext> lastDragOverFramePresContext = sLastDragOverFrame->PresContext();
|
||||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||||
aDragEvent, NS_DRAGDROP_EXIT,
|
aDragEvent, eDragExit,
|
||||||
nullptr, lastContent, sLastDragOverFrame);
|
nullptr, lastContent, sLastDragOverFrame);
|
||||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||||
aDragEvent, NS_DRAGDROP_LEAVE,
|
aDragEvent, eDragLeave,
|
||||||
nullptr, lastContent, sLastDragOverFrame);
|
nullptr, lastContent, sLastDragOverFrame);
|
||||||
|
|
||||||
sLastDragOverFrame = nullptr;
|
sLastDragOverFrame = nullptr;
|
||||||
|
@ -4393,17 +4393,15 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust the drag hover if the dragenter event was cancelled or this is a drag exit
|
// adjust the drag hover if the dragenter event was cancelled or this is a drag exit
|
||||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
if (status == nsEventStatus_eConsumeNoDefault || aMessage == eDragExit) {
|
||||||
aMessage == NS_DRAGDROP_EXIT) {
|
SetContentState((aMessage == eDragEnter) ? aTargetContent : nullptr,
|
||||||
SetContentState((aMessage == NS_DRAGDROP_ENTER) ?
|
|
||||||
aTargetContent : nullptr,
|
|
||||||
NS_EVENT_STATE_DRAGOVER);
|
NS_EVENT_STATE_DRAGOVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect any changes to moz cursor settings stored in the event's
|
// collect any changes to moz cursor settings stored in the event's
|
||||||
// data transfer.
|
// data transfer.
|
||||||
if (aMessage == NS_DRAGDROP_LEAVE || aMessage == NS_DRAGDROP_EXIT ||
|
if (aMessage == eDragLeave || aMessage == eDragExit ||
|
||||||
aMessage == NS_DRAGDROP_ENTER) {
|
aMessage == eDragEnter) {
|
||||||
UpdateDragDataTransfer(&event);
|
UpdateDragDataTransfer(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4610,8 +4608,7 @@ already_AddRefed<nsIContent>
|
||||||
EventStateManager::GetEventTargetContent(WidgetEvent* aEvent)
|
EventStateManager::GetEventTargetContent(WidgetEvent* aEvent)
|
||||||
{
|
{
|
||||||
if (aEvent &&
|
if (aEvent &&
|
||||||
(aEvent->mMessage == NS_FOCUS_CONTENT ||
|
(aEvent->mMessage == eFocus || aEvent->mMessage == eBlur)) {
|
||||||
aEvent->mMessage == NS_BLUR_CONTENT)) {
|
|
||||||
nsCOMPtr<nsIContent> content = GetFocusedContent();
|
nsCOMPtr<nsIContent> content = GetFocusedContent();
|
||||||
return content.forget();
|
return content.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ FocusEvent::FocusEvent(EventTarget* aOwner,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
InternalFocusEvent* aEvent)
|
InternalFocusEvent* aEvent)
|
||||||
: UIEvent(aOwner, aPresContext,
|
: UIEvent(aOwner, aPresContext,
|
||||||
aEvent ? aEvent : new InternalFocusEvent(false, NS_FOCUS_CONTENT))
|
aEvent ? aEvent : new InternalFocusEvent(false, eFocus))
|
||||||
{
|
{
|
||||||
if (aEvent) {
|
if (aEvent) {
|
||||||
mEventIsInternal = false;
|
mEventIsInternal = false;
|
||||||
|
|
|
@ -185,7 +185,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case eMouseMove:
|
case eMouseMove:
|
||||||
case NS_DRAGDROP_OVER: {
|
case eDragOver: {
|
||||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||||
if (mouseEvent->IsReal()) {
|
if (mouseEvent->IsReal()) {
|
||||||
// If the cursor is moving to be outside the frame,
|
// If the cursor is moving to be outside the frame,
|
||||||
|
@ -215,7 +215,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
||||||
case eMouseDoubleClick:
|
case eMouseDoubleClick:
|
||||||
case eMouseClick:
|
case eMouseClick:
|
||||||
case eContextMenu:
|
case eContextMenu:
|
||||||
case NS_DRAGDROP_DROP:
|
case eDrop:
|
||||||
EndTransaction();
|
EndTransaction();
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -222,7 +222,7 @@ HTMLButtonElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||||
bool outerActivateEvent =
|
bool outerActivateEvent =
|
||||||
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||||
(aVisitor.mEvent->mMessage == NS_UI_ACTIVATE &&
|
(aVisitor.mEvent->mMessage == eLegacyDOMActivate &&
|
||||||
!mInInternalActivate));
|
!mInInternalActivate));
|
||||||
|
|
||||||
if (outerActivateEvent) {
|
if (outerActivateEvent) {
|
||||||
|
@ -252,7 +252,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
if (mouseEvent && mouseEvent->IsLeftClickEvent()) {
|
if (mouseEvent && mouseEvent->IsLeftClickEvent()) {
|
||||||
// DOMActive event should be trusted since the activation is actually
|
// DOMActive event should be trusted since the activation is actually
|
||||||
// occurred even if the cause is an untrusted click event.
|
// occurred even if the cause is an untrusted click event.
|
||||||
InternalUIEvent actEvent(true, NS_UI_ACTIVATE, mouseEvent);
|
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
||||||
actEvent.detail = 1;
|
actEvent.detail = 1;
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||||
|
@ -370,7 +370,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
|
if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
|
||||||
mType == NS_FORM_BUTTON_RESET)) {
|
mType == NS_FORM_BUTTON_RESET)) {
|
||||||
InternalFormEvent event(true,
|
InternalFormEvent event(true,
|
||||||
(mType == NS_FORM_BUTTON_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
|
(mType == NS_FORM_BUTTON_RESET) ? eFormReset : eFormSubmit);
|
||||||
event.originator = this;
|
event.originator = this;
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
//
|
//
|
||||||
// Using presShell to dispatch the event. It makes sure that
|
// Using presShell to dispatch the event. It makes sure that
|
||||||
// event is not handled if the window is being destroyed.
|
// event is not handled if the window is being destroyed.
|
||||||
if (presShell && (event.mMessage != NS_FORM_SUBMIT ||
|
if (presShell && (event.mMessage != eFormSubmit ||
|
||||||
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
||||||
// We know the element is a submit control, if this check is moved,
|
// We know the element is a submit control, if this check is moved,
|
||||||
// make sure formnovalidate is used only if it's a submit control.
|
// make sure formnovalidate is used only if it's a submit control.
|
||||||
|
|
|
@ -256,7 +256,7 @@ HTMLFormElement::Submit(ErrorResult& aRv)
|
||||||
mPendingSubmission = nullptr;
|
mPendingSubmission = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
aRv = DoSubmitOrReset(nullptr, NS_FORM_SUBMIT);
|
aRv = DoSubmitOrReset(nullptr, eFormSubmit);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -270,7 +270,7 @@ HTMLFormElement::Submit()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
HTMLFormElement::Reset()
|
HTMLFormElement::Reset()
|
||||||
{
|
{
|
||||||
InternalFormEvent event(true, NS_FORM_RESET);
|
InternalFormEvent event(true, eFormReset);
|
||||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr, &event);
|
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr, &event);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ HTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
aVisitor.mWantsWillHandleEvent = true;
|
aVisitor.mWantsWillHandleEvent = true;
|
||||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||||
uint32_t msg = aVisitor.mEvent->mMessage;
|
uint32_t msg = aVisitor.mEvent->mMessage;
|
||||||
if (msg == NS_FORM_SUBMIT) {
|
if (msg == eFormSubmit) {
|
||||||
if (mGeneratingSubmit) {
|
if (mGeneratingSubmit) {
|
||||||
aVisitor.mCanHandle = false;
|
aVisitor.mCanHandle = false;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -504,8 +504,7 @@ HTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
// that means that if there are scripted submissions, the
|
// that means that if there are scripted submissions, the
|
||||||
// latest one will be deferred until after the exit point of the handler.
|
// latest one will be deferred until after the exit point of the handler.
|
||||||
mDeferSubmission = true;
|
mDeferSubmission = true;
|
||||||
}
|
} else if (msg == eFormReset) {
|
||||||
else if (msg == NS_FORM_RESET) {
|
|
||||||
if (mGeneratingReset) {
|
if (mGeneratingReset) {
|
||||||
aVisitor.mCanHandle = false;
|
aVisitor.mCanHandle = false;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -522,8 +521,8 @@ HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
// If this is the bubble stage and there is a nested form below us which
|
// If this is the bubble stage and there is a nested form below us which
|
||||||
// received a submit event we do *not* want to handle the submit event
|
// received a submit event we do *not* want to handle the submit event
|
||||||
// for this form too.
|
// for this form too.
|
||||||
if ((aVisitor.mEvent->mMessage == NS_FORM_SUBMIT ||
|
if ((aVisitor.mEvent->mMessage == eFormSubmit ||
|
||||||
aVisitor.mEvent->mMessage == NS_FORM_RESET) &&
|
aVisitor.mEvent->mMessage == eFormReset) &&
|
||||||
aVisitor.mEvent->mFlags.mInBubblingPhase &&
|
aVisitor.mEvent->mFlags.mInBubblingPhase &&
|
||||||
aVisitor.mEvent->originalTarget != static_cast<nsIContent*>(this)) {
|
aVisitor.mEvent->originalTarget != static_cast<nsIContent*>(this)) {
|
||||||
aVisitor.mEvent->mFlags.mPropagationStopped = true;
|
aVisitor.mEvent->mFlags.mPropagationStopped = true;
|
||||||
|
@ -536,17 +535,16 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
{
|
{
|
||||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||||
if (msg == NS_FORM_SUBMIT) {
|
if (msg == eFormSubmit) {
|
||||||
// let the form know not to defer subsequent submissions
|
// let the form know not to defer subsequent submissions
|
||||||
mDeferSubmission = false;
|
mDeferSubmission = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aVisitor.mEventStatus == nsEventStatus_eIgnore) {
|
if (aVisitor.mEventStatus == nsEventStatus_eIgnore) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case NS_FORM_RESET:
|
case eFormReset:
|
||||||
case NS_FORM_SUBMIT:
|
case eFormSubmit: {
|
||||||
{
|
if (mPendingSubmission && msg == eFormSubmit) {
|
||||||
if (mPendingSubmission && msg == NS_FORM_SUBMIT) {
|
|
||||||
// tell the form to forget a possible pending submission.
|
// tell the form to forget a possible pending submission.
|
||||||
// the reason is that the script returned true (the event was
|
// the reason is that the script returned true (the event was
|
||||||
// ignored) so if there is a stored submission, it will miss
|
// ignored) so if there is a stored submission, it will miss
|
||||||
|
@ -561,7 +559,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (msg == NS_FORM_SUBMIT) {
|
if (msg == eFormSubmit) {
|
||||||
// tell the form to flush a possible pending submission.
|
// tell the form to flush a possible pending submission.
|
||||||
// the reason is that the script returned false (the event was
|
// the reason is that the script returned false (the event was
|
||||||
// not ignored) so if there is a stored submission, it needs to
|
// not ignored) so if there is a stored submission, it needs to
|
||||||
|
@ -570,10 +568,9 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg == NS_FORM_SUBMIT) {
|
if (msg == eFormSubmit) {
|
||||||
mGeneratingSubmit = false;
|
mGeneratingSubmit = false;
|
||||||
}
|
} else if (msg == eFormReset) {
|
||||||
else if (msg == NS_FORM_RESET) {
|
|
||||||
mGeneratingReset = false;
|
mGeneratingReset = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,7 +579,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
|
HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
|
||||||
int32_t aMessage)
|
EventMessage aMessage)
|
||||||
{
|
{
|
||||||
// Make sure the presentation is up-to-date
|
// Make sure the presentation is up-to-date
|
||||||
nsIDocument* doc = GetComposedDoc();
|
nsIDocument* doc = GetComposedDoc();
|
||||||
|
@ -593,11 +590,11 @@ HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
|
||||||
// JBK Don't get form frames anymore - bug 34297
|
// JBK Don't get form frames anymore - bug 34297
|
||||||
|
|
||||||
// Submit or Reset the form
|
// Submit or Reset the form
|
||||||
if (NS_FORM_RESET == aMessage) {
|
if (eFormReset == aMessage) {
|
||||||
return DoReset();
|
return DoReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FORM_SUBMIT == aMessage) {
|
if (eFormSubmit == aMessage) {
|
||||||
// Don't submit if we're not in a document or if we're in
|
// Don't submit if we're not in a document or if we're in
|
||||||
// a sandboxed frame and form submit is disabled.
|
// a sandboxed frame and form submit is disabled.
|
||||||
if (!doc || (doc->GetSandboxFlags() & SANDBOXED_FORMS)) {
|
if (!doc || (doc->GetSandboxFlags() & SANDBOXED_FORMS)) {
|
||||||
|
|
|
@ -452,7 +452,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
nsresult DoSubmitOrReset(WidgetEvent* aEvent,
|
nsresult DoSubmitOrReset(WidgetEvent* aEvent,
|
||||||
int32_t aMessage);
|
EventMessage aMessage);
|
||||||
nsresult DoReset();
|
nsresult DoReset();
|
||||||
|
|
||||||
// Async callback to handle removal of our default submit
|
// Async callback to handle removal of our default submit
|
||||||
|
|
|
@ -2817,7 +2817,7 @@ HTMLInputElement::MaybeSubmitForm(nsPresContext* aPresContext)
|
||||||
// If there's only one text control, just submit the form
|
// If there's only one text control, just submit the form
|
||||||
// Hold strong ref across the event
|
// Hold strong ref across the event
|
||||||
nsRefPtr<mozilla::dom::HTMLFormElement> form = mForm;
|
nsRefPtr<mozilla::dom::HTMLFormElement> form = mForm;
|
||||||
InternalFormEvent event(true, NS_FORM_SUBMIT);
|
InternalFormEvent event(true, eFormSubmit);
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
shell->HandleDOMEventWithTarget(mForm, &event, &status);
|
shell->HandleDOMEventWithTarget(mForm, &event, &status);
|
||||||
}
|
}
|
||||||
|
@ -2987,7 +2987,7 @@ HTMLInputElement::DispatchSelectEvent(nsPresContext* aPresContext)
|
||||||
|
|
||||||
// If already handling select event, don't dispatch a second.
|
// If already handling select event, don't dispatch a second.
|
||||||
if (!mHandlingSelectEvent) {
|
if (!mHandlingSelectEvent) {
|
||||||
WidgetEvent event(nsContentUtils::IsCallerChrome(), NS_FORM_SELECTED);
|
WidgetEvent event(nsContentUtils::IsCallerChrome(), eFormSelect);
|
||||||
|
|
||||||
mHandlingSelectEvent = true;
|
mHandlingSelectEvent = true;
|
||||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||||
|
@ -3087,7 +3087,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||||
bool outerActivateEvent =
|
bool outerActivateEvent =
|
||||||
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||||
(aVisitor.mEvent->mMessage == NS_UI_ACTIVATE && !mInInternalActivate));
|
(aVisitor.mEvent->mMessage == eLegacyDOMActivate && !mInInternalActivate));
|
||||||
|
|
||||||
if (outerActivateEvent) {
|
if (outerActivateEvent) {
|
||||||
aVisitor.mItemFlags |= NS_OUTER_ACTIVATE_EVENT;
|
aVisitor.mItemFlags |= NS_OUTER_ACTIVATE_EVENT;
|
||||||
|
@ -3162,7 +3162,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
aVisitor.mItemFlags |= mType;
|
aVisitor.mItemFlags |= mType;
|
||||||
|
|
||||||
// Fire onchange (if necessary), before we do the blur, bug 357684.
|
// Fire onchange (if necessary), before we do the blur, bug 357684.
|
||||||
if (aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
if (aVisitor.mEvent->mMessage == eBlur) {
|
||||||
// Experimental mobile types rely on the system UI to prevent users to not
|
// Experimental mobile types rely on the system UI to prevent users to not
|
||||||
// set invalid values but we have to be extra-careful. Especially if the
|
// set invalid values but we have to be extra-careful. Especially if the
|
||||||
// option has been enabled on desktop.
|
// option has been enabled on desktop.
|
||||||
|
@ -3177,8 +3177,8 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mType == NS_FORM_INPUT_RANGE &&
|
if (mType == NS_FORM_INPUT_RANGE &&
|
||||||
(aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
(aVisitor.mEvent->mMessage == eFocus ||
|
||||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT)) {
|
aVisitor.mEvent->mMessage == eBlur)) {
|
||||||
// Just as nsGenericHTMLFormElementWithState::PreHandleEvent calls
|
// Just as nsGenericHTMLFormElementWithState::PreHandleEvent calls
|
||||||
// nsIFormControlFrame::SetFocus, we handle focus here.
|
// nsIFormControlFrame::SetFocus, we handle focus here.
|
||||||
nsIFrame* frame = GetPrimaryFrame();
|
nsIFrame* frame = GetPrimaryFrame();
|
||||||
|
@ -3231,9 +3231,9 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
StopNumberControlSpinnerSpin();
|
StopNumberControlSpinnerSpin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
if (aVisitor.mEvent->mMessage == eFocus ||
|
||||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
aVisitor.mEvent->mMessage == eBlur) {
|
||||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
|
if (aVisitor.mEvent->mMessage == eFocus) {
|
||||||
// Tell our frame it's getting focus so that it can make sure focus
|
// Tell our frame it's getting focus so that it can make sure focus
|
||||||
// is moved to our anonymous text control.
|
// is moved to our anonymous text control.
|
||||||
nsNumberControlFrame* numberControlFrame =
|
nsNumberControlFrame* numberControlFrame =
|
||||||
|
@ -3299,7 +3299,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
numberControlFrame->HandlingInputEvent(false);
|
numberControlFrame->HandlingInputEvent(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aVisitor.mEvent->mMessage == NS_FORM_CHANGE) {
|
else if (aVisitor.mEvent->mMessage == eFormChange) {
|
||||||
// We cancel the DOM 'change' event that is fired for any change to our
|
// We cancel the DOM 'change' event that is fired for any change to our
|
||||||
// anonymous text control since we fire our own 'change' events and
|
// anonymous text control since we fire our own 'change' events and
|
||||||
// content shouldn't be seeing two 'change' events. Besides that we
|
// content shouldn't be seeing two 'change' events. Besides that we
|
||||||
|
@ -3587,15 +3587,15 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
return MaybeInitPickers(aVisitor);
|
return MaybeInitPickers(aVisitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
if (aVisitor.mEvent->mMessage == eFocus ||
|
||||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
aVisitor.mEvent->mMessage == eBlur) {
|
||||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT &&
|
if (aVisitor.mEvent->mMessage == eFocus &&
|
||||||
MayFireChangeOnBlur() &&
|
MayFireChangeOnBlur() &&
|
||||||
!mIsDraggingRange) { // StartRangeThumbDrag already set mFocusedValue
|
!mIsDraggingRange) { // StartRangeThumbDrag already set mFocusedValue
|
||||||
GetValue(mFocusedValue);
|
GetValue(mFocusedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
if (aVisitor.mEvent->mMessage == eBlur) {
|
||||||
if (mIsDraggingRange) {
|
if (mIsDraggingRange) {
|
||||||
FinishRangeThumbDrag();
|
FinishRangeThumbDrag();
|
||||||
} else if (mNumberControlSpinnerIsSpinning) {
|
} else if (mNumberControlSpinnerIsSpinning) {
|
||||||
|
@ -3603,7 +3603,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateValidityUIBits(aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT);
|
UpdateValidityUIBits(aVisitor.mEvent->mMessage == eFocus);
|
||||||
|
|
||||||
UpdateState(true);
|
UpdateState(true);
|
||||||
}
|
}
|
||||||
|
@ -3630,7 +3630,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
|
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
|
||||||
// DOMActive event should be trusted since the activation is actually
|
// DOMActive event should be trusted since the activation is actually
|
||||||
// occurred even if the cause is an untrusted click event.
|
// occurred even if the cause is an untrusted click event.
|
||||||
InternalUIEvent actEvent(true, NS_UI_ACTIVATE, mouseEvent);
|
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
||||||
actEvent.detail = 1;
|
actEvent.detail = 1;
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||||
|
@ -3745,9 +3745,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
} else if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
|
} else if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
|
||||||
switch (aVisitor.mEvent->mMessage) {
|
switch (aVisitor.mEvent->mMessage) {
|
||||||
|
case eFocus: {
|
||||||
case NS_FOCUS_CONTENT:
|
|
||||||
{
|
|
||||||
// see if we should select the contents of the textbox. This happens
|
// see if we should select the contents of the textbox. This happens
|
||||||
// for text and password fields when the field was focused by the
|
// for text and password fields when the field was focused by the
|
||||||
// keyboard or a navigation, the platform allows it, and it wasn't
|
// keyboard or a navigation, the platform allows it, and it wasn't
|
||||||
|
@ -4015,7 +4013,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
case NS_FORM_INPUT_IMAGE:
|
case NS_FORM_INPUT_IMAGE:
|
||||||
if (mForm) {
|
if (mForm) {
|
||||||
InternalFormEvent event(true,
|
InternalFormEvent event(true,
|
||||||
(mType == NS_FORM_INPUT_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
|
(mType == NS_FORM_INPUT_RESET) ? eFormReset : eFormSubmit);
|
||||||
event.originator = this;
|
event.originator = this;
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
|
|
||||||
|
@ -4027,7 +4025,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
// pres shell. See bug 125624.
|
// pres shell. See bug 125624.
|
||||||
// TODO: removing this code and have the submit event sent by the
|
// TODO: removing this code and have the submit event sent by the
|
||||||
// form, see bug 592124.
|
// form, see bug 592124.
|
||||||
if (presShell && (event.mMessage != NS_FORM_SUBMIT ||
|
if (presShell && (event.mMessage != eFormSubmit ||
|
||||||
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
||||||
// We know the element is a submit control, if this check is moved,
|
// We know the element is a submit control, if this check is moved,
|
||||||
// make sure formnovalidate is used only if it's a submit control.
|
// make sure formnovalidate is used only if it's a submit control.
|
||||||
|
|
|
@ -216,11 +216,11 @@ HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (aEvent->mMessage) {
|
switch (aEvent->mMessage) {
|
||||||
case NS_FOCUS_CONTENT: {
|
case eFocus: {
|
||||||
OnFocusBlurPlugin(aElement, true);
|
OnFocusBlurPlugin(aElement, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NS_BLUR_CONTENT: {
|
case eBlur: {
|
||||||
OnFocusBlurPlugin(aElement, false);
|
OnFocusBlurPlugin(aElement, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ HTMLObjectElement::UnbindFromTree(bool aDeep,
|
||||||
{
|
{
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
// When a page is reloaded (when an nsIDocument's content is removed), the
|
// When a page is reloaded (when an nsIDocument's content is removed), the
|
||||||
// focused element isn't necessarily sent an NS_BLUR_CONTENT event. See
|
// focused element isn't necessarily sent an eBlur event. See
|
||||||
// nsFocusManager::ContentRemoved(). This means that a widget may think it
|
// nsFocusManager::ContentRemoved(). This means that a widget may think it
|
||||||
// still contains a focused plugin when it doesn't -- which in turn can
|
// still contains a focused plugin when it doesn't -- which in turn can
|
||||||
// disable text input in the browser window. See bug 1137229.
|
// disable text input in the browser window. See bug 1137229.
|
||||||
|
|
|
@ -1511,7 +1511,7 @@ HTMLSelectElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
nsresult
|
nsresult
|
||||||
HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
{
|
{
|
||||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
|
if (aVisitor.mEvent->mMessage == eFocus) {
|
||||||
// If the invalid UI is shown, we should show it while focused and
|
// If the invalid UI is shown, we should show it while focused and
|
||||||
// update the invalid/valid UI.
|
// update the invalid/valid UI.
|
||||||
mCanShowInvalidUI = !IsValid() && ShouldShowValidityUI();
|
mCanShowInvalidUI = !IsValid() && ShouldShowValidityUI();
|
||||||
|
@ -1522,7 +1522,7 @@ HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
|
|
||||||
// We don't have to update NS_EVENT_STATE_MOZ_UI_INVALID nor
|
// We don't have to update NS_EVENT_STATE_MOZ_UI_INVALID nor
|
||||||
// NS_EVENT_STATE_MOZ_UI_VALID given that the states should not change.
|
// NS_EVENT_STATE_MOZ_UI_VALID given that the states should not change.
|
||||||
} else if (aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
} else if (aVisitor.mEvent->mMessage == eBlur) {
|
||||||
mCanShowInvalidUI = true;
|
mCanShowInvalidUI = true;
|
||||||
mCanShowValidUI = true;
|
mCanShowValidUI = true;
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ HTMLSharedObjectElement::UnbindFromTree(bool aDeep,
|
||||||
{
|
{
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
// When a page is reloaded (when an nsIDocument's content is removed), the
|
// When a page is reloaded (when an nsIDocument's content is removed), the
|
||||||
// focused element isn't necessarily sent an NS_BLUR_CONTENT event. See
|
// focused element isn't necessarily sent an eBlur event. See
|
||||||
// nsFocusManager::ContentRemoved(). This means that a widget may think it
|
// nsFocusManager::ContentRemoved(). This means that a widget may think it
|
||||||
// still contains a focused plugin when it doesn't -- which in turn can
|
// still contains a focused plugin when it doesn't -- which in turn can
|
||||||
// disable text input in the browser window. See bug 1137229.
|
// disable text input in the browser window. See bug 1137229.
|
||||||
|
|
|
@ -137,7 +137,7 @@ HTMLTextAreaElement::Select()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
WidgetGUIEvent event(true, NS_FORM_SELECTED, nullptr);
|
WidgetGUIEvent event(true, eFormSelect, nullptr);
|
||||||
// XXXbz HTMLInputElement guards against this reentering; shouldn't we?
|
// XXXbz HTMLInputElement guards against this reentering; shouldn't we?
|
||||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||||
&event, nullptr, &status);
|
&event, nullptr, &status);
|
||||||
|
@ -486,7 +486,7 @@ HTMLTextAreaElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
|
|
||||||
// Don't dispatch a second select event if we are already handling
|
// Don't dispatch a second select event if we are already handling
|
||||||
// one.
|
// one.
|
||||||
if (aVisitor.mEvent->mMessage == NS_FORM_SELECTED) {
|
if (aVisitor.mEvent->mMessage == eFormSelect) {
|
||||||
if (mHandlingSelect) {
|
if (mHandlingSelect) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ HTMLTextAreaElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fire onchange (if necessary), before we do the blur, bug 370521.
|
// Fire onchange (if necessary), before we do the blur, bug 370521.
|
||||||
if (aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
if (aVisitor.mEvent->mMessage == eBlur) {
|
||||||
FireChangeEventIfNeeded();
|
FireChangeEventIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,13 +534,13 @@ HTMLTextAreaElement::FireChangeEventIfNeeded()
|
||||||
nsresult
|
nsresult
|
||||||
HTMLTextAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
HTMLTextAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
{
|
{
|
||||||
if (aVisitor.mEvent->mMessage == NS_FORM_SELECTED) {
|
if (aVisitor.mEvent->mMessage == eFormSelect) {
|
||||||
mHandlingSelect = false;
|
mHandlingSelect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
if (aVisitor.mEvent->mMessage == eFocus ||
|
||||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
aVisitor.mEvent->mMessage == eBlur) {
|
||||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
|
if (aVisitor.mEvent->mMessage == eFocus) {
|
||||||
// If the invalid UI is shown, we should show it while focusing (and
|
// If the invalid UI is shown, we should show it while focusing (and
|
||||||
// update). Otherwise, we should not.
|
// update). Otherwise, we should not.
|
||||||
GetValueInternal(mFocusedValue, true);
|
GetValueInternal(mFocusedValue, true);
|
||||||
|
@ -549,7 +549,7 @@ HTMLTextAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||||
// If neither invalid UI nor valid UI is shown, we shouldn't show the valid
|
// If neither invalid UI nor valid UI is shown, we shouldn't show the valid
|
||||||
// UI while typing.
|
// UI while typing.
|
||||||
mCanShowValidUI = ShouldShowValidityUI();
|
mCanShowValidUI = ShouldShowValidityUI();
|
||||||
} else { // NS_BLUR_CONTENT
|
} else { // eBlur
|
||||||
mCanShowInvalidUI = true;
|
mCanShowInvalidUI = true;
|
||||||
mCanShowValidUI = true;
|
mCanShowValidUI = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2251,8 +2251,7 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
{
|
{
|
||||||
if (aVisitor.mEvent->mFlags.mIsTrusted) {
|
if (aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||||
switch (aVisitor.mEvent->mMessage) {
|
switch (aVisitor.mEvent->mMessage) {
|
||||||
case NS_FOCUS_CONTENT:
|
case eFocus: {
|
||||||
{
|
|
||||||
// Check to see if focus has bubbled up from a form control's
|
// Check to see if focus has bubbled up from a form control's
|
||||||
// child textfield or button. If that's the case, don't focus
|
// child textfield or button. If that's the case, don't focus
|
||||||
// this parent file control -- leave focus on the child.
|
// this parent file control -- leave focus on the child.
|
||||||
|
@ -2262,8 +2261,7 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||||
formControlFrame->SetFocus(true, true);
|
formControlFrame->SetFocus(true, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NS_BLUR_CONTENT:
|
case eBlur: {
|
||||||
{
|
|
||||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||||
if (formControlFrame)
|
if (formControlFrame)
|
||||||
formControlFrame->SetFocus(false, false);
|
formControlFrame->SetFocus(false, false);
|
||||||
|
|
|
@ -819,7 +819,7 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection*
|
||||||
if (presShell)
|
if (presShell)
|
||||||
{
|
{
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
WidgetEvent event(true, NS_FORM_SELECTED);
|
WidgetEvent event(true, eFormSelect);
|
||||||
|
|
||||||
presShell->HandleEventWithTarget(&event, mFrame, content, &status);
|
presShell->HandleEventWithTarget(&event, mFrame, content, &status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,7 @@ class IDBDatabase::LogWarningRunnable final
|
||||||
nsCString mMessageName;
|
nsCString mMessageName;
|
||||||
nsString mFilename;
|
nsString mFilename;
|
||||||
uint32_t mLineNumber;
|
uint32_t mLineNumber;
|
||||||
|
uint32_t mColumnNumber;
|
||||||
uint64_t mInnerWindowID;
|
uint64_t mInnerWindowID;
|
||||||
bool mIsChrome;
|
bool mIsChrome;
|
||||||
|
|
||||||
|
@ -194,11 +195,13 @@ public:
|
||||||
LogWarningRunnable(const char* aMessageName,
|
LogWarningRunnable(const char* aMessageName,
|
||||||
const nsAString& aFilename,
|
const nsAString& aFilename,
|
||||||
uint32_t aLineNumber,
|
uint32_t aLineNumber,
|
||||||
|
uint32_t aColumnNumber,
|
||||||
bool aIsChrome,
|
bool aIsChrome,
|
||||||
uint64_t aInnerWindowID)
|
uint64_t aInnerWindowID)
|
||||||
: mMessageName(aMessageName)
|
: mMessageName(aMessageName)
|
||||||
, mFilename(aFilename)
|
, mFilename(aFilename)
|
||||||
, mLineNumber(aLineNumber)
|
, mLineNumber(aLineNumber)
|
||||||
|
, mColumnNumber(aColumnNumber)
|
||||||
, mInnerWindowID(aInnerWindowID)
|
, mInnerWindowID(aInnerWindowID)
|
||||||
, mIsChrome(aIsChrome)
|
, mIsChrome(aIsChrome)
|
||||||
{
|
{
|
||||||
|
@ -209,6 +212,7 @@ public:
|
||||||
LogWarning(const char* aMessageName,
|
LogWarning(const char* aMessageName,
|
||||||
const nsAString& aFilename,
|
const nsAString& aFilename,
|
||||||
uint32_t aLineNumber,
|
uint32_t aLineNumber,
|
||||||
|
uint32_t aColumnNumber,
|
||||||
bool aIsChrome,
|
bool aIsChrome,
|
||||||
uint64_t aInnerWindowID);
|
uint64_t aInnerWindowID);
|
||||||
|
|
||||||
|
@ -959,10 +963,10 @@ IDBDatabase::AbortTransactions(bool aShouldWarn)
|
||||||
MOZ_ASSERT(transaction);
|
MOZ_ASSERT(transaction);
|
||||||
|
|
||||||
nsString filename;
|
nsString filename;
|
||||||
uint32_t lineNo;
|
uint32_t lineNo, column;
|
||||||
transaction->GetCallerLocation(filename, &lineNo);
|
transaction->GetCallerLocation(filename, &lineNo, &column);
|
||||||
|
|
||||||
aDatabase->LogWarning(kWarningMessage, filename, lineNo);
|
aDatabase->LogWarning(kWarningMessage, filename, lineNo, column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1337,7 +1341,8 @@ IDBDatabase::Invalidate()
|
||||||
void
|
void
|
||||||
IDBDatabase::LogWarning(const char* aMessageName,
|
IDBDatabase::LogWarning(const char* aMessageName,
|
||||||
const nsAString& aFilename,
|
const nsAString& aFilename,
|
||||||
uint32_t aLineNumber)
|
uint32_t aLineNumber,
|
||||||
|
uint32_t aColumnNumber)
|
||||||
{
|
{
|
||||||
AssertIsOnOwningThread();
|
AssertIsOnOwningThread();
|
||||||
MOZ_ASSERT(aMessageName);
|
MOZ_ASSERT(aMessageName);
|
||||||
|
@ -1346,6 +1351,7 @@ IDBDatabase::LogWarning(const char* aMessageName,
|
||||||
LogWarningRunnable::LogWarning(aMessageName,
|
LogWarningRunnable::LogWarning(aMessageName,
|
||||||
aFilename,
|
aFilename,
|
||||||
aLineNumber,
|
aLineNumber,
|
||||||
|
aColumnNumber,
|
||||||
mFactory->IsChrome(),
|
mFactory->IsChrome(),
|
||||||
mFactory->InnerWindowID());
|
mFactory->InnerWindowID());
|
||||||
} else {
|
} else {
|
||||||
|
@ -1353,6 +1359,7 @@ IDBDatabase::LogWarning(const char* aMessageName,
|
||||||
new LogWarningRunnable(aMessageName,
|
new LogWarningRunnable(aMessageName,
|
||||||
aFilename,
|
aFilename,
|
||||||
aLineNumber,
|
aLineNumber,
|
||||||
|
aColumnNumber,
|
||||||
mFactory->IsChrome(),
|
mFactory->IsChrome(),
|
||||||
mFactory->InnerWindowID());
|
mFactory->InnerWindowID());
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
|
||||||
|
@ -1628,6 +1635,7 @@ IDBDatabase::
|
||||||
LogWarningRunnable::LogWarning(const char* aMessageName,
|
LogWarningRunnable::LogWarning(const char* aMessageName,
|
||||||
const nsAString& aFilename,
|
const nsAString& aFilename,
|
||||||
uint32_t aLineNumber,
|
uint32_t aLineNumber,
|
||||||
|
uint32_t aColumnNumber,
|
||||||
bool aIsChrome,
|
bool aIsChrome,
|
||||||
uint64_t aInnerWindowID)
|
uint64_t aInnerWindowID)
|
||||||
{
|
{
|
||||||
|
@ -1664,7 +1672,7 @@ LogWarningRunnable::LogWarning(const char* aMessageName,
|
||||||
aFilename,
|
aFilename,
|
||||||
/* aSourceLine */ EmptyString(),
|
/* aSourceLine */ EmptyString(),
|
||||||
aLineNumber,
|
aLineNumber,
|
||||||
/* aColumnNumber */ 0,
|
aColumnNumber,
|
||||||
nsIScriptError::warningFlag,
|
nsIScriptError::warningFlag,
|
||||||
category,
|
category,
|
||||||
aInnerWindowID)));
|
aInnerWindowID)));
|
||||||
|
@ -1674,7 +1682,7 @@ LogWarningRunnable::LogWarning(const char* aMessageName,
|
||||||
aFilename,
|
aFilename,
|
||||||
/* aSourceLine */ EmptyString(),
|
/* aSourceLine */ EmptyString(),
|
||||||
aLineNumber,
|
aLineNumber,
|
||||||
/* aColumnNumber */ 0,
|
aColumnNumber,
|
||||||
nsIScriptError::warningFlag,
|
nsIScriptError::warningFlag,
|
||||||
category.get())));
|
category.get())));
|
||||||
}
|
}
|
||||||
|
@ -1693,6 +1701,7 @@ LogWarningRunnable::Run()
|
||||||
LogWarning(mMessageName.get(),
|
LogWarning(mMessageName.get(),
|
||||||
mFilename,
|
mFilename,
|
||||||
mLineNumber,
|
mLineNumber,
|
||||||
|
mColumnNumber,
|
||||||
mIsChrome,
|
mIsChrome,
|
||||||
mInnerWindowID);
|
mInnerWindowID);
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,8 @@ private:
|
||||||
void
|
void
|
||||||
LogWarning(const char* aMessageName,
|
LogWarning(const char* aMessageName,
|
||||||
const nsAString& aFilename,
|
const nsAString& aFilename,
|
||||||
uint32_t aLineNumber);
|
uint32_t aLineNumber,
|
||||||
|
uint32_t aColumnNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace indexedDB
|
} // namespace indexedDB
|
||||||
|
|
|
@ -92,6 +92,7 @@ IDBRequest::InitMembers()
|
||||||
mLoggingSerialNumber = NextSerialNumber();
|
mLoggingSerialNumber = NextSerialNumber();
|
||||||
mErrorCode = NS_OK;
|
mErrorCode = NS_OK;
|
||||||
mLineNo = 0;
|
mLineNo = 0;
|
||||||
|
mColumn = 0;
|
||||||
mHaveResultOrErrorCode = false;
|
mHaveResultOrErrorCode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +105,7 @@ IDBRequest::Create(IDBDatabase* aDatabase,
|
||||||
aDatabase->AssertIsOnOwningThread();
|
aDatabase->AssertIsOnOwningThread();
|
||||||
|
|
||||||
nsRefPtr<IDBRequest> request = new IDBRequest(aDatabase);
|
nsRefPtr<IDBRequest> request = new IDBRequest(aDatabase);
|
||||||
CaptureCaller(request->mFilename, &request->mLineNo);
|
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
|
||||||
|
|
||||||
request->mTransaction = aTransaction;
|
request->mTransaction = aTransaction;
|
||||||
request->SetScriptOwner(aDatabase->GetScriptOwner());
|
request->SetScriptOwner(aDatabase->GetScriptOwner());
|
||||||
|
@ -168,13 +169,15 @@ IDBRequest::SetLoggingSerialNumber(uint64_t aLoggingSerialNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo)
|
IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo,
|
||||||
|
uint32_t* aColumn)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aFilename.IsEmpty());
|
MOZ_ASSERT(aFilename.IsEmpty());
|
||||||
MOZ_ASSERT(aLineNo);
|
MOZ_ASSERT(aLineNo);
|
||||||
|
MOZ_ASSERT(aColumn);
|
||||||
|
|
||||||
ThreadsafeAutoJSContext cx;
|
ThreadsafeAutoJSContext cx;
|
||||||
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo);
|
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo, aColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -271,13 +274,16 @@ IDBRequest::GetErrorAfterResult() const
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
void
|
void
|
||||||
IDBRequest::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const
|
IDBRequest::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
|
||||||
|
uint32_t* aColumn) const
|
||||||
{
|
{
|
||||||
AssertIsOnOwningThread();
|
AssertIsOnOwningThread();
|
||||||
MOZ_ASSERT(aLineNo);
|
MOZ_ASSERT(aLineNo);
|
||||||
|
MOZ_ASSERT(aColumn);
|
||||||
|
|
||||||
aFilename = mFilename;
|
aFilename = mFilename;
|
||||||
*aLineNo = mLineNo;
|
*aLineNo = mLineNo;
|
||||||
|
*aColumn = mColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
IDBRequestReadyState
|
IDBRequestReadyState
|
||||||
|
@ -516,7 +522,7 @@ IDBOpenDBRequest::CreateForWindow(IDBFactory* aFactory,
|
||||||
MOZ_ASSERT(aScriptOwner);
|
MOZ_ASSERT(aScriptOwner);
|
||||||
|
|
||||||
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, aOwner);
|
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, aOwner);
|
||||||
CaptureCaller(request->mFilename, &request->mLineNo);
|
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
|
||||||
|
|
||||||
request->SetScriptOwner(aScriptOwner);
|
request->SetScriptOwner(aScriptOwner);
|
||||||
|
|
||||||
|
@ -533,7 +539,7 @@ IDBOpenDBRequest::CreateForJS(IDBFactory* aFactory,
|
||||||
MOZ_ASSERT(aScriptOwner);
|
MOZ_ASSERT(aScriptOwner);
|
||||||
|
|
||||||
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, nullptr);
|
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, nullptr);
|
||||||
CaptureCaller(request->mFilename, &request->mLineNo);
|
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
|
||||||
|
|
||||||
request->SetScriptOwner(aScriptOwner);
|
request->SetScriptOwner(aScriptOwner);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
||||||
uint64_t mLoggingSerialNumber;
|
uint64_t mLoggingSerialNumber;
|
||||||
nsresult mErrorCode;
|
nsresult mErrorCode;
|
||||||
uint32_t mLineNo;
|
uint32_t mLineNo;
|
||||||
|
uint32_t mColumn;
|
||||||
bool mHaveResultOrErrorCode;
|
bool mHaveResultOrErrorCode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -82,7 +83,7 @@ public:
|
||||||
IDBTransaction* aTransaction);
|
IDBTransaction* aTransaction);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CaptureCaller(nsAString& aFilename, uint32_t* aLineNo);
|
CaptureCaller(nsAString& aFilename, uint32_t* aLineNo, uint32_t* aColumn);
|
||||||
|
|
||||||
static uint64_t
|
static uint64_t
|
||||||
NextSerialNumber();
|
NextSerialNumber();
|
||||||
|
@ -130,7 +131,8 @@ public:
|
||||||
GetError(ErrorResult& aRv);
|
GetError(ErrorResult& aRv);
|
||||||
|
|
||||||
void
|
void
|
||||||
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const;
|
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
|
||||||
|
uint32_t* aColumn) const;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
IsPending() const
|
IsPending() const
|
||||||
|
|
|
@ -82,6 +82,7 @@ IDBTransaction::IDBTransaction(IDBDatabase* aDatabase,
|
||||||
, mAbortCode(NS_OK)
|
, mAbortCode(NS_OK)
|
||||||
, mPendingRequestCount(0)
|
, mPendingRequestCount(0)
|
||||||
, mLineNo(0)
|
, mLineNo(0)
|
||||||
|
, mColumn(0)
|
||||||
, mReadyState(IDBTransaction::INITIAL)
|
, mReadyState(IDBTransaction::INITIAL)
|
||||||
, mMode(aMode)
|
, mMode(aMode)
|
||||||
, mCreating(false)
|
, mCreating(false)
|
||||||
|
@ -186,7 +187,7 @@ IDBTransaction::CreateVersionChange(
|
||||||
emptyObjectStoreNames,
|
emptyObjectStoreNames,
|
||||||
VERSION_CHANGE);
|
VERSION_CHANGE);
|
||||||
aOpenRequest->GetCallerLocation(transaction->mFilename,
|
aOpenRequest->GetCallerLocation(transaction->mFilename,
|
||||||
&transaction->mLineNo);
|
&transaction->mLineNo, &transaction->mColumn);
|
||||||
|
|
||||||
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
|
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
|
||||||
|
|
||||||
|
@ -219,7 +220,8 @@ IDBTransaction::Create(IDBDatabase* aDatabase,
|
||||||
|
|
||||||
nsRefPtr<IDBTransaction> transaction =
|
nsRefPtr<IDBTransaction> transaction =
|
||||||
new IDBTransaction(aDatabase, aObjectStoreNames, aMode);
|
new IDBTransaction(aDatabase, aObjectStoreNames, aMode);
|
||||||
IDBRequest::CaptureCaller(transaction->mFilename, &transaction->mLineNo);
|
IDBRequest::CaptureCaller(transaction->mFilename, &transaction->mLineNo,
|
||||||
|
&transaction->mColumn);
|
||||||
|
|
||||||
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
|
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
|
||||||
|
|
||||||
|
@ -492,13 +494,16 @@ IDBTransaction::IsOpen() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IDBTransaction::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const
|
IDBTransaction::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
|
||||||
|
uint32_t* aColumn) const
|
||||||
{
|
{
|
||||||
AssertIsOnOwningThread();
|
AssertIsOnOwningThread();
|
||||||
MOZ_ASSERT(aLineNo);
|
MOZ_ASSERT(aLineNo);
|
||||||
|
MOZ_ASSERT(aColumn);
|
||||||
|
|
||||||
aFilename = mFilename;
|
aFilename = mFilename;
|
||||||
*aLineNo = mLineNo;
|
*aLineNo = mLineNo;
|
||||||
|
*aColumn = mColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<IDBObjectStore>
|
already_AddRefed<IDBObjectStore>
|
||||||
|
|
|
@ -100,6 +100,7 @@ private:
|
||||||
|
|
||||||
nsString mFilename;
|
nsString mFilename;
|
||||||
uint32_t mLineNo;
|
uint32_t mLineNo;
|
||||||
|
uint32_t mColumn;
|
||||||
|
|
||||||
ReadyState mReadyState;
|
ReadyState mReadyState;
|
||||||
Mode mMode;
|
Mode mMode;
|
||||||
|
@ -205,7 +206,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const;
|
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
|
||||||
|
uint32_t* aColumn) const;
|
||||||
|
|
||||||
// 'Get' prefix is to avoid name collisions with the enum
|
// 'Get' prefix is to avoid name collisions with the enum
|
||||||
Mode
|
Mode
|
||||||
|
|
|
@ -480,7 +480,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
|
||||||
|
|
||||||
ThreadsafeAutoJSContext cx;
|
ThreadsafeAutoJSContext cx;
|
||||||
RootedDictionary<ErrorEventInit> init(cx);
|
RootedDictionary<ErrorEventInit> init(cx);
|
||||||
request->GetCallerLocation(init.mFilename, &init.mLineno);
|
request->GetCallerLocation(init.mFilename, &init.mLineno, &init.mColno);
|
||||||
|
|
||||||
init.mMessage = errorName;
|
init.mMessage = errorName;
|
||||||
init.mCancelable = true;
|
init.mCancelable = true;
|
||||||
|
@ -556,7 +556,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
|
||||||
init.mFilename,
|
init.mFilename,
|
||||||
/* aSourceLine */ EmptyString(),
|
/* aSourceLine */ EmptyString(),
|
||||||
init.mLineno,
|
init.mLineno,
|
||||||
/* aColumnNumber */ 0,
|
init.mColno,
|
||||||
nsIScriptError::errorFlag,
|
nsIScriptError::errorFlag,
|
||||||
category,
|
category,
|
||||||
innerWindowID)));
|
innerWindowID)));
|
||||||
|
@ -566,7 +566,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
|
||||||
init.mFilename,
|
init.mFilename,
|
||||||
/* aSourceLine */ EmptyString(),
|
/* aSourceLine */ EmptyString(),
|
||||||
init.mLineno,
|
init.mLineno,
|
||||||
/* aColumnNumber */ 0,
|
init.mColno,
|
||||||
nsIScriptError::errorFlag,
|
nsIScriptError::errorFlag,
|
||||||
category.get())));
|
category.get())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ interface nsIJSRAIIHelper;
|
||||||
interface nsIContentPermissionRequest;
|
interface nsIContentPermissionRequest;
|
||||||
interface nsIObserver;
|
interface nsIObserver;
|
||||||
|
|
||||||
[scriptable, uuid(6ddc9a79-18cd-4dbc-9975-68928e6c9857)]
|
[scriptable, uuid(a30a95ac-3b95-4251-88dc-8efa89ba9f9c)]
|
||||||
interface nsIDOMWindowUtils : nsISupports {
|
interface nsIDOMWindowUtils : nsISupports {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,15 +106,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||||
*/
|
*/
|
||||||
void updateLayerTree();
|
void updateLayerTree();
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the CSS viewport to be |widthPx| x |heightPx| in units of CSS
|
|
||||||
* pixels, regardless of the size of the enclosing widget/view.
|
|
||||||
* This will trigger reflow.
|
|
||||||
*
|
|
||||||
* The caller of this method must have chrome privileges.
|
|
||||||
*/
|
|
||||||
void setCSSViewport(in float aWidthPx, in float aHeightPx);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information retrieved from the <meta name="viewport"> tag.
|
* Information retrieved from the <meta name="viewport"> tag.
|
||||||
* See nsContentUtils::GetViewportInfo for more information.
|
* See nsContentUtils::GetViewportInfo for more information.
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "mozilla/dom/ipc/BlobChild.h"
|
#include "mozilla/dom/ipc/BlobChild.h"
|
||||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||||
#include "mozilla/ipc/InputStreamUtils.h"
|
#include "mozilla/ipc/InputStreamUtils.h"
|
||||||
#include "nsIObserverService.h"
|
|
||||||
|
|
||||||
using namespace mozilla::ipc;
|
using namespace mozilla::ipc;
|
||||||
using namespace mozilla::jsipc;
|
using namespace mozilla::jsipc;
|
||||||
|
@ -21,8 +20,7 @@ namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(ContentBridgeChild,
|
NS_IMPL_ISUPPORTS(ContentBridgeChild,
|
||||||
nsIContentChild,
|
nsIContentChild)
|
||||||
nsIObserver)
|
|
||||||
|
|
||||||
ContentBridgeChild::ContentBridgeChild(Transport* aTransport)
|
ContentBridgeChild::ContentBridgeChild(Transport* aTransport)
|
||||||
: mTransport(aTransport)
|
: mTransport(aTransport)
|
||||||
|
@ -36,10 +34,6 @@ ContentBridgeChild::~ContentBridgeChild()
|
||||||
void
|
void
|
||||||
ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
|
ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
||||||
if (os) {
|
|
||||||
os->RemoveObserver(this, "content-child-shutdown");
|
|
||||||
}
|
|
||||||
MessageLoop::current()->PostTask(
|
MessageLoop::current()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy));
|
NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy));
|
||||||
|
@ -55,11 +49,6 @@ ContentBridgeChild::Create(Transport* aTransport, ProcessId aOtherPid)
|
||||||
DebugOnly<bool> ok = bridge->Open(aTransport, aOtherPid, XRE_GetIOMessageLoop());
|
DebugOnly<bool> ok = bridge->Open(aTransport, aOtherPid, XRE_GetIOMessageLoop());
|
||||||
MOZ_ASSERT(ok);
|
MOZ_ASSERT(ok);
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
||||||
if (os) {
|
|
||||||
os->AddObserver(bridge, "content-child-shutdown", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return bridge;
|
return bridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,16 +169,5 @@ ContentBridgeChild::DeallocPBlobChild(PBlobChild* aActor)
|
||||||
return nsIContentChild::DeallocPBlobChild(aActor);
|
return nsIContentChild::DeallocPBlobChild(aActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
ContentBridgeChild::Observe(nsISupports* aSubject,
|
|
||||||
const char* aTopic,
|
|
||||||
const char16_t* aData)
|
|
||||||
{
|
|
||||||
if (!strcmp(aTopic, "content-child-shutdown")) {
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -9,20 +9,17 @@
|
||||||
|
|
||||||
#include "mozilla/dom/PContentBridgeChild.h"
|
#include "mozilla/dom/PContentBridgeChild.h"
|
||||||
#include "mozilla/dom/nsIContentChild.h"
|
#include "mozilla/dom/nsIContentChild.h"
|
||||||
#include "nsIObserver.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class ContentBridgeChild final : public PContentBridgeChild
|
class ContentBridgeChild final : public PContentBridgeChild
|
||||||
, public nsIContentChild
|
, public nsIContentChild
|
||||||
, public nsIObserver
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ContentBridgeChild(Transport* aTransport);
|
explicit ContentBridgeChild(Transport* aTransport);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIOBSERVER
|
|
||||||
|
|
||||||
static ContentBridgeChild*
|
static ContentBridgeChild*
|
||||||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||||
|
|
|
@ -163,6 +163,17 @@ ContentBridgeParent::DeallocPBrowserParent(PBrowserParent* aParent)
|
||||||
return nsIContentParent::DeallocPBrowserParent(aParent);
|
return nsIContentParent::DeallocPBrowserParent(aParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ContentBridgeParent::NotifyTabDestroyed()
|
||||||
|
{
|
||||||
|
int32_t numLiveTabs = ManagedPBrowserParent().Length();
|
||||||
|
if (numLiveTabs == 1) {
|
||||||
|
MessageLoop::current()->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &ContentBridgeParent::Close));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This implementation is identical to ContentParent::GetCPOWManager but we can't
|
// This implementation is identical to ContentParent::GetCPOWManager but we can't
|
||||||
// move it to nsIContentParent because it calls ManagedPJavaScriptParent() which
|
// move it to nsIContentParent because it calls ManagedPJavaScriptParent() which
|
||||||
// only exists in PContentParent and PContentBridgeParent.
|
// only exists in PContentParent and PContentBridgeParent.
|
||||||
|
|
|
@ -28,6 +28,8 @@ public:
|
||||||
|
|
||||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||||
void DeferredDestroy();
|
void DeferredDestroy();
|
||||||
|
virtual bool IsContentBridgeParent() override { return true; }
|
||||||
|
void NotifyTabDestroyed();
|
||||||
|
|
||||||
static ContentBridgeParent*
|
static ContentBridgeParent*
|
||||||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||||
|
|
|
@ -2809,7 +2809,7 @@ ContentChild::RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
|
||||||
if (session) {
|
if (session) {
|
||||||
session->SetDragAction(aAction);
|
session->SetDragAction(aAction);
|
||||||
nsCOMPtr<DataTransfer> dataTransfer =
|
nsCOMPtr<DataTransfer> dataTransfer =
|
||||||
new DataTransfer(nullptr, NS_DRAGDROP_START, false, -1);
|
new DataTransfer(nullptr, eDragStart, false, -1);
|
||||||
for (uint32_t i = 0; i < aTransfers.Length(); ++i) {
|
for (uint32_t i = 0; i < aTransfers.Length(); ++i) {
|
||||||
auto& items = aTransfers[i].items();
|
auto& items = aTransfers[i].items();
|
||||||
for (uint32_t j = 0; j < items.Length(); ++j) {
|
for (uint32_t j = 0; j < items.Length(); ++j) {
|
||||||
|
|
|
@ -1468,7 +1468,9 @@ ContentParent::Init()
|
||||||
}
|
}
|
||||||
Preferences::AddStrongObserver(this, "");
|
Preferences::AddStrongObserver(this, "");
|
||||||
if (obs) {
|
if (obs) {
|
||||||
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created", nullptr);
|
nsAutoString cpId;
|
||||||
|
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
|
||||||
|
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created", cpId.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
|
@ -1843,11 +1845,12 @@ ContentParent::OnBeginSyncTransaction() {
|
||||||
if (!sDisableUnsafeCPOWWarnings) {
|
if (!sDisableUnsafeCPOWWarnings) {
|
||||||
if (console && cx) {
|
if (console && cx) {
|
||||||
nsAutoString filename;
|
nsAutoString filename;
|
||||||
uint32_t lineno = 0;
|
uint32_t lineno = 0, column = 0;
|
||||||
nsJSUtils::GetCallingLocation(cx, filename, &lineno);
|
nsJSUtils::GetCallingLocation(cx, filename, &lineno, &column);
|
||||||
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||||
error->Init(NS_LITERAL_STRING("unsafe CPOW usage"), filename, EmptyString(),
|
error->Init(NS_LITERAL_STRING("unsafe CPOW usage"), filename,
|
||||||
lineno, 0, nsIScriptError::warningFlag, "chrome javascript");
|
EmptyString(), lineno, column,
|
||||||
|
nsIScriptError::warningFlag, "chrome javascript");
|
||||||
console->LogMessage(error);
|
console->LogMessage(error);
|
||||||
} else {
|
} else {
|
||||||
NS_WARNING("Unsafe synchronous IPC message");
|
NS_WARNING("Unsafe synchronous IPC message");
|
||||||
|
@ -2057,7 +2060,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
obs->NotifyObservers((nsIPropertyBag2*) props, "ipc:content-shutdown", nullptr);
|
nsAutoString cpId;
|
||||||
|
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
|
||||||
|
obs->NotifyObservers((nsIPropertyBag2*) props, "ipc:content-shutdown", cpId.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any and all idle listeners.
|
// Remove any and all idle listeners.
|
||||||
|
@ -2085,10 +2090,35 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||||
// least until after the current task finishes running.
|
// least until after the current task finishes running.
|
||||||
NS_DispatchToCurrentThread(new DelayedDeleteContentParentTask(this));
|
NS_DispatchToCurrentThread(new DelayedDeleteContentParentTask(this));
|
||||||
|
|
||||||
// Destroy any processes created by this ContentParent
|
// Release the appId's reference count of any processes
|
||||||
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
|
// created by this ContentParent and the frame opened by this ContentParent
|
||||||
|
// if this ContentParent crashes.
|
||||||
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||||
nsTArray<ContentParentId> childIDArray =
|
nsTArray<ContentParentId> childIDArray =
|
||||||
cpm->GetAllChildProcessById(this->ChildID());
|
cpm->GetAllChildProcessById(this->ChildID());
|
||||||
|
if (why == AbnormalShutdown) {
|
||||||
|
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||||
|
if(permMgr) {
|
||||||
|
// Release the appId's reference count of its child-processes
|
||||||
|
for (uint32_t i = 0; i < childIDArray.Length(); i++) {
|
||||||
|
nsTArray<TabContext> tabCtxs = cpm->GetTabContextByContentProcess(childIDArray[i]);
|
||||||
|
for (uint32_t j = 0 ; j < tabCtxs.Length() ; j++) {
|
||||||
|
if (tabCtxs[j].OwnOrContainingAppId() != nsIScriptSecurityManager::NO_APP_ID) {
|
||||||
|
permMgr->ReleaseAppId(tabCtxs[j].OwnOrContainingAppId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Release the appId's reference count belong to itself
|
||||||
|
nsTArray<TabContext> tabCtxs = cpm->GetTabContextByContentProcess(mChildID);
|
||||||
|
for (uint32_t i = 0; i < tabCtxs.Length() ; i++) {
|
||||||
|
if (tabCtxs[i].OwnOrContainingAppId()!= nsIScriptSecurityManager::NO_APP_ID) {
|
||||||
|
permMgr->ReleaseAppId(tabCtxs[i].OwnOrContainingAppId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy any processes created by this ContentParent
|
||||||
for(uint32_t i = 0; i < childIDArray.Length(); i++) {
|
for(uint32_t i = 0; i < childIDArray.Length(); i++) {
|
||||||
ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]);
|
ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]);
|
||||||
MessageLoop::current()->PostTask(
|
MessageLoop::current()->PostTask(
|
||||||
|
@ -2104,23 +2134,33 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ContentParent::NotifyTabDestroying(PBrowserParent* aTab)
|
ContentParent::NotifyTabDestroying(const TabId& aTabId,
|
||||||
|
const ContentParentId& aCpId)
|
||||||
{
|
{
|
||||||
|
if (XRE_IsParentProcess()) {
|
||||||
// There can be more than one PBrowser for a given app process
|
// There can be more than one PBrowser for a given app process
|
||||||
// because of popup windows. PBrowsers can also destroy
|
// because of popup windows. PBrowsers can also destroy
|
||||||
// concurrently. When all the PBrowsers are destroying, kick off
|
// concurrently. When all the PBrowsers are destroying, kick off
|
||||||
// another task to ensure the child process *really* shuts down,
|
// another task to ensure the child process *really* shuts down,
|
||||||
// even if the PBrowsers themselves never finish destroying.
|
// even if the PBrowsers themselves never finish destroying.
|
||||||
int32_t numLiveTabs = ManagedPBrowserParent().Length();
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||||
++mNumDestroyingTabs;
|
ContentParent* cp = cpm->GetContentProcessById(aCpId);
|
||||||
if (mNumDestroyingTabs != numLiveTabs) {
|
if (!cp) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
++cp->mNumDestroyingTabs;
|
||||||
|
nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(aCpId);
|
||||||
|
if (static_cast<size_t>(cp->mNumDestroyingTabs) != tabIds.Length()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're dying now, so prevent this content process from being
|
// We're dying now, so prevent this content process from being
|
||||||
// recycled during its shutdown procedure.
|
// recycled during its shutdown procedure.
|
||||||
MarkAsDead();
|
cp->MarkAsDead();
|
||||||
StartForceKillTimer();
|
cp->StartForceKillTimer();
|
||||||
|
} else {
|
||||||
|
ContentChild::GetSingleton()->SendNotifyTabDestroying(aTabId, aCpId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2142,16 +2182,15 @@ ContentParent::StartForceKillTimer()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ContentParent::NotifyTabDestroyed(PBrowserParent* aTab,
|
ContentParent::NotifyTabDestroyed(const TabId& aTabId,
|
||||||
bool aNotifiedDestroying)
|
bool aNotifiedDestroying)
|
||||||
{
|
{
|
||||||
if (aNotifiedDestroying) {
|
if (aNotifiedDestroying) {
|
||||||
--mNumDestroyingTabs;
|
--mNumDestroyingTabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
TabId id = static_cast<TabParent*>(aTab)->GetTabId();
|
|
||||||
nsTArray<PContentPermissionRequestParent*> parentArray =
|
nsTArray<PContentPermissionRequestParent*> parentArray =
|
||||||
nsContentPermissionUtils::GetContentPermissionRequestParentById(id);
|
nsContentPermissionUtils::GetContentPermissionRequestParentById(aTabId);
|
||||||
|
|
||||||
// Need to close undeleted ContentPermissionRequestParents before tab is closed.
|
// Need to close undeleted ContentPermissionRequestParents before tab is closed.
|
||||||
for (auto& permissionRequestParent : parentArray) {
|
for (auto& permissionRequestParent : parentArray) {
|
||||||
|
@ -2164,7 +2203,9 @@ ContentParent::NotifyTabDestroyed(PBrowserParent* aTab,
|
||||||
// There can be more than one PBrowser for a given app process
|
// There can be more than one PBrowser for a given app process
|
||||||
// because of popup windows. When the last one closes, shut
|
// because of popup windows. When the last one closes, shut
|
||||||
// us down.
|
// us down.
|
||||||
if (ManagedPBrowserParent().Length() == 1) {
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||||
|
nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(this->ChildID());
|
||||||
|
if (tabIds.Length() == 1) {
|
||||||
// In the case of normal shutdown, send a shutdown message to child to
|
// In the case of normal shutdown, send a shutdown message to child to
|
||||||
// allow it to perform shutdown tasks.
|
// allow it to perform shutdown tasks.
|
||||||
MessageLoop::current()->PostTask(
|
MessageLoop::current()->PostTask(
|
||||||
|
@ -4899,8 +4940,12 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
|
||||||
{
|
{
|
||||||
TabId tabId;
|
TabId tabId;
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||||
tabId = cpm->AllocateTabId(aOpenerTabId, aContext, aCpId);
|
tabId = cpm->AllocateTabId(aOpenerTabId, aContext, aCpId);
|
||||||
|
// Add appId's reference count in oop case
|
||||||
|
if (tabId) {
|
||||||
|
PermissionManagerAddref(aCpId, tabId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ContentChild::GetSingleton()->SendAllocateTabId(aOpenerTabId,
|
ContentChild::GetSingleton()->SendAllocateTabId(aOpenerTabId,
|
||||||
|
@ -4913,14 +4958,27 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
|
||||||
|
|
||||||
/*static*/ void
|
/*static*/ void
|
||||||
ContentParent::DeallocateTabId(const TabId& aTabId,
|
ContentParent::DeallocateTabId(const TabId& aTabId,
|
||||||
const ContentParentId& aCpId)
|
const ContentParentId& aCpId,
|
||||||
|
bool aMarkedDestroying)
|
||||||
{
|
{
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
|
// Release appId's reference count in oop case
|
||||||
|
if (aTabId) {
|
||||||
|
PermissionManagerRelease(aCpId, aTabId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||||
|
ContentParent* cp = cpm->GetContentProcessById(aCpId);
|
||||||
|
|
||||||
|
cp->NotifyTabDestroyed(aTabId, aMarkedDestroying);
|
||||||
|
|
||||||
ContentProcessManager::GetSingleton()->DeallocateTabId(aCpId,
|
ContentProcessManager::GetSingleton()->DeallocateTabId(aCpId,
|
||||||
aTabId);
|
aTabId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ContentChild::GetSingleton()->SendDeallocateTabId(aTabId);
|
ContentChild::GetSingleton()->SendDeallocateTabId(aTabId,
|
||||||
|
aCpId,
|
||||||
|
aMarkedDestroying);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4938,9 +4996,19 @@ ContentParent::RecvAllocateTabId(const TabId& aOpenerTabId,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ContentParent::RecvDeallocateTabId(const TabId& aTabId)
|
ContentParent::RecvDeallocateTabId(const TabId& aTabId,
|
||||||
|
const ContentParentId& aCpId,
|
||||||
|
const bool& aMarkedDestroying)
|
||||||
{
|
{
|
||||||
DeallocateTabId(aTabId, this->ChildID());
|
DeallocateTabId(aTabId, aCpId, aMarkedDestroying);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ContentParent::RecvNotifyTabDestroying(const TabId& aTabId,
|
||||||
|
const ContentParentId& aCpId)
|
||||||
|
{
|
||||||
|
NotifyTabDestroying(aTabId, aCpId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5044,9 +5112,9 @@ ContentParent::MaybeInvokeDragSession(TabParent* aParent)
|
||||||
session->GetDataTransfer(getter_AddRefs(domTransfer));
|
session->GetDataTransfer(getter_AddRefs(domTransfer));
|
||||||
nsCOMPtr<DataTransfer> transfer = do_QueryInterface(domTransfer);
|
nsCOMPtr<DataTransfer> transfer = do_QueryInterface(domTransfer);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
// Pass NS_DRAGDROP_DROP to get DataTransfer with external
|
// Pass eDrop to get DataTransfer with external
|
||||||
// drag formats cached.
|
// drag formats cached.
|
||||||
transfer = new DataTransfer(nullptr, NS_DRAGDROP_DROP, true, -1);
|
transfer = new DataTransfer(nullptr, eDrop, true, -1);
|
||||||
session->SetDataTransfer(transfer);
|
session->SetDataTransfer(transfer);
|
||||||
}
|
}
|
||||||
// Note, even though this fills the DataTransfer object with
|
// Note, even though this fills the DataTransfer object with
|
||||||
|
@ -5111,6 +5179,38 @@ ContentParent::DeallocPContentPermissionRequestParent(PContentPermissionRequestP
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ bool
|
||||||
|
ContentParent::PermissionManagerAddref(const ContentParentId& aCpId,
|
||||||
|
const TabId& aTabId)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(XRE_IsParentProcess(),
|
||||||
|
"Call PermissionManagerAddref in content process!");
|
||||||
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||||
|
uint32_t appId = cpm->GetAppIdByProcessAndTabId(aCpId, aTabId);
|
||||||
|
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||||
|
if (appId != nsIScriptSecurityManager::NO_APP_ID && permMgr) {
|
||||||
|
permMgr->AddrefAppId(appId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ bool
|
||||||
|
ContentParent::PermissionManagerRelease(const ContentParentId& aCpId,
|
||||||
|
const TabId& aTabId)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(XRE_IsParentProcess(),
|
||||||
|
"Call PermissionManagerRelease in content process!");
|
||||||
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||||
|
uint32_t appId = cpm->GetAppIdByProcessAndTabId(aCpId, aTabId);
|
||||||
|
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||||
|
if (appId != nsIScriptSecurityManager::NO_APP_ID && permMgr) {
|
||||||
|
permMgr->ReleaseAppId(appId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ContentParent::RecvGetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration* aConfig)
|
ContentParent::RecvGetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration* aConfig)
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,9 +212,10 @@ public:
|
||||||
virtual bool KillChild() override;
|
virtual bool KillChild() override;
|
||||||
|
|
||||||
/** Notify that a tab is beginning its destruction sequence. */
|
/** Notify that a tab is beginning its destruction sequence. */
|
||||||
void NotifyTabDestroying(PBrowserParent* aTab);
|
static void NotifyTabDestroying(const TabId& aTabId,
|
||||||
|
const ContentParentId& aCpId);
|
||||||
/** Notify that a tab was destroyed during normal operation. */
|
/** Notify that a tab was destroyed during normal operation. */
|
||||||
void NotifyTabDestroyed(PBrowserParent* aTab,
|
void NotifyTabDestroyed(const TabId& aTabId,
|
||||||
bool aNotifiedDestroying);
|
bool aNotifiedDestroying);
|
||||||
|
|
||||||
TestShellParent* CreateTestShell();
|
TestShellParent* CreateTestShell();
|
||||||
|
@ -227,7 +228,21 @@ public:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const ContentParentId& aCpId);
|
const ContentParentId& aCpId);
|
||||||
static void
|
static void
|
||||||
DeallocateTabId(const TabId& aTabId, const ContentParentId& aCpId);
|
DeallocateTabId(const TabId& aTabId,
|
||||||
|
const ContentParentId& aCpId,
|
||||||
|
bool aMarkedDestroying);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the appId's reference count by the given ContentParentId and TabId
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
PermissionManagerAddref(const ContentParentId& aCpId, const TabId& aTabId);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Release the appId's reference count by the given ContentParentId and TabId
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
PermissionManagerRelease(const ContentParentId& aCpId, const TabId& aTabId);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
GetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration& aConfig);
|
GetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration& aConfig);
|
||||||
|
@ -356,7 +371,12 @@ public:
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
TabId* aTabId) override;
|
TabId* aTabId) override;
|
||||||
|
|
||||||
virtual bool RecvDeallocateTabId(const TabId& aTabId) override;
|
virtual bool RecvDeallocateTabId(const TabId& aTabId,
|
||||||
|
const ContentParentId& aCpId,
|
||||||
|
const bool& aMarkedDestroying) override;
|
||||||
|
|
||||||
|
virtual bool RecvNotifyTabDestroying(const TabId& aTabId,
|
||||||
|
const ContentParentId& aCpId) override;
|
||||||
|
|
||||||
nsTArray<TabContext> GetManagedTabContext();
|
nsTArray<TabContext> GetManagedTabContext();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
|
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
|
#include "nsIScriptSecurityManager.h"
|
||||||
|
|
||||||
// XXX need another bug to move this to a common header.
|
// XXX need another bug to move this to a common header.
|
||||||
#ifdef DISABLE_ASSERTS_FOR_FUZZING
|
#ifdef DISABLE_ASSERTS_FOR_FUZZING
|
||||||
|
@ -334,5 +335,40 @@ ContentProcessManager::GetTopLevelTabParentByProcessAndTabId(const ContentParent
|
||||||
return GetTabParentByProcessAndTabId(currentCpId, currentTabId);
|
return GetTabParentByProcessAndTabId(currentCpId, currentTabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsTArray<TabId>
|
||||||
|
ContentProcessManager::GetTabParentsByProcessId(const ContentParentId& aChildCpId)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
nsTArray<TabId> tabIdList;
|
||||||
|
auto iter = mContentParentMap.find(aChildCpId);
|
||||||
|
if (NS_WARN_IF(iter == mContentParentMap.end())) {
|
||||||
|
ASSERT_UNLESS_FUZZING();
|
||||||
|
return Move(tabIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto remoteFrameIter = iter->second.mRemoteFrames.begin();
|
||||||
|
remoteFrameIter != iter->second.mRemoteFrames.end();
|
||||||
|
++remoteFrameIter) {
|
||||||
|
tabIdList.AppendElement(remoteFrameIter->first);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Move(tabIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
ContentProcessManager::GetAppIdByProcessAndTabId(const ContentParentId& aChildCpId,
|
||||||
|
const TabId& aChildTabId)
|
||||||
|
{
|
||||||
|
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
|
||||||
|
if (aChildCpId && aChildTabId) {
|
||||||
|
TabContext tabContext;
|
||||||
|
if (GetTabContextByProcessAndTabId(aChildCpId, aChildTabId, &tabContext)) {
|
||||||
|
appId = tabContext.OwnOrContainingAppId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return appId;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -110,6 +110,13 @@ public:
|
||||||
const TabId& aChildTabId,
|
const TabId& aChildTabId,
|
||||||
/*out*/ TabId* aOpenerTabId);
|
/*out*/ TabId* aOpenerTabId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all TabParents' Ids managed by the givent content process.
|
||||||
|
* Return empty array when TabParent couldn't be found via aChildCpId
|
||||||
|
*/
|
||||||
|
nsTArray<TabId>
|
||||||
|
GetTabParentsByProcessId(const ContentParentId& aChildCpId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the TabParent by the given content process and tab id.
|
* Get the TabParent by the given content process and tab id.
|
||||||
* Return nullptr when TabParent couldn't be found via aChildCpId
|
* Return nullptr when TabParent couldn't be found via aChildCpId
|
||||||
|
@ -135,6 +142,15 @@ public:
|
||||||
GetTopLevelTabParentByProcessAndTabId(const ContentParentId& aChildCpId,
|
GetTopLevelTabParentByProcessAndTabId(const ContentParentId& aChildCpId,
|
||||||
const TabId& aChildTabId);
|
const TabId& aChildTabId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return appId by given TabId and ContentParentId.
|
||||||
|
* It will return nsIScriptSecurityManager::NO_APP_ID
|
||||||
|
* if the given tab is not an app.
|
||||||
|
*/
|
||||||
|
uint32_t
|
||||||
|
GetAppIdByProcessAndTabId(const ContentParentId& aChildCpId,
|
||||||
|
const TabId& aChildTabId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static StaticAutoPtr<ContentProcessManager> sSingleton;
|
static StaticAutoPtr<ContentProcessManager> sSingleton;
|
||||||
TabId mUniqueId;
|
TabId mUniqueId;
|
||||||
|
|
|
@ -991,8 +991,15 @@ parent:
|
||||||
*/
|
*/
|
||||||
sync AllocateTabId(TabId openerTabId, IPCTabContext context, ContentParentId cpId)
|
sync AllocateTabId(TabId openerTabId, IPCTabContext context, ContentParentId cpId)
|
||||||
returns (TabId tabId);
|
returns (TabId tabId);
|
||||||
async DeallocateTabId(TabId tabId);
|
async DeallocateTabId(TabId tabId,
|
||||||
|
ContentParentId cpId,
|
||||||
|
bool aMarkedDestroying);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell the chrome process there is a destruction of PBrowser(Tab)
|
||||||
|
*/
|
||||||
|
async NotifyTabDestroying(TabId tabId,
|
||||||
|
ContentParentId cpId);
|
||||||
/**
|
/**
|
||||||
* Starts an offline application cache update.
|
* Starts an offline application cache update.
|
||||||
* @param manifestURI
|
* @param manifestURI
|
||||||
|
|
|
@ -2183,19 +2183,19 @@ TabChild::RecvRealDragEvent(const WidgetDragEvent& aEvent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aEvent.mMessage == NS_DRAGDROP_DROP) {
|
if (aEvent.mMessage == eDrop) {
|
||||||
bool canDrop = true;
|
bool canDrop = true;
|
||||||
if (!dragSession || NS_FAILED(dragSession->GetCanDrop(&canDrop)) ||
|
if (!dragSession || NS_FAILED(dragSession->GetCanDrop(&canDrop)) ||
|
||||||
!canDrop) {
|
!canDrop) {
|
||||||
localEvent.mMessage = NS_DRAGDROP_EXIT;
|
localEvent.mMessage = eDragExit;
|
||||||
}
|
}
|
||||||
} else if (aEvent.mMessage == NS_DRAGDROP_OVER) {
|
} else if (aEvent.mMessage == eDragOver) {
|
||||||
nsCOMPtr<nsIDragService> dragService =
|
nsCOMPtr<nsIDragService> dragService =
|
||||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||||
if (dragService) {
|
if (dragService) {
|
||||||
// This will dispatch 'drag' event at the source if the
|
// This will dispatch 'drag' event at the source if the
|
||||||
// drag transaction started in this process.
|
// drag transaction started in this process.
|
||||||
dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
dragService->FireDragEventAtSource(eDrag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,12 +436,8 @@ TabParent::IsVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TabParent::Destroy()
|
TabParent::DestroyInternal()
|
||||||
{
|
{
|
||||||
if (mIsDestroyed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IMEStateManager::OnTabParentDestroying(this);
|
IMEStateManager::OnTabParentDestroying(this);
|
||||||
|
|
||||||
RemoveWindowListeners();
|
RemoveWindowListeners();
|
||||||
|
@ -455,11 +451,6 @@ TabParent::Destroy()
|
||||||
RemoveTabParentFromTable(frame->GetLayersId());
|
RemoveTabParentFromTable(frame->GetLayersId());
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
}
|
}
|
||||||
mIsDestroyed = true;
|
|
||||||
|
|
||||||
if (XRE_IsParentProcess()) {
|
|
||||||
Manager()->AsContentParent()->NotifyTabDestroying(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Let all PluginWidgets know we are tearing down. Prevents
|
// Let all PluginWidgets know we are tearing down. Prevents
|
||||||
// these objects from sending async events after the child side
|
// these objects from sending async events after the child side
|
||||||
|
@ -468,6 +459,24 @@ TabParent::Destroy()
|
||||||
for (uint32_t idx = 0; idx < kids.Length(); ++idx) {
|
for (uint32_t idx = 0; idx < kids.Length(); ++idx) {
|
||||||
static_cast<mozilla::plugins::PluginWidgetParent*>(kids[idx])->ParentDestroy();
|
static_cast<mozilla::plugins::PluginWidgetParent*>(kids[idx])->ParentDestroy();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TabParent::Destroy()
|
||||||
|
{
|
||||||
|
if (mIsDestroyed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DestroyInternal();
|
||||||
|
|
||||||
|
mIsDestroyed = true;
|
||||||
|
|
||||||
|
if (XRE_IsParentProcess()) {
|
||||||
|
ContentParent::NotifyTabDestroying(this->GetTabId(), Manager()->AsContentParent()->ChildID());
|
||||||
|
} else {
|
||||||
|
ContentParent::NotifyTabDestroying(this->GetTabId(), Manager()->ChildID());
|
||||||
|
}
|
||||||
|
|
||||||
mMarkedDestroying = true;
|
mMarkedDestroying = true;
|
||||||
}
|
}
|
||||||
|
@ -476,12 +485,15 @@ bool
|
||||||
TabParent::Recv__delete__()
|
TabParent::Recv__delete__()
|
||||||
{
|
{
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
Manager()->AsContentParent()->NotifyTabDestroyed(this, mMarkedDestroying);
|
|
||||||
ContentParent::DeallocateTabId(mTabId,
|
ContentParent::DeallocateTabId(mTabId,
|
||||||
Manager()->AsContentParent()->ChildID());
|
Manager()->AsContentParent()->ChildID(),
|
||||||
|
mMarkedDestroying);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ContentParent::DeallocateTabId(mTabId, ContentParentId(0));
|
Manager()->AsContentBridgeParent()->NotifyTabDestroyed();
|
||||||
|
ContentParent::DeallocateTabId(mTabId,
|
||||||
|
Manager()->ChildID(),
|
||||||
|
mMarkedDestroying);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -494,6 +506,22 @@ TabParent::ActorDestroy(ActorDestroyReason why)
|
||||||
// case of a crash.
|
// case of a crash.
|
||||||
IMEStateManager::OnTabParentDestroying(this);
|
IMEStateManager::OnTabParentDestroying(this);
|
||||||
|
|
||||||
|
// Prevent executing ContentParent::NotifyTabDestroying in
|
||||||
|
// TabParent::Destroy() called by frameLoader->DestroyComplete() below
|
||||||
|
// when tab crashes in contentprocess because ContentParent::ActorDestroy()
|
||||||
|
// in main process will be triggered before this function
|
||||||
|
// and remove the process information that
|
||||||
|
// ContentParent::NotifyTabDestroying need from mContentParentMap.
|
||||||
|
|
||||||
|
// When tab crashes in content process,
|
||||||
|
// there is no need to call ContentParent::NotifyTabDestroying
|
||||||
|
// because the jobs in ContentParent::NotifyTabDestroying
|
||||||
|
// will be done by ContentParent::ActorDestroy.
|
||||||
|
if (XRE_IsContentProcess() && why == AbnormalShutdown && !mIsDestroyed) {
|
||||||
|
DestroyInternal();
|
||||||
|
mIsDestroyed = true;
|
||||||
|
}
|
||||||
|
|
||||||
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader(true);
|
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader(true);
|
||||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||||
if (frameLoader) {
|
if (frameLoader) {
|
||||||
|
|
|
@ -491,6 +491,7 @@ protected:
|
||||||
LayoutDeviceIntPoint mChromeOffset;
|
LayoutDeviceIntPoint mChromeOffset;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void DestroyInternal();
|
||||||
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
|
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
|
||||||
nsRefPtr<nsIContentParent> mManager;
|
nsRefPtr<nsIContentParent> mManager;
|
||||||
void TryCacheDPIAndScale();
|
void TryCacheDPIAndScale();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/dom/File.h"
|
#include "mozilla/dom/File.h"
|
||||||
#include "mozilla/dom/ContentParent.h"
|
#include "mozilla/dom/ContentParent.h"
|
||||||
|
#include "mozilla/dom/ContentBridgeParent.h"
|
||||||
#include "mozilla/dom/PTabContext.h"
|
#include "mozilla/dom/PTabContext.h"
|
||||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||||
#include "mozilla/dom/StructuredCloneUtils.h"
|
#include "mozilla/dom/StructuredCloneUtils.h"
|
||||||
|
@ -46,6 +47,13 @@ nsIContentParent::AsContentParent()
|
||||||
return static_cast<ContentParent*>(this);
|
return static_cast<ContentParent*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContentBridgeParent*
|
||||||
|
nsIContentParent::AsContentBridgeParent()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(IsContentBridgeParent());
|
||||||
|
return static_cast<ContentBridgeParent*>(this);
|
||||||
|
}
|
||||||
|
|
||||||
PJavaScriptParent*
|
PJavaScriptParent*
|
||||||
nsIContentParent::AllocPJavaScriptParent()
|
nsIContentParent::AllocPJavaScriptParent()
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,7 @@ class BlobConstructorParams;
|
||||||
class BlobImpl;
|
class BlobImpl;
|
||||||
class BlobParent;
|
class BlobParent;
|
||||||
class ContentParent;
|
class ContentParent;
|
||||||
|
class ContentBridgeParent;
|
||||||
class IPCTabContext;
|
class IPCTabContext;
|
||||||
class PBlobParent;
|
class PBlobParent;
|
||||||
class PBrowserParent;
|
class PBrowserParent;
|
||||||
|
@ -77,6 +78,8 @@ public:
|
||||||
|
|
||||||
virtual bool IsContentParent() { return false; }
|
virtual bool IsContentParent() { return false; }
|
||||||
ContentParent* AsContentParent();
|
ContentParent* AsContentParent();
|
||||||
|
virtual bool IsContentBridgeParent() { return false; }
|
||||||
|
ContentBridgeParent* AsContentBridgeParent();
|
||||||
|
|
||||||
protected: // methods
|
protected: // methods
|
||||||
bool CanOpenBrowser(const IPCTabContext& aContext);
|
bool CanOpenBrowser(const IPCTabContext& aContext);
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
var gBasePath = "tests/dom/ipc/tests/";
|
||||||
|
|
||||||
|
function handleRequest(request, response) {
|
||||||
|
var query = getQuery(request);
|
||||||
|
|
||||||
|
var testToken = '';
|
||||||
|
if ('testToken' in query) {
|
||||||
|
testToken = query.testToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
var template = '';
|
||||||
|
if ('template' in query) {
|
||||||
|
template = query.template;
|
||||||
|
}
|
||||||
|
var template = gBasePath + template;
|
||||||
|
response.setHeader("Content-Type", "application/x-web-app-manifest+json", false);
|
||||||
|
response.write(readTemplate(template).replace(/TESTTOKEN/g, testToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy-pasted incantations. There ought to be a better way to synchronously read
|
||||||
|
// a file into a string, but I guess we're trying to discourage that.
|
||||||
|
function readTemplate(path) {
|
||||||
|
var file = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||||
|
getService(Components.interfaces.nsIProperties).
|
||||||
|
get("CurWorkD", Components.interfaces.nsILocalFile);
|
||||||
|
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
|
||||||
|
createInstance(Components.interfaces.nsIFileInputStream);
|
||||||
|
var cis = Components.classes["@mozilla.org/intl/converter-input-stream;1"].
|
||||||
|
createInstance(Components.interfaces.nsIConverterInputStream);
|
||||||
|
var split = path.split("/");
|
||||||
|
for(var i = 0; i < split.length; ++i) {
|
||||||
|
file.append(split[i]);
|
||||||
|
}
|
||||||
|
fis.init(file, -1, -1, false);
|
||||||
|
cis.init(fis, "UTF-8", 0, 0);
|
||||||
|
|
||||||
|
var data = "";
|
||||||
|
let str = {};
|
||||||
|
let read = 0;
|
||||||
|
do {
|
||||||
|
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||||
|
data += str.value;
|
||||||
|
} while (read != 0);
|
||||||
|
cis.close();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQuery(request) {
|
||||||
|
var query = {};
|
||||||
|
request.queryString.split('&').forEach(function (val) {
|
||||||
|
var [name, value] = val.split('=');
|
||||||
|
query[name] = unescape(value);
|
||||||
|
});
|
||||||
|
return query;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "Nested-OOP",
|
||||||
|
"description": "Nested-OOP test app used for mochitest.",
|
||||||
|
"launch_path": "/tests/dom/ipc/tests/TESTTOKEN",
|
||||||
|
"icons": { "128": "default_icon" }
|
||||||
|
}
|
|
@ -21,3 +21,39 @@ skip-if = true # bug 1166923
|
||||||
skip-if = toolkit == 'cocoa' # disabled due to hangs, see changeset 6852e7c47edf
|
skip-if = toolkit == 'cocoa' # disabled due to hangs, see changeset 6852e7c47edf
|
||||||
[test_CrashService_crash.html]
|
[test_CrashService_crash.html]
|
||||||
skip-if = !(crashreporter && !e10s && (toolkit == 'gtk2' || toolkit == 'gtk3' || toolkit == 'cocoa' || toolkit == 'windows') && (buildapp != 'b2g' || toolkit == 'gonk') && (buildapp != 'mulet')) # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
|
skip-if = !(crashreporter && !e10s && (toolkit == 'gtk2' || toolkit == 'gtk3' || toolkit == 'cocoa' || toolkit == 'windows') && (buildapp != 'b2g' || toolkit == 'gonk') && (buildapp != 'mulet')) # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
|
||||||
|
[test_permission_for_in_process_app.html]
|
||||||
|
skip-if = e10s || os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app
|
||||||
|
support-files =
|
||||||
|
test_permission_helper.js
|
||||||
|
[test_permission_for_oop_app.html]
|
||||||
|
skip-if = buildapp == 'mulet' || os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app
|
||||||
|
support-files =
|
||||||
|
file_app.sjs
|
||||||
|
file_app.template.webapp
|
||||||
|
test_permission_helper.js
|
||||||
|
test_permission_embed.html
|
||||||
|
test_permission_framescript.js
|
||||||
|
[test_permission_for_nested_oop_app.html]
|
||||||
|
skip-if = buildapp == 'mulet' || os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app
|
||||||
|
support-files =
|
||||||
|
file_app.sjs
|
||||||
|
file_app.template.webapp
|
||||||
|
test_permission_helper.js
|
||||||
|
test_permission_embed.html
|
||||||
|
test_permission_framescript.js
|
||||||
|
[test_permission_for_two_oop_apps.html]
|
||||||
|
skip-if = buildapp == 'mulet' || os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app
|
||||||
|
support-files =
|
||||||
|
file_app.sjs
|
||||||
|
file_app.template.webapp
|
||||||
|
test_permission_helper.js
|
||||||
|
test_permission_embed.html
|
||||||
|
test_permission_framescript.js
|
||||||
|
[test_permission_when_oop_app_crashes.html]
|
||||||
|
skip-if = buildapp == 'mulet' || os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app
|
||||||
|
support-files =
|
||||||
|
file_app.sjs
|
||||||
|
file_app.template.webapp
|
||||||
|
test_permission_helper.js
|
||||||
|
test_permission_embed.html
|
||||||
|
test_permission_framescript.js
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>oop-test apps</title>
|
||||||
|
<script type="application/javascript">
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var queryString = decodeURIComponent(window.location.hash.substring(1));
|
||||||
|
|
||||||
|
// test-target-app
|
||||||
|
var APP_URL = "http://example.org";
|
||||||
|
var APP_MANIFEST = "http://example.org/manifest.webapp";
|
||||||
|
var APP_IFRAME_ID = "test-target";
|
||||||
|
|
||||||
|
function removeAppFrame(){
|
||||||
|
var ifr = document.getElementById(APP_IFRAME_ID);
|
||||||
|
ifr.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
function allocateAppFrame(source, manifestURL, useRemote) {
|
||||||
|
var ifr = document.createElement('iframe');
|
||||||
|
ifr.setAttribute('id', APP_IFRAME_ID);
|
||||||
|
ifr.setAttribute('remote', useRemote? "true" : "false");
|
||||||
|
ifr.setAttribute('mozbrowser', 'true');
|
||||||
|
ifr.setAttribute('mozapp', manifestURL);
|
||||||
|
ifr.setAttribute('src', source);
|
||||||
|
|
||||||
|
ifr.addEventListener('mozbrowserloadend', function () {
|
||||||
|
if (queryString == "crash") {
|
||||||
|
// Send a crash request to parent-process
|
||||||
|
sendMessgeToParent('crash');
|
||||||
|
} else {
|
||||||
|
removeAppFrame();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.body.appendChild(ifr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendMessgeToParent(msg) {
|
||||||
|
window.alert(msg);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
allocateAppFrame(APP_URL, APP_MANIFEST, true);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,43 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1114507
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test for Bug 1114507</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1114507">Mozilla Bug1114507</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="container" style="display: none"></div>
|
||||||
|
<script type="text/javascript" src="test_permission_helper.js"></script>
|
||||||
|
<script type="application/javascript">
|
||||||
|
// Put all the tests in order
|
||||||
|
var tests = [
|
||||||
|
// Setup preferences and permissions
|
||||||
|
setupPrefsAndPermissions,
|
||||||
|
|
||||||
|
// +-------------------------------------------+
|
||||||
|
// | Test 1: Open and close a in-process |
|
||||||
|
// | test-target-app in chrome-process |
|
||||||
|
// +-------------------------------------------+
|
||||||
|
//
|
||||||
|
// level
|
||||||
|
// 1 chrome process <-- app is here
|
||||||
|
|
||||||
|
// Add permission to app
|
||||||
|
function () {
|
||||||
|
addPermissionToApp(APP_URL, APP_MANIFEST);
|
||||||
|
},
|
||||||
|
|
||||||
|
test1
|
||||||
|
];
|
||||||
|
|
||||||
|
runTests();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,75 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1114507
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test for Bug 1114507</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1114507">Mozilla Bug1114507</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="container" style="display: none"></div>
|
||||||
|
<script type="text/javascript" src="test_permission_helper.js"></script>
|
||||||
|
<script type="application/javascript">
|
||||||
|
// Put all the tests in order
|
||||||
|
var tests = [
|
||||||
|
// Setup preferences and permissions
|
||||||
|
setupPrefsAndPermissions,
|
||||||
|
|
||||||
|
// ****************************************************
|
||||||
|
// Setup the enviroment for testing nested-oop cases: *
|
||||||
|
// test 3,4,5 *
|
||||||
|
// ****************************************************
|
||||||
|
|
||||||
|
// Install the app
|
||||||
|
installApp,
|
||||||
|
|
||||||
|
// Allow permission for embedApp to open mozbrowser and mozapp
|
||||||
|
function() {
|
||||||
|
var appId = gAppsService.getAppLocalIdByManifestURL(embedAppHostedManifestURL);
|
||||||
|
var context = { url: embedApp.origin,
|
||||||
|
appId: appId,
|
||||||
|
isInBrowserElement: false };
|
||||||
|
setupOpenAppPermission(context, runTests);
|
||||||
|
},
|
||||||
|
|
||||||
|
// +-------------------------------------------+
|
||||||
|
// | Test 3: Open a test-target-app on 3rd |
|
||||||
|
// | level child-process then close it |
|
||||||
|
// +-------------------------------------------+
|
||||||
|
//
|
||||||
|
// level
|
||||||
|
// 1 chrome process
|
||||||
|
// |
|
||||||
|
// 2 child process
|
||||||
|
// |
|
||||||
|
// 3 child process <-- app is here
|
||||||
|
|
||||||
|
// Add permission to app
|
||||||
|
function() {
|
||||||
|
addPermissionToApp(APP_URL, APP_MANIFEST);
|
||||||
|
},
|
||||||
|
|
||||||
|
test3,
|
||||||
|
|
||||||
|
// Remove the child-process on 2nd level
|
||||||
|
function() {
|
||||||
|
var afterShutdown = function() {
|
||||||
|
runTests();
|
||||||
|
};
|
||||||
|
afterContentShutdown(1, afterShutdown);
|
||||||
|
removeAppFrame(APP_IFRAME_ID);
|
||||||
|
},
|
||||||
|
|
||||||
|
uninstallApp
|
||||||
|
];
|
||||||
|
|
||||||
|
runTests();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,45 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1114507
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test for Bug 1114507</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1114507">Mozilla Bug1114507</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="container" style="display: none"></div>
|
||||||
|
<script type="text/javascript" src="test_permission_helper.js"></script>
|
||||||
|
<script type="application/javascript">
|
||||||
|
// Put all the tests in order
|
||||||
|
var tests = [
|
||||||
|
// Setup preferences and permissions
|
||||||
|
setupPrefsAndPermissions,
|
||||||
|
|
||||||
|
// +------------------------------------------+
|
||||||
|
// | Test 2: Open and close a test-target-app |
|
||||||
|
// | on 2nd level child-process |
|
||||||
|
// +------------------------------------------+
|
||||||
|
//
|
||||||
|
// level
|
||||||
|
// 1 chrome process
|
||||||
|
// |
|
||||||
|
// 2 child process <-- app is here
|
||||||
|
|
||||||
|
// Add permission to app
|
||||||
|
function() {
|
||||||
|
addPermissionToApp(APP_URL, APP_MANIFEST);
|
||||||
|
},
|
||||||
|
|
||||||
|
test2,
|
||||||
|
];
|
||||||
|
|
||||||
|
runTests();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче