Commit Graph

6861 Commits

Author SHA1 Message Date
Jan de Mooij
84743992b7 Bug 1482835 - Remove JS_GetCompartmentPrincipals calls in the compartment nuking code. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D5856

--HG--
extra : moz-landing-system : lando
2018-09-14 17:38:57 +00:00
Jan de Mooij
cb06d1d2a9 Bug 1491299 - Use JS::GetRealmPrincipals instead of JS_GetCompartmentPrincipals in GetUAWidgetScope. r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D5859

--HG--
extra : moz-landing-system : lando
2018-09-14 16:30:02 +00:00
Jeff Walden
a3dc828570 Bug 1491137 - Rename the JS::Compile function that accepts FILE* to JS::CompileUtf8File, because every caller passes a file with UTF-8 content. r=jandem
--HG--
extra : rebase_source : 7abe623b622ba5433ff85aafa691c9a3f0e16eea
2018-09-13 01:21:52 -07:00
Jeff Walden
8f587a8aa5 Bug 1491137 - Split the JS::Compile that takes const char*/size_t into JS::CompileUtf8 and JS::CompileLatin1 that assert |options.utf8| has consistent value, and a JS::Compile that delegates to one of those as appropriate -- a step toward having entirely separate compilation functions that do direct parsing of UTF-8 without inflating first. r=jandem
--HG--
extra : rebase_source : 4fbc10a7e5e221da4c68c02dc155d925e7a7367d
2018-09-12 20:48:44 -07:00
Gurzau Raul
c03510c273 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-09-17 19:48:54 +03:00
Bobby Holley
d5bb8045ce Bug 1491488 - Stop waiving the return value of the Sandbox constructor when wantXrays is false. r=kmag
MozReview-Commit-ID: 9DrgknOT0Z3
2018-09-17 09:25:02 -07:00
Ehsan Akhgari
743c23d1d0 Bug 1491588 - Remove the XPCOM registration for nsCommandParams; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5959
2018-09-17 09:54:00 -04:00
Ehsan Akhgari
731d1adebd Bug 1491560 - Remove the XPCOM registration for nsCommandLine; r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D5944
2018-09-15 12:16:39 -04:00
Xidorn Quan
1ee5079242 Bug 1188256 part 6 - Expose PromiseDebugging to plain mochitest via SpecialPowers. r=bzbarsky
Depends on D5852

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

--HG--
extra : moz-landing-system : lando
2018-09-14 22:43:54 +00:00
Andrew McCreight
7637c6c2a1 Bug 1490503 - Mark more XPConnect classes builtinclass r=peterv
Also, make nsIXPCWrappedJSObjectGetter not scriptable to save a tiny amount of binary size.

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

--HG--
extra : moz-landing-system : lando
2018-09-14 17:52:36 +00:00
Bobby Holley
6cceb08363 Bug 1453057 - Make Xrays to Arguments objects work correctly. r=bzbarsky
MozReview-Commit-ID: XeWrs0cNL5

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

--HG--
extra : moz-landing-system : lando
2018-09-14 16:14:49 +00:00
Jan de Mooij
cb90b553cd Bug 1487032 - Store origin/site info in CompartmentPrivate. r=bholley
This will let us answer the following questions (in a performant way):

1) What's the compartment's origin? Necessary to implement compartment-per-origin.
2) What's the origin's site? Necessary for the new Wrap() algorithm.
3) Has any realm in the compartment set document.domain? Necessary for the new Wrap() algorithm.

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

--HG--
extra : moz-landing-system : lando
2018-09-11 09:01:14 +00:00
Daniel Varga
8eac4fe0d9 Merge mozilla-central to mozilla-inbound 2018-09-13 05:50:34 +03:00
Ehsan Akhgari
6d56a36888 Bug 1489793 - Part 1: Remove the XPCOM component registration for EditorSpellCheck; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5371
2018-09-12 18:58:53 -04:00
Jan de Mooij
98b8b93e34 Bug 1490600 - Always use braces for if/for/while statements in js/xpconnect/wrappers. r=bholley
Depends on D5655

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

--HG--
extra : moz-landing-system : lando
2018-09-12 16:16:15 +00:00
Jan de Mooij
d51d2cab4b Bug 1490600 - Always use braces for if/for/while statements in js/xpconnect/src, part 4. r=kmag
Depends on D5654

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

--HG--
extra : moz-landing-system : lando
2018-09-12 18:19:51 +00:00
Jan de Mooij
d1f407756a Bug 1490600 - Always use braces for if/for/while statements in js/xpconnect/src, part 3. r=mccr8
Depends on D5653

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

--HG--
extra : moz-landing-system : lando
2018-09-12 18:18:29 +00:00
Jan de Mooij
489a289a73 Bug 1490600 - Always use braces for if/for/while statements in js/xpconnect/src, part 2. r=mccr8
Depends on D5652

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

