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

135 Коммитов

Автор SHA1 Сообщение Дата
Dave Townsend fd8d6b1590 Bug 1480465: Infer the namespace for custom elements at definition time by following the class hierarchy. r=smaug
When a custom element is defined we can check whether its class is an instance
of XULElement or HTMLElement and tag the defintion with a namespace accordingly.
This allows us to know the correct namespace for the custom element when
created.

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

--HG--
extra : moz-landing-system : lando
2018-08-15 10:31:16 +00:00
Kris Maglione e295c2223a Bug 1480244: Part 0 - Fix unified build bustage. r=me
--HG--
extra : rebase_source : 4966a2166a1d57747d0ca21941e885096850f63f
2018-08-11 15:26:49 -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 d238731d5e Bug 1472976 part 1 - Unwrap the object before getting its principal in CustomElementRegistry::IsCustomElementEnabled. r=smaug 2018-08-10 11:57:39 +02:00
Jan de Mooij 5824a03a39 Bug 1478359 - Store a global object in nsXPCWrappedJS and use it for realm-entering. r=mccr8
The problem we're solving here: getting/entering the realm/global of a cross-compartment wrapper doesn't make sense once there are multiple realms in a compartment and the CCW will be shared by all of them. Because nsXPCWrappedJS can store a CCW, we will no longer be able to use this JSObject to enter the target realm.

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

nsXPCWrappedJS has some code to deal with weak pointers. Fortunately this applies only to root wrappers and root wrappers always store an unwrapped JSObject, so the extra global we store is guaranteed to be marked by the GC in that case (a global object is never collected when there are live JSObjects belonging to the same realm).
2018-08-07 11:57:41 +02:00
Nicholas Nethercote d0da0b5842 Bug 1478879 - Remove Range/Enum use in dom/. r=mccr8
--HG--
extra : rebase_source : 422301183e7855a0a994c77ee1e4a4aed72fd9c5
2018-07-31 10:31:00 +10:00
Julian Descottes c81dc03e34 Bug 1443923 - part5: Emit chrome-only event customelementdefined for DevTools;r=masayuki
MozReview-Commit-ID: GCFhhpVj5VS

--HG--
extra : rebase_source : 358985aafe8f517c16be5a570fea7ed0ef68b6c3
2018-07-20 11:01:43 +02:00
Olli Pettay 2e08f09ac9 Bug 1477008, remove invalid assertions, r=edgar 2018-07-21 22:59:36 +03:00
Neil Deakin 0cc9fd046c Bug 1461742, add a mechanism so that custom elements can implement interfaces akin to XBL implements. This is accomplished by an additional chrome-only callback getCustomInterface that can be implemented by custom elements, r=bz 2018-07-19 08:38:45 -04:00
Csoregi Natalia 143b18ba60 Backed out 2 changesets (bug 1461742) for build bustage on CustomElementRegistry.cpp:97. CLOSED TREE
Backed out changeset ca5415dbc51a (bug 1461742)
Backed out changeset 30bd77de7bf5 (bug 1461742)
2018-07-19 13:36:31 +03:00
Neil Deakin c2c722be92 Bug 1461742, add a mechanism so that custom elements can implement interfaces akin to XBL implements. This is accomplished by an additional chrome-only callback getCustomInterface that can be implemented by custom elements, r=bz 2018-07-19 06:15:26 -04:00
Olli Pettay d87b0df953 Bug 1331334 - Implement :defined pseudo-class for custom elements, r=emilio
--HG--
extra : rebase_source : 5f95c38166d00ae07ef523ab8ecb5b4cb59eceaf
2018-06-28 14:55:45 +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
Olli Pettay 5f299f6227 Bug 1443722 - Implement customElements.upgrade(), static void TryUpgrade , r=mrbkap 2018-06-20 02:14:05 +03:00
Olli Pettay d10d7af09d Bug 1443722 - Implement customElements.upgrade() , r=mrbkap
--HG--
extra : rebase_source : b6153841b5cb38d697795564f1e864e46eb96d35
2018-06-20 02:06:33 +03: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
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
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
Olli Pettay 60fc265ce2 bug 1464345, ensure all CustomElementReaction implementations traverse their member variables, r=mrbkap 2018-05-30 13:24:44 +03:00
Timothy Guan-tin Chien 9b93107cb5 Bug 1462703 - Upgrade the created element after callback runs r=smaug
nsContentUtils::NS_NewXULOrHTMLElement will call into
CustomElementRegisty::RegisterCallbackUpgradeElement, which keeps
the newly created element, allowing RunCustomElementCreationCallback
to upgrade them after the callback runs.

It is unclear if this changes the order of constructor executions,
but even so it should not affact our use case.

MozReview-Commit-ID: LWTn7B35aBv

--HG--
extra : rebase_source : 15382431f34dd887c14142ff47337e8d1eec74ef
extra : source : 47058a61951c2974514e41e316e5370cfa4f9d8b
2018-05-23 13:04:18 +08:00
Timothy Guan-tin Chien dc0ecec7d0 Bug 1462703 - Set returned CustomElementDefinition again after script runner is set r=smaug
This would help in the case where it is safe to run script in-place and
the CustomElementDefinition is available before the function exits.

This fixes the tests changed.

MozReview-Commit-ID: Ays91W94WZm

--HG--
extra : rebase_source : 6b0f1f90de9a6bfd7db577f1fb0e76564c3627e7
extra : source : 47c62a1e2f268e1be24c3fddfc006c3ad45ba4ac
2018-05-22 07:30:07 +08:00
Timothy Guan-tin Chien e84b173ee2 Bug 1462806 - Extract is value from nsXMLContentSink r=smaug
Nodes copied from DOMParser document fragment would need to be
created with the proper custom element data.

CustomElementRegistry::IsCustomElementEnabled() is changed to allow
it to run in the test document.

MozReview-Commit-ID: 4GACDR8FIc7

--HG--
extra : rebase_source : 39da41dd1ca56bf62043418c503c526e2895254f
2018-05-20 10:23:46 +08:00
Margareta Eliza Balazs 0bb5e5ba36 Merge inbound to mozilla-central. a=merge 2018-05-19 12:39:28 +03:00
Boris Zbarsky a02a40bdb5 Bug 1462737. Make AsElement() not compile when called on Element or some subclass. r=mccr8
It's just noise if we already have an Element.
2018-05-18 23:37:56 -04:00
Boris Zbarsky 395d320fce Bug 1461711 part 4. Stop unwrapping the custom element prototype when getting the lifecycle callbacsk. r=smaug
There is no reason to do that, apart from allowing Xrays to shoot themselves in the foot....
2018-05-18 16:18:19 -04:00
Boris Zbarsky 4fe32cc96b Bug 1461711 part 3. Fix potential leak of LifecycleCallbacks in CustomElementRegistry::Define. r=smaug 2018-05-18 16:18:19 -04:00
Boris Zbarsky d37ee8aa88 Bug 1461711 part 2. Remove some unnecessary Realm machinery in CustomElementRegistry::Define. r=smaug
1) The passed-in constructor is already same-compartment with the passed-in
   aCx, so there is no need to enter its Realm to work with it.

2) aCx is already in the compartment of constructorProtoUnwrapped when we do
   JS_WrapValue on rootedv, which is initialized to constructorProtoUnwrapped.
   That JS_WrapValue call is not needed.
2018-05-18 16:18:19 -04:00
Boris Zbarsky 9f24750878 Bug 1461711 part 1. Change CustomElementRegistry::Define to just take a JSContext from the caller instead of setting up an AutoJSAPI itself. r=smaug
This more closely matches what should happen with entry/incumbent globals in
the spec.
2018-05-18 16:18:19 -04:00
Boris Zbarsky 2b7be9c25a Bug 1462453. Remove the useless, and incorrect, CheckLifeCycleCallbacks function. r=smaug
This check is already done by the dictionary init method.  This function just
makes us do extra non-spec get operations.

For now this introduces more failures due to bug 1419323 and the spec issue at
<https://github.com/whatwg/html/issues/3580>.  The tests testing for that stuff
were passing due to exceptions getting thrown from CheckLifeCycleCallbacks.
2018-05-18 16:18:19 -04:00
Timothy Guan-tin Chien 08741f30ed Bug 1460962 - Support customized built-in element in XUL r=smaug
This patch enables us to specify a custom element type with |is| attribute
or property when creating a XUL element. Because non-dashed names are valid
custom element names in XUL (bug 1446247), other checks has to modified
accordingly.

The checks I am settling with are
1) Forbids the custom built-in element names to be a non-dashed name.
2) Forbids the custom built-in element to extend a dashed built-in element name.

This also ensures the custom built-in element types don't take on the same
name as the element name it extends.

MozReview-Commit-ID: GCQ9RnfvvrC

--HG--
extra : rebase_source : 2fa13742525d2107580d50872ff5b0fc42539498
extra : source : 2dc5513660d78a4de4801109140743ffc9297f71
2018-05-11 12:44:46 -07:00
Timothy Guan-tin Chien c01a7646b9 Bug 1460815 - Provide a chrome-only callback on CustomElementRegistry so script can define CE lazily r=smaug
This patch creates a chrome-only method
customElements.setElementCreationCallback() so that custom elements migrated
from XBL bindings doesn't have to be define()'d on document loading. With this
method, we will set callbacks and the platform will get back to us when it
encounters a matched custom element type -- and the callback will load the
relevant script.

It's important to note that the callback runs after construction of the first
element; it will be upgraded when it's being appended.

MozReview-Commit-ID: 80z72zwXRlf

--HG--
extra : rebase_source : 826188e56bb0b167d1e5bafb7d2a487a32bd9dfa
2018-05-11 11:23:31 -07:00
Jan de Mooij 80e44e8003 Bug 1461292 part 1 - Rename JSAutoCompartment to JSAutoRealm. r=bz,luke 2018-05-16 10:53:16 +02:00
Olli Pettay a7be7cff43 Bug 1460334 - Fix crash caused when attempting to migrate <deck> from a XBL binding to a Custom Element. r=peterv
--HG--
extra : amend_source : 461d41fa51087ce1cefc72df61a00e9cae5605e5
2018-05-10 14:08:00 -04:00
Olli Pettay a055a5fc0d Bug 1444285, let custom element upgrades to use backup queue inside chrome/XBL, r=mrbkap
--HG--
extra : rebase_source : 73d484bf9cae0168c4a1dc478ad8d1ccd5eed93f
2018-04-27 02:08:27 +03:00
Brian Grinstead 6cb530800d Bug 1446247 - Pass namespace into IsCustomElementName to allow for non-dashed XUL elements;r=e7358d9c+590837,smaug
This will make it possible to migrate existing bindings without also needing to
mass-rewrite frontend code at the same time.

MozReview-Commit-ID: IBBqC4eeDDX

--HG--
extra : rebase_source : e901ac665208b3a683668c1bb33a26dcf479580c
2018-03-29 09:34:56 -07:00
Olli Pettay f2340aa57f Bug 1452386 - Add a helper to get the existing nsIWeakReference from nsINode, r=emilio 2018-04-07 20:41:03 +03:00
Olli Pettay 0f16188dd5 Bug 1452074 - improve the performance related to unresolved custom elements, r=emilio 2018-04-07 12:50:01 +03:00
Andreea Pavel 9f9457503a Backed out changeset e220521c6ff6 (bug 1446247) on request a=backout r=smaug 2018-04-06 13:23:59 +03:00
Brian Grinstead 81b95b0b38 Bug 1451340 - Don't attempt to RegisterUnresolvedElement for native anonymous content;r=smaug
The webconsole UI generates a large number of scrollbars, and considering their children as
potential Custom Elements causes a slowdown when setting innerHTML="" when devtools closes.

MozReview-Commit-ID: 2QCcXCnTHA2

--HG--
extra : rebase_source : 5226e5689195a047ebcb9903b4565df13b6b1aa0
2018-04-05 12:01:18 -07:00
Brian Grinstead a5543400b1 Bug 1446247 - Pass namespace into IsCustomElementName to allow for non-dashed XUL elements;r=e7358d9c+590837,smaug
This will make it possible to migrate existing bindings without also needing to
mass-rewrite frontend code at the same time.

MozReview-Commit-ID: IBBqC4eeDDX

--HG--
extra : rebase_source : e901ac665208b3a683668c1bb33a26dcf479580c
2018-03-29 09:34:56 -07:00
Dave Townsend c70f34995e Bug 1421070: Always enable custom elements in chrome. r=smaug, rs=MattN
This allows custom elements to work in any document in the parent process that
allows XUL and XBL. The test takes the easy option of moving the existing XUL
custom element test to a run with the custom element pref disabled.

MozReview-Commit-ID: CMiLzmp60jA

--HG--
extra : rebase_source : 735688061116c633b816f4f9d488712408df11a5
extra : source : 794ee6857d83dfe0b18629c12e96a622fc899586
2017-10-20 11:02:33 -07:00
Margareta Eliza Balazs 190225b29c Backed out changeset 794ee6857d83 (bug 1421070) for 15 failures in toolkit/components/payments/test/mochitest/test_ObservedPropertiesMixin.html on a CLOSED TREE
--HG--
extra : amend_source : 0574ce1b5b6a6e8735245684eb8e9ec7b0ac2647
2018-03-23 03:42:25 +02:00
Dave Townsend 2626e1c261 Bug 1421070: Always enable custom elements in chrome. r=smaug
This allows custom elements to work in any document in the parent process that
allows XUL and XBL. The test takes the easy option of moving the existing XUL
custom element test to a run with the custom element pref disabled.

MozReview-Commit-ID: CMiLzmp60jA

--HG--
extra : rebase_source : b9632de82cf79c1df15be09fadf1d25817c8a894
extra : amend_source : 235a76453d1d6782903d5051ee8e234b965dcc36
2017-10-20 11:02:33 -07:00
Blake Kaplan b12e3317aa bug 1326028 - Upgrade elements in the right order. r=smaug
MozReview-Commit-ID: 4u5PipUqN0j

--HG--
extra : rebase_source : d51e63783c156b2ecebbaed98d530a83bcb3f6b8
2018-02-21 16:43:09 -08:00
Andreea Pavel 9b1570bb80 Backed out 3 changesets (bug 1326028) for wpt bustage in custom-elements/CustomElementRegistry.html on a CLOSED TREE
Backed out changeset 38057b774238 (bug 1326028)
Backed out changeset ab4ee52d5a81 (bug 1326028)
Backed out changeset 414efc66b026 (bug 1326028)
2018-03-07 08:07:28 +02:00
Blake Kaplan 3b005f58b3 bug 1326028 - Upgrade elements in the right order. r=smaug
MozReview-Commit-ID: 4u5PipUqN0j

--HG--
extra : rebase_source : 9aa33ff7dddc16ed153ff4673d05fd74bdef9ac6
2018-02-21 16:43:09 -08:00
Olli Pettay 2439836b37 Bug 1193394 - Part 1: Microtasks and promises scheduling. r=bevis 2017-11-17 11:01:27 +08:00
Boris Zbarsky e278d7fdb7 Bug 1438326. Don't try to enqueue custom element callbacks when the custom element definition has been unlinked. r=smaug
MozReview-Commit-ID: FLf6CJcpcVQ
2018-03-01 12:32:32 -05:00
Csoregi Natalia 1fd0486e23 Backed out 7 changesets (bug 1193394) for browser-chrome failures on browser_ext_popup_background.js. CLOSED TREE
Backed out changeset 9683f24ff8ec (bug 1193394)
Backed out changeset 0e7140a7c841 (bug 1193394)
Backed out changeset a0e26f6b2784 (bug 1193394)
Backed out changeset 29e1fceaf48d (bug 1193394)
Backed out changeset b8632bbbd273 (bug 1193394)
Backed out changeset a54ef2d8f896 (bug 1193394)
Backed out changeset 55c94c05c57f (bug 1193394)
2018-03-01 16:29:02 +02:00