Closed
Bug 1238801
Opened 9 years ago
Closed 9 years ago
Don't bother setting a timer that will never fire in nsGeolocationRequest::SetTimeoutTimer()
Categories
(Core :: DOM: Geolocation, defect)
Core
DOM: Geolocation
Tracking
()
RESOLVED
FIXED
mozilla50
People
(Reporter: mccr8, Assigned: jj, Mentored)
Details
(Whiteboard: [lang=c++][good first bug])
Attachments
(1 file, 8 obsolete files)
1.60 KB,
patch
|
Details | Diff | Splinter Review |
The default value for PositionOptions.timeout is 0x7fffffff, which according to bug 741131 is a stand-in for "infinity". It seems like that in that case we should just not bother setting a timer. (Technically a very patient user could specify a timeout of 0x7fffffff and then not get the behavior they expected...)
This block of code is also quite odd:
if (timeout < 0) {
timeout = 0;
} else if (timeout < 10) {
timeout = 10;
}
But maybe there's some reason for that.
Comment 1•9 years ago
|
||
The negative timeout thing is a relic of older geolocation specifications that used neither unsigned nor [Clamp]: http://dev.w3.org/geo/api/spec-source.html#position-options
The <10 thing originates from http://hg.mozilla.org/mozilla-central/rev/52a9f1cfedaa which was committed before I got involved in the project. I doubt that anybody understands it now :)
Comment 2•9 years ago
|
||
There are a few self-contained changes to be made here:
* Updating the PositionOptions definition in Geolocation.webidl to match the specification that I linked in comment 1.
* Removing the check for timeout values that are <0 in nsGeolocation.cpp, since the previous step made that impossible
* Removing the timeout <10 check, because I don't see how it serves any meaningful purpose these days.
Then we need to run the geolocation tests and ensure they still pass: `./mach mochitest dom/tests/mochitest/geolocation`
Mentor: josh
Whiteboard: [lang=c++][good first bug]
Comment 3•9 years ago
|
||
Oh, and finally:
* check whether the timeout value equals 0xFFFFFFFF and avoid setting a timer if that's the case
Comment 4•9 years ago
|
||
May I be assigned to this bug? I would like to work on it.
Flags: needinfo?(josh)
Updated•9 years ago
|
Assignee: nobody → brindmo
Flags: needinfo?(josh)
Hi, I am new to fixing bugs and I would like to work on the bug can u help in setting the environment
Comment 6•9 years ago
|
||
Sorry, someone already claimed this issue in comment 4. You can get help with setting up your environment in the #introduction channel on IRC (https://wiki.mozilla.org/IRC).
Comment 8•9 years ago
|
||
Yes, I had some trouble with the development environment, but I should have a patch ready very soon. My apologies for the late response!
Flags: needinfo?(brindmo)
Comment 9•9 years ago
|
||
Comment 10•9 years ago
|
||
Thank you for your contribution! However, Bugzilla is designed to accept and review patches (ie. the changes to a file), rather than complete files. Could you follow the steps at https://developer.mozilla.org/en-US/docs/Mercurial/Using_Mercurial#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F to create a patch and attach it here instead?
Flags: needinfo?(brindmo)
Comment 11•9 years ago
|
||
My apologies. I hope that this is what is expected.
Attachment #8718031 -
Attachment is obsolete: true
Flags: needinfo?(brindmo)
Comment 12•9 years ago
|
||
That patch is empty, unfortunately. You can see this by clicking on the [details] link.
Comment 13•9 years ago
|
||
Attachment #8720950 -
Attachment is obsolete: true
Comment 14•9 years ago
|
||
Comment on attachment 8721142 [details] [diff] [review]
Patch to update PositionOptions in Geolocation webidl to more current specifications.
Review of attachment 8721142 [details] [diff] [review]:
-----------------------------------------------------------------
This looks great! I assume `./mach build` still completes successfully?
Attachment #8721142 -
Flags: review+
Comment 15•9 years ago
|
||
Yes, .mach build still completes successfully.
Reporter | ||
Comment 16•9 years ago
|
||
Josh, it looks like this is ready to be landed or given a try run or something.
Flags: needinfo?(josh)
Comment 17•9 years ago
|
||
Brin, were you planning to implement the remaining pieces from comment 2?
Flags: needinfo?(josh) → needinfo?(brindmo)
Assignee | ||
Comment 18•9 years ago
|
||
Attachment #8764354 -
Flags: review?(josh)
Comment 19•9 years ago
|
||
Comment on attachment 8764354 [details] [diff] [review]
patch.diff
Review of attachment 8764354 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for tackling this Jinank! I have a couple comments that should be addressed before we merge these changes.
::: dom/geolocation/nsGeolocation.cpp
@@ +570,1 @@
> int32_t timeout;
I think we might as well use mOptions->mTimeout directly rather than introducing this extra variable.
@@ +573,1 @@
> mTimeoutTimer = do_CreateInstance("@mozilla.org/timer;1");
We should still check if the timeout value equals 0x7fffffff and skip setting the timer if that's the case.
Attachment #8764354 -
Flags: review?(josh) → feedback+
Updated•9 years ago
|
Assignee: brindmo → jinank94
Assignee | ||
Comment 20•9 years ago
|
||
:jdm I checked the value of timeout variable no it is not 0x7fffffff. It was 10000 when I printed out that variable.
Thanks for noticing about timeout variable. I will soon fix that up too.
Assignee | ||
Comment 21•9 years ago
|
||
Attachment #8764440 -
Flags: review?(dougt)
Attachment #8764440 -
Flags: feedback?(josh)
Comment 22•9 years ago
|
||
Just to be clear - what was the JS that caused that? I would expect any use of geolocation.getPosition() or geolocation.watchPosition() that doesn't include a {timeout: ####} option argument to have the default value of 0x7fffffff.
Flags: needinfo?(brindmo) → needinfo?(jinank94)
Updated•9 years ago
|
Attachment #8764440 -
Flags: review?(josh)
Attachment #8764440 -
Flags: review?(dougt)
Attachment #8764440 -
Flags: feedback?(josh)
Assignee | ||
Comment 23•9 years ago
|
||
:jdm I tried to print mOptions->mTimeout this variable to know about the value of timeout and then I opened up Google Maps and tried to access my location that might have fired that event.
Flags: needinfo?(jinank94) → needinfo?(josh)
Comment 24•9 years ago
|
||
I recommend creating a page where you know precisely what JS it's using; google maps is probably using a real timeout value :)
Flags: needinfo?(josh)
Assignee | ||
Comment 25•9 years ago
|
||
yeah I checked out that it is set 0x7fffffff, so now we could remove setting it
Flags: needinfo?(josh)
Assignee | ||
Comment 26•9 years ago
|
||
I just need one more information yesterday I was trying to find out which mOptions gets set I was not able to find that file could you please help me out with that. [:jdm]
Comment 27•9 years ago
|
||
I'm not sure exactly what you're asking. mOptions is set in the nsGeolocationRequest constructor, where it comes from Geolocation::GetCurrentPosition and Geolocation::WatchPosition. Does that answer the question?
Flags: needinfo?(josh)
Assignee | ||
Comment 28•9 years ago
|
||
I was asking that where we set the value for timeout.
Flags: needinfo?(josh)
Comment 29•9 years ago
|
||
That is set by generated code in GeolocationBinding.cpp (obj-[something]/dom/bindings/GeolocationBinding.cpp) based on the value that is provided by the JavaScript that invokes geolocation.getCurrentPosition or geolocation.watchPosition.
Flags: needinfo?(josh)
Assignee | ||
Comment 30•9 years ago
|
||
But by removing timeout assignment from Geolocation.webidl gives compilation error so we cannot remove it from there
Flags: needinfo?(josh)
Comment 31•9 years ago
|
||
I never said we should remove the timeout default value. I said we should check if the provided timeout equals the default value and skip setting the timer, just like we check for a value of 0.
Flags: needinfo?(josh)
Assignee | ||
Comment 32•9 years ago
|
||
Attachment #8764354 -
Attachment is obsolete: true
Attachment #8764440 -
Attachment is obsolete: true
Attachment #8764440 -
Flags: review?(josh)
Attachment #8765195 -
Flags: review?(josh)
Comment 33•9 years ago
|
||
Comment on attachment 8765195 [details] [diff] [review]
patch.diff
Review of attachment 8765195 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/geolocation/nsGeolocation.cpp
@@ +571,3 @@
> mTimeoutTimer = do_CreateInstance("@mozilla.org/timer;1");
> RefPtr<TimerCallbackHolder> holder = new TimerCallbackHolder(this);
> + if(mOptions->mTimeout != 0x7fffffff)
Let's add this to the conditions in the previous `if` instead.
Attachment #8765195 -
Flags: review?(josh)
Updated•9 years ago
|
Attachment #8721142 -
Attachment is obsolete: true
Assignee | ||
Comment 34•9 years ago
|
||
That won't work if we add that condition to the previous if statement then we will not create an instance of mTimeoutTimer but which is needed indeed so I think the added condition location is fine
Flags: needinfo?(josh)
Assignee | ||
Comment 35•9 years ago
|
||
Attachment #8765195 -
Attachment is obsolete: true
Attachment #8765283 -
Flags: review?(josh)
Comment 36•9 years ago
|
||
Comment on attachment 8765283 [details] [diff] [review]
patch.diff
Review of attachment 8765283 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for making these changes! This patch needs a real commit message, like "Bug 1238801 - Avoid setting a geolocation timer for the default timeout value. r=jdm", which you can set using `hg qref -m "..."` (replacing the ... with the commit message). We should also make sure this passes tests - do you have tryserver access? (https://wiki.mozilla.org/ReleaseEngineering/TryServer) If not, please apply for it by following the steps at https://www.mozilla.org/hacking/committer/ .
Attachment #8765283 -
Flags: review?(josh) → review+
Updated•9 years ago
|
Flags: needinfo?(josh)
Assignee | ||
Comment 37•9 years ago
|
||
I had access to it before but I kind of forgot the password as I had accessed it a year later.
Assignee | ||
Comment 38•9 years ago
|
||
Do you have any idea about how change my ssh publicid so that I can again get access to try server?
Flags: needinfo?(josh)
Comment 39•9 years ago
|
||
https://login.mozilla.com/ is where you can update the SSH key you're using. If you can't remember the password to access that page, then please file a bug in "MOC: Service Requests" asking them to reset your LDAP password.
Flags: needinfo?(josh)
Assignee | ||
Comment 40•9 years ago
|
||
Assignee | ||
Comment 41•9 years ago
|
||
Assignee | ||
Comment 42•9 years ago
|
||
I had pushed that on try server and ran test against all the version
Flags: needinfo?(josh)
Comment 43•9 years ago
|
||
This looks good to me; sorry about the delay! Please attach a version of the patch with a commit message like "Bug 1238801 - Don't set a timer for the default geolocation timeout. r=jdm", then add the `checkin-needed` flag to the Keywords field in this bug.
Flags: needinfo?(josh)
Assignee | ||
Comment 44•9 years ago
|
||
Attachment #8765283 -
Attachment is obsolete: true
Attachment #8770728 -
Flags: checkin+
Comment 46•9 years ago
|
||
Like I said, add checkin-needed to Keywords :)
Flags: needinfo?(josh)
Keywords: checkin-needed
Comment 47•9 years ago
|
||
need dom peer review:
dom/webidl/Geolocation.webidl altered in changeset 5ab4ac053870 without DOM peer review
Flags: needinfo?(jinank94)
Keywords: checkin-needed
Comment 48•9 years ago
|
||
r=smaug for the .webidl change, since it seems to follow the spec.
Comment 49•9 years ago
|
||
Jinank, could you attach a patch with r=jdm,smaug instead of r=jdm?
Assignee | ||
Comment 50•9 years ago
|
||
Attachment #8770728 -
Attachment is obsolete: true
Flags: needinfo?(jinank94)
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 51•9 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e1b1f1362a6c
Don't set a timer for the default geolocation timeout. r=jdm, r=smaug
Keywords: checkin-needed
Comment 52•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in
before you can comment on or make changes to this bug.
Description
•