--HG--
extra : moz-landing-system : lando
2018-09-12 17:42:42 +00:00
Jan de Mooij
57c43dd68c Bug 1490600 - Always use braces for if/for/while statements in js/xpconnect/src, part 1. r=bholley
Depends on D5651

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

--HG--
extra : moz-landing-system : lando
2018-09-12 16:19:06 +00:00
Jan de Mooij
99b8247af2 Bug 1490600 - Always use braces for if/for/while statements in js/xpconnect/loader. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D5651

--HG--
extra : moz-landing-system : lando
2018-09-12 18:14:49 +00:00
shindli
53d4f9c065 Backed out 2 changesets (bug 1489793) for failures in editor/spellchecker/tests/test_bug1219928.html
Backed out changeset 9d793ccd3fca (bug 1489793)
Backed out changeset 30219dab424e (bug 1489793)
2018-09-12 05:59:31 +03:00
Ehsan Akhgari
d536808f38 Bug 1489793 - Part 1: Remove the XPCOM component registration for EditorSpellCheck; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5371
2018-09-11 19:17:46 -04:00
Dana Keeler
58da26473a bug 1411458 - add a test for bug 1411458 r=jcj
MozReview-Commit-ID: LrZN4DATEVP

--HG--
extra : rebase_source : f71a1278484a97e38a7c44fdf47cc0c690a0716b
2017-10-25 11:33:03 -07:00
Daniel Varga
1539df295b Merge mozilla-inbound to mozilla-central a=merge 2018-09-08 06:53:43 +03:00
Mike Hommey
117e48720c Bug 1489363 - Replace some string.Assign* with AssignLiteral. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D5224

--HG--
extra : moz-landing-system : lando
2018-09-07 22:12:01 +00:00
Nicholas Nethercote
563171857f Bug 1488628 - Change nsIConsoleMessage.message to an AString. r=erahm
--HG--
extra : rebase_source : e43aec79e309936e17d475b8c50559767538c18d
2018-09-05 13:31:42 +10:00
Kris Maglione
3d172327cd Bug 1486249: Part 1 - Automatically convert JS iterators to nsISimpleEnumerators at XPConnect boundary. r=mccr8
This allows JS callers and C++ callers to both create and consumer iterators
in their preferred style, while still presenting the appropriate interfaces to
callers in the other language.

When a C++ caller requires an nsISimpleEnumerator from an XPCWrappedJS object,
if that class does not already have a QueryInterface method, it is assumed to
be a JS enumerator, and an appropriate wrapper is created. JS callers who wish
to implement nsISimpleEnumerator manually, or opt out of the automatic
conversions, may implement a QueryInterface method, which automatically opts
them out of this behavior.

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

--HG--
extra : rebase_source : eb61ee725a8c67e3e7f5b22d9aef9baa0cde1955
2018-08-25 18:18:10 -07:00
Kris Maglione
a4a6e3ecd9 Bug 1489532: Check for nsISimpleEnumerator wrapper before searching existing tear-offs. r=mccr8
When an XPC wrapped JS object returns an object from a property or function
which is expected to return a given interface, we create a wrapper for that
interface regardless of whether the object has a QueryInterface method which
claims to support it. For the nsISimpleEnumerator enumerator case, the check
for that existing wrapper comes before the check for the nsISimpleEnumerator
special casing, which breaks automatic conversion in those cases.

This patch moves that check just before the check for the existing wrapper,
and just after the nsIPropertyBag special casing, which has similar semantics.

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

--HG--
extra : rebase_source : 2201063455a2434cfa0c3c470f668fefa8528f4b
2018-09-07 15:17:56 -07:00
Jeff Walden
327a90245e Bug 1487136 - Make OwningCompileOptions::setFile(JSContext*, const char*) MOZ_MUST_USE. r=kmag on fixing the one user requiring any changes, r=me on the obviously-justified attribute-addition
--HG--
extra : rebase_source : 53f22d0cb6f68fcdf93bd9cbf7e5e3b559a50611
2018-08-28 14:54:20 -05:00
Ehsan Akhgari
6bbaf2cf8c Bug 1489147 - Remove the XPCOM component registration for nsXPConnect; r=mccr8
We move the XPConnect() singleton accessor to nsIXConnect to make it available for consumers outside of XPConnect.  Most of the consumers of the singleton accessor just need the nsIXPConnect public interface, except for the IsShuttingDown() member which this patch adds to nsIXPConnect as well.

Differential Revision: https://phabricator.services.mozilla.com/D5151
2018-09-06 16:39:35 -04:00
shindli
2a86142e74 Backed out changeset d4ae1994c20c (bug 1489147) for bustages in JSDebugger.cpp on a CLOSED TREE 2018-09-06 22:12:44 +03:00
Ehsan Akhgari
bb7fcd9d69 Bug 1489147 - Remove the XPCOM component registration for nsXPConnect; r=mccr8
We move the XPConnect() singleton accessor to nsIXConnect to make it available for consumers outside of XPConnect.  Most of the consumers of the singleton accessor just need the nsIXPConnect public interface, except for the IsShuttingDown() member which this patch adds to nsIXPConnect as well.

