Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2013-04-19 11:17:18 -04:00
commit ff3978e6a7
7 changed files with 38 additions and 34 deletions

View File

@ -786,13 +786,6 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
goto respond_with_ok;
}
char chld = atCommandValues[0][0];
if (chld < '0' || chld > '4') {
NS_WARNING("Wrong value of command [AT+CHLD]");
SendLine("ERROR");
return;
}
/**
* The following two cases are supported:
* AT+CHLD=1 - Releases active calls and accepts the other (held or
@ -805,19 +798,26 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
* Please see 4.33.2 in Bluetooth hands-free profile 1.6 for more
* information.
*/
// No idx shall be included
char chld = atCommandValues[0][0];
bool valid = true;
if (atCommandValues[0].Length() > 1) {
SendLine("ERROR");
return;
}
if (chld == '1') {
NS_WARNING("No index should be included in command [AT+CHLD]");
valid = false;
} else if (chld == '0' || chld == '3' || chld == '4') {
NS_WARNING("The value of command [AT+CHLD] is not supported");
valid = false;
} else if (chld == '1') {
NotifyDialer(NS_LITERAL_STRING("CHUP+ATA"));
} else if (chld == '2') {
NotifyDialer(NS_LITERAL_STRING("CHLD+ATA"));
} else {
NS_WARNING("Not handling chld value");
NS_WARNING("Wrong value of command [AT+CHLD]");
valid = false;
}
if (!valid) {
SendLine("ERROR");
return;
}
} else if (msg.Find("AT+VGS=") != -1) {
// Adjust volume by headset

View File

@ -362,11 +362,12 @@ DeviceStorageFile::IsSafePath()
mPath.BeginReading(start);
mPath.EndReading(end);
// if the path has a ~ or \ in it, return false.
// if the path is a '~' or starts with '~/', return false.
NS_NAMED_LITERAL_STRING(tilde, "~");
NS_NAMED_LITERAL_STRING(bslash, "\\");
if (FindInReadable(tilde, start, end) ||
FindInReadable(bslash, start, end)) {
NS_NAMED_LITERAL_STRING(tildeSlash, "~/");
if (mPath.Equals(tilde) ||
StringBeginsWith(mPath, tildeSlash)) {
NS_WARNING("Path name starts with tilde!");
return false;
}
// split on /. if any token is "", ., or .., return false.

View File

@ -23,11 +23,11 @@ interface nsIDOMMozSmsFilter : nsISupports
[Null(Empty)]
attribute DOMString delivery;
// A read flag that can be a boolean or undefined.
// A read flag that can return and be set to a boolean or null.
[implicit_jscontext]
attribute jsval read;
// A thread id that can be a numeric value or undefined.
// A thread id that can return and be set to a numeric value or null.
[implicit_jscontext]
attribute jsval threadId;
};

View File

@ -234,7 +234,7 @@ NS_IMETHODIMP
SmsFilter::GetRead(JSContext* aCx, JS::Value* aRead)
{
if (mData.read() == eReadState_Unknown) {
*aRead = JSVAL_VOID;
*aRead = JSVAL_NULL;
return NS_OK;
}
@ -246,7 +246,7 @@ SmsFilter::GetRead(JSContext* aCx, JS::Value* aRead)
NS_IMETHODIMP
SmsFilter::SetRead(JSContext* aCx, const JS::Value& aRead)
{
if (aRead == JSVAL_VOID) {
if (aRead == JSVAL_NULL) {
mData.read() = eReadState_Unknown;
return NS_OK;
}
@ -263,7 +263,7 @@ NS_IMETHODIMP
SmsFilter::GetThreadId(JSContext* aCx, JS::Value* aThreadId)
{
if (!mData.threadId()) {
*aThreadId = JSVAL_VOID;
*aThreadId = JSVAL_NULL;
return NS_OK;
}
@ -275,7 +275,7 @@ SmsFilter::GetThreadId(JSContext* aCx, JS::Value* aThreadId)
NS_IMETHODIMP
SmsFilter::SetThreadId(JSContext* aCx, const JS::Value& aThreadId)
{
if (aThreadId == JSVAL_VOID) {
if (aThreadId == JSVAL_NULL) {
mData.threadId() = 0;
return NS_OK;
}

View File

@ -73,15 +73,15 @@ filter.read = true;
is(filter.read, true, "Setters and getters should work!");
filter.read = false;
is(filter.read, false, "Setters and getters should work!");
filter.read = undefined;
is(filter.read, undefined, "undefined should revert the value to default");
throwingCheck(filter, 'read', [ "foo", 0, [1, 2], function () {}, new Date(), null ]);
filter.read = null;
is(filter.read, null, "'null' should revert the value to default");
throwingCheck(filter, 'read', [ "foo", 0, [1, 2], function () {}, new Date(), undefined ]);
filter.threadId = 1;
is(filter.threadId, 1, "Setters and getters should work!");
filter.threadId = undefined;
is(filter.threadId, undefined, "undefined should revert the value to default");
throwingCheck(filter, 'threadId', [ "foo", 0, 1.5, [1, 2], function () {}, new Date(), null ]);
filter.threadId = null;
is(filter.threadId, null, "'null' should revert the value to default");
throwingCheck(filter, 'threadId', [ "foo", 0, 1.5, [1, 2], function () {}, new Date(), undefined ]);
</script>
</pre>

View File

@ -69,6 +69,10 @@ DOMWifiManager.prototype = {
// Only pages with perm set can use the wifi manager.
this._hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
if (!this._hasPrivileges) {
return null;
}
// Maintain this state for synchronous APIs.
this._currentNetwork = null;
this._connectionStatus = "disconnected";

View File

@ -411,7 +411,7 @@ class RunProgram(MachCommandBase):
help='Command-line arguments to pass to the program.')
def run(self, params):
try:
args = [self.get_binary_path('app')]
args = [self.get_binary_path('app'), '-no-remote']
except Exception as e:
print("It looks like your program isn't built.",
"You can run |mach build| to build it.")
@ -438,14 +438,13 @@ class DebugProgram(MachCommandBase):
print(e)
return 1
try:
args = [debugger, self.get_binary_path('app')]
args = [debugger, '--args', self.get_binary_path('app'), '-no-remote']
except Exception as e:
print("It looks like your program isn't built.",
"You can run |mach build| to build it.")
print(e)
return 1
if params:
args.insert(1, '--args')
args.extend(params)
return self.run_process(args=args, ensure_exit_code=False,
pass_thru=True)