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

6856 Коммитов

Автор SHA1 Сообщение Дата
Bogdan Tara f2cb75b28c Merge inbound to mozilla-central. a=merge 2018-08-03 13:16:27 +03:00
Kristen Wright fbf7880ab6 Bug 1478942 - Convert UniquePtr<SimpleEdgeRange> back to UniquePtr<EdgeRange> to return an EdgeRange. r=erahm 2018-07-27 11:00:40 -07:00
Boris Zbarsky d4993da381 Bug 1476142 part 4. Remove some unnecessary QIs on window in various parts of the tree. r=kmag
The crashtest was not testing anything useful, because getInterface is no longer exposed to web content.
2018-08-02 15:26:48 -04:00
Brian Hackett 51e310f29a Bug 1479547 Part 1 - Remove instrumentation related to non-deterministic GCs, r=mccr8.
--HG--
extra : rebase_source : 6dfc65ab83e770da6e1f64003379156c3b863050
2018-07-31 19:34:50 +00:00
Brian Hackett f43431cd1c Bug 1479651 - Use correct pointer for registering deferred finalization thing for SandboxPrivate, r=smaug.
--HG--
extra : rebase_source : 88e76371da6ba2c75c1bc88c380d1498a603183d
2018-07-31 19:33:04 +00:00
Boris Zbarsky 357b6b1348 Bug 1479570. Get Add a getter to get a docshell from nsIWindowlessBrowser. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D2669

--HG--
extra : moz-landing-system : lando
2018-08-03 00:05:07 +00:00
Gabriele Svelto 50ba13cce4 Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant functions are updated to take a typed enum (in C++) and an
integer constant (in JavaScript). A JavaScript wrapper around the crash
reporter service is provided to hold the constants. The existing whitelists
and blacklists of annotations are also generated from the YAML file and the
existing duplicate code has been consolidated. Once written out to the .extra
file the annotations are converted in string form and are no different than
the existing ones.

All existing annotations have been included (and some obsolete ones removed)
and all call sites have been updated including tests.

--HG--
extra : rebase_source : b4f0d4bf83c64851028c271d3fab3ebcb6fbcd3e
2018-07-05 15:42:11 +02:00
Nika Layzell 051eb6dcbd Bug 1480624 - Part 2: Add a DestructValue method to XPConnect to run XPT Type destructors, r=mccr8
Summary:
DestructValue acts a lot like CleanupValue, however in addition to normal
cleanup work, it invokes the destructor of complex data types. This is important
to ensure that constructors and destructors are matched for these complex data
types.

CleanupValue is also used to clean up a value without destructing it, so cannot
be modified in-place.

Depends On D2689

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1480624

Differential Revision: https://phabricator.services.mozilla.com/D2690
2018-08-03 15:55:13 -04:00
Nika Layzell f1902ff595 Bug 1480624 - Part 1: Add XPT_FOR_EACH_*_TYPE macros to xptinfo.h, r=mccr8
Summary:
This macro simplifies code which allows performing an operation on or
extracting information from a particular nsXPTType's native representation.

It is also used in part 2 to implement xpc::DestructValue.

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1480624

Differential Revision: https://phabricator.services.mozilla.com/D2689
2018-08-03 15:55:13 -04:00
Coroiu Cristina 1ba19a32ac Backed out changeset 86471a18672f (bug 1348273) for ESlint failure at toolkit/modules/WebNavigationChild.jsm
--HG--
extra : rebase_source : e0c94f49ddc1f1b119b72c06fccc1b4363b9d340
2018-08-03 22:48:51 +03:00
Gabriele Svelto eff24befbd Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant functions are updated to take a typed enum (in C++) and an
integer constant (in JavaScript). A JavaScript wrapper around the crash
reporter service is provided to hold the constants. The existing whitelists
and blacklists of annotations are also generated from the YAML file and the
existing duplicate code has been consolidated. Once written out to the .extra
file the annotations are converted in string form and are no different than
the existing ones.

All existing annotations have been included (and some obsolete ones removed)
and all call sites have been updated including tests.

--HG--
extra : rebase_source : f0e8d229581ac5c0daa0e0454cb258746108e28d
2018-07-05 15:42:11 +02:00
Jan de Mooij 741c3a4130 Bug 1479712 part 5 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in xpc::StackScopedClone. r=bholley 2018-08-02 09:15:42 +02:00
Jan de Mooij 4cda94fb7d Bug 1479712 part 4 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in NativeInterface2JSObject. r=bholley
Also fixes some callers to not pass a potential CCW.
2018-08-02 09:15:42 +02:00
Jan de Mooij 1d54f66140 Bug 1479712 part 3 - Remove unnecessary AutoJSContext and JSAutoRealmAllowCCW in JSObject2NativeInterface and nsXPConnect::WrapJS. r=bholley 2018-08-02 09:15:42 +02:00
Jan de Mooij af31466131 Bug 1479712 part 2 - Remove unused nsIXPConnect.getWrappedNativePrototype. r=bholley 2018-08-02 09:15:41 +02:00
Jan de Mooij f672f4f7b6 Bug 1479712 part 1 - Require a plain function in xpcshell setInterruptCallback. r=bholley
The head_watchdog.js test always calls this with a function argument. This lets us use JSAutoRealm instead of JSAutoRealmAllowCCW.
2018-08-02 09:15:41 +02:00
Jan de Mooij 51c1609621 Bug 1479363 part 6 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in js/xpconnect/loader. r=kmag 2018-08-02 08:49:10 +02:00
Nicholas Nethercote 6f95417fb4 Bug 1478879 - Remove Range/Enum use in XPConnect. r=mccr8
--HG--
extra : rebase_source : 2117904e70e05e318e2b13a5653f029dfdbed851
2018-07-31 10:31:00 +10:00
Nicholas Nethercote 6141e31ef4 Bug 1479954 - Rename Hash{Set,Map}::sizeOf{In,Ex}cludingThis(). r=luke
In PLDHashTable the equivalent functions have a "Shallow" prefix, which makes
it clear that they don't measure things hanging off the table. This patch makes
mozilla::Hash{Set,Map} do likewise.

MozReview-Commit-ID: 3kwCJynhW7d

--HG--
extra : rebase_source : 9c03d11f376a9fd4cfd5cfcdc0c446c00633b210
2018-08-01 09:57:52 +10:00
Jon Coppeard 827b83bae3 Bug 1475228 - Allow construction of a SourceBufferHolder from a UniquePtr r=jandem r=kmag 2018-07-17 14:30:23 +01:00
Jon Coppeard 4ff436874c Bug 1475228 - Make asynchronous compile APIs take SourceBufferHolders r=jandem 2018-07-17 14:30:23 +01:00
Jon Coppeard ec2af16383 Bug 1475228 - Make synchronous compile APIs take SourceBufferHolders exclusively r=jandem r=fitzgen 2018-07-17 14:30:22 +01:00
agashlin@mozilla.com a95f425a9e bug 1397297, make SnowWhite freeing more incremental, r=smaug
--HG--
extra : rebase_source : b5082f8753039358177bf99116966b0e51959169
2018-08-01 12:20:03 +03: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
Bogdan Tara eb256a84b2 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-08-01 01:07:12 +03:00
Nika Layzell 7fa88ded1b Bug 1474369 - Part 8: Rename from Sequence to Array in xpidl, r=mccr8
Summary:
This more closely matches the C++ names, and reflects the fact that the
reflected type is not WebIDL's mozilla::dom::Sequence. The reasoning behind this
type difference is for ergonomics, due to xpidl only being exposed to internal
JS code.

Depends On D2335

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2337
2018-07-31 17:53:03 -04:00
Nika Layzell cb71d3b003 Bug 1474369 - Part 7: Rename [array] to LegacyArray within xpt and xpidl, r=mccr8
Summary:
This is done so we can use Array as the name for the new nsTArray-based
type, rather than having to come up with a new name.

LegacyArray was chosen as the [array] attribute is now effectively deprecated,
and we'd like to remove it ASAP.

Depends On D2334

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2335
2018-07-31 17:53:03 -04:00
Nika Layzell f900f5239d Bug 1474369 - Part 6: Use RefPtr for Array<T> of interface and WebIDL types, r=mccr8
Summary:
This means that using these types involves many fewer footguns, while not
requiring any changes to the actual XPConnect implementation!

Depends on D2111

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2334
2018-07-31 17:53:03 -04:00
Nika Layzell 5b6ca0e475 Bug 1475409 - Part 3: Make the different categories of types in xptinfo more explicit, r=mccr8
Summary:
This should make it more clear which types have which behaviours, and should
make it easier to add new types without forgetting to handle a special case
somewhere.

Depends On D2114

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2115
2018-07-31 17:53:02 -04:00
Nika Layzell 985488cb0f Bug 1475409 - Part 2: Be more explicit about the type of nsXPTType::Tag(), r=mccr8
This will get us both more clarity as to what types are, but also will improve switch exhaustiveness checks.

Summary: Depends On D2113

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2114
2018-07-31 17:53:02 -04:00
Nika Layzell 2cb67382dc Bug 1475409 - Part 1: Remove nsXPTType::TagPart(), r=mccr8
Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2113
2018-07-31 17:53:02 -04:00
Nika Layzell cd11b005fc Bug 1474369 - Part 5: Add tests for new Sequence<T> types, r=mccr8
Summary: Depends On D2110

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2111
2018-07-31 17:53:01 -04:00
Nika Layzell d4c9b9edf4 Bug 1474369 - Part 4: Add support for Sequence<T> types to xpidl and XPConnect, r=mccr8
Summary:
This patch adds support for the `Sequence<T>` type. This is largely a
straightforward type propagation patch, but there are a few notable things:

 1. We allow `[iid_is(x)] Sequence<nsQIResult>`, so Sequence can be Dependent.

 2. `Sequence<T>` is reflected into C++ as a `nsTArray<T>`, which is different
    than WebIDL's `mozilla::dom::Sequence<T>` type. This decision was made for
    general ergonomics reasons, as `nsTArray<T>` is more prevailent throughout
    the codebase, and lengths in this case cannot be controlled by content, as
    XPConnect is only exposed to Chrome JS.

 3. Owned pointers in `Sequence<T>` are not reflected as their owned
    counterparts. For example, `Sequence<nsISupports>` is reflected as
    `nsTArray<nsISupports*>` rather than `nsTArray<RefPtr<nsISupports>>`. This
    was done to avoid depending on `RefPtr<T>` and `T*` having the same
    in-memory representation, however if that is considered an acceptable
    dependency, it would be nice to support that.

 4. We also don't reflect singly-owned pointers as their owned counterparts. For
    example, `nsTArray<nsIIDPtr>` would be reflected as `nsTArray<nsIID*>`
    rather than `nsTArray<mozilla::UniquePtr<nsIID>>`. If we are willing to
    depend on `mozilla::UniquePtr<T>`'s in-memory representation, we could also
    do this, however.

 5. There are no restrictions on what types can appear inside of a `Sequence<T>`
    or what can appear inside an `[array] T`. We may want to add restrictions
    either at the xpidl level or in XPConnect.

Depends On D2109

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2110
2018-07-31 17:53:01 -04:00
Nika Layzell 71fd37e0c9 Bug 1474369 - Part 2: Make JSArray2Native and NativeArray2JS more generic, so they can be used with Sequence<T>, r=mccr8
Summary:
The background logic for handling lists of XPConnect values is similar between
`[array] T` and `Sequence<T>`. The major differences are with regard to how
native length is determined, how 'null' and 'undefined' are handled, and how
native buffer allocation is handled.

This patch modifies the JSArray2Native function to make it generic over an
allocation strategy function, which can be implemented for each of `[array] T`
and `Sequence<T>`. The function takes in a `uint32_t*` pointer, pointing at the
computed length of the JS array. The callback can then allocate the correct
backing buffer, and optionally modify the length to copy.

The NativeArray2JS function is also modified to make it directly take a pointer
to the native buffer rather than determining it from a pointer to an `[array] T`
parameter.

