Commit Graph

84 Commits

Author SHA1 Message Date
Kris Maglione
39c12beb57 Bug 1445551: Part 5 - Remove add-on path service. r=aswan,mccr8
The path service was created to allow us to track resources that were part of
legacy add-ons, and to map URIs ponting to those resources to add-on IDs, so
that we could apply special behavior to them.

We have better ways to track resources belonging to WebExtensions, so this
code does not benefit them in any significant way.

The only remaining legacy extensions are system add-ons, which we control, and
do not need the path service in order to track.

MozReview-Commit-ID: BKXkcaM7jJx
2018-03-13 20:21:22 -07:00
Kris Maglione
27e1f60960 Bug 1403348: Part 4 - Annotate certain startup crashes with AsyncShutdown script contents. r=mccr8 data-r=rweiss
We're seeing startup crashes which point to data corruption in the source of
the AsyncShutdown component and module, but it's unclear whether the source of
this corruption is on disk, in memory, or in XDR data.

This change annotates crash reports with the contents of those files, so that
we can compare the actual source with the corrupted values in the generated
errors, and narrow down the source of the corruption.

MozReview-Commit-ID: 7p8y73XUGLK
2017-11-04 17:20:17 -07:00
Csoregi Natalia
d263b4ccd8 Backed out changeset cf8613751378 (bug 1403348) for Build Bustage on ServiceWorkerRegistrar.cpp:29. CLOSED TREE 2018-03-09 00:59:11 +02:00
Kris Maglione
9f14816f10 Bug 1403348: Part 4 - Annotate certain startup crashes with AsyncShutdown script contents. r=mccr8 data-r=rweiss
We're seeing startup crashes which point to data corruption in the source of
the AsyncShutdown component and module, but it's unclear whether the source of
this corruption is on disk, in memory, or in XDR data.

This change annotates crash reports with the contents of those files, so that
we can compare the actual source with the corrupted values in the generated
errors, and narrow down the source of the corruption.

MozReview-Commit-ID: 7p8y73XUGLK
2017-11-04 17:20:17 -07:00
Kris Maglione
59f145393e Bug 1431533: Part 1 - Cache module exports when a module is first loaded. r=mccr8
Looking up and copying exported properties each time a module is loaded is
fairly expensive at the best of times. It's even more expensive when we only
want to export a subset of symbols, which generally requires creating a
temporary object to hold the exports, or fetching them directly from the
returned global.

Aside from making the general case a bit faster, storing exports on an object
allows us to optimize lazy module imports by fetching imported symbols
directly from the exports object with very little additional overhead.

MozReview-Commit-ID: C9PGoXPNmsh
2018-01-18 14:12:04 -08:00
Florian Quèze
0be9490ccf Bug 1428176 - Enable browser_startup.js on DevEdition builds. r=mccr8, r=florian 2018-01-04 22:17:38 +01:00
Andrew McCreight
88093fdbd9 Bug 1407735 - Make the JS loader XPCOM component use a singleton. r=kmag
mozJSComponentLoader is created using XPCOM. However, you can only
call it once or it'll crash. This patch fixes that by using a
singleton macro.

MozReview-Commit-ID: Bq2k7nv9dKA
2017-10-23 13:53:58 -07:00
Andrew McCreight
ea27299d7f Bug 958643, part 6 - Remove some unused forward decls. r=krizsa
MozReview-Commit-ID: yMpU0hDUXP
2017-09-20 12:02:47 -07:00
Kris Maglione
51dc332f05 Bug 1398895: Part 2 - Ensure component loader initialization after user prefs load. r=mccr8
The script precompiler needs to begin its work very early in the startup
process in order to be effective. At the moment, this means before user
preferences are loaded. It also needs to be able to compile scripts into
the shared JSM global when that's in use, in order to avoid unnecessary script
clones.

Since we can't know whether global sharing is enabled by that point, instead,
we just always compile module scripts into the shared module global rather
than the XPC compillation scope.

