diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 497db27f09..c1af4942e0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -179,7 +179,9 @@ static void show_the_picker_if_applicable(HTMLInputElement& element) if (!is(global_object) || !static_cast(global_object).has_transient_activation()) return; - // FIXME: 2. If element is not mutable, then return. + // 2. If element is not mutable, then return. + if (!element.is_mutable()) + return; // 3. If element's type attribute is in the File Upload state, then run these steps in parallel: if (element.type_state() == HTMLInputElement::TypeAttributeState::FileUpload) { @@ -219,7 +221,9 @@ WebIDL::ExceptionOr HTMLInputElement::show_picker() { // The showPicker() method steps are: - // FIXME: 1. If this is not mutable, then throw an "InvalidStateError" DOMException. + // 1. If this is not mutable, then throw an "InvalidStateError" DOMException. + if (!m_is_mutable) + return WebIDL::InvalidStateError::create(realm(), "Element is not mutable"sv); // 2. If this's relevant settings object's origin is not same origin with this's relevant settings object's top-level origin, // and this's type attribute is not in the File Upload state or Color state, then throw a "SecurityError" DOMException. diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index 9e1536a197..251f2242c3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -81,6 +81,8 @@ public: bool indeterminate() const { return m_indeterminate; } void set_indeterminate(bool); + bool is_mutable() const { return m_is_mutable; } + void did_edit_text_node(Badge); JS::GCPtr files();