Differential Revision: https://phabricator.services.mozilla.com/D5151
2018-09-06 14:52:07 -04:00
André Bargull
38691a7464 Bug 1485066 - Part 11: Remove the unused |inBuf| argument from JS::FormatStackDump and change it to use Sprinter. r=Waldo 2018-09-05 03:01:23 -07:00
André Bargull
ed962c63e5 Bug 1485066 - Part 8: Rename JS_EncodeString to JS_EncodeStringToLatin1. r=Waldo 2018-09-05 06:05:03 -07:00
André Bargull
fbb9b6014c Bug 1485066 - Part 3: Replace calls to JS_EncodeString for string comparison with StringEqualsAscii. r=Waldo 2018-09-05 01:25:09 -07:00
André Bargull
e4d1d98f88 Bug 1485066 - Part 1: Remove JSAutoByteString. r=Waldo 2018-09-05 02:25:42 -07:00
Cosmin Sabou
1f0a42def4 Backed out 14 changesets (bug 1485066) for build bustages on MessageManagerFuzzer. CLOSED TREE
Backed out changeset e40f67f15bf1 (bug 1485066)
Backed out changeset f09bc4d5fdcc (bug 1485066)
Backed out changeset 939e27aa2d59 (bug 1485066)
Backed out changeset d50fcf82556c (bug 1485066)
Backed out changeset 5cbc0ae0117a (bug 1485066)
Backed out changeset 09b5382e0baf (bug 1485066)
Backed out changeset 6676e8fedcb3 (bug 1485066)
Backed out changeset 28e7e61c11ec (bug 1485066)
Backed out changeset b08b0cfc1dbe (bug 1485066)
Backed out changeset 8defc9eabfac (bug 1485066)
Backed out changeset bf167b0a3af3 (bug 1485066)
Backed out changeset 4f89260d5e30 (bug 1485066)
Backed out changeset c22fc17c9d87 (bug 1485066)
Backed out changeset d35bb63dbc1d (bug 1485066)
2018-09-05 15:54:03 +03:00
André Bargull
ceccb59fda Bug 1485066 - Part 11: Remove the unused |inBuf| argument from JS::FormatStackDump and change it to use Sprinter. r=Waldo 2018-09-05 03:01:23 -07:00
André Bargull
89416b7fd4 Bug 1485066 - Part 8: Rename JS_EncodeString to JS_EncodeStringToLatin1. r=Waldo 2018-09-05 02:26:49 -07:00
André Bargull
76789014b1 Bug 1485066 - Part 3: Replace calls to JS_EncodeString for string comparison with StringEqualsAscii. r=Waldo 2018-09-05 01:25:09 -07:00
André Bargull
775b7277cc Bug 1485066 - Part 1: Remove JSAutoByteString. r=Waldo 2018-09-05 02:25:42 -07:00
Jan de Mooij
cbb67627a3 Bug 722345 part 3 - Remove request API. r=luke
Differential Revision: https://phabricator.services.mozilla.com/D4424

--HG--
extra : rebase_source : 1842588c00dbc8fb4294ce5436cdb787190909b4
2018-08-28 09:53:30 +02:00
Bogdan Tara
ba6cae21b7 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-09-05 02:45:18 +03:00
Jan de Mooij
53f1370b5f Bug 1267297 - Use AutoEntryScript for script activity bookkeeping instead of the request machinery. r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D4085

--HG--
extra : moz-landing-system : lando
2018-09-04 16:59:56 +00:00
Luke Wagner
109280bf02 Bug 1330661 - Baldr: make the BuildIdOp a process global (r=lth,mccr8)
--HG--
extra : rebase_source : 0388505583fb0b445f989e3a8b97ec861ed62499
2018-09-04 14:25:57 -05:00
Emilio Cobos Álvarez
75bea4ec60 Bug 1486623 - Skip less nodes when reporting memory, and report ShadowRoot's StyleSheets. r=bzbarsky
This moves all the node-specific reporting to nsIDocument.

OrphanReporter delegates all the reporting to that and then returns the sum of
all sizes, which is not ideal but was pre-existing.

Also, I moved the main mStyleSheets size reporting to DocumentOrShadowRoot for
it to be shared between document and ShadowRoot.

I'll add memory reporting for the computed stylesheet maps and such in the
ShadowRoot in a followup.

I went through all the XBL bindings, though it seems I could just use
GetBindingWithContent(), since according to:

  https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/dom/xbl/nsXBLBinding.cpp#615

We don't allow multiple bindings to contribute anon content. Anyway it was the
same amount of code...

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

--HG--
extra : moz-landing-system : lando
2018-08-29 22:19:42 +00:00
Carl Corcoran
7da8e04c87 Bug 1467736: Add support for DllBlocklist_Shutdown;r=aklotz
Differential Revision: https://phabricator.services.mozilla.com/D4544

