If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Implement adopted callback for custom elements

RESOLVED FIXED in Firefox 58

Status

()

Core
DOM
P3
normal
RESOLVED FIXED
3 years ago
15 days ago

People

(Reporter: krizsa, Assigned: jdai)

Tracking

(Blocks: 2 bugs)

unspecified
mozilla58
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox58 fixed)

Details

(Whiteboard: dom-ce-m3)

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

3 years ago
The spec does not mention this callback yet, but there were numerous talks where everybody agreed that we need this callback.
(Reporter)

Comment 1

3 years ago
Do you think this callback could end up in the spec soonish? Is there any disagreement about it? Do we know exactly when it should be called? (I'm just trying to decide when would it make sense to start working on this)
Assignee: nobody → gkrizsanits
Flags: needinfo?(annevk)

Comment 2

3 years ago
I think there's still disagreement about whether callbacks should have symbols as names or not. If not, I would expect "adoptedCallback" that is passed the old and new document.
Flags: needinfo?(annevk)
Mark this bug as a duplicate of bug 1293921 since we plan to implement all lifecycle callback in bug 1293921.
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1293921

Comment 4

9 months ago
On a second thought, we decide splitting bug 1293921 into smaller pieces, so re-open this bug for implementing adoptedCallback.
Blocks: 889230, 1293921
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---

Updated

9 months ago
Priority: -- → P3
Whiteboard: dom-ce-m3
(Assignee)

Updated

a month ago
Assignee: gkrizsanits → jdai
(Assignee)

Comment 5

a month ago
Created attachment 8905947 [details] [diff] [review]
patch, v1

Follow the spec[1] implements adopted callback for custom elements. I only tested on my local, hence, could you give me some feedback about this patch? Thank you.

[1] https://dom.spec.whatwg.org/#concept-node-adopt
Flags: needinfo?(bugs)
Comment on attachment 8905947 [details] [diff] [review]
patch, v1


>+++ b/dom/base/CustomElementRegistry.h
>@@ -35,41 +35,55 @@ class Promise;
> struct LifecycleCallbackArgs
> {
>   nsString name;
>   nsString oldValue;
>   nsString newValue;
>   nsString namespaceURI;
> };
> 
>+struct LifecycleAdoptedCallbackArgs
>+{
>+  nsIDocument* oldDocument;
>+  nsIDocument* newDocument;
>+};
I think these both should be nsCOMPtr<nsIDocument>. And normal coding style would be to
call them mOldDocument and mNewDocument, but I see the previous struct doesn't use that either, so naming is up to you.
Flags: needinfo?(bugs)
Attachment #8905947 - Flags: review+
(Assignee)

Comment 7

15 days ago
Created attachment 8914212 [details] [diff] [review]
patch, v2

Rebase and carry r+.

Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=efa3e65f823ca2adce00b974fa25b6d8889aa34c&filter-tier=1&group_state=expanded
Attachment #8905947 - Attachment is obsolete: true
Attachment #8914212 - Flags: review+
(Assignee)

Updated

15 days ago
Keywords: checkin-needed

Comment 8

15 days ago
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0ad5ea4a3f1c
Implement adopted callback for custom elements. r=smaug
Keywords: checkin-needed

Comment 9

15 days ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/0ad5ea4a3f1c
Status: REOPENED → RESOLVED
Last Resolved: a year ago15 days ago
status-firefox58: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.