зеркало из https://github.com/mozilla/gecko-dev.git
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 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2b5881e46b
Коммит
af2973ef61
|
@ -10,7 +10,6 @@ const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html";
|
|||
|
||||
add_task(async function() {
|
||||
await pushPref("devtools.inspector.showAllAnonymousContent", true);
|
||||
await pushPref("dom.webcomponents.customelements.enabled", true);
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
|
|
|
@ -200,13 +200,11 @@ for (const {url, tree, title} of TEST_DATA) {
|
|||
// Test each configuration in both open and closed modes
|
||||
add_task(async function() {
|
||||
info(`Testing: [${title}] in OPEN mode`);
|
||||
await enableWebComponents();
|
||||
const {inspector} = await openInspectorForURL(url.replace("#MODE#", "open"));
|
||||
await assertMarkupViewAsTree(tree, "test-component", inspector);
|
||||
});
|
||||
add_task(async function() {
|
||||
info(`Testing: [${title}] in CLOSED mode`);
|
||||
await enableWebComponents();
|
||||
const {inspector} = await openInspectorForURL(url.replace("#MODE#", "closed"));
|
||||
await assertMarkupViewAsTree(tree, "test-component", inspector);
|
||||
});
|
||||
|
|
|
@ -41,8 +41,6 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
async function testRevealLink(revealFnFirst, revealFnSecond) {
|
||||
await enableWebComponents();
|
||||
|
||||
const { inspector } = await openInspectorForURL(TEST_URL);
|
||||
const { markup } = inspector;
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
const {markup} = inspector;
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
const {markup} = inspector;
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
// <test-component> is a shadow host.
|
||||
|
|
|
@ -60,8 +60,6 @@ const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
|
|||
</script>`);
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
const tree = `
|
||||
|
|
|
@ -36,8 +36,6 @@ const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
|
|||
</script>`);
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const { inspector, toolbox, testActor } = await openInspectorForURL(TEST_URL);
|
||||
|
||||
info("Waiting for element picker to become active.");
|
||||
|
|
|
@ -27,7 +27,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
await pushPref("devtools.markup.pagesize", 5);
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
|
|
@ -28,8 +28,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
const tree = `
|
||||
|
|
|
@ -45,8 +45,6 @@ const TEST_DATA = [
|
|||
];
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("dom.webcomponents.customelements.enabled", true);
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
info("Making sure the markup-view frame is focused");
|
||||
|
|
|
@ -46,8 +46,6 @@ const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
|
|||
</script>`);
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const { inspector, toolbox, tab, testActor } = await openInspectorForURL(TEST_URL);
|
||||
|
||||
info("Waiting for element picker to become active");
|
||||
|
|
|
@ -47,8 +47,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
// We expect that host children are correctly displayed when no slots are defined.
|
||||
|
|
|
@ -48,8 +48,6 @@ const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
|
|||
</script>`);
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector, toolbox} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
// Test with an element to which we attach a shadow.
|
||||
|
|
|
@ -29,8 +29,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const { inspector } = await openInspectorForURL(TEST_URL);
|
||||
const {markup} = inspector;
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const { inspector } = await openInspectorForURL(TEST_URL);
|
||||
const { markup } = inspector;
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const { inspector } = await openInspectorForURL(TEST_URL);
|
||||
const { markup } = inspector;
|
||||
const win = inspector.markup.doc.defaultView;
|
||||
|
|
|
@ -27,8 +27,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
|
||||
const tree = `
|
||||
|
|
|
@ -27,8 +27,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await enableWebComponents();
|
||||
|
||||
await addTab(TEST_URI);
|
||||
|
||||
const {inspector, view} = await openRuleView();
|
||||
|
|
|
@ -36,8 +36,6 @@ const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
|
|||
`);
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("dom.webcomponents.customelements.enabled", true);
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
const {markup} = inspector;
|
||||
const ruleview = inspector.getPanel("ruleview").view;
|
||||
|
|
|
@ -23,8 +23,6 @@ const TEST_URL = `data:text/html;charset=utf-8,
|
|||
</script>`;
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("dom.webcomponents.customelements.enabled", true);
|
||||
|
||||
const {inspector} = await openInspectorForURL(TEST_URL);
|
||||
const {markup} = inspector;
|
||||
const breadcrumbs = inspector.panelDoc.getElementById("inspector-breadcrumbs");
|
||||
|
|
|
@ -720,13 +720,6 @@ async function injectEventUtilsInContentTask(browser) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily flip all the preferences needed to enable web components.
|
||||
*/
|
||||
async function enableWebComponents() {
|
||||
await pushPref("dom.webcomponents.customelements.enabled", true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register an actor in the content process of the current tab.
|
||||
*
|
||||
|
|
|
@ -7,8 +7,6 @@ const TEST_URI =
|
|||
"data:text/html;charset=utf-8,Test syntax highlighted output";
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("dom.webcomponents.customelements.enabled", true);
|
||||
|
||||
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
|
||||
await performTests();
|
||||
|
||||
|
|
|
@ -353,32 +353,6 @@ CustomElementRegistry::~CustomElementRegistry()
|
|||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
|
||||
bool
|
||||
CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject)
|
||||
{
|
||||
if (nsContentUtils::IsCustomElementsEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!XRE_IsParentProcess()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIPrincipal* principal =
|
||||
nsContentUtils::ObjectPrincipal(js::UncheckedUnwrap(aObject));
|
||||
return nsContentUtils::AllowXULXBLForPrincipal(principal);
|
||||
}
|
||||
|
||||
bool
|
||||
CustomElementRegistry::IsCustomElementEnabled(nsIDocument* aDoc)
|
||||
{
|
||||
if (nsContentUtils::IsCustomElementsEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return XRE_IsParentProcess() && aDoc->AllowXULXBL();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CustomElementRegistry::RunCustomElementCreationCallback::Run()
|
||||
{
|
||||
|
|
|
@ -392,9 +392,6 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CustomElementRegistry)
|
||||
|
||||
public:
|
||||
static bool IsCustomElementEnabled(JSContext* aCx, JSObject* aObject);
|
||||
static bool IsCustomElementEnabled(nsIDocument* aDoc);
|
||||
|
||||
explicit CustomElementRegistry(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
private:
|
||||
|
|
|
@ -1778,7 +1778,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
SetSubtreeRootPointer(aParent->SubtreeRoot());
|
||||
}
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(OwnerDoc()) && IsInComposedDoc()) {
|
||||
if (IsInComposedDoc()) {
|
||||
// Connected callback must be enqueued whenever a custom element becomes
|
||||
// connected.
|
||||
CustomElementData* data = GetCustomElementData();
|
||||
|
@ -2105,17 +2105,15 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
|
||||
// Disconnected must be enqueued whenever a connected custom element becomes
|
||||
// disconnected.
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(OwnerDoc())) {
|
||||
CustomElementData* data = GetCustomElementData();
|
||||
if (data) {
|
||||
if (data->mState == CustomElementData::State::eCustom) {
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected,
|
||||
this);
|
||||
} else {
|
||||
// Remove an unresolved custom element that is a candidate for upgrade
|
||||
// when a custom element is disconnected.
|
||||
nsContentUtils::UnregisterUnresolvedElement(this);
|
||||
}
|
||||
CustomElementData* data = GetCustomElementData();
|
||||
if (data) {
|
||||
if (data->mState == CustomElementData::State::eCustom) {
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected,
|
||||
this);
|
||||
} else {
|
||||
// Remove an unresolved custom element that is a candidate for upgrade
|
||||
// when a custom element is disconnected.
|
||||
nsContentUtils::UnregisterUnresolvedElement(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2759,34 +2757,32 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
|||
}
|
||||
}
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(OwnerDoc())) {
|
||||
CustomElementDefinition* definition = GetCustomElementDefinition();
|
||||
// Only custom element which is in `custom` state could get the
|
||||
// CustomElementDefinition.
|
||||
if (definition && definition->IsInObservedAttributeList(aName)) {
|
||||
RefPtr<nsAtom> oldValueAtom;
|
||||
if (oldValue) {
|
||||
oldValueAtom = oldValue->GetAsAtom();
|
||||
} else {
|
||||
// If there is no old value, get the value of the uninitialized
|
||||
// attribute that was swapped with aParsedValue.
|
||||
oldValueAtom = aParsedValue.GetAsAtom();
|
||||
}
|
||||
RefPtr<nsAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
|
||||
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
aModType == MutationEvent_Binding::ADDITION ?
|
||||
VoidString() : nsDependentAtomString(oldValueAtom),
|
||||
nsDependentAtomString(newValueAtom),
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
CustomElementDefinition* definition = GetCustomElementDefinition();
|
||||
// Only custom element which is in `custom` state could get the
|
||||
// CustomElementDefinition.
|
||||
if (definition && definition->IsInObservedAttributeList(aName)) {
|
||||
RefPtr<nsAtom> oldValueAtom;
|
||||
if (oldValue) {
|
||||
oldValueAtom = oldValue->GetAsAtom();
|
||||
} else {
|
||||
// If there is no old value, get the value of the uninitialized
|
||||
// attribute that was swapped with aParsedValue.
|
||||
oldValueAtom = aParsedValue.GetAsAtom();
|
||||
}
|
||||
RefPtr<nsAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
|
||||
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
aModType == MutationEvent_Binding::ADDITION ?
|
||||
VoidString() : nsDependentAtomString(oldValueAtom),
|
||||
nsDependentAtomString(newValueAtom),
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
|
||||
if (aCallAfterSetAttr) {
|
||||
|
@ -2933,25 +2929,23 @@ Element::OnAttrSetButNotChanged(int32_t aNamespaceID, nsAtom* aName,
|
|||
const nsAttrValueOrString& aValue,
|
||||
bool aNotify)
|
||||
{
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(OwnerDoc())) {
|
||||
// Only custom element which is in `custom` state could get the
|
||||
// CustomElementDefinition.
|
||||
CustomElementDefinition* definition = GetCustomElementDefinition();
|
||||
if (definition && definition->IsInObservedAttributeList(aName)) {
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
|
||||
// Only custom element which is in `custom` state could get the
|
||||
// CustomElementDefinition.
|
||||
CustomElementDefinition* definition = GetCustomElementDefinition();
|
||||
if (definition && definition->IsInObservedAttributeList(aName)) {
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
|
||||
|
||||
nsAutoString value(aValue.String());
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
value,
|
||||
value,
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
nsAutoString value(aValue.String());
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
value,
|
||||
value,
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3066,25 +3060,23 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(OwnerDoc())) {
|
||||
CustomElementDefinition* definition = GetCustomElementDefinition();
|
||||
// Only custom element which is in `custom` state could get the
|
||||
// CustomElementDefinition.
|
||||
if (definition && definition->IsInObservedAttributeList(aName)) {
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
||||
CustomElementDefinition* definition = GetCustomElementDefinition();
|
||||
// Only custom element which is in `custom` state could get the
|
||||
// CustomElementDefinition.
|
||||
if (definition && definition->IsInObservedAttributeList(aName)) {
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
||||
|
||||
RefPtr<nsAtom> oldValueAtom = oldValue.GetAsAtom();
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
nsDependentAtomString(oldValueAtom),
|
||||
VoidString(),
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
RefPtr<nsAtom> oldValueAtom = oldValue.GetAsAtom();
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
nsDependentAtomString(oldValueAtom),
|
||||
VoidString(),
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
|
||||
rv = AfterSetAttr(aNameSpaceID, aName, nullptr, &oldValue, nullptr, aNotify);
|
||||
|
|
|
@ -208,7 +208,7 @@ load 1324500.html
|
|||
pref(dom.IntersectionObserver.enabled,true) load 1326194-1.html
|
||||
pref(dom.IntersectionObserver.enabled,true) load 1326194-2.html
|
||||
pref(dom.IntersectionObserver.enabled,true) load 1332939.html
|
||||
pref(dom.webcomponents.customelements.enabled,true) load 1341693.html
|
||||
load 1341693.html
|
||||
load 1352453.html
|
||||
pref(dom.IntersectionObserver.enabled,true) load 1353529.xul
|
||||
load 1368327.html
|
||||
|
@ -232,17 +232,17 @@ load 1403377.html
|
|||
load 1405771.html
|
||||
load 1406109-1.html
|
||||
load 1324463.html
|
||||
pref(dom.webcomponents.customelements.enabled,true) load 1413815.html
|
||||
load 1413815.html
|
||||
load 1411473.html
|
||||
load 1419799.html
|
||||
skip-if(!browserIsRemote) pref(dom.webcomponents.customelements.enabled,true) pref(dom.disable_open_during_load,false) load 1419902.html # skip on non e10s loads, Bug 1419902
|
||||
skip-if(!browserIsRemote) pref(dom.disable_open_during_load,false) load 1419902.html # skip on non e10s loads, Bug 1419902
|
||||
load 1422883.html
|
||||
load 1428053.html
|
||||
pref(dom.webcomponents.customelements.enabled,true) load 1441029.html
|
||||
load 1441029.html
|
||||
load 1449601.html
|
||||
load 1445670.html
|
||||
load 1458016.html
|
||||
load 1459688.html
|
||||
load 1460794.html
|
||||
load 1505875.html
|
||||
pref(dom.webcomponents.customelements.enabled,true) load 1505811.html
|
||||
load 1505811.html
|
||||
|
|
|
@ -303,7 +303,6 @@ bool nsContentUtils::sIsResourceTimingEnabled = false;
|
|||
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
|
||||
bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
|
||||
bool nsContentUtils::sIsUAWidgetEnabled = false;
|
||||
bool nsContentUtils::sIsCustomElementsEnabled = false;
|
||||
bool nsContentUtils::sSendPerformanceTimingNotifications = false;
|
||||
bool nsContentUtils::sUseActivityCursor = false;
|
||||
bool nsContentUtils::sAnimationsAPICoreEnabled = false;
|
||||
|
@ -673,9 +672,6 @@ nsContentUtils::Init()
|
|||
Preferences::AddBoolVarCache(&sIsUAWidgetEnabled,
|
||||
"dom.ua_widget.enabled", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
|
||||
"dom.webcomponents.customelements.enabled", false);
|
||||
|
||||
Preferences::AddIntVarCache(&sPrivacyMaxInnerWidth,
|
||||
"privacy.window.maxInnerWidth",
|
||||
1000);
|
||||
|
@ -10065,14 +10061,12 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a
|
|||
|
||||
MOZ_ASSERT_IF(aDefinition, isCustomElement);
|
||||
|
||||
bool customElementEnabled = CustomElementRegistry::IsCustomElementEnabled(nodeInfo->GetDocument());
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-create-element
|
||||
// We only handle the "synchronous custom elements flag is set" now.
|
||||
// For the unset case (e.g. cloning a node), see bug 1319342 for that.
|
||||
// Step 4.
|
||||
CustomElementDefinition* definition = aDefinition;
|
||||
if (customElementEnabled && isCustomElement && !definition) {
|
||||
if (isCustomElement && !definition) {
|
||||
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
|
||||
definition =
|
||||
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
|
||||
|
@ -10193,7 +10187,7 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (customElementEnabled && isCustomElement) {
|
||||
if (isCustomElement) {
|
||||
(*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
|
||||
nsContentUtils::RegisterCallbackUpgradeElement(*aResult, typeAtom);
|
||||
}
|
||||
|
|
|
@ -3286,9 +3286,6 @@ public:
|
|||
static bool
|
||||
IsLocalRefURL(const nsString& aString);
|
||||
|
||||
static bool
|
||||
IsCustomElementsEnabled() { return sIsCustomElementsEnabled; }
|
||||
|
||||
/**
|
||||
* Compose a tab id with process id and a serial number.
|
||||
*/
|
||||
|
|
|
@ -5743,8 +5743,7 @@ nsIDocument::CreateElement(const nsAString& aTagName,
|
|||
const ElementCreationOptions& options =
|
||||
aOptions.GetAsElementCreationOptions();
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(this) &&
|
||||
options.mIs.WasPassed()) {
|
||||
if (options.mIs.WasPassed()) {
|
||||
is = &options.mIs.Value();
|
||||
}
|
||||
|
||||
|
@ -5788,8 +5787,7 @@ nsIDocument::CreateElementNS(const nsAString& aNamespaceURI,
|
|||
}
|
||||
|
||||
const nsString* is = nullptr;
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(this) &&
|
||||
aOptions.IsElementCreationOptions()) {
|
||||
if (aOptions.IsElementCreationOptions()) {
|
||||
const ElementCreationOptions& options = aOptions.GetAsElementCreationOptions();
|
||||
if (options.mIs.WasPassed()) {
|
||||
is = &options.mIs.Value();
|
||||
|
@ -5817,8 +5815,7 @@ nsIDocument::CreateXULElement(const nsAString& aTagName,
|
|||
}
|
||||
|
||||
const nsString* is = nullptr;
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(this) &&
|
||||
aOptions.IsElementCreationOptions()) {
|
||||
if (aOptions.IsElementCreationOptions()) {
|
||||
const ElementCreationOptions& options = aOptions.GetAsElementCreationOptions();
|
||||
if (options.mIs.WasPassed()) {
|
||||
is = &options.mIs.Value();
|
||||
|
|
|
@ -435,8 +435,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(nodeInfo->GetDocument()) &&
|
||||
(clone->IsHTMLElement() || clone->IsXULElement())) {
|
||||
if (clone->IsHTMLElement() || clone->IsXULElement()) {
|
||||
// The cloned node may be a custom element that may require
|
||||
// enqueing upgrade reaction.
|
||||
Element* cloneElem = clone->AsElement();
|
||||
|
@ -490,7 +489,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|||
|
||||
nsIDocument* newDoc = aNode->OwnerDoc();
|
||||
if (newDoc) {
|
||||
if (elem && CustomElementRegistry::IsCustomElementEnabled(newDoc)) {
|
||||
if (elem) {
|
||||
// Adopted callback must be enqueued whenever a node’s
|
||||
// shadow-including inclusive descendants that is custom.
|
||||
CustomElementData* data = elem->GetCustomElementData();
|
||||
|
|
|
@ -7803,17 +7803,14 @@ class CGPerSignatureCall(CGThing):
|
|||
|
||||
if (idlNode.getExtendedAttribute('CEReactions') is not None and
|
||||
not getter):
|
||||
cgThings.append(CGGeneric(fill(
|
||||
cgThings.append(CGGeneric(dedent(
|
||||
"""
|
||||
Maybe<AutoCEReaction> ceReaction;
|
||||
if (CustomElementRegistry::IsCustomElementEnabled(cx, ${obj})) {
|
||||
DocGroup* docGroup = self->GetDocGroup();
|
||||
if (docGroup) {
|
||||
ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
|
||||
}
|
||||
DocGroup* docGroup = self->GetDocGroup();
|
||||
if (docGroup) {
|
||||
ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
|
||||
}
|
||||
""",
|
||||
obj=objectName)))
|
||||
""")))
|
||||
|
||||
# If this is a method that was generated by a maplike/setlike
|
||||
# interface, use the maplike/setlike generator to fill in the body.
|
||||
|
|
|
@ -7,7 +7,11 @@ skip-if = os == 'android' # bug 1323645
|
|||
support-files =
|
||||
htmlconstructor_autonomous_tests.js
|
||||
htmlconstructor_builtin_tests.js
|
||||
[test_custom_element_namespace.html]
|
||||
[test_custom_element_namespace.xhtml]
|
||||
[test_custom_element_namespace.xul]
|
||||
[test_custom_element_upgrade_chrome.html]
|
||||
support-files =
|
||||
test_upgrade_page.html
|
||||
upgrade_tests.js
|
||||
[test_xul_custom_element.xul]
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
[DEFAULT]
|
||||
prefs =
|
||||
dom.webcomponents.customelements.enabled=false
|
||||
|
||||
[test_xul_custom_element.xul]
|
||||
[test_custom_element_namespace.html]
|
||||
[test_custom_element_namespace.xhtml]
|
||||
[test_custom_element_namespace.xul]
|
|
@ -36,19 +36,8 @@ function test() {
|
|||
is(e.getAttribute("is"), null);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
test();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
// test with webcomponents enabled
|
||||
test();
|
||||
|
||||
// test with webcomponents disabled
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ 'set': [["dom.webcomponents.customelements.enabled", false]]}, runTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -182,7 +182,6 @@ MOCHITEST_CHROME_MANIFESTS += [
|
|||
'mochitest/localstorage/chrome.ini',
|
||||
'mochitest/sessionstorage/chrome.ini',
|
||||
'mochitest/webcomponents/chrome.ini',
|
||||
'mochitest/webcomponents/chrome_disabled.ini',
|
||||
'mochitest/whatwg/chrome.ini',
|
||||
]
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/#dom-window-customelements
|
||||
[Func="CustomElementRegistry::IsCustomElementEnabled"]
|
||||
interface CustomElementRegistry {
|
||||
[CEReactions, Throws]
|
||||
void define(DOMString name, Function functionConstructor,
|
||||
|
|
|
@ -39,7 +39,6 @@ typedef OfflineResourceList ApplicationCache;
|
|||
[PutForwards=href, Unforgeable, BinaryName="getLocation",
|
||||
CrossOriginReadable, CrossOriginWritable] readonly attribute Location location;
|
||||
[Throws] readonly attribute History history;
|
||||
[Func="CustomElementRegistry::IsCustomElementEnabled"]
|
||||
readonly attribute CustomElementRegistry customElements;
|
||||
[Replaceable, Throws] readonly attribute BarProp locationbar;
|
||||
[Replaceable, Throws] readonly attribute BarProp menubar;
|
||||
|
|
|
@ -593,7 +593,7 @@ load 1039454-1.html
|
|||
load 1042489.html
|
||||
load 1054010-1.html
|
||||
load 1058954-1.html
|
||||
skip-if(verify&&isDebugBuild&&(gtkWidget||OSX)) pref(dom.webcomponents.customelements.enabled,true) load 1059138-1.html
|
||||
skip-if(verify&&isDebugBuild&&(gtkWidget||OSX)) load 1059138-1.html
|
||||
load 1134531.html
|
||||
load 1134667.html
|
||||
load 1137723-1.html
|
||||
|
|
|
@ -1425,8 +1425,6 @@ pref("dom.ua_widget.enabled", true);
|
|||
pref("dom.ua_widget.enabled", false);
|
||||
#endif
|
||||
|
||||
pref("dom.webcomponents.customelements.enabled", true);
|
||||
|
||||
pref("javascript.enabled", true);
|
||||
pref("javascript.options.strict", false);
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -384,30 +384,27 @@ nsHtml5TreeOperation::CreateHTMLElement(
|
|||
RefPtr<nsAtom> isAtom;
|
||||
dom::CustomElementDefinition* definition = nullptr;
|
||||
|
||||
// Avoid overhead by checking if custom elements pref is enabled or not.
|
||||
if (dom::CustomElementRegistry::IsCustomElementEnabled(document)) {
|
||||
if (aAttributes) {
|
||||
nsHtml5String is = aAttributes->getValue(nsHtml5AttributeName::ATTR_IS);
|
||||
if (is) {
|
||||
nsAutoString isValue;
|
||||
is.ToString(isValue);
|
||||
isAtom = NS_Atomize(isValue);
|
||||
}
|
||||
if (aAttributes) {
|
||||
nsHtml5String is = aAttributes->getValue(nsHtml5AttributeName::ATTR_IS);
|
||||
if (is) {
|
||||
nsAutoString isValue;
|
||||
is.ToString(isValue);
|
||||
isAtom = NS_Atomize(isValue);
|
||||
}
|
||||
}
|
||||
|
||||
isCustomElement = (aCreator == NS_NewCustomElement || isAtom);
|
||||
if (isCustomElement && aFromParser != dom::FROM_PARSER_FRAGMENT) {
|
||||
RefPtr<nsAtom> tagAtom = nodeInfo->NameAtom();
|
||||
RefPtr<nsAtom> typeAtom =
|
||||
(aCreator == NS_NewCustomElement) ? tagAtom : isAtom;
|
||||
isCustomElement = (aCreator == NS_NewCustomElement || isAtom);
|
||||
if (isCustomElement && aFromParser != dom::FROM_PARSER_FRAGMENT) {
|
||||
RefPtr<nsAtom> tagAtom = nodeInfo->NameAtom();
|
||||
RefPtr<nsAtom> typeAtom =
|
||||
(aCreator == NS_NewCustomElement) ? tagAtom : isAtom;
|
||||
|
||||
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
|
||||
definition = nsContentUtils::LookupCustomElementDefinition(
|
||||
document, nodeInfo->NameAtom(), nodeInfo->NamespaceID(), typeAtom);
|
||||
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
|
||||
definition = nsContentUtils::LookupCustomElementDefinition(
|
||||
document, nodeInfo->NameAtom(), nodeInfo->NamespaceID(), typeAtom);
|
||||
|
||||
if (definition) {
|
||||
willExecuteScript = true;
|
||||
}
|
||||
if (definition) {
|
||||
willExecuteScript = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ macro_rules! apply_non_ts_list {
|
|||
("visited", Visited, visited, IN_VISITED_STATE, _),
|
||||
("active", Active, active, IN_ACTIVE_STATE, _),
|
||||
("checked", Checked, checked, IN_CHECKED_STATE, _),
|
||||
("defined", Defined, defined, IN_DEFINED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
||||
("defined", Defined, defined, IN_DEFINED_STATE, _),
|
||||
("disabled", Disabled, disabled, IN_DISABLED_STATE, _),
|
||||
("enabled", Enabled, enabled, IN_ENABLED_STATE, _),
|
||||
("focus", Focus, focus, IN_FOCUS_STATE, _),
|
||||
|
|
|
@ -178,9 +178,6 @@ impl NonTSPseudoClass {
|
|||
NonTSPseudoClass::Fullscreen => unsafe {
|
||||
mozilla::StaticPrefs_sVarCache_full_screen_api_unprefix_enabled
|
||||
},
|
||||
NonTSPseudoClass::Defined => unsafe {
|
||||
structs::nsContentUtils_sIsCustomElementsEnabled
|
||||
},
|
||||
// Otherwise, a pseudo-class is enabled in content when it
|
||||
// doesn't have any enabled flag.
|
||||
_ => !self
|
||||
|
|
|
@ -120,7 +120,6 @@ user_pref("dom.successive_dialog_time_limit", 0);
|
|||
// use an additional pref here to allow automation to use the "normal" behavior.
|
||||
user_pref("dom.use_xbl_scopes_for_remote_xul", true);
|
||||
user_pref("dom.w3c_touch_events.enabled", 1);
|
||||
user_pref("dom.webcomponents.customelements.enabled", true);
|
||||
user_pref("extensions.autoDisableScopes", 0);
|
||||
user_pref("extensions.blocklist.detailsURL", "http://{server}/extensions-dummy/blocklistDetailsURL");
|
||||
user_pref("extensions.blocklist.itemURL", "http://{server}/extensions-dummy/blocklistItemURL");
|
||||
|
|
Загрузка…
Ссылка в новой задаче