mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 07:01:19 +00:00
Backed out changeset d346871db5f6 (bug 1020697) for intermittent test failures
This commit is contained in:
parent
d23a38bc59
commit
69e146bee2
@ -2040,11 +2040,8 @@ public:
|
||||
*
|
||||
* @return whether aAttr was valid and can be cached.
|
||||
*/
|
||||
static AutocompleteAttrState
|
||||
SerializeAutocompleteAttribute(const nsAttrValue* aAttr,
|
||||
nsAString& aResult,
|
||||
AutocompleteAttrState aCachedState =
|
||||
eAutocompleteAttrState_Unknown);
|
||||
static AutocompleteAttrState SerializeAutocompleteAttribute(const nsAttrValue* aAttr,
|
||||
nsAString& aResult);
|
||||
|
||||
/**
|
||||
* This will parse aSource, to extract the value of the pseudo attribute
|
||||
|
@ -855,26 +855,8 @@ nsContentUtils::IsAutocompleteEnabled(nsIDOMHTMLInputElement* aInput)
|
||||
|
||||
nsContentUtils::AutocompleteAttrState
|
||||
nsContentUtils::SerializeAutocompleteAttribute(const nsAttrValue* aAttr,
|
||||
nsAString& aResult,
|
||||
AutocompleteAttrState aCachedState)
|
||||
nsAString& aResult)
|
||||
{
|
||||
if (!aAttr ||
|
||||
aCachedState == nsContentUtils::eAutocompleteAttrState_Invalid) {
|
||||
return aCachedState;
|
||||
}
|
||||
|
||||
if (aCachedState == nsContentUtils::eAutocompleteAttrState_Valid) {
|
||||
uint32_t atomCount = aAttr->GetAtomCount();
|
||||
for (uint32_t i = 0; i < atomCount; i++) {
|
||||
if (i != 0) {
|
||||
aResult.Append(' ');
|
||||
}
|
||||
aResult.Append(nsDependentAtomString(aAttr->AtomAt(i)));
|
||||
}
|
||||
nsContentUtils::ASCIIToLower(aResult);
|
||||
return aCachedState;
|
||||
}
|
||||
|
||||
AutocompleteAttrState state = InternalSerializeAutocompleteAttribute(aAttr, aResult);
|
||||
if (state == eAutocompleteAttrState_Valid) {
|
||||
ASCIIToLower(aResult);
|
||||
@ -891,7 +873,7 @@ nsContentUtils::SerializeAutocompleteAttribute(const nsAttrValue* aAttr,
|
||||
*/
|
||||
nsContentUtils::AutocompleteAttrState
|
||||
nsContentUtils::InternalSerializeAutocompleteAttribute(const nsAttrValue* aAttrVal,
|
||||
nsAString& aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
// No sandbox attribute so we are done
|
||||
if (!aAttrVal) {
|
||||
|
@ -1520,10 +1520,23 @@ HTMLInputElement::GetAutocomplete(nsAString& aValue)
|
||||
{
|
||||
aValue.Truncate(0);
|
||||
const nsAttrValue* attributeVal = GetParsedAttr(nsGkAtoms::autocomplete);
|
||||
if (!attributeVal ||
|
||||
mAutocompleteAttrState == nsContentUtils::eAutocompleteAttrState_Invalid) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (mAutocompleteAttrState == nsContentUtils::eAutocompleteAttrState_Valid) {
|
||||
uint32_t atomCount = attributeVal->GetAtomCount();
|
||||
for (uint32_t i = 0; i < atomCount; i++) {
|
||||
if (i != 0) {
|
||||
aValue.Append(' ');
|
||||
}
|
||||
aValue.Append(nsDependentAtomString(attributeVal->AtomAt(i)));
|
||||
}
|
||||
nsContentUtils::ASCIIToLower(aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mAutocompleteAttrState =
|
||||
nsContentUtils::SerializeAutocompleteAttribute(attributeVal, aValue,
|
||||
mAutocompleteAttrState);
|
||||
mAutocompleteAttrState = nsContentUtils::SerializeAutocompleteAttribute(attributeVal, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,6 @@ HTMLSelectElement::HTMLSelectElement(already_AddRefed<nsINodeInfo>& aNodeInfo,
|
||||
FromParser aFromParser)
|
||||
: nsGenericHTMLFormElementWithState(aNodeInfo),
|
||||
mOptions(new HTMLOptionsCollection(MOZ_THIS_IN_INITIALIZER_LIST())),
|
||||
mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown),
|
||||
mIsDoneAddingChildren(!aFromParser),
|
||||
mDisabledChanged(false),
|
||||
mMutating(false),
|
||||
@ -178,16 +177,6 @@ HTMLSelectElement::SetCustomValidity(const nsAString& aError)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLSelectElement::GetAutocomplete(DOMString& aValue)
|
||||
{
|
||||
const nsAttrValue* attributeVal = GetParsedAttr(nsGkAtoms::autocomplete);
|
||||
|
||||
mAutocompleteAttrState =
|
||||
nsContentUtils::SerializeAutocompleteAttribute(attributeVal, aValue,
|
||||
mAutocompleteAttrState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
@ -1344,9 +1333,6 @@ HTMLSelectElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
UpdateBarredFromConstraintValidation();
|
||||
} else if (aName == nsGkAtoms::required) {
|
||||
UpdateValueMissingValidityState();
|
||||
} else if (aName == nsGkAtoms::autocomplete) {
|
||||
// Clear the cached @autocomplete attribute state
|
||||
mAutocompleteAttrState = nsContentUtils::eAutocompleteAttrState_Unknown;
|
||||
}
|
||||
|
||||
UpdateState(aNotify);
|
||||
@ -1434,13 +1420,8 @@ HTMLSelectElement::ParseAttribute(int32_t aNamespaceID,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (kNameSpaceID_None == aNamespaceID) {
|
||||
if (aAttribute == nsGkAtoms::size) {
|
||||
return aResult.ParsePositiveIntValue(aValue);
|
||||
} else if (aAttribute == nsGkAtoms::autocomplete) {
|
||||
aResult.ParseAtomArray(aValue);
|
||||
return true;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::size && kNameSpaceID_None == aNamespaceID) {
|
||||
return aResult.ParsePositiveIntValue(aValue);
|
||||
}
|
||||
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
aResult);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
class nsContentList;
|
||||
class nsIDOMHTMLOptionElement;
|
||||
@ -160,11 +159,6 @@ public:
|
||||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::autofocus, aVal, aRv);
|
||||
}
|
||||
void GetAutocomplete(DOMString& aValue);
|
||||
void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv);
|
||||
}
|
||||
bool Disabled() const
|
||||
{
|
||||
return GetBoolAttr(nsGkAtoms::disabled);
|
||||
@ -611,7 +605,6 @@ protected:
|
||||
|
||||
/** The options[] array */
|
||||
nsRefPtr<HTMLOptionsCollection> mOptions;
|
||||
nsContentUtils::AutocompleteAttrState mAutocompleteAttrState;
|
||||
/** false if the parser is in the middle of adding children. */
|
||||
bool mIsDoneAddingChildren;
|
||||
/** true if our disabled state has changed from the default **/
|
||||
|
@ -13,8 +13,7 @@ Test @autocomplete on <input>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<form>
|
||||
<input id="input-field" />
|
||||
<select id="select-field" />
|
||||
<input id="field" />
|
||||
</form>
|
||||
</div>
|
||||
<pre id="test">
|
||||
@ -70,8 +69,9 @@ var values = [
|
||||
];
|
||||
|
||||
var types = [undefined, "hidden", "text", "search"]; // Valid types for all non-multiline hints.
|
||||
var field = document.getElementById("field");
|
||||
|
||||
function checkAutocompleteValues(field, type) {
|
||||
function checkAutocompleteValues(type) {
|
||||
for (var test of values) {
|
||||
if (typeof(test[0]) === "undefined")
|
||||
field.removeAttribute("autocomplete");
|
||||
@ -83,18 +83,14 @@ function checkAutocompleteValues(field, type) {
|
||||
}
|
||||
|
||||
function start() {
|
||||
var inputField = document.getElementById("input-field");
|
||||
for (var type of types) {
|
||||
// Switch the input type
|
||||
if (typeof(type) === "undefined")
|
||||
inputField.removeAttribute("type");
|
||||
field.removeAttribute("type");
|
||||
else
|
||||
inputField.type = type;
|
||||
checkAutocompleteValues(inputField, type || "");
|
||||
field.type = type;
|
||||
checkAutocompleteValues(type || "");
|
||||
}
|
||||
|
||||
var selectField = document.getElementById("select-field");
|
||||
checkAutocompleteValues(selectField, "select");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
||||
interface HTMLSelectElement : HTMLElement {
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean autofocus;
|
||||
[Pref="dom.forms.autocomplete.experimental", SetterThrows, Pure]
|
||||
attribute DOMString autocomplete;
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean disabled;
|
||||
[Pure]
|
||||
|
Loading…
x
Reference in New Issue
Block a user