Closed
Bug 1120843
Opened 10 years ago
Closed 10 years ago
HTTP proxy setting should be cleared after data call disconnected
Categories
(Firefox OS Graveyard :: RIL, defect)
Tracking
(firefox38 fixed)
RESOLVED
FIXED
2.2 S5 (6feb)
| Tracking | Status | |
|---|---|---|
| firefox38 | --- | fixed |
People
(Reporter: swu, Assigned: jessica)
References
Details
Attachments
(3 files, 3 obsolete files)
|
8.00 KB,
text/plain
|
Details | |
|
5.41 KB,
patch
|
jessica
:
review+
|
Details | Diff | Splinter Review |
|
4.06 KB,
patch
|
edgar
:
review+
|
Details | Diff | Splinter Review |
Device: Flame
Gecko: b8876c827edb + applied fix for bug 1120302
Gaia: d102cc0a7a1f346531553bec64588eea9e4594eb
STR:
1. Disable wifi
2. Enable data call with http proxy setting
3. Disable data call
Expected:
HTTP proxy setting should be cleared from preference.
Actual:
HTTP proxy setting is not cleared from preference.
| Reporter | ||
Updated•10 years ago
|
Component: General → RIL
| Reporter | ||
Comment 1•10 years ago
|
||
Sorry, this one is the correct log.
Attachment #8548032 -
Attachment is obsolete: true
| Assignee | ||
Comment 2•10 years ago
|
||
Thanks for reporting this, Shian-Yow. You are right, we are not clearing http proxy for data call nor wifi, when they get disconnected. I'll add this part.
Assignee: nobody → jjong
| Assignee | ||
Comment 3•10 years ago
|
||
Edgar, may I have your review on this? Thanks.
Attachment #8548667 -
Flags: review?(echen)
Comment 4•10 years ago
|
||
Comment on attachment 8548667 [details] [diff] [review]
patch, v1.
Review of attachment 8548667 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, but could you also help to add a test case for proxy?
Maybe use `SpecialPowers.get*Pref` to check the proxy configuration.
Thank you.
::: dom/system/gonk/NetworkService.js
@@ +377,5 @@
> setNetworkProxy: function(network) {
> try {
> if (!network.httpProxyHost || network.httpProxyHost === "") {
> // Sets direct connection to internet.
> + this.clearNetworkProxy();
I'd like to move these proxy code to NetworkManager and let NetworkManager set/clear pref directly. But I found wifi will use |NetworkService.setNetworkProxy| as well. Let's just keep current architecture now and see if it is necessary to come out a generic flow for both wifi and data later. Thank you.
@@ +400,5 @@
> }
> },
>
> + clearNetworkProxy: function() {
> + if(DEBUG) debug("Going to clear all network proxy.");
nit: space between `if` and `(`.
Attachment #8548667 -
Flags: review?(echen) → review+
Comment 5•10 years ago
|
||
(In reply to Edgar Chen [:edgar][:echen] from comment #4)
> ::: dom/system/gonk/NetworkService.js
> @@ +377,5 @@
> > setNetworkProxy: function(network) {
> > try {
> > if (!network.httpProxyHost || network.httpProxyHost === "") {
> > // Sets direct connection to internet.
> > + this.clearNetworkProxy();
>
> I'd like to move these proxy code to NetworkManager and let NetworkManager
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> set/clear pref directly.
I couldn't agree with this anymore :p
I am also aware of this when fixing Bug 1120302. After blaming the code
I found I was the one who put it to NetworkService >"<
Will file a bug to address this.
| Assignee | ||
Comment 6•10 years ago
|
||
(In reply to Henry Chang [:henry] from comment #5)
> (In reply to Edgar Chen [:edgar][:echen] from comment #4)
> > ::: dom/system/gonk/NetworkService.js
> > @@ +377,5 @@
> > > setNetworkProxy: function(network) {
> > > try {
> > > if (!network.httpProxyHost || network.httpProxyHost === "") {
> > > // Sets direct connection to internet.
> > > + this.clearNetworkProxy();
> >
> > I'd like to move these proxy code to NetworkManager and let NetworkManager
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > set/clear pref directly.
>
> I couldn't agree with this anymore :p
>
> I am also aware of this when fixing Bug 1120302. After blaming the code
> I found I was the one who put it to NetworkService >"<
> Will file a bug to address this.
Thanks! btw, what is wifi's |configureHttpProxy| for? Will someone call this function explicitly? If not, maybe we should let NetworkManager handle the proxy stuff.
| Assignee | ||
Comment 7•10 years ago
|
||
Rebased and fix possible null exception in |this.active|.
Attachment #8548667 -
Attachment is obsolete: true
Attachment #8555136 -
Flags: review+
| Assignee | ||
Comment 8•10 years ago
|
||
Edgar, may I have your review on the test case? Thanks.
Attachment #8555137 -
Flags: review?(echen)
| Assignee | ||
Comment 9•10 years ago
|
||
We found that it is possible that 'network-connection-state-change' event is fired before routing/http proxy/dnses are set correctly. This may lead to unexpected results, we should file a bug to handle that.
| Assignee | ||
Comment 10•10 years ago
|
||
(In reply to Jessica Jong [:jjong] [:jessica] from comment #9)
> We found that it is possible that 'network-connection-state-change' event is
> fired before routing/http proxy/dnses are set correctly. This may lead to
> unexpected results, we should file a bug to handle that.
filed bug 1126222 for this.
Comment 11•10 years ago
|
||
Comment on attachment 8555137 [details] [diff] [review]
Part 2: test cases for data connection http proxy.
Review of attachment 8555137 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for working on the test case, please see my comments below. :)
::: dom/system/gonk/tests/marionette/test_data_connection_proxy.js
@@ +20,5 @@
> +}
> +
> +function setTestApn() {
> + let apn = [
> + [ {"carrier":"T-Mobile US",
nit: space after `"`, here and below.
@@ +31,5 @@
> +
> + return setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, apn);
> +}
> +
> +function waitForTimeout(aTimeoutMs) {
I guess you could just simply use `waitFor` [1] then we don't need this function.
[1] https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/Marionette_JavaScript_Tests#waitFor%28%29
@@ +32,5 @@
> + return setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, apn);
> +}
> +
> +function waitForTimeout(aTimeoutMs) {
> + let deferred = Promise.defer();
`Deferred` is obsolete since Gecko 30 [2], please use `new Promise` instead.
e.g.
return new Promise(function(aResolve, aReject) {
setTimeout(function() {
aResolve();
}, aTimeoutMs);
});
[2] https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred
@@ +42,5 @@
> + return deferred.promise;
> +}
> +
> +function verifyHttpProxy(aIsSet) {
> + let deferred = Promise.defer();
Ditto
@@ +82,5 @@
> + "network.proxy.ssl_port");
> + }
> + }, () => {
> + if (!retryCnt--) {
> + throw "Failed waiting for http proxy.";
Looks like we won't have any chance to run into this condition given that the |retryCnt| always starts with `20`?
And how about rewriting with `waitFor` to make it simpler though I am not sure if this can totally cover your original idea?
e.g.
function waitForHttpProxyVerified(aShouldBeSet) {
return new Promise(function(aResolve, aReject) {
try {
waitFor(aResolve, () => {
....
// Check proxy value here.
}, TIME_OUT_VALUE);
} catch() {
// Time out.
aReject();
}
});
}
Attachment #8555137 -
Flags: review?(echen)
Comment 12•10 years ago
|
||
(In reply to Edgar Chen [:edgar][:echen] from comment #11)
> Comment on attachment 8555137 [details] [diff] [review]
> Part 2: test cases for data connection http proxy.
>
> Review of attachment 8555137 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Thanks for working on the test case, please see my comments below. :)
>
> ::: dom/system/gonk/tests/marionette/test_data_connection_proxy.js
> @@ +20,5 @@
> > +}
> > +
> > +function setTestApn() {
> > + let apn = [
> > + [ {"carrier":"T-Mobile US",
>
> nit: space after `"`, here and below.
^^^^
Sorry, it should be `:`. :p
| Assignee | ||
Comment 13•10 years ago
|
||
(In reply to Edgar Chen [:edgar][:echen] from comment #11)
> Comment on attachment 8555137 [details] [diff] [review]
> Part 2: test cases for data connection http proxy.
>
> Review of attachment 8555137 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Thanks for working on the test case, please see my comments below. :)
>
> ::: dom/system/gonk/tests/marionette/test_data_connection_proxy.js
> @@ +20,5 @@
> > +}
> > +
> > +function setTestApn() {
> > + let apn = [
> > + [ {"carrier":"T-Mobile US",
>
> nit: space after `"`, here and below.
>
> @@ +31,5 @@
> > +
> > + return setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, apn);
> > +}
> > +
> > +function waitForTimeout(aTimeoutMs) {
>
> I guess you could just simply use `waitFor` [1] then we don't need this
> function.
>
> [1]
> https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/
> Marionette_JavaScript_Tests#waitFor%28%29
>
> @@ +32,5 @@
> > + return setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, apn);
> > +}
> > +
> > +function waitForTimeout(aTimeoutMs) {
> > + let deferred = Promise.defer();
>
> `Deferred` is obsolete since Gecko 30 [2], please use `new Promise` instead.
>
> e.g.
>
> return new Promise(function(aResolve, aReject) {
> setTimeout(function() {
> aResolve();
> }, aTimeoutMs);
> });
>
> [2]
> https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/
> Promise.jsm/Deferred
>
> @@ +42,5 @@
> > + return deferred.promise;
> > +}
> > +
> > +function verifyHttpProxy(aIsSet) {
> > + let deferred = Promise.defer();
>
> Ditto
>
> @@ +82,5 @@
> > + "network.proxy.ssl_port");
> > + }
> > + }, () => {
> > + if (!retryCnt--) {
> > + throw "Failed waiting for http proxy.";
>
> Looks like we won't have any chance to run into this condition given that
> the |retryCnt| always starts with `20`?
>
> And how about rewriting with `waitFor` to make it simpler though I am not
> sure if this can totally cover your original idea?
>
> e.g.
>
> function waitForHttpProxyVerified(aShouldBeSet) {
> return new Promise(function(aResolve, aReject) {
> try {
> waitFor(aResolve, () => {
> ....
> // Check proxy value here.
> }, TIME_OUT_VALUE);
> } catch() {
> // Time out.
> aReject();
> }
> });
> }
Thanks for the helpful comments! I'll upload another patch base on these comments.
| Assignee | ||
Comment 14•10 years ago
|
||
Edgar, I have revised the patch according to review comment 11, may I have your review again? Thanks.
Attachment #8555137 -
Attachment is obsolete: true
Attachment #8556937 -
Flags: review?(echen)
Comment 15•10 years ago
|
||
Comment on attachment 8556937 [details] [diff] [review]
Part 2: test cases for data connection http proxy, v2.
Review of attachment 8556937 [details] [diff] [review]:
-----------------------------------------------------------------
Really nice work, thank you.
Attachment #8556937 -
Flags: review?(echen) → review+
| Assignee | ||
Comment 16•10 years ago
|
||
Thanks Edgar.
try looks good:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3cceb8440177
Keywords: checkin-needed
Comment 17•10 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/17d151a8dee1
https://hg.mozilla.org/integration/b2g-inbound/rev/9a14a438cde6
Keywords: checkin-needed
Comment 18•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/17d151a8dee1
https://hg.mozilla.org/mozilla-central/rev/9a14a438cde6
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox38:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S5 (6feb)
Comment 19•10 years ago
|
||
(In reply to Henry Chang [:henry] from comment #5)
> (In reply to Edgar Chen [:edgar][:echen] from comment #4)
> > ::: dom/system/gonk/NetworkService.js
> > @@ +377,5 @@
> > > setNetworkProxy: function(network) {
> > > try {
> > > if (!network.httpProxyHost || network.httpProxyHost === "") {
> > > // Sets direct connection to internet.
> > > + this.clearNetworkProxy();
> >
> > I'd like to move these proxy code to NetworkManager and let NetworkManager
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > set/clear pref directly.
>
> I couldn't agree with this anymore :p
>
> I am also aware of this when fixing Bug 1120302. After blaming the code
> I found I was the one who put it to NetworkService >"<
> Will file a bug to address this.
Hi Henry, have you already filed a bug for this?
Flags: needinfo?(hchang)
Comment 20•10 years ago
|
||
(In reply to Edgar Chen [:edgar][:echen] from comment #19)
> (In reply to Henry Chang [:henry] from comment #5)
> > (In reply to Edgar Chen [:edgar][:echen] from comment #4)
> > > ::: dom/system/gonk/NetworkService.js
> > > @@ +377,5 @@
> > > > setNetworkProxy: function(network) {
> > > > try {
> > > > if (!network.httpProxyHost || network.httpProxyHost === "") {
> > > > // Sets direct connection to internet.
> > > > + this.clearNetworkProxy();
> > >
> > > I'd like to move these proxy code to NetworkManager and let NetworkManager
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > set/clear pref directly.
> >
> > I couldn't agree with this anymore :p
> >
> > I am also aware of this when fixing Bug 1120302. After blaming the code
> > I found I was the one who put it to NetworkService >"<
> > Will file a bug to address this.
>
> Hi Henry, have you already filed a bug for this?
Just filed! Bug 1130962. Thanks for reminding!
Flags: needinfo?(hchang)
Comment 21•10 years ago
|
||
(In reply to Henry Chang [:henry] from comment #20)
> (In reply to Edgar Chen [:edgar][:echen] from comment #19)
> > (In reply to Henry Chang [:henry] from comment #5)
> > > (In reply to Edgar Chen [:edgar][:echen] from comment #4)
> > > > ::: dom/system/gonk/NetworkService.js
> > > > @@ +377,5 @@
> > > > > setNetworkProxy: function(network) {
> > > > > try {
> > > > > if (!network.httpProxyHost || network.httpProxyHost === "") {
> > > > > // Sets direct connection to internet.
> > > > > + this.clearNetworkProxy();
> > > >
> > > > I'd like to move these proxy code to NetworkManager and let NetworkManager
> > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > set/clear pref directly.
> > >
> > > I couldn't agree with this anymore :p
> > >
> > > I am also aware of this when fixing Bug 1120302. After blaming the code
> > > I found I was the one who put it to NetworkService >"<
> > > Will file a bug to address this.
> >
> > Hi Henry, have you already filed a bug for this?
>
> Just filed! Bug 1130962. Thanks for reminding!
Thank you, Henry.
You need to log in
before you can comment on or make changes to this bug.
Description
•