This also changes the global sharing tests to make a failure to respect the
user preference value a fatal error.

MozReview-Commit-ID: G0NkSOl2vU9
2017-09-11 13:52:13 -07:00
Florian Quèze
9278da562f Bug 1398198 - browser_startup.js should show the stack when a JS file was loaded earlier than expected, r=felipe,mccr8. 2017-09-13 21:19:53 +02:00
Kris Maglione
406ff5c8df Bug 1381976: Part 2 - Cleanup private/protected members and mark class final. r=mccr8
MozReview-Commit-ID: Kn9NfKC4GL8
2017-08-25 13:29:51 -07:00
Kris Maglione
78be6708ac Bug 1381976: Part 1 - Use the shared module global for script pre-compilation. r=mccr8
When we pre-compile scripts for a different global than they are eventually
executed in, we need to clone them into the new global before we can execute
them, which can be expensive. This also prevents us from using lazy parsing,
since lazy functions are currently eagerly compiled when cloned.

Since the vast majority of the scripts compiled by the preloader are executed
in the shared modules scope, initially compiling them there removes a lot of
startup overhead. For the few that aren't, we don't lose anything by compiling
them in the shared module global, but we also don't gain anything over
compiling them in the XPConnect compilation scope.

MozReview-Commit-ID: CEh42BmIMhL
2017-08-25 19:36:44 -07:00
Andrew McCreight
77d8afc89b Bug 1186409 - Check to make sure we don't set some weird XPConnect flags on the shared global. r=kmag
I added the predicate so people can't just start grabbing the loader
global and doing scary things with it.

MozReview-Commit-ID: HzPtMzEm0Ln
2017-06-06 14:41:27 -07:00
Andrew McCreight
3e76dfaaf2 Bug 1186409 - Use a single global for all JSMs. r=kmag
This patch adds a preference jsloader.shareGlobal that makes it so
that JSMs share a single global, in order to reduce memory usage. The
pref is disabled by default, and will be enabled in a later bug. Each
JSM gets its own NonSyntacticVariablesObject (NSVO), which is used for
top level variable bindings and as the value of |this| within the JSM.

For the module loader, the main change is setting up the shared
global, and the NSVO for each JSM. A number of files are blacklisted
from the shared global, because they do things to the global that
would interfer with other JSMs. This is detailed in
mozJSComponentLoader::ReuseGlobal().

MozReview-Commit-ID: 3qVAc1c5aMI
2017-07-18 14:47:27 -07:00
Kris Maglione
e661843d2b Bug 1383215: Part 4 - Use location string as key in modules map. r=mccr8
Using the unmolested module location string as the cache key removes a huge
chunk of overhead when loading cached modules.

This also ensures that multiple URLs are not used to load the same module,
which would result in it being loaded more than once in the new regime

