зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1610570) for causing gamepad related bustages. CLOSED TREE
Backed out changeset 047120786a91 (bug 1610570) Backed out changeset e2ef5d146d6a (bug 1610570) Backed out changeset 6594ce800a6b (bug 1610570) Backed out changeset 8d78b75b87fc (bug 1610570)
This commit is contained in:
Родитель
f29929310e
Коммит
b202667e72
|
@ -17,8 +17,9 @@ void StartGamepadMonitoring();
|
|||
void StopGamepadMonitoring();
|
||||
void SetGamepadLightIndicatorColor(const Tainted<GamepadHandle>& aGamepadHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex,
|
||||
const uint8_t& aRed, const uint8_t& aGreen,
|
||||
const uint8_t& aBlue);
|
||||
const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen,
|
||||
const Tainted<uint8_t>& aBlue);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -109,8 +109,9 @@ void StopGamepadMonitoring() {
|
|||
|
||||
void SetGamepadLightIndicatorColor(const Tainted<GamepadHandle>& aGamepadHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex,
|
||||
const uint8_t& aRed, const uint8_t& aGreen,
|
||||
const uint8_t& aBlue) {
|
||||
const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen,
|
||||
const Tainted<uint8_t>& aBlue) {
|
||||
NS_WARNING("Android doesn't support gamepad light indicator.");
|
||||
}
|
||||
|
||||
|
|
|
@ -213,8 +213,9 @@ class DarwinGamepadService {
|
|||
void Shutdown();
|
||||
void SetLightIndicatorColor(const Tainted<GamepadHandle>& aGamepadHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex,
|
||||
const uint8_t& aRed, const uint8_t& aGreen,
|
||||
const uint8_t& aBlue);
|
||||
const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen,
|
||||
const Tainted<uint8_t>& aBlue);
|
||||
friend class DarwinGamepadServiceStartupRunnable;
|
||||
friend class DarwinGamepadServiceShutdownRunnable;
|
||||
};
|
||||
|
@ -572,8 +573,8 @@ void DarwinGamepadService::Shutdown() {
|
|||
|
||||
void DarwinGamepadService::SetLightIndicatorColor(
|
||||
const Tainted<GamepadHandle>& aGamepadHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex, const uint8_t& aRed,
|
||||
const uint8_t& aGreen, const uint8_t& aBlue) {
|
||||
const Tainted<uint32_t>& aLightColorIndex, const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen, const Tainted<uint8_t>& aBlue) {
|
||||
// We get aControllerIdx from GamepadPlatformService::AddGamepad(),
|
||||
// It begins from 1 and is stored at Gamepad.id.
|
||||
const Gamepad* gamepad = MOZ_FIND_AND_VALIDATE(
|
||||
|
@ -592,7 +593,13 @@ void DarwinGamepadService::SetLightIndicatorColor(
|
|||
}
|
||||
|
||||
std::vector<uint8_t> report;
|
||||
remapper->GetLightColorReport(aRed, aGreen, aBlue, report);
|
||||
remapper->GetLightColorReport(
|
||||
MOZ_NO_VALIDATE(aRed, "uint8_t's range is the range of all valid values"),
|
||||
MOZ_NO_VALIDATE(aGreen,
|
||||
"uint8_t's range is the range of all valid values"),
|
||||
MOZ_NO_VALIDATE(aBlue,
|
||||
"uint8_t's range is the range of all valid values"),
|
||||
report);
|
||||
gamepad->WriteOutputReport(report);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,13 @@ void GamepadEventChannelParent::ActorDestroy(ActorDestroyReason aWhy) {
|
|||
mozilla::ipc::IPCResult GamepadEventChannelParent::RecvVibrateHaptic(
|
||||
const Tainted<GamepadHandle>& aHandle,
|
||||
const Tainted<uint32_t>& aHapticIndex, const Tainted<double>& aIntensity,
|
||||
const Tainted<double>& aDuration, const uint32_t& aPromiseID) {
|
||||
const Tainted<double>& aDuration, const Tainted<uint32_t>& aPromiseID) {
|
||||
// TODO: Bug 680289, implement for standard gamepads
|
||||
|
||||
if (SendReplyGamepadPromise(aPromiseID)) {
|
||||
// TODO: simplify tainted validation, see 1610570
|
||||
if (SendReplyGamepadPromise(MOZ_NO_VALIDATE(
|
||||
aPromiseID,
|
||||
"This value is unused aside from being passed back to the child."))) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -89,11 +92,15 @@ mozilla::ipc::IPCResult GamepadEventChannelParent::RecvStopVibrateHaptic(
|
|||
|
||||
mozilla::ipc::IPCResult GamepadEventChannelParent::RecvLightIndicatorColor(
|
||||
const Tainted<GamepadHandle>& aHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex, const uint8_t& aRed,
|
||||
const uint8_t& aGreen, const uint8_t& aBlue, const uint32_t& aPromiseID) {
|
||||
const Tainted<uint32_t>& aLightColorIndex, const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen, const Tainted<uint8_t>& aBlue,
|
||||
const Tainted<uint32_t>& aPromiseID) {
|
||||
SetGamepadLightIndicatorColor(aHandle, aLightColorIndex, aRed, aGreen, aBlue);
|
||||
|
||||
if (SendReplyGamepadPromise(aPromiseID)) {
|
||||
// TODO: simplify tainted validation, see 1610570
|
||||
if (SendReplyGamepadPromise(MOZ_NO_VALIDATE(
|
||||
aPromiseID,
|
||||
"This value is unused aside from being passed back to the child."))) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,14 @@ class GamepadEventChannelParent final : public PGamepadEventChannelParent {
|
|||
mozilla::ipc::IPCResult RecvVibrateHaptic(
|
||||
const Tainted<GamepadHandle>& aHandle,
|
||||
const Tainted<uint32_t>& aHapticIndex, const Tainted<double>& aIntensity,
|
||||
const Tainted<double>& aDuration, const uint32_t& aPromiseID);
|
||||
const Tainted<double>& aDuration, const Tainted<uint32_t>& aPromiseID);
|
||||
mozilla::ipc::IPCResult RecvStopVibrateHaptic(
|
||||
const Tainted<GamepadHandle>& aHandle);
|
||||
mozilla::ipc::IPCResult RecvLightIndicatorColor(
|
||||
const Tainted<GamepadHandle>& aHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex, const uint8_t& aRed,
|
||||
const uint8_t& aGreen, const uint8_t& aBlue, const uint32_t& aPromiseID);
|
||||
const Tainted<uint32_t>& aLightColorIndex, const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen, const Tainted<uint8_t>& aBlue,
|
||||
const Tainted<uint32_t>& aPromiseID);
|
||||
void DispatchUpdateEvent(const GamepadChangeEvent& aEvent);
|
||||
|
||||
GamepadEventChannelParent(const GamepadEventChannelParent&) = delete;
|
||||
|
|
|
@ -16,11 +16,10 @@ refcounted protocol PGamepadEventChannel {
|
|||
async __delete__();
|
||||
|
||||
[Tainted] async VibrateHaptic(GamepadHandle aHandle, uint32_t aHapticIndex,
|
||||
double aIntensity, double aDuration, [NoTaint=passback] uint32_t aPromiseID);
|
||||
double aIntensity, double aDuration, uint32_t aPromiseID);
|
||||
[Tainted] async StopVibrateHaptic(GamepadHandle aHandle);
|
||||
[Tainted] async LightIndicatorColor(GamepadHandle aHandle, uint32_t aLightColorIndex,
|
||||
[NoTaint=allvalid] uint8_t aRed, [NoTaint=allvalid] uint8_t aGreen,
|
||||
[NoTaint=allvalid] uint8_t aBlue, [NoTaint=passback] uint32_t aPromiseID);
|
||||
uint8_t aRed, uint8_t aGreen, uint8_t aBlue, uint32_t aPromiseID);
|
||||
|
||||
child:
|
||||
async GamepadUpdate(GamepadChangeEvent aGamepadEvent);
|
||||
|
|
|
@ -353,8 +353,9 @@ void StopGamepadMonitoring() {
|
|||
|
||||
void SetGamepadLightIndicatorColor(const Tainted<GamepadHandle>& aGamepadHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex,
|
||||
const uint8_t& aRed, const uint8_t& aGreen,
|
||||
const uint8_t& aBlue) {
|
||||
const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen,
|
||||
const Tainted<uint8_t>& aBlue) {
|
||||
// TODO: Bug 1523355.
|
||||
NS_WARNING("Linux doesn't support gamepad light indicator.");
|
||||
}
|
||||
|
|
|
@ -335,8 +335,9 @@ class WindowsGamepadService {
|
|||
bool HandleRawInput(HRAWINPUT handle);
|
||||
void SetLightIndicatorColor(const Tainted<GamepadHandle>& aGamepadHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex,
|
||||
const uint8_t& aRed, const uint8_t& aGreen,
|
||||
const uint8_t& aBlue);
|
||||
const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen,
|
||||
const Tainted<uint8_t>& aBlue);
|
||||
size_t WriteOutputReport(const std::vector<uint8_t>& aReport);
|
||||
static void XInputMessageLoopOnceCallback(nsITimer* aTimer, void* aClosure);
|
||||
static void DevicesChangeCallback(nsITimer* aTimer, void* aService);
|
||||
|
@ -891,8 +892,8 @@ bool WindowsGamepadService::HandleRawInput(HRAWINPUT handle) {
|
|||
|
||||
void WindowsGamepadService::SetLightIndicatorColor(
|
||||
const Tainted<GamepadHandle>& aGamepadHandle,
|
||||
const Tainted<uint32_t>& aLightColorIndex, const uint8_t& aRed,
|
||||
const uint8_t& aGreen, const uint8_t& aBlue) {
|
||||
const Tainted<uint32_t>& aLightColorIndex, const Tainted<uint8_t>& aRed,
|
||||
const Tainted<uint8_t>& aGreen, const Tainted<uint8_t>& aBlue) {
|
||||
// We get aControllerIdx from GamepadPlatformService::AddGamepad(),
|
||||
// It begins from 1 and is stored at Gamepad.id.
|
||||
const Gamepad* gamepad = (MOZ_FIND_AND_VALIDATE(
|
||||
|
@ -911,7 +912,13 @@ void WindowsGamepadService::SetLightIndicatorColor(
|
|||
}
|
||||
|
||||
std::vector<uint8_t> report;
|
||||
remapper->GetLightColorReport(aRed, aGreen, aBlue, report);
|
||||
remapper->GetLightColorReport(
|
||||
MOZ_NO_VALIDATE(aRed, "uint8_t's range is the range of all valid values"),
|
||||
MOZ_NO_VALIDATE(aGreen,
|
||||
"uint8_t's range is the range of all valid values"),
|
||||
MOZ_NO_VALIDATE(aBlue,
|
||||
"uint8_t's range is the range of all valid values"),
|
||||
report);
|
||||
WriteOutputReport(report);
|
||||
}
|
||||
|
||||
|
|
|
@ -355,11 +355,10 @@ class MessageDecl(Node):
|
|||
|
||||
|
||||
class Param(Node):
|
||||
def __init__(self, loc, typespec, name, attributes={}):
|
||||
def __init__(self, loc, typespec, name):
|
||||
Node.__init__(self, loc)
|
||||
self.name = name
|
||||
self.typespec = typespec
|
||||
self.attributes = attributes
|
||||
|
||||
|
||||
class TypeSpec(Node):
|
||||
|
@ -417,4 +416,3 @@ class Decl(Node):
|
|||
self.loc = loc
|
||||
self.type = None
|
||||
self.scope = None
|
||||
self.attributes = {}
|
||||
|
|
|
@ -707,10 +707,9 @@ class _HybridDecl:
|
|||
"""A hybrid decl stores both an IPDL type and all the C++ type
|
||||
info needed by later passes, along with a basic name for the decl."""
|
||||
|
||||
def __init__(self, ipdltype, name, attributes={}):
|
||||
def __init__(self, ipdltype, name):
|
||||
self.ipdltype = ipdltype
|
||||
self.name = name
|
||||
self.attributes = attributes
|
||||
|
||||
def var(self):
|
||||
return ExprVar(self.name)
|
||||
|
@ -1116,7 +1115,7 @@ class MessageDecl(ipdl.ast.MessageDecl):
|
|||
|params| and |returns| is the C++ semantics of those: 'in', 'out', or None."""
|
||||
|
||||
def makeDecl(d, sems):
|
||||
if self.decl.type.tainted and 'NoTaint' not in d.attributes and direction == "recv":
|
||||
if self.decl.type.tainted and direction == "recv":
|
||||
# Tainted types are passed by-value, allowing the receiver to move them if desired.
|
||||
assert sems != "out"
|
||||
return Decl(Type("Tainted", T=d.bareType(side)), d.name)
|
||||
|
@ -1514,7 +1513,7 @@ class _DecorateWithCxxStuff(ipdl.ast.Visitor):
|
|||
self.typedefSet.add(Typedef(Type(ud.fqClassName()), ud.name))
|
||||
|
||||
def visitDecl(self, decl):
|
||||
return _HybridDecl(decl.type, decl.progname, decl.attributes)
|
||||
return _HybridDecl(decl.type, decl.progname)
|
||||
|
||||
def visitMessageDecl(self, md):
|
||||
md.namespace = self.protocolName
|
||||
|
@ -5120,7 +5119,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||
Decl(
|
||||
(
|
||||
Type("Tainted", T=p.bareType(side))
|
||||
if md.decl.type.tainted and 'NoTaint' not in p.attributes
|
||||
if md.decl.type.tainted
|
||||
else p.bareType(side)
|
||||
),
|
||||
p.var().name,
|
||||
|
|
|
@ -633,8 +633,8 @@ def p_ParamList(p):
|
|||
|
||||
|
||||
def p_Param(p):
|
||||
"""Param : Attributes Type ID"""
|
||||
p[0] = Param(locFromTok(p, 2), p[2], p[3], p[1])
|
||||
"""Param : Type ID"""
|
||||
p[0] = Param(locFromTok(p, 1), p[1], p[2])
|
||||
|
||||
|
||||
def p_Type(p):
|
||||
|
|
|
@ -828,13 +828,12 @@ class GatherDecls(TcheckVisitor):
|
|||
self.symtab = None
|
||||
self.builtinUsing = builtinUsing
|
||||
|
||||
def declare(self, loc, type, shortname=None, fullname=None, progname=None, attributes={}):
|
||||
def declare(self, loc, type, shortname=None, fullname=None, progname=None):
|
||||
d = Decl(loc)
|
||||
d.type = type
|
||||
d.progname = progname
|
||||
d.shortname = shortname
|
||||
d.fullname = fullname
|
||||
d.attributes = attributes
|
||||
self.symtab.declare(d)
|
||||
return d
|
||||
|
||||
|
@ -1298,28 +1297,9 @@ class GatherDecls(TcheckVisitor):
|
|||
|
||||
# replace inparam Param nodes with proper Decls
|
||||
def paramToDecl(param):
|
||||
self.checkAttributes(
|
||||
param.attributes,
|
||||
{
|
||||
# Passback indicates that the argument is unused by the Parent and is
|
||||
# merely returned to the Child later.
|
||||
# AllValid indicates that the entire span of values representable by
|
||||
# the type are acceptable. e.g. 0-255 in a uint8
|
||||
"NoTaint": ("passback", "allvalid")
|
||||
},
|
||||
)
|
||||
|
||||
ptname = param.typespec.basename()
|
||||
ploc = param.typespec.loc
|
||||
|
||||
if 'NoTaint' in param.attributes and 'Tainted' not in md.attributes:
|
||||
self.error(
|
||||
ploc,
|
||||
"argument typename `%s' of message `%s' has a NoTaint attribute, but the message lacks the Tainted attribute",
|
||||
ptname,
|
||||
msgname,
|
||||
)
|
||||
|
||||
ptdecl = self.symtab.lookup(ptname)
|
||||
if ptdecl is None:
|
||||
self.error(
|
||||
|
@ -1331,7 +1311,7 @@ class GatherDecls(TcheckVisitor):
|
|||
ptype = VOID
|
||||
else:
|
||||
ptype = self._canonicalType(ptdecl.type, param.typespec)
|
||||
return self.declare(loc=ploc, type=ptype, progname=param.name, attributes=param.attributes)
|
||||
return self.declare(loc=ploc, type=ptype, progname=param.name)
|
||||
|
||||
for i, inparam in enumerate(md.inParams):
|
||||
pdecl = paramToDecl(inparam)
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
//error: argument typename `int' of message `foo' has a NoTaint attribute, but the message lacks the Tainted attribute
|
||||
|
||||
intr protocol PNoTaintWithoutTainted {
|
||||
child:
|
||||
async foo([NoTaint=passback] int id);
|
||||
};
|
|
@ -1,4 +0,0 @@
|
|||
intr protocol PMessageTaintedWithPassback {
|
||||
child:
|
||||
[Tainted] async foo([NoTaint=passback] int id);
|
||||
};
|
Загрузка…
Ссылка в новой задаче