--HG--
extra : moz-landing-system : lando
2018-08-29 18:49:49 +00:00
Nicholas Nethercote
fe34f19459 Bug 1486690 - Rename nsMemory::Clone() and remove unnecessary checks after it. r=glandium
The 'x' in the new name makes it clearer that it's infallible.

--HG--
extra : rebase_source : 51fd946c482befe8a8ca5bd88ecc967971f455da
2018-08-28 15:59:19 +10:00
Nicholas Nethercote
2fcd08a173 Bug 1486690 - Rename NS_str{,}dup and remove unnecessary checks after calls to them. r=glandium
The 'x' prefix makes it clearer that these are infallible.

A couple of nsJSID methods are now also infallible.

--HG--
extra : rebase_source : fcce44a00212d6d341afbf3827b31bd4f7355ad5
2018-08-28 15:58:54 +10:00
Nicholas Nethercote
ac5efebb4b Bug 1486690 - Remove unnecessary checks after moz_xmalloc() calls. r=glandium
There are surprisingly many of them.

(Plus a couple of unnecessary checks after `new` calls that were nearby.)

--HG--
extra : rebase_source : 47b6d5d7c5c99b1b50b396daf7a3b67abfd74fc1
2018-08-28 15:56:01 +10:00
Jeff Walden
64fceacad0 Bug 1486577 - Don't #include "js/CompilationAndEvaluation.h" in jsapi.h, minimizing the scope of that header and reducing translation-unit size of anything that needs JSAPI but doesn't need to compile/evaluate JavaScript. r=jandem
--HG--
extra : rebase_source : cd9a8becc15477bc5e24408159d4f061ec81c8b2
2018-08-24 22:51:49 -05:00
Jeff Walden
4bdf4a3614 Bug 1486577 - Don't #include js/SourceBufferHolder.h in jsapi.h, and instead require users to do so -- a minor translation-unit size improvement for anyone who never has to use SourceBufferHolder other than by reference. r=jandem
--HG--
extra : rebase_source : df47aba0c7dac3fe80ab6ea1b9a34c7acc54850d
2018-08-24 21:01:58 -05:00
Kris Maglione
93703861d1 Bug 1486182: Part 3 - Remove unused XPCOMUtils.enumerateCategoryEntries method. r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D4280

--HG--
extra : rebase_source : 6e09e6c46cee8ebe0e942f7135408a5b075066d1
2018-08-24 17:20:50 -07:00
Kris Maglione
b821d119a0 Bug 1486182: Part 2b - Update XPCOMUtils.enumerateCategoryEntries callers to use the category manager directly. r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D4279

--HG--
extra : rebase_source : f57e09927871a23ed3c105325369e5c35ffd3d93
2018-08-24 17:05:41 -07:00
Kris Maglione
53f96aa226 Bug 1486182: Part 2a - Add Services.catMan getter for the category manager. r=mossop
This makes it much easier to update existing consumers of
XPCOMUtils.enumerateCategoryEntries to use the category manager directly.

It also, unfortunately, requires updating existing category manager consumers
to use the Services getter in order to avoid ESLint errors.

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

--HG--
extra : rebase_source : fb9fd9b21db80af472ff6250a2e9a35e8d538147
2018-08-24 22:13:57 -07:00
Kris Maglione
b7962a2385 Bug 1484496: Part 6 - Remove unused XPCOMUtils.IterSimpleEnumerator method. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3734

--HG--
extra : rebase_source : 54c648602e8384ac78dc28b02a9bdc33c2dd9a35
extra : histedit_source : 3743ce95426177a42ee216659e4a5c7ee0e0adbc
2018-08-18 18:45:57 -07:00
Kris Maglione
3a5c05e76f Bug 1484496: Part 5e - Convert remaining nsISimpleEnumerator users to use JS iteration. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3733

--HG--
extra : rebase_source : c0fac176d7b3d840c4dbb14f8d95ccfc7f83a5a8
extra : histedit_source : a92c40117d0808a3ad68c972f622a7a42c9ae8ba
2018-08-18 18:13:14 -07:00
Kris Maglione
2dee0aae3c Bug 1484496: Part 4b - Add intrinsic type information to most nsSimpleEnumerators. r=froydnj
This allows JS callers to automatically get the correct types during
interation, without having to explicitly specify them.

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

--HG--
extra : rebase_source : b708f382d8ea571d199c669bfed5b5a7ca9ffac4
extra : histedit_source : 7df6feb82088c8a5ca45dc28fe4d2b852c177fee
2018-08-18 21:06:32 -07:00
Kris Maglione
83db11134f Bug 1484496: Part 1 - Add support for symbol properties to XPIDL. r=nika
This patch allows us to define methods or getters/setters for any of the
current set of well-known symbols. Those are defined by adding the [symbol]
attribute to a method:

  [symbol]
  Iterator iterator();

