[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
bweinstein at apple.com
bweinstein at apple.com
Thu Oct 29 20:46:36 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit b7d8265443e17c3907248b11a247ff80437d5be7
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 17 01:18:24 2009 +0000
WebCore: Fixes part of <http://webkit.org/b/30412>.
Web Inspector should get human readable DOM Exceptions.
Reviewed by Darin Adler.
Add a description field to ExceptionBase, and call it through
reportException which allows the user/developer to get a more detailed
and coherent error explanation through the Web Inspector.
This only applies to exceptions that come from a script on the page when
it is run. DOM Exceptions that come from the code run in the console, or DOM
exceptions that are caught and logged will come in a future patch.
Tests: inspector/uncaught-dom1-exception.html
inspector/uncaught-dom3-exception.html
inspector/uncaught-dom8-exception.html
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMBinding.cpp:
(WebCore::reportException):
* bindings/js/JSExceptionBase.cpp: Added.
(WebCore::toExceptionBase):
* bindings/js/JSExceptionBase.h: Added.
* dom/ExceptionBase.cpp:
(WebCore::ExceptionBase::ExceptionBase):
* dom/ExceptionBase.h:
(WebCore::ExceptionBase::description):
* dom/ExceptionCode.cpp:
(WebCore::):
(WebCore::getExceptionCodeDescription):
* dom/ExceptionCode.h:
LayoutTests: Fixes part of <http://webkit.org/b/30412>.
Web Inspector should get human readable DOM Exceptions.
Reviewed by Darin Adler.
Adds tests for output of uncaught exceptions to the Web Inspector
Console. Tests DOM exceptions 1, 3, and 8 (INDEX_SIZE_ERR, NOT_FOUND_ERR, and
HIERARCHY_REQUEST_ERR).
* inspector/uncaught-dom1-exception-expected.txt: Added.
* inspector/uncaught-dom1-exception.html: Added.
* inspector/uncaught-dom3-exception-expected.txt: Added.
* inspector/uncaught-dom3-exception.html: Added.
* inspector/uncaught-dom8-exception-expected.txt: Added.
* inspector/uncaught-dom8-exception.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e082a50..e188cd1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2009-10-16 Brian Weinstein <bweinstein at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixes part of <http://webkit.org/b/30412>.
+ Web Inspector should get human readable DOM Exceptions.
+
+ Adds tests for output of uncaught exceptions to the Web Inspector
+ Console. Tests DOM exceptions 1, 3, and 8 (INDEX_SIZE_ERR, NOT_FOUND_ERR, and
+ HIERARCHY_REQUEST_ERR).
+
+ * inspector/uncaught-dom1-exception-expected.txt: Added.
+ * inspector/uncaught-dom1-exception.html: Added.
+ * inspector/uncaught-dom3-exception-expected.txt: Added.
+ * inspector/uncaught-dom3-exception.html: Added.
+ * inspector/uncaught-dom8-exception-expected.txt: Added.
+ * inspector/uncaught-dom8-exception.html: Added.
+
2009-10-16 Simon Fraser <simon.fraser at apple.com>
Reviewed by Dan Bernstein.
diff --git a/LayoutTests/inspector/uncaught-dom1-exception-expected.txt b/LayoutTests/inspector/uncaught-dom1-exception-expected.txt
new file mode 100644
index 0000000..fb58b3d
--- /dev/null
+++ b/LayoutTests/inspector/uncaught-dom1-exception-expected.txt
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 19: INDEX_SIZE_ERR: DOM Exception 1: Index or size was negative, or greater than the allowed value.
+ALERT: Exception timeout exceeded.
+This tests that we are getting the correct message for DOM Exception 1: INDEX_SIZE_ERR.
+
+
diff --git a/LayoutTests/inspector/uncaught-dom1-exception.html b/LayoutTests/inspector/uncaught-dom1-exception.html
new file mode 100644
index 0000000..cd21b3e
--- /dev/null
+++ b/LayoutTests/inspector/uncaught-dom1-exception.html
@@ -0,0 +1,37 @@
+<html>
+<head>
+<script src="evaluate-in-frontend.js"></script>
+<script>
+
+function doit()
+{
+ // Since the exception will kill execution, make a short timeout.
+ setTimeout(function() {
+ alert("Exception timeout exceeded.")
+ if (window.layoutTestController) {
+ layoutTestController.closeWebInspector();
+ layoutTestController.notifyDone();
+ }
+ }, 500);
+
+ var p = document.createTextNode();
+ p.textContent = "foo";
+ p.splitText(10000);
+}
+
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+This tests that we are getting the correct message for DOM Exception 1: INDEX_SIZE_ERR.
+</p>
+
+<div id="frontend-script" style="display:none">
+</div>
+
+<div id="output">
+</div>
+
+</body>
+</html>
diff --git a/LayoutTests/inspector/uncaught-dom3-exception-expected.txt b/LayoutTests/inspector/uncaught-dom3-exception-expected.txt
new file mode 100644
index 0000000..d3a3809
--- /dev/null
+++ b/LayoutTests/inspector/uncaught-dom3-exception-expected.txt
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 17: HIERARCHY_REQUEST_ERR: DOM Exception 3: A Node was inserted somewhere it doesn't belong.
+ALERT: Exception timeout exceeded.
+This tests that we are getting the correct message for DOM Exception 3: HIERARCHY_REQUEST_ERR.
+
+
diff --git a/LayoutTests/inspector/uncaught-dom3-exception.html b/LayoutTests/inspector/uncaught-dom3-exception.html
new file mode 100644
index 0000000..3b434ea
--- /dev/null
+++ b/LayoutTests/inspector/uncaught-dom3-exception.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script src="evaluate-in-frontend.js"></script>
+<script>
+
+function doit()
+{
+ // Since the exception will kill execution, make a short timeout.
+ setTimeout(function() {
+ alert("Exception timeout exceeded.")
+ if (window.layoutTestController) {
+ layoutTestController.closeWebInspector();
+ layoutTestController.notifyDone();
+ }
+ }, 500);
+
+ document.appendChild(document.createElement());
+}
+
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+This tests that we are getting the correct message for DOM Exception 3: HIERARCHY_REQUEST_ERR.
+</p>
+
+<div id="frontend-script" style="display:none">
+</div>
+
+<div id="output">
+</div>
+
+</body>
+</html>
diff --git a/LayoutTests/inspector/uncaught-dom8-exception-expected.txt b/LayoutTests/inspector/uncaught-dom8-exception-expected.txt
new file mode 100644
index 0000000..bf185ac
--- /dev/null
+++ b/LayoutTests/inspector/uncaught-dom8-exception-expected.txt
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 17: NOT_FOUND_ERR: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist.
+ALERT: Exception timeout exceeded.
+This tests that we are getting the correct message for DOM Exception 8: NOT_FOUND_ERR.
+
+
diff --git a/LayoutTests/inspector/uncaught-dom8-exception.html b/LayoutTests/inspector/uncaught-dom8-exception.html
new file mode 100644
index 0000000..02046aa
--- /dev/null
+++ b/LayoutTests/inspector/uncaught-dom8-exception.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script src="evaluate-in-frontend.js"></script>
+<script>
+
+function doit()
+{
+ // Since the exception will kill execution, make a short timeout.
+ setTimeout(function() {
+ alert("Exception timeout exceeded.")
+ if (window.layoutTestController) {
+ layoutTestController.closeWebInspector();
+ layoutTestController.notifyDone();
+ }
+ }, 500);
+
+ document.appendChild();
+}
+
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+This tests that we are getting the correct message for DOM Exception 8: NOT_FOUND_ERR.
+</p>
+
+<div id="frontend-script" style="display:none">
+</div>
+
+<div id="output">
+</div>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9d96faa..27622d5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,39 @@
+2009-10-16 Brian Weinstein <bweinstein at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixes part of <http://webkit.org/b/30412>.
+ Web Inspector should get human readable DOM Exceptions.
+
+ Add a description field to ExceptionBase, and call it through
+ reportException which allows the user/developer to get a more detailed
+ and coherent error explanation through the Web Inspector.
+
+ This only applies to exceptions that come from a script on the page when
+ it is run. DOM Exceptions that come from the code run in the console, or DOM
+ exceptions that are caught and logged will come in a future patch.
+
+ Tests: inspector/uncaught-dom1-exception.html
+ inspector/uncaught-dom3-exception.html
+ inspector/uncaught-dom8-exception.html
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::reportException):
+ * bindings/js/JSExceptionBase.cpp: Added.
+ (WebCore::toExceptionBase):
+ * bindings/js/JSExceptionBase.h: Added.
+ * dom/ExceptionBase.cpp:
+ (WebCore::ExceptionBase::ExceptionBase):
+ * dom/ExceptionBase.h:
+ (WebCore::ExceptionBase::description):
+ * dom/ExceptionCode.cpp:
+ (WebCore::):
+ (WebCore::getExceptionCodeDescription):
+ * dom/ExceptionCode.h:
+
2009-10-16 Geoffrey Garen <ggaren at apple.com>
Build fix: forgot to check in this #include.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 99d3391..afe422f 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -486,6 +486,8 @@
'bindings/js/JSEventListener.h',
'bindings/js/JSEventTarget.cpp',
'bindings/js/JSEventTarget.h',
+ 'bindings/js/JSExceptionBase.cpp',
+ 'bindings/js/JSExceptionBase.h',
'bindings/js/JSGeolocationCustom.cpp',
'bindings/js/JSHistoryCustom.cpp',
'bindings/js/JSHistoryCustom.h',
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 84d7d49..f09f6ef 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -33021,6 +33021,14 @@
RelativePath="..\bindings\js\JSEventTarget.h"
>
</File>
+ <File
+ RelativePath="..\bindings\js\JSExceptionBase.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSExceptionBase.h"
+ >
+ </File>
<File
RelativePath="..\bindings\js\JSGeolocationCustom.cpp"
>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 17e07a3..913f766 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -639,6 +639,8 @@
31C0FF4C0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */; };
31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */; };
31C0FF4E0E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */; };
+ 3314ACEB10892086000F0E56 /* JSExceptionBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */; };
+ 3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 3314ACEA10892086000F0E56 /* JSExceptionBase.h */; };
33503C9A10179A74003B47E1 /* NotificationPresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503C9910179A74003B47E1 /* NotificationPresenter.h */; settings = {ATTRIBUTES = (Private, ); }; };
33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503C9F10179AD7003B47E1 /* JSNotification.cpp */; };
33503CA410179AD7003B47E1 /* JSNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA010179AD7003B47E1 /* JSNotification.h */; };
@@ -5840,6 +5842,8 @@
31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEvent.h; sourceTree = "<group>"; };
31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitTransitionEvent.mm; sourceTree = "<group>"; };
31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEventInternal.h; sourceTree = "<group>"; };
+ 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExceptionBase.cpp; sourceTree = "<group>"; };
+ 3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = "<group>"; };
333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Notification.idl; path = notifications/Notification.idl; sourceTree = "<group>"; };
333F704F0FB49CA2008E12A6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notification.h; path = notifications/Notification.h; sourceTree = "<group>"; };
33503C9910179A74003B47E1 /* NotificationPresenter.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = NotificationPresenter.h; path = notifications/NotificationPresenter.h; sourceTree = "<group>"; };
@@ -14246,6 +14250,8 @@
BCBFB53B0DCD29CF0019B3E5 /* JSDOMWindowShell.h */,
BC60901E0E91B8EC000C68B5 /* JSEventTarget.cpp */,
BC60901D0E91B8EC000C68B5 /* JSEventTarget.h */,
+ 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */,
+ 3314ACEA10892086000F0E56 /* JSExceptionBase.h */,
C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */,
C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */,
C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */,
@@ -18040,6 +18046,7 @@
93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */,
E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
+ 3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */,
973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -20172,6 +20179,7 @@
93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
+ 3314ACEB10892086000F0E56 /* JSExceptionBase.cpp in Sources */,
973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 515c088..8168323 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -25,6 +25,7 @@
#include "DOMCoreException.h"
#include "Document.h"
#include "EventException.h"
+#include "ExceptionBase.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "HTMLAudioElement.h"
@@ -35,6 +36,7 @@
#include "JSDOMCoreException.h"
#include "JSDOMWindowCustom.h"
#include "JSEventException.h"
+#include "JSExceptionBase.h"
#include "JSNode.h"
#include "JSRangeException.h"
#include "JSXMLHttpRequestException.h"
@@ -468,6 +470,9 @@ void reportException(ExecState* exec, JSValue exception)
UString exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL")).toString(exec);
exec->clearException();
+ if (ExceptionBase* exceptionBase = toExceptionBase(exception))
+ errorMessage = exceptionBase->message() + ": " + exceptionBase->description();
+
ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
ASSERT(scriptExecutionContext);
diff --git a/WebCore/bindings/js/JSExceptionBase.cpp b/WebCore/bindings/js/JSExceptionBase.cpp
new file mode 100644
index 0000000..3749eed
--- /dev/null
+++ b/WebCore/bindings/js/JSExceptionBase.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSExceptionBase.h"
+
+#include "JSDOMCoreException.h"
+#include "JSEventException.h"
+#include "JSRangeException.h"
+#include "JSXMLHttpRequestException.h"
+#if ENABLE(SVG)
+#include "JSSVGException.h"
+#endif
+#if ENABLE(XPATH)
+#include "JSXPathException.h"
+#endif
+
+namespace WebCore {
+
+ExceptionBase* toExceptionBase(JSC::JSValue value)
+{
+ if (DOMCoreException* domException = toDOMCoreException(value))
+ return reinterpret_cast<ExceptionBase*>(domException);
+ if (RangeException* rangeException = toRangeException(value))
+ return reinterpret_cast<ExceptionBase*>(rangeException);
+ if (EventException* eventException = toEventException(value))
+ return reinterpret_cast<ExceptionBase*>(eventException);
+ if (XMLHttpRequestException* xmlHttpException = toXMLHttpRequestException(value))
+ return reinterpret_cast<ExceptionBase*>(xmlHttpException);
+#if ENABLE(SVG)
+ if (SVGException* svgException = toSVGException(value))
+ return reinterpret_cast<ExceptionBase*>(svgException);
+#endif
+#if ENABLE(XPATH)
+ if (XPathException* pathException = toXPathException(value))
+ return reinterpret_cast<ExceptionBase*>(pathException);
+#endif
+
+ return 0;
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/JSExceptionBase.h b/WebCore/bindings/js/JSExceptionBase.h
new file mode 100644
index 0000000..01c6ac2
--- /dev/null
+++ b/WebCore/bindings/js/JSExceptionBase.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSExceptionBase_h
+#define JSExceptionBase_h
+
+namespace JSC {
+
+class JSValue;
+
+} // namespace JSC
+
+namespace WebCore {
+
+class ExceptionBase;
+
+ExceptionBase* toExceptionBase(JSC::JSValue);
+
+} // namespace WebCore
+
+#endif // JSExceptionBase_h
diff --git a/WebCore/dom/ExceptionBase.cpp b/WebCore/dom/ExceptionBase.cpp
index c73d514..d175d8b 100644
--- a/WebCore/dom/ExceptionBase.cpp
+++ b/WebCore/dom/ExceptionBase.cpp
@@ -34,6 +34,7 @@ namespace WebCore {
ExceptionBase::ExceptionBase(const ExceptionCodeDescription& description)
: m_code(description.code)
, m_name(description.name)
+ , m_description(description.description)
{
if (description.name)
m_message = String::format("%s: %s Exception %d", description.name, description.typeName, description.code);
diff --git a/WebCore/dom/ExceptionBase.h b/WebCore/dom/ExceptionBase.h
index 44fad7e..81e2d7f 100644
--- a/WebCore/dom/ExceptionBase.h
+++ b/WebCore/dom/ExceptionBase.h
@@ -40,6 +40,7 @@ namespace WebCore {
unsigned short code() const { return m_code; }
String name() const { return m_name; }
String message() const { return m_message; }
+ String description() const { return m_description; }
String toString() const;
@@ -50,6 +51,7 @@ namespace WebCore {
unsigned short m_code;
String m_name;
String m_message;
+ String m_description;
};
} // namespace WebCore
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
diff --git a/WebCore/dom/ExceptionCode.h b/WebCore/dom/ExceptionCode.h
index 58b18e2..573fb36 100644
--- a/WebCore/dom/ExceptionCode.h
+++ b/WebCore/dom/ExceptionCode.h
@@ -77,6 +77,7 @@ namespace WebCore {
struct ExceptionCodeDescription {
const char* typeName; // has spaces and is suitable for use in exception description strings; maximum length is 10 characters
const char* name; // exception name, also intended for use in exception description strings; 0 if name not known; maximum length is 27 characters
+ const char* description; // exception description, intended for use in exception strings; more readable explanation of error
int code; // numeric value of the exception within a particular type
ExceptionType type;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list