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

1570 Коммитов

Автор SHA1 Сообщение Дата
Dave Townsend 27380b996e Bug 1404420: Add custom element support to XUL. r=edgar, r=smaug
MozReview-Commit-ID: BietEX2gOoG

--HG--
extra : rebase_source : 6fd9a732a21f2c048d37c3f7139cd18503148767
2017-10-10 15:25:10 -07:00
Edgar Chen bf0a0f5b38 Bug 1415761 - Catch the exception and rethrow it after invoking custom elements reactions; r=bz
The spec was unclear on how CEReactions interact with thrown exceptions; see https://github.com/whatwg/html/issues/3217.
The spec is now being clarified in https://github.com/whatwg/html/pull/3235.

MozReview-Commit-ID: 521HprTRS7k

--HG--
extra : rebase_source : 107d331203d0d16062fa061569e822d3c6d5f2c9
2017-11-17 17:44:18 +08:00
Boris Zbarsky 3dd8d0e9c1 Bug 1379688 part 1. Remove some restrictions on whether an interface that implements QueryInterface can have a non-abstract ancestor. r=smaug
This restriction was put in place back when we automatically added
QueryInterface to all rootmost non-abstract interfaces.  At the time, we needed
to make sure it did NOT end up on EventTarget, because then webidl quickstubs
would replace the QI impl on non-webidl EventTargets with the WebIDL one, which
would not work for them.

Since then, we have removed WebIDL quickstubs and we now explicitly list which
interfaces get QueryInterface, so this check is no longer needed.

MozReview-Commit-ID: 5B13ymdyLp3
2017-11-20 13:59:20 -05:00
Sylvestre Ledru 85d099995a Bug 1416716 - Init deleteSucceeded to silent a -Wmaybe-uninitialized warning r=bz
MozReview-Commit-ID: C3pYuP5dPxI

--HG--
extra : rebase_source : f6a1003ca85b534a43b5efba33bbb4f502532d05
2017-11-13 10:04:59 +01:00
Boris Zbarsky e95559cd09 Bug 1415234. Annotate HTMLInputElement::Width() as MOZ_CAN_RUN_SCRIPT and plumb through the binding bits needed to make this pass static analysis. r=mystor
This basically marks most of the bindings bits as MOZ_CAN_RUN_SCRIPT.

MozReview-Commit-ID: HcQcYhTR9cb
2017-11-13 10:36:53 -05:00
Boris Zbarsky 37836d94c0 Bug 1414359. Remove vestigial support for 'creator' operations from webidl; all setters are creators. r=qdot
MozReview-Commit-ID: AeRjWxk1YwE
2017-11-04 00:36:10 -04:00
Kyle Machulis df8270946f Bug 792059 - Add NeedsWindowsUndef extended attribute for constants; r=bz
When defining WebIDL constants in C++, we may need to undefine some
constant names that conflict with windows.h preprocessor defines.
Doing this in the binding header is far easier than tracking down the
include orders that may cause conflicts.

MozReview-Commit-ID: A0UoYezIQs5

--HG--
extra : rebase_source : d9100af2ccdb5c6e6468542ac68f74b2e4f9050c
2017-10-23 17:34:28 -07:00
Kyle Machulis b0922aec43 Bug 792059 - Codegen generation of WebIDL constants in C++; r=bz
Generate C++ const definitions for WebIDL interface members with
primitive types.

MozReview-Commit-ID: 4fLtteWZUWA

--HG--
extra : rebase_source : bf45427c6b0e4acfa32ed3431a3cf385972950a0
2017-10-09 19:59:36 -07:00
Tom Schuster 7a6aff2c7e Bug 638054 - Remove watch class-hook and proxy trap r=jorendorff,bz 2017-10-24 20:48:14 +02:00
Boris Zbarsky 6a07397359 Bug 1354730. Disable named property object (aka global scope polluter) behavior for all Xrays. r=kmag
MozReview-Commit-ID: KmbXFfSzH0N
2017-10-16 10:58:09 -04:00
Peter Van der Beken 772f1ee5da Bug 1383059 - Remove instanceof for supplemental interfaces. Part 2: remove support for supplemental interfaces in instanceof code and remove unnecessary ChromeWindow interface. r=bz.
--HG--
extra : rebase_source : e8ce446e7f1844c6d1d352896873cbb865837632
extra : source : 944786dca81aed2e480562694bfabc6e5fbf1266
2017-07-05 23:01:04 +02:00
Jan de Mooij dbca189324 Bug 1153592 part 2 - Remove JSPROP_SHARED; ensure accessor props don't have slots. r=evilpie 2017-09-26 12:26:50 +02:00
Kris Maglione f37317cad0 Bug 1369533: Return dead wrappers rather than null for dead CallbackObject values. r=bz
We don't have access to an appropriate context to create the dead wrapper in
when the callback is nuked, so instead, this patch creates a new dead wrapper
in the caller compartment each time the property is accessed. This is the same
behavior we'd get when trying to re-wrap a cross-compartment dead wrapper, so
it's consistent with the way we handle these situations elsewhere.

MozReview-Commit-ID: 3cMeR4z8EOe

--HG--
extra : rebase_source : 7e8cf4a195ef64deb7677ce4ac9818d342815667
2017-09-04 17:21:06 -07:00
Jon Coppeard 8bd8591183 Bug 1396613 - Make proxy objects override handler's objectMoved method rather than using class hook r=sfink r=mccr8 r=peterv 2017-09-19 12:31:30 +01:00
Jon Coppeard 1077972535 Bug 1396613 - Update the object moved hook to allow it to be called when tenuring nursery objects r=sfink r=mccr8 2017-09-19 12:31:30 +01:00
Boris Zbarsky 005450266e Bug 1400139 part 1. Add infrastructure for marking WebIDL interface members as non-enumerable. r=qdot
MozReview-Commit-ID: 9F0ZNverS63
2017-09-18 21:24:37 -04:00
Boris Zbarsky 82a08c647e Bug 991271. Restore our assertions about how wrapping failure should mean an exception was thrown. r=mccr8
Now that Gecko controls error reporting and the JS engine is no longer doing
JS_IsRunning checks, we should consistently have exceptions here.

MozReview-Commit-ID: IqBe5ArJc2l
2017-09-18 21:24:37 -04:00
Boris Zbarsky 15194f2f07 Bug 1400275. Ensure we create reflectors for JS-implemented webidl interfaces with the right prototype when those interfaces are subclassed. r=qdot
MozReview-Commit-ID: 5yYD92NVVFQ
2017-09-15 23:45:06 -04:00
Eden Chuang 8b1ac2ad9e Bug 1387149 - Remove outdated comment from Codegen.py. r=bz
Remove following outdated comment from Codegen.py
# We don't enforce this for chrome in realease builds to avoid the addon
# compat fallout of making that change. See bug 916644.
2017-08-09 17:31:10 +08:00
Valentin Gosu 0546c43ed7 Bug 1393837 - Make sure codegen includes all the parent interfaces r=peterv
MozReview-Commit-ID: 5UWExNmYyME

--HG--
extra : rebase_source : 2fa38d0ebaa894a381b3daf0b4de57346a9f911d
2017-09-06 10:33:45 +02:00
Boris Zbarsky 056d8fe612 Bug 1395421 part 2. When a get() happens on a JS-implemented maplike, notify the JS implementation so it can take some sort of action (e.g. logging or warning). r=peterv
MozReview-Commit-ID: 9G115wOyzvm
2017-08-31 22:45:53 -04:00
Boris Zbarsky 2697cc0235 Bug 1395421 part 1. Don't codegen JS-implemented-webidl glue for methods that use maplike/setlike/iterable codegen (and hence wouldn't call into that clue anyway). r=peterv
MozReview-Commit-ID: 6voihCBh6wh
2017-08-31 22:45:53 -04:00
Andrew McCreight 78807d8776 Bug 1391005 - Eliminate NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED. r=peterv
Replace it with NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION, because it
has been the same for a while.

MozReview-Commit-ID: 5agRGFyUry1

--HG--
extra : rebase_source : 5388c56b2f6905c6ef969150f0c5b77bf247624d
2017-08-29 16:02:48 -07:00
Jan de Mooij a5de55dced Bug 1389510 part 3 - Remove getProperty/setProperty hooks from ClassOps. r=evilpie 2017-08-25 10:12:16 +02:00
Benjamin Bouvier b5407c81cc Bug 1391633: Remove the unused JSContext parameter in SetDocumentAndPageUseCounter; r=froydnj
MozReview-Commit-ID: KtVP5JgLIFC

--HG--
extra : rebase_source : 210f0a479cf0919e1d6e589a5857f43fb50fa8c5
extra : histedit_source : 2f08891b3dba80e117e3f5e4a0e0367b51e42606
2017-08-18 16:02:15 +02:00
John Dai b50868f89a Bug 1392790 - Avoid doing [CEReactions] if custom element preference is disabled. r=smaug 2017-08-23 02:36:00 -04:00
Edgar Chen 12bce104dc Bug 1299363 - Part 2: Allow prototype swizzling in html constructor. r=bz
MozReview-Commit-ID: KGVfbAxpbfq

--HG--
extra : rebase_source : f9b5150eb2c988b0d18b44cdcce820bc8d3f4bf3
extra : histedit_source : a6f4f69740f3622959557e1fc0ae44bb05151c37
2017-02-17 18:33:44 +08:00
Andrea Marchesini 42e07522e8 Bug 1128959 - Implement the WHATWG Streams spec - part 2 - WebIDL Bindings - internal renaming, r=bkelly 2017-08-10 18:04:54 -07:00
Andrea Marchesini 351d938b86 Bug 1128959 - Implement the WHATWG Streams spec - part 1 - WebIDL Bindings, r=bz 2017-08-10 18:04:54 -07:00
Boris Zbarsky 66481a7a29 Bug 1371259 part 9. Make UnwrapReflectorToISupports return already_AddRefed<nsISupports>. r=peterv
The main reason to not do this would be performance (avoiding the
addref/release), but there are two main mitigating factors:

1)  All calls to UnwrapReflectorToISupports that pass in a Web IDL object
    already do the addref (and in fact QI).  So this only affects the
    XPCWrappedNative case.

2)  The vast majority of the callers proceed to QI on the pointer anyway, and a
    second addref is cheap; it's the first addref after a CC that can be
    expensive on a cycle-collected object.

Going through the changes one by one:

* In GlobalObject::GetAsSupports, we do have a change that slightly slows down
  precisely in the XPCWrappedNative global case.  That's the message managers
  and the backstagepass.  And this really only affects calls to Web IDL statics
  from those globals.

* In UnwrapArgImpl we're talking about a Web IDL method taking an "external
  interface" type, and the UnwrapReflectorToISupports call is immediately
  followed by QI anyway.

* In UnwrapXPConnectImpl we're talking about the case when we have a
  non-WebIDL-object implementation of a Web IDL interface.  Again, this is the
  message manager globals, for EventTarget.  And we have a QI call immediately
  after the UnwrapReflectorToISupports.

* In the generated HasInstance hook for EventTarget we will be slightly slower
  when the LHS of the instanceof is an XPCWrappedNative.  And not much slower,
  because again there's an immediate QI.

* In InstallXBLField we're never going to have an XPCWrappedNative as thisObj;
  it's always an Element in practice.  So this is no more expensive than before.

* In sandbox's GetPrincipalOrSOP we now have an extra addref.  But it was
  followed by various QIs anyway.

* In XPCConvert::JSValToXPCException we have an extra addref if someone throws
  an XPCWrappedNative, which is fairly unlikely; our actual Exception objects
  are on Web IDL bindings.  Plus we have an immediate QI.

* In xpc::HasInstance we have an extra addred if the LHS of instanceof is an
  XPCWrappedNative.  But, again, there's an immediated QI after the
  UnwrapReflectorToISupports.

* In xpcJSWeakReference::Init we are likely doing an extra addref, but again
  immediately followed by QI.

I think it's worth making this change just to remove the footgun and that the
perf impact, if any, is pretty minimal.
2017-07-10 16:05:26 -04:00
Boris Zbarsky 9cdb2834a8 Bug 1371259 part 8. Get rid of nsIXPConnect::GetNativeOfWrapper. r=peterv
Most of these changes are just replacements of GetNativeOfWrapper with
UnwrapReflectorToISupports, which is all it did under the hood.

The other changes are as follows:

* In nsDOMClassInfo, we really care whether we have a window, so we can just
  UNWRAP_OBJECT to the Window interface, since Window is always on Web IDL
  bindings now.  Also, the weird compartment check hasn't been needed ever since
  GetNativeOfWrapper stopped returning things off the passed-in object's
  prototype chain (Firefox 22, bug 658909).
* The only use of do_QueryWrapper was to get a Window in nsDocument; again we
  can UNWRAP_OBJECT.
* In XPCJSRuntime, we again just want to check for a Window, so UNWRAP_OBJECT.
2017-07-10 16:05:25 -04:00
Boris Zbarsky cdd8fe10d4 Bug 1371259 part 4. Stop using UnwrapArg to unwrap this values. r=peterv 2017-07-10 16:05:25 -04:00
Boris Zbarsky 5c76874a46 Bug 1371259 part 3. Change UnwrapObject<> and the UNWRAP_OBJECT macro to allow passing in mutable object or value handles for the thing being unwrapped, and do so at various callsites. r=peterv
I did audit all UNWRAP_OBJECT callers to make sure that the lifetimes of all the
temporary Rooted or the RefPtrs they unwrap into are long enough.
2017-07-10 16:05:24 -04:00
Boris Zbarsky 5fd161c633 Bug 1371259 part 2. Change union conversions for non-owning unions to pass a MutableHandle through to the underlying conversion code. r=peterv 2017-07-10 16:05:24 -04:00
Boris Zbarsky 6ed5936b6b Bug 1371259 part 1. Pass maybe-mutable Value handles, not JSObject*, into CastableObjectUnwrapper. r=peterv
The idea is that CastableObjectUnwrapper will want to have a MutableHandle for
the thing it's unwrapping whenever its target is a raw pointer.  Since we have
convenient MutableHandle<Value> in most cases, it's easier to switch
CastableObjectUnwrapper to working with MutableHandle<Value> or Handle<Value>
instead of trying to get MutableHandle<JSObject*> in the right places.

There are basically two changes here:

1) Make CastableObjectUnwrapper work with at thing that looks like a Value.
2) Change various callsites to pass in MutableHandle<Value>, in addition to a
   Handle<Value>, into the JS-to-C++ conversion templates.  The
   MutableHandle<Value> is passed as ${maybeMutableVal}.  It may not actually
   end up being a MutableHandle in some cases.

The reason for passing both a Handle and a MutableHandle is that when the thing
we actually have is a Rooted named "foo" the Handle will be "foo" but the
MutableHandle is most naturally written as "&foo".  This is not a problem if
you're just passing it through, but if you want to test whether it's an object,
say, you have a problem.  Writing "foo.isObject()" is ok, but "&foo.isObject()"
is not, and neither is "(&foo).isObject()".  This could be worked around by
passing the MutableHandle as "JS::MutableHandle<JS::Value>(&foo)" or something,
and then "JS::MutableHandle<JS::Value>(&foo).isObject()" does work.  But it
makes the code very hard to read.

So we just pass both things along; ${val} should be used for readonly access and
${maybeMutableVal} any time you really want a MutableHandle.
2017-07-10 16:05:24 -04:00
Boris Zbarsky d471a06f87 Bug 1376954 part 2. Support nursery allocation of DOM proxy objects. r=smaug,jonco 2017-06-30 10:15:52 -07:00
Boris Zbarsky 239e1057ca Bug 1376954 part 1. Ensure that we don't try to nursery-allocate non-wrappercached DOM objects. r=smaug 2017-06-30 10:15:51 -07:00
Ting-Yu Chou 8f144f6221 Bug 1348099 part 3 - Fix the codegen so the methods for clearing cached attribute values are not unforgeable. r=bz
Current codegen list the methods for clearing cached attribute values in both
chrome only unforgeable methods and chrome only normal methods, but they should
exist only in the normal ones.

MozReview-Commit-ID: Il2JvCLZ2v3

--HG--
extra : rebase_source : 21b9c715c921c4ac7f6ed4c235ee79a3628162bd
2017-06-29 17:54:20 +08:00
Ting-Yu Chou 2a8c9b7ffd Bug 1348099 part 1 - Binary search property id when resolve DOM Xrays own property. r=bz
Currently we resolve a property by iterating every prefable and check whether it
is enabled.  If it is, we linear search the ids that it manages.  This patch
changes that to binary searching to find whether the id being resolved is
present first, and checking whether its prefable is enabled only when we find
it.  This improves the performance of property resolution, especially when the
property is not present.

The patch stores all the property ids a NativePropertiesN owns in a single array
of PropertyInfo structs.  Each struct contains an id and the information needed
to find the corresponding Prefable for the enabled check, as well as the
information needed to find the correct property descriptor in the Prefable.  We
also store an array of indices into the PropertyInfo array, sorted by bits of
the corresponding jsid.  Given a jsid, this allows us to binary search for the
index of the corresponding PropertyInfo, if any.  The index array requires 2
bytes for each property, which is ~20k across all our bindings.  The extra
information stored in each PropertyInfo requires 4 bytes for each property,
which is about 40k across all our bindings in 32-bit builds, or 80k in 64-bit
builds due to alignment requirements on PropertyInfo.  However we save a bit of
memory from changing NativePropertiesN's trios to duos.

The array of unsorted ids is kept because XrayOwnPropertyKeys() includes only
properties that are enabled.  Without it, we will need to check every single
property to know whether its prefable is enabled or not, which is inefficient.

With this patch, initializing property ids takes longer because of the sorting.
I measured also insertion sort because I thought the ids should be nearly sorted
as they are generated sequentially at run time, but that's not the case and
NS_QuickSort() runs faster.

MozReview-Commit-ID: Lc4Z1ui3t0o

--HG--
extra : rebase_source : 314efe467a14428c57f90af2ecc0ec5c47a31993
2017-06-12 12:13:38 +08:00
Boris Zbarsky b87612bde1 Bug 1374119. Use a bool pref cache for interface object enablement conditions instead of calling GetBool. r=qdot 2017-06-19 23:52:04 -04:00
Mats Palmgren ea75194536 Bug 1372031 - Use EnsureInserted instead of Contains+PutEntry to avoid unnecessary hashtable lookups. r=froydnj
MozReview-Commit-ID: 2ZG2qX3dyGa
2017-06-17 00:06:04 +02:00
Jan de Mooij bf6aed7a06 Bug 1370608 part 3 - Use JS_NewEnumerateStandardClasses outside js/src. r=bz 2017-06-14 10:39:11 +02:00
Jan de Mooij 83f290de99 Bug 1370608 part 1 - Move newEnumerate hook from ObjectOps to ClassOps. r=evilpie,bz 2017-06-14 10:37:44 +02:00
Boris Zbarsky d7ec8ed805 Bug 1372371. Fix enumerability handling in the window resolve hook. r=qdot 2017-06-12 22:17:03 -04:00
Boris Zbarsky 40b47041ab Bug 1370614. Replace some uses of ProtoAndIfaceCache::EntrySlotIfExists with a faster boolean-returning test function. r=froydnj 2017-06-07 12:56:27 -04:00
Boris Zbarsky febf0f30d6 Bug 1364816 part 5. Make getting window names a bit faster by avoiding various intermediate strings. r=qdot,jandem 2017-06-06 21:21:45 -04:00
Boris Zbarsky 60d80c3c4e Bug 1364816 part 3. Switch NeedResolve bindings to using a newResolve hook instead of a resolve hook. r=qdot,jandem 2017-06-06 21:21:44 -04:00
Boris Zbarsky 1002ea42f3 Bug 1364816 part 1. Store the relevant constructor id in the entries in the WebIDLGlobalNameHash. r=qdot 2017-06-06 21:21:43 -04:00
Boris Zbarsky 0396c9b2f2 Bug 1369367. DOM callbacks can now store a null object; teach codegen to handle that. r=qdot 2017-06-02 16:37:02 -04:00
Boris Zbarsky 7c6c40e506 Bug 1366032. Align IDL record to C++ conversion with the spec when Symbol-named properties are involved. r=qdot 2017-05-24 08:50:30 -04:00