which causes the method to define a property with the well-known symbol which
matches its method name (Symbol.iterator, in this case).

Due to the implementation details of the XPIDL parser, this currently does not
support defining a non-symbol function with the same name as a symbol
function:

  [symbol]
  Iterator iterator();

  [binaryname(OtherIterator)]
  Thing iterator(in nsIDRef aIID);

throws for a duplicate method name, even though there is no actual conflict.

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

--HG--
extra : rebase_source : 1385e2da93113306730f7c087fe7385dbe668e91
extra : histedit_source : 3afd9fe38e7cbddc5576c2bd1673496dd623e489
2018-08-21 14:08:35 -07:00
Masatoshi Kimura
49ee57f31d Bug 1485028 - Fix warnings that are specific to clang-cl ASAN builds. r=dmajor
--HG--
extra : source : f0b577cc8b920352dfe297e7ec9cca58b1838c5d
2018-08-22 02:02:56 +09:00
Masatoshi Kimura
9d4f4b2a44 Bug 1485028 - Use GetWindowsStackSize() on Windows even with ASAN builds. r=jandem
--HG--
extra : source : 62941c04d652a0ce3688be069fb9dd997dd3c4a7
extra : intermediate-source : d78e18c21d52037de9ae0e9eaa44bfa4c37ad5ba
2018-08-22 02:02:29 +09:00
Jeff Walden
cce0bfcd74 Bug 1484420 - Move locale-related functions into js/public/LocaleSensitive.h that isn't #include'd in jsapi.h. r=anba
--HG--
extra : rebase_source : 96d10bf0985da922f1992ac13f39cb4c2a944137
2018-08-20 17:11:32 -05:00
Andreea Pavel
d801b3a01e Backed out 2 changesets (bug 1484420) for hazard failures on a CLOSED TREE
Backed out changeset d910e3c8372a (bug 1484420)
Backed out changeset d79cdb73c55f (bug 1484420)
2018-08-21 23:19:27 +03:00
Jeff Walden
8acccdc0b8 Bug 1484420 - Move locale-related functions into js/public/LocaleSensitive.h that isn't #include'd in jsapi.h. r=anba
--HG--
extra : rebase_source : 0c594e4a64373f0432194898ab18f94722c3c54a
2018-08-20 17:11:32 -05:00
Jeff Walden
ffd93ba761 Bug 1033916 - Move JSAutoByteString out of jsapi.h into js/public/AutoByteString.h, incidentally breaking the jsfriendapi.h -> jsapi.h dependency. r=jandem
--HG--
extra : rebase_source : d85baf9b28e632db5669aa3d056cc9744686f5c8
2018-08-20 07:46:08 -07:00
Jeff Walden
3e90595274 Bug 1484389 - Move various SavedFrame-related functions and data types into js/public/SavedFrameAPI.h so that users aren't forced to depend on jsapi.h or jsfriendapi.h for them. r=jandem
--HG--
extra : rebase_source : d891f81cb0827d3c03971f71ba95a014d1e35379
2018-08-20 07:45:44 -07:00
Kris Maglione
31bde826fc Bug 1484466: Part 5 - Use a single QueryInterface method for all nsIFactory instances. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3712

--HG--
extra : rebase_source : d63dc47aed6ab8c35b8352437bdde6c9f3fa1b6d
2018-08-18 12:55:21 -07:00
Kris Maglione
72a0557c23 Bug 1484466: Part 4 - Remove unnecessary lockFactory stub method implementation. r=mccr8
XPConnect will handle dispatching an appropriate error for these calls.

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

--HG--
extra : rebase_source : 659a429248aea6bb70d76f0ba24241ae64056772
2018-08-18 12:53:47 -07:00
Kris Maglione
3dc726f5c5 Bug 1484466: Part 3b - Remove unused XPCOMUtils.generateQI method. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3710

--HG--
extra : rebase_source : 07057848d1dd8ca674d45f7dc975746c7a3c3f74
2018-08-18 12:45:31 -07:00
Kris Maglione
356dd0de4a Bug 1484466: Part 3a - Update remaining XPCOMUtils.generateQI callers to use ChromeUtils. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3709

--HG--
extra : rebase_source : 650545d3e58ab92821a9ea2097793cca5996d5b3
2018-08-18 12:44:57 -07:00
Kris Maglione
312a132d3c Bug 1484466: Part 2b - Remove unused XPCOMUtils.generateCI method. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3708

--HG--
extra : rebase_source : 6d4c844d4b3b224caef01cb92f3ee27e6999ca4d
2018-08-18 12:39:32 -07:00
Kris Maglione
880dd37f97 Bug 1484466: Part 1 - Remove unused XPCOMUtils.importRelative method. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3706

