summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dom/base/nsDocument.cpp40
-rw-r--r--dom/base/nsDocument.h14
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_register.html40
3 files changed, 0 insertions, 94 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index fa40c41ac..a0857faf8 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5395,14 +5395,6 @@ nsDocument::CreateElement(const nsAString& aTagName,
}
const nsString* is = nullptr;
- if (aOptions.IsElementCreationOptions()) {
- // Throw NotFoundError if 'is' is not-null and definition is null
- is = CheckCustomElementName(aOptions.GetAsElementCreationOptions(),
- needsLowercase ? lcTagName : aTagName, mDefaultElementType, rv);
- if (rv.Failed()) {
- return nullptr;
- }
- }
RefPtr<Element> elem = CreateElem(
needsLowercase ? lcTagName : aTagName, nullptr, mDefaultElementType, is);
@@ -5443,14 +5435,6 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
}
const nsString* is = nullptr;
- if (aOptions.IsElementCreationOptions()) {
- // Throw NotFoundError if 'is' is not-null and definition is null
- is = CheckCustomElementName(aOptions.GetAsElementCreationOptions(),
- aQualifiedName, nodeInfo->NamespaceID(), rv);
- if (rv.Failed()) {
- return nullptr;
- }
- }
nsCOMPtr<Element> element;
rv = NS_NewElement(getter_AddRefs(element), nodeInfo.forget(),
@@ -12757,30 +12741,6 @@ nsIDocument::UpdateStyleBackendType()
#endif
}
-const nsString*
-nsDocument::CheckCustomElementName(const ElementCreationOptions& aOptions,
- const nsAString& aLocalName,
- uint32_t aNamespaceID,
- ErrorResult& rv)
-{
- // only check aOptions if 'is' is passed and the webcomponents preference
- // is enabled
- if (!aOptions.mIs.WasPassed() ||
- !CustomElementRegistry::IsCustomElementEnabled()) {
- return nullptr;
- }
-
- const nsString* is = &aOptions.mIs.Value();
-
- // Throw NotFoundError if 'is' is not-null and definition is null
- if (!nsContentUtils::LookupCustomElementDefinition(this, aLocalName,
- aNamespaceID, is)) {
- rv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
- }
-
- return is;
-}
-
Selection*
nsIDocument::GetSelection(ErrorResult& aRv)
{
diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h
index 8ea4993f0..90e511dcb 100644
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -1388,20 +1388,6 @@ protected:
private:
static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp);
- /**
- * Check if the passed custom element name, aOptions.mIs, is a registered
- * custom element type or not, then return the custom element name for future
- * usage.
- *
- * If there is no existing custom element definition for this name, throw a
- * NotFoundError.
- */
- const nsString* CheckCustomElementName(
- const mozilla::dom::ElementCreationOptions& aOptions,
- const nsAString& aLocalName,
- uint32_t aNamespaceID,
- ErrorResult& rv);
-
public:
virtual already_AddRefed<mozilla::dom::CustomElementRegistry>
GetCustomElementRegistry() override;
diff --git a/dom/tests/mochitest/webcomponents/test_document_register.html b/dom/tests/mochitest/webcomponents/test_document_register.html
index a9c194b60..aa80fef5f 100644
--- a/dom/tests/mochitest/webcomponents/test_document_register.html
+++ b/dom/tests/mochitest/webcomponents/test_document_register.html
@@ -103,52 +103,12 @@ function startTest() {
is(extendedButton.getAttribute("is"), "x-extended-button", "The |is| attribute of the created element should be the extended type.");
is(extendedButton.type, "submit", "Created element should be a button with type of \"submit\"");
- // document.createElementNS with different namespace than definition.
- try {
- var svgButton = document.createElementNS("http://www.w3.org/2000/svg", "button", {is: "x-extended-button"});
- ok(false, "An exception should've been thrown");
- } catch(err) {
- is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
- }
-
- // document.createElementNS with no namespace.
- try {
- var noNamespaceButton = document.createElementNS("", "button", {is: "x-extended-button"});
- ok(false, "An exception should've been thrown");
- } catch(err) {
- is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
- }
-
- // document.createElement with non-existant extended type.
- try {
- var normalButton = document.createElement("button", {is: "x-non-existant"});
- ok(false, "An exception should've been thrown");
- } catch(err) {
- is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
- }
-
- // document.createElement with exteneded type that does not match with local name of element.
- try {
- var normalDiv = document.createElement("div", {is: "x-extended-button"});
- ok(false, "An exception should've been thrown");
- } catch(err) {
- is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
- }
-
// Custom element constructor.
var constructedButton = new buttonConstructor();
is(constructedButton.tagName, "BUTTON", "Created element should have local name of BUTTON");
is(constructedButton.__proto__, extendedProto, "Created element should have the prototype of the extended type.");
is(constructedButton.getAttribute("is"), "x-extended-button", "The |is| attribute of the created element should be the extended type.");
- // document.createElement with different namespace than definition for extended element.
- try {
- var htmlText = document.createElement("text", {is: "x-extended-text"});
- ok(false, "An exception should've been thrown");
- } catch(err) {
- is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
- }
-
// Try creating an element with a custom element name, but not in the html namespace.
var htmlNamespaceProto = Object.create(HTMLElement.prototype);
document.registerElement("x-in-html-namespace", { prototype: htmlNamespaceProto });