From 39471c6ea279e09ede89705a09371a3d23f1f2af Mon Sep 17 00:00:00 2001 From: Carmen Jimenez Cabezas Date: Tue, 16 Apr 2013 10:54:00 +0200 Subject: [PATCH 1/5] Bug 815110 - Change DOMWifiManager so it returns null instead of creating the object if the caller doesn't have the correct permission. r=mrbkap --- dom/wifi/DOMWifiManager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dom/wifi/DOMWifiManager.js b/dom/wifi/DOMWifiManager.js index b6c43aa2b1a..2af91345bb4 100644 --- a/dom/wifi/DOMWifiManager.js +++ b/dom/wifi/DOMWifiManager.js @@ -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"; From c77bcf5799760e7f0dce400e4e9f09929d86a508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=C3=A9=E2=84=A2=C2=B3=C3=A4=C2=BE=C6=92?= =?UTF-8?q?=C3=A5=C2=A6=E2=80=9A=29?= Date: Fri, 19 Apr 2013 07:55:58 -0400 Subject: [PATCH 2/5] Bug 845707 - Only filter file path that is a '~' or starts with '~/'. r=dougt --- dom/devicestorage/nsDeviceStorage.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 1e848f9083d..1a0b19fc175 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -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. From dfd861b9ac0284f8028496026e9a236e10856c51 Mon Sep 17 00:00:00 2001 From: Vicamo Yang Date: Fri, 19 Apr 2013 20:38:02 +0800 Subject: [PATCH 3/5] Bug 863035 - WebSMS: use 'null' to reset SmsFilter::read and threadId. r=mounir,Ms2ger --- dom/mobilemessage/interfaces/nsIDOMSmsFilter.idl | 4 ++-- dom/mobilemessage/src/SmsFilter.cpp | 8 ++++---- dom/mobilemessage/tests/test_smsfilter.html | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dom/mobilemessage/interfaces/nsIDOMSmsFilter.idl b/dom/mobilemessage/interfaces/nsIDOMSmsFilter.idl index daa8d146fc2..cdc67d1b119 100644 --- a/dom/mobilemessage/interfaces/nsIDOMSmsFilter.idl +++ b/dom/mobilemessage/interfaces/nsIDOMSmsFilter.idl @@ -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; }; diff --git a/dom/mobilemessage/src/SmsFilter.cpp b/dom/mobilemessage/src/SmsFilter.cpp index c23f2405a49..7b8d1351514 100644 --- a/dom/mobilemessage/src/SmsFilter.cpp +++ b/dom/mobilemessage/src/SmsFilter.cpp @@ -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; } diff --git a/dom/mobilemessage/tests/test_smsfilter.html b/dom/mobilemessage/tests/test_smsfilter.html index 0be495dc444..922dc462f2d 100644 --- a/dom/mobilemessage/tests/test_smsfilter.html +++ b/dom/mobilemessage/tests/test_smsfilter.html @@ -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 ]); From c1d82b45064afec542140b0e5448f7fab3a237b4 Mon Sep 17 00:00:00 2001 From: Gina Yeh Date: Fri, 19 Apr 2013 14:40:51 +0200 Subject: [PATCH 4/5] Bug 863620 - Followup of bug 848414, r=echou --- dom/bluetooth/BluetoothHfpManager.cpp | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index d41a51071c2..344713d8342 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -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 From 912cb1e117778c6c4f9d789aca410c16ff302576 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 19 Apr 2013 09:03:09 -0400 Subject: [PATCH 5/5] Bug 863092 - Make mach run and mach debug run firefox -no-remote; r=gps DONTBUILD --- python/mozbuild/mozbuild/mach_commands.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 2f7054015e0..a789597a905 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -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)