Depends On D2105

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2106
2018-07-31 17:53:00 -04:00
Nika Layzell 5ee2c61291 Bug 1474369 - Part 1: Clean up value initialization codepaths in XPConnect, r=mccr8
Summary:
A goal of the Sequence<T> work is to allow using more complex types within lists
in XPConnect. For example, we ideally want to support `Sequence<AString>`,
rather than requiring people to use the unergonomic 'wstring' type.

These types require initialization before they can be read into. Currently this
initialization for parameters is directly handled by XPCWrappedNative's
CallMethodHelper object.

This patch introduces a new function to the `xpc` namespace to initialize a
specific value from an uninitialized state to a safe state.

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2105
2018-07-31 17:53:00 -04:00
Nika Layzell 95fd91c8e3 Bug 1471726 - Part 2: Add basic tests for jsval array codegen, r=mccr8 2018-07-31 17:52:59 -04:00
Gijs Kruitbosch dcbec7c8b6 Bug 1478404 - remove _xpcom_categories annotations as they're dead code, r=florian
Support for the _xpcom_categories property was removed in Bug 568691,
but we left a bunch of consumers behind, and it's been cargo-culted a bit more.
We should remove the remaining remnants.

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

--HG--
extra : moz-landing-system : lando
2018-07-31 17:39:25 +00:00
Jan de Mooij fa4de44430 Bug 1479363 part 8 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in js/xpconnect/wrapper. r=bholley 2018-07-31 08:37:38 +02:00
Jan de Mooij 43f54ada0c Bug 1479363 part 7 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in js/xpconnect/src. r=mrbkap 2018-07-31 08:37:26 +02:00
Cosmin Sabou e748fd8968 Backed out 15 changesets (bug 1475409, bug 1461450, bug 1474369, bug 1471726) for causing rooting hazards and browser chrome failures. CLOSED TREE
Backed out changeset 7ce27aa3ce68 (bug 1474369)
Backed out changeset a8a4e2414daa (bug 1474369)
Backed out changeset 13c9626970e2 (bug 1474369)
Backed out changeset 9817819b7765 (bug 1475409)
Backed out changeset 39fcebfe6529 (bug 1475409)
Backed out changeset c19ca740d3d1 (bug 1475409)
Backed out changeset b26c90518fca (bug 1474369)
Backed out changeset cbdde0474521 (bug 1474369)
Backed out changeset ccea3049fe0f (bug 1474369)
Backed out changeset e9f6d2544a82 (bug 1474369)
Backed out changeset 99c4d07d4b88 (bug 1474369)
Backed out changeset c721ada8a6d6 (bug 1461450)
Backed out changeset 961379be0f5e (bug 1461450)
Backed out changeset cf2448b2635f (bug 1471726)
Backed out changeset 408961783c95 (bug 1471726)
2018-07-30 20:31:24 +03:00
Nika Layzell 72ed07e711 Bug 1474369 - Part 8: Rename from Sequence to Array in xpidl, r=mccr8
Summary:
This more closely matches the C++ names, and reflects the fact that the
reflected type is not WebIDL's mozilla::dom::Sequence. The reasoning behind this
type difference is for ergonomics, due to xpidl only being exposed to internal
JS code.

Depends On D2335

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2337
2018-07-30 11:31:41 -04:00
Nika Layzell 28fd912fa1 Bug 1474369 - Part 7: Rename [array] to LegacyArray within xpt and xpidl, r=mccr8
Summary:
This is done so we can use Array as the name for the new nsTArray-based
type, rather than having to come up with a new name.

LegacyArray was chosen as the [array] attribute is now effectively deprecated,
and we'd like to remove it ASAP.

Depends On D2334

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2335
2018-07-30 11:31:29 -04:00
Nika Layzell 4bde66e24f Bug 1474369 - Part 6: Use RefPtr for Array<T> of interface and WebIDL types, r=mccr8
Summary:
This means that using these types involves many fewer footguns, while not
requiring any changes to the actual XPConnect implementation!

Depends on D2111

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2334
2018-07-30 11:28:22 -04:00
Nika Layzell f6490fc64d Bug 1475409 - Part 3: Make the different categories of types in xptinfo more explicit, r=mccr8
Summary:
This should make it more clear which types have which behaviours, and should
make it easier to add new types without forgetting to handle a special case
somewhere.

Depends On D2114

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2115
2018-07-30 11:28:19 -04:00
Nika Layzell e1f1115f9a Bug 1475409 - Part 2: Be more explicit about the type of nsXPTType::Tag(), r=mccr8
This will get us both more clarity as to what types are, but also will improve switch exhaustiveness checks.

Summary: Depends On D2113

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2114
2018-07-30 11:28:17 -04:00
Nika Layzell 366cd88a89 Bug 1475409 - Part 1: Remove nsXPTType::TagPart(), r=mccr8
Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2113
2018-07-30 11:28:14 -04:00
Nika Layzell 9f0c30cedb Bug 1474369 - Part 5: Add tests for new Sequence<T> types, r=mccr8
Summary: Depends On D2110

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2111
2018-07-30 11:28:11 -04:00
Nika Layzell 0f6863aece Bug 1474369 - Part 4: Add support for Sequence<T> types to xpidl and XPConnect, r=mccr8
Summary:
This patch adds support for the `Sequence<T>` type. This is largely a
straightforward type propagation patch, but there are a few notable things:

 1. We allow `[iid_is(x)] Sequence<nsQIResult>`, so Sequence can be Dependent.

 2. `Sequence<T>` is reflected into C++ as a `nsTArray<T>`, which is different
    than WebIDL's `mozilla::dom::Sequence<T>` type. This decision was made for
    general ergonomics reasons, as `nsTArray<T>` is more prevailent throughout
    the codebase, and lengths in this case cannot be controlled by content, as
    XPConnect is only exposed to Chrome JS.

 3. Owned pointers in `Sequence<T>` are not reflected as their owned
    counterparts. For example, `Sequence<nsISupports>` is reflected as
    `nsTArray<nsISupports*>` rather than `nsTArray<RefPtr<nsISupports>>`. This
    was done to avoid depending on `RefPtr<T>` and `T*` having the same
    in-memory representation, however if that is considered an acceptable
    dependency, it would be nice to support that.

 4. We also don't reflect singly-owned pointers as their owned counterparts. For
    example, `nsTArray<nsIIDPtr>` would be reflected as `nsTArray<nsIID*>`
    rather than `nsTArray<mozilla::UniquePtr<nsIID>>`. If we are willing to
    depend on `mozilla::UniquePtr<T>`'s in-memory representation, we could also
    do this, however.

 5. There are no restrictions on what types can appear inside of a `Sequence<T>`
    or what can appear inside an `[array] T`. We may want to add restrictions
    either at the xpidl level or in XPConnect.

Depends On D2109

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2110
2018-07-30 11:28:08 -04:00
Nika Layzell ef3ba34832 Bug 1474369 - Part 2: Make JSArray2Native and NativeArray2JS more generic, so they can be used with Sequence<T>, r=mccr8
Summary:
The background logic for handling lists of XPConnect values is similar between
`[array] T` and `Sequence<T>`. The major differences are with regard to how
native length is determined, how 'null' and 'undefined' are handled, and how
native buffer allocation is handled.

This patch modifies the JSArray2Native function to make it generic over an
allocation strategy function, which can be implemented for each of `[array] T`
and `Sequence<T>`. The function takes in a `uint32_t*` pointer, pointing at the
computed length of the JS array. The callback can then allocate the correct
backing buffer, and optionally modify the length to copy.

The NativeArray2JS function is also modified to make it directly take a pointer
to the native buffer rather than determining it from a pointer to an `[array] T`
parameter.

Depends On D2105

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2106
2018-07-30 11:28:03 -04:00
Nika Layzell 6391732616 Bug 1474369 - Part 1: Clean up value initialization codepaths in XPConnect, r=mccr8
Summary:
A goal of the Sequence<T> work is to allow using more complex types within lists
in XPConnect. For example, we ideally want to support `Sequence<AString>`,
rather than requiring people to use the unergonomic 'wstring' type.

These types require initialization before they can be read into. Currently this
initialization for parameters is directly handled by XPCWrappedNative's
CallMethodHelper object.

This patch introduces a new function to the `xpc` namespace to initialize a
specific value from an uninitialized state to a safe state.

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2105
2018-07-30 11:28:00 -04:00
Nika Layzell a86f1a8c0a Bug 1471726 - Part 2: Add basic tests for jsval array codegen, r=mccr8 2018-07-30 11:27:52 -04:00
Andreea Pavel 840f785b1e Backed out 8 changesets (bug 1475228) for wpt failures e.g. html/semantics/scripting-1/the-script-element/execution-timing/088.html on a CLOSED TREE
Backed out changeset b2d18ea619ec (bug 1475228)
Backed out changeset 45d3ffe3308e (bug 1475228)
Backed out changeset 02b27f8441be (bug 1475228)
Backed out changeset b82c2cf4b3f1 (bug 1475228)
Backed out changeset 2bc8f24dc3fc (bug 1475228)
Backed out changeset 6104ea971587 (bug 1475228)
Backed out changeset 7c83633262db (bug 1475228)
Backed out changeset 34fb24d52f08 (bug 1475228)
2018-07-30 16:49:02 +03:00
Jon Coppeard 3fb3cc8a1c Bug 1475228 - Allow construction of a SourceBufferHolder from a UniquePtr r=jandem r=kmag 2018-07-17 14:30:23 +01:00
Jon Coppeard cdfffa27fe Bug 1475228 - Make asynchronous compile APIs take SourceBufferHolders r=jandem 2018-07-17 14:30:23 +01:00
Jon Coppeard c6cb9bdf25 Bug 1475228 - Make synchronous compile APIs take SourceBufferHolders exclusively r=jandem 2018-07-17 14:30:22 +01:00
Kris Maglione 02ba563399 Bug 1463016: Part 5 - Add domWindow property to DocShellTreeItem and update callers to use it. r=nika
MozReview-Commit-ID: FRRAdxLHRtG

--HG--
extra : source : 0d69b4fb1ed43751cfcbc0b4f2fe3b6a49bc0494
extra : histedit_source : d0ce31513ffaae2fd7f01f6567a97b6d2d96b797%2Cfff837de7a00fa90809d2c3e755097180dfd56d8
2018-05-20 18:10:16 -07:00
Narcis Beleuzu 561ccb2ceb Backed out 2 changesets (bug 1463016, bug 1463291) for geckoview failures
Backed out changeset fcfb99baa0f0 (bug 1463291)
Backed out changeset 0d69b4fb1ed4 (bug 1463016)
2018-07-29 03:55:23 +03:00
Kris Maglione 636f1839e5 Bug 1463016: Part 5 - Add domWindow property to DocShellTreeItem and update callers to use it. r=nika
MozReview-Commit-ID: FRRAdxLHRtG

--HG--
extra : rebase_source : 36565ef5e74360aad14062005e5bdab2939e888b
2018-05-20 18:10:16 -07:00
Kris Maglione 7c7c5fb182 Bug 1476405: Part 3 - Use reasonable stack sizes and create wrappers for JS threads. r=erahm,tcampbell
For ordinary JS helper threads, we can update names and create wrappers using
the existing thread profiler hooks, but we still need to update their default
stack sizes to avoid huge pages.

For the XPConnect JS Watchdog thread, we sometimes get a wrapper as it is, but
only sometimes. And we never use a reasonable stack size.

MozReview-Commit-ID: EuR3gL5JATL

