Bug 679689. Allow empty string values to be associtated to enumerated attributes. r=sicking

This commit is contained in:
Boris Zbarsky 2011-08-31 18:09:58 -04:00
parent b98b1e5b49
commit 5df1c9dfe4
3 changed files with 10 additions and 3 deletions

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<img crossorigin>

View File

@ -93,3 +93,4 @@ load 642022-1.html
load 646184.html load 646184.html
load 658845-1.svg load 658845-1.svg
load 667336-1.html load 667336-1.html
load 679689-1.html

View File

@ -1250,10 +1250,14 @@ nsAttrValue::SetMiscAtomOrString(const nsAString* aValue)
"Trying to re-set atom or string!"); "Trying to re-set atom or string!");
if (aValue) { if (aValue) {
PRUint32 len = aValue->Length(); PRUint32 len = aValue->Length();
// We're allowing eCSSStyleRule attributes to store empty strings as it // * We're allowing eCSSStyleRule attributes to store empty strings as it
// can be beneficial to store an empty style attribute as a parsed rule. // can be beneficial to store an empty style attribute as a parsed rule.
// * We're allowing enumerated values because sometimes the empty
// string corresponds to a particular enumerated value, especially
// for enumerated values that are not limited enumerated.
// Add other types as needed. // Add other types as needed.
NS_ASSERTION(len || Type() == eCSSStyleRule, "Empty string?"); NS_ASSERTION(len || Type() == eCSSStyleRule || Type() == eEnum,
"Empty string?");
MiscContainer* cont = GetMiscContainer(); MiscContainer* cont = GetMiscContainer();
if (len <= NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM) { if (len <= NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM) {
nsIAtom* atom = NS_NewAtom(*aValue); nsIAtom* atom = NS_NewAtom(*aValue);