Граф коммитов

154 Коммитов

Автор SHA1 Сообщение Дата
Boris Zbarsky 417c6749c3 Bug 1581276. Require a message arg to ThrowDOMException. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D46250

--HG--
extra : moz-landing-system : lando
2019-09-20 02:17:01 +00:00
Boris Zbarsky fa0ce4b209 Bug 1581315 part 1. Adjust MOZ_MUST_RETURN_FROM_CALLER to only apply to method calls on arguments. r=nika
It doesn't really make sense to enforce this behavior for calls on stack
variables (which presumably we then want to do something with) and doesn't
necessarily make sense to enforce it for member variables either.

Differential Revision: https://phabricator.services.mozilla.com/D46105

--HG--
extra : moz-landing-system : lando
2019-09-20 02:17:01 +00:00
Markus Stange 6efbe54e95 Bug 1515214 - Add CallbackObject::GetDescription and TimeoutHandler::GetDescription. r=bzbarsky
This allows us to create profiler markers whose description contains the name
of the function and its file / line number. This allows the profiler UI to
match up setTimeout callbacks for multiple instances of the same page load, in
order to create meaningful profile comparisons based on markers.

Differential Revision: https://phabricator.services.mozilla.com/D19192

--HG--
extra : moz-landing-system : lando
2019-07-10 20:48:14 +00:00
Boris Zbarsky 3910c9fe0a Bug 1561887 part 2. Fix cycle-collection skipping of JSEventHandler to work correctly. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D36870

--HG--
extra : moz-landing-system : lando
2019-07-09 17:04:59 +00:00
Boris Zbarsky 356eb6dfd9 Bug 1547923 part 5. Start using nsIGlobalObject::GetGlobalJSObjectPreserveColor where possible. r=mccr8,jonco
Differential Revision: https://phabricator.services.mozilla.com/D29706

--HG--
extra : moz-landing-system : lando
2019-05-03 15:15:31 +00:00
Boris Zbarsky ff72e84ac1 Bug 1547923 part 4. Add nsIGlobalObject::HasJSGlobal(). r=mccr8
Consumers that just care about this boolean state should use this instead of
getting the JSObject* directly.

Differential Revision: https://phabricator.services.mozilla.com/D29705

--HG--
extra : moz-landing-system : lando
2019-05-02 21:32:17 +00:00
Boris Zbarsky d0bcf72821 Bug 1543564 part 2. Get rid of pointless nsPIDOMWindowInner::AsInner methods. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D27027

--HG--
extra : moz-landing-system : lando
2019-04-11 14:12:43 +00:00
Brindusan Cristian 86556db730 Backed out 2 changesets (bug 1515214) for hazard build bustage at CallbackObject.cpp. CLOSED TREE
Backed out changeset 7c4973b0d0e8 (bug 1515214)
Backed out changeset 9aabc3ad2470 (bug 1515214)

--HG--
extra : histedit_source : fe9f52b4aa92e6c3aacb62d5eba3807353c20654
2019-03-08 00:04:31 +02:00
Markus Stange 18e5146459 Bug 1515214 - Add CallbackObject::GetDescription. r=bzbarsky
This allows us to create profiler markers whose description contains the name
of the function and its file / line number. This allows the profiler UI to
match up setTimeout callbacks for multiple instances of the same page load, in
order to create meaningful profile comparisons based on markers.

Differential Revision: https://phabricator.services.mozilla.com/D19192

--HG--
extra : moz-landing-system : lando
2019-03-07 18:04:43 +00:00
Jeff Walden 59aaefa333 Bug 1522350 - Move JS::ContextOptions{,Ref} to a new js/public/ContextOptions.h header to further slim jsapi.h. r=arai
--HG--
rename : js/src/jsapi.h => js/public/ContextOptions.h
2019-01-23 16:56:56 -08:00
Jan de Mooij b8a316aca4 Bug 1512260 - Make wrapper nuking work with a target realm instead of target compartment. r=kmag
For *incoming* wrappers this preserves behavior. We nuke *outgoing* wrappers
when all realms in the compartment have been nuked. To implement this I moved
the wasNuked flag from XPConnect to JS::Compartment as nukedOutgoingWrappers and
to JS::Realm as nukedIncomingWrappers.

The code to create a dead wrapper in the nuked compartment/realm case was also
moved into the JS engine. I added a shell test for it.

Differential Revision: https://phabricator.services.mozilla.com/D14149

