Closed
Bug 730830
Opened 13 years ago
Closed 13 years ago
Don't add the Mozilla networks if they already exist
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mrbkap, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
patch
|
vingtetun
:
review+
|
Details | Diff | Splinter Review |
Right now, we'll add the hacked mozilla networks, even if there's already an entry for them, we should avoid doing so.
Of note here is a fix to getNetworkConfiguration where the change from var -> let means that each closure created inside the loop gets its own fieldName.
Attachment #600923 -
Flags: review?(gal)
Reporter | ||
Updated•13 years ago
|
Attachment #600923 -
Flags: review?(gal) → review?(21)
Comment 1•13 years ago
|
||
Comment on attachment 600923 [details] [diff] [review]
patch
>diff --git a/dom/wifi/nsWifiWorker.js b/dom/wifi/nsWifiWorker.js
>@@ -861,6 +861,13 @@ var WifiManager = (function() {
> var done = 0;
> var errors = 0;
> var lines = reply.split("\n");
>+ if (lines.length === 1) {
>+ // We need to make sure we call the callback even if there are no
>+ // configured networks.
>+ callback(networks);
>+ return;
>+ }
nit: maybe you can return before declaring the done and errors variables
>@@ -986,7 +993,33 @@ function nsWifiWorker() {
> WifiManager.scan(false, function(){});
> });
> }
>- addThem();
>+
>+ WifiManager.getConfiguredNetworks(function(networks) {
>+ if (!networks) {
>+ debug("Unable to get existing networks");
>+ return;
>+ }
>+
>+ // O(n*m) but this is all temporary, right?
>+ // We enable any of our networks that area already configured but
>+ // disabled and avoid re-adding them if they exist.
>+ for each (let net in networks) {
>+ if (!net.ssid)
>+ continue;
>+ for (let known = 0; known < configs.length; ++known) {
>+ if (configs[known].ssid !== net.ssid)
>+ continue;
>+
>+ configs.splice(known, 1);
>+ if (net.status === "DISABLED")
>+ WifiManager.enableNetwork(net.netId, false, function() {});
>+ break;
>+ }
>+ }
>+
>+ if (configs.length > 0)
>+ addThem();
>+ });
This is not really elegant but this has been removed into another bug, right?
r+ with the small nit and a bug number for this part of the code that will/has been removed elsewhere.
Attachment #600923 -
Flags: review?(21) → review+
Reporter | ||
Comment 2•13 years ago
|
||
This landed yesterday with bug 732982.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•