Commit Graph

65 Commits

Author SHA1 Message Date
Andrew McCreight
b5b634092f Bug 1256061 - Hold a strong reference to a request when we call a method on it. r=jdm, a=ritu
I think it is possible for the TimerCallbackHolder to fire off a
Notify() while the geolocation object and the nsGeolocationRequest are
only holding each other alive, so they would be freed by the cycle
collector the next time it runs, but we haven't run the cycle
collector yet. If that happens, then Geolocation::RemoveRequest()
would break the cycle, causing stuff to unravel and bad things to
happen. To fix this, we just hold the request alive in
TimerCallbackHolder::Notify(), which will also ensure that the
geolocation object is alive, hopefully preventing crashes.

This will make the Notify() behavior similar to what it was before bug
1238427, when the nsITimer object would hold a strong reference to the
request when the Notify() was being run.
2016-03-23 12:59:14 -07:00
Doug Turner
ddc6d8619b Bug 1253159 - Remove locationUpdatePending and restore request timeout. r=jdm 2016-03-02 21:48:00 -05:00
Michelangelo De Simone
54637ce376 Bug 1249833 - Typo in nsGeolocation.h. r=jdm
MozReview-Commit-ID: DGg2iUOkSMJ
2016-02-19 16:30:09 -08:00
ywu
e326fc20a4 Bug 1238873 - Handle the bug that if we take cached data, we might not get any update later. r=kchen. r=jdm. 2016-02-15 17:56:00 +01:00
Andrew McCreight
3c316e9dd9 Bug 1240906 - Shut down geolocation service at xpcom-shutdown instead of quit-application. r=dougt
Also, remove trailing spaces from network_geolocation.sjs.
2016-01-19 14:07:00 +01:00
ywu
7317711fff Bug 1240664 - Only enable bug 1216148's behavior when there is a wakelock support. r=kanru 2016-02-01 16:40:21 +08:00
Kyle Huey
94f653c385 Bug 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug 2016-01-30 09:05:36 -08:00
ywu
08eb8fbbf9 Bug 1240666 - Follow-up to bug 1216148. r=kchen.
Add a comment to where we resume gps requests from invisible state.
2016-01-26 18:10:00 +01:00
Alphan Chen
ff90780c49 Bug 858827 - [Geolocation] Add a handling for getCurrentLocation when timeout is zero. r=jdm
Follow W3C spec, Error callback should be called when timeout is zero and
  there's no cached position for getCurrentLocation.
2016-01-26 17:11:54 +08:00
Andrew McCreight
339c59af64 Bug 1238427 - Avoid a strong reference from the timeout timer to nsGeolocationRequest. r=jdm
The timeout timer of a geolocation request holds a strong reference to
the request. This can cause the window to leak if the request is not
completed before the tab containing the window is closed.

To fix this, I made the timer instead hold a strong reference to a
wrapper class that has only a weak reference to the request. The
request destructor must now cancel the timeout timer.

I also outlined a call to StopTimeoutTimer() in
nsGeolocationRequest::Shutdown().
2016-01-21 09:57:30 -08:00
Phil Ringnalda
b92cf66e9e Back out 0014798942e0 (bug 1238427) for its bad implicit conversion constructor for 'TimerCallbackHolder'
CLOSED TREE
2016-01-20 21:17:44 -08:00
Andrew McCreight
12696e1167 Bug 1238427 - Avoid a strong reference from the timeout timer to nsGeolocationRequest. r=jdm
The timeout timer of a geolocation request holds a strong reference to
the request. This can cause the window to leak if the request is not
completed before the tab containing the window is closed.

To fix this, I made the timer instead hold a strong reference to a
wrapper class that has only a weak reference to the request. The
request destructor must now cancel the timeout timer.