--HG--
extra : moz-landing-system : lando
2018-12-12 08:02:30 +00:00
Ciure Andrei 12adcc1edd Backed out changeset a8dd01db9f92 (bug 1512260) requsted by owner (missing test) CLOSED TREE 2018-12-12 09:14:53 +02:00
Jan de Mooij 89da963b10 Bug 1512260 - Make wrapper nuking work with a target realm instead of target compartment. r=kmag
For *incoming* wrappers this preserves behavior. We nuke *outgoing* wrappers
when all realms in the compartment have been nuked. To implement this I moved
the wasNuked flag from XPConnect to JS::Compartment as nukedOutgoingWrappers and
to JS::Realm as nukedIncomingWrappers.

The code to create a dead wrapper in the nuked compartment/realm case was also
moved into the JS engine. I added a shell test for it.

Differential Revision: https://phabricator.services.mozilla.com/D14149

--HG--
extra : moz-landing-system : lando
2018-12-12 06:39:38 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Kris Maglione 6b594aefe4 Bug 1480244: Part 1b - Rename nsInProcessTabChildGlobal to InProcessTabChildMessageManager. r=bz
MozReview-Commit-ID: GgleVt1tXTG

--HG--
rename : dom/base/nsInProcessTabChildGlobal.cpp => dom/base/InProcessTabChildMessageManager.cpp
rename : dom/base/nsInProcessTabChildGlobal.h => dom/base/InProcessTabChildMessageManager.h
extra : rebase_source : c0a595cb31c98952e9586830c8d1cee9f9d4c62b
2018-08-10 14:08:07 -07:00
Jan de Mooij 4af62d6c9e Bug 1480678 part 7 - Use CallbackObject's callback global for realm entering in more places. r=bz 2018-08-07 14:06:44 +02:00
Jan de Mooij 5824a03a39 Bug 1478359 - Store a global object in nsXPCWrappedJS and use it for realm-entering. r=mccr8
The problem we're solving here: getting/entering the realm/global of a cross-compartment wrapper doesn't make sense once there are multiple realms in a compartment and the CCW will be shared by all of them. Because nsXPCWrappedJS can store a CCW, we will no longer be able to use this JSObject to enter the target realm.

What this patch does: we pass a JSContext* to nsXPCWrappedJS::GetNewOrUsed and we use this to store a global object in nsXPCWrappedJS (with the invariant that the object and global stored in nsXPCWrappedJS are same-compartment). Then when we want to enter the nsXPCWrappedJS's target realm, we use this global object instead of the maybe-CCW object. Because we currently still have one realm per compartment and the objects are same-compartment, this is guaranteed to preserve behavior for now.

nsXPCWrappedJS has some code to deal with weak pointers. Fortunately this applies only to root wrappers and root wrappers always store an unwrapped JSObject, so the extra global we store is guaranteed to be marked by the GC in that case (a global object is never collected when there are live JSObjects belonging to the same realm).
2018-08-07 11:57:41 +02:00
Boris Zbarsky f771d7e529 Bug 1477923. Make WebIDL callbacks store a global in addition to the object that's used as a callback. r=mccr8
We want to be able to enter the Realm we were in when the callback was created
before calling it, but if the callback stores a cross-compartment wrapper we
don't really have a good way to find that Realm.  So we store it explicitly by
storing a global when the callback is created.

The changes to the constructor signatures to use JSObject* instead of
JS::Handle<JSObject*> are so we can avoid having to root the global for these
calls.  These changes make two of the constructors ambiguous when nullptr is
being passed for the first arg; this patch adds casts to disambiguate.
2018-08-03 17:11:39 -04:00
Jan de Mooij 84036b8de4 Bug 1474272 part 4 - Stop using js::GetGlobalForObjectCrossCompartment in xpc::NativeGlobal. r=bholley 2018-08-01 11:25:50 +02:00
Jan de Mooij 80adc67aba Bug 1478955 part 1 - Rename JSAutoRealm to JSAutoRealmAllowCCW. r=luke 2018-07-28 12:12:26 +02:00
Jan de Mooij a51f9bdda9 Bug 1472973 part 2 - Use JS::GetNonCCWObjectGlobal in some functions where we unwrapped the object. r=bz 2018-07-06 18:16:23 +02:00
Jan de Mooij ce3eb7d5c0 Bug 1464374 part 2 - Pass JS::Realm* instead of JSCompartment* to CallSetup. r=bz,luke
The principals are on the realm so we need a realm instead of a compartment. Also adds js::GetNonCCWObjectRealm to get the realm of a non-CCW object.
2018-05-31 11:28:48 +02:00
Jan de Mooij 80e44e8003 Bug 1461292 part 1 - Rename JSAutoCompartment to JSAutoRealm. r=bz,luke 2018-05-16 10:53:16 +02:00
Daniel Holbert ac637fa79e Bug 1447420: Give CallbackObject.cpp an include for nsContentUtils.h (whose methods it calls). r=baku
MozReview-Commit-ID: 84cktBhkUOd

--HG--
extra : rebase_source : 1d03ce470c749e675e8afb9cd0ffe0cce686c109
2018-03-20 12:18:20 -07:00
Olli Pettay 2439836b37 Bug 1193394 - Part 1: Microtasks and promises scheduling. r=bevis 2017-11-17 11:01:27 +08:00
Csoregi Natalia 1fd0486e23 Backed out 7 changesets (bug 1193394) for browser-chrome failures on browser_ext_popup_background.js. CLOSED TREE
Backed out changeset 9683f24ff8ec (bug 1193394)
Backed out changeset 0e7140a7c841 (bug 1193394)
Backed out changeset a0e26f6b2784 (bug 1193394)
Backed out changeset 29e1fceaf48d (bug 1193394)
Backed out changeset b8632bbbd273 (bug 1193394)
Backed out changeset a54ef2d8f896 (bug 1193394)
Backed out changeset 55c94c05c57f (bug 1193394)
2018-03-01 16:29:02 +02:00
Olli Pettay b7726493fb Bug 1193394 - Part 1: Microtasks and promises scheduling. r=bevis 2017-11-17 11:01:27 +08:00
Nika Layzell f1ac9bf744 Bug 1419597 - Part 18: Remove IsInnerWindow and IsOuterWindow methods, r=smaug
MozReview-Commit-ID: DAAm6tLubhJ
2017-11-23 13:12:13 -05:00
Nika Layzell 3409141758 Bug 1414974 - Part 2: Switch many consumers to nsGlobalWindow{Inner,Outer}, r=smaug
This is a large patch which tries to switch many of the external consumers of
nsGlobalWindow to instead use the new Inner or Outer variants.

MozReview-Commit-ID: 99648Lm46T5
2017-11-09 10:44:47 -05:00
Steve Fink 67d7e8dcdc Bug 1406570 - Rooting improvements, r=jonco,bz
--HG--
extra : rebase_source : 48d6fd63e016abe7a6ce22e621d25858560e61f1
2017-10-09 10:59:02 -07:00
Olli Pettay 478b3b1343 Bug 1405821 - Move microtask handling to CycleCollectedJSContext, r=baku 2017-10-05 18:34:12 +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
Boris Zbarsky b986760665 Bug 1396904. Remove bogus and no longer needed AutoSuppressGCAnalysis. r=mccr8 2017-09-09 04:11:25 -04: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
Michael Layzell e66a0f7027 Bug 1331434 - Part 5: Mark some Throw calls in /dom/bindings as having custom cleanup, r=baku
MozReview-Commit-ID: CooKyfkMlWq
2017-03-07 19:06:48 -05: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
Olli Pettay 0364dbc792 Bug 1326507, remove NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS, r=mccr8
--HG--
extra : rebase_source : 3ae1207308de120b7299b13ecaa95dd1612b3459
2017-01-03 21:47:55 +02: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 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 4821850eb8 Bug 1295322 part 2. Stop propagating through xpconnect exceptions to consumers that won't be able to work with them. r=bholley 2016-08-26 15:38:16 -04:00
Boris Zbarsky eb139d85bf Bug 1279313 part 1. Simplify AutoEntryScript to not make callers pass in a JSContext. r=bholley 2016-07-07 20:08:25 -04:00
Ms2ger 595eb44ead Bug 1273499 - Move some code around in CallSetup::CallSetup() to avoid code repetition; r=bz
This has been possible since changeset d5f6867173c9 (bug 1262630).
2016-06-03 11:11:45 +02:00
Boris Zbarsky dc120449d2 Bug 1275698. Get rid of nsScriptSecurityManager::ScriptAllowed and replace it with xpc::Scriptability::Get(obj).Allowed() for better performance and less indirection. r=khuey 2016-05-27 20:26:56 -04: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 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 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 049c40b0ef Bug 1269400. Provide better error messages for the cases when a CallSetup fails and we hence fail to execute a Web IDL callback. r=bholley 2016-05-04 13:59:42 -04:00