зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team a=merge
This commit is contained in:
Коммит
1c8090ed35
|
@ -123,23 +123,38 @@ static const GInterfaceInfo atk_if_infos[] = {
|
|||
(GInterfaceFinalizeFunc) nullptr, nullptr}
|
||||
};
|
||||
|
||||
/**
|
||||
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
|
||||
*/
|
||||
struct MaiAtkObject
|
||||
{
|
||||
AtkObject parent;
|
||||
/*
|
||||
* The AccessibleWrap whose properties and features are exported
|
||||
* via this object instance.
|
||||
*/
|
||||
uintptr_t accWrap;
|
||||
};
|
||||
|
||||
// This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
|
||||
// proxy.
|
||||
static const uintptr_t IS_PROXY = 1;
|
||||
|
||||
static GQuark quark_mai_hyperlink = 0;
|
||||
|
||||
AtkHyperlink*
|
||||
MaiAtkObject::GetAtkHyperlink()
|
||||
{
|
||||
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
|
||||
MaiHyperlink* maiHyperlink =
|
||||
(MaiHyperlink*)g_object_get_qdata(G_OBJECT(this), quark_mai_hyperlink);
|
||||
if (!maiHyperlink) {
|
||||
maiHyperlink = new MaiHyperlink(reinterpret_cast<Accessible*>(accWrap));
|
||||
g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, maiHyperlink);
|
||||
}
|
||||
|
||||
return maiHyperlink->GetAtkHyperlink();
|
||||
}
|
||||
|
||||
void
|
||||
MaiAtkObject::Shutdown()
|
||||
{
|
||||
accWrap = 0;
|
||||
MaiHyperlink* maiHyperlink =
|
||||
(MaiHyperlink*)g_object_get_qdata(G_OBJECT(this), quark_mai_hyperlink);
|
||||
if (maiHyperlink) {
|
||||
delete maiHyperlink;
|
||||
g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
struct MaiAtkObjectClass
|
||||
{
|
||||
AtkObjectClass parent_class;
|
||||
|
@ -208,8 +223,6 @@ static const char * GetUniqueMaiAtkTypeName(uint16_t interfacesBits);
|
|||
|
||||
static gpointer parent_class = nullptr;
|
||||
|
||||
static GQuark quark_mai_hyperlink = 0;
|
||||
|
||||
GType
|
||||
mai_atk_object_get_type(void)
|
||||
{
|
||||
|
@ -250,14 +263,15 @@ AccessibleWrap::~AccessibleWrap()
|
|||
void
|
||||
AccessibleWrap::ShutdownAtkObject()
|
||||
{
|
||||
if (mAtkObject) {
|
||||
if (IS_MAI_OBJECT(mAtkObject)) {
|
||||
MAI_ATK_OBJECT(mAtkObject)->accWrap = 0;
|
||||
}
|
||||
SetMaiHyperlink(nullptr);
|
||||
g_object_unref(mAtkObject);
|
||||
mAtkObject = nullptr;
|
||||
}
|
||||
if (!mAtkObject)
|
||||
return;
|
||||
|
||||
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "wrong type of atk object");
|
||||
if (IS_MAI_OBJECT(mAtkObject))
|
||||
MAI_ATK_OBJECT(mAtkObject)->Shutdown();
|
||||
|
||||
g_object_unref(mAtkObject);
|
||||
mAtkObject = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -267,42 +281,6 @@ AccessibleWrap::Shutdown()
|
|||
Accessible::Shutdown();
|
||||
}
|
||||
|
||||
MaiHyperlink*
|
||||
AccessibleWrap::GetMaiHyperlink(bool aCreate /* = true */)
|
||||
{
|
||||
// make sure mAtkObject is created
|
||||
GetAtkObject();
|
||||
|
||||
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
|
||||
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
|
||||
MaiHyperlink* maiHyperlink = nullptr;
|
||||
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
|
||||
maiHyperlink = (MaiHyperlink*)g_object_get_qdata(G_OBJECT(mAtkObject),
|
||||
quark_mai_hyperlink);
|
||||
if (!maiHyperlink && aCreate) {
|
||||
maiHyperlink = new MaiHyperlink(this);
|
||||
SetMaiHyperlink(maiHyperlink);
|
||||
}
|
||||
}
|
||||
return maiHyperlink;
|
||||
}
|
||||
|
||||
void
|
||||
AccessibleWrap::SetMaiHyperlink(MaiHyperlink* aMaiHyperlink)
|
||||
{
|
||||
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
|
||||
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
|
||||
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
|
||||
MaiHyperlink* maiHyperlink = GetMaiHyperlink(false);
|
||||
if (!maiHyperlink && !aMaiHyperlink) {
|
||||
return; // Never set and we're shutting down
|
||||
}
|
||||
delete maiHyperlink;
|
||||
g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
|
||||
aMaiHyperlink);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AccessibleWrap::GetNativeInterface(void** aOutAccessible)
|
||||
{
|
||||
|
@ -1093,7 +1071,7 @@ void
|
|||
a11y::ProxyDestroyed(ProxyAccessible* aProxy)
|
||||
{
|
||||
auto obj = reinterpret_cast<MaiAtkObject*>(aProxy->GetWrapper() & ~IS_PROXY);
|
||||
obj->accWrap = 0;
|
||||
obj->Shutdown();
|
||||
g_object_unref(obj);
|
||||
aProxy->SetWrapper(0);
|
||||
}
|
||||
|
|
|
@ -63,10 +63,6 @@ public:
|
|||
|
||||
bool IsValidObject();
|
||||
|
||||
// get/set the MaiHyperlink object for this AccessibleWrap
|
||||
MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
|
||||
void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
|
||||
|
||||
static const char * ReturnString(nsAString &aString) {
|
||||
static nsCString returnedString;
|
||||
returnedString = NS_ConvertUTF16toUTF8(aString);
|
||||
|
|
|
@ -51,4 +51,27 @@ IsAtkVersionAtLeast(int aMajor, int aMinor)
|
|||
(aMajor == atkMajorVersion && aMinor <= atkMinorVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
|
||||
*/
|
||||
struct MaiAtkObject
|
||||
{
|
||||
AtkObject parent;
|
||||
/*
|
||||
* The AccessibleWrap whose properties and features are exported
|
||||
* via this object instance.
|
||||
*/
|
||||
uintptr_t accWrap;
|
||||
|
||||
/*
|
||||
* Get the AtkHyperlink for this atk object.
|
||||
*/
|
||||
AtkHyperlink* GetAtkHyperlink();
|
||||
|
||||
/*
|
||||
* Shutdown this AtkObject.
|
||||
*/
|
||||
void Shutdown();
|
||||
};
|
||||
|
||||
#endif /* __NS_MAI_H__ */
|
||||
|
|
|
@ -94,56 +94,28 @@ MaiHyperlink::MaiHyperlink(Accessible* aHyperLink) :
|
|||
mHyperlink(aHyperLink),
|
||||
mMaiAtkHyperlink(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
MaiHyperlink::~MaiHyperlink()
|
||||
{
|
||||
if (mMaiAtkHyperlink) {
|
||||
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
|
||||
g_object_unref(mMaiAtkHyperlink);
|
||||
}
|
||||
}
|
||||
|
||||
AtkHyperlink*
|
||||
MaiHyperlink::GetAtkHyperlink(void)
|
||||
{
|
||||
NS_ENSURE_TRUE(mHyperlink, nullptr);
|
||||
|
||||
if (mMaiAtkHyperlink)
|
||||
return mMaiAtkHyperlink;
|
||||
|
||||
if (!mHyperlink->IsLink())
|
||||
return nullptr;
|
||||
return;
|
||||
|
||||
mMaiAtkHyperlink =
|
||||
reinterpret_cast<AtkHyperlink *>
|
||||
(g_object_new(mai_atk_hyperlink_get_type(), nullptr));
|
||||
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
|
||||
NS_ENSURE_TRUE(mMaiAtkHyperlink, nullptr);
|
||||
if (!mMaiAtkHyperlink)
|
||||
return;
|
||||
|
||||
/* be sure to initialize it with "this" */
|
||||
MaiHyperlink::Initialize(mMaiAtkHyperlink, this);
|
||||
|
||||
return mMaiAtkHyperlink;
|
||||
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = this;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
||||
/* remember to call this static function when a MaiAtkHyperlink
|
||||
* is created
|
||||
*/
|
||||
|
||||
nsresult
|
||||
MaiHyperlink::Initialize(AtkHyperlink *aObj, MaiHyperlink *aHyperlink)
|
||||
MaiHyperlink::~MaiHyperlink()
|
||||
{
|
||||
NS_ENSURE_ARG(MAI_IS_ATK_HYPERLINK(aObj));
|
||||
NS_ENSURE_ARG(aHyperlink);
|
||||
|
||||
/* initialize hyperlink */
|
||||
MAI_ATK_HYPERLINK(aObj)->maiHyperlink = aHyperlink;
|
||||
return NS_OK;
|
||||
if (mMaiAtkHyperlink) {
|
||||
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
|
||||
g_object_unref(mMaiAtkHyperlink);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* static functions for ATK callbacks */
|
||||
|
||||
void
|
||||
|
|
|
@ -27,15 +27,13 @@ public:
|
|||
~MaiHyperlink();
|
||||
|
||||
public:
|
||||
AtkHyperlink *GetAtkHyperlink(void);
|
||||
AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; }
|
||||
Accessible* GetAccHyperlink()
|
||||
{ return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; }
|
||||
|
||||
protected:
|
||||
Accessible* mHyperlink;
|
||||
AtkHyperlink* mMaiAtkHyperlink;
|
||||
public:
|
||||
static nsresult Initialize(AtkHyperlink *aObj, MaiHyperlink *aClass);
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -21,9 +21,7 @@ getHyperlinkCB(AtkHyperlinkImpl* aImpl)
|
|||
|
||||
NS_ENSURE_TRUE(accWrap->IsLink(), nullptr);
|
||||
|
||||
MaiHyperlink* maiHyperlink = accWrap->GetMaiHyperlink();
|
||||
NS_ENSURE_TRUE(maiHyperlink, nullptr);
|
||||
return maiHyperlink->GetAtkHyperlink();
|
||||
return MAI_ATK_OBJECT(aImpl)->GetAtkHyperlink();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,9 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
|
|||
}
|
||||
|
||||
AtkObject* hyperLinkAtkObj = AccessibleWrap::GetAtkObject(hyperLink);
|
||||
AccessibleWrap* accChild = GetAccessibleWrap(hyperLinkAtkObj);
|
||||
NS_ENSURE_TRUE(accChild, nullptr);
|
||||
NS_ENSURE_TRUE(IS_MAI_OBJECT(hyperLinkAtkObj), nullptr);
|
||||
|
||||
MaiHyperlink* maiHyperlink = accChild->GetMaiHyperlink();
|
||||
NS_ENSURE_TRUE(maiHyperlink, nullptr);
|
||||
return maiHyperlink->GetAtkHyperlink();
|
||||
return MAI_ATK_OBJECT(hyperLinkAtkObj)->GetAtkHyperlink();
|
||||
}
|
||||
|
||||
if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
|
|
|
@ -300,7 +300,7 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
|
|||
return;
|
||||
|
||||
nsPoint point =
|
||||
aPoint.ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
ToAppUnits(aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
|
||||
nsPoint deltaPoint(point.x - frameRect.x, point.y - frameRect.y);
|
||||
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
struct nsRoleMapEntry;
|
||||
|
||||
struct nsRect;
|
||||
class nsIFrame;
|
||||
class nsIAtom;
|
||||
struct nsIntRect;
|
||||
class nsIPersistentProperties;
|
||||
class nsView;
|
||||
|
||||
|
|
|
@ -1040,7 +1040,7 @@ HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType)
|
|||
|
||||
nsPresContext* presContext = mDoc->PresContext();
|
||||
nsPoint coordsInAppUnits =
|
||||
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
|
||||
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
|
||||
|
||||
nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits();
|
||||
if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y))
|
||||
|
@ -1568,7 +1568,7 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
|
|||
|
||||
nsPresContext* presContext = frame->PresContext();
|
||||
nsPoint coordsInAppUnits =
|
||||
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
|
||||
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
|
||||
|
||||
bool initialScrolled = false;
|
||||
nsIFrame *parentFrame = frame;
|
||||
|
|
|
@ -8,9 +8,9 @@ include protocol PContent;
|
|||
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using struct nsIntPoint from "nsRect.h";
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
using nsIntRect from "nsRect.h";
|
||||
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
|
||||
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
@ -135,7 +135,7 @@ child:
|
|||
prio(high) sync PasteText(uint64_t aID, int32_t aPosition)
|
||||
returns(bool aValid);
|
||||
|
||||
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal);
|
||||
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal);
|
||||
prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal);
|
||||
|
||||
prio(high) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -134,8 +134,8 @@
|
|||
<project name="platform/hardware/akm" path="hardware/akm" revision="6d3be412647b0eab0adff8a2768736cf4eb68039"/>
|
||||
<project groups="invensense" name="platform/hardware/invensense" path="hardware/invensense" revision="e6d9ab28b4f4e7684f6c07874ee819c9ea0002a2"/>
|
||||
<project name="platform/hardware/ril" path="hardware/ril" revision="865ce3b4a2ba0b3a31421ca671f4d6c5595f8690"/>
|
||||
<project name="kernel/common" path="kernel" revision="df636d2c31ad4434a7de2565359ad982b3767118"/>
|
||||
<project name="platform/system/core" path="system/core" revision="3747764c63d23de586c56e1cef6dca2cdd90b2ea"/>
|
||||
<project name="kernel/common" path="kernel" revision="65d2a18bd4ab0f1ed36a76c1e3c4f9ae98f345b9"/>
|
||||
<project name="platform/system/core" path="system/core" revision="7992618bd4ee33ce96897675a5c0a9b619122f13"/>
|
||||
<project name="u-boot" path="u-boot" revision="f1502910977ac88f43da7bf9277c3523ad4b0b2f"/>
|
||||
<project name="vendor/sprd/gps" path="vendor/sprd/gps" revision="4c59900937dc2e978b7b14b7f1ea617e3d5d550e"/>
|
||||
<project name="vendor/sprd/open-source" path="vendor/sprd/open-source" revision="e503b1d14d7fdee532b8f391407299da193c1b2d"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9a9797062c6001d6346504161c51187a2968466b"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -135,7 +135,7 @@
|
|||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c5f8d282efe4a4e8b1e31a37300944e338e60e4f"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="eb8b8828c412bf8d164ad42a39766becd39f9fb5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
|
||||
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
|
||||
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
|
||||
</manifest>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="6b0721ca0e92788df30daf8f7a5fb2863544f9c8">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9a9797062c6001d6346504161c51187a2968466b"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -146,7 +146,7 @@
|
|||
<project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/>
|
||||
<project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/>
|
||||
<project name="platform/system/core" path="system/core" revision="42839aedcf70bf6bc92a3b7ea4a5cc9bf9aef3f9"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="eb8b8828c412bf8d164ad42a39766becd39f9fb5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
|
||||
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
|
||||
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/>
|
||||
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4c187c1f3a0dffd8e51a961735474ea703535b99"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -145,7 +145,7 @@
|
|||
<project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/>
|
||||
<project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/>
|
||||
<project name="platform/system/core" path="system/core" revision="adc485d8755af6a61641d197de7cfef667722580"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="eb8b8828c412bf8d164ad42a39766becd39f9fb5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
|
||||
<project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/>
|
||||
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/>
|
||||
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "0645bbed4d6cbd8064652eebafe011edc3e417fd",
|
||||
"git_revision": "15134b080b5f406e5aa36f5136c17dafb4e31f64",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "b8a031b1d0d2dfe6dc33194ec18b25c6f0cd625a",
|
||||
"revision": "457b84a122653f399cb817513b5149c4c087afe9",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -130,7 +130,7 @@
|
|||
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
|
||||
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="eb8b8828c412bf8d164ad42a39766becd39f9fb5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
|
||||
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="6b0721ca0e92788df30daf8f7a5fb2863544f9c8">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0645bbed4d6cbd8064652eebafe011edc3e417fd"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="15134b080b5f406e5aa36f5136c17dafb4e31f64"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f4c86a6371082db0be8087b17a31bb79d35fb1d1"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
@ -156,5 +156,5 @@
|
|||
<project name="platform/hardware/qcom/sensors" path="hardware/qcom/sensors" revision="fde83fdf67e9b919f8a49008725bd595221bf33f"/>
|
||||
<project name="platform/hardware/qcom/wlan" path="hardware/qcom/wlan" revision="6417804bea95f6e46094a01a06025a86e28c5b0d"/>
|
||||
<project name="platform/hardware/ril" path="hardware/ril" revision="e00d716e7e3d31729f75399855b6921e90cb0b66"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="eb8b8828c412bf8d164ad42a39766becd39f9fb5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="d82e00fb6380b4f6cea7a96213913ee9eb441239"/>
|
||||
</manifest>
|
||||
|
|
|
@ -298,11 +298,6 @@ MY_RULES := $(DEPTH)/config/myrules.mk
|
|||
#
|
||||
CCC = $(CXX)
|
||||
|
||||
# Java macros
|
||||
JAVA_GEN_DIR = _javagen
|
||||
JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
|
||||
JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
|
||||
|
||||
INCLUDES = \
|
||||
-I$(srcdir) \
|
||||
-I. \
|
||||
|
|
|
@ -14,9 +14,9 @@ interface nsIPrintSettings;
|
|||
|
||||
%{ C++
|
||||
#include "nsTArray.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIWidget;
|
||||
struct nsIntRect;
|
||||
class nsIPresShell;
|
||||
class nsPresContext;
|
||||
class nsView;
|
||||
|
|
|
@ -22,7 +22,7 @@ interface nsIStructuredCloneContainer;
|
|||
interface nsIBFCacheEntry;
|
||||
|
||||
%{C++
|
||||
struct nsIntRect;
|
||||
#include "nsRect.h"
|
||||
class nsDocShellEditorData;
|
||||
class nsSHEntryShared;
|
||||
%}
|
||||
|
|
|
@ -15,6 +15,6 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE
|
|||
[test_parent_navigation_by_location.html]
|
||||
[test_sibling_navigation_by_location.html]
|
||||
[test_top_navigation_by_location_exotic.html]
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || android_version == '18' #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt
|
||||
[test_top_navigation_by_location.html]
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || android_version == '18' #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt
|
||||
|
|
|
@ -3922,6 +3922,42 @@ nsIDocument::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks)
|
|||
mFrameRequestCallbacks.Clear();
|
||||
}
|
||||
|
||||
bool
|
||||
nsIDocument::ShouldThrottleFrameRequests()
|
||||
{
|
||||
if (!mIsShowing) {
|
||||
// We're not showing (probably in a background tab or the bf cache).
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mPresShell) {
|
||||
return false; // Can't do anything smarter.
|
||||
}
|
||||
|
||||
nsIFrame* frame = mPresShell->GetRootFrame();
|
||||
if (!frame) {
|
||||
return false; // Can't do anything smarter.
|
||||
}
|
||||
|
||||
nsIFrame* displayRootFrame = nsLayoutUtils::GetDisplayRootFrame(frame);
|
||||
if (!displayRootFrame) {
|
||||
return false; // Can't do anything smarter.
|
||||
}
|
||||
|
||||
if (!displayRootFrame->DidPaintPresShell(mPresShell)) {
|
||||
// We didn't get painted during the last paint, so we're not visible.
|
||||
// Throttle. Note that because we have to paint this document at least
|
||||
// once to unthrottle it, we will drop one requestAnimationFrame frame
|
||||
// when a document that previously wasn't visible scrolls into view. This
|
||||
// is acceptable since it would happen outside the viewport on APZ
|
||||
// platforms and is unlikely to be human-perceivable on non-APZ platforms.
|
||||
return true;
|
||||
}
|
||||
|
||||
// We got painted during the last paint, so run at full speed.
|
||||
return false;
|
||||
}
|
||||
|
||||
PLDHashOperator RequestDiscardEnumerator(imgIRequest* aKey,
|
||||
uint32_t aData,
|
||||
void* userArg)
|
||||
|
|
|
@ -2104,6 +2104,13 @@ public:
|
|||
*/
|
||||
void TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks);
|
||||
|
||||
/**
|
||||
* @return true if this document's frame request callbacks should be
|
||||
* throttled. We throttle requestAnimationFrame for documents which aren't
|
||||
* visible (e.g. scrolled out of the viewport).
|
||||
*/
|
||||
bool ShouldThrottleFrameRequests();
|
||||
|
||||
// This returns true when the document tree is being teared down.
|
||||
bool InUnlinkOrDeletion() { return mInUnlinkOrDeletion; }
|
||||
|
||||
|
|
|
@ -235,10 +235,16 @@ extern bool gBluetoothDebugFlag;
|
|||
|
||||
/**
|
||||
* When a remote BLE device gets connected / disconnected, we'll dispatch an
|
||||
* event
|
||||
* event.
|
||||
*/
|
||||
#define GATT_CONNECTION_STATE_CHANGED_ID "connectionstatechanged"
|
||||
|
||||
/**
|
||||
* When attributes of BluetoothManager, BluetoothAdapter, or BluetoothDevice
|
||||
* are changed, we'll dispatch an event.
|
||||
*/
|
||||
#define ATTRIBUTE_CHANGED_ID "attributechanged"
|
||||
|
||||
// Bluetooth address format: xx:xx:xx:xx:xx:xx (or xx_xx_xx_xx_xx_xx)
|
||||
#define BLUETOOTH_ADDRESS_LENGTH 17
|
||||
#define BLUETOOTH_ADDRESS_NONE "00:00:00:00:00:00"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define mozilla_dom_bluetooth_BluetoothSocketObserver_h
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "BluetoothProfileManagerBase.h"
|
||||
#include "BluetoothSocketObserver.h"
|
||||
#include "DeviceStorage.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
class nsIDOMBlob;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "BluetoothUtils.h"
|
||||
#include "BluetoothUuid.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "BluetoothSocketObserver.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothUtils.h"
|
||||
#include "mozilla/ipc/UnixSocketWatcher.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "BluetoothHfpManagerBase.h"
|
||||
#include "BluetoothRilListener.h"
|
||||
#include "BluetoothSocketObserver.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "mozilla/Hal.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISettingsService.h"
|
||||
|
|
|
@ -23,9 +23,6 @@ namespace dom {
|
|||
class BlobChild;
|
||||
class BlobParent;
|
||||
}
|
||||
namespace ipc {
|
||||
class UnixSocketConsumer;
|
||||
}
|
||||
}
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
|
|
@ -9,22 +9,10 @@
|
|||
|
||||
#include "BluetoothService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
class UnixSocketConsumer;
|
||||
}
|
||||
namespace dom {
|
||||
namespace bluetooth {
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothChild;
|
||||
|
||||
} // namespace bluetooth
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothServiceChildProcess : public BluetoothService
|
||||
{
|
||||
friend class mozilla::dom::bluetooth::BluetoothChild;
|
||||
|
|
|
@ -791,7 +791,7 @@ BluetoothAdapter::SetAdapterState(BluetoothAdapterState aState)
|
|||
mState = aState;
|
||||
|
||||
// Fire BluetoothAttributeEvent for changed adapter state
|
||||
nsTArray<nsString> types;
|
||||
Sequence<nsString> types;
|
||||
BT_APPEND_ENUM_STRING(types,
|
||||
BluetoothAdapterAttribute,
|
||||
BluetoothAdapterAttribute::State);
|
||||
|
@ -806,7 +806,7 @@ BluetoothAdapter::HandlePropertyChanged(const BluetoothValue& aValue)
|
|||
const InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
nsTArray<nsString> types;
|
||||
Sequence<nsString> types;
|
||||
for (uint32_t i = 0, propCount = arr.Length(); i < propCount; ++i) {
|
||||
BluetoothAdapterAttribute type =
|
||||
ConvertStringToAdapterAttribute(arr[i].name());
|
||||
|
@ -912,26 +912,17 @@ BluetoothAdapter::HandleDeviceUnpaired(const BluetoothValue& aValue)
|
|||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::DispatchAttributeEvent(const nsTArray<nsString>& aTypes)
|
||||
BluetoothAdapter::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(aTypes.Length());
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
NS_ENSURE_TRUE_VOID(jsapi.Init(GetOwner()));
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
BluetoothAttributeEventInit init;
|
||||
init.mAttrs = aTypes;
|
||||
|
||||
if (!ToJSValue(cx, aTypes, &value)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
RootedDictionary<BluetoothAttributeEventInit> init(cx);
|
||||
init.mAttrs = value;
|
||||
nsRefPtr<BluetoothAttributeEvent> event =
|
||||
BluetoothAttributeEvent::Constructor(this,
|
||||
NS_LITERAL_STRING("attributechanged"),
|
||||
init);
|
||||
BluetoothAttributeEvent::Constructor(
|
||||
this, NS_LITERAL_STRING(ATTRIBUTE_CHANGED_ID), init);
|
||||
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ private:
|
|||
/**
|
||||
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
|
||||
*/
|
||||
void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
|
||||
void DispatchAttributeEvent(const Sequence<nsString>& aTypes);
|
||||
|
||||
/**
|
||||
* Fire BluetoothDeviceEvent to trigger
|
||||
|
|
|
@ -261,7 +261,7 @@ BluetoothDevice::HandlePropertyChanged(const BluetoothValue& aValue)
|
|||
const InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
nsTArray<nsString> types;
|
||||
Sequence<nsString> types;
|
||||
for (uint32_t i = 0, propCount = arr.Length(); i < propCount; ++i) {
|
||||
BluetoothDeviceAttribute type =
|
||||
ConvertStringToDeviceAttribute(arr[i].name());
|
||||
|
@ -283,26 +283,16 @@ BluetoothDevice::HandlePropertyChanged(const BluetoothValue& aValue)
|
|||
}
|
||||
|
||||
void
|
||||
BluetoothDevice::DispatchAttributeEvent(const nsTArray<nsString>& aTypes)
|
||||
BluetoothDevice::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(aTypes.Length());
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
NS_ENSURE_TRUE_VOID(jsapi.Init(GetOwner()));
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
|
||||
if (!ToJSValue(cx, aTypes, &value)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
RootedDictionary<BluetoothAttributeEventInit> init(cx);
|
||||
init.mAttrs = value;
|
||||
BluetoothAttributeEventInit init;
|
||||
init.mAttrs = aTypes;
|
||||
nsRefPtr<BluetoothAttributeEvent> event =
|
||||
BluetoothAttributeEvent::Constructor(this,
|
||||
NS_LITERAL_STRING("attributechanged"),
|
||||
init);
|
||||
BluetoothAttributeEvent::Constructor(
|
||||
this, NS_LITERAL_STRING(ATTRIBUTE_CHANGED_ID), init);
|
||||
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ private:
|
|||
/**
|
||||
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
|
||||
*/
|
||||
void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
|
||||
void DispatchAttributeEvent(const Sequence<nsString>& aTypes);
|
||||
|
||||
/**
|
||||
* Convert uint32_t to BluetoothDeviceType.
|
||||
|
|
|
@ -246,28 +246,18 @@ BluetoothManager::DispatchAttributeEvent()
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
BT_API2_LOGR();
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
NS_ENSURE_TRUE_VOID(jsapi.Init(GetOwner()));
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
|
||||
nsTArray<nsString> types;
|
||||
Sequence<nsString> types;
|
||||
BT_APPEND_ENUM_STRING(types,
|
||||
BluetoothManagerAttribute,
|
||||
BluetoothManagerAttribute::DefaultAdapter);
|
||||
|
||||
if (!ToJSValue(cx, types, &value)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
// Notify application of default adapter change
|
||||
RootedDictionary<BluetoothAttributeEventInit> init(cx);
|
||||
init.mAttrs = value;
|
||||
BluetoothAttributeEventInit init;
|
||||
init.mAttrs = types;
|
||||
nsRefPtr<BluetoothAttributeEvent> event =
|
||||
BluetoothAttributeEvent::Constructor(this,
|
||||
NS_LITERAL_STRING("attributechanged"),
|
||||
init);
|
||||
BluetoothAttributeEvent::Constructor(
|
||||
this, NS_LITERAL_STRING(ATTRIBUTE_CHANGED_ID), init);
|
||||
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@ namespace dom {
|
|||
class BlobChild;
|
||||
class BlobParent;
|
||||
}
|
||||
namespace ipc {
|
||||
class UnixSocketConsumer;
|
||||
}
|
||||
}
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
|
|
@ -9,22 +9,10 @@
|
|||
|
||||
#include "BluetoothService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
class UnixSocketConsumer;
|
||||
}
|
||||
namespace dom {
|
||||
namespace bluetooth {
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothChild;
|
||||
|
||||
} // namespace bluetooth
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothServiceChildProcess : public BluetoothService
|
||||
{
|
||||
friend class mozilla::dom::bluetooth::BluetoothChild;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "mozilla/ipc/DBusUtils.h"
|
||||
#include "mozilla/ipc/RawDBusConnection.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "BluetoothRilListener.h"
|
||||
#endif
|
||||
#include "BluetoothSocketObserver.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "mozilla/Hal.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "BluetoothProfileManagerBase.h"
|
||||
#include "BluetoothSocketObserver.h"
|
||||
#include "DeviceStorage.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
class nsIDOMBlob;
|
||||
|
|
|
@ -5,13 +5,544 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BluetoothSocket.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "BluetoothSocketObserver.h"
|
||||
#include "BluetoothUnixSocketConnector.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
static const size_t MAX_READ_SIZE = 1 << 16;
|
||||
|
||||
//
|
||||
// BluetoothSocketIO
|
||||
//
|
||||
|
||||
class BluetoothSocket::BluetoothSocketIO final
|
||||
: public UnixSocketWatcher
|
||||
, protected SocketIOBase
|
||||
{
|
||||
public:
|
||||
BluetoothSocketIO(MessageLoop* mIOLoop,
|
||||
BluetoothSocket* aConsumer,
|
||||
UnixSocketConnector* aConnector,
|
||||
const nsACString& aAddress);
|
||||
~BluetoothSocketIO();
|
||||
|
||||
void GetSocketAddr(nsAString& aAddrStr) const;
|
||||
SocketConsumerBase* GetConsumer();
|
||||
SocketBase* GetSocketBase();
|
||||
|
||||
// Shutdown state
|
||||
//
|
||||
|
||||
bool IsShutdownOnMainThread() const;
|
||||
void ShutdownOnMainThread();
|
||||
|
||||
bool IsShutdownOnIOThread() const;
|
||||
void ShutdownOnIOThread();
|
||||
|
||||
// Delayed-task handling
|
||||
//
|
||||
|
||||
void SetDelayedConnectTask(CancelableTask* aTask);
|
||||
void ClearDelayedConnectTask();
|
||||
void CancelDelayedConnectTask();
|
||||
|
||||
// Task callback methods
|
||||
//
|
||||
|
||||
/**
|
||||
* Run bind/listen to prepare for further runs of accept()
|
||||
*/
|
||||
void Listen();
|
||||
|
||||
/**
|
||||
* Connect to a socket
|
||||
*/
|
||||
void Connect();
|
||||
|
||||
void Send(UnixSocketRawData* aData);
|
||||
|
||||
// I/O callback methods
|
||||
//
|
||||
|
||||
void OnAccepted(int aFd, const sockaddr_any* aAddr,
|
||||
socklen_t aAddrLen) override;
|
||||
void OnConnected() override;
|
||||
void OnError(const char* aFunction, int aErrno) override;
|
||||
void OnListening() override;
|
||||
void OnSocketCanReceiveWithoutBlocking() override;
|
||||
void OnSocketCanSendWithoutBlocking() override;
|
||||
|
||||
private:
|
||||
void FireSocketError();
|
||||
|
||||
// Set up flags on file descriptor.
|
||||
static bool SetSocketFlags(int aFd);
|
||||
|
||||
/**
|
||||
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
|
||||
* directly from main thread. All non-main-thread accesses should happen with
|
||||
* mIO as container.
|
||||
*/
|
||||
RefPtr<BluetoothSocket> mConsumer;
|
||||
|
||||
/**
|
||||
* Connector object used to create the connection we are currently using.
|
||||
*/
|
||||
nsAutoPtr<UnixSocketConnector> mConnector;
|
||||
|
||||
/**
|
||||
* If true, do not requeue whatever task we're running
|
||||
*/
|
||||
bool mShuttingDownOnIOThread;
|
||||
|
||||
/**
|
||||
* Address we are connecting to, assuming we are creating a client connection.
|
||||
*/
|
||||
nsCString mAddress;
|
||||
|
||||
/**
|
||||
* Size of the socket address struct
|
||||
*/
|
||||
socklen_t mAddrSize;
|
||||
|
||||
/**
|
||||
* Address struct of the socket currently in use
|
||||
*/
|
||||
sockaddr_any mAddr;
|
||||
|
||||
/**
|
||||
* Task member for delayed connect task. Should only be access on main thread.
|
||||
*/
|
||||
CancelableTask* mDelayedConnectTask;
|
||||
};
|
||||
|
||||
BluetoothSocket::BluetoothSocketIO::BluetoothSocketIO(
|
||||
MessageLoop* mIOLoop,
|
||||
BluetoothSocket* aConsumer,
|
||||
UnixSocketConnector* aConnector,
|
||||
const nsACString& aAddress)
|
||||
: UnixSocketWatcher(mIOLoop)
|
||||
, SocketIOBase(MAX_READ_SIZE)
|
||||
, mConsumer(aConsumer)
|
||||
, mConnector(aConnector)
|
||||
, mShuttingDownOnIOThread(false)
|
||||
, mAddress(aAddress)
|
||||
, mDelayedConnectTask(nullptr)
|
||||
{
|
||||
MOZ_ASSERT(mConsumer);
|
||||
MOZ_ASSERT(mConnector);
|
||||
}
|
||||
|
||||
BluetoothSocket::BluetoothSocketIO::~BluetoothSocketIO()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(IsShutdownOnMainThread());
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::GetSocketAddr(nsAString& aAddrStr) const
|
||||
{
|
||||
if (!mConnector) {
|
||||
NS_WARNING("No connector to get socket address from!");
|
||||
aAddrStr.Truncate();
|
||||
return;
|
||||
}
|
||||
mConnector->GetSocketAddr(mAddr, aAddrStr);
|
||||
}
|
||||
|
||||
SocketConsumerBase*
|
||||
BluetoothSocket::BluetoothSocketIO::GetConsumer()
|
||||
{
|
||||
return mConsumer.get();
|
||||
}
|
||||
|
||||
SocketBase*
|
||||
BluetoothSocket::BluetoothSocketIO::GetSocketBase()
|
||||
{
|
||||
return GetConsumer();
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::BluetoothSocketIO::IsShutdownOnMainThread() const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
return mConsumer == nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::ShutdownOnMainThread()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!IsShutdownOnMainThread());
|
||||
|
||||
mConsumer = nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::BluetoothSocketIO::IsShutdownOnIOThread() const
|
||||
{
|
||||
return mShuttingDownOnIOThread;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::ShutdownOnIOThread()
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(!mShuttingDownOnIOThread);
|
||||
|
||||
Close(); // will also remove fd from I/O loop
|
||||
mShuttingDownOnIOThread = true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::SetDelayedConnectTask(CancelableTask* aTask)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mDelayedConnectTask = aTask;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::ClearDelayedConnectTask()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mDelayedConnectTask = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::CancelDelayedConnectTask()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mDelayedConnectTask) {
|
||||
return;
|
||||
}
|
||||
|
||||
mDelayedConnectTask->Cancel();
|
||||
ClearDelayedConnectTask();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::Listen()
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
MOZ_ASSERT(mConnector);
|
||||
|
||||
// This will set things we don't particularly care about, but it will hand
|
||||
// back the correct structure size which is what we do care about.
|
||||
if (!mConnector->CreateAddr(true, mAddrSize, mAddr, nullptr)) {
|
||||
NS_WARNING("Cannot create socket address!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsOpen()) {
|
||||
int fd = mConnector->Create();
|
||||
if (fd < 0) {
|
||||
NS_WARNING("Cannot create socket fd!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
if (!SetSocketFlags(fd)) {
|
||||
NS_WARNING("Cannot set socket flags!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
SetFd(fd);
|
||||
|
||||
// calls OnListening on success, or OnError otherwise
|
||||
nsresult rv = UnixSocketWatcher::Listen(
|
||||
reinterpret_cast<struct sockaddr*>(&mAddr), mAddrSize);
|
||||
NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::Connect()
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
MOZ_ASSERT(mConnector);
|
||||
|
||||
if (!IsOpen()) {
|
||||
int fd = mConnector->Create();
|
||||
if (fd < 0) {
|
||||
NS_WARNING("Cannot create socket fd!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
if (!SetSocketFlags(fd)) {
|
||||
NS_WARNING("Cannot set socket flags!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
SetFd(fd);
|
||||
}
|
||||
|
||||
if (!mConnector->CreateAddr(false, mAddrSize, mAddr, mAddress.get())) {
|
||||
NS_WARNING("Cannot create socket address!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
|
||||
// calls OnConnected() on success, or OnError() otherwise
|
||||
nsresult rv = UnixSocketWatcher::Connect(
|
||||
reinterpret_cast<struct sockaddr*>(&mAddr), mAddrSize);
|
||||
NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::Send(UnixSocketRawData* aData)
|
||||
{
|
||||
EnqueueData(aData);
|
||||
AddWatchers(WRITE_WATCHER, false);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::OnAccepted(
|
||||
int aFd, const sockaddr_any* aAddr, socklen_t aAddrLen)
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_LISTENING);
|
||||
MOZ_ASSERT(aAddr);
|
||||
MOZ_ASSERT(aAddrLen > 0 && (size_t)aAddrLen <= sizeof(mAddr));
|
||||
|
||||
memcpy (&mAddr, aAddr, aAddrLen);
|
||||
mAddrSize = aAddrLen;
|
||||
|
||||
if (!mConnector->SetUp(aFd)) {
|
||||
NS_WARNING("Could not set up socket!");
|
||||
return;
|
||||
}
|
||||
|
||||
RemoveWatchers(READ_WATCHER|WRITE_WATCHER);
|
||||
Close();
|
||||
if (!SetSocketFlags(aFd)) {
|
||||
return;
|
||||
}
|
||||
SetSocket(aFd, SOCKET_IS_CONNECTED);
|
||||
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new SocketIOEventRunnable<BluetoothSocketIO>(
|
||||
this, SocketIOEventRunnable<BluetoothSocketIO>::CONNECT_SUCCESS);
|
||||
NS_DispatchToMainThread(r);
|
||||
|
||||
AddWatchers(READ_WATCHER, true);
|
||||
if (HasPendingData()) {
|
||||
AddWatchers(WRITE_WATCHER, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::OnConnected()
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED);
|
||||
|
||||
if (!SetSocketFlags(GetFd())) {
|
||||
NS_WARNING("Cannot set socket flags!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mConnector->SetUp(GetFd())) {
|
||||
NS_WARNING("Could not set up socket!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new SocketIOEventRunnable<BluetoothSocketIO>(
|
||||
this, SocketIOEventRunnable<BluetoothSocketIO>::CONNECT_SUCCESS);
|
||||
NS_DispatchToMainThread(r);
|
||||
|
||||
AddWatchers(READ_WATCHER, true);
|
||||
if (HasPendingData()) {
|
||||
AddWatchers(WRITE_WATCHER, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::OnListening()
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_LISTENING);
|
||||
|
||||
if (!mConnector->SetUpListenSocket(GetFd())) {
|
||||
NS_WARNING("Could not set up listen socket!");
|
||||
FireSocketError();
|
||||
return;
|
||||
}
|
||||
|
||||
AddWatchers(READ_WATCHER, true);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::OnError(const char* aFunction, int aErrno)
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
|
||||
UnixFdWatcher::OnError(aFunction, aErrno);
|
||||
FireSocketError();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::OnSocketCanReceiveWithoutBlocking()
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); // see bug 990984
|
||||
|
||||
ssize_t res = ReceiveData(GetFd(), this);
|
||||
if (res < 0) {
|
||||
/* I/O error */
|
||||
RemoveWatchers(READ_WATCHER|WRITE_WATCHER);
|
||||
} else if (!res) {
|
||||
/* EOF or peer shutdown */
|
||||
RemoveWatchers(READ_WATCHER);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::OnSocketCanSendWithoutBlocking()
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); // see bug 990984
|
||||
|
||||
nsresult rv = SendPendingData(GetFd(), this);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasPendingData()) {
|
||||
AddWatchers(WRITE_WATCHER, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::BluetoothSocketIO::FireSocketError()
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
|
||||
|
||||
// Clean up watchers, statuses, fds
|
||||
Close();
|
||||
|
||||
// Tell the main thread we've errored
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new SocketIOEventRunnable<BluetoothSocketIO>(
|
||||
this, SocketIOEventRunnable<BluetoothSocketIO>::CONNECT_ERROR);
|
||||
|
||||
NS_DispatchToMainThread(r);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::BluetoothSocketIO::SetSocketFlags(int aFd)
|
||||
{
|
||||
// Set socket addr to be reused even if kernel is still waiting to close
|
||||
int n = 1;
|
||||
if (setsockopt(aFd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set close-on-exec bit.
|
||||
int flags = TEMP_FAILURE_RETRY(fcntl(aFd, F_GETFD));
|
||||
if (-1 == flags) {
|
||||
return false;
|
||||
}
|
||||
flags |= FD_CLOEXEC;
|
||||
if (-1 == TEMP_FAILURE_RETRY(fcntl(aFd, F_SETFD, flags))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set non-blocking status flag.
|
||||
flags = TEMP_FAILURE_RETRY(fcntl(aFd, F_GETFL));
|
||||
if (-1 == flags) {
|
||||
return false;
|
||||
}
|
||||
flags |= O_NONBLOCK;
|
||||
if (-1 == TEMP_FAILURE_RETRY(fcntl(aFd, F_SETFL, flags))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// Socket tasks
|
||||
//
|
||||
|
||||
class BluetoothSocket::ListenTask final
|
||||
: public SocketIOTask<BluetoothSocketIO>
|
||||
{
|
||||
public:
|
||||
ListenTask(BluetoothSocketIO* aIO)
|
||||
: SocketIOTask<BluetoothSocketIO>(aIO)
|
||||
{ }
|
||||
|
||||
void Run() override
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
if (!IsCanceled()) {
|
||||
GetIO()->Listen();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class BluetoothSocket::ConnectTask final
|
||||
: public SocketIOTask<BluetoothSocketIO>
|
||||
{
|
||||
public:
|
||||
ConnectTask(BluetoothSocketIO* aIO)
|
||||
: SocketIOTask<BluetoothSocketIO>(aIO)
|
||||
{ }
|
||||
|
||||
void Run() override
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(!IsCanceled());
|
||||
|
||||
GetIO()->Connect();
|
||||
}
|
||||
};
|
||||
|
||||
class BluetoothSocket::DelayedConnectTask final
|
||||
: public SocketIOTask<BluetoothSocketIO>
|
||||
{
|
||||
public:
|
||||
DelayedConnectTask(BluetoothSocketIO* aIO)
|
||||
: SocketIOTask<BluetoothSocketIO>(aIO)
|
||||
{ }
|
||||
|
||||
void Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (IsCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothSocketIO* io = GetIO();
|
||||
if (io->IsShutdownOnMainThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
io->ClearDelayedConnectTask();
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new ConnectTask(io));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// BluetoothSocket
|
||||
//
|
||||
|
||||
BluetoothSocket::BluetoothSocket(BluetoothSocketObserver* aObserver,
|
||||
BluetoothSocketType aType,
|
||||
|
@ -21,10 +552,16 @@ BluetoothSocket::BluetoothSocket(BluetoothSocketObserver* aObserver,
|
|||
, mType(aType)
|
||||
, mAuth(aAuth)
|
||||
, mEncrypt(aEncrypt)
|
||||
, mIO(nullptr)
|
||||
{
|
||||
MOZ_ASSERT(aObserver);
|
||||
}
|
||||
|
||||
BluetoothSocket::~BluetoothSocket()
|
||||
{
|
||||
MOZ_ASSERT(!mIO);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::Connect(const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aServiceUuid,
|
||||
|
@ -101,3 +638,122 @@ BluetoothSocket::OnDisconnect()
|
|||
mObserver->OnSocketDisconnect(this);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::SendSocketData(UnixSocketRawData* aData)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mIO) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mIO->IsShutdownOnMainThread());
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
new SocketIOSendTask<BluetoothSocketIO, UnixSocketRawData>(mIO, aData));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::SendSocketData(const nsACString& aStr)
|
||||
{
|
||||
if (aStr.Length() > MAX_READ_SIZE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoPtr<UnixSocketRawData> data(
|
||||
new UnixSocketRawData(aStr.BeginReading(), aStr.Length()));
|
||||
|
||||
if (!SendSocketData(data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unused << data.forget();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::CloseSocket()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mIO) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIO->CancelDelayedConnectTask();
|
||||
|
||||
// From this point on, we consider mIO as being deleted.
|
||||
// We sever the relationship here so any future calls to listen or connect
|
||||
// will create a new implementation.
|
||||
mIO->ShutdownOnMainThread();
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE, new SocketIOShutdownTask<BluetoothSocketIO>(mIO));
|
||||
|
||||
mIO = nullptr;
|
||||
|
||||
NotifyDisconnect();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothSocket::GetSocketAddr(nsAString& aAddrStr)
|
||||
{
|
||||
aAddrStr.Truncate();
|
||||
if (!mIO || GetConnectionStatus() != SOCKET_CONNECTED) {
|
||||
NS_WARNING("No socket currently open!");
|
||||
return;
|
||||
}
|
||||
mIO->GetSocketAddr(aAddrStr);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::ConnectSocket(BluetoothUnixSocketConnector* aConnector,
|
||||
const char* aAddress,
|
||||
int aDelayMs)
|
||||
{
|
||||
MOZ_ASSERT(aConnector);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoPtr<UnixSocketConnector> connector(aConnector);
|
||||
|
||||
if (mIO) {
|
||||
NS_WARNING("Socket already connecting/connected!");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCString addr(aAddress);
|
||||
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
|
||||
mIO = new BluetoothSocketIO(ioLoop, this, connector.forget(), addr);
|
||||
SetConnectionStatus(SOCKET_CONNECTING);
|
||||
if (aDelayMs > 0) {
|
||||
DelayedConnectTask* connectTask = new DelayedConnectTask(mIO);
|
||||
mIO->SetDelayedConnectTask(connectTask);
|
||||
MessageLoop::current()->PostDelayedTask(FROM_HERE, connectTask, aDelayMs);
|
||||
} else {
|
||||
ioLoop->PostTask(FROM_HERE, new ConnectTask(mIO));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothSocket::ListenSocket(BluetoothUnixSocketConnector* aConnector)
|
||||
{
|
||||
MOZ_ASSERT(aConnector);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoPtr<UnixSocketConnector> connector(aConnector);
|
||||
|
||||
if (mIO) {
|
||||
NS_WARNING("Socket already connecting/connected!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mIO = new BluetoothSocketIO(
|
||||
XRE_GetIOMessageLoop(), this, connector.forget(), EmptyCString());
|
||||
SetConnectionStatus(SOCKET_LISTENING);
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new ListenTask(mIO));
|
||||
return true;
|
||||
}
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
|
|
@ -8,19 +8,27 @@
|
|||
#define mozilla_dom_bluetooth_BluetoothSocket_h
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include <stdlib.h>
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "mozilla/ipc/UnixSocketWatcher.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothSocketObserver;
|
||||
class BluetoothUnixSocketConnector;
|
||||
|
||||
class BluetoothSocket : public mozilla::ipc::UnixSocketConsumer
|
||||
class BluetoothSocket final : public mozilla::ipc::SocketConsumerBase
|
||||
{
|
||||
public:
|
||||
BluetoothSocket(BluetoothSocketObserver* aObserver,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt);
|
||||
~BluetoothSocket();
|
||||
|
||||
bool Connect(const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aServiceUuid,
|
||||
|
@ -44,11 +52,73 @@ public:
|
|||
GetSocketAddr(aDeviceAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue data to be sent to the socket on the IO thread. Can only be called on
|
||||
* originating thread.
|
||||
*
|
||||
* @param aMessage Data to be sent to socket
|
||||
*
|
||||
* @return true if data is queued, false otherwise (i.e. not connected)
|
||||
*/
|
||||
bool SendSocketData(mozilla::ipc::UnixSocketRawData* aMessage);
|
||||
|
||||
/**
|
||||
* Convenience function for sending strings to the socket (common in bluetooth
|
||||
* profile usage). Converts to a UnixSocketRawData struct. Can only be called
|
||||
* on originating thread.
|
||||
*
|
||||
* @param aMessage String to be sent to socket
|
||||
*
|
||||
* @return true if data is queued, false otherwise (i.e. not connected)
|
||||
*/
|
||||
bool SendSocketData(const nsACString& aMessage);
|
||||
|
||||
/**
|
||||
* Starts a task on the socket that will try to connect to a socket in a
|
||||
* non-blocking manner.
|
||||
*
|
||||
* @param aConnector Connector object for socket type specific functions
|
||||
* @param aAddress Address to connect to.
|
||||
* @param aDelayMs Time delay in milli-seconds.
|
||||
*
|
||||
* @return true on connect task started, false otherwise.
|
||||
*/
|
||||
bool ConnectSocket(BluetoothUnixSocketConnector* aConnector,
|
||||
const char* aAddress,
|
||||
int aDelayMs = 0);
|
||||
|
||||
/**
|
||||
* Starts a task on the socket that will try to accept a new connection in a
|
||||
* non-blocking manner.
|
||||
*
|
||||
* @param aConnector Connector object for socket type specific functions
|
||||
*
|
||||
* @return true on listen started, false otherwise
|
||||
*/
|
||||
bool ListenSocket(BluetoothUnixSocketConnector* aConnector);
|
||||
|
||||
/**
|
||||
* Queues the internal representation of socket for deletion. Can be called
|
||||
* from main thread.
|
||||
*/
|
||||
void CloseSocket();
|
||||
|
||||
/**
|
||||
* Get the current sockaddr for the socket
|
||||
*/
|
||||
void GetSocketAddr(nsAString& aAddrStr);
|
||||
|
||||
private:
|
||||
class BluetoothSocketIO;
|
||||
class ConnectTask;
|
||||
class DelayedConnectTask;
|
||||
class ListenTask;
|
||||
|
||||
BluetoothSocketObserver* mObserver;
|
||||
BluetoothSocketType mType;
|
||||
bool mAuth;
|
||||
bool mEncrypt;
|
||||
BluetoothSocketIO* mIO;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "BluetoothCommon.h"
|
||||
#include <sys/socket.h>
|
||||
#include <mozilla/ipc/UnixSocket.h>
|
||||
#include <mozilla/ipc/UnixSocketConnector.h>
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ skip-if = (toolkit == 'gonk' && !debug)
|
|||
skip-if = (toolkit == 'gonk' && !debug)
|
||||
[test_browserElement_oop_GetScreenshot.html]
|
||||
[test_browserElement_oop_GetScreenshotDppx.html]
|
||||
skip-if = (toolkit == 'windows')
|
||||
[test_browserElement_oop_Iconchange.html]
|
||||
[test_browserElement_oop_LoadEvents.html]
|
||||
[test_browserElement_oop_Manifestchange.html]
|
||||
|
|
|
@ -162,6 +162,7 @@ skip-if = (toolkit == 'gonk' && !debug)
|
|||
[test_browserElement_inproc_GetScreenshot.html]
|
||||
skip-if = (toolkit == 'android' && processor == 'x86') #x86 only
|
||||
[test_browserElement_inproc_GetScreenshotDppx.html]
|
||||
skip-if = (toolkit == 'windows')
|
||||
[test_browserElement_inproc_Iconchange.html]
|
||||
[test_browserElement_inproc_LoadEvents.html]
|
||||
[test_browserElement_inproc_Manifestchange.html]
|
||||
|
|
|
@ -308,12 +308,12 @@ public:
|
|||
nsIntRegion strokePaintNeededRegion;
|
||||
|
||||
FilterSupport::ComputeSourceNeededRegions(
|
||||
ctx->CurrentState().filter, mgfx::ThebesIntRect(mPostFilterBounds),
|
||||
ctx->CurrentState().filter, mPostFilterBounds,
|
||||
sourceGraphicNeededRegion, fillPaintNeededRegion, strokePaintNeededRegion);
|
||||
|
||||
mSourceGraphicRect = mgfx::ToIntRect(sourceGraphicNeededRegion.GetBounds());
|
||||
mFillPaintRect = mgfx::ToIntRect(fillPaintNeededRegion.GetBounds());
|
||||
mStrokePaintRect = mgfx::ToIntRect(strokePaintNeededRegion.GetBounds());
|
||||
mSourceGraphicRect = sourceGraphicNeededRegion.GetBounds();
|
||||
mFillPaintRect = fillPaintNeededRegion.GetBounds();
|
||||
mStrokePaintRect = strokePaintNeededRegion.GetBounds();
|
||||
|
||||
mSourceGraphicRect = mSourceGraphicRect.Intersect(aPreFilterBounds);
|
||||
|
||||
|
@ -600,10 +600,10 @@ private:
|
|||
nsIntRegion strokePaintNeededRegion;
|
||||
|
||||
FilterSupport::ComputeSourceNeededRegions(
|
||||
ctx->CurrentState().filter, mgfx::ThebesIntRect(mgfx::RoundedToInt(aDestBounds)),
|
||||
ctx->CurrentState().filter, mgfx::RoundedToInt(aDestBounds),
|
||||
sourceGraphicNeededRegion, fillPaintNeededRegion, strokePaintNeededRegion);
|
||||
|
||||
return mgfx::Rect(mgfx::ToIntRect(sourceGraphicNeededRegion.GetBounds()));
|
||||
return mgfx::Rect(sourceGraphicNeededRegion.GetBounds());
|
||||
}
|
||||
|
||||
mgfx::Rect
|
||||
|
@ -639,8 +639,8 @@ private:
|
|||
|
||||
nsIntRegion extents =
|
||||
mgfx::FilterSupport::ComputePostFilterExtents(ctx->CurrentState().filter,
|
||||
mgfx::ThebesIntRect(intBounds));
|
||||
return mgfx::Rect(mgfx::ToIntRect(extents.GetBounds()));
|
||||
intBounds);
|
||||
return mgfx::Rect(extents.GetBounds());
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> mTarget;
|
||||
|
|
|
@ -11,12 +11,11 @@
|
|||
#include "mozilla/EventForwards.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsPoint.h"
|
||||
|
||||
class nsIScrollableFrame;
|
||||
class nsITimer;
|
||||
|
||||
struct nsIntPoint;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class EventStateManager;
|
||||
|
|
|
@ -49,13 +49,26 @@ function isEnabledMiddleClickPaste()
|
|||
}
|
||||
}
|
||||
|
||||
function isEnabledTouchCaret()
|
||||
{
|
||||
try {
|
||||
return SpecialPowers.getBoolPref("touchcaret.enabled");
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function doTest(aButton)
|
||||
{
|
||||
// NOTE #1: Right click causes a context menu to popup, then, the click event
|
||||
// isn't generated.
|
||||
// NOTE #2: If middle click causes text to be pasted, then, the click event
|
||||
// isn't generated.
|
||||
if (aButton != 2 && (aButton != 1 || !isEnabledMiddleClickPaste())) {
|
||||
// NOTE #3: If touch caret is enabled, touch caret would ovelap input element,
|
||||
// then, the click event isn't generated.
|
||||
if (aButton != 2 &&
|
||||
(aButton != 1 || !isEnabledMiddleClickPaste()) &&
|
||||
(aButton != 0 || !isEnabledTouchCaret())) {
|
||||
gClickCount = 0;
|
||||
// click on border of input
|
||||
synthesizeMouse(input, 5, 5, { button: aButton });
|
||||
|
|
|
@ -37,9 +37,9 @@ using nscolor from "nsColor.h";
|
|||
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
|
||||
using struct mozilla::widget::IMENotification from "nsIWidget.h";
|
||||
using struct nsIMEUpdatePreference from "nsIWidget.h";
|
||||
using struct nsIntPoint from "nsPoint.h";
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
|
||||
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
|
||||
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
|
||||
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
|
||||
|
@ -488,11 +488,11 @@ parent:
|
|||
uint64_t aObserverId);
|
||||
SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
TouchPointerState aPointerState,
|
||||
nsIntPoint aPointerScreenPoint,
|
||||
IntPoint aPointerScreenPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation,
|
||||
uint64_t aObserverId);
|
||||
SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
|
||||
SynthesizeNativeTouchTap(IntPoint aPointerScreenPoint,
|
||||
bool aLongTap,
|
||||
uint64_t aObserverId);
|
||||
ClearNativeTouchSequence(uint64_t aObserverId);
|
||||
|
@ -548,8 +548,8 @@ child:
|
|||
|
||||
CacheFileDescriptor(nsString path, FileDescriptor fd);
|
||||
|
||||
UpdateDimensions(nsIntRect rect, ScreenIntSize size, ScreenOrientation orientation,
|
||||
nsIntPoint chromeDisp) compress;
|
||||
UpdateDimensions(IntRect rect, ScreenIntSize size, ScreenOrientation orientation,
|
||||
LayoutDeviceIntPoint chromeDisp) compress;
|
||||
|
||||
UpdateFrame(FrameMetrics frame);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ include protocol PBrowser;
|
|||
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
using nsIntRect from "nsRect.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
|
|
@ -8,7 +8,7 @@ include protocol PContent;
|
|||
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
using nsIntRect from "nsRect.h";
|
||||
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -92,6 +92,47 @@ private:
|
|||
bool mEnabled;
|
||||
bool mShutdown;
|
||||
nsRefPtr<ContentParent> mPreallocatedAppProcess;
|
||||
|
||||
#if defined(MOZ_NUWA_PROCESS) && defined(ENABLE_TESTS)
|
||||
// For testing NS_NewUnmonitoredThread().
|
||||
|
||||
void CreateUnmonitoredThread();
|
||||
void DestroyUnmonitoredThread();
|
||||
|
||||
class UnmonitoredThreadRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
UnmonitoredThreadRunnable()
|
||||
: mMonitor("UnmonitoredThreadRunnable")
|
||||
, mEnabled(true)
|
||||
{ }
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
while (mEnabled) {
|
||||
mMonitor.Wait();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void Disable()
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mEnabled = false;
|
||||
mMonitor.NotifyAll();
|
||||
}
|
||||
|
||||
private:
|
||||
~UnmonitoredThreadRunnable() { }
|
||||
|
||||
Monitor mMonitor;
|
||||
bool mEnabled;
|
||||
};
|
||||
|
||||
nsCOMPtr<nsIThread> mUnmonitoredThread;
|
||||
nsRefPtr<UnmonitoredThreadRunnable> mUnmonitoredThreadRunnable;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* static */ StaticRefPtr<PreallocatedProcessManagerImpl>
|
||||
|
@ -155,6 +196,40 @@ PreallocatedProcessManagerImpl::Observe(nsISupports* aSubject,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(MOZ_NUWA_PROCESS) && defined(ENABLE_TESTS)
|
||||
void
|
||||
PreallocatedProcessManagerImpl::CreateUnmonitoredThread()
|
||||
{
|
||||
if (Preferences::GetBool("dom.ipc.newUnmonitoredThread.testMode")) {
|
||||
// Create an unmonitored thread and dispatch a blocking runnable in test
|
||||
// case startup.
|
||||
nsresult rv = NS_NewUnmonitoredThread(getter_AddRefs(mUnmonitoredThread),
|
||||
nullptr);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
mUnmonitoredThreadRunnable = new UnmonitoredThreadRunnable();
|
||||
mUnmonitoredThread->Dispatch(mUnmonitoredThreadRunnable,
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PreallocatedProcessManagerImpl::DestroyUnmonitoredThread()
|
||||
{
|
||||
// Cleanup after the test case finishes.
|
||||
if (mUnmonitoredThreadRunnable) {
|
||||
mUnmonitoredThreadRunnable->Disable();
|
||||
}
|
||||
|
||||
if (mUnmonitoredThread) {
|
||||
mUnmonitoredThread->Shutdown();
|
||||
}
|
||||
|
||||
mUnmonitoredThreadRunnable = nullptr;
|
||||
mUnmonitoredThread = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PreallocatedProcessManagerImpl::RereadPrefs()
|
||||
{
|
||||
|
@ -180,6 +255,11 @@ PreallocatedProcessManagerImpl::Enable()
|
|||
|
||||
mEnabled = true;
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
#ifdef ENABLE_TESTS
|
||||
// For testing New_UnmonitoredThread().
|
||||
CreateUnmonitoredThread();
|
||||
#endif
|
||||
|
||||
ScheduleDelayedNuwaFork();
|
||||
#else
|
||||
AllocateAfterDelay();
|
||||
|
@ -372,6 +452,11 @@ PreallocatedProcessManagerImpl::Disable()
|
|||
mEnabled = false;
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
#ifdef ENABLE_TESTS
|
||||
// Shut down the test-only unmonitored thread.
|
||||
DestroyUnmonitoredThread();
|
||||
#endif
|
||||
|
||||
// Cancel pending fork.
|
||||
if (mPreallocateAppProcessTask) {
|
||||
mPreallocateAppProcessTask->Cancel();
|
||||
|
|
|
@ -1085,7 +1085,7 @@ TabChild::Init()
|
|||
}
|
||||
mWidget->Create(
|
||||
nullptr, 0, // no parents
|
||||
nsIntRect(nsIntPoint(0, 0), nsIntSize(0, 0)),
|
||||
gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)),
|
||||
nullptr // HandleWidgetEvent
|
||||
);
|
||||
|
||||
|
@ -2018,7 +2018,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
|
|||
|
||||
bool
|
||||
TabChild::RecvUpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size,
|
||||
const ScreenOrientation& orientation, const nsIntPoint& chromeDisp)
|
||||
const ScreenOrientation& orientation, const LayoutDeviceIntPoint& chromeDisp)
|
||||
{
|
||||
if (!mRemoteFrame) {
|
||||
return true;
|
||||
|
@ -3179,7 +3179,7 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
|
|||
initData.mUnicode = false;
|
||||
initData.clipChildren = true;
|
||||
initData.clipSiblings = true;
|
||||
nsresult rv = pluginWidget->Create(aParent, nullptr, nsIntRect(nsIntPoint(0, 0),
|
||||
nsresult rv = pluginWidget->Create(aParent, nullptr, gfx::IntRect(gfx::IntPoint(0, 0),
|
||||
nsIntSize(0, 0)), &initData);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Creating native plugin widget on the chrome side failed.");
|
||||
|
|
|
@ -322,7 +322,7 @@ public:
|
|||
virtual bool RecvUpdateDimensions(const nsIntRect& rect,
|
||||
const ScreenIntSize& size,
|
||||
const ScreenOrientation& orientation,
|
||||
const nsIntPoint& chromeDisp) override;
|
||||
const LayoutDeviceIntPoint& chromeDisp) override;
|
||||
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
|
||||
virtual bool RecvRequestFlingSnap(const ViewID& aScrollId,
|
||||
const CSSPoint& aDestination) override;
|
||||
|
@ -487,7 +487,7 @@ public:
|
|||
bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override;
|
||||
nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
|
||||
|
||||
nsIntPoint GetChromeDisplacement() { return mChromeDisp; };
|
||||
LayoutDeviceIntPoint GetChromeDisplacement() { return mChromeDisp; };
|
||||
|
||||
bool IPCOpen() { return mIPCOpen; }
|
||||
|
||||
|
@ -625,7 +625,7 @@ private:
|
|||
bool mHasValidInnerSize;
|
||||
bool mDestroyed;
|
||||
// Position of tab, relative to parent widget (typically the window)
|
||||
nsIntPoint mChromeDisp;
|
||||
LayoutDeviceIntPoint mChromeDisp;
|
||||
TabId mUniqueId;
|
||||
float mDPI;
|
||||
double mDefaultScale;
|
||||
|
|
|
@ -270,7 +270,6 @@ TabParent::TabParent(nsIContentParent* aManager,
|
|||
, mDPI(0)
|
||||
, mDefaultScale(0)
|
||||
, mUpdatedDimensions(false)
|
||||
, mChromeOffset(0, 0)
|
||||
, mManager(aManager)
|
||||
, mMarkedDestroying(false)
|
||||
, mIsDestroyed(false)
|
||||
|
@ -338,16 +337,27 @@ TabParent::SetOwnerElement(Element* aElement)
|
|||
|
||||
// Update to the new content, and register to listen for events from it.
|
||||
mFrameElement = aElement;
|
||||
if (mFrameElement && mFrameElement->OwnerDoc()->GetWindow()) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = mFrameElement->OwnerDoc()->GetWindow();
|
||||
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
|
||||
if (eventTarget) {
|
||||
eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
|
||||
this, false, false);
|
||||
|
||||
AddWindowListeners();
|
||||
TryCacheDPIAndScale();
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::AddWindowListeners()
|
||||
{
|
||||
if (mFrameElement && mFrameElement->OwnerDoc()) {
|
||||
if (nsCOMPtr<nsPIDOMWindow> window = mFrameElement->OwnerDoc()->GetWindow()) {
|
||||
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
|
||||
if (eventTarget) {
|
||||
eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
|
||||
this, false, false);
|
||||
}
|
||||
}
|
||||
if (nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell()) {
|
||||
mPresShellWithRefreshListener = shell;
|
||||
shell->AddPostRefreshObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
TryCacheDPIAndScale();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -361,6 +371,18 @@ TabParent::RemoveWindowListeners()
|
|||
this, false);
|
||||
}
|
||||
}
|
||||
if (mPresShellWithRefreshListener) {
|
||||
mPresShellWithRefreshListener->RemovePostRefreshObserver(this);
|
||||
mPresShellWithRefreshListener = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::DidRefresh()
|
||||
{
|
||||
if (mChromeOffset != -GetChildProcessOffset()) {
|
||||
UpdatePosition();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -395,6 +417,8 @@ TabParent::Destroy()
|
|||
return;
|
||||
}
|
||||
|
||||
RemoveWindowListeners();
|
||||
|
||||
// If this fails, it's most likely due to a content-process crash,
|
||||
// and auto-cleanup will kick in. Otherwise, the child side will
|
||||
// destroy itself and send back __delete__().
|
||||
|
@ -904,6 +928,19 @@ TabParent::RecvSetDimensions(const uint32_t& aFlags,
|
|||
return false;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TabParent::UpdatePosition()
|
||||
{
|
||||
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
|
||||
if (!frameLoader) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsIntRect windowDims;
|
||||
NS_ENSURE_SUCCESS(frameLoader->GetWindowDimensions(windowDims), NS_ERROR_FAILURE);
|
||||
UpdateDimensions(windowDims, mDimensions);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
|
||||
{
|
||||
|
@ -913,17 +950,18 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
|
|||
hal::ScreenConfiguration config;
|
||||
hal::GetCurrentScreenConfiguration(&config);
|
||||
ScreenOrientation orientation = config.orientation();
|
||||
nsIntPoint chromeOffset = -LayoutDevicePixel::ToUntyped(GetChildProcessOffset());
|
||||
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
nsIntRect contentRect = rect;
|
||||
if (widget) {
|
||||
contentRect.x += widget->GetClientOffset().x;
|
||||
contentRect.y += widget->GetClientOffset().y;
|
||||
}
|
||||
|
||||
if (!mUpdatedDimensions || mOrientation != orientation ||
|
||||
mDimensions != size || !mRect.IsEqualEdges(rect) ||
|
||||
mDimensions != size || !mRect.IsEqualEdges(contentRect) ||
|
||||
chromeOffset != mChromeOffset) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
nsIntRect contentRect = rect;
|
||||
if (widget) {
|
||||
contentRect.x += widget->GetClientOffset().x;
|
||||
contentRect.y += widget->GetClientOffset().y;
|
||||
}
|
||||
|
||||
mUpdatedDimensions = true;
|
||||
mRect = contentRect;
|
||||
|
@ -2990,14 +3028,7 @@ TabParent::HandleEvent(nsIDOMEvent* aEvent)
|
|||
if (eventType.EqualsLiteral("MozUpdateWindowPos") && !mIsDestroyed) {
|
||||
// This event is sent when the widget moved. Therefore we only update
|
||||
// the position.
|
||||
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
|
||||
if (!frameLoader) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsIntRect windowDims;
|
||||
NS_ENSURE_SUCCESS(frameLoader->GetWindowDimensions(windowDims), NS_ERROR_FAILURE);
|
||||
UpdateDimensions(windowDims, mDimensions);
|
||||
return NS_OK;
|
||||
return UpdatePosition();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsITabParent.h"
|
||||
#include "nsIXULBrowserWindow.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "Units.h"
|
||||
#include "nsIWidget.h"
|
||||
|
@ -74,6 +75,7 @@ class TabParent final : public PBrowserParent
|
|||
, public nsISecureBrowserUI
|
||||
, public nsSupportsWeakReference
|
||||
, public TabContext
|
||||
, public nsAPostRefreshObserver
|
||||
{
|
||||
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
||||
|
||||
|
@ -119,6 +121,8 @@ public:
|
|||
void Destroy();
|
||||
|
||||
void RemoveWindowListeners();
|
||||
void AddWindowListeners();
|
||||
void DidRefresh() override;
|
||||
|
||||
virtual bool RecvMoveFocus(const bool& aForward) override;
|
||||
virtual bool RecvEvent(const RemoteDOMEvent& aEvent) override;
|
||||
|
@ -479,7 +483,7 @@ protected:
|
|||
float mDPI;
|
||||
CSSToLayoutDeviceScale mDefaultScale;
|
||||
bool mUpdatedDimensions;
|
||||
nsIntPoint mChromeOffset;
|
||||
LayoutDeviceIntPoint mChromeOffset;
|
||||
|
||||
private:
|
||||
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
|
||||
|
@ -487,6 +491,8 @@ private:
|
|||
nsRefPtr<nsIContentParent> mManager;
|
||||
void TryCacheDPIAndScale();
|
||||
|
||||
nsresult UpdatePosition();
|
||||
|
||||
CSSPoint AdjustTapToChildWidget(const CSSPoint& aPoint);
|
||||
|
||||
// Update state prior to routing an APZ-aware event to the child process.
|
||||
|
@ -595,6 +601,8 @@ private:
|
|||
// cursor. This happens whenever the cursor is in the tab's region.
|
||||
bool mTabSetsCursor;
|
||||
|
||||
nsRefPtr<nsIPresShell> mPresShellWithRefreshListener;
|
||||
|
||||
private:
|
||||
// This is used when APZ needs to find the TabParent associated with a layer
|
||||
// to dispatch events.
|
||||
|
|
|
@ -17,6 +17,8 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet'
|
|||
skip-if = toolkit != 'gonk'
|
||||
[test_NuwaProcessDeadlock.html]
|
||||
skip-if = toolkit != 'gonk'
|
||||
[test_NewUnmonitoredThread.html]
|
||||
skip-if = toolkit != 'gonk'
|
||||
[test_child_docshell.html]
|
||||
skip-if = toolkit == 'cocoa' # disabled due to hangs, see changeset 6852e7c47edf
|
||||
[test_CrashService_crash.html]
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test if Nuwa process created successfully.
|
||||
-->
|
||||
<head>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="setup()">
|
||||
|
||||
<script type="application/javascript;version=1.7">
|
||||
"use strict";
|
||||
|
||||
function runTest()
|
||||
{
|
||||
info("Launch the Nuwa process");
|
||||
let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsISyncMessageSender);
|
||||
let seenNuwaReady = false;
|
||||
let msgHandler = {
|
||||
receiveMessage: function receiveMessage(msg) {
|
||||
msg = SpecialPowers.wrap(msg);
|
||||
if (msg.name == 'TEST-ONLY:nuwa-ready') {
|
||||
ok(true, "Got nuwa-ready");
|
||||
is(seenNuwaReady, false, "Already received nuwa ready");
|
||||
seenNuwaReady = true;
|
||||
} else if (msg.name == 'TEST-ONLY:nuwa-add-new-process') {
|
||||
ok(true, "Got nuwa-add-new-process");
|
||||
is(seenNuwaReady, true, "Receive nuwa-add-new-process before nuwa-ready");
|
||||
shutdown();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function shutdown() {
|
||||
info("Shut down the test case");
|
||||
cpmm.removeMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
|
||||
cpmm.removeMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
cpmm.addMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
|
||||
cpmm.addMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
|
||||
|
||||
|
||||
// Setting this pref to true should cause us to prelaunch a process.
|
||||
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', true);
|
||||
}
|
||||
|
||||
function setup2()
|
||||
{
|
||||
info("Enable the Nuwa process to test the unmonitored thread");
|
||||
|
||||
SpecialPowers.pushPrefEnv({
|
||||
'set': [
|
||||
['dom.ipc.processPrelaunch.enabled', false],
|
||||
['dom.ipc.preallocatedProcessManager.testMode', true]
|
||||
]
|
||||
}, runTest);
|
||||
}
|
||||
|
||||
function setup()
|
||||
{
|
||||
info("Create an unmonitored thread.");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({
|
||||
'set': [
|
||||
// For testing NS_NewUnmonitoredThread()
|
||||
['dom.ipc.newUnmonitoredThread.testMode', true],
|
||||
]
|
||||
}, setup2);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/CheckedInt.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
#if !(defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)) || \
|
||||
defined(MOZ_ASAN)
|
||||
|
@ -28,8 +29,6 @@ using mozilla::CheckedUint64;
|
|||
using mozilla::CheckedInt32;
|
||||
using mozilla::CheckedUint32;
|
||||
|
||||
struct nsIntRect;
|
||||
|
||||
// This file contains stuff we'd rather put elsewhere, but which is
|
||||
// dependent on other changes which we don't want to wait for. We plan to
|
||||
// remove this file in the near future.
|
||||
|
|
|
@ -174,7 +174,7 @@ bool AndroidMediaReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
|||
|
||||
currentImage = bufferCallback.GetImage();
|
||||
int64_t pos = mDecoder->GetResource()->Tell();
|
||||
IntRect picture = ToIntRect(mPicture);
|
||||
IntRect picture = mPicture;
|
||||
|
||||
nsRefPtr<VideoData> v;
|
||||
if (currentImage) {
|
||||
|
|
|
@ -198,7 +198,7 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
|
|||
keyFrame = 0;
|
||||
}
|
||||
|
||||
gfx::IntRect picture = ToIntRect(mPicture);
|
||||
gfx::IntRect picture = mPicture;
|
||||
if (mFrameInfo.mWidth != mInitialFrame.width ||
|
||||
mFrameInfo.mHeight != mInitialFrame.height) {
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ PRLogModuleInfo* GetDemuxerLog();
|
|||
#define LOG(...)
|
||||
#endif
|
||||
|
||||
using mozilla::gfx::ToIntRect;
|
||||
using mozilla::layers::Image;
|
||||
using mozilla::layers::IMFYCbCrImage;
|
||||
using mozilla::layers::LayerManager;
|
||||
|
@ -404,7 +403,7 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
|
|||
VideoData::SetVideoDataToImage(image,
|
||||
mVideoInfo,
|
||||
b,
|
||||
ToIntRect(mPictureRegion),
|
||||
mPictureRegion,
|
||||
false);
|
||||
|
||||
nsRefPtr<VideoData> v =
|
||||
|
@ -416,7 +415,7 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
|
|||
image.forget(),
|
||||
false,
|
||||
-1,
|
||||
ToIntRect(mPictureRegion));
|
||||
mPictureRegion);
|
||||
|
||||
v.forget(aOutVideoData);
|
||||
return S_OK;
|
||||
|
@ -453,7 +452,7 @@ WMFVideoMFTManager::CreateD3DVideoFrame(IMFSample* aSample,
|
|||
image.forget(),
|
||||
false,
|
||||
-1,
|
||||
ToIntRect(mPictureRegion));
|
||||
mPictureRegion);
|
||||
|
||||
NS_ENSURE_TRUE(v, E_FAIL);
|
||||
v.forget(aOutVideoData);
|
||||
|
|
|
@ -890,7 +890,7 @@ nsresult OggReader::DecodeTheora(ogg_packet* aPacket, int64_t aTimeThreshold)
|
|||
b,
|
||||
isKeyframe,
|
||||
aPacket->granulepos,
|
||||
ToIntRect(mPicture));
|
||||
mPicture);
|
||||
if (!v) {
|
||||
// There may be other reasons for this error, but for
|
||||
// simplicity just assume the worst case: out of memory.
|
||||
|
|
|
@ -1645,7 +1645,7 @@ MediaCodecReader::UpdateVideoInfo()
|
|||
}
|
||||
|
||||
// Relative picture size
|
||||
gfx::IntRect relative_picture_rect = gfx::ToIntRect(picture_rect);
|
||||
gfx::IntRect relative_picture_rect = picture_rect;
|
||||
if (mVideoTrack.mWidth != mVideoTrack.mFrameSize.width ||
|
||||
mVideoTrack.mHeight != mVideoTrack.mFrameSize.height) {
|
||||
// Frame size is different from what the container reports. This is legal,
|
||||
|
|
|
@ -403,7 +403,7 @@ bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
|||
|
||||
aKeyframeSkip = false;
|
||||
|
||||
IntRect picture = ToIntRect(mPicture);
|
||||
IntRect picture = mPicture;
|
||||
if (frame.Y.mWidth != mInitialFrame.width ||
|
||||
frame.Y.mHeight != mInitialFrame.height) {
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
|||
b,
|
||||
1, // In raw video every frame is a keyframe
|
||||
-1,
|
||||
ToIntRect(mPicture));
|
||||
mPicture);
|
||||
if (!v)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
|
|||
b.mPlanes[2].mOffset = b.mPlanes[2].mSkip = 0;
|
||||
|
||||
nsIntRect pictureRect = mReader->GetPicture();
|
||||
IntRect picture = ToIntRect(pictureRect);
|
||||
IntRect picture = pictureRect;
|
||||
nsIntSize initFrame = mReader->GetInitialFrame();
|
||||
if (img->d_w != static_cast<uint32_t>(initFrame.width) ||
|
||||
img->d_h != static_cast<uint32_t>(initFrame.height)) {
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
#include "WMF.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
struct nsIntRect;
|
||||
#include "nsRect.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -747,7 +747,7 @@ WMFReader::CreateBasicVideoFrame(IMFSample* aSample,
|
|||
b,
|
||||
false,
|
||||
-1,
|
||||
ToIntRect(mPictureRegion));
|
||||
mPictureRegion);
|
||||
if (twoDBuffer) {
|
||||
twoDBuffer->Unlock2D();
|
||||
} else {
|
||||
|
@ -789,7 +789,7 @@ WMFReader::CreateD3DVideoFrame(IMFSample* aSample,
|
|||
image.forget(),
|
||||
false,
|
||||
-1,
|
||||
ToIntRect(mPictureRegion));
|
||||
mPictureRegion);
|
||||
|
||||
NS_ENSURE_TRUE(v, E_FAIL);
|
||||
v.forget(aOutVideoData);
|
||||
|
|
|
@ -167,6 +167,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "gMobileConnectionService",
|
|||
"@mozilla.org/mobileconnection/mobileconnectionservice;1",
|
||||
"nsIMobileConnectionService");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gNetworkService",
|
||||
"@mozilla.org/network/service;1",
|
||||
"nsINetworkService");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "MMS", function() {
|
||||
let MMS = {};
|
||||
Cu.import("resource://gre/modules/MmsPduHelper.jsm", MMS);
|
||||
|
@ -706,33 +710,38 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
|
|||
url = mmsConnection.mmsc;
|
||||
}
|
||||
|
||||
let startTransaction = () => {
|
||||
let startTransaction = netId => {
|
||||
if (DEBUG) debug("sendRequest: register proxy filter to " + url);
|
||||
let proxyFilter = new MmsProxyFilter(mmsConnection, url);
|
||||
gpps.registerFilter(proxyFilter, 0);
|
||||
|
||||
cancellable.xhr =
|
||||
this.sendHttpRequest(mmsConnection, method,
|
||||
url, istream, proxyFilter,
|
||||
url, istream, proxyFilter, netId,
|
||||
(aHttpStatus, aData) =>
|
||||
cancellable.done(aHttpStatus, aData));
|
||||
};
|
||||
|
||||
mmsConnection.ensureRouting(url)
|
||||
.then(() => startTransaction(),
|
||||
(aError) => {
|
||||
debug("Failed to ensureRouting: " + aError);
|
||||
let onRejected = aReason => {
|
||||
debug(aReason);
|
||||
mmsConnection.release();
|
||||
cancellable.done(_HTTP_STATUS_FAILED_TO_ROUTE, null);
|
||||
};
|
||||
|
||||
mmsConnection.release();
|
||||
cancellable.done(_HTTP_STATUS_FAILED_TO_ROUTE, null);
|
||||
});
|
||||
// TODO: |getNetId| will be implemented as a sync call in nsINetworkManager
|
||||
// once Bug 1141903 is landed.
|
||||
mmsConnection.ensureRouting(url)
|
||||
.then(() => gNetworkService.getNetId(mmsConnection.networkInterface.name),
|
||||
(aReason) => onRejected('Failed to ensureRouting: ' + aReason))
|
||||
.then((netId) => startTransaction(netId),
|
||||
(aReason) => onRejected('Failed to getNetId: ' + aReason));
|
||||
});
|
||||
|
||||
return cancellable;
|
||||
},
|
||||
|
||||
sendHttpRequest: function(mmsConnection, method, url, istream, proxyFilter,
|
||||
callback) {
|
||||
netId, callback) {
|
||||
let releaseMmsConnectionAndCallback = (httpStatus, data) => {
|
||||
gpps.unregisterFilter(proxyFilter);
|
||||
// Always release the MMS network connection before callback.
|
||||
|
@ -745,6 +754,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
|
|||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
|
||||
// Basic setups
|
||||
xhr.networkInterfaceId = netId;
|
||||
xhr.open(method, url, true);
|
||||
xhr.responseType = "arraybuffer";
|
||||
if (istream) {
|
||||
|
|
|
@ -613,6 +613,10 @@ Nfc.prototype = {
|
|||
message.target.sendAsyncMessage(nfcMsgType, message.data);
|
||||
},
|
||||
|
||||
getErrorMessage: function getErrorMessage(errorCode) {
|
||||
return NFC.NFC_ERROR_MSG[errorCode];
|
||||
},
|
||||
|
||||
/**
|
||||
* Process the incoming message from the NFC Service.
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define NfcService_h
|
||||
|
||||
#include "mozilla/ipc/Nfc.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINfcService.h"
|
||||
#include "NfcMessageHandler.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#endif
|
||||
|
||||
class nsIInputStream;
|
||||
struct nsIntRect;
|
||||
class nsPluginDOMContextMenuListener;
|
||||
class nsPluginFrame;
|
||||
class nsDisplayListBuilder;
|
||||
|
|
|
@ -26,7 +26,7 @@ using gfxIntSize from "nsSize.h";
|
|||
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
using nsIntRect from "nsRect.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
|
|
@ -3087,7 +3087,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect,
|
|||
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(aSurface);
|
||||
RefPtr<SourceSurface> surface =
|
||||
gfxPlatform::GetSourceSurfaceForSurface(dt, renderSurface);
|
||||
dt->CopySurface(surface, ToIntRect(aRect), ToIntPoint(aRect.TopLeft()));
|
||||
dt->CopySurface(surface, aRect, aRect.TopLeft());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3145,7 +3145,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
|||
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(whiteImage);
|
||||
RefPtr<SourceSurface> surface =
|
||||
gfxPlatform::GetSourceSurfaceForSurface(dt, aSurface);
|
||||
dt->CopySurface(surface, ToIntRect(rect), IntPoint());
|
||||
dt->CopySurface(surface, rect, IntPoint());
|
||||
}
|
||||
|
||||
// Paint the plugin directly onto the target, with a black
|
||||
|
@ -3191,7 +3191,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
|||
gfxPlatform::GetSourceSurfaceForSurface(dt, blackImage);
|
||||
dt->CopySurface(surface,
|
||||
IntRect(0, 0, rect.width, rect.height),
|
||||
ToIntPoint(rect.TopLeft()));
|
||||
rect.TopLeft());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3328,9 +3328,7 @@ PluginInstanceChild::ShowPluginFrame()
|
|||
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(surface);
|
||||
RefPtr<SourceSurface> backgroundSurface =
|
||||
gfxPlatform::GetSourceSurfaceForSurface(dt, mBackground);
|
||||
dt->CopySurface(backgroundSurface,
|
||||
ToIntRect(rect),
|
||||
ToIntPoint(rect.TopLeft()));
|
||||
dt->CopySurface(backgroundSurface, rect, rect.TopLeft());
|
||||
}
|
||||
// ... and hand off to the plugin
|
||||
// BEWARE: mBackground may die during this call
|
||||
|
@ -3463,7 +3461,7 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect)
|
|||
nsIntRegionRectIterator iter(result);
|
||||
const nsIntRect* r;
|
||||
while ((r = iter.Next()) != nullptr) {
|
||||
dt->CopySurface(source, ToIntRect(*r), ToIntPoint(r->TopLeft()));
|
||||
dt->CopySurface(source, *r, r->TopLeft());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
#include "nsError.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class gfxContext;
|
||||
class nsCString;
|
||||
struct nsIntRect;
|
||||
class nsNPAPIPlugin;
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
|
||||
#include "npapi.h"
|
||||
#include "mozilla/gfx/QuartzSupport.h"
|
||||
|
||||
struct nsIntRect;
|
||||
#include "nsRect.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "OpenFileFinder.h"
|
||||
#include "Volume.h"
|
||||
#include "VolumeManager.h"
|
||||
#include "nsIStatusReporter.h"
|
||||
|
||||
using namespace mozilla::hal;
|
||||
USING_MTP_NAMESPACE
|
||||
|
@ -259,6 +260,10 @@ public:
|
|||
}
|
||||
|
||||
void UpdateState();
|
||||
void GetStatus(bool& umsAvail, bool& umsConfigured, bool& umsEnabled, bool& mtpAvail,
|
||||
bool& mtpConfigured, bool& mtpEnabled, bool& rndisConfigured);
|
||||
|
||||
nsresult Dump(nsACString& desc);
|
||||
|
||||
void ConfigureUsbFunction(const char* aUsbFunc);
|
||||
|
||||
|
@ -459,6 +464,21 @@ private:
|
|||
static StaticRefPtr<AutoMounter> sAutoMounter;
|
||||
static StaticRefPtr<MozMtpServer> sMozMtpServer;
|
||||
|
||||
// The following is for status reporter
|
||||
enum STATE_REPORTER_STATE
|
||||
{
|
||||
REPORTER_UNREGISTERED,
|
||||
REPORTER_REGISTERED
|
||||
};
|
||||
|
||||
static int status_reporter_progress = REPORTER_UNREGISTERED;
|
||||
nsresult getState(nsACString &desc)
|
||||
{
|
||||
sAutoMounter->Dump(desc);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_STATUS_REPORTER_IMPLEMENT(AutoMounter, "AutoMounter", getState);
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
void
|
||||
|
@ -703,56 +723,12 @@ AutoMounter::UpdateState()
|
|||
//
|
||||
// Since IsUsbCablePluggedIn returns state == CONFIGURED, it will look
|
||||
// like a cable pull and replugin.
|
||||
|
||||
bool umsAvail = false;
|
||||
bool umsConfigured = false;
|
||||
bool umsEnabled = false;
|
||||
bool mtpAvail = false;
|
||||
bool mtpConfigured = false;
|
||||
bool mtpEnabled = false;
|
||||
bool rndisConfigured = false;
|
||||
bool umsAvail, umsConfigured, umsEnabled;
|
||||
bool mtpAvail, mtpConfigured, mtpEnabled;
|
||||
bool rndisConfigured;
|
||||
bool usbCablePluggedIn = IsUsbCablePluggedIn();
|
||||
|
||||
if (access(ICS_SYS_USB_FUNCTIONS, F_OK) == 0) {
|
||||
char functionsStr[60];
|
||||
if (!ReadSysFile(ICS_SYS_USB_FUNCTIONS, functionsStr, sizeof(functionsStr))) {
|
||||
ERR("Error reading file '%s': %s", ICS_SYS_USB_FUNCTIONS, strerror(errno));
|
||||
functionsStr[0] = '\0';
|
||||
}
|
||||
DBG("UpdateState: USB functions: '%s'", functionsStr);
|
||||
|
||||
bool usbConfigured = IsUsbConfigured();
|
||||
|
||||
// On the Nexus 4/5, it advertises that the UMS usb function is available,
|
||||
// but we have a further requirement that mass_storage be in the
|
||||
// persist.sys.usb.config property.
|
||||
char persistSysUsbConfig[PROPERTY_VALUE_MAX];
|
||||
property_get(PERSIST_SYS_USB_CONFIG, persistSysUsbConfig, "");
|
||||
if (IsUsbFunctionEnabled(persistSysUsbConfig, USB_FUNC_UMS)) {
|
||||
umsAvail = (access(ICS_SYS_UMS_DIRECTORY, F_OK) == 0);
|
||||
}
|
||||
if (umsAvail) {
|
||||
umsConfigured = usbConfigured && strstr(functionsStr, USB_FUNC_UMS) != nullptr;
|
||||
umsEnabled = (mMode == AUTOMOUNTER_ENABLE_UMS) ||
|
||||
((mMode == AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED) && umsConfigured);
|
||||
} else {
|
||||
umsConfigured = false;
|
||||
umsEnabled = false;
|
||||
}
|
||||
|
||||
mtpAvail = (access(ICS_SYS_MTP_DIRECTORY, F_OK) == 0);
|
||||
if (mtpAvail) {
|
||||
mtpConfigured = usbConfigured && strstr(functionsStr, USB_FUNC_MTP) != nullptr;
|
||||
mtpEnabled = (mMode == AUTOMOUNTER_ENABLE_MTP) ||
|
||||
((mMode == AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED) && mtpConfigured);
|
||||
} else {
|
||||
mtpConfigured = false;
|
||||
mtpEnabled = false;
|
||||
}
|
||||
|
||||
rndisConfigured = strstr(functionsStr, USB_FUNC_RNDIS) != nullptr;
|
||||
}
|
||||
|
||||
GetStatus(umsAvail, umsConfigured, umsEnabled, mtpAvail,
|
||||
mtpConfigured, mtpEnabled, rndisConfigured);
|
||||
bool enabled = mtpEnabled || umsEnabled;
|
||||
|
||||
if (mMode == AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED) {
|
||||
|
@ -1139,6 +1115,167 @@ AutoMounter::UpdateState()
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
void AutoMounter::GetStatus(bool& umsAvail, bool& umsConfigured, bool& umsEnabled,
|
||||
bool& mtpAvail, bool& mtpConfigured, bool& mtpEnabled,
|
||||
bool& rndisConfigured)
|
||||
{
|
||||
umsConfigured = false;
|
||||
umsEnabled = false;
|
||||
mtpAvail = false;
|
||||
mtpConfigured = false;
|
||||
mtpEnabled = false;
|
||||
rndisConfigured = false;
|
||||
|
||||
if (access(ICS_SYS_USB_FUNCTIONS, F_OK) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char functionsStr[60];
|
||||
if (!ReadSysFile(ICS_SYS_USB_FUNCTIONS, functionsStr, sizeof(functionsStr))) {
|
||||
ERR("Error reading file '%s': %s", ICS_SYS_USB_FUNCTIONS, strerror(errno));
|
||||
functionsStr[0] = '\0';
|
||||
}
|
||||
DBG("GetStatus: USB functions: '%s'", functionsStr);
|
||||
|
||||
bool usbConfigured = IsUsbConfigured();
|
||||
|
||||
// On the Nexus 4/5, it advertises that the UMS usb function is available,
|
||||
// but we have a further requirement that mass_storage be in the
|
||||
// persist.sys.usb.config property.
|
||||
char persistSysUsbConfig[PROPERTY_VALUE_MAX];
|
||||
property_get(PERSIST_SYS_USB_CONFIG, persistSysUsbConfig, "");
|
||||
if (IsUsbFunctionEnabled(persistSysUsbConfig, USB_FUNC_UMS)) {
|
||||
umsAvail = (access(ICS_SYS_UMS_DIRECTORY, F_OK) == 0);
|
||||
}
|
||||
if (umsAvail) {
|
||||
umsConfigured = usbConfigured && strstr(functionsStr, USB_FUNC_UMS) != nullptr;
|
||||
umsEnabled = (mMode == AUTOMOUNTER_ENABLE_UMS) ||
|
||||
((mMode == AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED) && umsConfigured);
|
||||
} else {
|
||||
umsConfigured = false;
|
||||
umsEnabled = false;
|
||||
}
|
||||
|
||||
mtpAvail = (access(ICS_SYS_MTP_DIRECTORY, F_OK) == 0);
|
||||
if (mtpAvail) {
|
||||
mtpConfigured = usbConfigured && strstr(functionsStr, USB_FUNC_MTP) != nullptr;
|
||||
mtpEnabled = (mMode == AUTOMOUNTER_ENABLE_MTP) ||
|
||||
((mMode == AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED) && mtpConfigured);
|
||||
} else {
|
||||
mtpConfigured = false;
|
||||
mtpEnabled = false;
|
||||
}
|
||||
|
||||
rndisConfigured = strstr(functionsStr, USB_FUNC_RNDIS) != nullptr;
|
||||
}
|
||||
|
||||
|
||||
nsresult AutoMounter::Dump(nsACString& desc)
|
||||
{
|
||||
DBG("GetState!");
|
||||
bool umsAvail, umsConfigured, umsEnabled;
|
||||
bool mtpAvail, mtpConfigured, mtpEnabled;
|
||||
bool rndisConfigured;
|
||||
GetStatus(umsAvail, umsConfigured, umsEnabled, mtpAvail,
|
||||
mtpConfigured, mtpEnabled, rndisConfigured);
|
||||
if (mMode == AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED) {
|
||||
// DISABLE_WHEN_UNPLUGGED implies already enabled.
|
||||
if (!IsUsbCablePluggedIn()) {
|
||||
mMode = AUTOMOUNTER_DISABLE;
|
||||
mtpEnabled = false;
|
||||
umsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Automounter information
|
||||
desc += "Current Mode:";
|
||||
desc += ModeStr(mMode);
|
||||
desc += "|";
|
||||
|
||||
|
||||
desc += "Current State:";
|
||||
desc += StateStr(mState);
|
||||
desc += "|";
|
||||
|
||||
desc += "UMS Status:";
|
||||
if (umsAvail) {
|
||||
desc += "Available";
|
||||
} else {
|
||||
desc += "UnAvailable";
|
||||
}
|
||||
desc += ",";
|
||||
if (umsConfigured) {
|
||||
desc += "Configured";
|
||||
} else {
|
||||
desc += "Un-Configured";
|
||||
}
|
||||
desc += ",";
|
||||
if (umsEnabled) {
|
||||
desc += "Enabled";
|
||||
} else {
|
||||
desc += "Disabled";
|
||||
}
|
||||
desc += "|";
|
||||
|
||||
|
||||
desc += "MTP Status:";
|
||||
if (mtpAvail) {
|
||||
desc += "Available";
|
||||
} else {
|
||||
desc += "UnAvailable";
|
||||
}
|
||||
desc += ",";
|
||||
if (mtpConfigured) {
|
||||
desc += "Configured";
|
||||
} else {
|
||||
desc += "Un-Configured";
|
||||
}
|
||||
desc += ",";
|
||||
if (mtpEnabled) {
|
||||
desc += "Enabled";
|
||||
} else {
|
||||
desc += "Disabled";
|
||||
}
|
||||
|
||||
|
||||
// Volume information
|
||||
VolumeArray::index_type volIndex;
|
||||
VolumeArray::size_type numVolumes = VolumeManager::NumVolumes();
|
||||
for (volIndex = 0; volIndex < numVolumes; volIndex++) {
|
||||
RefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
|
||||
|
||||
desc += "|";
|
||||
desc += vol->NameStr();
|
||||
desc += ":";
|
||||
desc += vol->StateStr();
|
||||
desc += "@";
|
||||
desc += vol->MountPoint().get();
|
||||
|
||||
if (!vol->MediaPresent()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (vol->CanBeShared()) {
|
||||
desc += ",CanBeShared";
|
||||
}
|
||||
if (vol->CanBeFormatted()) {
|
||||
desc += ",CanBeFormatted";
|
||||
}
|
||||
if (vol->CanBeMounted()) {
|
||||
desc += ",CanBeMounted";
|
||||
}
|
||||
if (vol->IsRemovable()) {
|
||||
desc += ",Removable";
|
||||
}
|
||||
if (vol->IsHotSwappable()) {
|
||||
desc += ",HotSwappable";
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
InitAutoMounterIOThread()
|
||||
{
|
||||
|
@ -1270,6 +1407,12 @@ InitAutoMounter()
|
|||
// start it here and have it send events to the AutoMounter running
|
||||
// on the IO Thread.
|
||||
sUsbCableObserver = new UsbCableObserver();
|
||||
|
||||
// Register status reporter into reporter manager
|
||||
if(status_reporter_progress == REPORTER_UNREGISTERED) {
|
||||
NS_RegisterStatusReporter(new NS_STATUS_REPORTER_NAME(AutoMounter));
|
||||
}
|
||||
status_reporter_progress = REPORTER_REGISTERED;
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
@ -1340,6 +1483,11 @@ ShutdownAutoMounter()
|
|||
if (sAutoMounter) {
|
||||
DBG("ShutdownAutoMounter: About to StopMtpServer");
|
||||
sAutoMounter->StopMtpServer();
|
||||
// Unregister status reporter into reporter manager
|
||||
if(status_reporter_progress == REPORTER_REGISTERED) {
|
||||
NS_UnregisterStatusReporter(new NS_STATUS_REPORTER_NAME(AutoMounter));
|
||||
}
|
||||
status_reporter_progress = REPORTER_UNREGISTERED;
|
||||
}
|
||||
sAutoMounterSetting = nullptr;
|
||||
sUsbCableObserver = nullptr;
|
||||
|
|
|
@ -277,48 +277,53 @@ NetworkManager.prototype = {
|
|||
switch (network.state) {
|
||||
case Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED:
|
||||
gNetworkService.createNetwork(network.name, () => {
|
||||
// Add host route for data calls
|
||||
if (this.isNetworkTypeMobile(network.type)) {
|
||||
let currentInterfaceLinks = this.networkInterfaceLinks[networkId];
|
||||
let newLinkRoutes = network.getDnses().concat(network.httpProxyHost);
|
||||
// If gateways have changed, remove all old routes first.
|
||||
this._handleGateways(networkId, network.getGateways())
|
||||
.then(() => this._updateRoutes(currentInterfaceLinks.linkRoutes,
|
||||
newLinkRoutes,
|
||||
network.getGateways(), network.name))
|
||||
.then(() => currentInterfaceLinks.setLinks(newLinkRoutes,
|
||||
network.getGateways(),
|
||||
network.name));
|
||||
}
|
||||
|
||||
// Remove pre-created default route and let setAndConfigureActive()
|
||||
// to set default route only on preferred network
|
||||
gNetworkService.removeDefaultRoute(network);
|
||||
|
||||
// Dun type is a special case where we add the default route to a
|
||||
// secondary table.
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.setSecondaryDefaultRoute(network);
|
||||
}
|
||||
|
||||
this._addSubnetRoutes(network);
|
||||
this.setAndConfigureActive();
|
||||
|
||||
// Update data connection when Wifi connected/disconnected
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI && this.mRil) {
|
||||
for (let i = 0; i < this.mRil.numRadioInterfaces; i++) {
|
||||
this.mRil.getRadioInterface(i).updateRILNetworkInterface();
|
||||
// Set DNS server as early as possible to prevent from
|
||||
// premature domain name lookup.
|
||||
gNetworkService.setDNS(network, () => {
|
||||
// Add host route for data calls
|
||||
if (this.isNetworkTypeMobile(network.type)) {
|
||||
let currentInterfaceLinks = this.networkInterfaceLinks[networkId];
|
||||
let newLinkRoutes = network.getDnses().concat(network.httpProxyHost);
|
||||
// If gateways have changed, remove all old routes first.
|
||||
this._handleGateways(networkId, network.getGateways())
|
||||
.then(() => this._updateRoutes(currentInterfaceLinks.linkRoutes,
|
||||
newLinkRoutes,
|
||||
network.getGateways(), network.name))
|
||||
.then(() => currentInterfaceLinks.setLinks(newLinkRoutes,
|
||||
network.getGateways(),
|
||||
network.name));
|
||||
}
|
||||
}
|
||||
|
||||
// Probing the public network accessibility after routing table is ready
|
||||
CaptivePortalDetectionHelper
|
||||
.notify(CaptivePortalDetectionHelper.EVENT_CONNECT, this.active);
|
||||
// Dun type is a special case where we add the default route to a
|
||||
// secondary table.
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.setSecondaryDefaultRoute(network);
|
||||
}
|
||||
|
||||
// Notify outer modules like MmsService to start the transaction after
|
||||
// the configuration of the network interface is done.
|
||||
Services.obs.notifyObservers(network, TOPIC_CONNECTION_STATE_CHANGED,
|
||||
this.convertConnectionType(network));
|
||||
this._addSubnetRoutes(network);
|
||||
this.setAndConfigureActive();
|
||||
|
||||
// Update data connection when Wifi connected/disconnected
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI && this.mRil) {
|
||||
for (let i = 0; i < this.mRil.numRadioInterfaces; i++) {
|
||||
this.mRil.getRadioInterface(i).updateRILNetworkInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// Probing the public network accessibility after routing table is ready
|
||||
CaptivePortalDetectionHelper
|
||||
.notify(CaptivePortalDetectionHelper.EVENT_CONNECT, this.active);
|
||||
|
||||
// Notify outer modules like MmsService to start the transaction after
|
||||
// the configuration of the network interface is done.
|
||||
Services.obs.notifyObservers(network, TOPIC_CONNECTION_STATE_CHANGED,
|
||||
this.convertConnectionType(network));
|
||||
});
|
||||
});
|
||||
|
||||
break;
|
||||
|
@ -641,7 +646,7 @@ NetworkManager.prototype = {
|
|||
// The override was just set, so reconfigure the network.
|
||||
if (this.active != this._overriddenActive) {
|
||||
this.active = this._overriddenActive;
|
||||
this._setDefaultRouteAndDNS(this.active, oldActive);
|
||||
this._setDefaultRouteAndProxy(this.active, oldActive);
|
||||
Services.obs.notifyObservers(this.active, TOPIC_ACTIVE_CHANGED, null);
|
||||
}
|
||||
return;
|
||||
|
@ -652,7 +657,7 @@ NetworkManager.prototype = {
|
|||
this.active.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED &&
|
||||
this.active.type == this._preferredNetworkType) {
|
||||
debug("Active network is already our preferred type.");
|
||||
this._setDefaultRouteAndDNS(this.active, oldActive);
|
||||
this._setDefaultRouteAndProxy(this.active, oldActive);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -686,10 +691,8 @@ NetworkManager.prototype = {
|
|||
this.active = defaultDataNetwork;
|
||||
}
|
||||
// Don't set default route on secondary APN
|
||||
if (this.isNetworkTypeSecondaryMobile(this.active.type)) {
|
||||
gNetworkService.setDNS(this.active, function() {});
|
||||
} else {
|
||||
this._setDefaultRouteAndDNS(this.active, oldActive);
|
||||
if (!this.isNetworkTypeSecondaryMobile(this.active.type)) {
|
||||
this._setDefaultRouteAndProxy(this.active, oldActive);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -713,44 +716,48 @@ NetworkManager.prototype = {
|
|||
return Promise.resolve([hostname]);
|
||||
}
|
||||
|
||||
let deferred = Promise.defer();
|
||||
let onLookupComplete = (aRequest, aRecord, aStatus) => {
|
||||
if (!Components.isSuccessCode(aStatus)) {
|
||||
deferred.reject(new Error(
|
||||
"Failed to resolve '" + hostname + "', with status: " + aStatus));
|
||||
return;
|
||||
}
|
||||
// Wrap gDNSService.asyncResolveExtended to a promise, which
|
||||
// resolves with an array of ip addresses or rejects with
|
||||
// the reason otherwise.
|
||||
let hostResolveWrapper = aNetId => {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
// Callback for gDNSService.asyncResolveExtended.
|
||||
let onLookupComplete = (aRequest, aRecord, aStatus) => {
|
||||
if (!Components.isSuccessCode(aStatus)) {
|
||||
aReject(new Error("Failed to resolve '" + hostname +
|
||||
"', with status: " + aStatus));
|
||||
return;
|
||||
}
|
||||
|
||||
let retval = [];
|
||||
while (aRecord.hasMore()) {
|
||||
retval.push(aRecord.getNextAddrAsString());
|
||||
}
|
||||
let retval = [];
|
||||
while (aRecord.hasMore()) {
|
||||
retval.push(aRecord.getNextAddrAsString());
|
||||
}
|
||||
|
||||
if (!retval.length) {
|
||||
deferred.reject(new Error("No valid address after DNS lookup!"));
|
||||
return;
|
||||
}
|
||||
if (!retval.length) {
|
||||
aReject(new Error("No valid address after DNS lookup!"));
|
||||
return;
|
||||
}
|
||||
|
||||
debug("hostname is resolved: " + hostname);
|
||||
debug("Addresses: " + JSON.stringify(retval));
|
||||
debug("hostname is resolved: " + hostname);
|
||||
debug("Addresses: " + JSON.stringify(retval));
|
||||
|
||||
deferred.resolve(retval);
|
||||
aResolve(retval);
|
||||
};
|
||||
|
||||
debug('Calling gDNSService.asyncResolveExtended: ' + aNetId + ', ' + hostname);
|
||||
gDNSService.asyncResolveExtended(hostname,
|
||||
0,
|
||||
aNetId,
|
||||
onLookupComplete,
|
||||
Services.tm.mainThread);
|
||||
});
|
||||
};
|
||||
|
||||
// Bug 1058282 - Explicitly request ipv4 to get around 8.8.8.8 probe at
|
||||
// http://androidxref.com/4.3_r2.1/xref/bionic/libc/netbsd/net/getaddrinfo.c#1923
|
||||
//
|
||||
// Whenever MMS connection is the only network interface, there is no
|
||||
// default route so that any ip probe will fail.
|
||||
let flags = 0;
|
||||
if (network.type === Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
|
||||
flags |= Ci.nsIDNSService.RESOLVE_DISABLE_IPV6;
|
||||
}
|
||||
|
||||
// TODO: Bug 992772 - Resolve the hostname with specified networkInterface.
|
||||
gDNSService.asyncResolve(hostname, flags, onLookupComplete, Services.tm.mainThread);
|
||||
|
||||
return deferred.promise;
|
||||
// TODO: |getNetId| will be implemented as a sync call in nsINetworkManager
|
||||
// once Bug 1141903 is landed.
|
||||
return gNetworkService.getNetId(network.name)
|
||||
.then(aNetId => hostResolveWrapper(aNetId));
|
||||
},
|
||||
|
||||
convertConnectionType: function(network) {
|
||||
|
@ -774,15 +781,13 @@ NetworkManager.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_setDefaultRouteAndDNS: function(network, oldInterface) {
|
||||
_setDefaultRouteAndProxy: function(network, oldInterface) {
|
||||
gNetworkService.setDefaultRoute(network, oldInterface, function(success) {
|
||||
if (!success) {
|
||||
gNetworkService.destroyNetwork(network, function() {});
|
||||
return;
|
||||
}
|
||||
gNetworkService.setDNS(network, function(result) {
|
||||
gNetworkService.setNetworkProxy(network);
|
||||
});
|
||||
gNetworkService.setNetworkProxy(network);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -391,7 +391,8 @@ NetworkService.prototype = {
|
|||
cmd: "setDNS",
|
||||
ifname: networkInterface.name,
|
||||
domain: "mozilla." + networkInterface.name + ".doman",
|
||||
dnses: dnses
|
||||
dnses: dnses,
|
||||
gateways: networkInterface.getGateways()
|
||||
};
|
||||
this.controlMessage(options, function(result) {
|
||||
callback.setDnsResult(result.success ? null : result.reason);
|
||||
|
@ -762,6 +763,23 @@ NetworkService.prototype = {
|
|||
callback.nativeCommandResult(!result.error);
|
||||
});
|
||||
},
|
||||
|
||||
getNetId: function(interfaceName) {
|
||||
let params = {
|
||||
cmd: "getNetId",
|
||||
ifname: interfaceName
|
||||
};
|
||||
|
||||
return new Promise((aResolve, aReject) => {
|
||||
this.controlMessage(params, result => {
|
||||
if (result.error) {
|
||||
aReject(result.reason);
|
||||
return;
|
||||
}
|
||||
aResolve(result.netId);
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([NetworkService]);
|
||||
|
|
|
@ -440,7 +440,6 @@ CommandResult::CommandResult(int32_t aResultCode)
|
|||
strerror_r(abs(aResultCode), strerrorBuf, STRERROR_R_BUF_SIZE);
|
||||
mResult.mReason = NS_ConvertUTF8toUTF16(strerrorBuf);
|
||||
}
|
||||
mResult.mRet = true;
|
||||
}
|
||||
|
||||
CommandResult::CommandResult(const mozilla::dom::NetworkResultOptions& aResult)
|
||||
|
@ -1535,6 +1534,7 @@ void NetworkUtils::ExecuteCommand(NetworkParams aOptions)
|
|||
BUILD_ENTRY(resetConnections),
|
||||
BUILD_ENTRY(createNetwork),
|
||||
BUILD_ENTRY(destroyNetwork),
|
||||
BUILD_ENTRY(getNetId),
|
||||
|
||||
#undef BUILD_ENTRY
|
||||
};
|
||||
|
@ -1704,6 +1704,7 @@ CommandResult NetworkUtils::setDNS(NetworkParams& aOptions)
|
|||
// Lollipop.
|
||||
static CommandFunc COMMAND_CHAIN[] = {
|
||||
setInterfaceDns,
|
||||
addDefaultRouteToNetwork,
|
||||
defaultAsyncSuccessHandler
|
||||
};
|
||||
NetIdManager::NetIdInfo netIdInfo;
|
||||
|
@ -1717,7 +1718,12 @@ CommandResult NetworkUtils::setDNS(NetworkParams& aOptions)
|
|||
if (SDK_VERSION >= 18) {
|
||||
// JB, KK.
|
||||
static CommandFunc COMMAND_CHAIN[] = {
|
||||
#if ANDROID_VERSION == 18
|
||||
// Since we don't use per-interface DNS lookup feature on JB,
|
||||
// we need to set the default DNS interface whenever setting the
|
||||
// DNS name server.
|
||||
setDefaultInterface,
|
||||
#endif
|
||||
setInterfaceDns,
|
||||
defaultAsyncSuccessHandler
|
||||
};
|
||||
|
@ -1898,6 +1904,17 @@ CommandResult NetworkUtils::setDefaultRouteLegacy(NetworkParams& aOptions)
|
|||
}
|
||||
}
|
||||
|
||||
// Set the default DNS interface.
|
||||
if (SDK_VERSION >= 18) {
|
||||
// For JB, KK only.
|
||||
static CommandFunc COMMAND_CHAIN[] = {
|
||||
setDefaultInterface,
|
||||
defaultAsyncSuccessHandler
|
||||
};
|
||||
runChain(aOptions, COMMAND_CHAIN, setDnsFail);
|
||||
return CommandResult::Pending();
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2516,6 +2533,27 @@ CommandResult NetworkUtils::destroyNetwork(NetworkParams& aOptions)
|
|||
return CommandResult::Pending();
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the netId associated with the given network interface name.
|
||||
*/
|
||||
CommandResult NetworkUtils::getNetId(NetworkParams& aOptions)
|
||||
{
|
||||
NetworkResultOptions result;
|
||||
|
||||
if (SDK_VERSION < 20) {
|
||||
// For pre-Lollipop, use the interface name as the fallback.
|
||||
result.mNetId = GET_FIELD(mIfname);
|
||||
return result;
|
||||
}
|
||||
|
||||
NetIdManager::NetIdInfo netIdInfo;
|
||||
if (-1 == mNetIdManager.lookup(GET_FIELD(mIfname), &netIdInfo)) {
|
||||
return ESRCH;
|
||||
}
|
||||
result.mNetId.AppendInt(netIdInfo.mNetId, 10);
|
||||
return result;
|
||||
}
|
||||
|
||||
void NetworkUtils::sendBroadcastMessage(uint32_t code, char* reason)
|
||||
{
|
||||
NetworkResultOptions result;
|
||||
|
|
|
@ -309,6 +309,7 @@ private:
|
|||
CommandResult updateUpStream(NetworkParams& aOptions);
|
||||
CommandResult createNetwork(NetworkParams& aOptions);
|
||||
CommandResult destroyNetwork(NetworkParams& aOptions);
|
||||
CommandResult getNetId(NetworkParams& aOptions);
|
||||
|
||||
CommandResult addHostRouteLegacy(NetworkParams& aOptions);
|
||||
CommandResult removeHostRouteLegacy(NetworkParams& aOptions);
|
||||
|
|
|
@ -159,7 +159,7 @@ interface nsIDhcpRequestCallback : nsISupports
|
|||
/**
|
||||
* Provide network services.
|
||||
*/
|
||||
[scriptable, uuid(e40dd966-cb04-4dc7-ac4b-6382769c00b9)]
|
||||
[scriptable, uuid(a0f29630-c25c-11e4-8830-0800200c9a66)]
|
||||
interface nsINetworkService : nsISupports
|
||||
{
|
||||
const long MODIFY_ROUTE_ADD = 0;
|
||||
|
@ -486,4 +486,17 @@ interface nsINetworkService : nsISupports
|
|||
*/
|
||||
void destroyNetwork(in DOMString interfaceName,
|
||||
in nsINativeCommandCallback callback);
|
||||
|
||||
/**
|
||||
* Query the netId associated with given network interface name.
|
||||
*
|
||||
* @param interfaceName
|
||||
* The network interface name which we want to query.
|
||||
*
|
||||
* @return A deferred promise that resolves with a string to indicate.
|
||||
* the queried netId on success and rejects if the interface name
|
||||
* is invalid.
|
||||
*
|
||||
*/
|
||||
jsval getNetId(in DOMString interfaceName);
|
||||
};
|
||||
|
|
|
@ -9,13 +9,11 @@
|
|||
optional BluetoothAttributeEventInit eventInitDict)]
|
||||
interface BluetoothAttributeEvent : Event
|
||||
{
|
||||
readonly attribute any attrs;
|
||||
// We don't support sequence in event codegen yet (Bug 1023762)
|
||||
// Bug 1015796:
|
||||
// readonly attribute sequence<DOMString> attrs;
|
||||
[Cached, Constant]
|
||||
readonly attribute sequence<DOMString> attrs;
|
||||
};
|
||||
|
||||
dictionary BluetoothAttributeEventInit : EventInit
|
||||
{
|
||||
any attrs = null;
|
||||
required sequence<DOMString> attrs;
|
||||
};
|
||||
|
|
|
@ -96,4 +96,6 @@ dictionary NetworkResultOptions
|
|||
long dns1 = 0;
|
||||
long dns2 = 0;
|
||||
long server = 0;
|
||||
|
||||
DOMString netId = ""; // for "getNetId".
|
||||
};
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
|
@ -477,17 +476,34 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
|
|||
nsFocusManager::GetFocusedDescendant(windowToCheck, true, getter_AddRefs(focusedWindow));
|
||||
}
|
||||
|
||||
// If the focus is in an editable region, don't scroll.
|
||||
if (focusedContent->IsEditable()) {
|
||||
return NS_OK;
|
||||
}
|
||||
bool isLink = false;
|
||||
nsIContent *content = focusedContent;
|
||||
|
||||
// If the focus is in a form control, don't scroll.
|
||||
for (nsIContent* c = focusedContent; c; c = c->GetParent()) {
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(c);
|
||||
if (formControl) {
|
||||
return NS_OK;
|
||||
// if the focused element is a link then we do want space to
|
||||
// scroll down. The focused element may be an element in a link,
|
||||
// we need to check the parent node too. Only do this check if an
|
||||
// element is focused and has a parent.
|
||||
if (focusedContent && focusedContent->GetParent()) {
|
||||
while (content) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::a)) {
|
||||
isLink = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (content->HasAttr(kNameSpaceID_XLink, nsGkAtoms::type)) {
|
||||
isLink = content->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
nsGkAtoms::simple, eCaseMatters);
|
||||
|
||||
if (isLink) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
content = content->GetParent();
|
||||
}
|
||||
|
||||
if (!isLink)
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<button>Button</button>
|
||||
<img src="green.png" usemap="#map">
|
||||
<map name="map">
|
||||
<!-- This URL ensures that the link doesn't get clicked, since
|
||||
mochitests cannot access the outside network. -->
|
||||
<area shape="rect" coords="0,0,10,10" href="https://youtube.com/">
|
||||
</map>
|
||||
<div style="height: 20000px;" tabindex="-1"><hr></div>
|
||||
</body>
|
||||
</html>
|
|
@ -9,7 +9,6 @@ support-files =
|
|||
file_bug549262.html
|
||||
file_bug586662.html
|
||||
file_bug674770-1.html
|
||||
file_bug915962.html
|
||||
file_select_all_without_body.html
|
||||
green.png
|
||||
spellcheck.js
|
||||
|
@ -138,8 +137,6 @@ skip-if = toolkit == 'android' || e10s
|
|||
[test_bug832025.html]
|
||||
[test_bug857487.html]
|
||||
[test_bug858918.html]
|
||||
[test_bug915962.html]
|
||||
skip-if = toolkit == 'android' || e10s
|
||||
[test_bug966155.html]
|
||||
skip-if = os != "win"
|
||||
[test_bug966552.html]
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=915962
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 915962</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915962">Mozilla Bug 915962</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 915962 **/
|
||||
|
||||
var smoothScrollPref = "general.smoothScroll";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var win = window.open("file_bug915962.html", "_blank",
|
||||
"width=600,height=600,scrollbars=yes");
|
||||
|
||||
// grab the timer right at the start
|
||||
var cwu = SpecialPowers.getDOMWindowUtils(win);
|
||||
function step() {
|
||||
cwu.advanceTimeAndRefresh(100);
|
||||
}
|
||||
SimpleTest.waitForFocus(function() {
|
||||
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest);
|
||||
}, win);
|
||||
function startTest() {
|
||||
// Make sure that pressing Space when a tabindex=-1 element is focused
|
||||
// will scroll the page.
|
||||
var button = win.document.querySelector("button");
|
||||
var sc = win.document.querySelector("div");
|
||||
sc.focus();
|
||||
is(win.scrollY, 0, "Sanity check");
|
||||
synthesizeKey(" ", {}, win);
|
||||
|
||||
step();
|
||||
|
||||
isnot(win.scrollY, 0, "Page is scrolled down");
|
||||
var oldY = win.scrollY;
|
||||
synthesizeKey(" ", {shiftKey: true}, win);
|
||||
|
||||
step();
|
||||
|
||||
ok(win.scrollY < oldY, "Page is scrolled up");
|
||||
|
||||
// Make sure that pressing Space when a tabindex=-1 element is focused
|
||||
// will not scroll the page, and will activate the element.
|
||||
button.focus();
|
||||
var clicked = false;
|
||||
button.onclick = () => clicked = true;
|
||||
oldY = win.scrollY;
|
||||
synthesizeKey(" ", {}, win);
|
||||
|
||||
step();
|
||||
|
||||
ok(win.scrollY <= oldY, "Page is not scrolled down");
|
||||
ok(clicked, "The button should be clicked");
|
||||
synthesizeKey("VK_TAB", {}, win);
|
||||
|
||||
step();
|
||||
|
||||
oldY = win.scrollY;
|
||||
synthesizeKey(" ", {}, win);
|
||||
|
||||
step()
|
||||
|
||||
ok(win.scrollY >= oldY, "Page is scrolled down");
|
||||
|
||||
win.close();
|
||||
cwu.restoreNormalRefresh();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -77,7 +77,7 @@ skip-if(B2G||Mulet) fails-if(Android) needs-focus != spellcheck-hyphen-multiple-
|
|||
== unneeded_scroll.html unneeded_scroll-ref.html
|
||||
skip-if(B2G||Mulet) == caret_on_presshell_reinit.html caret_on_presshell_reinit-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) == caret_on_presshell_reinit-2.html caret_on_presshell_reinit-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) == 642800.html 642800-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) skip-if(asyncPanZoom&&winWidget) == 642800.html 642800-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
== selection_visibility_after_reframe.html selection_visibility_after_reframe-ref.html
|
||||
!= selection_visibility_after_reframe-2.html selection_visibility_after_reframe-ref.html
|
||||
!= selection_visibility_after_reframe-3.html selection_visibility_after_reframe-ref.html
|
||||
|
|
|
@ -6,10 +6,14 @@
|
|||
#ifndef MOZILLA_GFX_NUMERICTOOLS_H_
|
||||
#define MOZILLA_GFX_NUMERICTOOLS_H_
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// XXX - Move these into mfbt/MathAlgorithms.h?
|
||||
|
||||
// Returns the largest multiple of aMultiplied that's <= x.
|
||||
// Same as int32_t(floor(double(x) / aMultiplier)) * aMultiplier,
|
||||
// but faster.
|
||||
static int32_t
|
||||
inline int32_t
|
||||
RoundDownToMultiple(int32_t x, int32_t aMultiplier)
|
||||
{
|
||||
// We don't use float division + floor because that's hard for the compiler
|
||||
|
@ -24,7 +28,7 @@ RoundDownToMultiple(int32_t x, int32_t aMultiplier)
|
|||
// Returns the smallest multiple of aMultiplied that's >= x.
|
||||
// Same as int32_t(ceil(double(x) / aMultiplier)) * aMultiplier,
|
||||
// but faster.
|
||||
static int32_t
|
||||
inline int32_t
|
||||
RoundUpToMultiple(int32_t x, int32_t aMultiplier)
|
||||
{
|
||||
int mod = x % aMultiplier;
|
||||
|
@ -34,4 +38,6 @@ RoundUpToMultiple(int32_t x, int32_t aMultiplier)
|
|||
return x - mod;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* MOZILLA_GFX_NUMERICTOOLS_H_ */
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "BaseRect.h"
|
||||
#include "BaseMargin.h"
|
||||
#include "NumericTools.h"
|
||||
#include "Point.h"
|
||||
#include "Tools.h"
|
||||
|
||||
|
@ -105,6 +106,21 @@ struct IntRectTyped :
|
|||
{
|
||||
return IntRectTyped<units>::IsEqualEdges(aRect);
|
||||
}
|
||||
|
||||
void InflateToMultiple(const IntSizeTyped<units>& aTileSize)
|
||||
{
|
||||
int32_t yMost = this->YMost();
|
||||
int32_t xMost = this->XMost();
|
||||
|
||||
this->x = mozilla::RoundDownToMultiple(this->x, aTileSize.width);
|
||||
this->y = mozilla::RoundDownToMultiple(this->y, aTileSize.height);
|
||||
xMost = mozilla::RoundUpToMultiple(xMost, aTileSize.width);
|
||||
yMost = mozilla::RoundUpToMultiple(yMost, aTileSize.height);
|
||||
|
||||
this->width = xMost - this->x;
|
||||
this->height = yMost - this->y;
|
||||
}
|
||||
|
||||
};
|
||||
typedef IntRectTyped<UnknownUnits> IntRect;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
|
|||
const gfx::IntPoint* aSrcPoint)
|
||||
{
|
||||
nsIntRegion destRegion = aDestRegion ? *aDestRegion
|
||||
: nsIntRect(0, 0,
|
||||
: IntRect(0, 0,
|
||||
aSurface->GetSize().width,
|
||||
aSurface->GetSize().height);
|
||||
gfx::IntPoint srcPoint = aSrcPoint ? *aSrcPoint
|
||||
|
@ -120,13 +120,13 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
|
|||
if (CanUploadSubTextures(mGLContext)) {
|
||||
GetUpdateRegion(aRegion);
|
||||
} else {
|
||||
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
|
||||
aRegion = IntRect(IntPoint(0, 0), mSize);
|
||||
}
|
||||
|
||||
mUpdateRegion = aRegion;
|
||||
|
||||
nsIntRect rgnSize = mUpdateRegion.GetBounds();
|
||||
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(rgnSize)) {
|
||||
IntRect rgnSize = mUpdateRegion.GetBounds();
|
||||
if (!IntRect(IntPoint(0, 0), mSize).Contains(rgnSize)) {
|
||||
NS_ERROR("update outside of image");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ BasicTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
|
|||
// changed, we need to recreate our backing surface and force the
|
||||
// client to paint everything
|
||||
if (mTextureState != Valid) {
|
||||
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
|
||||
aForRegion = IntRect(IntPoint(0, 0), mSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,10 +205,10 @@ BasicTextureImage::FinishedSurfaceUpload()
|
|||
bool
|
||||
BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0, 0) */)
|
||||
{
|
||||
nsIntRect bounds = aRegion.GetBounds();
|
||||
IntRect bounds = aRegion.GetBounds();
|
||||
nsIntRegion region;
|
||||
if (mTextureState != Valid) {
|
||||
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
|
||||
bounds = IntRect(0, 0, mSize.width, mSize.height);
|
||||
region = nsIntRegion(bounds);
|
||||
} else {
|
||||
region = aRegion;
|
||||
|
@ -220,7 +220,7 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
|
|||
region,
|
||||
mTexture,
|
||||
mTextureState == Created,
|
||||
bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y),
|
||||
bounds.TopLeft() + IntPoint(aFrom.x, aFrom.y),
|
||||
false);
|
||||
mTextureState = Valid;
|
||||
return true;
|
||||
|
@ -345,7 +345,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
|
|||
nsIntRegion region;
|
||||
|
||||
if (mTextureState != Valid) {
|
||||
nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height);
|
||||
IntRect bounds = IntRect(0, 0, mSize.width, mSize.height);
|
||||
region = nsIntRegion(bounds);
|
||||
} else {
|
||||
region = aRegion;
|
||||
|
@ -355,7 +355,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
|
|||
int oldCurrentImage = mCurrentImage;
|
||||
BeginBigImageIteration();
|
||||
do {
|
||||
nsIntRect tileRect = ThebesIntRect(GetSrcTileRect());
|
||||
IntRect tileRect = GetSrcTileRect();
|
||||
int xPos = tileRect.x;
|
||||
int yPos = tileRect.y;
|
||||
|
||||
|
@ -400,7 +400,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
|
|||
// if the texture hasn't been initialized yet, or something important
|
||||
// changed, we need to recreate our backing surface and force the
|
||||
// client to paint everything
|
||||
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
|
||||
aForRegion = IntRect(IntPoint(0, 0), mSize);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
|
|||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||
int xPos = (i % mColumns) * mTileSize;
|
||||
int yPos = (i / mColumns) * mTileSize;
|
||||
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
|
||||
IntRect imageRect = IntRect(IntPoint(xPos,yPos),
|
||||
mImages[i]->GetSize());
|
||||
|
||||
if (aForRegion.Intersects(imageRect)) {
|
||||
|
@ -446,16 +446,16 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion)
|
|||
// if the texture hasn't been initialized yet, or something important
|
||||
// changed, we need to recreate our backing surface and force the
|
||||
// client to paint everything
|
||||
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
|
||||
aRegion = IntRect(IntPoint(0, 0), mSize);
|
||||
}
|
||||
|
||||
nsIntRect bounds = aRegion.GetBounds();
|
||||
IntRect bounds = aRegion.GetBounds();
|
||||
|
||||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||
int xPos = (i % mColumns) * mTileSize;
|
||||
int yPos = (i / mColumns) * mTileSize;
|
||||
nsIntRegion imageRegion =
|
||||
nsIntRegion(nsIntRect(nsIntPoint(xPos,yPos),
|
||||
nsIntRegion(IntRect(IntPoint(xPos,yPos),
|
||||
mImages[i]->GetSize()));
|
||||
|
||||
// a single Image can handle this update request
|
||||
|
@ -510,8 +510,7 @@ TiledTextureImage::EndUpdate()
|
|||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||
int xPos = (i % mColumns) * mTileSize;
|
||||
int yPos = (i / mColumns) * mTileSize;
|
||||
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
|
||||
mImages[i]->GetSize());
|
||||
IntRect imageRect = IntRect(IntPoint(xPos,yPos), mImages[i]->GetSize());
|
||||
|
||||
nsIntRegion subregion;
|
||||
subregion.And(mUpdateRegion, imageRect);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче