mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Merge mozilla-central to autoland. a=merge on a CLOSED TREE
This commit is contained in:
commit
cca6606253
@ -688,10 +688,8 @@ CustomElementRegistry::Define(const nsAString& aName,
|
||||
* 2. If name is not a valid custom element name, then throw a "SyntaxError"
|
||||
* DOMException and abort these steps.
|
||||
*/
|
||||
nsIDocument* doc = mWindow->GetExtantDoc();
|
||||
uint32_t nameSpaceID = doc ? doc->GetDefaultNamespaceID() : kNameSpaceID_XHTML;
|
||||
RefPtr<nsAtom> nameAtom(NS_Atomize(aName));
|
||||
if (!nsContentUtils::IsCustomElementName(nameAtom, nameSpaceID)) {
|
||||
if (!nsContentUtils::IsCustomElementName(nameAtom)) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return;
|
||||
}
|
||||
@ -733,7 +731,7 @@ CustomElementRegistry::Define(const nsAString& aName,
|
||||
nsAutoString localName(aName);
|
||||
if (aOptions.mExtends.WasPassed()) {
|
||||
RefPtr<nsAtom> extendsAtom(NS_Atomize(aOptions.mExtends.Value()));
|
||||
if (nsContentUtils::IsCustomElementName(extendsAtom, nameSpaceID)) {
|
||||
if (nsContentUtils::IsCustomElementName(extendsAtom)) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
}
|
||||
@ -973,9 +971,7 @@ CustomElementRegistry::WhenDefined(const nsAString& aName, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
RefPtr<nsAtom> nameAtom(NS_Atomize(aName));
|
||||
nsIDocument* doc = mWindow->GetExtantDoc();
|
||||
uint32_t nameSpaceID = doc ? doc->GetDefaultNamespaceID() : kNameSpaceID_XHTML;
|
||||
if (!nsContentUtils::IsCustomElementName(nameAtom, nameSpaceID)) {
|
||||
if (!nsContentUtils::IsCustomElementName(nameAtom)) {
|
||||
promise->MaybeReject(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
@ -1196,7 +1196,7 @@ Element::AttachShadow(const ShadowRootInit& aInit, ErrorResult& aError)
|
||||
* then throw a "NotSupportedError" DOMException.
|
||||
*/
|
||||
nsAtom* nameAtom = NodeInfo()->NameAtom();
|
||||
if (!(nsContentUtils::IsCustomElementName(nameAtom, NodeInfo()->NamespaceID()) ||
|
||||
if (!(nsContentUtils::IsCustomElementName(nameAtom) ||
|
||||
nameAtom == nsGkAtoms::article ||
|
||||
nameAtom == nsGkAtoms::aside ||
|
||||
nameAtom == nsGkAtoms::blockquote ||
|
||||
@ -4304,7 +4304,7 @@ Element::SetCustomElementData(CustomElementData* aData)
|
||||
#if DEBUG
|
||||
nsAtom* name = NodeInfo()->NameAtom();
|
||||
nsAtom* type = aData->GetCustomElementType();
|
||||
if (nsContentUtils::IsCustomElementName(name, NodeInfo()->NamespaceID())) {
|
||||
if (nsContentUtils::IsCustomElementName(name)) {
|
||||
MOZ_ASSERT(type == name);
|
||||
} else {
|
||||
MOZ_ASSERT(type != name);
|
||||
|
@ -3194,13 +3194,8 @@ nsContentUtils::NewURIWithDocumentCharset(nsIURI** aResult,
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::IsCustomElementName(nsAtom* aName, uint32_t aNameSpaceID)
|
||||
nsContentUtils::IsCustomElementName(nsAtom* aName)
|
||||
{
|
||||
// Allow non-dashed names in XUL for XBL to Custom Element migrations.
|
||||
if (aNameSpaceID == kNameSpaceID_XUL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// A valid custom element name is a sequence of characters name which
|
||||
// must match the PotentialCustomElementName production:
|
||||
// PotentialCustomElementName ::= [a-z] (PCENChar)* '-' (PCENChar)*
|
||||
@ -9985,9 +9980,9 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a
|
||||
if (nodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) {
|
||||
tag = nsHTMLTags::CaseSensitiveAtomTagToId(name);
|
||||
isCustomElementName = (tag == eHTMLTag_userdefined &&
|
||||
nsContentUtils::IsCustomElementName(name, kNameSpaceID_XHTML));
|
||||
nsContentUtils::IsCustomElementName(name));
|
||||
} else {
|
||||
isCustomElementName = nsContentUtils::IsCustomElementName(name, kNameSpaceID_XUL);
|
||||
isCustomElementName = nsContentUtils::IsCustomElementName(name);
|
||||
}
|
||||
|
||||
RefPtr<nsAtom> tagAtom = nodeInfo->NameAtom();
|
||||
|
@ -710,7 +710,7 @@ public:
|
||||
* Returns true if |aName| is a valid name to be registered via
|
||||
* customElements.define.
|
||||
*/
|
||||
static bool IsCustomElementName(nsAtom* aName, uint32_t aNameSpaceID);
|
||||
static bool IsCustomElementName(nsAtom* aName);
|
||||
|
||||
static nsresult CheckQName(const nsAString& aQualifiedName,
|
||||
bool aNamespaceAware = true,
|
||||
|
@ -26,9 +26,6 @@
|
||||
|
||||
customElements.define("test-custom-element", TestCustomElement);
|
||||
|
||||
class TestWithoutDash extends XULElement { }
|
||||
customElements.define("testwithoutdash", TestWithoutDash);
|
||||
|
||||
function runTest() {
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
@ -56,9 +53,6 @@
|
||||
"Parser should have instantiated the custom element.");
|
||||
ok(element4 instanceof TestCustomElement, "Should be an instance of TestCustomElement");
|
||||
|
||||
let element5 = document.getElementById("element5");
|
||||
ok(element5 instanceof TestWithoutDash, "Should be an instance of TestWithoutDash");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
]]>
|
||||
@ -68,7 +62,6 @@
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<test-custom-element id="element4" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
|
||||
<testwithoutdash id="element5" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
|
||||
</div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user