From cac0f67c402d107cdb10971b95719e2ff9c7c76b Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 5 Nov 2009 09:23:40 +0000 Subject: Merge webkit.org at r50258 : Initial merge by git. Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0 --- WebCore/dom/ExceptionCode.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'WebCore/dom/ExceptionCode.cpp') diff --git a/WebCore/dom/ExceptionCode.cpp b/WebCore/dom/ExceptionCode.cpp index 0291a21..7bb8a50 100644 --- a/WebCore/dom/ExceptionCode.cpp +++ b/WebCore/dom/ExceptionCode.cpp @@ -65,25 +65,70 @@ static const char* const exceptionNames[] = { "QUOTA_EXCEEDED_ERR" }; +static const char* const exceptionDescriptions[] = { + "Index or size was negative, or greater than the allowed value.", + "The specified range of text did not fit into a DOMString.", + "A Node was inserted somewhere it doesn't belong.", + "A Node was used in a different document than the one that created it (that doesn't support it).", + "An invalid or illegal character was specified, such as in an XML name.", + "Data was specified for a Node which does not support data.", + "An attempt was made to modify an object where modifications are not allowed.", + "An attempt was made to reference a Node in a context where it does not exist.", + "The implementation did not support the requested type of object or operation.", + "An attempt was made to add an attribute that is already in use elsewhere.", + "An attempt was made to use an object that is not, or is no longer, usable.", + "An invalid or illegal string was specified.", + "An attempt was made to modify the type of the underlying object.", + "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces.", + "A parameter or an operation was not supported by the underlying object.", + "A call to a method such as insertBefore or removeChild would make the Node invalid with respect to \"partial validity\", this exception would be raised and the operation would not be done.", + "The type of an object was incompatible with the expected type of the parameter associated to the object.", + "An attempt was made to break through the security policy of the user agent.", + // FIXME: Couldn't find a description in the HTML/DOM specifications for NETWORK_ERR, ABORT_ERR, URL_MISMATCH_ERR, and QUOTA_EXCEEDED_ERR + "A network error occured.", + "The user aborted a request.", + "A worker global scope represented an absolute URL that is not equal to the resulting absolute URL.", + "An attempt was made to add something to storage that exceeded the quota." +}; + static const char* const rangeExceptionNames[] = { "BAD_BOUNDARYPOINTS_ERR", "INVALID_NODE_TYPE_ERR" }; +static const char* const rangeExceptionDescriptions[] = { + "The boundary-points of a Range did not meet specific requirements.", + "The container of an boundary-point of a Range was being set to either a node of an invalid type or a node with an ancestor of an invalid type." +}; + static const char* const eventExceptionNames[] = { "UNSPECIFIED_EVENT_TYPE_ERR" }; +static const char* const eventExceptionDescriptions[] = { + "The Event's type was not specified by initializing the event before the method was called." +}; + static const char* const xmlHttpRequestExceptionNames[] = { "NETWORK_ERR", "ABORT_ERR" }; +static const char* const xmlHttpRequestExceptionDescriptions[] = { + "A network error occured in synchronous requests.", + "The user aborted a request in synchronous requests." +}; + #if ENABLE(XPATH) static const char* const xpathExceptionNames[] = { "INVALID_EXPRESSION_ERR", "TYPE_ERR" }; + +static const char* const xpathExceptionDescriptions[] = { + "The expression had a syntax error or otherwise is not a legal expression according to the rules of the specific XPathEvaluator.", + "The expression could not be converted to return the specified type." +}; #endif #if ENABLE(SVG) @@ -92,6 +137,12 @@ static const char* const svgExceptionNames[] = { "SVG_INVALID_VALUE_ERR", "SVG_MATRIX_NOT_INVERTABLE" }; + +static const char* const svgExceptionDescriptions[] = { + "An object of the wrong type was passed to an operation.", + "An invalid value was passed to an operation or assigned to an attribute.", + "An attempt was made to invert a matrix that is not invertible." +}; #endif void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& description) @@ -101,6 +152,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des const char* typeName; int code = ec; const char* const* nameTable; + const char* const* descriptionTable; int nameTableSize; int nameTableOffset; ExceptionType type; @@ -110,6 +162,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM Range"; code -= RangeException::RangeExceptionOffset; nameTable = rangeExceptionNames; + descriptionTable = rangeExceptionDescriptions; nameTableSize = sizeof(rangeExceptionNames) / sizeof(rangeExceptionNames[0]); nameTableOffset = RangeException::BAD_BOUNDARYPOINTS_ERR; } else if (code >= EventException::EventExceptionOffset && code <= EventException::EventExceptionMax) { @@ -117,6 +170,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM Events"; code -= EventException::EventExceptionOffset; nameTable = eventExceptionNames; + descriptionTable = eventExceptionDescriptions; nameTableSize = sizeof(eventExceptionNames) / sizeof(eventExceptionNames[0]); nameTableOffset = EventException::UNSPECIFIED_EVENT_TYPE_ERR; } else if (code >= XMLHttpRequestException::XMLHttpRequestExceptionOffset && code <= XMLHttpRequestException::XMLHttpRequestExceptionMax) { @@ -124,6 +178,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "XMLHttpRequest"; code -= XMLHttpRequestException::XMLHttpRequestExceptionOffset; nameTable = xmlHttpRequestExceptionNames; + descriptionTable = xmlHttpRequestExceptionDescriptions; nameTableSize = sizeof(xmlHttpRequestExceptionNames) / sizeof(xmlHttpRequestExceptionNames[0]); // XMLHttpRequest exception codes start with 101 and we don't want 100 empty elements in the name array nameTableOffset = XMLHttpRequestException::NETWORK_ERR; @@ -133,6 +188,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM XPath"; code -= XPathException::XPathExceptionOffset; nameTable = xpathExceptionNames; + descriptionTable = xpathExceptionDescriptions; nameTableSize = sizeof(xpathExceptionNames) / sizeof(xpathExceptionNames[0]); // XPath exception codes start with 51 and we don't want 51 empty elements in the name array nameTableOffset = XPathException::INVALID_EXPRESSION_ERR; @@ -143,6 +199,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM SVG"; code -= SVGException::SVGExceptionOffset; nameTable = svgExceptionNames; + descriptionTable = svgExceptionDescriptions; nameTableSize = sizeof(svgExceptionNames) / sizeof(svgExceptionNames[0]); nameTableOffset = SVGException::SVG_WRONG_TYPE_ERR; #endif @@ -150,17 +207,20 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des type = DOMExceptionType; typeName = "DOM"; nameTable = exceptionNames; + descriptionTable = exceptionDescriptions; nameTableSize = sizeof(exceptionNames) / sizeof(exceptionNames[0]); nameTableOffset = INDEX_SIZE_ERR; } description.typeName = typeName; description.name = (ec >= nameTableOffset && ec - nameTableOffset < nameTableSize) ? nameTable[ec - nameTableOffset] : 0; + description.description = (ec >= nameTableOffset && ec - nameTableOffset < nameTableSize) ? descriptionTable[ec - nameTableOffset] : 0; description.code = code; description.type = type; // All exceptions used in the DOM code should have names. ASSERT(description.name); + ASSERT(description.description); } } // namespace WebCore -- cgit v1.1