Commit Graph

120 Commits

Author SHA1 Message Date
Jason Orendorff
e7c94fff59 Bug 1439063 - Part 1: Move several public headers from js/src to js/public. r=jandem.
js/src/jsalloc.h -> js/public/AllocPolicy.h
jsalloc.cpp -> js/src/util/AllocPolicy.cpp
jsbytecode.h -> merge into js/public/TypeDecls.h
jsprf.h -> js/public/Printf.h
jsprf.cpp -> js/src/util/Printf.cpp
jsprototypes.h -> public/ProtoKey.h
jswrapper.h -> js/Wrapper.h

--HG--
rename : js/src/jsalloc.h => js/public/AllocPolicy.h
rename : js/src/jsprf.h => js/public/Printf.h
rename : js/src/jsprototypes.h => js/public/ProtoKey.h
rename : js/src/jswrapper.h => js/public/Wrapper.h
rename : js/src/jsalloc.cpp => js/src/util/AllocPolicy.cpp
rename : js/src/jsprf.cpp => js/src/util/Printf.cpp
extra : rebase_source : 98b16d94c469202eab0303a8da844f1d0b6aa809
extra : amend_source : e0b16c1077226d6fe240f4d7096537f93b43f2b8
extra : histedit_source : d94e0ba7904a7d66742c7fac43f638aaec4fa4e5
2018-02-21 10:30:19 -06:00
Andrea Marchesini
baa04d619a Bug 1120178 - Migrate DOMError to DOMExtension in FileReader, IndexedDB, DOMRequest and so on, r=smaug 2017-08-06 20:47:00 +03:00
Kris Maglione
f37317cad0 Bug 1369533: Return dead wrappers rather than null for dead CallbackObject values. r=bz
We don't have access to an appropriate context to create the dead wrapper in
when the callback is nuked, so instead, this patch creates a new dead wrapper
in the caller compartment each time the property is accessed. This is the same
behavior we'd get when trying to re-wrap a cross-compartment dead wrapper, so
it's consistent with the way we handle these situations elsewhere.

MozReview-Commit-ID: 3cMeR4z8EOe

--HG--
extra : rebase_source : 7e8cf4a195ef64deb7677ce4ac9818d342815667
2017-09-04 17:21:06 -07:00
Thomas Wisniewski
3646a5cbe9 Bug 1036659 - Don't call mozilla::DropJSObjects() in CallbackObject::DropJSObjects(). r=mccr8
MozReview-Commit-ID: AbD1NUqCvFD
2017-06-16 17:15:32 -04:00
Jon Coppeard
82cbd987a2 Bug 1338623 - Add a slower but more exact gray marking check for checking correctness r=sfink r=mccr8 2017-03-02 10:22:47 +00:00
Kris Maglione
d0f62ee58a Bug 1336988: Correctly handle dead callback objects when iterating over event listeners. r=peterv
MozReview-Commit-ID: 5vGlPL1p3uh

--HG--
extra : rebase_source : 7e33d93472faa1c047361addf8b15f8a78639255
2017-02-06 11:34:56 -08:00
Kris Maglione
67fcf5b318 Bug 1273251: Part 4 - Drop CallbackObject's JS objects for nuked compartments during CC. r=peterv,mccr8
MozReview-Commit-ID: 6lPdmUtKREt

--HG--
extra : rebase_source : c6a53f914b5bbe829de6f5a080cfb9ee93146bd3
2016-11-14 19:49:28 -08:00
Kris Maglione
729b7a2019 Bug 1273251: Part 3 - Allow CallbackObject to contain a null callable. r=peterv
MozReview-Commit-ID: FCXVHouhG3I

--HG--
extra : rebase_source : f3e9325559d40bcb4017ec2505f435275d4fea7f
2016-11-14 21:25:37 -08:00
Boris Zbarsky
3f8b6befb3 Bug 1326105 part 5. Move the getting of the incumbent global to the finish-slow-js codepath too, since it's not needed if no one will ever call our callback. r=smaug 2016-12-29 13:19:26 -08:00
Boris Zbarsky
249298d20c Bug 1326105 part 4. Remove the now-unused JSContext argument of the protected CallbackObject constructor. r=smaug 2016-12-29 13:19:26 -08:00
Boris Zbarsky
ba1f5c039f Bug 1326105 part 3. Move async stack capture out of the 'fast' CallbackObject constructor and into FinishSlowJSInitIfMoreThanOneOwner. r=smaug 2016-12-29 13:19:26 -08:00
Boris Zbarsky
e5f32d3609 Bug 1326105 part 2. Rename CallbackObject::HoldJSObjectsIfMoreThanOneOwner to a more generic name and hand it a JSContext to use. r=smaug 2016-12-29 13:19:26 -08:00
Boris Zbarsky
f3debaf2fb Bug 1326105 part 1. dom::RootedCallback should hold on to a JSContext that it can then use in its destructor. r=smaug 2016-12-29 13:19:25 -08:00
Jon Coppeard
556585c65f Bug 1297558 - Remove explicit calls to Expose*ToActiveJS r=mccr8 2016-10-18 17:58:19 +01:00
Jon Coppeard
38b109439a Bug 1307372 - Avoid triggering mCallback read barrier in CallbackObject::CallbackKnownNotGray r=mccr8 2016-10-05 10:09:24 +02:00
Xidorn Quan
31f5ebf083 Bug 1287706 part 1 - Make CallbackObjectHolder movable (and actually move-only). r=smaug
So that we can avoid unnecessary refcount changes.