I also outlined a call to StopTimeoutTimer() in
nsGeolocationRequest::Shutdown().
2016-01-19 14:09:00 -05:00
Tim Taubert
680227c8fb Bug 1240766 - Fix startup crash in Geolocation::Init() when principal URI is null r=jdm 2016-01-19 22:06:01 +01:00
Tim Taubert
7db1e070bf Bug 1230209 - Add more telemetry for Geolocation usage f=bsmedberg r=tanvi,rbarnes,jdm 2015-12-03 19:12:11 +01:00
ywu
110b39165f Bug 1216148 - Handle how geolocation acts when the app's visibility changes. r=kchen.
Add the wake lock api to geolocation.
If your app holds a lock, you can continue use geolocation service when your app is invisible.
Otherwise, your invisible app can't get any updated location.
2016-01-12 00:33:00 +01:00
Andrea Marchesini
da5c7a3c74 Bug 1231378 - part 2 - Fix uninitialized members of classes in dom/*, r=smaug 2016-01-12 18:16:59 +00:00
Carsten "Tomcat" Book
72d5b69443 Backed out changeset 5f6a58676e87 (bug 1231378) 2016-01-12 15:48:57 +01:00
Andrea Marchesini
2a65b00fe2 Bug 1231378 - part 2 - Fix uninitialized members of classes in dom/*, r=smaug 2016-01-12 13:54:53 +00:00
Bogdan Postelnicu
8d3acc2112 Bug 1227119 - Set a default value for variable ret. r=dougt 2015-11-23 06:03:00 -05:00
Boris Zbarsky
247b1d8a5e Bug 1228707. Add a away to call Web IDL callbacks while ignoring any errors from them, and use it in a few places. r=smaug 2015-11-30 22:04:09 -05:00
Boris Zbarsky
68db7e4534 Bug 1228009. Geolocation code needs to handle failures on its ErrorResults. r=smaug 2015-11-25 15:48:04 -05:00
Dave Huseby
91ebc31678 Bug 1220688 - catch and ignore JS exceptions when working with nsAutoJSString. r=bz 2015-11-12 13:12:00 +01:00
Birunthan Mohanathas
94998cf5fe Bug 1219392 - Capitalize mozilla::unused to avoid conflicts. r=froydnj 2015-11-02 07:53:26 +02:00
Kyle Huey
fffe5cc829 Bug 1216401: Eviscerate nsIDOMWindow, move still needed methods to nsPIDOMWindow. r=bz 2015-10-26 14:37:32 -07:00
Nathan Froyd
e4e2da55c9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi
2015-10-18 01:24:48 -04:00
Bobby Holley
708ae67ade Bug 1072150 - Use the opt-out for various sloppy consumers. r=bz 2015-09-24 14:02:41 -07:00
Chris Peterson
dd2fcb9b7d Bug 1207030 - Enable -Wshadow flag in more directories that have no -Wshadow warnings. r=glandium 2015-09-22 21:39:03 -07:00
Jeff Walden
a33c1c9f14 Bug 1179003 - Convert the infallible objectClassIs proxy hook into a fallible getBuiltinClass hook that indicates class type via outparam. r=efaust, r=bz on DOM bits, r=billm on IPC bits 2015-08-28 21:55:40 -07:00
Nicholas Nethercote
69d088e45f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.
2015-08-27 20:44:53 -07:00
Terrence Cole
783b6b9e6c Bug 1191529 - Remove JSIdArray and AutoIdArray and replace with Rooted<IdVector>; r=mccr8, r=jonco
* * *
imported patch 2_remove_AutoIdArray_gk
2015-08-05 11:02:00 -07:00
Birunthan Mohanathas
47ed3a3675 Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Juan Gomez
01df2f691b Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj 2015-07-03 18:29:00 -07:00
Ryan VanderMeulen
e6131fc8b8 Backed out changeset 8b4e4083639e (bug 1171931) for B2G debug emulator bustage. 2015-06-25 19:48:42 -04:00
Juan Gomez
2128198065 Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj 2015-06-24 14:11:00 -04:00
Garvan Keeley
d540fbdedb Bug 1145111: ensure the pos. cache isn't reset when nsGeolocationService shuts down provider. r=jdm
After 6 seconds of idle, nsGeolocationService shuts down its provider, and was unintenionally
clearing the position cache.
2015-05-20 12:35:06 -04:00
Garvan Keeley
7be72663d4 Bug 1166556 - Don't start geolocation provider if the cached position is being used. r=jdm 2015-05-20 12:35:06 -04:00
Andrew McCreight
c979f253c0 Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Jim Blandy
3fe47490c7 Bug 1152577: Add 'aReason' argument to AutoEntryScript constructor, and provide plausible names for its instantiations. r=bholley 2015-04-08 21:23:48 -04:00
Kershaw Chang
31cff83422 Bug 1020179 - Let PContent manage PContentPermissionRequest. r=fabrice, r=khuey 2015-04-13 21:08:00 -04:00
Andrea Marchesini
94545cbb2e Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
Ehsan Akhgari
5cccea6f0f Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Boris Zbarsky
988b8e01be Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp.  The
rest of this diff was generated by running the following commands:

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 10:13:33 -04:00
Garvan Keeley
6502074801 Bug 1129633 - part1. Use win8 geolocation with a fallback to MLS - r=m_kato 2015-03-10 12:47:40 -04:00
Garvan Keeley
5556ec4f53 Bug 1134019 - Extract MLS fallback to its own class for reuse - r=jdm 2015-02-27 19:15:32 -05:00
Dave Huseby
e66c4d8ba4 Bug 1116189 - Fix up the dom uses of nsAutoJSString::Init to use the cx-less interface where it makes sense. r=bholley 2015-02-13 16:53:00 -05:00
Dave Huseby
6c1bf2a61c Bug 1114667 - crash in js::VectorToIdArray(JSContext*, JS::AutoIdVector&, JSIdArray**). r=bholley 2015-02-10 18:07:00 +01:00
Garvan Keeley
17748b8c40 Bug 1125411 - OSX: turn CoreLocation provider on, r=cpeterson
Also, expose this setting in about:config
2015-01-26 12:25:00 +01:00
Carsten "Tomcat" Book
678a4b88ec Backed out changeset 32fe616d4950 (bug 1125411) 2015-01-27 09:16:40 +01:00
Garvan Keeley
573cdfe3ac Bug 1125411 - OSX: turn CoreLocation provider on, r=cpeterson
Also, expose this setting in about:config
2015-01-26 12:25:00 +01:00
Makoto Kato
2b4be5e6f7 Bug 512407 - Support Windows Location API. r=jdm,jmathies 2015-01-23 18:43:46 +09:00