MozReview-Commit-ID: BAWoOJQSTc1
2017-07-24 20:32:42 -07:00
Andrew McCreight
6bb4df9cf7 Bug 1381919 - Remove most of the xpcIJSModuleLoader interface. r=kmag
People only use these methods via Cu, so remove them from this
interface. Also, ban anybody from implementing this interface in JS
(though I can't imagine anybody trying), and eliminate a variant of
mozJSComponentLoader::ImportInto that is never called.

MozReview-Commit-ID: Kok5ksXiK5a
2017-07-17 17:11:06 -07:00
Wes Kocher
f15763c885 Backed out changeset 3b275d92b419 (bug 1381919) for 32-bit windows build bustage a=backout CLOSED TREE
MozReview-Commit-ID: AeocWzkRyan
2017-07-18 22:37:01 -07:00
Andrew McCreight
943fcb9096 Bug 1381919 - Remove most of the xpcIJSModuleLoader interface. r=kmag
People only use these methods via Cu, so remove them from this
interface. Also, ban anybody from implementing this interface in JS
(though I can't imagine anybody trying), and eliminate a variant of
mozJSComponentLoader::ImportInto that is never called.

MozReview-Commit-ID: Kok5ksXiK5a
2017-07-17 17:11:06 -07:00
Andrew McCreight
e8cbbfcbb1 Bug 1379023, part 4 - Remove mSystemPrincipal fields from mozJSSubScriptLoader and mozJSComponentLoader. r=mrbkap
The lone remaining use is trivial.

MozReview-Commit-ID: Gx0K69ArMJ2
2017-07-07 11:29:48 -07:00
Andrew McCreight
425ab984cf Bug 1372295 - Call SetLocationForGlobal in a single location in the loader. r=kmag
SetLocationForGlobal is called on globals created for JSMs to give
them a nice name for about:memory. Right now this is done in
ImportInto and LoadModule, but I think it makes more sense to set the
name once, right after the global is created. Calling GetSpec on aURI
seems to return the same spec we'd use in these two call sites. This
change makes it easier to label the shared JSM global nicely in bug
1186409.

MozReview-Commit-ID: 5qKMbzLEiuG
2017-06-12 10:45:52 -07:00
Andrew McCreight
9afa0cb861 Bug 989373, part 8 - mLoaderGlobal is always null. r=kmag
This field can be eliminated for now.

MozReview-Commit-ID: 9xyxoTwBfXU
2017-05-15 15:51:20 -07:00
Andrew McCreight
9afebe5c0e Bug 989373, part 7 - Add new method to create a loader global. r=kmag
This makes the code a little nicer to read, and means there will be less code churn
if we later add back the ability to share globals.

The holder also gets changed to an actual JS object.

mLoaderGlobal is always null, but the simplification for that will be
made in a later patch.

MozReview-Commit-ID: 7Qg7JSgIxxm
2017-05-15 15:46:13 -07:00
Andrew McCreight
422f7c1863 Bug 989373, part 1 - Remove pref for reusing globals with JSMs. r=kmag
Removing support for this preference means that mReuseLoaderGlobal
will always be false, which lets us eliminate that field, and remove a
lot of code.

This also means that false is always passed to
PrepareObjectForLocation for aReuseLoaderGlobal.

ReadCachedFunction is no longer used, so it is deleted.

MozReview-Commit-ID: 5JD24EYVcQf
2017-05-15 14:33:21 -07:00
Andrew McCreight
dff2384e2f Bug 1365417 - mozJSComponentLoader::FindTargetObject() is infallible. r=kmag
MozReview-Commit-ID: Iw4ke16CTKg
2017-05-16 14:27:50 -07:00
Shu-yu Guo
45f2e559d8 Bug 1263355 - Rewrite the frontend: bindings. (r=jorendorff,Waldo) 2016-08-25 01:28:47 -07:00
Jan de Mooij
4e52a6ac88 Bug 1292892 part 4 - Pass RootingContext to ModuleEntry. r=bz 2016-08-11 14:39:22 +02:00
Jan de Mooij
bd0f1c9018 Bug 1292892 part 1 - Stop using JSRuntime outside SpiderMonkey. r=bz,terrence,fitzgen,kanru 2016-08-11 14:39:22 +02:00
Jonathan Watt
9c5b8de022 Bug 1279451 - Remove a lot of unnecessary includes of nsAutoPtr.h. rs=sparky 2016-06-07 21:10:18 +01:00
Nicholas Nethercote
d3e6c3b07b Bug 1187146 - Replace nsBaseHashtable::Enumerate() calls in js/xpconnect/ with iterators. r=mrbkap. 2015-11-22 18:52:40 -08:00
Shu-yu Guo
05b495be74 Bug 1202902 - Support non-syntactic extensible lexical scopes. (r=billm) 2015-10-06 14:00:29 -07:00
Terrence Cole
c06fcc8c9d Bug 1186156 - Move the PersistentRooted list heads into RootLists; r=sfink 2015-07-09 14:13:10 -07:00
Mike Hommey
4d93988786 Bug 1134923 - Remove NS_Alloc/NS_Realloc/NS_Free. r=nfroyd
They are kept around for the sake of the standalone glue, which is used
for e.g. webapprt, which doesn't have direct access to jemalloc, and thus
still needs a wrapper to go through the xpcom function list and get to
jemalloc from there.
2015-05-01 09:40:30 +09:00
Jan de Mooij
c6596c5fa8 Bug 1144366 - Switch SpiderMonkey and XPConnect style from |T *t| to |T* t|. r=jorendorff 2015-03-28 23:22:11 +01:00
Phil Ringnalda
1a1c158706 Backed out changeset 0c030f97a04f (bug 1144366) for being on top of patches being backed out
CLOSED TREE
2015-03-28 10:39:56 -07:00
Jan de Mooij
369ef1b850 Bug 1144366 - Switch SpiderMonkey and XPConnect style from |T *t| to |T* t|. r=jorendorff 2015-03-28 12:08:37 +01:00
Ehsan Akhgari
ea41d8de48 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

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

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Ehsan Akhgari
3ad09f5334 Bug 1119260 - Mark virtual overridden functions as MOZ_OVERRIDE in XPConnect; r=bholley 2015-01-22 17:54:52 -05:00
Ehsan Akhgari
7e755801f0 Bug 1060977 - Fix more bad implicit constructors in xpconnect; r=smaug 2014-08-31 21:06:35 -04:00
Bobby Holley
b2b763cb29 Bug 1052052 - Hoist Auto*JSContext into nsContentUtils and kill nsCxPusher.{cpp,h}. r=gabor 2014-08-14 18:47:15 -07:00
Ryan VanderMeulen
df43fcf12d Backed out changesets 5b1a3161f614, 17a9673ed782, and a9b8c346d295 (bug 1052052) for B2G non-unified bustage. 2014-08-14 17:23:10 -04:00
Bobby Holley
10dec58cfc Bug 1052052 - Hoist Auto*JSContext into nsContentUtils and kill nsCxPusher.{cpp,h}. r=gabor 2014-08-14 12:54:34 -07:00
Bob Owen
92b2244980 Bug 1047509 - Part 9: Remove final uses of mozJSComponentLoader's own JSContext and tidy up. r=bholley 2014-08-07 19:36:31 +01:00
Bob Owen
eeb09f67bb Bug 1047509 - Part 5: Change mozJSComponentLoader::PrepareObjectForLocation to take JSContext* instead of JSCLContextHelper&. r=bholley 2014-08-07 19:16:47 +01:00
Benoit Jacob
4401ffe3eb Bug 1028588 - Fix dangerous public destructors in js/xpconnect - r=bholley 2014-06-23 14:49:08 -04:00
Bobby Holley
dff4003f1f Bug 1026860 - Remove mThisObjects and use the function parent instead. r=luke,khuey 2014-06-18 22:36:42 -07:00
Bobby Holley
b7583931dc Bug 1008006 - Use a helper to avoid repeated computations of various dependencies. r=gabor 2014-05-12 14:37:46 -07:00
Birunthan Mohanathas
56da97da22 Bug 866289 - Make mode lines consistent in js/xpconnect/ for 4 space indented files. r=Ms2ger 2014-04-03 07:58:00 -04:00
Jon Coppeard
3af10bff29 Bug 993413 - Remove use of JS_Add/Remove*Root in favour of JS::PersistentRooted where possible r=terrence r=bz r=bholley 2014-04-16 09:47:53 +01:00
Bobby Holley
243cff36c1 Bug 977340 - Use an AutoJSContext when clearing modules. r=gabor 2014-03-04 10:05:08 -08:00
Bill McCloskey
de20dc88cf Bug 952183 - reuseGlobal doesn't account for scripts being recycled (r=mrbkap,khuey) 2013-12-19 12:49:52 -08:00