--HG--
extra : rebase_source : bea0fcbfc3398f79f2b2655aea81f6181eeca856
2018-08-18 12:36:03 -07:00
Jason Orendorff
47ba603af2 Bug 1469019 - Object.fromEntries. r=evilpie, r=peterv
--HG--
extra : rebase_source : d9f198cd5546c6f244c53c49a613bdcd4194d7f5
2018-08-14 13:25:30 -05:00
Ehsan Akhgari
726074f95d Bug 1484394 - Remove two unused XPCOM component registrations from XPConnect; r=mccr8 2018-08-20 09:05:16 -04:00
Ehsan Akhgari
e4ec6f1178 Bug 1483650 - Remove the component registration for nsCycleCollectorLogger; r=mccr8 2018-08-16 16:52:31 -04:00
Timothy Guan-tin Chien
dab48182aa Bug 1431255 - Part V, Set the reflectors of the UA Widget DOM to UA Widget Scope r=bholley
The DOM elements within the UA Widget Shadow DOM should have its reflectors in
the UA Widget Scope. This is done by calling nsINode::IsInUAWidget() which
would check its containing shadow and its UA Widget bit.

To prevent JS access of the DOM element before it is in the
UA Widget Shadom DOM tree, various DOM methods are set to inaccessible to
UA Widget script. It would need to use the two special methods in ShadowRoot
instead to insert the DOM directly into the shadow tree.

MozReview-Commit-ID: Jz9iCaVIoij

--HG--
extra : rebase_source : b7b17be68dcde00cfeb207cb39cf16b486f2ab02
2018-06-29 13:39:46 -07:00
Timothy Guan-tin Chien
bfd7aeb85d Bug 1431255 - Part III, Create per-origin sandboxes from XPCJSRuntime and load UA widgets scripts r=bholley,jaws,sfink
This patch creates the basic structure on how the widget scripts can be loaded
and be pointed to the Shadow Root, from the UAWidgetsChild.jsm.

The UAWidgetsClass class asks for a sandbox from Cu.getUAWidgetScope(), which
calls into XPCJSRuntime::GetUAWidgetScope(). It creates and keeps the
sandboxes, in a GCHashMap keyed to the origin, so we could reuse it if needed.

MozReview-Commit-ID: J6W4PDQWMcN

--HG--
extra : rebase_source : a62b0a22195f09cdb508df72c954e20d18c7bf68
2018-06-27 11:34:07 -07:00
Henri Sivonen
3edc601325 Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj.
Correctness improvements:

 * UTF errors are handled safely per spec instead of dangerously truncating
   strings.

 * There are fewer converter implementations.

Performance improvements:

 * The old code did exact buffer length math, which meant doing UTF math twice
   on each input string (once for length calculation and another time for
   conversion). Exact length math is more complicated when handling errors
   properly, which the old code didn't do. The new code does UTF math on the
   string content only once (when converting) but risks allocating more than
   once. There are heuristics in place to lower the probability of
   reallocation in cases where the double math avoidance isn't enough of a
   saving to absorb an allocation and memcpy.

 * Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
   but a single non-ASCII code point pessimized the rest of the string. The
   new code tries to get back on the fast ASCII path.

 * UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
   input to eliminate an operation from the inner loop on x86/x86_64.

 * When assigning to a pre-existing string, the new code tries to reuse the
   old buffer instead of first releasing the old buffer and then allocating a
   new one.

 * When reallocating from the new code, the memcpy covers only the data that
   is part of the logical length of the old string instead of memcpying the
   whole capacity. (For old callers old excess memcpy behavior is preserved
   due to bogus callers. See bug 1472113.)

 * UTF-8 strings in XPConnect that are in the Latin1 range are passed to
   SpiderMonkey as Latin1.

New features:

 * Conversion between UTF-8 and Latin1 is added in order to enable faster
   future interop between Rust code (or otherwise UTF-8-using code) and text
   node and SpiderMonkey code that uses Latin1.

MozReview-Commit-ID: JaJuExfILM9
2018-08-14 14:43:42 +03:00
Steve Fink
22ee12770e Bug 1480843 - Avoid hazard by controlling order of operations so that we GC before using any GC heap pointers, r=bz
--HG--
extra : topic : gcstats.thresh
extra : rebase_source : b9e31b5b0da9924bee110b689f16989cf578cb2e
2018-08-03 10:47:21 -07:00
Logan F Smyth
4abb1e0558 Bug 1378808 - Use ::Arguments or ::PropertyName location for method call column offsets. r=jorendorff, r=ckerschb
--HG--
extra : rebase_source : 69612b61b1cfbfd26856e285d63600ce56e95ec3
extra : source : 6c6a609463ab5d71e475354cab8c3ff323d0571d
2018-07-12 11:51:17 -07:00
Nicholas Nethercote
b9e071e2e8 Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink
Entry storage allocation now occurs on the first lookupForAdd()/put()/putNew().
This removes the need for init() and initialized(), and matches how
PLDHashTable/nsTHashtable work. It also removes the need for init() functions
in a lot of types that are built on top of mozilla::Hash{Map,Set}.

Pros:

- No need for init() calls and subsequent checks.