--HG--
extra : rebase_source : 99985a751a37fb8c515cea8cdae4526b319aba67
extra : intermediate-source : 4831cbfd03ded9ea6dcc8d6f0797f5f80fb717c7
extra : source : f092a32a363911e58c71ed5d2e4bd92347437c7e
2018-07-19 19:29:56 -07:00
Jan de Mooij 80adc67aba Bug 1478955 part 1 - Rename JSAutoRealm to JSAutoRealmAllowCCW. r=luke 2018-07-28 12:12:26 +02:00
Cosmin Sabou 778ca4f84f Backed out 8 changesets (bug 1476405) for causing frequent failures in bug 1479022. a=backout
Backed out changeset ad1674e9152d (bug 1476405)
Backed out changeset e0a021b27d2c (bug 1476405)
Backed out changeset 771288dbf852 (bug 1476405)
Backed out changeset aeebad4f2dc3 (bug 1476405)
Backed out changeset 4831cbfd03de (bug 1476405)
Backed out changeset 0b0c243a1827 (bug 1476405)
Backed out changeset 236b366fdf37 (bug 1476405)
Backed out changeset c767b1b618fb (bug 1476405)
2018-07-28 01:25:25 +03:00
Jan de Mooij ad92a85c3f Bug 1478356 - Pass the unwrapped object's global to AutoEntryScript in XPCWrappedJS code. r=bz 2018-07-27 11:35:57 +02:00
Kris Maglione 831de9e086 Bug 1476405: Part 3 - Use reasonable stack sizes and create wrappers for JS threads. r=erahm,tcampbell
For ordinary JS helper threads, we can update names and create wrappers using
the existing thread profiler hooks, but we still need to update their default
stack sizes to avoid huge pages.

For the XPConnect JS Watchdog thread, we sometimes get a wrapper as it is, but
only sometimes. And we never use a reasonable stack size.

MozReview-Commit-ID: EuR3gL5JATL

--HG--
extra : source : f092a32a363911e58c71ed5d2e4bd92347437c7e
extra : histedit_source : e66e41015f56882fb94b82244da9da3a8dd15c30
2018-07-19 19:29:56 -07:00
Coroiu Cristina 6d037d0cba Backed out 9 changesets (bug 1476405) for causing leaks
Backed out changeset 4113d6fb3c1c (bug 1476405)
Backed out changeset cb7f7cc32687 (bug 1476405)
Backed out changeset 6d18a8bd5ee3 (bug 1476405)
Backed out changeset b2a99f50e642 (bug 1476405)
Backed out changeset b5b9d295545d (bug 1476405)
Backed out changeset f092a32a3639 (bug 1476405)
Backed out changeset 6c154f4d9dd9 (bug 1476405)
Backed out changeset d0ebb3aa8e0f (bug 1476405)
Backed out changeset 06b8093ddc6a (bug 1476405)
2018-07-27 08:56:36 +03:00
Kris Maglione f222aaad95 Bug 1476405: Part 3 - Use reasonable stack sizes and create wrappers for JS threads. r=erahm,tcampbell
For ordinary JS helper threads, we can update names and create wrappers using
the existing thread profiler hooks, but we still need to update their default
stack sizes to avoid huge pages.

For the XPConnect JS Watchdog thread, we sometimes get a wrapper as it is, but
only sometimes. And we never use a reasonable stack size.

MozReview-Commit-ID: EuR3gL5JATL

--HG--
extra : rebase_source : ccf47a10321d2f859d3a3d93e79ac18bf44b73a8
2018-07-19 19:29:56 -07:00
Jan de Mooij bb3767cb60 Bug 1478275 part 3 - Rename GlobalHasExclusiveExpandos to CompartmentHasExclusiveExpandos and make it use IsInSandboxCompartment. r=bholley 2018-07-26 11:00:21 +02:00
Jan de Mooij ce81f1f7ef Bug 1478275 part 2 - Add a CompartmentPrivate::isSandboxCompartment flag and xpc::IsInSandboxCompartment(obj). r=bholley
Wrappers are per-compartment, not per-realm, so this will simplify the next patch. Also, considering the upcoming Realms proposal, it might eventually be possible to have multiple globals in a sandbox compartment.
2018-07-26 10:58:37 +02:00
Jan de Mooij 1f193575a4 Bug 1478275 part 1 - Remove unused CompartmentPrivate::isAddonCompartment. r=bholley 2018-07-26 10:57:15 +02:00
Jan de Mooij 2264882701 Bug 1477989 part 4 - Use JS::GetNonCCWObjectGlobal in xpc::GetXBLScopeOrGlobal. r=bz
GetOrCreateMapEntryForPrototype is the only caller where the object could be a CCW. However there cx and proto are same-compartment (GetOrCreateMapEntryForPrototype asserts this) so I changed that code to use JS::CurrentGlobalOrNull.
2018-07-26 10:53:21 +02:00
Kristen Wright 82fd1509ba Bug 1474383 - JSRuntime hook to construct ubi::Nodes specialized for nsINode instances. r=sfink,jimb,bz
Created a runtime hook to handle DOM nodes. Specialized ubi::Concrete for nsINode-inheriting objects. Displayed outgoing nsISupports* edges on reflector JSObjects. Generated outgoing child edges from nsINodes by examining their children. Updated the UbiNodeCensus to ignore zone checks if there is no zone to be found in a node.

--HG--
extra : rebase_source : 319dccb3277a39e51a79588eac9c8f2b4ff97c2f
2018-07-06 16:52:42 -07:00
Brindusan Cristian d7e724835f Backed out 15 changesets (bug 1475409, bug 1461450, bug 1474369, bug 1471726) for build bustages on xptcstubs_gcc_x86_unix.cpp:55:1. CLOSED TREE
Backed out changeset 79dbf5b9d8db (bug 1474369)
Backed out changeset 7e2e13953e19 (bug 1474369)
Backed out changeset 9d0b9a4c4651 (bug 1474369)
Backed out changeset 9f14f7b8bc3d (bug 1475409)
Backed out changeset bddd838d1910 (bug 1475409)
Backed out changeset 850f21ca1f45 (bug 1475409)
Backed out changeset 320802ab02e3 (bug 1474369)
Backed out changeset db67bf0e7f91 (bug 1474369)
Backed out changeset f355d9be9912 (bug 1474369)
Backed out changeset e1b6a5f74642 (bug 1474369)
Backed out changeset 459635cdfc08 (bug 1474369)
Backed out changeset 44414b1cd32e (bug 1461450)
Backed out changeset a5d04cf5d67f (bug 1461450)
Backed out changeset 40885fbf99c6 (bug 1471726)
Backed out changeset da79e75b9cb3 (bug 1471726)
2018-07-25 22:57:09 +03:00
Nika Layzell 0866987b30 Bug 1474369 - Part 8: Rename from Sequence to Array in xpidl, r=mccr8
Summary:
This more closely matches the C++ names, and reflects the fact that the
reflected type is not WebIDL's mozilla::dom::Sequence. The reasoning behind this
type difference is for ergonomics, due to xpidl only being exposed to internal
JS code.

Depends On D2335

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2337
2018-07-25 15:38:04 -04:00
Nika Layzell 2e51038216 Bug 1474369 - Part 7: Rename [array] to LegacyArray within xpt and xpidl, r=mccr8
Summary:
This is done so we can use Array as the name for the new nsTArray-based
type, rather than having to come up with a new name.

LegacyArray was chosen as the [array] attribute is now effectively deprecated,
and we'd like to remove it ASAP.

Depends On D2334

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2335
2018-07-25 15:38:02 -04:00
Nika Layzell 758bebfa14 Bug 1474369 - Part 6: Use RefPtr for Array<T> of interface and WebIDL types, r=mccr8
Summary:
This means that using these types involves many fewer footguns, while not
requiring any changes to the actual XPConnect implementation!

Depends on D2111

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2334
2018-07-25 15:38:00 -04:00
Nika Layzell 4e4ab925ca Bug 1475409 - Part 3: Make the different categories of types in xptinfo more explicit, r=mccr8
Summary:
This should make it more clear which types have which behaviours, and should
make it easier to add new types without forgetting to handle a special case
somewhere.

Depends On D2114

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2115
2018-07-25 15:37:58 -04:00
Nika Layzell b24e4f4b40 Bug 1475409 - Part 2: Be more explicit about the type of nsXPTType::Tag(), r=mccr8
This will get us both more clarity as to what types are, but also will improve switch exhaustiveness checks.

Summary: Depends On D2113

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2114
2018-07-25 15:37:56 -04:00
Nika Layzell 0df716e08d Bug 1475409 - Part 1: Remove nsXPTType::TagPart(), r=mccr8
Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1475409

Differential Revision: https://phabricator.services.mozilla.com/D2113
2018-07-25 15:37:54 -04:00
Nika Layzell aa005d31b4 Bug 1474369 - Part 5: Add tests for new Sequence<T> types, r=mccr8
Summary: Depends On D2110

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2111
2018-07-25 15:37:52 -04:00
Nika Layzell b47aabdb25 Bug 1474369 - Part 4: Add support for Sequence<T> types to xpidl and XPConnect, r=mccr8
Summary:
This patch adds support for the `Sequence<T>` type. This is largely a
straightforward type propagation patch, but there are a few notable things:

 1. We allow `[iid_is(x)] Sequence<nsQIResult>`, so Sequence can be Dependent.

 2. `Sequence<T>` is reflected into C++ as a `nsTArray<T>`, which is different
    than WebIDL's `mozilla::dom::Sequence<T>` type. This decision was made for
    general ergonomics reasons, as `nsTArray<T>` is more prevailent throughout
    the codebase, and lengths in this case cannot be controlled by content, as
    XPConnect is only exposed to Chrome JS.

 3. Owned pointers in `Sequence<T>` are not reflected as their owned
    counterparts. For example, `Sequence<nsISupports>` is reflected as
    `nsTArray<nsISupports*>` rather than `nsTArray<RefPtr<nsISupports>>`. This
    was done to avoid depending on `RefPtr<T>` and `T*` having the same
    in-memory representation, however if that is considered an acceptable
    dependency, it would be nice to support that.

 4. We also don't reflect singly-owned pointers as their owned counterparts. For
    example, `nsTArray<nsIIDPtr>` would be reflected as `nsTArray<nsIID*>`
    rather than `nsTArray<mozilla::UniquePtr<nsIID>>`. If we are willing to
    depend on `mozilla::UniquePtr<T>`'s in-memory representation, we could also
    do this, however.

 5. There are no restrictions on what types can appear inside of a `Sequence<T>`
    or what can appear inside an `[array] T`. We may want to add restrictions
    either at the xpidl level or in XPConnect.

Depends On D2109

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2110
2018-07-25 15:37:50 -04:00
Nika Layzell 3316e39e4d Bug 1474369 - Part 2: Make JSArray2Native and NativeArray2JS more generic, so they can be used with Sequence<T>, r=mccr8
Summary:
The background logic for handling lists of XPConnect values is similar between
`[array] T` and `Sequence<T>`. The major differences are with regard to how
native length is determined, how 'null' and 'undefined' are handled, and how
native buffer allocation is handled.

This patch modifies the JSArray2Native function to make it generic over an
allocation strategy function, which can be implemented for each of `[array] T`
and `Sequence<T>`. The function takes in a `uint32_t*` pointer, pointing at the
computed length of the JS array. The callback can then allocate the correct
backing buffer, and optionally modify the length to copy.

The NativeArray2JS function is also modified to make it directly take a pointer
to the native buffer rather than determining it from a pointer to an `[array] T`
parameter.

Depends On D2105

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2106
2018-07-25 15:37:46 -04:00
Nika Layzell 9426bbf9e9 Bug 1474369 - Part 1: Clean up value initialization codepaths in XPConnect, r=mccr8
Summary:
A goal of the Sequence<T> work is to allow using more complex types within lists
in XPConnect. For example, we ideally want to support `Sequence<AString>`,
rather than requiring people to use the unergonomic 'wstring' type.

These types require initialization before they can be read into. Currently this
initialization for parameters is directly handled by XPCWrappedNative's
CallMethodHelper object.

This patch introduces a new function to the `xpc` namespace to initialize a
specific value from an uninitialized state to a safe state.

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2105
2018-07-25 15:37:44 -04:00
Nika Layzell 69a27ed832 Bug 1471726 - Part 2: Add basic tests for jsval array codegen, r=mccr8 2018-07-25 15:37:38 -04:00
Brian Hackett 2221c4b95b Bug 1465294 Part 9 - Avoid triggering unhandled recording divergences in XPConnect, r=mccr8.
--HG--
extra : rebase_source : a8a60143d3b8b9cc5c46be42a4dcbd23ad8c0b95
2018-07-24 15:44:35 +00:00
Boris Zbarsky 75abc43e0d Bug 1476145 part 8. Stop using getInterface(nsIDOMWindowUtils) in various test code. r=kmag 2018-07-24 19:47:43 -04:00
Csoregi Natalia f7a71fcb6d Backed out changeset ec8c33de4e10 (bug 1474383) for build bustage. CLOSED TREE 2018-07-24 19:32:06 +03:00
Kristen Wright 657d16c582 Bug 1474383 - JSRuntime hook to construct ubi::Nodes specialized for nsINode instances r=jimb
Created a runtime hook to handle DOM nodes. Specialized ubi::Concrete for nsINode-inheriting objects. Displayed outgoing nsISupports* edges on reflector JSObjects. Generated outgoing child edges from nsINodes by examining their children. Updated the UbiNodeCensus to ignore zone checks if there is no zone to be found in a node.
2018-07-06 16:52:42 -07:00
Kris Maglione 5520b46fd0 Bug 1477129: Part 2 - Fix SharedMap blob handling, and add tests. r=erahm
We were previously failing to send blobs to new content processes, which was a
problem for those processes. But we were also attempting to extract blobs for
new entries that we were serializing after we'd extracted their structured
clone data, and their blob array had been thrown away (which was a problem for
all processes).

This patch fixes both problems.

MozReview-Commit-ID: 3qbAmUTA85g

--HG--
extra : rebase_source : 87ed9356aa23ae83762a887cf12ba1f466e7bf61
2018-07-20 14:44:00 -07:00
Brian Hackett 52b33afe4e Bug 1207696 Part 7 - Ensure deterministic interaction of GC with CC and object references, r=smaug.
--HG--
extra : rebase_source : 5d9e7ebd1dc242ca648193ed1f27ae91d19006de
2018-07-23 14:46:37 +00:00
Brian Hackett 093c01c416 Bug 1207696 Part 6e - Disable the slow script dialog when recording or replaying, r=mrbkap.
--HG--
extra : rebase_source : 756af2eaf75b35f007bbc4ef4e0861cb82c8f0d9
2018-07-23 14:42:56 +00:00
Brian Hackett d138090586 Bug 1465287 Part 7 - Add IPDL and IDL for record/replay directives and fatal errors, r=mccr8.
--HG--
extra : rebase_source : 5f938acb994cf777cfd0630980f29aa03045789c
2018-07-22 11:51:55 +00:00
Jan de Mooij 30d5135f62 Bug 1475559 part 6 - Add principals argument to SavedFrame APIs and do frame filtering based on it. r=bz
This removes AutoMaybeEnterFrameRealm. Most places pass cx->realm->principals: it preserves behavior when the (possibly wrapped) SavedFrame and cx are same-compartment. The main exception is the JSStackFrame DOM bindings code where we have to be a bit smarter about which principals to use.
2018-07-21 14:34:58 +02:00
Jan de Mooij 8c93c6e9e8 Bug 1475559 part 5 - Pass a global object to nsScriptErrorWithStack. r=bz
The stack object might be a CCW and we want to make it impossible to get a CCW's global. Now the caller has to supply a same-compartment global object, so we no longer rely on getting the CCW's global.
2018-07-21 14:34:37 +02:00
Jan de Mooij 90cedbd436 Bug 1475559 part 4 - Remove unnecessary nsScriptError::ToString call in JSErrorToXPCException. r=bz
formattedMsg was passed to XPCConvert::ConstructException, but there we call GetMessageMoz and use that instead.
2018-07-21 14:34:20 +02:00
Jan de Mooij 41bc700eb1 Bug 1475559 part 2 - Rename JS::IsSavedFrame to JS::IsMaybeWrappedSavedFrame and do some minor cleanup. r=bz
Our JS::IsFoo APIs usually don't check for wrappers so being explicit about this seems useful.
2018-07-21 14:32:25 +02:00
Nazım Can Altınova fb6e07639b Bug 1474547 - Add AutoProfilerLabel to place where we load JSM r=mstange
MozReview-Commit-ID: 3VM8h7JygsE

--HG--
extra : rebase_source : 4958b6da91806d48e746fd6876c55a524b7d3ed9
2018-07-10 12:19:55 +02:00
Tiberius Oros d6492ca47e Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-07-18 00:59:21 +03:00
Tiberius Oros d701ae940f Merge inbound to mozilla-central. a=merge 2018-07-18 00:55:33 +03:00
Jan de Mooij ef23676856 Bug 1475699 - Support invoking JS-implemented XPIDL methods/attributes marked as [implicit_jscontext]. r=mccr8 2018-07-17 18:11:03 +02:00
Bobby Holley 1387148cf0 Bug 1452762 - Avoid interrupting the wrong script in watchdog tests. r=arai
My best guess as to the failures here is that we're not actually
reaching the busyWait call by the time the interrupt callback fires,
and thus we're killing unrelated scripts.

MozReview-Commit-ID: GvCJzBcJlXm

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

--HG--
extra : moz-landing-system : lando
2018-07-17 03:16:12 +00:00
Margareta Eliza Balazs ad89a11136 Backed out 7 changesets (bug 1475228) for causing Spidermonkey rust failures on Linux x64 debug
Backed out changeset e91802969fb7 (bug 1475228)
Backed out changeset 623af73419eb (bug 1475228)
Backed out changeset bf96bd78dc11 (bug 1475228)
Backed out changeset 104817d51d1b (bug 1475228)
Backed out changeset d3829c85f650 (bug 1475228)
Backed out changeset 74d10b32b3ea (bug 1475228)
Backed out changeset dde64fbe2f0d (bug 1475228)
2018-07-17 17:57:55 +03:00
Jon Coppeard f168d91fd3 Bug 1475228 - Allow construction of a SourceBufferHolder from a UniquePtr r=jandem r=kmag 2018-07-17 14:30:23 +01:00
Jon Coppeard 89af4d641f Bug 1475228 - Make asynchronous compile APIs take SourceBufferHolders r=jandem 2018-07-17 14:30:23 +01:00
Jon Coppeard 4bf9e8dfe9 Bug 1475228 - Make synchronous compile APIs take SourceBufferHolders exclusively r=jandem 2018-07-17 14:30:22 +01:00
Kris Maglione 30e792ee5b Bug 1473631: Part 7 - Replace pref observers with callbacks in WatchdogManager. r=njn
MozReview-Commit-ID: 7Ctch5PYQzh

--HG--
extra : rebase_source : 80f491d1502a6cce25e5fb153e1d18777b4a3b78
2018-07-05 14:30:58 -07:00
Kris Maglione 0bfdb4329f Bug 1473631: Part 0a - Make preference callbacks typesafe. r=njn
I initially tried to avoid this, but decided it was necessary given the number
of times I had to repeat the same pattern of casting a variable to void*, and
then casting it back in a part of code far distant from the original type.

This changes our preference callback registration functions to match the type
of the callback's closure argument to the actual type of the closure pointer
passed, and then casting it to the type of our generic callback function. This
ensures that the callback function always gets an argument of the type it's
actually expecting without adding any additional runtime memory or
QueryInterface overhead for tracking it.

MozReview-Commit-ID: 9tLKBe10ddP

--HG--
extra : rebase_source : 7524fa8dcd5585f5a31fdeb37d95714f1bb94922
2018-07-06 12:24:41 -07:00
Andrea Marchesini 4e97b69ebf Bug 1476306 - Moving NullPrincipal/ContentPrincipal/SystemPrincipal under mozilla namespace - part 3 - ContentPrincipal, r=ckerschb 2018-07-17 21:38:48 +02:00
Andrea Marchesini 58f78c6f5d Bug 1476306 - Moving NullPrincipal/ContentPrincipal/SystemPrincipal under mozilla namespace - part 2 - SystemPrincipal, r=ckerschb 2018-07-17 21:38:19 +02:00
Andrea Marchesini a053cf1c15 Bug 1476306 - Moving NullPrincipal/ContentPrincipal/SystemPrincipal under mozilla namespace - part 1 - NullPrincipal, r=ckerschb 2018-07-17 21:37:48 +02:00
Jan de Mooij 594a3aa6d4 Bug 1475177 - Change sendCommand xpcshell function to only accept plain JSFunction callbacks. r=evilpie 2018-07-16 14:02:16 +02:00
Masayuki Nakano 5c3723acb2 Bug 1475461 - part 2: Make callers of PLDHashTable::Search() const methods if possible r=Ehsan
Some callers of PLDHashTable::Search() use const_cast, some others are not
const methods due to non-const PLDHashTable::Search().

This patch removes const_cast from the former and mark some methods of the
latter const.

MozReview-Commit-ID: C8ayoi7mXc1

--HG--
extra : rebase_source : 2cba0339756e3278ba6e5f0e8a11e68217a61d34
2018-07-13 19:01:53 +09:00
Kris Maglione 03bf0b5bdd Bug 1463587: Part 2 - Add a shared-memory structured clone key-value store. r=erahm,bz
This class allows one read-write copy of a map in the parent process to share
data with multiple read-only copies in child processes. The maps only hold
onto data as structured clone blobs, and deserialize them each time a key is
read.

This commit only provides the bare-bones data structures. Follow-ups will add
bindings, change events, and automatic flushes.

MozReview-Commit-ID: LimwfmFBNOi

--HG--
extra : rebase_source : e43985c39bd1cfd05a2ad536b0d7f74db494a753
extra : source : c27295337b4c16e2a178106a3aa873d2a0e5a1f4
2018-06-22 20:35:49 -07:00
Matthew Gaudet 5d0bf9c261 Bug 1469044: [Part 2] Remove remainder of MathCache r=jandem
--HG--
extra : rebase_source : 587d69130f2c6d50ca8e14bd0ccaf7a4f58285e8
2018-07-09 16:52:16 -04:00
Jan de Mooij c5364bf395 Bug 1473865 part 5 - Use JS::GetNonCCWObjectGlobal in xpc::WindowGlobalOrNull. r=bz 2018-07-12 16:17:44 +02:00
Jan de Mooij 7967870e29 Bug 1473865 part 4 - Use xpc::WindowOrNull instead of xpc::WindowGlobalOrNull in a few places. r=bz 2018-07-12 16:17:44 +02:00
Jan de Mooij 083d62f388 Bug 1472973 part 15 - Use JS::GetNonCCWObjectGlobal in SandboxCallableProxyHandler::call. r=bz 2018-07-12 12:14:38 +02:00
Gurzau Raul fff6ccd0b0 Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-07-12 01:08:09 +03:00
Jan de Mooij 4f7b2378dc Bug 1474273 - Add xpc::CurrentNativeGlobal and use it instead of NativeGlobal(JS::CurrentGlobalOrNull(cx)). r=bz 2018-07-11 14:07:02 +02:00
imjching 3dcc4fd573 Bug 1416066 - Use XPConnect compilation scope for some non-cached local scripts with codebase principal when preload cache is enabled. r=kmag
When we use the preload cache for some non-cached local scripts in loadSubScript,
we will keep the global that the script was compiled for alive, resulting in a
leak.

We will compile these chrome:// and resource:// scripts with codebase principal in
the XPConnect compilation scope when using mozJSSubScriptLoader to load scripts
synchronously. When the script is evaluated, it will be cloned into the target
scope to be executed. By compiling the script in a different scope, we can avoid
keeping the global that the script was compiled for originally alive.

MozReview-Commit-ID: HYSTvmPCbyR

--HG--
extra : rebase_source : 1ee540e08b9eda9046539f6f20f596732a651034
2018-07-03 21:26:04 -04:00
imjching 0c7582c716 Bug 1416066 - Enable caching for scripts with codebase URLs of about:home, about:newtab, and about:welcome. r=kmag
MozReview-Commit-ID: HC3cNVxWLe6

--HG--
extra : rebase_source : eab95e34618bf1ac856b44db89800b615c6503b8
2018-07-03 21:24:52 -04:00
imjching cee0b1d4b8 Bug 1416066 - Make ScriptPreloader wait for content-document-loaded to fire before writing cache for privileged processes. r=kmag,mconley
MozReview-Commit-ID: 2ElKqWN0clm

