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)

ARM
Gonk (Firefox OS)
defect
Not set
normal

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)

Attached file Console log (obsolete) —
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.
Component: General → RIL
Attached file Console log
Sorry, this one is the correct log.
Attachment #8548032 - Attachment is obsolete: true
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
Attached patch patch, v1. (obsolete) — Splinter Review
Edgar, may I have your review on this? Thanks.
Attachment #8548667 - Flags: review?(echen)
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+
(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.
(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.
Blocks: 1115495
Rebased and fix possible null exception in |this.active|.
Attachment #8548667 - Attachment is obsolete: true
Attachment #8555136 - Flags: review+
Edgar, may I have your review on the test case? Thanks.
Attachment #8555137 - Flags: review?(echen)
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.
(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 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)
(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
(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.
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 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+
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S5 (6feb)
(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)
(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)
(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.

Attachment

General

Created:
Updated:
Size: