Print a note to the web console when a web site is using shadow DOM (v1), preffed off by default

RESOLVED FIXED in Firefox 62

Status

()

enhancement
P2
normal
RESOLVED FIXED
Last year
3 months ago

People

(Reporter: smaug, Assigned: smaug)

Tracking

unspecified
mozilla62
Points:
---

Firefox Tracking Flags

(firefox62 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

Last year
Just to ease finding whether a web site is actually using Shadow DOM.


(or need to ask devtools if they have some magic for this already)
Assignee

Comment 1

Last year
To help to detect pages using shadow DOM, let's add this console message for now.
Disabled by default but can be enabled using
dom.webcomponents.shadowdom.report_usage = true

Perhaps you emilio could review this.

I explicitly wanted to have dom_webcomponents_shadowdom_report_usage() call in Element to avoid extra OwnerDoc() access when the pref isn't set.

remote: 
remote: Follow the progress of your build on Treeherder:
remote:   https://treeherder.mozilla.org/#/jobs?repo=try&revision=4ab772bded08d62a9535447259709be6e52fc94f
remote: recorded changegroup in replication log in 0.072s
Attachment #8975632 - Flags: review?(emilio)
Comment on attachment 8975632 [details] [diff] [review]
shadow_report_usage.diff

Review of attachment 8975632 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks. I guess it's not really worth it to add a test for this. r=me as long as you've tested it manually.

::: dom/base/nsDocument.cpp
@@ +13242,5 @@
> +
> +  nsIDocument* topLevel = GetTopLevelContentDocument();
> +  if (topLevel && !topLevel->mHasReportedShadowDOMUsage) {
> +    topLevel->mHasReportedShadowDOMUsage = true;
> +    nsString uri;

nit: Maybe nsAutoString?
Attachment #8975632 - Flags: review?(emilio) → review+
Assignee

Comment 3

Last year
GetDocumentURI explicitly takes nsString, not nsAString, so I used nsString.

Comment 4

Last year
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/887c21926833
Print a note to the web console when a web site is using shadow DOM (v1), preffed off by default, r=emilio
Priority: -- → P2

Comment 5

Last year
bugherder
https://hg.mozilla.org/mozilla-central/rev/887c21926833
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.