--HG--
extra : rebase_source : de5f7cf1a35700659cad9efe38a49e6772564665
2018-06-22 17:29:08 -04:00
imjching c66f4c3e82 Bug 1416066 - Delay initialization of sProcessType for child processes in ScriptPreloader since remoteType in ContentChild is not ready yet. r=kmag
MozReview-Commit-ID: FTmQMbKhlR

--HG--
extra : rebase_source : c6414c627d05ce7510a97850c143d0b8e04c852c
2018-06-22 17:07:12 -04:00
imjching 62198551fb Bug 1416066 - Update script_cache.py to support new version of startup script cache file. r=kmag
MozReview-Commit-ID: IuNZ3kjLcak

--HG--
extra : rebase_source : ef9dcd24f9311956bcae303336b874f6cc358905
2018-06-26 14:02:22 -04:00
imjching 6cb83fd0dd Bug 1416066 - Set default ProcessType in ScriptPreloader to Uninitialized and update version of startup script cache file. r=kmag
MozReview-Commit-ID: FbpMLqrFSIq

--HG--
extra : rebase_source : ffe7056cc2f70730fab0d2c006a5eb838462676d
2018-06-22 16:58:22 -04:00
Boris Zbarsky 8f7c90d6be Bug 1473149. Add an external string variant that keeps a DynamicAtom alive. r=njn,rwood
The change to call AsStatic() in SetKnownLiveAtom is drive-by performance cleanup.
2018-07-10 11:21:42 -07:00
Kris Maglione 8ff07d3c3f Bug 1472495: Don't report shared memmapped cache as explicit memory. r=erahm
MozReview-Commit-ID: 7xWJOdg3mfg

--HG--
extra : rebase_source : 8bb19b94495ae99ec1c4083cd88bd8915003886f
extra : amend_source : e72654de7148415e6999632a0da3f598648685a6
2018-06-30 16:33:50 -07:00
Andreea Pavel 2ef6a9ab83 Merge mozilla-central to mozilla-inbound. a=merge on a CLOSED TREE 2018-07-08 00:54:23 +03:00
Bobby Holley 4da035394a Bug 1447856 - Make the watchdog tests actually wait for completion. r=arai
MozReview-Commit-ID: KjvUxJSrmtk

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

--HG--
extra : moz-landing-system : lando
2018-07-07 07:20:50 +00:00
Kris Maglione 2ced7f0d8b Bug 1471091: Follow-up: Fix crash in devtools tests when they execute process scripts multiple times. r=bustage 2018-07-07 13:15:44 -07:00
Kris Maglione 8751f930ce Bug 1471091: Avoid cloning and caching process scripts. r=mccr8
We only run process scripts once per process, so there's no need to compile
them for the compilation scope, or to keep a separate cloned copy alive for
the length of the session.

This patch changes the caching behavior of message managers to compile
single-use scripts directly for the target global, and avoid caching them for
the rest of the session. It also changes the preloader to drop references to
these scripts after they've been executed and/or encoded, as appropriate.

MozReview-Commit-ID: EfKo2aYbBxl

--HG--
extra : rebase_source : aebc5812bef4413d497ac4fdb59aced00a5a4c8e
extra : absorb_source : cf5795eb0bff47d08b1ab45f002afb3f05109c93
extra : histedit_source : e92619d2a818095241c52d8f1961ccad38300d32
2018-06-29 18:07:46 -07:00
Ciure Andrei f61df5dc45 Backed out 4 changesets (bug 1461450, bug 1471726) for linting failure xpidl.py CLOSED TREE
Backed out changeset 6e8148c1ca7f (bug 1461450)
Backed out changeset 2a02d86bc113 (bug 1461450)
Backed out changeset 1907567a85c5 (bug 1471726)
Backed out changeset c4df8eab6d1c (bug 1471726)
2018-07-07 03:12:10 +03:00
Nika Layzell 95e4893811 Bug 1471726 - Part 2: Add basic tests for jsval array codegen, r=mccr8 2018-07-06 19:53:04 -04:00
Jan de Mooij e918a3c855 Bug 1472973 part 8 - Use JS::GetNonCCWObjectGlobal in XrayAwareCalleeGlobal. r=bz 2018-07-06 18:16:24 +02:00
Jan de Mooij 396c86f339 Bug 1472973 part 7 - Use JS::GetNonCCWObjectGlobal in mozJSComponentLoader::FindTargetObject. r=bz
js::GetJSMEnvironmentOfScriptedCaller returns either nullptr or a NonSyntacticVariablesObject.
2018-07-06 18:16:24 +02:00
Jan de Mooij b6f0af2059 Bug 1472973 part 6 - Use JS::GetNonCCWObjectGlobal in subscript loader. r=bz 2018-07-06 18:16:24 +02:00
Jan de Mooij 09149a5c4a Bug 1472973 part 3 - Remove some GetGlobalForObjectCrossCompartment calls on globals/WindowProxy. r=bz 2018-07-06 18:16:23 +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 3201853e80 Bug 1468752 part 4 - Remove JS_GetGlobalForObject. r=bz 2018-07-06 12:54:00 +02:00
Christian Holler 2a3b6f8ca3 Bug 1471532 - Support Windows in ASan Nightly Reporter builds. r=froydnj
MozReview-Commit-ID: AK2dBOgoazY

--HG--
extra : rebase_source : 1065a2f3b10913ac574cf1187d717f21fc2994e6
extra : histedit_source : 3042e51e496e4e8593b367d89332a9199bf3999c
2018-06-27 11:19:00 +02:00
Olli Pettay b053857985 Bug 1472431, nodes in Shadow DOM aren't orphan, if they are in composed document, r=mccr8 2018-07-01 22:28:17 +03:00
Kris Maglione 2bbae5374b Bug 1470365: Part 1 - Add a compact, read-only, shared-memory string map class. r=erahm
This class implements a shared memory key-value store that fits into a single
memory mapped segment. All of the runtime data for its instances are stored in
the shared memory region, which means that memory overhead for each instance
in each process is only a few bytes.

Importantly, the key and value strings returned by this class are also
pointers into the shared memory region, which means that once an instance is
created, its memory cannot be unmapped until process shutdown.

For the uses I intend to put it to, this is a reasonable constraint. If we
need to use it for shorter-lived maps in the future, we can add an option to
return non-literal dependent strings that will be copied if they need to be
kept alive long term.

MozReview-Commit-ID: 5BwAaDsb7HS

--HG--
extra : rebase_source : b472fe628018f88a2c4d6b3de4b7143aeca55e14
extra : absorb_source : 5cdeb568cfd2b4a5a767191402e699e61e653b3b
2018-06-29 22:50:41 -07:00
Kris Maglione fd093e7cca Bug 1463587: Part 1 - Add helper class for creating snapshots of shared memory regions. r=jld,erahm
This class allows us to map a read-write shared memory region, and then safely
remap it read-only, so that it can be shared with sandboxed content processes.

MozReview-Commit-ID: 2PJMQgOwA4V

--HG--
extra : rebase_source : c556cabfa7d379a91dc9ef7171ac0a7d7d8fb32e
extra : absorb_source : e78e304ed95891c694050f79a0bb5d40d11ee884
2018-06-22 20:30:23 -07:00
Andrew Swan 07dcc1c764 Bug 1451519 Convert specialpowers to a webextension r=kmag
This is a quick-and-dirty port.  It might be nice to replace
SpecialPowersObserver with the webextensions content script injection
system at some point, but that isn't practical right now (since WE experiments
cannot implement new APIs visible to content scripts).

MozReview-Commit-ID: GinCu3VcbWK

--HG--
rename : testing/specialpowers/bootstrap.js => testing/specialpowers/api.js
extra : rebase_source : 0faf7d21c8868c957ddc7fede0d56809f27dc161
extra : intermediate-source : ffb9ce93b92dd6396bfe038d3f6a8bcf929ec277
extra : source : cca596eadd0437dc75b75c119b6c7a405805f703
2018-06-27 13:10:51 -07:00
Coroiu Cristina 896ef35dfd Backed out changeset 722113b8204d (bug 1451519) for browser-chrome failures at browser/base/content/test/performance/browser_startup_content.js on a CLOSED TREE
--HG--
rename : testing/specialpowers/api.js => testing/specialpowers/bootstrap.js
2018-06-29 22:13:46 +03:00
Andrew Swan 849bbbb42d Bug 1451519 Convert specialpowers to a webextension r=kmag
This is a quick-and-dirty port.  It might be nice to replace
SpecialPowersObserver with the webextensions content script injection
system at some point, but that isn't practical right now (since WE experiments
cannot implement new APIs visible to content scripts).

MozReview-Commit-ID: GinCu3VcbWK

--HG--
rename : testing/specialpowers/bootstrap.js => testing/specialpowers/api.js
extra : rebase_source : 8be131e80d95a6bf6e86c994fdfa40c14ba610eb
extra : source : cca596eadd0437dc75b75c119b6c7a405805f703
2018-06-27 13:10:51 -07:00
André Bargull 781fc92292 Bug 1471900: Change return type of JS_EncodeStringToBuffer to bool. r=jandem 2018-06-28 07:35:20 -07:00
Cosmin Sabou a612a6fdf5 Merge mozilla-central to mozilla-inbound. a=merge 2018-06-28 13:13:46 +03:00
Cosmin Sabou f4b3baf021 Merge mozilla-inbound to mozilla-central. a=merge 2018-06-28 13:04:23 +03:00
imjching 4867775c4c Bug 1469072 - Add infrastructure to move Activity Stream into its own content process. r=kmag,mconley
Summary:
This patch adds the infrastructure to move Activity Stream (about:newtab, about:home,
and about:welcome) into its own special content process - the privileged content
process. This feature of running Activity Stream in the privileged content process
is disabled by default. (See "browser.tabs.remote.separatePrivilegedContentProcess"
preference.) We can deal with other about: pages in a follow-up.

Reviewers: mconley

Tags: #secure-revision

Bug #: 1469072

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

MozReview-Commit-ID: 5gIrP4LxcIt

--HG--
extra : rebase_source : d43c411ae60aad3d5a3a496e6729de0b547b4acd
2018-06-20 14:04:51 -04:00
Kris Maglione 6dd32d12e3 Bug 1442737: Use shared JSM global for compilation and privileged junk scopes. r=bholley
MozReview-Commit-ID: 3rLgxQVtc0X

--HG--
extra : rebase_source : 9486cd685b4db0f5f282a8cd362a05056064f32e
extra : intermediate-source : a1db50f691f000a0261a57d39da75675592ada9c
extra : source : 8477472996e06d06a21d8e602e4a92d0ec130ea3
2018-06-24 19:16:33 -07:00
Kris Maglione 14d61004ed Bug 1470793: Stop eagerly XDR encoding scripts in the preloader cache. r=erahm
MozReview-Commit-ID: 2e85c34zt8v

--HG--
extra : rebase_source : 82b750185b598418d2ad0842090fc53bfbeedde3
2018-06-24 18:37:50 -07:00
Kris Maglione 923f03d3d3 Bug 1471089: Improve handling of pre-loaded content processes in script preloader. r=erahm
MozReview-Commit-ID: GwZzQ0ic5Et

--HG--
extra : rebase_source : 0c02b45af7ea9f1bea9e9a4bd466b69aa97eb0f9
2018-06-25 17:45:34 -07:00
Coroiu Cristina 614012f859 Backed out changeset a1db50f691f0 (bug 1442737) for frequent mochitest failures on e.g: dom/workers/test/browser_fileURL.js 2018-06-27 10:58:48 +03:00
Jeff Gilbert 5b753da289 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
Kris Maglione 4f10d70a3d Bug 1442737: Use shared JSM global for compilation and privileged junk scopes. r=bholley
MozReview-Commit-ID: 3rLgxQVtc0X