MozReview-Commit-ID: 4Mk9SJTj6AS

--HG--
extra : source : c35643f76ef33b6cdce115c8de0dfae8abccd644
2016-07-28 12:00:06 +10:00
Andrew McCreight
1d1ce1020c Bug 1283636 - Use CallbackPreserveColor() less. r=bz
Some places call CallbackPreserveColor() because they know the object
must have already been marked black. This patch replaces those calls
with a new function CallbackKnownNotGray() which documents and
dynamically checks this assumption.
2016-07-13 13:28:00 +02:00
Jan de Mooij
a53a99aab6 Bug 1284808 - Rename RuntimeOptions to ContextOptions and move it to the context. r=luke,baku
--HG--
extra : rebase_source : acd82642a27b36b98bf1bf34c29d33c7e0b57dea
2016-07-07 08:15:15 +02:00
Boris Zbarsky
bfc23d53a8 Bug 1273661 part 3. Add the codegen bits and Trace implementation to allow Web IDL callbacks to not have to HoldJSObjects until the bindings have determined that someone is actually holding on to the callback object. r=smaug,terrence 2016-05-18 12:23:35 -04:00
Boris Zbarsky
24fa4ec444 Bug 1273661 part 1. Add a way to construct a callback object without calling HoldJSObjects. r=smaug 2016-05-18 12:23:35 -04:00
Boris Zbarsky
61b3aedfa3 Backed out changesets bdb5b50fd858, 74dbcb56456d, 8f319062be85, 9806d7a88802, c08f417d85fd (bug 1273661) for build bustage and CLOSED TREE. 2016-05-19 00:26:24 -04:00
Boris Zbarsky
5938137a2b Bug 1273661 another followup. Guess that msvc is not being happy with OwningNonNull not being pulled in here. r=STILL CLOSED TREE 2016-05-19 00:01:43 -04:00
Boris Zbarsky
1a82ba56e3 Bug 1273661 followup. We need different RootedCallback destructors for the OwningNonNull and RefPtr cases, unfortuntately. r=CLOSED TREE 2016-05-18 23:38:23 -04:00
Boris Zbarsky
893059f88a Bug 1273661 part 3. Add the codegen bits and Trace implementation to allow Web IDL callbacks to not have to HoldJSObjects until the bindings have determined that someone is actually holding on to the callback object. r=smaug,terrence 2016-05-18 12:23:35 -04:00
Boris Zbarsky
384428f2af Bug 1273661 part 1. Add a way to construct a callback object without calling HoldJSObjects. r=smaug 2016-05-18 12:23:35 -04:00
Ms2ger
dd6ade76ab Bug 1260417 - Part c: Stop mentioning requests around CallSetup::mRootedCallable; r=bz
Rooted used to only work when the JSContext was in a request. This has long
been rectified, so the comments referring to that constraint are confusing at
best.
2016-04-07 09:11:52 +02:00
Ms2ger
c005f7ce82 Bug 1260417 - Part a: Add a comment about the compartment of CallbackObject::mCallback; r=bz 2016-04-07 09:11:52 +02:00
Nathan Froyd
cccdd9fbca Bug 1177488 - use |const char*| for representing async call reasons; r=bz,fitzgen
Using a simple |const char*| is more memory-efficient than allocating a
JS string. We still have to allocate the JS string for passing things
into JS, but ideally we will be able to move the point of allocation
much closer to where it's actually needed, rather than indiscriminantly
doing it all the time.
2016-03-23 10:40:53 -04:00
Wes Kocher
ea76ed99d7 Backed out changeset 95494e68c722 (bug 1177488) for crashes in test_bug732665.xul CLOSED TREE
MozReview-Commit-ID: IFUHUBUCnCD
2016-03-25 12:11:48 -07:00
Nathan Froyd
418aa2af4f Bug 1177488 - use |const char*| for representing async call reasons; r=bz,fitzgen
Using a simple |const char*| is more memory-efficient than allocating a
JS string. We still have to allocate the JS string for passing things
into JS, but ideally we will be able to move the point of allocation
much closer to where it's actually needed, rather than indiscriminantly
doing it all the time.
2016-03-23 10:40:53 -04:00
Till Schneidereit
6602beaac6 Bug 1257030 - Add support for supplying preexisting stack instead of capturing one for use as the async parent stack of CallbackObject. r=bz,tromey 2016-03-17 18:07:43 +01:00
Wes Kocher
168746512d Backed out changeset ee3c99e6f676 (bug 1177488) for LeakSanitizer failures
MozReview-Commit-ID: FFfF4u2vOrS