- No memory allocated for empty tables, which are not that uncommon.

Cons:

- An extra branch in lookup() and lookupForAdd(), but not in put()/putNew(),
  because the existing checkOverloaded() can handle it.

Specifics:

- Construction now can take a length parameter.

- init() is removed. Explicit length-setting, when necessary, now occurs in the
  constructors.

- initialized() is removed.

- capacity() now returns zero when the entry storage is absent.

- lookupForAdd() is no longer `const`, because it can instantiate the storage,
  which requires modifications.

- lookupForAdd() can now return an invalid AddPtr in two cases:

  - old: hashing failure (due to OOM in the hasher)

  - new: OOM while instantiating entry storage

  The existing failure handling paths for the old case work for the new case.

- clear(), finish(), and clearAndShrink() are replaced by clear(), compact(),
  and reserve(). The old compactIfUnderloaded() is also removed.

- Capacity computation code is now in its own functions, bestCapacity() and
  hashShift(). setTableSizeLog2() is removed.

- uint32_t is used throughout for capacities, instead of size_t, for
  consistency with other similar values.

- changeTableSize() now takes a capacity instead of a deltaLog2, and it can now
  handle !mTable.

Measurements:

- Total source code size is reduced by over 900 lines. Also, lots of existing
  lines got shorter (i.e. two checks were reduced to one).

- Executable size barely changed, down by 2 KiB on Linux64. The extra branches
  are compensated for by the lack of init() calls.

- Speed changed negligibly. The instruction count for Bench_Cpp_MozHash
  increased from 2.84 billion to 2.89 billion but any execution time change was
  well below noise.
2018-08-10 18:00:29 +10:00
Jan de Mooij
b3d493f06a Bug 1482423 part 2 - Use js::IsSystemCompartment in xpc::AccessCheck::isChrome. r=mrbkap
--HG--
extra : rebase_source : 7998deb57b0fd8fddcc822bb726a29d3942d3601
2018-08-11 13:12:49 +02:00
Jan de Mooij
17094cb561 Bug 1472976 part 6 - Remove unused xpc::AccessCheck::getPrincipal method. r=mrbkap 2018-08-10 11:57:40 +02:00
Jan de Mooij
0fdef26898 Bug 1472976 part 5 - Use xpc::GetRealmPrincipal instead of xpc::GetCompartmentPrincipal in xpc::GetObjectPrincipal. r=mrbkap 2018-08-10 11:57:40 +02:00
Jan de Mooij
90d9694728 Bug 1472976 part 4 - Use JS::GetRealmPrincipals instead of JS_GetCompartmentPrincipals in XPCWrappedNativeScope::GetPrincipal. r=mrbkap 2018-08-10 11:57:40 +02:00
Gabriele Svelto
15adf94f4d 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 C++ functions are updated to take a typed enum. JavaScript
calls are unaffected but they will throw if the string argument does not
correspond to one of the known entries in the C++ enum. The existing whitelists
and blacklists of annotations are also generated from the YAML file and all
duplicate code related to them 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 in the list (and some obsolete ones
have been removed) and all call sites have been updated including tests where
appropriate.

--HG--
extra : source : 4f6c43f2830701ec5552e08e3f1b06fe6d045860
2018-07-05 15:42:11 +02:00
Tooru Fujisawa
f3ffec503c Bug 1478936 - Fix the comment for JS_GetFunctionArity, and add JS_GetFunctionLength which matches to the original comment, and fixed consumer. r=jandem 2018-08-10 07:49:17 +09:00
Jan de Mooij
6b5c6b10aa Bug 1481772 - Remove unnecessary JSAutoRealm in mozJSComponentLoader::ImportInto. r=kmag 2018-08-09 10:48:29 +02:00
Mike Hommey
6d197a0707 Bug 1481719 - Disable profile-instr-out-of-date warnings explicitly rather than allowing all warnings where they appear. r=dmajor 2018-08-09 06:07:33 +09:00
Jan de Mooij
1b991ab653 Bug 1481467 part 3 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in XrayTraits::attachExpandoObject. r=bz
Because XrayTraits::attachExpandoObject operates in the Xray target realm/compartment and we cannot use the Xray wrapper with JSAutoRealm, we pass the caller's global as exclusiveWrapperGlobal and use that.