--HG--
extra : rebase_source : 77afa66ef4fcdf8ac0ce1e2cae99d7a0992bc421
extra : amend_source : c97299a71b9b20370ae79ce4dd33c1833ca3f22f
extra : source : 8477472996e06d06a21d8e602e4a92d0ec130ea3
2018-06-24 19:16:33 -07:00
Margareta Eliza Balazs 616a3ce82b Backed out changeset 8477472996e0 (bug 1442737) for frequent mochitest failures e.g.: toolkit/components/alerts/test/test_principal.html 2018-06-26 11:28:50 +03:00
Kris Maglione a81efd6ad5 Bug 1442737: Use shared JSM global for compillation and privileged junk scopes. r=bholley
MozReview-Commit-ID: 3rLgxQVtc0X

--HG--
extra : rebase_source : bc15130d4db2f449569dbefe1a11c39b2ba1ad10
2018-06-24 19:16:33 -07:00
Andi-Bogdan Postelnicu f0ebe92a4a Bug 1453795 - XPConnect - Initialize member fields in classes/ structures. r=peterv
--HG--
extra : rebase_source : 656f79f07e30e4d1f410ff3c72d71650c8498812
2018-06-15 14:25:49 +03:00
Brindusan Cristian f321a9bf6d Backed out changeset 32d9328cab02 (bug 1453795) as requested by Andi. CLOSED TREE 2018-06-21 13:30:07 +03:00
Andi-Bogdan Postelnicu b5f08ab328 Bug 1453795 - XPConnect - Initialize member fields in classes/ structures. r=peterv
--HG--
extra : rebase_source : b996be8c8e2a7fea85f12c986644948360b47821
2018-06-15 14:25:49 +03:00
Jan de Mooij cf5e1222da Bug 1469217 part 6 - Remove JSPROP_SHADOWABLE, address review comments. r=anba 2018-06-21 11:05:42 +02:00
Jan de Mooij b47f1cb4ba Bug 1469217 part 3 - Clean up TryResolvePropertyFromSpecs; remove a bunch of macros. r=anba 2018-06-21 11:05:42 +02:00
Jan de Mooij 45a7ade57e Bug 1469217 part 2 - Add APIs taking getter/setter objects instead of JSNatives. r=anba 2018-06-21 11:05:42 +02:00
Jan de Mooij 539de0ae06 Bug 1469217 part 1 - Remove JSPROP_PROPOP_ACCESSORS. r=anba 2018-06-21 11:05:41 +02:00
Tom Schuster 7c01dffca0 Bug 1469540 - Remove option to disable Array.prototype.values. r=jandem
--HG--
extra : rebase_source : 5b935db0e58c076b289a7b5a3a8a43fe6e9446b3
2018-06-05 14:57:13 +02:00
Jan Beich f2740b785d Bug 1468928 - Unbreak build without GeckoProfiler after bug 1405374. r=mstange
In file included from objdir/js/xpconnect/src/Unified_cpp_js_xpconnect_src1.cpp:110:
js/xpconnect/src/nsXPConnect.cpp:76:37: error: use of undeclared identifier
      'profiler_register_thread'
    JS::SetProfilingThreadCallbacks(profiler_register_thread, profiler_unregister_thread);
                                    ^
js/xpconnect/src/nsXPConnect.cpp:76:63: error: use of undeclared identifier
      'profiler_unregister_thread'
    JS::SetProfilingThreadCallbacks(profiler_register_thread, profiler_unregister_thread);
                                                              ^

MozReview-Commit-ID: HrBGEkByEum

--HG--
extra : rebase_source : b588e8f04d44d07c348120efc6008e6c24b8949e
2018-06-15 10:12:23 +00:00
Boris Zbarsky 9b13c30592 Bug 1467870. When cloning Xray expando chains for an adopt into the Xray compartment, don't lose expandos. r=mrbkap
This does mean that if the node is adopted back into the original document the
expandos would end up on the reflector at that point.  I think that's OK;
people shouldn't be adopting things in that direction.  Futhermore, if they
adopt, then set expandos, then adopt back they already get this behaviorl

So if we decide we don't want that, we should probably just avoid copying own
props when reparenting into a global whose principals don't subsume the old
global.
2018-06-14 19:06:43 -04:00
Jan de Mooij a2548dc268 Bug 1468252 part 2 - Rename GetOriginalEval to GetRealmOriginalEval, remove scope argument. r=evilpie
--HG--
extra : rebase_source : f1aa3fc12fc775bf64318d16246555badbe83e78
2018-06-14 09:07:30 -07:00
Tom Schuster f7c7d0f881 Bug 1435813 - Enable Array.prototype.flat and Array.prototype.flatMap in release builds. r=till
--HG--
extra : rebase_source : adc7e839e4d241857a89df6c6669c241a14466da
2018-06-05 14:41:41 +02:00
Jan de Mooij 2b3ff5c90a Bug 1468219 - Rename JS_InitStandardClasses to JS::InitRealmStandardClasses, remove obj argument. r=anba
--HG--
extra : rebase_source : 5c092c37298e89096b85524e92d143ff2447f31f
2018-06-13 12:47:47 -07:00
Jan de Mooij de211d96a6 Bug 1468137 - Remove JS_Get*Prototype APIs; use JS::GetRealm*Prototype instead. r=evilpie
--HG--
extra : rebase_source : 9d5e815b83b3a71ab3e74fc2c0e2feb1009f2af9
2018-06-13 12:47:40 -07:00
Joel Maher 1ef32bf5c6 Bug 1405428 - skip-if = verify on xpcshell tests which do not pass test-verify. r=gbrown 2018-06-13 11:34:40 -04:00
Mike Conley bf614c6737 Bug 1458375 - Make ScriptPreloader wait until browser-idle-startup-tasks-finished before writing cache. r=kmag
Originally, the ScriptPreloader stopped recording and wrote its cache when the
browser-delayed-startup-finished notification fired for the first window, but there
are other scripts (both in the content and WebExtension processes) that might run
soon after that we also want to cache.

This patch still makes the parent process stop recording scripts after
browser-delayed-startup-finished, but only prepares and writes the cache
once browser-idle-startup-tasks-finished fires, when it is much more likely
that the content and WebExtension caches are ready to go.

MozReview-Commit-ID: KiBEVvuqQkA

--HG--
extra : rebase_source : 6f0fde65cdafdecf72242a06416fef10304637b8
2018-06-11 12:19:02 -07:00
Steve Fink bc2be79d2a Bug 1405374 - Register JS threads with the profiler, r=jonco
--HG--
extra : rebase_source : c29dffb341bff5e3f020ad0be6d48c045e178a5c
2018-06-07 15:37:08 -07:00
Kris Maglione a4973ad0d6 Bug 1464548: Part 1b - Don't delete properties before redefining them, because deleting properties kills JIT performance. r=mccr8
MozReview-Commit-ID: IUMg59xRoIu

--HG--
extra : rebase_source : 6be1c84601ff868835cad53116ab920d2f2db317
2018-05-25 19:17:58 -07:00
Kris Maglione bbbb42012f Bug 1464548: Part 1a - Add defineLazyGlobalGetters helper. r=mccr8
This allows us to lazily import global properties using
Cu.importGlobalProperties. Aside from making it easier to avoid lazily
importing these properties, it also defines them all in the shared JSM global
so that we don't risk re-creating them in Sandboxes or frameloader globals.

MozReview-Commit-ID: GV6shguUlIG

--HG--
extra : rebase_source : 6b9269f3b33fe085c5ed63ee16e5b4ce9e5343a4
2018-05-25 22:28:27 -07:00
Tom Schuster 731eb0bfab Bug 1451017 - Remove Xray resolveNativeProperty. r=bz
--HG--
extra : rebase_source : 3fca06866110b912478448b06f12dc2158f560c7
2018-05-08 22:09:05 +02:00
Jan de Mooij f7fb3be6ec Bug 1466121 part 1 - Rename JSCompartment to JS::Compartment. r=luke
--HG--
extra : rebase_source : cd7140ecda54f0caa02a96f562167b3c9a107450
2018-06-07 16:44:40 +02:00
Peter Van der Beken b986ba77dd Bug 1053271 - Remove some unused XRayWrapper code. r=bz.
--HG--
extra : rebase_source : 62e659d4b70872997b62185b2f634d87e9242d9d
2018-06-04 16:37:04 +02:00
Peter Van der Beken f4270dc255 Bug 1053271 - Move Sandbox proxy handlers out of XrayWrapper.h. r=bz.
--HG--
extra : rebase_source : 6172fcbc5782ec3e800b034ca5fdba354f0797e2
2018-06-06 11:42:12 +02:00
Peter Van der Beken a47cb53336 Bug 1053271 - Remove XrayTraits' HasPrototype. r=bz.
XPCWN Xrays were the only Xrays that set HasPrototype to 0.

--HG--
extra : rebase_source : c10654e4eb6eb39b3cfe8884009cd1a47dcad807
2018-06-04 14:26:37 +02:00
Peter Van der Beken c02d68395d Bug 1053271 - Remove XPCWN Xrays. r=bz.
--HG--
extra : rebase_source : 4da59c56ffc6eab4af0bf59d3d3861bbc18a33ba
2018-06-04 12:56:38 +02:00
Jan de Mooij 56ca3c9524 Bug 1466501 part 1 - Refactor ZoneSpecifier and add a sameCompartmentAs option to newGlobal in the shell. r=luke 2018-06-07 10:02:10 +02:00
Narcis Beleuzu cf464eabfe Merge inbound to mozilla-central. a=merge 2018-06-06 20:00:09 +03:00
Jan de Mooij 156284156a Bug 1363214 - Remove JS::Realm/JSCompartment inheritance. r=jonco
--HG--
extra : rebase_source : ad63de7c6676532640659d1fccced7f83798e06d
2018-06-06 14:30:52 +02:00
Karl Tomlinson 9e0c1c7c2b bug 1442776 make CycleCollectedJSContext accessible from JSContext private r=peterv
Inheriting PerThreadAtomCache on CycleCollectedJSContext permits use of
static_cast, avoiding one level of indirection compared to adding a
CycleCollectedJSContext* to PerThreadAtomCache.

PerThreadAtomCache is over 18kB, and so WorkerJSContext and WorkletJSContext
are moved from the stack to the heap.

MozReview-Commit-ID: 6jdJeZcviK4

--HG--
extra : rebase_source : 3c2accb71faf3f017a44c405ae0484e57aaf039c
2018-05-10 17:04:12 +12:00
Jan de Mooij 4ded85aeda Bug 1466083 part 9 - Introduce JS::IterateRealmsInCompartment and use it in NukeAllWrappersForCompartment. r=jonco 2018-06-06 12:55:50 +02:00
Jan de Mooij 615ecff147 Bug 1466083 part 8 - Various minor API changes. r=luke
* GetScriptCompartment => GetScriptRealm
* Adds IsSystemRealm in addition to IsSystemCompartment and uses it where we can.
* JS_GetCompartmentPrincipals and IsSystemCompartment now release-assert they have a single realm. This is temporary until we know what Gecko will do/need exactly.
2018-06-06 12:55:50 +02:00
Jan de Mooij 9389383f2c Bug 1466083 part 7 - Replace GetCompartmentZone with GetRealmZone. r=luke 2018-06-06 12:55:50 +02:00
Jan de Mooij 7f38cbf185 Bug 1465728 part 3 - Rename Cu.getCompartmentLocation to Cu.getRealmLocation. r=bz 2018-06-06 11:44:17 +02:00
Jan de Mooij 3d013f2eef Bug 1465728 part 2 - Remove the compartment name callback. r=luke 2018-06-06 11:44:17 +02:00
Jan de Mooij 71d86bded9 Bug 1465728 part 1 - Move location and locationURI fields from CompartmentPrivate to RealmPrivate. r=bz
The xpcprivate.h changes are just code motion, except I changed the order of the GetLocationURI methods to get a much more readable diff.
2018-06-06 11:44:17 +02:00
Miko Mynttinen 4c85ef17cc Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 1e7eea4f2d4ec16ec0c559a8afb26976ddbf4d07
2018-06-01 17:59:07 +02:00
shindli 936dd8d764 Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-06-04 01:07:15 +03:00
arthur.iakab 7e765f798b Backed out 2 changesets (bug 1465060) for build bustages on security/sandbox/linux/reporter/SandboxReporter.cpp
Backed out changeset 7c8905b6b226 (bug 1465060)
Backed out changeset 10446073eca8 (bug 1465060)
2018-06-03 19:25:41 +03:00
Miko Mynttinen 8d9dc85cd4 Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 619d0e0ff63a2453c80f0c4d9beb906d43fa9b01
2018-06-01 17:59:07 +02:00
Andreea Pavel 4ced6e8b2d Merge mozilla-central to autoland. a=merge 2018-06-03 07:27:01 +03:00
Jan de Mooij 403ba762c8 Bug 1466083 part 6 - Add xpc::GetRealmPrincipal and use it in a few places. r=bz
Not strictly necessary, but this lets us remove some JS::GetCompartmentForRealm and JS_GetCompartmentPrincipals calls.
2018-06-02 11:58:29 +02:00
Jan de Mooij 14752d0042 Bug 1464772 part 2 - Remove RealmBehaviorsRef(obj), change RealmBehaviorsRef(compartment) to take a realm. r=luke
At some point I'll audit the obj->realm() calls for CCWs; removing RealmBehaviorsRef(obj) prepares for that.

Also, RealmBehaviorsRef(realm) could be removed and we could use RealmBehaviorsRef(cx) everywhere, but it seems reasonable to keep it.
2018-06-03 12:22:28 +02:00
Emilio Cobos Álvarez 1e9c395548 Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj
Same approach as the other bug, mostly replacing automatically by removing
'using mozilla::Forward;' and then:

  s/mozilla::Forward/std::forward/
  s/Forward</std::forward</

The only file that required manual fixup was TestTreeTraversal.cpp, which had
a class called TestNodeForward with template parameters :)

MozReview-Commit-ID: A88qFG5AccP
2018-06-02 09:33:26 +02:00
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Jan de Mooij f3fe2d13d4 Bug 1465472 - Remove the atoms realm/compartment. r=jonco
Some of the less trivial changes:

* When we allocated a symbol, we used the atom realm's RNG to create a hash code [0]. Instead of this I added a RNG for this to the runtime.

* IsCompilingWasm returned true if the JitContext's realm is nullptr, but that's now also true when we initialize the trampolines stored in the atoms zone. To fix that I added a CompileZone* to JitContext, in addition to the CompileRuntime and CompileRealm, and we now check the zone instead of the realm in IsCompilingWasm.

* JSContext::hasEnteredRealm is only called in DEBUG builds so I made hasEnteredRealm and enterRealmDepth_ #ifdef DEBUG.
2018-05-31 12:53:26 +02:00
Jan de Mooij 37e765587c Bug 1464374 part 7 - Use GetRealmPrincipals in GetCompartmentName. r=luke
This will become GetRealmName at some point.
2018-05-31 11:28:49 +02:00
Jan de Mooij 1edb6a4c17 Bug 1464374 part 6 - Use GetRealmPrincipals in Scriptability constructor. r=bz 2018-05-31 11:28:49 +02:00
Steve Fink 0680fed494 Bug 1464266 - Rename GCForReason to NonIncrementalGC, r=jonco
--HG--
extra : topic : GCForReason
extra : rebase_source : e81bf7bb8ca0824f8b63f25a46ccbe26c4002325
2018-05-24 16:19:18 -07:00
Jan de Mooij 45e968b1dd Bug 1464134 part 8 - Make IterateHeapUnbarriered and related code use realms instead of compartments. r=jonco 2018-05-30 20:14:19 +02:00
Jan de Mooij 732a7c63d6 Bug 1464134 part 7 - Replace GetAnyCompartmentInZone with GetAnyRealmInZone. r=luke 2018-05-30 20:14:19 +02:00
Boris Zbarsky 89366855ba Bug 1455676 part 1. Make it possible to importGlobalProperties Node. r=qdot 2018-05-29 22:58:47 -04:00
Boris Zbarsky 69db48b9c0 Bug 1047514. Re-enable the test_getWebIDLCaller test on Android. r=kmag 2018-05-29 13:38:53 -04:00
Tom Schuster 30cc5c7f25 Bug 1465039 - Rename Array.prototype.flatten to Array.prototype.flat. r=anba
--HG--
extra : rebase_source : aa2aa39508dd22d7e380e1996d559bf03d7478eb
2018-05-29 13:23:06 +02:00
Peter Van der Beken 0a2e4b8cb7 Bug 1146316 - Remove nsWrapperCache::SetIsNotDOMBinding and IsDOMBinding(). r=bz.
--HG--
extra : rebase_source : cd36e7afb4f6ebcd042ea40d9403546a683375ad
2018-04-05 17:22:41 +02:00
Peter Van der Beken 6e33f1d567 Bug 1146316 - Preserve the wrapper of sandboxes, so that we never try to call WrapObject on them. r=bz.
--HG--
extra : rebase_source : 00519dbe00d048000b2febdcd69e9232a79b5388
2018-04-11 11:52:13 +02:00
Boris Zbarsky ed3c958547 Bug 1463889 part 1. Switch nsPIDOMWindowOuter::GetFrames to returning an nsDOMWindowList. r=qdot 2018-05-24 23:32:19 -04:00
Kris Maglione ed0d691f13 Bug 1461012: Add CC optimizations for PrecompiledScript objects. r=mccr8
Tracing the script members held alive by PrecompiledScript objects can be
expensive, especially for large scripts. It would be nice if we could avoid
tracing them when possible.

Most of the time, when PrecompiledScripts are alive, they're held alive by
black roots, and have black JS wrappers. In those cases, there's no chance of
them creating garbage cycles, and we can just mark their script children
black.

MozReview-Commit-ID: KnkJfznJZBx

--HG--
extra : rebase_source : da0da30265c3f752c9aba177bf510937a743e49e
2018-05-11 15:57:31 -07:00
Tom Schuster 937d9326cd Bug 1453916 - Allow canvas extraction from webextension content-script even with resistFingerprinting turned on. r=kmag,bz
--HG--
extra : rebase_source : d67c589e8819407bb5acc4378d029288dd9295be
2018-05-14 20:49:32 +02:00
Kris Maglione 8134b33e89 Bug 1462964: Remove obsolete nsIDOMBlob interface. r=bz
MozReview-Commit-ID: 2HIlaSrvfBe

--HG--
extra : rebase_source : 944a6244dbfe1f0a37dd34a041d1329624a86f93
extra : histedit_source : d7859be664fed00f8504e40969480d3af3d674e7%2C4456b502db338bd06823654306e47c2583101396
2018-05-21 17:32:44 -07:00
Jan de Mooij f820ec7afa Bug 1461938 part 5 - Some atoms compartment/realm related changes. r=jonco 2018-05-18 15:18:23 +02:00
Jan de Mooij 575aec161b Bug 1461677 - Rename compartment to realm in the memory reporting code. r=njn 2018-05-17 16:15:18 +02:00
Jan de Mooij 17f3983d0f Bug 1461605 part 1 - Rename CompartmentOptions to RealmOptions. r=luke,bz 2018-05-17 10:59:45 +02:00
Kris Maglione 166dab340b Bug 1461062: Follow-up: Fix rebase bustage. r=bustage CLOSED TREE
MozReview-Commit-ID: 2fjL5eCL2xP

--HG--
extra : amend_source : 1fef859835028292ca163d840a61077bf05fcc06
2018-05-16 19:07:01 -07:00
Ciure Andrei eab785689c Backed out 2 changesets (bug 1458043) for dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html failures a=backout
Backed out changeset 0b5c103fcb70 (bug 1458043)
Backed out changeset 51cdd0595094 (bug 1458043)
2018-05-17 00:54:04 +03:00
Jan de Mooij 80e44e8003 Bug 1461292 part 1 - Rename JSAutoCompartment to JSAutoRealm. r=bz,luke 2018-05-16 10:53:16 +02:00
Csoregi Natalia 2f779be8d9 Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-06-02 01:03:45 +03:00
Markus Stange 772669d431 Bug 1464909 - Add the "GC / CC" category to AsyncFreeSnowWhite::Run. r=smaug
MozReview-Commit-ID: KEZUstzTHhn

--HG--
extra : rebase_source : 82f7b0b02f342b574f16849a8f6a9ffe625bddf6
2018-05-31 14:08:24 -04:00
Markus Stange 423ce68542 Bug 1462784 - Relabel various other stuff as being OTHER. r=njn
Any more specific work that is happening in these methods will have its own
specific category labeling in that specific code. The instances touched in this
patch are more on the outside and don't really know what kind of code is going
to be running inside.

MozReview-Commit-ID: 47NO1DZzkdH

--HG--
extra : rebase_source : 344c380ddaaf42a1fd820a26b762c61ee9e2d524
2018-05-18 17:58:43 -04:00
Csoregi Natalia fc2ed6e92a Backed out 18 changesets (bug 1462784) for ESlint failure on FlameGraph.js:1297. CLOSED TREE
Backed out changeset 79556798ff9f (bug 1462784)
Backed out changeset 88321efb673b (bug 1462784)
Backed out changeset 7880f9dc7023 (bug 1462784)
Backed out changeset 71fe35fd1f7e (bug 1462784)
Backed out changeset a543b94b049a (bug 1462784)
Backed out changeset d1ca8b0f2221 (bug 1462784)
Backed out changeset 68eabfbf3c16 (bug 1462784)
Backed out changeset 34e71c789903 (bug 1462784)
Backed out changeset 6fe79d1ca1bd (bug 1462784)
Backed out changeset e5ad2e525ea9 (bug 1462784)
Backed out changeset 329645ff1e23 (bug 1462784)
Backed out changeset e09c38853172 (bug 1462784)
Backed out changeset 0663d1a6d2da (bug 1462784)
Backed out changeset 106967fc29d2 (bug 1462784)
Backed out changeset 99b4a433a8e5 (bug 1462784)
Backed out changeset 1d38a4cf5a4a (bug 1462784)
Backed out changeset 692017229de6 (bug 1462784)
Backed out changeset c2911a626671 (bug 1462784)
2018-06-01 23:42:00 +03:00
Markus Stange 3f54b9a3dd Bug 1462784 - Relabel various other stuff as being OTHER. r=njn
Any more specific work that is happening in these methods will have its own
specific category labeling in that specific code. The instances touched in this
patch are more on the outside and don't really know what kind of code is going
to be running inside.

MozReview-Commit-ID: 47NO1DZzkdH

--HG--
extra : rebase_source : f807c14bf6a592e0c651e15b63d1e7d63e4b0159
2018-05-18 17:58:43 -04:00
Noemi Erli 7bfa96a42b Backed out 4 changesets (bug 1464909) for failures in devtools/client/performance/test/unit/test_tree-model-08.js r=mstange on a CLOSED TREE
Backed out changeset 119c2055e002 (bug 1464909)
Backed out changeset 562aeeced55b (bug 1464909)
Backed out changeset c1e1d74ad27e (bug 1464909)
Backed out changeset 11670c51f572 (bug 1464909)
2018-06-01 01:23:49 +03:00
Noemi Erli 1fd69fa2bc Backed out 18 changesets (bug 1462784) for failures in devtools/client/performance/test/unit/test_tree-model-08.js on a CLOSED TREE
Backed out changeset a74d36598442 (bug 1462784)
Backed out changeset c8192175f360 (bug 1462784)
Backed out changeset cde492240e99 (bug 1462784)
Backed out changeset 8c8d30fa406c (bug 1462784)
Backed out changeset ad3802ffb780 (bug 1462784)
Backed out changeset 2fe10732076c (bug 1462784)
Backed out changeset 268a72b7c3c4 (bug 1462784)
Backed out changeset 4055eb6c3bc6 (bug 1462784)
Backed out changeset 3901070e2e60 (bug 1462784)
Backed out changeset 2faf787fbbdf (bug 1462784)
Backed out changeset 8f06963c7c6f (bug 1462784)
Backed out changeset 036e6f64e224 (bug 1462784)
Backed out changeset e670f156a603 (bug 1462784)
Backed out changeset cd39588aece4 (bug 1462784)
Backed out changeset 2ac65d100fa2 (bug 1462784)
Backed out changeset ea05ff70a51d (bug 1462784)
Backed out changeset 8a06c0ba42f7 (bug 1462784)
Backed out changeset 52ed9a039ad2 (bug 1462784)
2018-06-01 01:06:29 +03:00
Noemi Erli 614b78ae36 Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-06-01 00:58:09 +03:00
Markus Stange 76dc63b77e Bug 1464909 - Add the "GC / CC" category to AsyncFreeSnowWhite::Run. r=smaug
MozReview-Commit-ID: KEZUstzTHhn

--HG--
extra : rebase_source : 6db5ea2c5ca4e8d1802a0c71915bfe1d2dbf7326
2018-05-31 14:08:24 -04:00
Markus Stange d80822de42 Bug 1462784 - Relabel various other stuff as being OTHER. r=njn
Any more specific work that is happening in these methods will have its own
specific category labeling in that specific code. The instances touched in this
patch are more on the outside and don't really know what kind of code is going
to be running inside.

MozReview-Commit-ID: 47NO1DZzkdH

--HG--
extra : rebase_source : 35362bc94068103367f46b23a14cb3831cd86990
2018-05-18 17:58:43 -04:00
Noemi Erli 8e2471b6cb Backed out 8 changesets (bug 1458375) for Mochitest leaks on a CLOSED TREE
Backed out changeset 30a743401670 (bug 1458375)
Backed out changeset ae969e1cebfb (bug 1458375)
Backed out changeset 1fb76b9b6f82 (bug 1458375)
Backed out changeset 868da3a1b94a (bug 1458375)
Backed out changeset bd2cba9dfb3d (bug 1458375)
Backed out changeset 715850ae92a1 (bug 1458375)
Backed out changeset cfe8da250de7 (bug 1458375)
Backed out changeset 2968c0a21410 (bug 1458375)
2018-05-31 22:38:48 +03:00
Mike Conley 7c11f30a6f Bug 1458375 - Make ScriptPreloader stop recording after browser-idle-startup-tasks-finished. r=kmag
The ScriptPreloader stopped recording before browser-delayed-startup-finished before, but there
are other scripts (both in the parent and content processes) that might run soon after that we
also want to cache. This increases the probability that those scripts are noted by the
ScriptPreloader cache.

MozReview-Commit-ID: KiBEVvuqQkA

--HG--
extra : rebase_source : 4c1bffa882b0641f93260867ac8a4334b1269e99
2018-05-29 12:55:21 -04:00
Felipe Gomes fd0a264b26 Bug 1457988 - Implement XPCOMUtils.defineLazyProxy. r=kmag
This implements a new kind of lazy getter in XPCOMUtils that creates an object (implemented as a JS Proxy) that is resilient to be passed around as references to other functions, and will only evaluate the getter when it really needs to be used
2018-05-15 19:49:17 -03:00
Peter Van der Beken d73809b86f Bug 1453011 - Remove PostCreatePrototype. r=bz.
--HG--
extra : rebase_source : 6c096b964e43a3460a092b0f0b1ed9b512fd98c9
2018-03-22 11:31:05 +01:00
Peter Van der Beken 33304e70f6 Bug 1453011 - Remove some unused nsIXPCScriptable flags. r=bz.
--HG--
extra : rebase_source : bd116870762e7b9b0fcae558039c3522acb30009
2018-03-22 10:37:43 +01:00
Peter Van der Beken 1cd3ab60da Bug 1453011 - Remove nsXPCClassInfo. r=bz.
--HG--
extra : rebase_source : 4f137f69ad8613c149a25260c3ceeb029b823117
2018-03-22 09:42:21 +01:00
Peter Van der Beken ddfc4b6022 Bug 1452981 - Remove qsObjectHelper. r=bz.
--HG--
extra : rebase_source : f87d70c72bd720cd57377b4b70fdf8ecec590086
2018-05-02 11:47:02 +02:00
Nika Layzell 84d0194704 Bug 1458043 - Part 1: Stop converting promises to nsISupports in xpconnect, r=bz 2018-05-14 17:55:58 -04:00
Nika Layzell 3043db4105 Bug 1457972 - Part 10: Make sure to allocate ExtendedVal inline, r=froydnj 2018-05-14 17:55:57 -04:00
Nika Layzell 70dbf079a4 Bug 1457972 - Part 9: Allow passing invalid values to xpidl arrays for compat reasons, r=mccr8
This one sucks. I found out when running tests that we exploit some edge
case behaviour in our tests where passing an invalid value to an xpidl
array parameter will be passed as an empty array...

I figured that just respecting this behaviour for now is the easiest
approach, but we will probably want to fix it in the future.
2018-05-14 17:55:57 -04:00
Nika Layzell 656ad38909 Bug 1457972 - Part 8: Remove external consumers of XPCConvert::NativeArray2JS/JSArray2Native, r=mccr8
Current XPIDL native arrays currently also require a custom entry point. With
the new arraylen parameter we can handle them in JSData2Native/NativeData2JS. As
these methods are more complex and don't share logic with an existing codepath,
I keep them in external helper methods.
2018-05-14 17:55:57 -04:00
Nika Layzell 3efaead212 Bug 1457972 - Part 7: Eliminate XPCConvert::NativeStringWithSize2JS/JSStringWithSize2Native, r=mccr8
XPIDL supports explicitly sized string types. These types currently have to be
handled by a separate entry point into XPCConvert, and don't share any logic
with the implicitly sized string types.

If we just add an array length parameter to the basic JSData2Native and
NativeData2JS methods we can handle them in the same place as every other type.

This also allows us to share a lot of code with non-sized string types, which is
nice :-).
2018-05-14 17:55:56 -04:00
Nika Layzell e97495d7b3 Bug 1457972 - Part 5: Use modern JS APIs to root jsval temporaries in XPConnect, r=mccr8
When a jsval passed from JS code it needs to be stored in a nsXPTCVariant
object. This object is not rooted by default, as it is stored in some
C++-allocated memory. Currently, we root the values by adding a custom root
using the `js::AddRawValueRoot` API, which is deprecated, and only used by this
code and ErrorResult.

This also has the unfortunate effect that we cannot support XPCOM arrays of
jsvals, as we cannot root all of the values in the array using this API.

Fortunately, the JS engine has a better rooting API which we can use here
instead. I make the call context a custom rooter, like the SequenceRooter type
from WebIDL, and make sure to note every jsval when tracing, both in arrays and
as direct values.

This should allow us to avoid some hashtable operations with roots when
performing XPConnect calls, and remove a consumer of this gross legacy API.

In addition it allows us to support arrays. This will be even more useful in the
future when I add support for sequence<T> (which is a nsTArray<T>) to xpidl and
xpconnect.
2018-05-14 17:55:55 -04:00
Nika Layzell e2240ec5a2 Bug 1457972 - Part 4: Remove dipper types, r=mccr8
In XPConnect, native values are passed around within nsXPTCMiniVariant objects.
an [nsXPTCMiniVariant] contains 64-bits of data in a union type.

nsXPTCMiniVariant values are created by the platform-specific glue code and
passed into XPConnect proper when calling from C++ into JS.

When calling from JS into C++, we instead create nsXPTCVariant objects and pass
them into the glue code. These objects have extra information in addition to the
nsXPTCMiniVariant: namely they also have a `type` field with the type stored in
the variant, space for flags, and a `ptr` field which is passed over IPC instead
of the inner nsXPTCMiniVariant when a flag (`PTR_IS_DATA`) is set.

The JSValue type in XPConnect is always passed as a pointer to a JSValue object,
both for in parameters and out parameters. This is handled by making the JSValue
type be unconditionally flagged as [`IsIndirect()`] This flag is also used for
all types of outparameters.

When the `IsIndirect()` flag is set, it means that the actual data is stored in
the nsXPTCVariant's val field, and it sets the flag to tell the glue code to
instead pass the `ptr` field (which is always pointing to the `val` field for
[legacy reasons]) into the C++ code.

In contrast "dipper" is a different and super weird flag. Currently only the
string class types (nsACString & nsAString) are marked as "dipper". A "dipper"
type is always passed as an "in" type (and thus always passed "directly"), even
when it's actually an out parameter.

XPConnect treats these types as though they are pointer types (nsAString*). This
means that there is no space in the nsXPTCVariant to store the actual nsAString
types when passing from JS into C++, so these values have to be allocated by a
different mechanism (in the current code, there is a size 2 buffer for each
string type in the context and once that buffer is exceeded, we heap allocate
the nsString values).

In effect, the current state looks something like this:
+------------+---------------------+---------------------+
| type       | out (xpt/native)    | in (xpt/native)     |
+------------+---------------------+---------------------+
| TD_INT32   | indirect (int32_t*) | direct (int32_t)    |
+------------+---------------------+---------------------+
| TD_JSVAL   | indirect (JSValue*) | indirect (JSValue*) |
+------------+---------------------+---------------------+
| TD_ASTRING | direct (nsAString*) | direct (nsAString*) |
+------------+---------------------+---------------------+

This patch ensures there is enough space in the nsXPTCVariant to fit the
nsString value, and switches string class types to being unconditionally
indirect instead of using the dipper system. This allows us to delete a ton of
dipper-specific code, and unify the indirect and string class codepaths.

This only affects the size of nsXPTCVariant objects, and does not affect
nsXPTCMiniVariant objects. nsXPTCVariant objects are never allocated by the
platform-specific binding code, rather, they are allocated in an AutoTArray on
the stack as part of the CallMethodHelper object.

The size increase is a total of 1 word, so 4 bytes in 32-bit builds, and 8 bytes
in 64-bit builds, which is ignorable for stack allocated objects.

[nsXPTCMiniVariant]: https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/xpcom/reflect/xptcall/xptcall.h#20-47
[`IsIndirect()`]: https://searchfox.org/mozilla-central/rev/c0d81882c7941c4ff13a50603e37095cdab0d1ea/xpcom/reflect/xptinfo/xptinfo.h#371
[legacy reasons]: https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/xpcom/reflect/xptcall/xptcall.h#66-79
2018-05-14 17:55:55 -04:00
Nika Layzell f20e777cdb Bug 1457972 - Part 2: Remove unused code paths in xpconnect, r=mccr8
Thanks to the changes in the previous patch, we had some unused code which we
can get rid of. This patch just cleans stuff up a bit.
2018-05-14 17:55:54 -04:00
Nika Layzell 73efb8abf3 Bug 1457972 - Part 1: Unify xpconnect cleanup codepaths, r=mccr8
It used to be that in XPConnect there were many different pieces of code for
each place where we may need to clean up some untyped values based on their
nsXPTType information. This was a mess, and meant that every time you needed to
add a new data type you'd have to find every one of these places and add support
for your new type to them.

In fact, this was bad enough that it appears that I missed some places when
adding my webidl support! Which means that in some edge cases we may clean up
one of these values incorrectly D:!

This patch adds a new unified method which performs the cleanup by looking at a
nsXPTType object. The idea is that this function takes a void* which is actually
a T* where T is a value of the nsXPTType parmaeter. It clears the value behind
the pointer to a valid state such that free-ing the memory would not cause any
leaks. e.g. it free(...)s owned pointers and sets the pointer to `nullptr`, and
truncates nsA[C]String values such that they reference the static empty string.

I also modify every one of these custom cleanup codepaths to instead call into
this unified cleanup method.

This also involved some simplification of helper methods in order to make the
implementation cleaner.
2018-05-14 17:55:54 -04:00
Nika Layzell 9c090cb316 Bug 1455217 - Part 2: Add support for promises to XPCConvert, r=mccr8 2018-05-14 17:55:53 -04:00
Jon Coppeard 0924042900 Bug 1456774 - Remove linear search for finished parse task and type off thread parse token r=jandem r=baku 2018-05-10 14:51:14 +01:00
Ciure Andrei de05fd66c8 Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-05-09 02:02:05 +03:00