--HG--
extra : rebase_source : 0c7f5e290b388b2f35837a5f757f2d962b973da3
2016-03-14 13:15:21 -07:00
Nathan Froyd
6b6c2a1fcd Bug 1177488 - use |const char*| for representing async call reasons; r=bz,fitzgen
Using a simple |const char*| is more memory-efficient than allocating a
JS string.  We still have to allocate the JS string for passing things
into JS, but ideally we will be able to move the point of allocation
much closer to where it's actually needed, rather than indiscriminantly
doing it all the time.
2016-03-08 16:29:25 -05:00
Nathan Froyd
c381a6b86c Bug 1218454 - part 2 - don't #include nsContentUtils.h from CallbackObject.h; r=bz
We used to need nsContentUtils.h here for nsCxPusher, but since that got
moved to ScriptSettings.h, we no longer need nsContentUtils.h for
anything.
2015-10-26 12:14:47 -04:00
Boris Zbarsky
89a6485e7f Bug 1172246. Make sure CallSetup's handling of exceptions it wants to deal with itself works even when the callable is a JSNative that uses the JS_Report*Error APIs instead of throwing exceptions in the usual way. r=bholley 2015-06-08 16:16:27 -04:00
Boris Zbarsky
888bc2d651 Back out bug 1172246 because of mochitest-JP bustage. Who needs tests that we care about running on try anyway? 2015-11-20 18:00:27 -05:00
Boris Zbarsky
bc25c907d6 Bug 1172246. Make sure CallSetup's handling of exceptions it wants to deal with itself works even when the callable is a JSNative that uses the JS_Report*Error APIs instead of throwing exceptions in the usual way. r=bholley 2015-06-08 16:16:27 -04:00
Nathan Froyd
01583602a9 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

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Olli Pettay
efbb629c53 Bug 1196317 - Optimize CallbackObject::mCreationStack out from cycle collection graph when possible, r=mccr8
--HG--
extra : rebase_source : af43dc4dfaf68ee979b3111134dc7ea006e1226d
2015-08-20 18:36:06 +03:00
Tom Tromey
9f3b16bf4c Bug 1148593 - Create async stack in callback objects. r=bz, r=fitzgen
--HG--
extra : rebase_source : f9b507d8f005dbca6f40f510ca41a0cbb03aebf9
2015-07-24 07:01:00 -04:00
Tom Tromey
a37b7fa928 Bug 1148593 - Pass JSContext to CallbackObject constructor. r=bz
--HG--
extra : rebase_source : 5c4c1b8dc646fc76bda37a8c6e35a6494d0800b8
2015-07-24 07:00:00 -04:00
Ryan VanderMeulen
b171b787bd Backed out changesets fa9fe193778f and 3eaf867930dd (bug 1148593) for test_async_setTimeout_stack.html and test_async_setTimeout_stack_across_globals.html failures. 2015-07-17 12:37:24 -04:00
Tom Tromey
843465db8e Bug 1148593 - Create async stack in callback objects. r=bz, r=fitzgen 2015-07-17 07:48:00 -04:00
Tom Tromey
2bbc02624b Bug 1148593 - Pass JSContext to CallbackObject constructor. r=bz 2015-07-17 07:47:00 -04:00
Andrew McCreight
9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Ehsan Akhgari
399276d5fc Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 21:40:49 -04:00
Wes Kocher
638b28b8e0 Backed out changeset 02e6a50741a9 (bug 1153348) to hopefully fix the static bustage CLOSED TREE 2015-04-21 15:47:40 -07:00
Ehsan Akhgari
3d21a05904 Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 16:31:58 -04:00
Jim Blandy
ebd83c9a61 Bug 1152577: Add 'aReason' argument to AutoEntryScript constructor, and provide plausible names for its instantiations. r=bholley
--HG--
extra : rebase_source : 8ab7a3628a5b4d94b957f24e23e4c5c7871db97c
2015-04-08 21:23:48 -04:00
Boris Zbarsky
8615709f13 Bug 1107953 part 1. Change the invariants around aCompartment in CallSetup to allow passing it even when the exception handling mode is eRethrowExceptions. r=bholley 2015-01-15 17:39:01 -05:00