Commit Graph

230 Commits

Author SHA1 Message Date
Eric Rahm
daeb56f35b Bug 1606187 - Part 2b: Update users of nsClassHashtable to handle UniquePtr differences r=KrisWright,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D59042
2020-01-13 19:18:56 +00:00
Manish Giri
5b23e2dc5f Bug 1605662 - Remove redundant return in void function. r=sylvestre
Depends on D58225

Differential Revision: https://phabricator.services.mozilla.com/D58227
2019-12-26 08:42:00 +00:00
Edgar Chen
c33011e0e0 Bug 1595050 - Update spec comment in CustomElementRegistry::Define to reflect the latest spec; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D52348
2019-11-08 13:18:53 +00:00
John Dai
d1587a1387 Bug 1552313 - Implement element.attachInternals; r=smaug,edgar
ElementInternals class is empty-for-now.

Differential Revision: https://phabricator.services.mozilla.com/D52158
2019-11-12 11:27:55 +00:00
John Dai
43393674ad Bug 1552313 - Implement disableShadow; r=smaug,edgar
Differential Revision: https://phabricator.services.mozilla.com/D52157
2019-11-12 11:27:52 +00:00
John Dai
5e7076a4cb Bug 1552313 - Implement custom element disabledFeatures and disableInternals; r=smaug,edgar
- Introduce `dom.webcomponents.elementInternals.enabled` for custom element's elementInternals.
- Implement disabledFeatures static field and disableInternals.
- Refactor get observedAttributes sequence.

Differential Revision: https://phabricator.services.mozilla.com/D52156
2019-11-12 11:27:45 +00:00
Dorel Luca
d437fccc6c Backed out 3 changesets (bug 1552313) for WPT failures in custom-elements/CustomElementRegistry.html. CLOSED TREE
Backed out changeset 27a01989152a (bug 1552313)
Backed out changeset 5f8c6c9f2d36 (bug 1552313)
Backed out changeset f26d61e06a9d (bug 1552313)
2019-11-11 20:55:58 +02:00
John Dai
6636687f8f Bug 1552313 - Implement element.attachInternals; r=smaug,edgar
ElementInternals class is empty-for-now.

Differential Revision: https://phabricator.services.mozilla.com/D52158
2019-11-11 15:43:03 +00:00
John Dai
c503c5951d Bug 1552313 - Implement disableShadow; r=smaug,edgar
Differential Revision: https://phabricator.services.mozilla.com/D52157
2019-11-11 15:42:58 +00:00
John Dai
19a9bbebae Bug 1552313 - Implement custom element disabledFeatures and disableInternals; r=smaug,edgar
- Introduce `dom.webcomponents.elementInternals.enabled` for custom element's elementInternals.
- Implement disabledFeatures static field and disableInternals.
- Refactor get observedAttributes sequence.

Differential Revision: https://phabricator.services.mozilla.com/D52156
2019-11-11 15:42:56 +00:00
Boris Zbarsky
17361b9160 Bug 1581276. Require a message arg to ThrowDOMException. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D46250
2019-09-20 02:17:01 +00:00
John Dai
19013aa032 Bug 1560744 - Part 2: Add clearer error message for duplicate custom element name;
Differential Revision: https://phabricator.services.mozilla.com//D38206
2019-07-16 19:35:12 +03:00
John Dai
f94311de5c Bug 1560744 - Add clearer message for custom elements; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D38082
2019-07-16 10:03:10 +00:00
Karl Tomlinson
a90482161c Bug 1542932 Remove CustomElementConstructor copy r=bzbarsky
Depends on D26868

Differential Revision: https://phabricator.services.mozilla.com/D26869
2019-04-10 15:45:57 +00:00
Karl Tomlinson
35e052a9f7 Bug 1542932 Change define() parameter functionConstructor from Function to CustomElementConstructor r=bzbarsky
Depends on D26867

Differential Revision: https://phabricator.services.mozilla.com/D26868
2019-04-10 15:45:11 +00:00
Karl Tomlinson
22086f161f bug 1542932 Generate CustomElementConstructor from WebIDL callback definition r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D26867
2019-04-11 23:05:10 +00:00
Karl Tomlinson
12082dcf8b Bug 1542932 align CustomElementConstructor::Construct() parameters with WebIDL bindings conventions r=bzbarsky
Depends on D26865

Differential Revision: https://phabricator.services.mozilla.com/D26866
2019-04-10 15:25:15 +00:00
Karl Tomlinson
303bbb123b bug 1542934 Annotate that CustomElementConstructor::Construct() callers can run script r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D26635
2019-04-10 12:51:15 +00:00
Karl Tomlinson
eec64f3c0a Bug 1542934 Mark strong reference members as const to aid CanRunScriptChecker r=smaug
Depends on D26633

Differential Revision: https://phabricator.services.mozilla.com/D26634
2019-04-09 13:37:23 +00:00
Karl Tomlinson
8b65d3471c Bug 1542934 strong ref arguments for functions that may run CustomElementConstructor::Construct() r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D26633
2019-04-10 06:29:56 +00:00
Jeff Walden
f4f68cd7ec Bug 1537536 - Move JS::ForOfIterator to its own header. r=arai,bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D24257
2019-03-26 17:10:44 +00:00
Ryan Hunt
ad7b7dbb30 Bug 1523969 part 6 - Move method definition inline comments to new line in 'dom/'. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D21106
2019-02-25 16:05:29 -06:00
Boris Zbarsky
bd8c7a033a Bug 1521907 part 4. Start using CheckedUnwrapStatic/Dynamic in non-binding DOM code. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D17884
2019-02-02 03:24:22 +00:00
Gurzau Raul
bdea746b45 Backed out 7 changesets (bug 1521907) for failing at unit/test_bug1151385.js on a CLOSED TREE.
Backed out changeset ef04359ccf0d (bug 1521907)
Backed out changeset ac1c61bf61e9 (bug 1521907)
Backed out changeset df09b7be63c5 (bug 1521907)
Backed out changeset 585fa0024d46 (bug 1521907)
Backed out changeset e593c29aaff4 (bug 1521907)
Backed out changeset ac2e180a35b6 (bug 1521907)
Backed out changeset 270b1db9ea81 (bug 1521907)
2019-02-02 00:58:16 +02:00
Boris Zbarsky
ce5ef7c6dd Bug 1521907 part 4. Start using CheckedUnwrapStatic/Dynamic in non-binding DOM code. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D17884
2019-02-01 18:48:36 +00:00
Ciure Andrei
a92a3ebc0a Backed out 7 changesets (bug 1521907) for JSObject Wrapper.cpp bustages and failures CLOSED TREE
Backed out changeset ce3108090e77 (bug 1521907)
Backed out changeset efd05f4979f1 (bug 1521907)
Backed out changeset 2d0895148907 (bug 1521907)
Backed out changeset 192152fe986a (bug 1521907)
Backed out changeset ca65b46b0d37 (bug 1521907)
Backed out changeset b3daf5ca3d11 (bug 1521907)
Backed out changeset 1b0a09a46c70 (bug 1521907)
2019-02-01 19:38:25 +02:00
Boris Zbarsky
eefa4f1803 Bug 1521907 part 4. Start using CheckedUnwrapStatic/Dynamic in non-binding DOM code. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D17884
2019-01-31 15:51:52 +00:00
Boris Zbarsky
eba2039f3e Bug 1519193 part 3. Convert CustomElementRegistry::Upgrade to using ShadowIncludingTreeIterator. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D16244
2019-01-12 03:19:27 +00:00
Boris Zbarsky
76096a6840 Bug 1519193 part 2. Convert CandidateFinder::Traverse to using ShadowIncludingTreeIterator. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D16243
2019-01-12 03:18:38 +00:00
Noemi Erli
034297a992 Backed out 5 changesets (bug 1519193) for build bustages in Document.cpp CLOSED TREE
Backed out changeset e118466df64d (bug 1519193)
Backed out changeset 12d89a7fe296 (bug 1519193)
Backed out changeset 08b0f2b9a96a (bug 1519193)
Backed out changeset 1caa462e7f08 (bug 1519193)
Backed out changeset aae6e06aa88b (bug 1519193)
2019-01-12 00:29:37 +02:00
Boris Zbarsky
ef6e8e503e Bug 1519193 part 3. Convert CustomElementRegistry::Upgrade to using ShadowIncludingTreeIterator. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D16244
2019-01-10 22:23:33 +00:00
Boris Zbarsky
579bad774e Bug 1519193 part 2. Convert CandidateFinder::Traverse to using ShadowIncludingTreeIterator. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D16243
2019-01-10 22:21:24 +00:00
Emilio Cobos Álvarez
dc336a73ba Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
2019-01-03 17:48:33 +01:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Nika Layzell
55c56f7a85 Bug 1477432 - Part 11: Update CustomElementRegistry to not use nsIJSID, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D9733
2018-11-16 17:27:48 -05:00
Timothy Guan-tin Chien
fb30ec3de3 Bug 1503019 - Part II, Remove dom.webcomponents.customelements.enabled pref r=smaug
This patch removes the following functions:

* nsContentUtils::IsCustomElementsEnabled()
* CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject)
* CustomElementRegistry::IsCustomElementEnabled(nsIDocument* aDoc)

and all references of the pref.

Depends on D11183

Differential Revision: https://phabricator.services.mozilla.com/D11249
2018-11-15 06:52:01 +00:00
Andreea Pavel
f667cd7449 Backed out 2 changesets (bug 1503019) for failing crashtests at dom/base/crashtests/1505811.html on a CLOSED TREE
Backed out changeset 06b12fd41ff1 (bug 1503019)
Backed out changeset 7b845eac9dd7 (bug 1503019)
2018-11-15 01:52:30 +02:00
Timothy Guan-tin Chien
3e86e5f53e Bug 1503019 - Part II, Remove dom.webcomponents.customelements.enabled pref r=smaug
This patch removes the following functions:

* nsContentUtils::IsCustomElementsEnabled()
* CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject)
* CustomElementRegistry::IsCustomElementEnabled(nsIDocument* aDoc)

and all references of the pref.

Depends on D11183

Differential Revision: https://phabricator.services.mozilla.com/D11249
2018-11-14 19:37:42 +00:00
Karl Tomlinson
8f7a12f5da Bug 1493073 Remove obsolete comment about webidl callback parameter being nulled before use r=kmag
CustomElementRegistryBinding uses RootedCallback and so the constructor cannot
be nulled.

The comment was added to warn about an unrooted callback argument
from nsDocument::RegisterElement(), a caller that no longer exists.

https://bugzilla.mozilla.org/show_bug.cgi?id=1369533#c25
https://hg.mozilla.org/mozilla-central/rev/16d0cd656b05#l6.298

Differential Revision: https://phabricator.services.mozilla.com/D6465
2018-10-30 19:41:18 +00:00
Boris Zbarsky
41e6ce9908 Bug 1496673. Fix crash in custom element data memory reporting code. r=jdai
While iterating the list in CustomElementReactionsStack::InvokeReactions we can
have null pointers in mReactionQueue for reactions that have already been
invoked.

Differential Revision: https://phabricator.services.mozilla.com/D7923
2018-10-05 21:27:14 +00:00
Karl Tomlinson
39096bba51 Bug 1493362 Remove obsolete "all wrappers are constructable if they are callable" comment r=edgar
The comment is no longer accurate since
https://hg.mozilla.org/mozilla-central/rev/26b1ee21f365#l2.20

I've left the same behavior because checking that the caller has permission to
access the unwrapped constructor still seems sensible.

The JS::IsConstructor() check could be performed on |constructor| but I
guess it is a touch more efficient on constructorUnwrapped.

Differential Revision: https://phabricator.services.mozilla.com/D6564
2018-09-24 07:56:13 +00:00
Emilio Cobos Álvarez
850464117c Bug 1484285 - Avoid loading XBL bindings for stuff that is very likely to be a custom-element. r=smaug
This should be more generic than hardcoding the tags, and be enough for our
chrome to avoid regressions as they migrate more stuff to CE, avoiding calling
into the GetComputedStyle machinery..

Differential Revision: https://phabricator.services.mozilla.com/D6537
2018-09-21 21:29:25 +00:00
Steve Fink
51b13c2f1f Bug 1487167 - Various DOM rooting issues. r=bz 2018-08-28 21:26:50 -07:00
Neil Deakin
6054f3d911 Bug 1478372, allow QueryInterface to be used for custom element implemented interfaces, r=bz,bgrins 2018-09-19 06:46:41 -04:00
Boris Zbarsky
e2d8437e78 Bug 1486480. Add memory reporting for custom element data. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D4350
2018-08-27 19:20:53 +00:00
Dave Townsend
e416deef2e 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
2018-08-15 10:31:16 +00:00
Kris Maglione
571bb15009 Bug 1480244: Part 0 - Fix unified build bustage. r=me 2018-08-11 15:26:49 -07:00
Nicholas Nethercote
439d31614d 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
6e17affde6 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
69882e67b0 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