This also changes XrayWrapper<Base, Traits>::defineProperty to call ensureExpandoObject in the wrapper (instead of target) realm. This didn't matter before, because ensureExpandoObject immediately entered the target realm anyway.
2018-08-08 15:14:02 +02:00
Jan de Mooij
48b99bc1f0 Bug 1481467 part 2 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in JSXrayTraits::getOwnPropertyFromTargetIfSafe. r=bz
Because getOwnPropertyFromTargetIfSafe operates in the Xray target realm/compartment and we cannot use the Xray wrapper with JSAutoRealm, we pass the caller's global as wrapperGlobal and use that.
2018-08-08 15:12:16 +02:00
Jan de Mooij
21af7a61b0 Bug 1481467 part 1 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in mozJSComponentLoader::ImportInto. r=kmag
The targetVal argument is always same-compartment with the JSContext, so we only need to use JSAutoRealm in the FindTargetObject case.
2018-08-08 15:07:41 +02:00
Jon Coppeard
9d6255073d Bug 1481196 - Compile module scripts to a JSScript like we do for classic scripts r=jandem r=baku 2018-08-08 10:40:03 +01:00
agashlin@mozilla.com
a03dfcbd42 bug 1397297, make SnowWhite freeing more incremental, r=smaug
--HG--
extra : rebase_source : 0772adabddb6cee33d83184d32c981d3920ea6e6
2018-08-08 09:14:58 +03:00
Brindusan Cristian
37bf8a10b0 Backed out 3 changesets (bug 1378808) for wpt failures on /content-security-policy/securitypolicyviolation/targeting.html.
Backed out changeset 6c6a609463ab (bug 1378808)
Backed out changeset 6dd9c641346a (bug 1378808)
Backed out changeset e732697778c2 (bug 1378808)
2018-08-08 04:40:19 +03:00
Kris Maglione
25c94b46d8 Bug 1481021: Part 1 - Fix tests that rely on permissive COWs or SpecialPowers side-effects in frame script scopes. r=bz
Right now, a lot of test code relies on side-effects of SpecialPowers being
loaded into frame script globals. In particular:

- It forces permissive COWs from those scopes, which allows frame scripts to
  pass objects from those scopes to unprivileged content that they otherwise
  wouldn't.
- It imports a bunch of helper modules and WebIDL globals which would
  otherwise not be available.

Fortunately, this seems to only impact test code at this point. But there's a
real down-the-road risk of it impacting shipping code, which ends up working
in automation due to the side-effects of SpecialPowers, but failing in real
world use.

MozReview-Commit-ID: G27eSSOHymX

--HG--
extra : rebase_source : 1702e63fed719fc92def2bdbbb8a7c53572432db
extra : source : 41bedc526dd6ec6b7e8c7be1c832ac60c81d6263
2018-08-07 14:13:06 -07:00
Brindusan Cristian
16ec846afc Backed out 2 changesets (bug 1481021) for bc failures on security/sandbox/test/browser_bug1393259.js.
Backed out changeset c53c7b0249ad (bug 1481021)
Backed out changeset 41bedc526dd6 (bug 1481021)
2018-08-08 03:22:16 +03:00
Logan F Smyth
96dd9699d1 Bug 1378808 - Use ::Arguments or ::PropertyName location for method call column offsets. r=jorendorff
MozReview-Commit-ID: G8mG1qsIO21

--HG--
extra : rebase_source : b5a72b239156617319fc6dabe111c02c13f621c9
2018-07-12 11:51:17 -07:00
Kris Maglione
c1969dbca2 Bug 1481021: Part 1 - Fix tests that rely on permissive COWs or SpecialPowers side-effects in frame script scopes. r=bz
Right now, a lot of test code relies on side-effects of SpecialPowers being
loaded into frame script globals. In particular:

- It forces permissive COWs from those scopes, which allows frame scripts to
  pass objects from those scopes to unprivileged content that they otherwise
  wouldn't.
- It imports a bunch of helper modules and WebIDL globals which would
  otherwise not be available.

Fortunately, this seems to only impact test code at this point. But there's a
real down-the-road risk of it impacting shipping code, which ends up working
in automation due to the side-effects of SpecialPowers, but failing in real
world use.

MozReview-Commit-ID: G27eSSOHymX

--HG--
extra : rebase_source : c528dffe3a54eec75ad6cb358980b783b00eb4a4
2018-08-07 14:13:06 -07: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
Masatoshi Kimura
3b21b7868b Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj
--HG--
extra : rebase_source : c09366fb93e5b0f72abe1e99d3094e3d96a934fb
extra : intermediate-source : 5950c9d63c3b4fd63a25464a7b50944aaec7079f
extra : source : ca1b9a2bcc4381795f556fea2fb59066567c30f3
2018-07-31 22:10:07 +09:00
Brian Hackett
8eb62dd065 Bug 1479058 Part 8 - Store time warp target on nsIScriptError, r=smaug.
--HG--
extra : rebase_source : 1faf5a0c0ead57f5dfb24c7450873977bf41a022
2018-08-02 23:31:29 +00:00
Noemi Erli
23c8a3a9f3 Backed out changeset 1e9ecba54e7b (bug 1348273) for failing on widget/tests/test_bug1123480.xul 2018-08-04 12:39:40 +03:00
Dorel Luca
33b000ddd1 Merge mozilla-central to mozilla-inbound 2018-08-04 01:31:40 +03:00
Dorel Luca
5c509fd70a Backed out changeset 8c763e66ba84 (bug 1397297) for frequent mochitest failures. a=backout 2018-08-04 01:27:15 +03:00
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