зеркало из 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*
|
||||
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.
|
||||
if (MAI_ATK_OBJECT(aAtkObj)->accWrap & IS_PROXY)
|
||||
uintptr_t accWrapPtr = isMAIObject ?
|
||||
MAI_ATK_OBJECT(aAtkObj)->accWrap :
|
||||
reinterpret_cast<uintptr_t>(MAI_ATK_SOCKET(aAtkObj)->accWrap);
|
||||
if (accWrapPtr & IS_PROXY)
|
||||
return nullptr;
|
||||
|
||||
AccessibleWrap* accWrap =
|
||||
reinterpret_cast<AccessibleWrap*>(MAI_ATK_OBJECT(aAtkObj)->accWrap);
|
||||
AccessibleWrap* accWrap = reinterpret_cast<AccessibleWrap*>(accWrapPtr);
|
||||
|
||||
// Check if the accessible was deconstructed.
|
||||
if (!accWrap)
|
||||
|
@ -1067,7 +1070,8 @@ GetAccessibleWrap(AtkObject* aAtkObj)
|
|||
ProxyAccessible*
|
||||
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 reinterpret_cast<ProxyAccessible*>(MAI_ATK_OBJECT(aObj)->accWrap
|
||||
|
|
|
@ -21,35 +21,6 @@ const char* AtkSocketAccessible::sATKSocketGetTypeSymbol = "atk_socket_get_type"
|
|||
bool AtkSocketAccessible::gCanEmbed = FALSE;
|
||||
|
||||
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,
|
||||
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);
|
||||
|
||||
return refAccessibleAtPointHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
|
||||
return refAccessibleAtPointHelper(ATK_OBJECT(MAI_ATK_SOCKET(aComponent)),
|
||||
aX, aY, aCoordType);
|
||||
}
|
||||
|
||||
|
@ -99,7 +70,7 @@ GetExtents(AtkComponent* aComponent, gint* aX, gint* aY, gint* aWidth,
|
|||
if (!MAI_IS_ATK_SOCKET(aComponent))
|
||||
return;
|
||||
|
||||
getExtentsHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
|
||||
getExtentsHelper(ATK_OBJECT(MAI_ATK_SOCKET(aComponent)),
|
||||
aX, aY, aWidth, aHeight, aCoordType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ void valueInterfaceInitCB(AtkValueIface *aIface);
|
|||
/**
|
||||
* 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);
|
||||
void getExtentsHelper(mozilla::a11y::AccessibleWrap* aAccWrap,
|
||||
void getExtentsHelper(AtkObject* aAtkObj,
|
||||
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
|
||||
AtkCoordType aCoordType);
|
||||
|
||||
|
|
|
@ -34,6 +34,36 @@ class ProxyAccessible;
|
|||
MaiAtkObjectClass))
|
||||
GType mai_atk_object_get_type(void);
|
||||
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::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
|
||||
AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsCoreUtils.h"
|
||||
#include "nsMai.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/a11y/ProxyAccessible.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
@ -20,7 +21,7 @@ static AtkObject*
|
|||
refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
|
||||
AtkCoordType aCoordType)
|
||||
{
|
||||
return refAccessibleAtPointHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
|
||||
return refAccessibleAtPointHelper(ATK_OBJECT(aComponent),
|
||||
aAccX, aAccY, aCoordType);
|
||||
}
|
||||
|
||||
|
@ -28,73 +29,109 @@ static void
|
|||
getExtentsCB(AtkComponent* aComponent, gint* aX, gint* aY,
|
||||
gint* aWidth, gint* aHeight, AtkCoordType aCoordType)
|
||||
{
|
||||
getExtentsHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
|
||||
getExtentsHelper(ATK_OBJECT(aComponent),
|
||||
aX, aY, aWidth, aHeight, aCoordType);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
grabFocusCB(AtkComponent* aComponent)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
|
||||
if (!accWrap)
|
||||
return FALSE;
|
||||
AtkObject* atkObject = ATK_OBJECT(aComponent);
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(atkObject);
|
||||
if (accWrap) {
|
||||
accWrap->TakeFocus();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
accWrap->TakeFocus();
|
||||
return TRUE;
|
||||
ProxyAccessible* proxy = GetProxy(atkObject);
|
||||
if (proxy) {
|
||||
proxy->TakeFocus();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
refAccessibleAtPointHelper(AccessibleWrap* aAccWrap, gint aX, gint aY,
|
||||
refAccessibleAtPointHelper(AtkObject* aAtkObj, gint aX, gint aY,
|
||||
AtkCoordType aCoordType)
|
||||
{
|
||||
if (!aAccWrap || aAccWrap->IsDefunct() || nsAccUtils::MustPrune(aAccWrap))
|
||||
return nullptr;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||
if (accWrap) {
|
||||
if (accWrap->IsDefunct() || nsAccUtils::MustPrune(accWrap)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Accessible::ChildAtPoint(x,y) is in screen pixels.
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
nsIntPoint winCoords =
|
||||
nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
|
||||
aX += winCoords.x;
|
||||
aY += winCoords.y;
|
||||
// Accessible::ChildAtPoint(x,y) is in screen pixels.
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
nsIntPoint winCoords =
|
||||
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
|
||||
aX += winCoords.x;
|
||||
aY += winCoords.y;
|
||||
}
|
||||
|
||||
Accessible* accAtPoint = accWrap->ChildAtPoint(aX, aY,
|
||||
Accessible::eDirectChild);
|
||||
if (!accAtPoint) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AtkObject* atkObj = AccessibleWrap::GetAtkObject(accAtPoint);
|
||||
if (atkObj) {
|
||||
g_object_ref(atkObj);
|
||||
}
|
||||
|
||||
return atkObj;
|
||||
}
|
||||
|
||||
Accessible* accAtPoint = aAccWrap->ChildAtPoint(aX, aY,
|
||||
Accessible::eDirectChild);
|
||||
if (!accAtPoint)
|
||||
return nullptr;
|
||||
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;
|
||||
}
|
||||
|
||||
AtkObject* atkObj = AccessibleWrap::GetAtkObject(accAtPoint);
|
||||
if (atkObj)
|
||||
g_object_ref(atkObj);
|
||||
return atkObj;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
getExtentsHelper(AccessibleWrap* aAccWrap,
|
||||
getExtentsHelper(AtkObject* aAtkObj,
|
||||
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
|
||||
AtkCoordType aCoordType)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||
*aX = *aY = *aWidth = *aHeight = 0;
|
||||
|
||||
if (!aAccWrap || aAccWrap->IsDefunct())
|
||||
return;
|
||||
if (accWrap) {
|
||||
if (accWrap->IsDefunct()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIntRect screenRect = aAccWrap->Bounds();
|
||||
if (screenRect.IsEmpty())
|
||||
return;
|
||||
nsIntRect screenRect = accWrap->Bounds();
|
||||
if (screenRect.IsEmpty())
|
||||
return;
|
||||
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
nsIntPoint winCoords =
|
||||
nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
|
||||
screenRect.x -= winCoords.x;
|
||||
screenRect.y -= winCoords.y;
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
nsIntPoint winCoords =
|
||||
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
|
||||
screenRect.x -= winCoords.x;
|
||||
screenRect.y -= winCoords.y;
|
||||
}
|
||||
|
||||
*aX = screenRect.x;
|
||||
*aY = screenRect.y;
|
||||
*aWidth = screenRect.width;
|
||||
*aHeight = screenRect.height;
|
||||
return;
|
||||
}
|
||||
|
||||
*aX = screenRect.x;
|
||||
*aY = screenRect.y;
|
||||
*aWidth = screenRect.width;
|
||||
*aHeight = screenRect.height;
|
||||
if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
|
||||
proxy->Extents(aCoordType == ATK_XY_WINDOW, aX, aY, aWidth, aHeight);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1792,42 +1792,6 @@ DocAccessibleChild::RecvFocusedChild(const uint64_t& aID,
|
|||
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
|
||||
DocAccessibleChild::RecvLanguage(const uint64_t& aID,
|
||||
nsString* aLocale)
|
||||
|
@ -1906,5 +1870,71 @@ DocAccessibleChild::RecvURLDocTypeMimeType(const uint64_t& aID,
|
|||
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,
|
||||
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 RecvDocType(const uint64_t& aID, nsString* aType) override;
|
||||
virtual bool RecvTitle(const uint64_t& aID, nsString* aTitle) override;
|
||||
|
@ -466,6 +457,21 @@ public:
|
|||
nsString* aURL,
|
||||
nsString* aDocType,
|
||||
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:
|
||||
|
||||
Accessible* IdToAccessible(const uint64_t& aID) const;
|
||||
|
|
|
@ -233,9 +233,6 @@ child:
|
|||
returns(uint64_t aChild);
|
||||
prio(high) sync FocusedChild(uint64_t aID)
|
||||
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 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 MimeType(uint64_t aID) returns(nsString aMime);
|
||||
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,9 +1019,9 @@ ProxyAccessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||
{
|
||||
uint64_t childID = 0;
|
||||
bool ok = false;
|
||||
unused << mDoc->SendChildAtPoint(mID, aX, aY,
|
||||
static_cast<uint32_t>(aWhichChild),
|
||||
&childID, &ok);
|
||||
unused << mDoc->SendAccessibleAtPoint(mID, aX, aY, false,
|
||||
static_cast<uint32_t>(aWhichChild),
|
||||
&childID, &ok);
|
||||
return ok ? mDoc->GetAccessible(childID) : nullptr;
|
||||
}
|
||||
|
||||
|
@ -1029,7 +1029,9 @@ nsIntRect
|
|||
ProxyAccessible::Bounds()
|
||||
{
|
||||
nsIntRect rect;
|
||||
unused << mDoc->SendBounds(mID, &rect);
|
||||
unused << mDoc->SendExtents(mID, false,
|
||||
&(rect.x), &(rect.y),
|
||||
&(rect.width), &(rect.height));
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -1070,6 +1072,26 @@ ProxyAccessible::URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
|||
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*
|
||||
ProxyAccessible::OuterDocOfRemoteBrowser() const
|
||||
{
|
||||
|
|
|
@ -319,6 +319,12 @@ public:
|
|||
void URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
||||
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.
|
||||
*/
|
||||
|
|
|
@ -419,9 +419,14 @@
|
|||
oncommand="gContextMenu.switchPageDirection();"/>
|
||||
<menuseparator id="fill-login-separator" hidden="true"/>
|
||||
<menu id="fill-login"
|
||||
label="&fillPasswordMenu.label;"
|
||||
class="menu-iconic"
|
||||
accesskey="&fillPasswordMenu.accesskey;"
|
||||
label="&fillLoginMenu.label;"
|
||||
label-login="&fillLoginMenu.label;"
|
||||
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">
|
||||
<menupopup id="fill-login-popup">
|
||||
<menuitem id="fill-login-no-logins"
|
||||
|
|
|
@ -107,6 +107,7 @@ let handleContentContextMenu = function (event) {
|
|||
let frameOuterWindowID = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.outerWindowID;
|
||||
let loginFillInfo = LoginManagerContent.getFieldContext(event.target);
|
||||
|
||||
// get referrer attribute from clicked link and parse it
|
||||
// if per element referrer is enabled, the element referrer overrules
|
||||
|
@ -168,7 +169,8 @@ let handleContentContextMenu = function (event) {
|
|||
{ editFlags, spellInfo, customMenuItems, addonInfo,
|
||||
principal, docLocation, charSet, baseURI, referrer,
|
||||
referrerPolicy, contentType, contentDisposition,
|
||||
frameOuterWindowID, selectionInfo, disableSetDesktopBg },
|
||||
frameOuterWindowID, selectionInfo, disableSetDesktopBg,
|
||||
loginFillInfo, },
|
||||
{ event, popupNode: event.target });
|
||||
}
|
||||
else {
|
||||
|
@ -190,6 +192,7 @@ let handleContentContextMenu = function (event) {
|
|||
contentDisposition: contentDisposition,
|
||||
selectionInfo: selectionInfo,
|
||||
disableSetDesktopBackground: disableSetDesktopBg,
|
||||
loginFillInfo,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -506,13 +506,35 @@ nsContextMenu.prototype = {
|
|||
},
|
||||
|
||||
initPasswordManagerItems: function() {
|
||||
let showFillPassword = this.onPassword;
|
||||
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);
|
||||
let loginFillInfo = gContextMenuContentData && gContextMenuContentData.loginFillInfo;
|
||||
|
||||
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;
|
||||
}
|
||||
let documentURI = gContextMenuContentData.documentURIObject;
|
||||
|
|
|
@ -4056,6 +4056,7 @@
|
|||
frameOuterWindowID: aMessage.data.frameOuterWindowID,
|
||||
selectionInfo: aMessage.data.selectionInfo,
|
||||
disableSetDesktopBackground: aMessage.data.disableSetDesktopBg,
|
||||
loginFillInfo: aMessage.data.loginFillInfo,
|
||||
};
|
||||
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
||||
let event = gContextMenuContentData.event;
|
||||
|
|
|
@ -80,7 +80,7 @@ function runTest(testNum) {
|
|||
"context-inspect", true];
|
||||
}
|
||||
|
||||
var passwordFillItems = [
|
||||
var loginFillItems = [
|
||||
"---", null,
|
||||
"fill-login", null,
|
||||
[
|
||||
|
@ -652,7 +652,8 @@ function runTest(testNum) {
|
|||
"context-searchselect",true,
|
||||
"---", null,
|
||||
"spell-check-enabled", true
|
||||
].concat(inspectItems));
|
||||
].concat(loginFillItems)
|
||||
.concat(inspectItems));
|
||||
closeContextMenu();
|
||||
selectInputText(select_inputtext_password); // Select text prior to opening context menu.
|
||||
openContextMenuFor(select_inputtext_password); // Invoke context menu for next test.
|
||||
|
@ -675,7 +676,7 @@ function runTest(testNum) {
|
|||
["spell-check-dictionary-en-US", true,
|
||||
"---", null,
|
||||
"spell-add-dictionaries", true], null
|
||||
].concat(passwordFillItems)
|
||||
].concat(loginFillItems)
|
||||
.concat(inspectItems));
|
||||
closeContextMenu();
|
||||
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_RIGHT:
|
||||
case KeyEvent.DOM_VK_HOME:
|
||||
this.popup.hidePopup();
|
||||
return;
|
||||
// Reset the selected index so that nsAutoCompleteController
|
||||
// simply closes the popup without trying to fill anything.
|
||||
this.popup.selectedIndex = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ const BREAKPOINT_LINE_TOOLTIP_MAX_LENGTH = 1000; // chars
|
|||
const BREAKPOINT_CONDITIONAL_POPUP_POSITION = "before_start";
|
||||
const BREAKPOINT_CONDITIONAL_POPUP_OFFSET_X = 7; // 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_MAX_RESULTS = 10;
|
||||
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_POPUP_POSITION = "topcenter bottomleft";
|
||||
const TOOLBAR_ORDER_POPUP_POSITION = "topcenter bottomleft";
|
||||
const RESIZE_REFRESH_RATE = 50; // ms
|
||||
const PROMISE_DEBUGGER_URL =
|
||||
"chrome://browser/content/devtools/promisedebugger/promise-debugger.xhtml";
|
||||
|
||||
|
@ -93,6 +95,8 @@ let DebuggerView = {
|
|||
return this._shutdown;
|
||||
}
|
||||
|
||||
window.removeEventListener("resize", this._onResize, false);
|
||||
|
||||
let deferred = promise.defer();
|
||||
this._shutdown = deferred.promise;
|
||||
|
||||
|
@ -141,10 +145,10 @@ let DebuggerView = {
|
|||
this._instrumentsPane.setAttribute("width", Prefs.instrumentsWidth);
|
||||
this.toggleInstrumentsPane({ visible: Prefs.panesVisibleOnStartup });
|
||||
|
||||
// Side hosts requires a different arrangement of the debugger widgets.
|
||||
if (gHostType == "side") {
|
||||
this.handleHostChanged(gHostType);
|
||||
}
|
||||
this.updateLayoutMode();
|
||||
|
||||
this._onResize = this._onResize.bind(this);
|
||||
window.addEventListener("resize", this._onResize, false);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -214,6 +218,17 @@ let DebuggerView = {
|
|||
_initializePromiseDebugger: function() {
|
||||
let iframe = this._promiseDebuggerIframe = document.createElement("iframe");
|
||||
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);
|
||||
this._promisePane.appendChild(iframe);
|
||||
},
|
||||
|
@ -223,6 +238,8 @@ let DebuggerView = {
|
|||
*/
|
||||
_destroyPromiseDebugger: function() {
|
||||
if (this._promiseDebuggerIframe) {
|
||||
this._promiseDebuggerIframe.contentWindow.destroy();
|
||||
|
||||
this._promiseDebuggerIframe.parentNode.removeChild(
|
||||
this._promiseDebuggerIframe);
|
||||
|
||||
|
@ -619,24 +636,64 @@ let DebuggerView = {
|
|||
* @param string aType
|
||||
* The host type, either "bottom", "side" or "window".
|
||||
*/
|
||||
handleHostChanged: function(aType) {
|
||||
let newLayout = "";
|
||||
|
||||
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);
|
||||
handleHostChanged: function(hostType) {
|
||||
this._hostType = hostType;
|
||||
this.updateLayoutMode();
|
||||
},
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
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() {
|
||||
let normContainer = document.getElementById("debugger-widgets");
|
||||
|
|
|
@ -26,7 +26,7 @@ function DebuggerPanel(iframeWindow, toolbox) {
|
|||
this.unhighlightWhenResumed = this.unhighlightWhenResumed.bind(this);
|
||||
|
||||
EventEmitter.decorate(this);
|
||||
};
|
||||
}
|
||||
|
||||
exports.DebuggerPanel = DebuggerPanel;
|
||||
|
||||
|
|
|
@ -6,15 +6,22 @@
|
|||
* host changes.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
let gDefaultHostType = Services.prefs.getCharPref("devtools.toolbox.host");
|
||||
|
||||
function test() {
|
||||
// test is too slow on some platforms due to the number of test cases
|
||||
requestLongerTimeout(2);
|
||||
|
||||
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(["bottom", "side", "bottom"], ["horizontal", "vertical", "horizontal"]);
|
||||
yield testHosts(["side", "window", "side"], ["vertical", "horizontal", "vertical"]);
|
||||
yield testHosts(["window", "side", "window"], ["horizontal", "vertical", "horizontal"]);
|
||||
yield testHosts(["side", "window:big", "side"], ["vertical", "horizontal", "vertical"]);
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
@ -23,11 +30,15 @@ function testHosts(aHostTypes, aLayoutTypes) {
|
|||
let [firstHost, secondHost, thirdHost] = aHostTypes;
|
||||
let [firstLayout, secondLayout, thirdLayout] = aLayoutTypes;
|
||||
|
||||
Services.prefs.setCharPref("devtools.toolbox.host", firstHost);
|
||||
Services.prefs.setCharPref("devtools.toolbox.host", getHost(firstHost));
|
||||
|
||||
return Task.spawn(function*() {
|
||||
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, thirdHost, thirdLayout);
|
||||
yield teardown(panel);
|
||||
|
@ -39,26 +50,63 @@ function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
|
|||
let gDebugger = aPanel.panelWin;
|
||||
|
||||
return Task.spawn(function*() {
|
||||
let layoutChanged = once(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
|
||||
let hostChanged = gToolbox.switchHost(aHostType);
|
||||
let layoutChanged = waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
|
||||
let hostChanged = gToolbox.switchHost(getHost(aHostType));
|
||||
|
||||
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;
|
||||
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) {
|
||||
let deferred = promise.defer();
|
||||
aTarget.once(aEvent, deferred.resolve);
|
||||
return deferred.promise;
|
||||
function waitEventOnce(aTarget, aEvent) {
|
||||
let deferred = promise.defer();
|
||||
aTarget.once(aEvent, deferred.resolve);
|
||||
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 gView = gDebugger.DebuggerView;
|
||||
|
||||
|
|
|
@ -621,7 +621,9 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
|||
let promisePane = this.DebuggerView._promisePane;
|
||||
promisePane.hidden = !promisePane.hidden;
|
||||
|
||||
this.DebuggerView._initializePromiseDebugger();
|
||||
if (!this.DebuggerView._promiseDebuggerIframe) {
|
||||
this.DebuggerView._initializePromiseDebugger();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -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/optimizations-list.js (performance/views/optimizations-list.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/commandline.css (commandline/commandline.css)
|
||||
content/browser/devtools/commandlineoutput.xhtml (commandline/commandlineoutput.xhtml)
|
||||
|
|
|
@ -259,17 +259,34 @@ MarkupView.prototype = {
|
|||
},
|
||||
|
||||
_onMouseUp: function() {
|
||||
if (this._lastDropTarget) {
|
||||
this.indicateDropTarget(null);
|
||||
}
|
||||
if (this._lastDragTarget) {
|
||||
this.indicateDragTarget(null);
|
||||
}
|
||||
this.indicateDropTarget(null);
|
||||
this.indicateDragTarget(null);
|
||||
if (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,
|
||||
|
||||
/**
|
||||
|
@ -632,6 +649,12 @@ MarkupView.prototype = {
|
|||
this.beginEditingOuterHTML(this._selectedContainer.node);
|
||||
break;
|
||||
}
|
||||
case Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE: {
|
||||
if (this.isDragging) {
|
||||
this.cancelDragging();
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
handled = false;
|
||||
}
|
||||
|
@ -1927,6 +1950,18 @@ MarkupContainer.prototype = {
|
|||
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) {
|
||||
let target = event.target;
|
||||
|
||||
|
@ -1964,9 +1999,7 @@ MarkupContainer.prototype = {
|
|||
this.markup._dragStartEl = target;
|
||||
setTimeout(() => {
|
||||
// Make sure the mouse is still down and on target.
|
||||
if (!this._isMouseDown || this.markup._dragStartEl !== target ||
|
||||
this.node.isPseudoElement || this.node.isAnonymous ||
|
||||
!this.win.getSelection().isCollapsed) {
|
||||
if (!this.isDraggable(target)) {
|
||||
return;
|
||||
}
|
||||
this.isDragging = true;
|
||||
|
@ -1990,8 +2023,7 @@ MarkupContainer.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
this.isDragging = false;
|
||||
this.elt.style.removeProperty("top");
|
||||
this.cancelDragging();
|
||||
|
||||
let dropTargetNodes = this.markup.dropTargetNodes;
|
||||
|
||||
|
@ -2021,6 +2053,16 @@ MarkupContainer.prototype = {
|
|||
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.
|
||||
* 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_css_completion_style_attribute.js]
|
||||
[browser_markupview_dragdrop_autoscroll.js]
|
||||
[browser_markupview_dragdrop_dragRootNode.js]
|
||||
[browser_markupview_dragdrop_escapeKeyPress.js]
|
||||
[browser_markupview_dragdrop_invalidNodes.js]
|
||||
[browser_markupview_dragdrop_isDragging.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']
|
||||
|
||||
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"/>
|
||||
</head>
|
||||
<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>
|
||||
</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 {
|
||||
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.
|
||||
// This excludes arguments and local variables, leaving only captured
|
||||
// variables.
|
||||
astMatcher.addMatcher(
|
||||
lambdaExpr(hasDescendant(
|
||||
declRefExpr(hasType(pointerType(pointee(isRefCounted()))),
|
||||
to(decl().bind("decl")))
|
||||
.bind("declref")),
|
||||
unless(hasDescendant(decl(equalsBoundNode("decl"))))),
|
||||
&refCountedInsideLambdaChecker);
|
||||
astMatcher.addMatcher(lambdaExpr().bind("lambda"), &refCountedInsideLambdaChecker);
|
||||
|
||||
// Older clang versions such as the ones used on the infra 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");
|
||||
unsigned noteID = Diag.getDiagnosticIDs()->getCustomDiagID(
|
||||
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)
|
||||
<< declref->getFoundDecl() << declref->getType()->getPointeeType();
|
||||
Diag.Report(declref->getLocStart(), noteID);
|
||||
for (const LambdaCapture Capture : Lambda->captures()) {
|
||||
if (Capture.capturesVariable()) {
|
||||
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(
|
||||
|
|
|
@ -67,9 +67,9 @@ void foo() {
|
|||
take(argsp);
|
||||
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;
|
||||
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();
|
||||
localptr->method();
|
||||
});
|
||||
|
@ -79,9 +79,9 @@ void foo() {
|
|||
argsp->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;
|
||||
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(localptr);
|
||||
});
|
||||
|
|
|
@ -2852,7 +2852,7 @@ Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
|
|||
(!aVisitor.mEvent->mFlags.mIsTrusted &&
|
||||
(aVisitor.mEvent->mMessage != eMouseClick) &&
|
||||
(aVisitor.mEvent->mMessage != eKeyPress) &&
|
||||
(aVisitor.mEvent->mMessage != NS_UI_ACTIVATE)) ||
|
||||
(aVisitor.mEvent->mMessage != eLegacyDOMActivate)) ||
|
||||
!aVisitor.mPresContext ||
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
|
||||
return false;
|
||||
|
@ -2869,9 +2869,9 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
|
|||
// IMPORTANT: this switch and the switch below it must be kept in sync!
|
||||
switch (aVisitor.mEvent->mMessage) {
|
||||
case eMouseOver:
|
||||
case NS_FOCUS_CONTENT:
|
||||
case eFocus:
|
||||
case eMouseOut:
|
||||
case NS_BLUR_CONTENT:
|
||||
case eBlur:
|
||||
break;
|
||||
default:
|
||||
return NS_OK;
|
||||
|
@ -2892,7 +2892,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
|
|||
case eMouseOver:
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
// FALL THROUGH
|
||||
case NS_FOCUS_CONTENT: {
|
||||
case eFocus: {
|
||||
InternalFocusEvent* focusEvent = aVisitor.mEvent->AsFocusEvent();
|
||||
if (!focusEvent || !focusEvent->isRefocus) {
|
||||
nsAutoString target;
|
||||
|
@ -2907,7 +2907,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
|
|||
case eMouseOut:
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
// FALL THROUGH
|
||||
case NS_BLUR_CONTENT:
|
||||
case eBlur:
|
||||
rv = LeaveLink(aVisitor.mPresContext);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
|
@ -2931,7 +2931,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
|||
switch (aVisitor.mEvent->mMessage) {
|
||||
case eMouseDown:
|
||||
case eMouseClick:
|
||||
case NS_UI_ACTIVATE:
|
||||
case eLegacyDOMActivate:
|
||||
case eKeyPress:
|
||||
break;
|
||||
default:
|
||||
|
@ -2985,7 +2985,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
|||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
// DOMActive event should be trusted since the activation is actually
|
||||
// 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;
|
||||
|
||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
|
@ -2996,7 +2996,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case NS_UI_ACTIVATE:
|
||||
case eLegacyDOMActivate:
|
||||
{
|
||||
if (aVisitor.mEvent->originalTarget == this) {
|
||||
nsAutoString target;
|
||||
|
|
|
@ -69,6 +69,7 @@ EventSource::EventSource(nsPIDOMWindow* aOwnerWindow) :
|
|||
mLastConvertionResult(NS_OK),
|
||||
mReadyState(CONNECTING),
|
||||
mScriptLine(0),
|
||||
mScriptColumn(0),
|
||||
mInnerWindowID(0)
|
||||
{
|
||||
}
|
||||
|
@ -205,7 +206,8 @@ EventSource::Init(nsISupports* aOwner,
|
|||
|
||||
// The conditional here is historical and not necessarily sane.
|
||||
if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
|
||||
nsJSUtils::GetCallingLocation(cx, mScriptFile, &mScriptLine);
|
||||
nsJSUtils::GetCallingLocation(cx, mScriptFile, &mScriptLine,
|
||||
&mScriptColumn);
|
||||
mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx);
|
||||
}
|
||||
|
||||
|
@ -987,7 +989,7 @@ EventSource::PrintErrorOnConsole(const char *aBundleURI,
|
|||
rv = errObj->InitWithWindowID(message,
|
||||
mScriptFile,
|
||||
EmptyString(),
|
||||
mScriptLine, 0,
|
||||
mScriptLine, mScriptColumn,
|
||||
nsIScriptError::errorFlag,
|
||||
"Event Source", mInnerWindowID);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -255,12 +255,14 @@ protected:
|
|||
|
||||
// Event Source owner information:
|
||||
// - 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
|
||||
// be the same as the Event Source owner window.
|
||||
// These attributes are used for error reporting.
|
||||
nsString mScriptFile;
|
||||
uint32_t mScriptLine;
|
||||
uint32_t mScriptColumn;
|
||||
uint64_t mInnerWindowID;
|
||||
|
||||
private:
|
||||
|
|
|
@ -806,12 +806,12 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// selectstart
|
||||
bool stopEvent = false;
|
||||
switch (aVisitor.mEvent->mMessage) {
|
||||
case NS_IMAGE_ABORT:
|
||||
case NS_LOAD_ERROR:
|
||||
case NS_FORM_SELECTED:
|
||||
case NS_FORM_CHANGE:
|
||||
case NS_LOAD:
|
||||
case NS_FORM_RESET:
|
||||
case eImageAbort:
|
||||
case eLoadError:
|
||||
case eFormSelect:
|
||||
case eFormChange:
|
||||
case eLoad:
|
||||
case eFormReset:
|
||||
case eResize:
|
||||
case eScroll:
|
||||
stopEvent = true;
|
||||
|
@ -843,7 +843,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// The load event is special in that we don't ever propagate it
|
||||
// to chrome.
|
||||
nsCOMPtr<nsPIDOMWindow> win = OwnerDoc()->GetWindow();
|
||||
EventTarget* parentTarget = win && aVisitor.mEvent->mMessage != NS_LOAD
|
||||
EventTarget* parentTarget = win && aVisitor.mEvent->mMessage != eLoad
|
||||
? win->GetParentTarget() : nullptr;
|
||||
|
||||
aVisitor.mParentTarget = parentTarget;
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
, mCloseEventWasClean(false)
|
||||
, mCloseEventCode(nsIWebSocketChannel::CLOSE_ABNORMAL)
|
||||
, mScriptLine(0)
|
||||
, mScriptColumn(0)
|
||||
, mInnerWindowID(0)
|
||||
, mWorkerPrivate(nullptr)
|
||||
#ifdef DEBUG
|
||||
|
@ -121,6 +122,7 @@ public:
|
|||
nsTArray<nsString>& aProtocolArray,
|
||||
const nsACString& aScriptFile,
|
||||
uint32_t aScriptLine,
|
||||
uint32_t aScriptColumn,
|
||||
ErrorResult& aRv,
|
||||
bool* aConnectionFailed);
|
||||
|
||||
|
@ -197,12 +199,14 @@ public:
|
|||
|
||||
// Web Socket owner information:
|
||||
// - 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
|
||||
// be the same as the Web Socket owner window.
|
||||
// These attributes are used for error reporting.
|
||||
nsCString mScriptFile;
|
||||
uint32_t mScriptLine;
|
||||
uint32_t mScriptColumn;
|
||||
uint64_t mInnerWindowID;
|
||||
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
|
@ -370,13 +374,14 @@ WebSocketImpl::PrintErrorOnConsole(const char *aBundleURI,
|
|||
if (mInnerWindowID) {
|
||||
rv = errorObject->InitWithWindowID(message,
|
||||
NS_ConvertUTF8toUTF16(mScriptFile),
|
||||
EmptyString(), mScriptLine, 0,
|
||||
EmptyString(), mScriptLine,
|
||||
mScriptColumn,
|
||||
nsIScriptError::errorFlag, "Web Socket",
|
||||
mInnerWindowID);
|
||||
} else {
|
||||
rv = errorObject->Init(message,
|
||||
NS_ConvertUTF8toUTF16(mScriptFile),
|
||||
EmptyString(), mScriptLine, 0,
|
||||
EmptyString(), mScriptLine, mScriptColumn,
|
||||
nsIScriptError::errorFlag, "Web Socket");
|
||||
}
|
||||
|
||||
|
@ -1036,6 +1041,7 @@ public:
|
|||
InitRunnable(WebSocketImpl* aImpl, const nsAString& aURL,
|
||||
nsTArray<nsString>& aProtocolArray,
|
||||
const nsACString& aScriptFile, uint32_t aScriptLine,
|
||||
uint32_t aScriptColumn,
|
||||
ErrorResult& aRv, bool* aConnectionFailed)
|
||||
: WebSocketMainThreadRunnable(aImpl->mWorkerPrivate)
|
||||
, mImpl(aImpl)
|
||||
|
@ -1043,6 +1049,7 @@ public:
|
|||
, mProtocolArray(aProtocolArray)
|
||||
, mScriptFile(aScriptFile)
|
||||
, mScriptLine(aScriptLine)
|
||||
, mScriptColumn(aScriptColumn)
|
||||
, mRv(aRv)
|
||||
, mConnectionFailed(aConnectionFailed)
|
||||
{
|
||||
|
@ -1074,7 +1081,7 @@ protected:
|
|||
}
|
||||
|
||||
mImpl->Init(jsapi.cx(), principal, mURL, mProtocolArray, mScriptFile,
|
||||
mScriptLine, mRv, mConnectionFailed);
|
||||
mScriptLine, mScriptColumn, mRv, mConnectionFailed);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1084,7 +1091,7 @@ protected:
|
|||
MOZ_ASSERT(aTopLevelWorkerPrivate && !aTopLevelWorkerPrivate->GetWindow());
|
||||
|
||||
mImpl->Init(nullptr, aTopLevelWorkerPrivate->GetPrincipal(), mURL,
|
||||
mProtocolArray, mScriptFile, mScriptLine, mRv,
|
||||
mProtocolArray, mScriptFile, mScriptLine, mScriptColumn, mRv,
|
||||
mConnectionFailed);
|
||||
return true;
|
||||
}
|
||||
|
@ -1096,6 +1103,7 @@ protected:
|
|||
nsTArray<nsString>& mProtocolArray;
|
||||
nsCString mScriptFile;
|
||||
uint32_t mScriptLine;
|
||||
uint32_t mScriptColumn;
|
||||
ErrorResult& mRv;
|
||||
bool* mConnectionFailed;
|
||||
};
|
||||
|
@ -1217,7 +1225,7 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
|
|||
|
||||
if (NS_IsMainThread()) {
|
||||
webSocket->mImpl->Init(aGlobal.Context(), principal, aUrl, protocolArray,
|
||||
EmptyCString(), 0, aRv, &connectionFailed);
|
||||
EmptyCString(), 0, 0, aRv, &connectionFailed);
|
||||
} else {
|
||||
// In workers we have to keep the worker alive using a feature in order to
|
||||
// dispatch messages correctly.
|
||||
|
@ -1226,15 +1234,16 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned lineno;
|
||||
unsigned lineno, column;
|
||||
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.");
|
||||
}
|
||||
|
||||
nsRefPtr<InitRunnable> runnable =
|
||||
new InitRunnable(webSocket->mImpl, aUrl, protocolArray,
|
||||
nsAutoCString(file.get()), lineno, aRv,
|
||||
nsAutoCString(file.get()), lineno, column, aRv,
|
||||
&connectionFailed);
|
||||
runnable->Dispatch(aGlobal.Context());
|
||||
}
|
||||
|
@ -1395,6 +1404,7 @@ WebSocketImpl::Init(JSContext* aCx,
|
|||
nsTArray<nsString>& aProtocolArray,
|
||||
const nsACString& aScriptFile,
|
||||
uint32_t aScriptLine,
|
||||
uint32_t aScriptColumn,
|
||||
ErrorResult& aRv,
|
||||
bool* aConnectionFailed)
|
||||
{
|
||||
|
@ -1434,14 +1444,16 @@ WebSocketImpl::Init(JSContext* aCx,
|
|||
if (mWorkerPrivate) {
|
||||
mScriptFile = aScriptFile;
|
||||
mScriptLine = aScriptLine;
|
||||
mScriptColumn = aScriptColumn;
|
||||
} else {
|
||||
MOZ_ASSERT(aCx);
|
||||
|
||||
unsigned lineno;
|
||||
unsigned lineno, column;
|
||||
JS::AutoFilename file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineno)) {
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineno, &column)) {
|
||||
mScriptFile = file.get();
|
||||
mScriptLine = lineno;
|
||||
mScriptColumn = column;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3502,7 +3502,7 @@ nsContentUtils::ReportToConsoleNonLocalized(const nsAString& aErrorText,
|
|||
if (!aLineNumber) {
|
||||
JSContext *cx = GetCurrentJSContext();
|
||||
if (cx) {
|
||||
nsJSUtils::GetCallingLocation(cx, spec, &aLineNumber);
|
||||
nsJSUtils::GetCallingLocation(cx, spec, &aLineNumber, &aColumnNumber);
|
||||
}
|
||||
}
|
||||
if (spec.IsEmpty() && aURI)
|
||||
|
@ -5464,8 +5464,8 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
|||
// For draggesture and dragstart events, the data transfer object is
|
||||
// created before the event fires, so it should already be set. For other
|
||||
// drag events, get the object from the drag session.
|
||||
NS_ASSERTION(aDragEvent->mMessage != NS_DRAGDROP_GESTURE &&
|
||||
aDragEvent->mMessage != NS_DRAGDROP_START,
|
||||
NS_ASSERTION(aDragEvent->mMessage != eLegacyDragGesture &&
|
||||
aDragEvent->mMessage != eDragStart,
|
||||
"draggesture event created without a dataTransfer");
|
||||
|
||||
nsCOMPtr<nsIDragSession> dragSession = GetDragSession();
|
||||
|
@ -5492,8 +5492,8 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
|||
}
|
||||
|
||||
bool isCrossDomainSubFrameDrop = false;
|
||||
if (aDragEvent->mMessage == NS_DRAGDROP_DROP ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_DRAGDROP) {
|
||||
if (aDragEvent->mMessage == eDrop ||
|
||||
aDragEvent->mMessage == eLegacyDragDrop) {
|
||||
isCrossDomainSubFrameDrop = CheckForSubFrameDrop(dragSession, aDragEvent);
|
||||
}
|
||||
|
||||
|
@ -5507,16 +5507,15 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
|||
// for the dragenter and dragover events, initialize the drop effect
|
||||
// from the drop action, which platform specific widget code sets before
|
||||
// the event is fired based on the keyboard state.
|
||||
if (aDragEvent->mMessage == NS_DRAGDROP_ENTER ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_OVER) {
|
||||
if (aDragEvent->mMessage == eDragEnter || aDragEvent->mMessage == eDragOver) {
|
||||
uint32_t action, effectAllowed;
|
||||
dragSession->GetDragAction(&action);
|
||||
aDragEvent->dataTransfer->GetEffectAllowedInt(&effectAllowed);
|
||||
aDragEvent->dataTransfer->SetDropEffectInt(FilterDropEffect(action, effectAllowed));
|
||||
}
|
||||
else if (aDragEvent->mMessage == NS_DRAGDROP_DROP ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_DRAGDROP ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_END) {
|
||||
else if (aDragEvent->mMessage == eDrop ||
|
||||
aDragEvent->mMessage == eLegacyDragDrop ||
|
||||
aDragEvent->mMessage == eDragEnd) {
|
||||
// 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
|
||||
// EventStateManager::PostHandleEvent for the last dragenter or
|
||||
|
|
|
@ -299,25 +299,6 @@ nsDOMWindowUtils::UpdateLayerTree()
|
|||
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
|
||||
nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
||||
uint32_t aDisplayHeight,
|
||||
|
|
|
@ -8146,7 +8146,7 @@ nsDocument::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
aVisitor.mForceContentDispatch = true;
|
||||
|
||||
// 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());
|
||||
aVisitor.mParentTarget =
|
||||
window ? window->GetTargetForEventTargetChain() : nullptr;
|
||||
|
|
|
@ -966,7 +966,7 @@ nsFocusManager::WindowHidden(nsIDOMWindow* aWindow)
|
|||
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
||||
|
||||
if (presShell) {
|
||||
SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell,
|
||||
SendFocusOrBlurEvent(eBlur, presShell,
|
||||
oldFocusedContent->GetComposedDoc(),
|
||||
oldFocusedContent, 1, false);
|
||||
}
|
||||
|
@ -1682,7 +1682,7 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear,
|
|||
if (mActiveWindow)
|
||||
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
||||
|
||||
SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell,
|
||||
SendFocusOrBlurEvent(eBlur, presShell,
|
||||
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
|
||||
nsIDocument* doc = window->GetExtantDoc();
|
||||
if (doc)
|
||||
SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell, doc, doc, 1, false);
|
||||
SendFocusOrBlurEvent(eBlur, presShell, doc, doc, 1, false);
|
||||
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
|
||||
result = (mFocusedWindow == nullptr && mActiveWindow);
|
||||
|
@ -1857,10 +1857,10 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
|
|||
GetFocusMoveActionCause(aFlags));
|
||||
}
|
||||
if (doc)
|
||||
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
|
||||
SendFocusOrBlurEvent(eFocus, presShell, doc,
|
||||
doc, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
|
||||
if (mFocusedWindow == aWindow && mFocusedContent == nullptr)
|
||||
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
|
||||
SendFocusOrBlurEvent(eFocus, presShell, doc,
|
||||
aWindow, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
|
||||
}
|
||||
|
||||
|
@ -1908,7 +1908,7 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
|
|||
if (!aWindowRaised)
|
||||
aWindow->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
|
||||
|
||||
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell,
|
||||
SendFocusOrBlurEvent(eFocus, presShell,
|
||||
aContent->GetComposedDoc(),
|
||||
aContent, aFlags & FOCUSMETHOD_MASK,
|
||||
aWindowRaised, isRefocus);
|
||||
|
@ -2001,8 +2001,7 @@ nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
|
|||
bool aWindowRaised,
|
||||
bool aIsRefocus)
|
||||
{
|
||||
NS_ASSERTION(aEventMessage == NS_FOCUS_CONTENT ||
|
||||
aEventMessage == NS_BLUR_CONTENT,
|
||||
NS_ASSERTION(aEventMessage == eFocus || aEventMessage == eBlur,
|
||||
"Wrong event type for SendFocusOrBlurEvent");
|
||||
|
||||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||
|
@ -2042,7 +2041,7 @@ nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
|
|||
#ifdef ACCESSIBILITY
|
||||
nsAccessibilityService* accService = GetAccService();
|
||||
if (accService) {
|
||||
if (aEventMessage == NS_FOCUS_CONTENT) {
|
||||
if (aEventMessage == eFocus) {
|
||||
accService->NotifyOfDOMFocus(aTarget);
|
||||
} else {
|
||||
accService->NotifyOfDOMBlur(aTarget);
|
||||
|
|
|
@ -280,7 +280,7 @@ protected:
|
|||
/**
|
||||
* 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.
|
||||
*
|
||||
* aWindowRaised should only be true if called from WindowRaised.
|
||||
|
|
|
@ -157,7 +157,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
|
|||
, mObservingOwnerContent(false)
|
||||
, mVisible(true)
|
||||
{
|
||||
ResetPermissionManagerStatus();
|
||||
mRemoteFrame = ShouldUseRemoteProcess();
|
||||
}
|
||||
|
||||
|
@ -409,6 +408,9 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
|||
mURIToLoad = nullptr;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Track the appId's reference count if this frame is in-process
|
||||
ResetPermissionManagerStatus();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2705,7 +2707,9 @@ nsFrameLoader::ResetPermissionManagerStatus()
|
|||
{
|
||||
// The resetting of the permissions status can run only
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -663,12 +663,12 @@ GetParamsForMessage(JSContext* aCx,
|
|||
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||
if (console) {
|
||||
nsAutoString filename;
|
||||
uint32_t lineno = 0;
|
||||
nsJSUtils::GetCallingLocation(aCx, filename, &lineno);
|
||||
uint32_t lineno = 0, column = 0;
|
||||
nsJSUtils::GetCallingLocation(aCx, filename, &lineno, &column);
|
||||
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?"),
|
||||
filename, EmptyString(),
|
||||
lineno, 0, nsIScriptError::warningFlag, "chrome javascript");
|
||||
filename, EmptyString(), lineno, column,
|
||||
nsIScriptError::warningFlag, "chrome javascript");
|
||||
console->LogMessage(error);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ public:
|
|||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override
|
||||
{
|
||||
MOZ_ASSERT(IsInNativeAnonymousSubtree());
|
||||
if (aVisitor.mEvent->mMessage == NS_LOAD ||
|
||||
aVisitor.mEvent->mMessage == NS_LOAD_ERROR) {
|
||||
if (aVisitor.mEvent->mMessage == eLoad ||
|
||||
aVisitor.mEvent->mMessage == eLoadError) {
|
||||
// Don't propagate the events to the parent.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -3086,7 +3086,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
}
|
||||
} else if (msg == eMouseDown && aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
gMouseDown = true;
|
||||
} else if ((msg == eMouseUp || msg == NS_DRAGDROP_END) &&
|
||||
} else if ((msg == eMouseUp || msg == eDragEnd) &&
|
||||
aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
gMouseDown = false;
|
||||
if (gDragServiceDisabled) {
|
||||
|
@ -3265,8 +3265,8 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
// Return early if there is nothing to do.
|
||||
switch (aVisitor.mEvent->mMessage) {
|
||||
case eResize:
|
||||
case NS_PAGE_UNLOAD:
|
||||
case NS_LOAD:
|
||||
case eUnload:
|
||||
case eLoad:
|
||||
break;
|
||||
default:
|
||||
return NS_OK;
|
||||
|
@ -3280,7 +3280,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
|
||||
if (aVisitor.mEvent->mMessage == eResize) {
|
||||
mIsHandlingResizeEvent = false;
|
||||
} else if (aVisitor.mEvent->mMessage == NS_PAGE_UNLOAD &&
|
||||
} else if (aVisitor.mEvent->mMessage == eUnload &&
|
||||
aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
// Execute bindingdetached handlers before we tear ourselves
|
||||
// down.
|
||||
|
@ -3288,7 +3288,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
mDoc->BindingManager()->ExecuteDetachedHandlers();
|
||||
}
|
||||
mIsDocumentLoaded = false;
|
||||
} else if (aVisitor.mEvent->mMessage == NS_LOAD &&
|
||||
} else if (aVisitor.mEvent->mMessage == eLoad &&
|
||||
aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
// This is page load event since load events don't propagate to |window|.
|
||||
// @see nsDocument::PreHandleEvent.
|
||||
|
@ -3302,7 +3302,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
// onload event for the frame element.
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetEvent event(aVisitor.mEvent->mFlags.mIsTrusted, NS_LOAD);
|
||||
WidgetEvent event(aVisitor.mEvent->mFlags.mIsTrusted, eLoad);
|
||||
event.mFlags.mBubbles = false;
|
||||
|
||||
// Most of the time we could get a pres context to pass in here,
|
||||
|
|
|
@ -35,10 +35,10 @@ using namespace mozilla::dom;
|
|||
|
||||
bool
|
||||
nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
||||
uint32_t* aLineno)
|
||||
uint32_t* aLineno, uint32_t* aColumn)
|
||||
{
|
||||
JS::AutoFilename filename;
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -48,10 +48,10 @@ nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
|||
|
||||
bool
|
||||
nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
|
||||
uint32_t* aLineno)
|
||||
uint32_t* aLineno, uint32_t* aColumn)
|
||||
{
|
||||
JS::AutoFilename filename;
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,11 @@ class nsJSUtils
|
|||
{
|
||||
public:
|
||||
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,
|
||||
uint32_t* aLineno);
|
||||
uint32_t* aLineno = nullptr,
|
||||
uint32_t* aColumn = nullptr);
|
||||
|
||||
static nsIScriptGlobalObject *GetStaticScriptGlobal(JSObject* aObj);
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ nsScriptElement::ScriptEvaluated(nsresult aResult,
|
|||
nsContentUtils::GetContextForContent(cont);
|
||||
|
||||
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);
|
||||
// Load event doesn't bubble.
|
||||
event.mFlags.mBubbles = (message != NS_LOAD);
|
||||
event.mFlags.mBubbles = (message != eLoad);
|
||||
|
||||
EventDispatcher::Dispatch(cont, presContext, &event, nullptr, &status);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,6 @@ UNIFIED_SOURCES += [
|
|||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../..', # Support `#include "mfbt/RefPtr.h"`
|
||||
'/js/xpconnect/wrappers',
|
||||
]
|
||||
|
||||
|
|
|
@ -68,40 +68,41 @@ const char DataTransfer::sEffects[8][9] = {
|
|||
"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)
|
||||
: mParent(aParent),
|
||||
mEventType(aEventType),
|
||||
mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE),
|
||||
mEffectAllowed(nsIDragService::DRAGDROP_ACTION_UNINITIALIZED),
|
||||
mCursorState(false),
|
||||
mReadOnly(true),
|
||||
mIsExternal(aIsExternal),
|
||||
mUserCancelled(false),
|
||||
mIsCrossDomainSubFrameDrop(false),
|
||||
mClipboardType(aClipboardType),
|
||||
mDragImageX(0),
|
||||
mDragImageY(0)
|
||||
: mParent(aParent)
|
||||
, mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE)
|
||||
, mEffectAllowed(nsIDragService::DRAGDROP_ACTION_UNINITIALIZED)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mCursorState(false)
|
||||
, mReadOnly(true)
|
||||
, mIsExternal(aIsExternal)
|
||||
, mUserCancelled(false)
|
||||
, mIsCrossDomainSubFrameDrop(false)
|
||||
, mClipboardType(aClipboardType)
|
||||
, mDragImageX(0)
|
||||
, mDragImageY(0)
|
||||
{
|
||||
// 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
|
||||
// external usage, cache the data from the native clipboard or drag.
|
||||
if (aEventType == NS_CUT ||
|
||||
aEventType == NS_COPY ||
|
||||
aEventType == NS_DRAGDROP_START ||
|
||||
aEventType == NS_DRAGDROP_GESTURE) {
|
||||
if (aEventMessage == NS_CUT ||
|
||||
aEventMessage == NS_COPY ||
|
||||
aEventMessage == eDragStart ||
|
||||
aEventMessage == eLegacyDragGesture) {
|
||||
mReadOnly = false;
|
||||
} else if (mIsExternal) {
|
||||
if (aEventType == NS_PASTE) {
|
||||
if (aEventMessage == NS_PASTE) {
|
||||
CacheExternalClipboardFormats();
|
||||
} else if (aEventType >= NS_DRAGDROP_EVENT_START && aEventType <= NS_DRAGDROP_LEAVE) {
|
||||
} else if (aEventMessage >= eDragDropEventFirst &&
|
||||
aEventMessage <= eDragDropEventLast) {
|
||||
CacheExternalDragFormats();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DataTransfer::DataTransfer(nsISupports* aParent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
const uint32_t aEffectAllowed,
|
||||
bool aCursorState,
|
||||
bool aIsExternal,
|
||||
|
@ -112,20 +113,20 @@ DataTransfer::DataTransfer(nsISupports* aParent,
|
|||
Element* aDragImage,
|
||||
uint32_t aDragImageX,
|
||||
uint32_t aDragImageY)
|
||||
: mParent(aParent),
|
||||
mEventType(aEventType),
|
||||
mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE),
|
||||
mEffectAllowed(aEffectAllowed),
|
||||
mCursorState(aCursorState),
|
||||
mReadOnly(true),
|
||||
mIsExternal(aIsExternal),
|
||||
mUserCancelled(aUserCancelled),
|
||||
mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop),
|
||||
mClipboardType(aClipboardType),
|
||||
mItems(aItems),
|
||||
mDragImage(aDragImage),
|
||||
mDragImageX(aDragImageX),
|
||||
mDragImageY(aDragImageY)
|
||||
: mParent(aParent)
|
||||
, mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE)
|
||||
, mEffectAllowed(aEffectAllowed)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mCursorState(aCursorState)
|
||||
, mReadOnly(true)
|
||||
, mIsExternal(aIsExternal)
|
||||
, mUserCancelled(aUserCancelled)
|
||||
, mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop)
|
||||
, mClipboardType(aClipboardType)
|
||||
, mItems(aItems)
|
||||
, mDragImage(aDragImage)
|
||||
, mDragImageX(aDragImageX)
|
||||
, mDragImageY(aDragImageY)
|
||||
{
|
||||
MOZ_ASSERT(mParent);
|
||||
// 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
|
||||
// modifiable, but those events should have been using the first constructor
|
||||
// above.
|
||||
NS_ASSERTION(aEventType != NS_DRAGDROP_GESTURE &&
|
||||
aEventType != NS_DRAGDROP_START,
|
||||
NS_ASSERTION(aEventMessage != eLegacyDragGesture &&
|
||||
aEventMessage != eDragStart,
|
||||
"invalid event type for DataTransfer constructor");
|
||||
}
|
||||
|
||||
|
@ -268,8 +269,9 @@ DataTransfer::GetMozUserCancelled(bool* aUserCancelled)
|
|||
FileList*
|
||||
DataTransfer::GetFiles(ErrorResult& aRv)
|
||||
{
|
||||
if (mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
|
||||
mEventType != NS_PASTE) {
|
||||
if (mEventMessage != eDrop &&
|
||||
mEventMessage != eLegacyDragDrop &&
|
||||
mEventMessage != NS_PASTE) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -541,7 +543,8 @@ DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv)
|
|||
{
|
||||
// Only the first item is valid for clipboard events
|
||||
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);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -581,7 +584,8 @@ DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
|
|||
|
||||
// Only the first item is valid for clipboard events
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -599,8 +603,8 @@ DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
|
|||
// only allow access to the data with the same principal.
|
||||
nsIPrincipal* principal = nullptr;
|
||||
if (mIsCrossDomainSubFrameDrop ||
|
||||
(mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
|
||||
mEventType != NS_PASTE &&
|
||||
(mEventMessage != eDrop && mEventMessage != eLegacyDragDrop &&
|
||||
mEventMessage != NS_PASTE &&
|
||||
!nsContentUtils::IsCallerChrome())) {
|
||||
principal = nsContentUtils::SubjectPrincipal();
|
||||
}
|
||||
|
@ -692,7 +696,8 @@ DataTransfer::MozSetDataAt(const nsAString& aFormat, nsIVariant* aData,
|
|||
|
||||
// Only the first item is valid for clipboard events
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -737,7 +742,8 @@ DataTransfer::MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,
|
|||
|
||||
// Only the first item is valid for clipboard events
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -752,8 +758,8 @@ DataTransfer::MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
|
|||
MOZ_ASSERT(!mReadOnly);
|
||||
MOZ_ASSERT(aIndex < mItems.Length());
|
||||
MOZ_ASSERT(aIndex == 0 ||
|
||||
(mEventType != NS_CUT && mEventType != NS_COPY &&
|
||||
mEventType != NS_PASTE));
|
||||
(mEventMessage != NS_CUT && mEventMessage != NS_COPY &&
|
||||
mEventMessage != NS_PASTE));
|
||||
|
||||
nsAutoString format;
|
||||
GetRealFormat(aFormat, format);
|
||||
|
@ -938,12 +944,12 @@ DataTransfer::AddElement(nsIDOMElement* aElement)
|
|||
}
|
||||
|
||||
nsresult
|
||||
DataTransfer::Clone(nsISupports* aParent, uint32_t aEventType,
|
||||
DataTransfer::Clone(nsISupports* aParent, EventMessage aEventMessage,
|
||||
bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
|
||||
DataTransfer** aNewDataTransfer)
|
||||
{
|
||||
DataTransfer* newDataTransfer =
|
||||
new DataTransfer(aParent, aEventType, mEffectAllowed, mCursorState,
|
||||
new DataTransfer(aParent, aEventMessage, mEffectAllowed, mCursorState,
|
||||
mIsExternal, aUserCancelled, aIsCrossDomainSubFrameDrop,
|
||||
mClipboardType, mItems, mDragImage, mDragImageX,
|
||||
mDragImageY);
|
||||
|
@ -1252,7 +1258,8 @@ DataTransfer::CacheExternalDragFormats()
|
|||
void
|
||||
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
|
||||
// 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
|
||||
NS_ASSERTION(mEventType != NS_CUT && mEventType != NS_COPY,
|
||||
NS_ASSERTION(mEventMessage != NS_CUT && mEventMessage != NS_COPY,
|
||||
"clipboard event with empty data");
|
||||
|
||||
NS_ConvertUTF16toUTF8 utf8format(aItem.mFormat);
|
||||
|
@ -1311,7 +1318,7 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
|
|||
trans->Init(nullptr);
|
||||
trans->AddDataFlavor(format);
|
||||
|
||||
if (mEventType == NS_PASTE) {
|
||||
if (mEventMessage == NS_PASTE) {
|
||||
MOZ_ASSERT(aIndex == 0, "index in clipboard must be 0");
|
||||
|
||||
nsCOMPtr<nsIClipboard> clipboard = do_GetService("@mozilla.org/widget/clipboard;1");
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/File.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
|
||||
// needed to a new data transfer.
|
||||
DataTransfer(nsISupports* aParent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
const uint32_t aEffectAllowed,
|
||||
bool aCursorState,
|
||||
bool aIsExternal,
|
||||
|
@ -95,8 +96,6 @@ public:
|
|||
|
||||
// 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
|
||||
// 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
|
||||
|
@ -104,8 +103,8 @@ public:
|
|||
// service directly. For clipboard operations, aClipboardType indicates
|
||||
// which clipboard to use, from nsIClipboard, or -1 for non-clipboard operations,
|
||||
// or if access to the system clipboard should not be allowed.
|
||||
DataTransfer(nsISupports* aParent, uint32_t aEventType, bool aIsExternal,
|
||||
int32_t aClipboardType);
|
||||
DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
|
||||
bool aIsExternal, int32_t aClipboardType);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
nsISupports* GetParentObject()
|
||||
|
@ -222,8 +221,9 @@ public:
|
|||
return mDragImage;
|
||||
}
|
||||
|
||||
nsresult Clone(nsISupports* aParent, uint32_t aEventType, bool aUserCancelled,
|
||||
bool aIsCrossDomainSubFrameDrop, DataTransfer** aResult);
|
||||
nsresult Clone(nsISupports* aParent, EventMessage aEventMessage,
|
||||
bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
|
||||
DataTransfer** aResult);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -254,14 +254,15 @@ protected:
|
|||
|
||||
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
|
||||
uint32_t mDropEffect;
|
||||
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
|
||||
bool mCursorState;
|
||||
|
||||
|
|
|
@ -716,12 +716,12 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
// nsPresShell::HandleEventInternal() for details.
|
||||
if (EventStateManager::IsHandlingUserInput()) {
|
||||
switch(aEvent->mMessage) {
|
||||
case NS_FORM_SELECTED :
|
||||
case eFormSelect:
|
||||
if (PopupAllowedForEvent("select")) {
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
case NS_FORM_CHANGE :
|
||||
case eFormChange:
|
||||
if (PopupAllowedForEvent("change")) {
|
||||
abuse = openControlled;
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
// nsPresShell::HandleEventInternal() for details.
|
||||
if (EventStateManager::IsHandlingUserInput()) {
|
||||
switch(aEvent->mMessage) {
|
||||
case NS_FORM_CHANGE :
|
||||
case eFormChange:
|
||||
if (PopupAllowedForEvent("change")) {
|
||||
abuse = openControlled;
|
||||
}
|
||||
|
@ -853,12 +853,12 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
// nsPresShell::HandleEventInternal() for details.
|
||||
if (EventStateManager::IsHandlingUserInput()) {
|
||||
switch(aEvent->mMessage) {
|
||||
case NS_FORM_SUBMIT :
|
||||
case eFormSubmit:
|
||||
if (PopupAllowedForEvent("submit")) {
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
case NS_FORM_RESET :
|
||||
case eFormReset:
|
||||
if (PopupAllowedForEvent("reset")) {
|
||||
abuse = openControlled;
|
||||
}
|
||||
|
|
|
@ -1339,8 +1339,8 @@ EventListenerManager::HasUnloadListeners()
|
|||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Listener* listener = &mListeners.ElementAt(i);
|
||||
if (listener->mEventMessage == NS_PAGE_UNLOAD ||
|
||||
listener->mEventMessage == NS_BEFORE_PAGE_UNLOAD) {
|
||||
if (listener->mEventMessage == eUnload ||
|
||||
listener->mEventMessage == eBeforeUnload) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
#endif /* BEFOREUNLOAD_EVENT */
|
||||
|
||||
EVENT(abort,
|
||||
NS_IMAGE_ABORT,
|
||||
eImageAbort,
|
||||
EventNameType_All,
|
||||
eBasicEventClass)
|
||||
EVENT(canplay,
|
||||
|
@ -161,7 +161,7 @@ EVENT(canplaythrough,
|
|||
EventNameType_HTML,
|
||||
eBasicEventClass)
|
||||
EVENT(change,
|
||||
NS_FORM_CHANGE,
|
||||
eFormChange,
|
||||
EventNameType_HTMLXUL,
|
||||
eBasicEventClass)
|
||||
EVENT(click,
|
||||
|
@ -179,31 +179,31 @@ EVENT(dblclick,
|
|||
EventNameType_HTMLXUL,
|
||||
eMouseEventClass)
|
||||
EVENT(drag,
|
||||
NS_DRAGDROP_DRAG,
|
||||
eDrag,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragend,
|
||||
NS_DRAGDROP_END,
|
||||
eDragEnd,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragenter,
|
||||
NS_DRAGDROP_ENTER,
|
||||
eDragEnter,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragleave,
|
||||
NS_DRAGDROP_LEAVE,
|
||||
eDragLeave,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragover,
|
||||
NS_DRAGDROP_OVER,
|
||||
eDragOver,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragstart,
|
||||
NS_DRAGDROP_START,
|
||||
eDragStart,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(drop,
|
||||
NS_DRAGDROP_DROP,
|
||||
eDrop,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(durationchange,
|
||||
|
@ -223,7 +223,7 @@ EVENT(input,
|
|||
EventNameType_HTMLXUL,
|
||||
eEditorInputEventClass)
|
||||
EVENT(invalid,
|
||||
NS_FORM_INVALID,
|
||||
eFormInvalid,
|
||||
EventNameType_HTMLXUL,
|
||||
eBasicEventClass)
|
||||
EVENT(keydown,
|
||||
|
@ -374,7 +374,7 @@ EVENT(ratechange,
|
|||
EventNameType_HTML,
|
||||
eBasicEventClass)
|
||||
EVENT(reset,
|
||||
NS_FORM_RESET,
|
||||
eFormReset,
|
||||
EventNameType_HTMLXUL,
|
||||
eBasicEventClass)
|
||||
EVENT(seeked,
|
||||
|
@ -386,7 +386,7 @@ EVENT(seeking,
|
|||
EventNameType_HTML,
|
||||
eBasicEventClass)
|
||||
EVENT(select,
|
||||
NS_FORM_SELECTED,
|
||||
eFormSelect,
|
||||
EventNameType_HTMLXUL,
|
||||
eBasicEventClass)
|
||||
EVENT(show,
|
||||
|
@ -398,7 +398,7 @@ EVENT(stalled,
|
|||
EventNameType_HTML,
|
||||
eBasicEventClass)
|
||||
EVENT(submit,
|
||||
NS_FORM_SUBMIT,
|
||||
eFormSubmit,
|
||||
EventNameType_HTMLXUL,
|
||||
eBasicEventClass)
|
||||
EVENT(suspend,
|
||||
|
@ -444,19 +444,19 @@ EVENT(afterscriptexecute,
|
|||
eBasicEventClass)
|
||||
|
||||
FORWARDED_EVENT(blur,
|
||||
NS_BLUR_CONTENT,
|
||||
eBlur,
|
||||
EventNameType_HTMLXUL,
|
||||
eFocusEventClass)
|
||||
ERROR_EVENT(error,
|
||||
NS_LOAD_ERROR,
|
||||
eLoadError,
|
||||
EventNameType_All,
|
||||
eBasicEventClass)
|
||||
FORWARDED_EVENT(focus,
|
||||
NS_FOCUS_CONTENT,
|
||||
eFocus,
|
||||
EventNameType_HTMLXUL,
|
||||
eFocusEventClass)
|
||||
FORWARDED_EVENT(load,
|
||||
NS_LOAD,
|
||||
eLoad,
|
||||
EventNameType_All,
|
||||
eBasicEventClass)
|
||||
FORWARDED_EVENT(resize,
|
||||
|
@ -477,11 +477,11 @@ WINDOW_EVENT(beforeprint,
|
|||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
BEFOREUNLOAD_EVENT(beforeunload,
|
||||
NS_BEFORE_PAGE_UNLOAD,
|
||||
eBeforeUnload,
|
||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
WINDOW_EVENT(hashchange,
|
||||
NS_HASHCHANGE,
|
||||
eHashChange,
|
||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
WINDOW_EVENT(languagechange,
|
||||
|
@ -512,7 +512,7 @@ WINDOW_EVENT(pageshow,
|
|||
EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
WINDOW_EVENT(popstate,
|
||||
NS_POPSTATE,
|
||||
ePopState,
|
||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
// Not supported yet
|
||||
|
@ -522,7 +522,7 @@ WINDOW_EVENT(popstate,
|
|||
// Not supported yet
|
||||
// WINDOW_EVENT(undo)
|
||||
WINDOW_EVENT(unload,
|
||||
NS_PAGE_UNLOAD,
|
||||
eUnload,
|
||||
(EventNameType_XUL | EventNameType_SVGSVG |
|
||||
EventNameType_HTMLBodyOrFramesetOnly),
|
||||
eBasicEventClass)
|
||||
|
@ -581,7 +581,7 @@ TOUCH_EVENT(touchcancel,
|
|||
eTouchEventClass)
|
||||
|
||||
DOCUMENT_ONLY_EVENT(readystatechange,
|
||||
NS_READYSTATECHANGE,
|
||||
eReadyStateChange,
|
||||
EventNameType_HTMLXUL,
|
||||
eBasicEventClass)
|
||||
|
||||
|
@ -620,15 +620,15 @@ NON_IDL_EVENT(DOMSubtreeModified,
|
|||
eMutationEventClass)
|
||||
|
||||
NON_IDL_EVENT(DOMActivate,
|
||||
NS_UI_ACTIVATE,
|
||||
eLegacyDOMActivate,
|
||||
EventNameType_HTMLXUL,
|
||||
eUIEventClass)
|
||||
NON_IDL_EVENT(DOMFocusIn,
|
||||
NS_UI_FOCUSIN,
|
||||
eLegacyDOMFocusIn,
|
||||
EventNameType_HTMLXUL,
|
||||
eUIEventClass)
|
||||
NON_IDL_EVENT(DOMFocusOut,
|
||||
NS_UI_FOCUSOUT,
|
||||
eLegacyDOMFocusOut,
|
||||
EventNameType_HTMLXUL,
|
||||
eUIEventClass)
|
||||
|
||||
|
@ -720,15 +720,15 @@ NON_IDL_EVENT(commandupdate,
|
|||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(dragexit,
|
||||
NS_DRAGDROP_EXIT,
|
||||
eDragExit,
|
||||
EventNameType_XUL,
|
||||
eDragEventClass)
|
||||
NON_IDL_EVENT(dragdrop,
|
||||
NS_DRAGDROP_DRAGDROP,
|
||||
eLegacyDragDrop,
|
||||
EventNameType_XUL,
|
||||
eDragEventClass)
|
||||
NON_IDL_EVENT(draggesture,
|
||||
NS_DRAGDROP_GESTURE,
|
||||
eLegacyDragGesture,
|
||||
EventNameType_XUL,
|
||||
eDragEventClass)
|
||||
NON_IDL_EVENT(overflow,
|
||||
|
|
|
@ -646,16 +646,16 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
FlushPendingEvents(aPresContext);
|
||||
break;
|
||||
}
|
||||
case NS_DRAGDROP_GESTURE:
|
||||
case eLegacyDragGesture:
|
||||
if (Prefs::ClickHoldContextMenu()) {
|
||||
// an external drag gesture event came in, not generated internally
|
||||
// by Gecko. Make sure we get rid of the click-hold timer.
|
||||
KillClickHoldTimer();
|
||||
}
|
||||
break;
|
||||
case NS_DRAGDROP_OVER:
|
||||
// NS_DRAGDROP_DROP is fired before NS_DRAGDROP_DRAGDROP so send
|
||||
// the enter/exit events before NS_DRAGDROP_DROP.
|
||||
case eDragOver:
|
||||
// eDrop is fired before eLegacyDragDrop so send the enter/exit events
|
||||
// before eDrop.
|
||||
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
|
||||
break;
|
||||
|
||||
|
@ -1193,9 +1193,9 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
|
|||
}
|
||||
case eDragEventClass:
|
||||
switch (aEvent.mMessage) {
|
||||
case NS_DRAGDROP_OVER:
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case NS_DRAGDROP_DROP:
|
||||
case eDragOver:
|
||||
case eDragExit:
|
||||
case eDrop:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
@ -1637,7 +1637,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
return;
|
||||
|
||||
nsRefPtr<DataTransfer> dataTransfer =
|
||||
new DataTransfer(window, NS_DRAGDROP_START, false, -1);
|
||||
new DataTransfer(window, eDragStart, false, -1);
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsCOMPtr<nsIContent> eventContent, targetContent;
|
||||
|
@ -1663,11 +1663,11 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
|
||||
// get the widget from the target frame
|
||||
WidgetDragEvent startEvent(aEvent->mFlags.mIsTrusted,
|
||||
NS_DRAGDROP_START, widget);
|
||||
eDragStart, widget);
|
||||
FillInEventFromGestureDown(&startEvent);
|
||||
|
||||
WidgetDragEvent gestureEvent(aEvent->mFlags.mIsTrusted,
|
||||
NS_DRAGDROP_GESTURE, widget);
|
||||
eLegacyDragGesture, widget);
|
||||
FillInEventFromGestureDown(&gestureEvent);
|
||||
|
||||
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
|
||||
// send it to
|
||||
|
||||
|
@ -3171,8 +3171,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_ENTER:
|
||||
case NS_DRAGDROP_OVER:
|
||||
case eDragEnter:
|
||||
case eDragOver:
|
||||
{
|
||||
NS_ASSERTION(aEvent->mClass == eDragEventClass, "Expected a drag event");
|
||||
|
||||
|
@ -3261,13 +3261,13 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
|
||||
// For now, do this only for dragover.
|
||||
//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
|
||||
// content or chrome.
|
||||
dragSession->SetOnlyChromeDrop(
|
||||
!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.
|
||||
dragSession->SetOnlyChromeDrop(true);
|
||||
}
|
||||
|
@ -3286,7 +3286,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_DROP:
|
||||
case eDrop:
|
||||
{
|
||||
// now fire the dragdrop event, for compatibility with XUL
|
||||
if (mCurrentTarget && nsEventStatus_eConsumeNoDefault != *aStatus) {
|
||||
|
@ -3296,7 +3296,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
|
||||
nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
|
||||
WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
|
||||
NS_DRAGDROP_DRAGDROP, widget);
|
||||
eLegacyDragDrop, widget);
|
||||
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
event.refPoint = mouseEvent->refPoint;
|
||||
|
@ -3319,9 +3319,9 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
ClearGlobalActiveContent(this);
|
||||
break;
|
||||
}
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case eDragExit:
|
||||
// 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());
|
||||
break;
|
||||
|
||||
|
@ -4299,7 +4299,7 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||
|
||||
switch(aDragEvent->mMessage) {
|
||||
case NS_DRAGDROP_OVER:
|
||||
case eDragOver:
|
||||
{
|
||||
// when dragging from one frame to another, events are fired in the
|
||||
// order: dragexit, dragenter, dragleave
|
||||
|
@ -4316,16 +4316,16 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
getter_AddRefs(lastContent));
|
||||
|
||||
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
||||
aDragEvent, NS_DRAGDROP_EXIT,
|
||||
aDragEvent, eDragExit,
|
||||
targetContent, lastContent, sLastDragOverFrame);
|
||||
}
|
||||
|
||||
FireDragEnterOrExit(aPresContext, aDragEvent, NS_DRAGDROP_ENTER,
|
||||
FireDragEnterOrExit(aPresContext, aDragEvent, eDragEnter,
|
||||
lastContent, targetContent, mCurrentTarget);
|
||||
|
||||
if (sLastDragOverFrame) {
|
||||
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
||||
aDragEvent, NS_DRAGDROP_LEAVE,
|
||||
aDragEvent, eDragLeave,
|
||||
targetContent, lastContent, sLastDragOverFrame);
|
||||
}
|
||||
|
||||
|
@ -4334,7 +4334,7 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case eDragExit:
|
||||
{
|
||||
//This is actually the window mouse exit event.
|
||||
if (sLastDragOverFrame) {
|
||||
|
@ -4344,10 +4344,10 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
|
||||
nsRefPtr<nsPresContext> lastDragOverFramePresContext = sLastDragOverFrame->PresContext();
|
||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||
aDragEvent, NS_DRAGDROP_EXIT,
|
||||
aDragEvent, eDragExit,
|
||||
nullptr, lastContent, sLastDragOverFrame);
|
||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||
aDragEvent, NS_DRAGDROP_LEAVE,
|
||||
aDragEvent, eDragLeave,
|
||||
nullptr, lastContent, sLastDragOverFrame);
|
||||
|
||||
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
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
aMessage == NS_DRAGDROP_EXIT) {
|
||||
SetContentState((aMessage == NS_DRAGDROP_ENTER) ?
|
||||
aTargetContent : nullptr,
|
||||
if (status == nsEventStatus_eConsumeNoDefault || aMessage == eDragExit) {
|
||||
SetContentState((aMessage == eDragEnter) ? aTargetContent : nullptr,
|
||||
NS_EVENT_STATE_DRAGOVER);
|
||||
}
|
||||
|
||||
// collect any changes to moz cursor settings stored in the event's
|
||||
// data transfer.
|
||||
if (aMessage == NS_DRAGDROP_LEAVE || aMessage == NS_DRAGDROP_EXIT ||
|
||||
aMessage == NS_DRAGDROP_ENTER) {
|
||||
if (aMessage == eDragLeave || aMessage == eDragExit ||
|
||||
aMessage == eDragEnter) {
|
||||
UpdateDragDataTransfer(&event);
|
||||
}
|
||||
}
|
||||
|
@ -4610,8 +4608,7 @@ already_AddRefed<nsIContent>
|
|||
EventStateManager::GetEventTargetContent(WidgetEvent* aEvent)
|
||||
{
|
||||
if (aEvent &&
|
||||
(aEvent->mMessage == NS_FOCUS_CONTENT ||
|
||||
aEvent->mMessage == NS_BLUR_CONTENT)) {
|
||||
(aEvent->mMessage == eFocus || aEvent->mMessage == eBlur)) {
|
||||
nsCOMPtr<nsIContent> content = GetFocusedContent();
|
||||
return content.forget();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ FocusEvent::FocusEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
InternalFocusEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalFocusEvent(false, NS_FOCUS_CONTENT))
|
||||
aEvent ? aEvent : new InternalFocusEvent(false, eFocus))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -185,7 +185,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
|||
}
|
||||
return;
|
||||
case eMouseMove:
|
||||
case NS_DRAGDROP_OVER: {
|
||||
case eDragOver: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsReal()) {
|
||||
// If the cursor is moving to be outside the frame,
|
||||
|
@ -215,7 +215,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
|||
case eMouseDoubleClick:
|
||||
case eMouseClick:
|
||||
case eContextMenu:
|
||||
case NS_DRAGDROP_DROP:
|
||||
case eDrop:
|
||||
EndTransaction();
|
||||
return;
|
||||
default:
|
||||
|
|
|
@ -222,7 +222,7 @@ HTMLButtonElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
bool outerActivateEvent =
|
||||
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||
(aVisitor.mEvent->mMessage == NS_UI_ACTIVATE &&
|
||||
(aVisitor.mEvent->mMessage == eLegacyDOMActivate &&
|
||||
!mInInternalActivate));
|
||||
|
||||
if (outerActivateEvent) {
|
||||
|
@ -252,7 +252,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
if (mouseEvent && mouseEvent->IsLeftClickEvent()) {
|
||||
// DOMActive event should be trusted since the activation is actually
|
||||
// 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;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||
|
@ -370,7 +370,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
|
||||
mType == NS_FORM_BUTTON_RESET)) {
|
||||
InternalFormEvent event(true,
|
||||
(mType == NS_FORM_BUTTON_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
|
||||
(mType == NS_FORM_BUTTON_RESET) ? eFormReset : eFormSubmit);
|
||||
event.originator = this;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
|
@ -382,7 +382,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
//
|
||||
// Using presShell to dispatch the event. It makes sure that
|
||||
// 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) ||
|
||||
// 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.
|
||||
|
|
|
@ -256,7 +256,7 @@ HTMLFormElement::Submit(ErrorResult& aRv)
|
|||
mPendingSubmission = nullptr;
|
||||
}
|
||||
|
||||
aRv = DoSubmitOrReset(nullptr, NS_FORM_SUBMIT);
|
||||
aRv = DoSubmitOrReset(nullptr, eFormSubmit);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -270,7 +270,7 @@ HTMLFormElement::Submit()
|
|||
NS_IMETHODIMP
|
||||
HTMLFormElement::Reset()
|
||||
{
|
||||
InternalFormEvent event(true, NS_FORM_RESET);
|
||||
InternalFormEvent event(true, eFormReset);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr, &event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ HTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
aVisitor.mWantsWillHandleEvent = true;
|
||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||
uint32_t msg = aVisitor.mEvent->mMessage;
|
||||
if (msg == NS_FORM_SUBMIT) {
|
||||
if (msg == eFormSubmit) {
|
||||
if (mGeneratingSubmit) {
|
||||
aVisitor.mCanHandle = false;
|
||||
return NS_OK;
|
||||
|
@ -504,8 +504,7 @@ HTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// that means that if there are scripted submissions, the
|
||||
// latest one will be deferred until after the exit point of the handler.
|
||||
mDeferSubmission = true;
|
||||
}
|
||||
else if (msg == NS_FORM_RESET) {
|
||||
} else if (msg == eFormReset) {
|
||||
if (mGeneratingReset) {
|
||||
aVisitor.mCanHandle = false;
|
||||
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
|
||||
// received a submit event we do *not* want to handle the submit event
|
||||
// for this form too.
|
||||
if ((aVisitor.mEvent->mMessage == NS_FORM_SUBMIT ||
|
||||
aVisitor.mEvent->mMessage == NS_FORM_RESET) &&
|
||||
if ((aVisitor.mEvent->mMessage == eFormSubmit ||
|
||||
aVisitor.mEvent->mMessage == eFormReset) &&
|
||||
aVisitor.mEvent->mFlags.mInBubblingPhase &&
|
||||
aVisitor.mEvent->originalTarget != static_cast<nsIContent*>(this)) {
|
||||
aVisitor.mEvent->mFlags.mPropagationStopped = true;
|
||||
|
@ -536,17 +535,16 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
{
|
||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||
if (msg == NS_FORM_SUBMIT) {
|
||||
if (msg == eFormSubmit) {
|
||||
// let the form know not to defer subsequent submissions
|
||||
mDeferSubmission = false;
|
||||
}
|
||||
|
||||
if (aVisitor.mEventStatus == nsEventStatus_eIgnore) {
|
||||
switch (msg) {
|
||||
case NS_FORM_RESET:
|
||||
case NS_FORM_SUBMIT:
|
||||
{
|
||||
if (mPendingSubmission && msg == NS_FORM_SUBMIT) {
|
||||
case eFormReset:
|
||||
case eFormSubmit: {
|
||||
if (mPendingSubmission && msg == eFormSubmit) {
|
||||
// tell the form to forget a possible pending submission.
|
||||
// the reason is that the script returned true (the event was
|
||||
// ignored) so if there is a stored submission, it will miss
|
||||
|
@ -561,7 +559,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
if (msg == NS_FORM_SUBMIT) {
|
||||
if (msg == eFormSubmit) {
|
||||
// tell the form to flush a possible pending submission.
|
||||
// the reason is that the script returned false (the event was
|
||||
// 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;
|
||||
}
|
||||
else if (msg == NS_FORM_RESET) {
|
||||
} else if (msg == eFormReset) {
|
||||
mGeneratingReset = false;
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +579,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
|
||||
nsresult
|
||||
HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
|
||||
int32_t aMessage)
|
||||
EventMessage aMessage)
|
||||
{
|
||||
// Make sure the presentation is up-to-date
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
|
@ -593,11 +590,11 @@ HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
|
|||
// JBK Don't get form frames anymore - bug 34297
|
||||
|
||||
// Submit or Reset the form
|
||||
if (NS_FORM_RESET == aMessage) {
|
||||
if (eFormReset == aMessage) {
|
||||
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
|
||||
// a sandboxed frame and form submit is disabled.
|
||||
if (!doc || (doc->GetSandboxFlags() & SANDBOXED_FORMS)) {
|
||||
|
|
|
@ -452,7 +452,7 @@ protected:
|
|||
};
|
||||
|
||||
nsresult DoSubmitOrReset(WidgetEvent* aEvent,
|
||||
int32_t aMessage);
|
||||
EventMessage aMessage);
|
||||
nsresult DoReset();
|
||||
|
||||
// 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
|
||||
// Hold strong ref across the event
|
||||
nsRefPtr<mozilla::dom::HTMLFormElement> form = mForm;
|
||||
InternalFormEvent event(true, NS_FORM_SUBMIT);
|
||||
InternalFormEvent event(true, eFormSubmit);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
shell->HandleDOMEventWithTarget(mForm, &event, &status);
|
||||
}
|
||||
|
@ -2987,7 +2987,7 @@ HTMLInputElement::DispatchSelectEvent(nsPresContext* aPresContext)
|
|||
|
||||
// If already handling select event, don't dispatch a second.
|
||||
if (!mHandlingSelectEvent) {
|
||||
WidgetEvent event(nsContentUtils::IsCallerChrome(), NS_FORM_SELECTED);
|
||||
WidgetEvent event(nsContentUtils::IsCallerChrome(), eFormSelect);
|
||||
|
||||
mHandlingSelectEvent = true;
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
|
@ -3087,7 +3087,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
bool outerActivateEvent =
|
||||
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||
(aVisitor.mEvent->mMessage == NS_UI_ACTIVATE && !mInInternalActivate));
|
||||
(aVisitor.mEvent->mMessage == eLegacyDOMActivate && !mInInternalActivate));
|
||||
|
||||
if (outerActivateEvent) {
|
||||
aVisitor.mItemFlags |= NS_OUTER_ACTIVATE_EVENT;
|
||||
|
@ -3162,7 +3162,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
aVisitor.mItemFlags |= mType;
|
||||
|
||||
// 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
|
||||
// set invalid values but we have to be extra-careful. Especially if the
|
||||
// option has been enabled on desktop.
|
||||
|
@ -3177,8 +3177,8 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
}
|
||||
|
||||
if (mType == NS_FORM_INPUT_RANGE &&
|
||||
(aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT)) {
|
||||
(aVisitor.mEvent->mMessage == eFocus ||
|
||||
aVisitor.mEvent->mMessage == eBlur)) {
|
||||
// Just as nsGenericHTMLFormElementWithState::PreHandleEvent calls
|
||||
// nsIFormControlFrame::SetFocus, we handle focus here.
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
|
@ -3231,9 +3231,9 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
StopNumberControlSpinnerSpin();
|
||||
}
|
||||
}
|
||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
|
||||
if (aVisitor.mEvent->mMessage == eFocus ||
|
||||
aVisitor.mEvent->mMessage == eBlur) {
|
||||
if (aVisitor.mEvent->mMessage == eFocus) {
|
||||
// Tell our frame it's getting focus so that it can make sure focus
|
||||
// is moved to our anonymous text control.
|
||||
nsNumberControlFrame* numberControlFrame =
|
||||
|
@ -3299,7 +3299,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
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
|
||||
// anonymous text control since we fire our own 'change' events and
|
||||
// content shouldn't be seeing two 'change' events. Besides that we
|
||||
|
@ -3587,15 +3587,15 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
return MaybeInitPickers(aVisitor);
|
||||
}
|
||||
|
||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT &&
|
||||
if (aVisitor.mEvent->mMessage == eFocus ||
|
||||
aVisitor.mEvent->mMessage == eBlur) {
|
||||
if (aVisitor.mEvent->mMessage == eFocus &&
|
||||
MayFireChangeOnBlur() &&
|
||||
!mIsDraggingRange) { // StartRangeThumbDrag already set mFocusedValue
|
||||
GetValue(mFocusedValue);
|
||||
}
|
||||
|
||||
if (aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
||||
if (aVisitor.mEvent->mMessage == eBlur) {
|
||||
if (mIsDraggingRange) {
|
||||
FinishRangeThumbDrag();
|
||||
} 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);
|
||||
}
|
||||
|
@ -3630,7 +3630,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
|
||||
// DOMActive event should be trusted since the activation is actually
|
||||
// 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;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||
|
@ -3745,9 +3745,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
}
|
||||
} else if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
|
||||
switch (aVisitor.mEvent->mMessage) {
|
||||
|
||||
case NS_FOCUS_CONTENT:
|
||||
{
|
||||
case eFocus: {
|
||||
// see if we should select the contents of the textbox. This happens
|
||||
// for text and password fields when the field was focused by the
|
||||
// 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:
|
||||
if (mForm) {
|
||||
InternalFormEvent event(true,
|
||||
(mType == NS_FORM_INPUT_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
|
||||
(mType == NS_FORM_INPUT_RESET) ? eFormReset : eFormSubmit);
|
||||
event.originator = this;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
|
@ -4027,7 +4025,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
// pres shell. See bug 125624.
|
||||
// TODO: removing this code and have the submit event sent by the
|
||||
// form, see bug 592124.
|
||||
if (presShell && (event.mMessage != NS_FORM_SUBMIT ||
|
||||
if (presShell && (event.mMessage != eFormSubmit ||
|
||||
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
||||
// 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.
|
||||
|
|
|
@ -216,11 +216,11 @@ HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement,
|
|||
return;
|
||||
}
|
||||
switch (aEvent->mMessage) {
|
||||
case NS_FOCUS_CONTENT: {
|
||||
case eFocus: {
|
||||
OnFocusBlurPlugin(aElement, true);
|
||||
break;
|
||||
}
|
||||
case NS_BLUR_CONTENT: {
|
||||
case eBlur: {
|
||||
OnFocusBlurPlugin(aElement, false);
|
||||
break;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ HTMLObjectElement::UnbindFromTree(bool aDeep,
|
|||
{
|
||||
#ifdef XP_MACOSX
|
||||
// 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
|
||||
// still contains a focused plugin when it doesn't -- which in turn can
|
||||
// disable text input in the browser window. See bug 1137229.
|
||||
|
|
|
@ -1511,7 +1511,7 @@ HTMLSelectElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
nsresult
|
||||
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
|
||||
// update the invalid/valid UI.
|
||||
mCanShowInvalidUI = !IsValid() && ShouldShowValidityUI();
|
||||
|
@ -1522,7 +1522,7 @@ HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
|
||||
// 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.
|
||||
} else if (aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
||||
} else if (aVisitor.mEvent->mMessage == eBlur) {
|
||||
mCanShowInvalidUI = true;
|
||||
mCanShowValidUI = true;
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ HTMLSharedObjectElement::UnbindFromTree(bool aDeep,
|
|||
{
|
||||
#ifdef XP_MACOSX
|
||||
// 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
|
||||
// still contains a focused plugin when it doesn't -- which in turn can
|
||||
// disable text input in the browser window. See bug 1137229.
|
||||
|
|
|
@ -137,7 +137,7 @@ HTMLTextAreaElement::Select()
|
|||
}
|
||||
|
||||
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?
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event, nullptr, &status);
|
||||
|
@ -486,7 +486,7 @@ HTMLTextAreaElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
|
||||
// Don't dispatch a second select event if we are already handling
|
||||
// one.
|
||||
if (aVisitor.mEvent->mMessage == NS_FORM_SELECTED) {
|
||||
if (aVisitor.mEvent->mMessage == eFormSelect) {
|
||||
if (mHandlingSelect) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ HTMLTextAreaElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
}
|
||||
|
||||
// Fire onchange (if necessary), before we do the blur, bug 370521.
|
||||
if (aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
||||
if (aVisitor.mEvent->mMessage == eBlur) {
|
||||
FireChangeEventIfNeeded();
|
||||
}
|
||||
|
||||
|
@ -534,13 +534,13 @@ HTMLTextAreaElement::FireChangeEventIfNeeded()
|
|||
nsresult
|
||||
HTMLTextAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->mMessage == NS_FORM_SELECTED) {
|
||||
if (aVisitor.mEvent->mMessage == eFormSelect) {
|
||||
mHandlingSelect = false;
|
||||
}
|
||||
|
||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
|
||||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
|
||||
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
|
||||
if (aVisitor.mEvent->mMessage == eFocus ||
|
||||
aVisitor.mEvent->mMessage == eBlur) {
|
||||
if (aVisitor.mEvent->mMessage == eFocus) {
|
||||
// If the invalid UI is shown, we should show it while focusing (and
|
||||
// update). Otherwise, we should not.
|
||||
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
|
||||
// UI while typing.
|
||||
mCanShowValidUI = ShouldShowValidityUI();
|
||||
} else { // NS_BLUR_CONTENT
|
||||
} else { // eBlur
|
||||
mCanShowInvalidUI = true;
|
||||
mCanShowValidUI = true;
|
||||
}
|
||||
|
|
|
@ -2251,8 +2251,7 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
{
|
||||
if (aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
switch (aVisitor.mEvent->mMessage) {
|
||||
case NS_FOCUS_CONTENT:
|
||||
{
|
||||
case eFocus: {
|
||||
// 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
|
||||
// this parent file control -- leave focus on the child.
|
||||
|
@ -2262,8 +2261,7 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
formControlFrame->SetFocus(true, true);
|
||||
break;
|
||||
}
|
||||
case NS_BLUR_CONTENT:
|
||||
{
|
||||
case eBlur: {
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
if (formControlFrame)
|
||||
formControlFrame->SetFocus(false, false);
|
||||
|
|
|
@ -819,7 +819,7 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection*
|
|||
if (presShell)
|
||||
{
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetEvent event(true, NS_FORM_SELECTED);
|
||||
WidgetEvent event(true, eFormSelect);
|
||||
|
||||
presShell->HandleEventWithTarget(&event, mFrame, content, &status);
|
||||
}
|
||||
|
|
|
@ -187,6 +187,7 @@ class IDBDatabase::LogWarningRunnable final
|
|||
nsCString mMessageName;
|
||||
nsString mFilename;
|
||||
uint32_t mLineNumber;
|
||||
uint32_t mColumnNumber;
|
||||
uint64_t mInnerWindowID;
|
||||
bool mIsChrome;
|
||||
|
||||
|
@ -194,11 +195,13 @@ public:
|
|||
LogWarningRunnable(const char* aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
: mMessageName(aMessageName)
|
||||
, mFilename(aFilename)
|
||||
, mLineNumber(aLineNumber)
|
||||
, mColumnNumber(aColumnNumber)
|
||||
, mInnerWindowID(aInnerWindowID)
|
||||
, mIsChrome(aIsChrome)
|
||||
{
|
||||
|
@ -209,6 +212,7 @@ public:
|
|||
LogWarning(const char* aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID);
|
||||
|
||||
|
@ -959,10 +963,10 @@ IDBDatabase::AbortTransactions(bool aShouldWarn)
|
|||
MOZ_ASSERT(transaction);
|
||||
|
||||
nsString filename;
|
||||
uint32_t lineNo;
|
||||
transaction->GetCallerLocation(filename, &lineNo);
|
||||
uint32_t lineNo, column;
|
||||
transaction->GetCallerLocation(filename, &lineNo, &column);
|
||||
|
||||
aDatabase->LogWarning(kWarningMessage, filename, lineNo);
|
||||
aDatabase->LogWarning(kWarningMessage, filename, lineNo, column);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1337,7 +1341,8 @@ IDBDatabase::Invalidate()
|
|||
void
|
||||
IDBDatabase::LogWarning(const char* aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber)
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aMessageName);
|
||||
|
@ -1346,6 +1351,7 @@ IDBDatabase::LogWarning(const char* aMessageName,
|
|||
LogWarningRunnable::LogWarning(aMessageName,
|
||||
aFilename,
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
mFactory->IsChrome(),
|
||||
mFactory->InnerWindowID());
|
||||
} else {
|
||||
|
@ -1353,6 +1359,7 @@ IDBDatabase::LogWarning(const char* aMessageName,
|
|||
new LogWarningRunnable(aMessageName,
|
||||
aFilename,
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
mFactory->IsChrome(),
|
||||
mFactory->InnerWindowID());
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
|
||||
|
@ -1628,6 +1635,7 @@ IDBDatabase::
|
|||
LogWarningRunnable::LogWarning(const char* aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
{
|
||||
|
@ -1664,7 +1672,7 @@ LogWarningRunnable::LogWarning(const char* aMessageName,
|
|||
aFilename,
|
||||
/* aSourceLine */ EmptyString(),
|
||||
aLineNumber,
|
||||
/* aColumnNumber */ 0,
|
||||
aColumnNumber,
|
||||
nsIScriptError::warningFlag,
|
||||
category,
|
||||
aInnerWindowID)));
|
||||
|
@ -1674,7 +1682,7 @@ LogWarningRunnable::LogWarning(const char* aMessageName,
|
|||
aFilename,
|
||||
/* aSourceLine */ EmptyString(),
|
||||
aLineNumber,
|
||||
/* aColumnNumber */ 0,
|
||||
aColumnNumber,
|
||||
nsIScriptError::warningFlag,
|
||||
category.get())));
|
||||
}
|
||||
|
@ -1693,6 +1701,7 @@ LogWarningRunnable::Run()
|
|||
LogWarning(mMessageName.get(),
|
||||
mFilename,
|
||||
mLineNumber,
|
||||
mColumnNumber,
|
||||
mIsChrome,
|
||||
mInnerWindowID);
|
||||
|
||||
|
|
|
@ -313,7 +313,8 @@ private:
|
|||
void
|
||||
LogWarning(const char* aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber);
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber);
|
||||
};
|
||||
|
||||
} // namespace indexedDB
|
||||
|
|
|
@ -92,6 +92,7 @@ IDBRequest::InitMembers()
|
|||
mLoggingSerialNumber = NextSerialNumber();
|
||||
mErrorCode = NS_OK;
|
||||
mLineNo = 0;
|
||||
mColumn = 0;
|
||||
mHaveResultOrErrorCode = false;
|
||||
}
|
||||
|
||||
|
@ -104,7 +105,7 @@ IDBRequest::Create(IDBDatabase* aDatabase,
|
|||
aDatabase->AssertIsOnOwningThread();
|
||||
|
||||
nsRefPtr<IDBRequest> request = new IDBRequest(aDatabase);
|
||||
CaptureCaller(request->mFilename, &request->mLineNo);
|
||||
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
|
||||
|
||||
request->mTransaction = aTransaction;
|
||||
request->SetScriptOwner(aDatabase->GetScriptOwner());
|
||||
|
@ -168,13 +169,15 @@ IDBRequest::SetLoggingSerialNumber(uint64_t aLoggingSerialNumber)
|
|||
}
|
||||
|
||||
void
|
||||
IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo)
|
||||
IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo,
|
||||
uint32_t* aColumn)
|
||||
{
|
||||
MOZ_ASSERT(aFilename.IsEmpty());
|
||||
MOZ_ASSERT(aLineNo);
|
||||
MOZ_ASSERT(aColumn);
|
||||
|
||||
ThreadsafeAutoJSContext cx;
|
||||
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo);
|
||||
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo, aColumn);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -271,13 +274,16 @@ IDBRequest::GetErrorAfterResult() const
|
|||
#endif // DEBUG
|
||||
|
||||
void
|
||||
IDBRequest::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const
|
||||
IDBRequest::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
|
||||
uint32_t* aColumn) const
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aLineNo);
|
||||
MOZ_ASSERT(aColumn);
|
||||
|
||||
aFilename = mFilename;
|
||||
*aLineNo = mLineNo;
|
||||
*aColumn = mColumn;
|
||||
}
|
||||
|
||||
IDBRequestReadyState
|
||||
|
@ -516,7 +522,7 @@ IDBOpenDBRequest::CreateForWindow(IDBFactory* aFactory,
|
|||
MOZ_ASSERT(aScriptOwner);
|
||||
|
||||
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, aOwner);
|
||||
CaptureCaller(request->mFilename, &request->mLineNo);
|
||||
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
|
||||
|
||||
request->SetScriptOwner(aScriptOwner);
|
||||
|
||||
|
@ -533,7 +539,7 @@ IDBOpenDBRequest::CreateForJS(IDBFactory* aFactory,
|
|||
MOZ_ASSERT(aScriptOwner);
|
||||
|
||||
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, nullptr);
|
||||
CaptureCaller(request->mFilename, &request->mLineNo);
|
||||
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
|
||||
|
||||
request->SetScriptOwner(aScriptOwner);
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
|||
uint64_t mLoggingSerialNumber;
|
||||
nsresult mErrorCode;
|
||||
uint32_t mLineNo;
|
||||
uint32_t mColumn;
|
||||
bool mHaveResultOrErrorCode;
|
||||
|
||||
public:
|
||||
|
@ -82,7 +83,7 @@ public:
|
|||
IDBTransaction* aTransaction);
|
||||
|
||||
static void
|
||||
CaptureCaller(nsAString& aFilename, uint32_t* aLineNo);
|
||||
CaptureCaller(nsAString& aFilename, uint32_t* aLineNo, uint32_t* aColumn);
|
||||
|
||||
static uint64_t
|
||||
NextSerialNumber();
|
||||
|
@ -130,7 +131,8 @@ public:
|
|||
GetError(ErrorResult& aRv);
|
||||
|
||||
void
|
||||
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const;
|
||||
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
|
||||
uint32_t* aColumn) const;
|
||||
|
||||
bool
|
||||
IsPending() const
|
||||
|
|
|
@ -82,6 +82,7 @@ IDBTransaction::IDBTransaction(IDBDatabase* aDatabase,
|
|||
, mAbortCode(NS_OK)
|
||||
, mPendingRequestCount(0)
|
||||
, mLineNo(0)
|
||||
, mColumn(0)
|
||||
, mReadyState(IDBTransaction::INITIAL)
|
||||
, mMode(aMode)
|
||||
, mCreating(false)
|
||||
|
@ -186,7 +187,7 @@ IDBTransaction::CreateVersionChange(
|
|||
emptyObjectStoreNames,
|
||||
VERSION_CHANGE);
|
||||
aOpenRequest->GetCallerLocation(transaction->mFilename,
|
||||
&transaction->mLineNo);
|
||||
&transaction->mLineNo, &transaction->mColumn);
|
||||
|
||||
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
|
||||
|
||||
|
@ -219,7 +220,8 @@ IDBTransaction::Create(IDBDatabase* aDatabase,
|
|||
|
||||
nsRefPtr<IDBTransaction> transaction =
|
||||
new IDBTransaction(aDatabase, aObjectStoreNames, aMode);
|
||||
IDBRequest::CaptureCaller(transaction->mFilename, &transaction->mLineNo);
|
||||
IDBRequest::CaptureCaller(transaction->mFilename, &transaction->mLineNo,
|
||||
&transaction->mColumn);
|
||||
|
||||
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
|
||||
|
||||
|
@ -492,13 +494,16 @@ IDBTransaction::IsOpen() const
|
|||
}
|
||||
|
||||
void
|
||||
IDBTransaction::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const
|
||||
IDBTransaction::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
|
||||
uint32_t* aColumn) const
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aLineNo);
|
||||
MOZ_ASSERT(aColumn);
|
||||
|
||||
aFilename = mFilename;
|
||||
*aLineNo = mLineNo;
|
||||
*aColumn = mColumn;
|
||||
}
|
||||
|
||||
already_AddRefed<IDBObjectStore>
|
||||
|
|
|
@ -100,6 +100,7 @@ private:
|
|||
|
||||
nsString mFilename;
|
||||
uint32_t mLineNo;
|
||||
uint32_t mColumn;
|
||||
|
||||
ReadyState mReadyState;
|
||||
Mode mMode;
|
||||
|
@ -205,7 +206,8 @@ public:
|
|||
}
|
||||
|
||||
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
|
||||
Mode
|
||||
|
|
|
@ -480,7 +480,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
|
|||
|
||||
ThreadsafeAutoJSContext cx;
|
||||
RootedDictionary<ErrorEventInit> init(cx);
|
||||
request->GetCallerLocation(init.mFilename, &init.mLineno);
|
||||
request->GetCallerLocation(init.mFilename, &init.mLineno, &init.mColno);
|
||||
|
||||
init.mMessage = errorName;
|
||||
init.mCancelable = true;
|
||||
|
@ -556,7 +556,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
|
|||
init.mFilename,
|
||||
/* aSourceLine */ EmptyString(),
|
||||
init.mLineno,
|
||||
/* aColumnNumber */ 0,
|
||||
init.mColno,
|
||||
nsIScriptError::errorFlag,
|
||||
category,
|
||||
innerWindowID)));
|
||||
|
@ -566,7 +566,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
|
|||
init.mFilename,
|
||||
/* aSourceLine */ EmptyString(),
|
||||
init.mLineno,
|
||||
/* aColumnNumber */ 0,
|
||||
init.mColno,
|
||||
nsIScriptError::errorFlag,
|
||||
category.get())));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ interface nsIJSRAIIHelper;
|
|||
interface nsIContentPermissionRequest;
|
||||
interface nsIObserver;
|
||||
|
||||
[scriptable, uuid(6ddc9a79-18cd-4dbc-9975-68928e6c9857)]
|
||||
[scriptable, uuid(a30a95ac-3b95-4251-88dc-8efa89ba9f9c)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
|
@ -106,15 +106,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
*/
|
||||
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.
|
||||
* See nsContentUtils::GetViewportInfo for more information.
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using namespace mozilla::jsipc;
|
||||
|
@ -21,8 +20,7 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(ContentBridgeChild,
|
||||
nsIContentChild,
|
||||
nsIObserver)
|
||||
nsIContentChild)
|
||||
|
||||
ContentBridgeChild::ContentBridgeChild(Transport* aTransport)
|
||||
: mTransport(aTransport)
|
||||
|
@ -36,10 +34,6 @@ ContentBridgeChild::~ContentBridgeChild()
|
|||
void
|
||||
ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
os->RemoveObserver(this, "content-child-shutdown");
|
||||
}
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy));
|
||||
|
@ -55,11 +49,6 @@ ContentBridgeChild::Create(Transport* aTransport, ProcessId aOtherPid)
|
|||
DebugOnly<bool> ok = bridge->Open(aTransport, aOtherPid, XRE_GetIOMessageLoop());
|
||||
MOZ_ASSERT(ok);
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
os->AddObserver(bridge, "content-child-shutdown", false);
|
||||
}
|
||||
|
||||
return bridge;
|
||||
}
|
||||
|
||||
|
@ -180,16 +169,5 @@ ContentBridgeChild::DeallocPBlobChild(PBlobChild* 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 mozilla
|
||||
|
|
|
@ -9,20 +9,17 @@
|
|||
|
||||
#include "mozilla/dom/PContentBridgeChild.h"
|
||||
#include "mozilla/dom/nsIContentChild.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class ContentBridgeChild final : public PContentBridgeChild
|
||||
, public nsIContentChild
|
||||
, public nsIObserver
|
||||
{
|
||||
public:
|
||||
explicit ContentBridgeChild(Transport* aTransport);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
static ContentBridgeChild*
|
||||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||
|
|
|
@ -163,6 +163,17 @@ ContentBridgeParent::DeallocPBrowserParent(PBrowserParent* 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
|
||||
// move it to nsIContentParent because it calls ManagedPJavaScriptParent() which
|
||||
// only exists in PContentParent and PContentBridgeParent.
|
||||
|
|
|
@ -28,6 +28,8 @@ public:
|
|||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
void DeferredDestroy();
|
||||
virtual bool IsContentBridgeParent() override { return true; }
|
||||
void NotifyTabDestroyed();
|
||||
|
||||
static ContentBridgeParent*
|
||||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||
|
|
|
@ -2809,7 +2809,7 @@ ContentChild::RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
|
|||
if (session) {
|
||||
session->SetDragAction(aAction);
|
||||
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) {
|
||||
auto& items = aTransfers[i].items();
|
||||
for (uint32_t j = 0; j < items.Length(); ++j) {
|
||||
|
|
|
@ -1468,7 +1468,9 @@ ContentParent::Init()
|
|||
}
|
||||
Preferences::AddStrongObserver(this, "");
|
||||
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
|
||||
|
@ -1843,11 +1845,12 @@ ContentParent::OnBeginSyncTransaction() {
|
|||
if (!sDisableUnsafeCPOWWarnings) {
|
||||
if (console && cx) {
|
||||
nsAutoString filename;
|
||||
uint32_t lineno = 0;
|
||||
nsJSUtils::GetCallingLocation(cx, filename, &lineno);
|
||||
uint32_t lineno = 0, column = 0;
|
||||
nsJSUtils::GetCallingLocation(cx, filename, &lineno, &column);
|
||||
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||
error->Init(NS_LITERAL_STRING("unsafe CPOW usage"), filename, EmptyString(),
|
||||
lineno, 0, nsIScriptError::warningFlag, "chrome javascript");
|
||||
error->Init(NS_LITERAL_STRING("unsafe CPOW usage"), filename,
|
||||
EmptyString(), lineno, column,
|
||||
nsIScriptError::warningFlag, "chrome javascript");
|
||||
console->LogMessage(error);
|
||||
} else {
|
||||
NS_WARNING("Unsafe synchronous IPC message");
|
||||
|
@ -2057,7 +2060,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
}
|
||||
#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.
|
||||
|
@ -2085,10 +2090,35 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
// least until after the current task finishes running.
|
||||
NS_DispatchToCurrentThread(new DelayedDeleteContentParentTask(this));
|
||||
|
||||
// Destroy any processes created by this ContentParent
|
||||
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
|
||||
// Release the appId's reference count of any processes
|
||||
// created by this ContentParent and the frame opened by this ContentParent
|
||||
// if this ContentParent crashes.
|
||||
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||
nsTArray<ContentParentId> childIDArray =
|
||||
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++) {
|
||||
ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]);
|
||||
MessageLoop::current()->PostTask(
|
||||
|
@ -2104,23 +2134,33 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
}
|
||||
|
||||
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
|
||||
// because of popup windows. PBrowsers can also destroy
|
||||
// concurrently. When all the PBrowsers are destroying, kick off
|
||||
// another task to ensure the child process *really* shuts down,
|
||||
// even if the PBrowsers themselves never finish destroying.
|
||||
int32_t numLiveTabs = ManagedPBrowserParent().Length();
|
||||
++mNumDestroyingTabs;
|
||||
if (mNumDestroyingTabs != numLiveTabs) {
|
||||
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||
ContentParent* cp = cpm->GetContentProcessById(aCpId);
|
||||
if (!cp) {
|
||||
return;
|
||||
}
|
||||
++cp->mNumDestroyingTabs;
|
||||
nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(aCpId);
|
||||
if (static_cast<size_t>(cp->mNumDestroyingTabs) != tabIds.Length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We're dying now, so prevent this content process from being
|
||||
// recycled during its shutdown procedure.
|
||||
MarkAsDead();
|
||||
StartForceKillTimer();
|
||||
cp->MarkAsDead();
|
||||
cp->StartForceKillTimer();
|
||||
} else {
|
||||
ContentChild::GetSingleton()->SendNotifyTabDestroying(aTabId, aCpId);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2142,16 +2182,15 @@ ContentParent::StartForceKillTimer()
|
|||
}
|
||||
|
||||
void
|
||||
ContentParent::NotifyTabDestroyed(PBrowserParent* aTab,
|
||||
ContentParent::NotifyTabDestroyed(const TabId& aTabId,
|
||||
bool aNotifiedDestroying)
|
||||
{
|
||||
if (aNotifiedDestroying) {
|
||||
--mNumDestroyingTabs;
|
||||
}
|
||||
|
||||
TabId id = static_cast<TabParent*>(aTab)->GetTabId();
|
||||
nsTArray<PContentPermissionRequestParent*> parentArray =
|
||||
nsContentPermissionUtils::GetContentPermissionRequestParentById(id);
|
||||
nsContentPermissionUtils::GetContentPermissionRequestParentById(aTabId);
|
||||
|
||||
// Need to close undeleted ContentPermissionRequestParents before tab is closed.
|
||||
for (auto& permissionRequestParent : parentArray) {
|
||||
|
@ -2164,7 +2203,9 @@ ContentParent::NotifyTabDestroyed(PBrowserParent* aTab,
|
|||
// There can be more than one PBrowser for a given app process
|
||||
// because of popup windows. When the last one closes, shut
|
||||
// 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
|
||||
// allow it to perform shutdown tasks.
|
||||
MessageLoop::current()->PostTask(
|
||||
|
@ -4899,8 +4940,12 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
|
|||
{
|
||||
TabId tabId;
|
||||
if (XRE_IsParentProcess()) {
|
||||
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
|
||||
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||
tabId = cpm->AllocateTabId(aOpenerTabId, aContext, aCpId);
|
||||
// Add appId's reference count in oop case
|
||||
if (tabId) {
|
||||
PermissionManagerAddref(aCpId, tabId);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ContentChild::GetSingleton()->SendAllocateTabId(aOpenerTabId,
|
||||
|
@ -4913,14 +4958,27 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
|
|||
|
||||
/*static*/ void
|
||||
ContentParent::DeallocateTabId(const TabId& aTabId,
|
||||
const ContentParentId& aCpId)
|
||||
const ContentParentId& aCpId,
|
||||
bool aMarkedDestroying)
|
||||
{
|
||||
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,
|
||||
aTabId);
|
||||
}
|
||||
else {
|
||||
ContentChild::GetSingleton()->SendDeallocateTabId(aTabId);
|
||||
ContentChild::GetSingleton()->SendDeallocateTabId(aTabId,
|
||||
aCpId,
|
||||
aMarkedDestroying);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4938,9 +4996,19 @@ ContentParent::RecvAllocateTabId(const TabId& aOpenerTabId,
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -5044,9 +5112,9 @@ ContentParent::MaybeInvokeDragSession(TabParent* aParent)
|
|||
session->GetDataTransfer(getter_AddRefs(domTransfer));
|
||||
nsCOMPtr<DataTransfer> transfer = do_QueryInterface(domTransfer);
|
||||
if (!transfer) {
|
||||
// Pass NS_DRAGDROP_DROP to get DataTransfer with external
|
||||
// Pass eDrop to get DataTransfer with external
|
||||
// drag formats cached.
|
||||
transfer = new DataTransfer(nullptr, NS_DRAGDROP_DROP, true, -1);
|
||||
transfer = new DataTransfer(nullptr, eDrop, true, -1);
|
||||
session->SetDataTransfer(transfer);
|
||||
}
|
||||
// Note, even though this fills the DataTransfer object with
|
||||
|
@ -5111,6 +5179,38 @@ ContentParent::DeallocPContentPermissionRequestParent(PContentPermissionRequestP
|
|||
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
|
||||
ContentParent::RecvGetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration* aConfig)
|
||||
{
|
||||
|
|
|
@ -212,9 +212,10 @@ public:
|
|||
virtual bool KillChild() override;
|
||||
|
||||
/** 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. */
|
||||
void NotifyTabDestroyed(PBrowserParent* aTab,
|
||||
void NotifyTabDestroyed(const TabId& aTabId,
|
||||
bool aNotifiedDestroying);
|
||||
|
||||
TestShellParent* CreateTestShell();
|
||||
|
@ -227,7 +228,21 @@ public:
|
|||
const IPCTabContext& aContext,
|
||||
const ContentParentId& aCpId);
|
||||
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
|
||||
GetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration& aConfig);
|
||||
|
@ -356,7 +371,12 @@ public:
|
|||
const ContentParentId& aCpId,
|
||||
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();
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/ClearOnShutdown.h"
|
||||
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
// XXX need another bug to move this to a common header.
|
||||
#ifdef DISABLE_ASSERTS_FOR_FUZZING
|
||||
|
@ -334,5 +335,40 @@ ContentProcessManager::GetTopLevelTabParentByProcessAndTabId(const ContentParent
|
|||
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 mozilla
|
||||
|
|
|
@ -110,6 +110,13 @@ public:
|
|||
const TabId& aChildTabId,
|
||||
/*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.
|
||||
* Return nullptr when TabParent couldn't be found via aChildCpId
|
||||
|
@ -135,6 +142,15 @@ public:
|
|||
GetTopLevelTabParentByProcessAndTabId(const ContentParentId& aChildCpId,
|
||||
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:
|
||||
static StaticAutoPtr<ContentProcessManager> sSingleton;
|
||||
TabId mUniqueId;
|
||||
|
|
|
@ -991,8 +991,15 @@ parent:
|
|||
*/
|
||||
sync AllocateTabId(TabId openerTabId, IPCTabContext context, ContentParentId cpId)
|
||||
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.
|
||||
* @param manifestURI
|
||||
|
|
|
@ -2183,19 +2183,19 @@ TabChild::RecvRealDragEvent(const WidgetDragEvent& aEvent,
|
|||
}
|
||||
}
|
||||
|
||||
if (aEvent.mMessage == NS_DRAGDROP_DROP) {
|
||||
if (aEvent.mMessage == eDrop) {
|
||||
bool canDrop = true;
|
||||
if (!dragSession || NS_FAILED(dragSession->GetCanDrop(&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 =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
if (dragService) {
|
||||
// This will dispatch 'drag' event at the source if the
|
||||
// drag transaction started in this process.
|
||||
dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
||||
dragService->FireDragEventAtSource(eDrag);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -436,12 +436,8 @@ TabParent::IsVisible()
|
|||
}
|
||||
|
||||
void
|
||||
TabParent::Destroy()
|
||||
TabParent::DestroyInternal()
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
IMEStateManager::OnTabParentDestroying(this);
|
||||
|
||||
RemoveWindowListeners();
|
||||
|
@ -455,11 +451,6 @@ TabParent::Destroy()
|
|||
RemoveTabParentFromTable(frame->GetLayersId());
|
||||
frame->Destroy();
|
||||
}
|
||||
mIsDestroyed = true;
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
Manager()->AsContentParent()->NotifyTabDestroying(this);
|
||||
}
|
||||
|
||||
// Let all PluginWidgets know we are tearing down. Prevents
|
||||
// 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) {
|
||||
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;
|
||||
}
|
||||
|
@ -476,12 +485,15 @@ bool
|
|||
TabParent::Recv__delete__()
|
||||
{
|
||||
if (XRE_IsParentProcess()) {
|
||||
Manager()->AsContentParent()->NotifyTabDestroyed(this, mMarkedDestroying);
|
||||
ContentParent::DeallocateTabId(mTabId,
|
||||
Manager()->AsContentParent()->ChildID());
|
||||
Manager()->AsContentParent()->ChildID(),
|
||||
mMarkedDestroying);
|
||||
}
|
||||
else {
|
||||
ContentParent::DeallocateTabId(mTabId, ContentParentId(0));
|
||||
Manager()->AsContentBridgeParent()->NotifyTabDestroyed();
|
||||
ContentParent::DeallocateTabId(mTabId,
|
||||
Manager()->ChildID(),
|
||||
mMarkedDestroying);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -494,6 +506,22 @@ TabParent::ActorDestroy(ActorDestroyReason why)
|
|||
// case of a crash.
|
||||
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);
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (frameLoader) {
|
||||
|
|
|
@ -491,6 +491,7 @@ protected:
|
|||
LayoutDeviceIntPoint mChromeOffset;
|
||||
|
||||
private:
|
||||
void DestroyInternal();
|
||||
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
|
||||
nsRefPtr<nsIContentParent> mManager;
|
||||
void TryCacheDPIAndScale();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/ContentBridgeParent.h"
|
||||
#include "mozilla/dom/PTabContext.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/StructuredCloneUtils.h"
|
||||
|
@ -46,6 +47,13 @@ nsIContentParent::AsContentParent()
|
|||
return static_cast<ContentParent*>(this);
|
||||
}
|
||||
|
||||
ContentBridgeParent*
|
||||
nsIContentParent::AsContentBridgeParent()
|
||||
{
|
||||
MOZ_ASSERT(IsContentBridgeParent());
|
||||
return static_cast<ContentBridgeParent*>(this);
|
||||
}
|
||||
|
||||
PJavaScriptParent*
|
||||
nsIContentParent::AllocPJavaScriptParent()
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ class BlobConstructorParams;
|
|||
class BlobImpl;
|
||||
class BlobParent;
|
||||
class ContentParent;
|
||||
class ContentBridgeParent;
|
||||
class IPCTabContext;
|
||||
class PBlobParent;
|
||||
class PBrowserParent;
|
||||
|
@ -77,6 +78,8 @@ public:
|
|||
|
||||
virtual bool IsContentParent() { return false; }
|
||||
ContentParent* AsContentParent();
|
||||
virtual bool IsContentBridgeParent() { return false; }
|
||||
ContentBridgeParent* AsContentBridgeParent();
|
||||
|
||||
protected: // methods
|
||||
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
|
||||
[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.
|
||||
[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>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче