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