diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
| commit | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch) | |
| tree | 988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/xml/XMLHttpRequestException.cpp | |
| parent | dd91e772430dc294e3bf478c119ef8d43c0a3358 (diff) | |
| download | qtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz | |
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/xml/XMLHttpRequestException.cpp')
| -rw-r--r-- | Source/WebCore/xml/XMLHttpRequestException.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/Source/WebCore/xml/XMLHttpRequestException.cpp b/Source/WebCore/xml/XMLHttpRequestException.cpp index 9e74aac88..c06c07c0d 100644 --- a/Source/WebCore/xml/XMLHttpRequestException.cpp +++ b/Source/WebCore/xml/XMLHttpRequestException.cpp @@ -31,19 +31,14 @@ namespace WebCore { -// FIXME: This should be an array of structs to pair the names and descriptions. -static const char* const exceptionNames[] = { - "NETWORK_ERR", - "ABORT_ERR" +static struct XMLHttpRequestExceptionNameDescription { + const char* const name; + const char* const description; +} exceptions[] = { + { "NETWORK_ERR", "A network error occurred in synchronous requests." }, + { "ABORT_ERR", "The user aborted a request in synchronous requests." } }; -static const char* const exceptionDescriptions[] = { - "A network error occurred in synchronous requests.", - "The user aborted a request in synchronous requests." -}; - -COMPILE_ASSERT(WTF_ARRAY_LENGTH(exceptionNames) == WTF_ARRAY_LENGTH(exceptionDescriptions), XMLHttpRequestExceptionTablesMustMatch); - bool XMLHttpRequestException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description) { if (ec < XMLHttpRequestExceptionOffset || ec > XMLHttpRequestExceptionMax) @@ -53,11 +48,11 @@ bool XMLHttpRequestException::initializeDescription(ExceptionCode ec, ExceptionC description->code = ec - XMLHttpRequestExceptionOffset; description->type = XMLHttpRequestExceptionType; - size_t tableSize = WTF_ARRAY_LENGTH(exceptionNames); + size_t tableSize = WTF_ARRAY_LENGTH(exceptions); size_t tableIndex = ec - NETWORK_ERR; - description->name = tableIndex < tableSize ? exceptionNames[tableIndex] : 0; - description->description = tableIndex < tableSize ? exceptionDescriptions[tableIndex] : 0; + description->name = tableIndex < tableSize ? exceptions[tableIndex].name : 0; + description->description = tableIndex < tableSize ? exceptions[tableIndex].description : 0; return true; } |
