WebCore:
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jan 2008 03:04:16 +0000 (03:04 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jan 2008 03:04:16 +0000 (03:04 +0000)
        Reviewed by Darin.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=16637
        Acid3 expects ExeceptionCode constants to be defined on DOMException objects

        - Make DOMException a real JS object.

        Test: fast/dom/DOMException/prototype-object.html

        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:

        This is no longer needed as the autogenerated classes now includes the
        constructor.
        * bindings/js/JSDOMExceptionConstructor.cpp: Removed.
        * bindings/js/JSDOMExceptionConstructor.h: Removed.

        Create on demand and use the new class for DOMExceptions.
        * bindings/js/kjs_binding.cpp:
        (KJS::setDOMException):

        Remove no longer needed custom constructor getter.
        * bindings/js/kjs_window.cpp:
        (KJS::Window::getValueProperty):

        Don't expose DOMCoreException as the name of class by special casing
        the user visible class name to be DOMException.
        * bindings/scripts/CodeGeneratorJS.pm:

        The DOMException class/file needs to be named DOMCoreException because there is
        name conflict with one of the Objective-C bindings classes.  It should be renamed
        to DOMException when the Objective-C bindings are moved into WebKit.
        * dom/DOMCoreException.cpp: Added.
        (WebCore::DOMCoreException::DOMCoreException):
        (WebCore::DOMCoreException::toString):
        * dom/DOMCoreException.h: Added.
        (WebCore::DOMCoreException::):
        (WebCore::DOMCoreException::code):
        (WebCore::DOMCoreException::name):
        (WebCore::DOMCoreException::message):
        * dom/DOMCoreException.idl: Added.
        * page/DOMWindow.idl:

LayoutTests:

        Reviewed by Darin.

        Test for http://bugs.webkit.org/show_bug.cgi?id=16637
        Acid3 expects ExeceptionCode constants to be defined on DOMException objects

        * fast/dom/DOMException: Added.
        * fast/dom/DOMException/prototype-object-expected.txt: Added.
        * fast/dom/DOMException/prototype-object.html: Added.
        * fast/dom/DOMException/resources: Added.
        * fast/dom/DOMException/resources/prototype-object.js: Added.
        * fast/dom/Window/window-properties-expected.txt:
        * http/tests/xmlhttprequest/connection-error-sync-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29058 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/DOMException/prototype-object-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/DOMException/prototype-object.html [new file with mode: 0644]
LayoutTests/fast/dom/DOMException/resources/prototype-object.js [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/http/tests/xmlhttprequest/connection-error-sync-expected.txt
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSDOMExceptionConstructor.cpp [deleted file]
WebCore/bindings/js/JSDOMExceptionConstructor.h [deleted file]
WebCore/bindings/js/kjs_binding.cpp
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/dom/DOMCoreException.cpp [new file with mode: 0644]
WebCore/dom/DOMCoreException.h [new file with mode: 0644]
WebCore/dom/DOMCoreException.idl [new file with mode: 0644]
WebCore/page/DOMWindow.idl

index 49a20b322cf3c249606335c7af5f0ae522902b90..c446ab2806bdb0cf6c0bebbed5d701c175d2b3e3 100644 (file)
@@ -1,3 +1,18 @@
+2007-12-31  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Darin.
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=16637
+        Acid3 expects ExeceptionCode constants to be defined on DOMException objects
+
+        * fast/dom/DOMException: Added.
+        * fast/dom/DOMException/prototype-object-expected.txt: Added.
+        * fast/dom/DOMException/prototype-object.html: Added.
+        * fast/dom/DOMException/resources: Added.
+        * fast/dom/DOMException/resources/prototype-object.js: Added.
+        * fast/dom/Window/window-properties-expected.txt:
+        * http/tests/xmlhttprequest/connection-error-sync-expected.txt:
+
 2007-12-31  Darin Adler  <darin@apple.com>
 
         * fast/dom/HTMLFormElement/elements-not-in-document-expected.txt: Updated results to expect success.
diff --git a/LayoutTests/fast/dom/DOMException/prototype-object-expected.txt b/LayoutTests/fast/dom/DOMException/prototype-object-expected.txt
new file mode 100644 (file)
index 0000000..abe0b4a
--- /dev/null
@@ -0,0 +1,16 @@
+DOMException needs a real prototype: http://bugs.webkit.org/show_bug.cgi?id=16637
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS e.toString() is "Error: HIERARCHY_REQUEST_ERR: DOM Exception 3"
+PASS Object.prototype.toString.call(e) is "[object DOMException]"
+PASS Object.prototype.toString.call(e.__proto__) is "[object DOMExceptionPrototype]"
+PASS e.constructor.toString() is "[object DOMExceptionConstructor]"
+PASS e.constructor is window.DOMException
+PASS e.HIERARCHY_REQUEST_ERR is e.constructor.HIERARCHY_REQUEST_ERR
+PASS e.HIERARCHY_REQUEST_ERR is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DOMException/prototype-object.html b/LayoutTests/fast/dom/DOMException/prototype-object.html
new file mode 100644 (file)
index 0000000..82db16b
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/prototype-object.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/DOMException/resources/prototype-object.js b/LayoutTests/fast/dom/DOMException/resources/prototype-object.js
new file mode 100644 (file)
index 0000000..ac40e8c
--- /dev/null
@@ -0,0 +1,19 @@
+description("DOMException needs a real prototype: http://bugs.webkit.org/show_bug.cgi?id=16637")
+
+var e;
+try {
+  document.body.appendChild(document.documentElement);
+   // raises a HIERARCHY_REQUEST_ERR
+} catch (err) {
+  e = err;
+}
+
+shouldBeEqualToString("e.toString()", "Error: HIERARCHY_REQUEST_ERR: DOM Exception 3");
+shouldBeEqualToString("Object.prototype.toString.call(e)", "[object DOMException]");
+shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object DOMExceptionPrototype]");
+shouldBeEqualToString("e.constructor.toString()", "[object DOMExceptionConstructor]");
+shouldBe("e.constructor", "window.DOMException");
+shouldBe("e.HIERARCHY_REQUEST_ERR", "e.constructor.HIERARCHY_REQUEST_ERR");
+shouldBe("e.HIERARCHY_REQUEST_ERR", "3");
+
+var successfullyParsed = true;
index bf77dca8299c626614a6fde03841195ac6f5ecf9..18426c2930d3801c8609b7805289b7dbe4d4ea30 100644 (file)
@@ -268,6 +268,41 @@ window.Comment.prototype [printed above as window.CharacterData.prototype]
 window.Counter [object CounterConstructor]
 window.Counter.prototype [object CounterPrototype]
 window.DOMException [object DOMExceptionConstructor]
+window.DOMException.DOMSTRING_SIZE_ERR [number]
+window.DOMException.HIERARCHY_REQUEST_ERR [number]
+window.DOMException.INDEX_SIZE_ERR [number]
+window.DOMException.INUSE_ATTRIBUTE_ERR [number]
+window.DOMException.INVALID_ACCESS_ERR [number]
+window.DOMException.INVALID_CHARACTER_ERR [number]
+window.DOMException.INVALID_MODIFICATION_ERR [number]
+window.DOMException.INVALID_STATE_ERR [number]
+window.DOMException.NAMESPACE_ERR [number]
+window.DOMException.NOT_FOUND_ERR [number]
+window.DOMException.NOT_SUPPORTED_ERR [number]
+window.DOMException.NO_DATA_ALLOWED_ERR [number]
+window.DOMException.NO_MODIFICATION_ALLOWED_ERR [number]
+window.DOMException.SYNTAX_ERR [number]
+window.DOMException.TYPE_MISMATCH_ERR [number]
+window.DOMException.VALIDATION_ERR [number]
+window.DOMException.WRONG_DOCUMENT_ERR [number]
+window.DOMException.prototype [object DOMExceptionPrototype]
+window.DOMException.prototype.DOMSTRING_SIZE_ERR [number]
+window.DOMException.prototype.HIERARCHY_REQUEST_ERR [number]
+window.DOMException.prototype.INDEX_SIZE_ERR [number]
+window.DOMException.prototype.INUSE_ATTRIBUTE_ERR [number]
+window.DOMException.prototype.INVALID_ACCESS_ERR [number]
+window.DOMException.prototype.INVALID_CHARACTER_ERR [number]
+window.DOMException.prototype.INVALID_MODIFICATION_ERR [number]
+window.DOMException.prototype.INVALID_STATE_ERR [number]
+window.DOMException.prototype.NAMESPACE_ERR [number]
+window.DOMException.prototype.NOT_FOUND_ERR [number]
+window.DOMException.prototype.NOT_SUPPORTED_ERR [number]
+window.DOMException.prototype.NO_DATA_ALLOWED_ERR [number]
+window.DOMException.prototype.NO_MODIFICATION_ALLOWED_ERR [number]
+window.DOMException.prototype.SYNTAX_ERR [number]
+window.DOMException.prototype.TYPE_MISMATCH_ERR [number]
+window.DOMException.prototype.VALIDATION_ERR [number]
+window.DOMException.prototype.WRONG_DOCUMENT_ERR [number]
 window.DOMImplementation [object DOMImplementationConstructor]
 window.DOMImplementation.prototype [object DOMImplementationPrototype]
 window.DOMImplementation.prototype.createCSSStyleSheet [function]
index b7818e459246297d02c0b8a14b26bba257dcd9e2..39ea80b261905a59b45187a64a427046ce53dbb2 100644 (file)
@@ -1,3 +1,3 @@
 Test the behavior of a sync XMLHttpRequest that encounters an infinite redirection loop.
 
-Exception Error; code=101; number=undefined (0); message='NETWORK_ERR: XMLHttpRequest Exception 101'
+Exception NETWORK_ERR; code=101; number=undefined (0); message='NETWORK_ERR: XMLHttpRequest Exception 101'
index a46ec215c0edaccb083d04cf7e13f46de29126a1..cbdf94120653be709f05a7bdcd166800f86dfb29 100644 (file)
@@ -1,3 +1,48 @@
+2007-12-31  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Darin.
+
+        Patch for http://bugs.webkit.org/show_bug.cgi?id=16637
+        Acid3 expects ExeceptionCode constants to be defined on DOMException objects
+
+        - Make DOMException a real JS object.
+
+        Test: fast/dom/DOMException/prototype-object.html
+
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        This is no longer needed as the autogenerated classes now includes the
+        constructor.
+        * bindings/js/JSDOMExceptionConstructor.cpp: Removed.
+        * bindings/js/JSDOMExceptionConstructor.h: Removed.
+
+        Create on demand and use the new class for DOMExceptions.
+        * bindings/js/kjs_binding.cpp:
+        (KJS::setDOMException):
+
+        Remove no longer needed custom constructor getter.
+        * bindings/js/kjs_window.cpp:
+        (KJS::Window::getValueProperty):
+
+        Don't expose DOMCoreException as the name of class by special casing
+        the user visible class name to be DOMException.
+        * bindings/scripts/CodeGeneratorJS.pm:
+
+        The DOMException class/file needs to be named DOMCoreException because there is
+        name conflict with one of the Objective-C bindings classes.  It should be renamed
+        to DOMException when the Objective-C bindings are moved into WebKit.
+        * dom/DOMCoreException.cpp: Added.
+        (WebCore::DOMCoreException::DOMCoreException):
+        (WebCore::DOMCoreException::toString):
+        * dom/DOMCoreException.h: Added.
+        (WebCore::DOMCoreException::):
+        (WebCore::DOMCoreException::code):
+        (WebCore::DOMCoreException::name):
+        (WebCore::DOMCoreException::message):
+        * dom/DOMCoreException.idl: Added.
+        * page/DOMWindow.idl:
+
 2007-12-31  Sam Weinig  <sam@webkit.org>
 
         Re-enable querySelector and querySelectorAll and touch the necessary files to not
index 16cb6126d36235520bb40f77c8d175b142eaf2c0..d4e0ad39414cc8adaee3409197964e8ad54b2be4 100644 (file)
@@ -332,12 +332,13 @@ all : \
     JSConsole.h \
     JSCounter.h \
     JSCSSStyleDeclaration.h \
-    JSDatabase.h \
+    JSDOMCoreException.h \
     JSDOMExceptionConstructor.lut.h \
     JSDOMImplementation.h \
     JSDOMParser.h \
     JSDOMSelection.h \
     JSDOMWindow.h \
+    JSDatabase.h \
     JSDocument.h \
     JSDocumentFragment.h \
     JSDocumentType.h \
index 70015f6e0ab155fbf94892fa67b0059f32deb0b4..b4ca3e19ea87a3c914a96b96be841bd4d8c57739 100644 (file)
                B27B28280CEF0C0700D39D54 /* JSSVGGlyphElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B27B28220CEF0C0700D39D54 /* JSSVGGlyphElement.h */; };
                B27B28290CEF0C0700D39D54 /* JSSVGMissingGlyphElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27B28230CEF0C0700D39D54 /* JSSVGMissingGlyphElement.cpp */; };
                B27B282A0CEF0C0700D39D54 /* JSSVGMissingGlyphElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B27B28240CEF0C0700D39D54 /* JSSVGMissingGlyphElement.h */; };
-               B27B28360CEF0C3600D39D54 /* CSSPropertyNames.in in Resources */ = {isa = PBXBuildFile; fileRef = B27B282B0CEF0C3500D39D54 /* CSSPropertyNames.in */; };
-               B27B28370CEF0C3600D39D54 /* CSSValueKeywords.in in Resources */ = {isa = PBXBuildFile; fileRef = B27B282C0CEF0C3500D39D54 /* CSSValueKeywords.in */; };
                B27B28380CEF0C3600D39D54 /* DOMSVGFontElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B27B282D0CEF0C3500D39D54 /* DOMSVGFontElement.h */; settings = {ATTRIBUTES = (); }; };
                B27B28390CEF0C3600D39D54 /* DOMSVGFontElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = B27B282E0CEF0C3500D39D54 /* DOMSVGFontElement.mm */; };
                B27B283A0CEF0C3600D39D54 /* DOMSVGFontElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = B27B282F0CEF0C3500D39D54 /* DOMSVGFontElementInternal.h */; };
                BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5A86820C33676000EEA649 /* DOMSelection.h */; };
                BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */; };
                BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */; };
+               BC60D6E90D28D83400B9918F /* DOMCoreException.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60D6E80D28D83400B9918F /* DOMCoreException.h */; };
+               BC60D6EC0D28D99900B9918F /* DOMCoreException.idl in Resources */ = {isa = PBXBuildFile; fileRef = BC60D6EB0D28D99900B9918F /* DOMCoreException.idl */; };
+               BC60D7C00D29A46300B9918F /* JSDOMCoreException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC60D7BE0D29A46300B9918F /* JSDOMCoreException.cpp */; };
+               BC60D7C10D29A46300B9918F /* JSDOMCoreException.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60D7BF0D29A46300B9918F /* JSDOMCoreException.h */; };
+               BC60D8040D29A9E800B9918F /* DOMCoreException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC60D8030D29A9E800B9918F /* DOMCoreException.cpp */; };
                BC64B4CB0CB4295D005F2B62 /* CachedFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4C90CB4295D005F2B62 /* CachedFont.cpp */; };
                BC64B4CC0CB4295D005F2B62 /* CachedFont.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4CA0CB4295D005F2B62 /* CachedFont.h */; };
                BC64B4D50CB4298A005F2B62 /* CSSFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */; };
                BCD9C2630C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */; };
                BCD9C2640C17AA67005C90A2 /* JSNodeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2600C17AA67005C90A2 /* JSNodeCustom.cpp */; };
                BCD9C2650C17AA67005C90A2 /* JSNodeListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */; };
-               BCD9C26E0C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2680C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp */; };
-               BCD9C26F0C17AA81005C90A2 /* JSDOMExceptionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2690C17AA81005C90A2 /* JSDOMExceptionConstructor.h */; };
                BCD9C2700C17AA81005C90A2 /* JSEventTargetNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C26A0C17AA81005C90A2 /* JSEventTargetNode.cpp */; };
                BCD9C2710C17AA81005C90A2 /* JSEventTargetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C26B0C17AA81005C90A2 /* JSEventTargetNode.h */; };
                BCD9C2720C17AA81005C90A2 /* JSNamedNodesCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C26C0C17AA81005C90A2 /* JSNamedNodesCollection.cpp */; };
                B27B28220CEF0C0700D39D54 /* JSSVGGlyphElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGGlyphElement.h; sourceTree = "<group>"; };
                B27B28230CEF0C0700D39D54 /* JSSVGMissingGlyphElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGMissingGlyphElement.cpp; sourceTree = "<group>"; };
                B27B28240CEF0C0700D39D54 /* JSSVGMissingGlyphElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGMissingGlyphElement.h; sourceTree = "<group>"; };
-               B27B282B0CEF0C3500D39D54 /* CSSPropertyNames.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSPropertyNames.in; sourceTree = "<group>"; };
-               B27B282C0CEF0C3500D39D54 /* CSSValueKeywords.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValueKeywords.in; sourceTree = "<group>"; };
                B27B282D0CEF0C3500D39D54 /* DOMSVGFontElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGFontElement.h; sourceTree = "<group>"; };
                B27B282E0CEF0C3500D39D54 /* DOMSVGFontElement.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGFontElement.mm; sourceTree = "<group>"; };
                B27B282F0CEF0C3500D39D54 /* DOMSVGFontElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGFontElementInternal.h; sourceTree = "<group>"; };
                BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMSelection.cpp; sourceTree = "<group>"; };
                BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDOMSelection.h; sourceTree = "<group>"; };
                BC5EC1760A507E3E006007F5 /* view-source.css */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "view-source.css"; sourceTree = "<group>"; };
+               BC60D6E80D28D83400B9918F /* DOMCoreException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCoreException.h; sourceTree = "<group>"; };
+               BC60D6EB0D28D99900B9918F /* DOMCoreException.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCoreException.idl; sourceTree = "<group>"; };
+               BC60D7BE0D29A46300B9918F /* JSDOMCoreException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMCoreException.cpp; sourceTree = "<group>"; };
+               BC60D7BF0D29A46300B9918F /* JSDOMCoreException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMCoreException.h; sourceTree = "<group>"; };
+               BC60D8030D29A9E800B9918F /* DOMCoreException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCoreException.cpp; sourceTree = "<group>"; };
                BC64B4C90CB4295D005F2B62 /* CachedFont.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedFont.cpp; sourceTree = "<group>"; };
                BC64B4CA0CB4295D005F2B62 /* CachedFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFont.h; sourceTree = "<group>"; };
                BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFace.cpp; sourceTree = "<group>"; };
                BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNamedNodeMapCustom.cpp; sourceTree = "<group>"; };
                BCD9C2600C17AA67005C90A2 /* JSNodeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeCustom.cpp; sourceTree = "<group>"; };
                BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeListCustom.cpp; sourceTree = "<group>"; };
-               BCD9C2680C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMExceptionConstructor.cpp; sourceTree = "<group>"; };
-               BCD9C2690C17AA81005C90A2 /* JSDOMExceptionConstructor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDOMExceptionConstructor.h; sourceTree = "<group>"; };
                BCD9C26A0C17AA81005C90A2 /* JSEventTargetNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventTargetNode.cpp; sourceTree = "<group>"; };
                BCD9C26B0C17AA81005C90A2 /* JSEventTargetNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSEventTargetNode.h; sourceTree = "<group>"; };
                BCD9C26C0C17AA81005C90A2 /* JSNamedNodesCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNamedNodesCollection.cpp; sourceTree = "<group>"; };
                85B232260A8BF3A100FDF47B /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
-                               B27B282B0CEF0C3500D39D54 /* CSSPropertyNames.in */,
-                               B27B282C0CEF0C3500D39D54 /* CSSValueKeywords.in */,
                                85967D9F0AA8BB59005FEDEE /* Core */,
                                85967DCA0AA8BF0F005FEDEE /* CSS */,
                                85AFA7AB0AAF3BB000E84305 /* Events */,
                A83B79100CCB001B000B0825 /* Core */ = {
                        isa = PBXGroup;
                        children = (
+                               BC60D7BE0D29A46300B9918F /* JSDOMCoreException.cpp */,
+                               BC60D7BF0D29A46300B9918F /* JSDOMCoreException.h */,
                                65DF31D809D1C122000BE325 /* JSAttr.cpp */,
                                65DF31D909D1C123000BE325 /* JSAttr.h */,
                                93F9B79E0BA6032600854064 /* JSCDATASection.cpp */,
                                D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */,
                                65DF31EF09D1CC60000BE325 /* JSText.cpp */,
                                65DF31F009D1CC60000BE325 /* JSText.h */,
+                               65DF31ED09D1CC60000BE325 /* JSRange.cpp */,
+                               65DF31EE09D1CC60000BE325 /* JSRange.h */,
+                               D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */,
+                               D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */,
                        );
                        name = Core;
                        sourceTree = "<group>";
                                1432E8460C51493800B1500F /* GCController.h */,
                                E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */,
                                E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */,
-                               BCD9C2680C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp */,
-                               BCD9C2690C17AA81005C90A2 /* JSDOMExceptionConstructor.h */,
                                B25BE50E0D06B70800B524C6 /* JSEventTargetBase.cpp */,
                                B25BE50F0D06B70800B524C6 /* JSEventTargetBase.h */,
                                BCD9C26A0C17AA81005C90A2 /* JSEventTargetNode.cpp */,
                BC9854460CD3DA5F00069BC1 /* Ranges */ = {
                        isa = PBXGroup;
                        children = (
-                               65DF31ED09D1CC60000BE325 /* JSRange.cpp */,
-                               65DF31EE09D1CC60000BE325 /* JSRange.h */,
-                               D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */,
-                               D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */,
                        );
                        name = Ranges;
                        sourceTree = "<group>";
                                A8185F3209765765005826D9 /* DocumentType.cpp */,
                                A8185F3109765765005826D9 /* DocumentType.h */,
                                93EEC1E809C2877700C515D1 /* DocumentType.idl */,
+                               BC60D8030D29A9E800B9918F /* DOMCoreException.cpp */,
+                               BC60D6E80D28D83400B9918F /* DOMCoreException.h */,
+                               BC60D6EB0D28D99900B9918F /* DOMCoreException.idl */,
                                A8185F3609765765005826D9 /* DOMImplementation.cpp */,
                                A8185F3309765765005826D9 /* DOMImplementation.h */,
                                93EEC1E909C2877700C515D1 /* DOMImplementation.idl */,
                                51EC926A0CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h in Headers */,
                                1A3417C90CECFF250049CBDE /* JSCustomVoidCallback.h in Headers */,
                                E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */,
-                               BCD9C26F0C17AA81005C90A2 /* JSDOMExceptionConstructor.h in Headers */,
                                BCD9C2C60C17B6EC005C90A2 /* JSDOMExceptionConstructor.lut.h in Headers */,
                                65DF31F809D1CC60000BE325 /* JSDOMImplementation.h in Headers */,
                                1ACE53E00A8D18810022947D /* JSDOMParser.h in Headers */,
                                BC7FA62D0D1F0EFF00DB22A9 /* StaticNodeList.h in Headers */,
                                BC7FA6810D1F167900DB22A9 /* SelectorNodeList.h in Headers */,
                                BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */,
+                               BC60D6E90D28D83400B9918F /* DOMCoreException.h in Headers */,
+                               BC60D7C10D29A46300B9918F /* JSDOMCoreException.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                B2A1F2AC0CEF0ABF00442F6A /* SVGFontElement.idl in Resources */,
                                B2A1F2AF0CEF0ABF00442F6A /* SVGGlyphElement.idl in Resources */,
                                B2A1F2B20CEF0ABF00442F6A /* SVGMissingGlyphElement.idl in Resources */,
-                               B27B28360CEF0C3600D39D54 /* CSSPropertyNames.in in Resources */,
-                               B27B28370CEF0C3600D39D54 /* CSSValueKeywords.in in Resources */,
+                               BC60D6EC0D28D99900B9918F /* DOMCoreException.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                51EC92690CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp in Sources */,
                                1A3417CA0CECFF250049CBDE /* JSCustomVoidCallback.cpp in Sources */,
                                E10B93C30B73C291003ED890 /* JSCustomXPathNSResolver.cpp in Sources */,
-                               BCD9C26E0C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp in Sources */,
                                65DF31F709D1CC60000BE325 /* JSDOMImplementation.cpp in Sources */,
                                1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */,
                                BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
                                BC7FA62E0D1F0EFF00DB22A9 /* StaticNodeList.cpp in Sources */,
                                BC7FA6820D1F167900DB22A9 /* SelectorNodeList.cpp in Sources */,
                                BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */,
+                               BC60D7C00D29A46300B9918F /* JSDOMCoreException.cpp in Sources */,
+                               BC60D8040D29A9E800B9918F /* DOMCoreException.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebCore/bindings/js/JSDOMExceptionConstructor.cpp b/WebCore/bindings/js/JSDOMExceptionConstructor.cpp
deleted file mode 100644 (file)
index 5006265..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2007 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 COMPUTER, 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 COMPUTER, 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 "JSDOMExceptionConstructor.h"
-
-#include "ExceptionCode.h"
-#include <kjs/object_object.h>
-
-#include "JSDOMExceptionConstructor.lut.h"
-
-namespace WebCore {
-
-using namespace KJS;
-
-const ClassInfo JSDOMExceptionConstructor::info = { "DOMExceptionConstructor", 0, 0 };
-
-/* Source for DOMExceptionConstructorTable. Use "make hashtables" to regenerate.
-@begin JSDOMExceptionConstructorTable 15
-  INDEX_SIZE_ERR                WebCore::INDEX_SIZE_ERR               DontDelete|ReadOnly
-  DOMSTRING_SIZE_ERR            WebCore::DOMSTRING_SIZE_ERR   DontDelete|ReadOnly
-  HIERARCHY_REQUEST_ERR         WebCore::HIERARCHY_REQUEST_ERR        DontDelete|ReadOnly
-  WRONG_DOCUMENT_ERR            WebCore::WRONG_DOCUMENT_ERR   DontDelete|ReadOnly
-  INVALID_CHARACTER_ERR         WebCore::INVALID_CHARACTER_ERR        DontDelete|ReadOnly
-  NO_DATA_ALLOWED_ERR           WebCore::NO_DATA_ALLOWED_ERR  DontDelete|ReadOnly
-  NO_MODIFICATION_ALLOWED_ERR   WebCore::NO_MODIFICATION_ALLOWED_ERR  DontDelete|ReadOnly
-  NOT_FOUND_ERR                 WebCore::NOT_FOUND_ERR                DontDelete|ReadOnly
-  NOT_SUPPORTED_ERR             WebCore::NOT_SUPPORTED_ERR    DontDelete|ReadOnly
-  INUSE_ATTRIBUTE_ERR           WebCore::INUSE_ATTRIBUTE_ERR  DontDelete|ReadOnly
-  INVALID_STATE_ERR             WebCore::INVALID_STATE_ERR    DontDelete|ReadOnly
-  SYNTAX_ERR                    WebCore::SYNTAX_ERR           DontDelete|ReadOnly
-  INVALID_MODIFICATION_ERR      WebCore::INVALID_MODIFICATION_ERR     DontDelete|ReadOnly
-  NAMESPACE_ERR                 WebCore::NAMESPACE_ERR                DontDelete|ReadOnly
-  INVALID_ACCESS_ERR            WebCore::INVALID_ACCESS_ERR   DontDelete|ReadOnly
-@end
-*/
-
-JSDOMExceptionConstructor::JSDOMExceptionConstructor(ExecState* exec) 
-{ 
-    setPrototype(exec->lexicalGlobalObject()->objectPrototype());
-}
-
-bool JSDOMExceptionConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
-    return getStaticValueSlot<JSDOMExceptionConstructor, DOMObject>(exec, &JSDOMExceptionConstructorTable, this, propertyName, slot);
-}
-
-JSValue* JSDOMExceptionConstructor::getValueProperty(ExecState*, int token) const
-{
-    // We use the token as the value to return directly
-    return jsNumber(token);
-}
-
-JSObject* getDOMExceptionConstructor(ExecState* exec)
-{
-    return cacheGlobalObject<JSDOMExceptionConstructor>(exec, "[[DOMException.constructor]]");
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/js/JSDOMExceptionConstructor.h b/WebCore/bindings/js/JSDOMExceptionConstructor.h
deleted file mode 100644 (file)
index e7c78da..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2007 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 COMPUTER, 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 COMPUTER, 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 JSDOMExceptionConstructor_h
-#define JSDOMExceptionConstructor_h
-
-#include "kjs_binding.h"
-
-namespace WebCore {
-
-    // Constructor for DOMException - constructor stuff not implemented yet
-    class JSDOMExceptionConstructor : public KJS::DOMObject {
-    public:
-        JSDOMExceptionConstructor(KJS::ExecState*);
-
-        virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);
-        KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;
-        // no put - all read-only
-
-        virtual const KJS::ClassInfo* classInfo() const { return &info; }
-        static const KJS::ClassInfo info;
-    };
-
-    KJS::JSObject* getDOMExceptionConstructor(KJS::ExecState*);
-
-} // namespace WebCore
-
-#endif // JSDOMExceptionConstructor_h
index 6602c2c2d6add0f75d39d6e492ce3e232a16d0b1..256b87ff22c35d61f386479438ed625c0a84da03 100644 (file)
 #include "config.h"
 #include "kjs_binding.h"
 
+#include "DOMCoreException.h"
 #include "ExceptionCode.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
+#include "JSDOMCoreException.h"
 #include "JSNode.h"
 #include "XMLHttpRequest.h"
 
@@ -266,24 +268,9 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
         return;
     }
 
-    ExceptionCodeDescription description;
-    getExceptionCodeDescription(ec, description);
-
-    // 100 characters is a big enough buffer, because there are:
-    //   13 characters in the message
-    //   10 characters in the longest type name
-    //   27 characters in the longest exception name
-    //   20 or so digits in the longest integer's ASCII form (even if int is 64-bit)
-    //   1 byte for a null character
-    // That adds up to about 70 bytes.
-    char buffer[100];
-    if (description.name)
-        sprintf(buffer, "%s: %s Exception %d", description.name, description.typeName, description.code);
-    else
-        sprintf(buffer, "%s Exception %d", description.typeName, description.code);
-
-    JSObject* errorObject = throwError(exec, GeneralError, buffer);
-    errorObject->put(exec, "code", jsNumber(description.code));
+    DOMCoreException* exception = new DOMCoreException(ec);
+    JSValue* errorObject = toJS(exec, exception);
+    exec->setException(errorObject);
 }
 
-}
+} // namespace KJS
index d29d0ef68aeda80417506a9b6d6cb4db9864e092..496749b6912b18e641b161f27c8d71aabfe372cd 100644 (file)
@@ -39,7 +39,6 @@
 #include "FrameTree.h"
 #include "GCController.h"
 #include "HTMLDocument.h"
-#include "JSDOMExceptionConstructor.h"
 #include "JSDOMWindow.h"
 #include "JSEvent.h"
 #include "JSHTMLAudioElementConstructor.h"
@@ -194,7 +193,6 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable };
   onbeforeunload        Window::Onbeforeunload      DontDelete
 # -- Constructors --
   Audio                 Window::Audio               DontDelete
-  DOMException          Window::DOMException        DontDelete
   Image                 Window::Image               DontDelete
   Option                Window::Option              DontDelete
   XMLHttpRequest        Window::XMLHttpRequest      DontDelete
@@ -460,10 +458,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
    switch (token) {
    case Crypto:
       return jsUndefined(); // FIXME: implement this
-   case DOMException:
-      if (!allowsAccessFrom(exec))
-        return jsUndefined();
-      return getDOMExceptionConstructor(exec);
     case Event_:
       if (!allowsAccessFrom(exec))
         return jsUndefined();
index d9a449058c358a40f57646dd70111444e648a27e..03f6e5c1a989c40e202699c9103876e1d822fb87 100644 (file)
@@ -133,6 +133,14 @@ sub GetLegacyHeaderIncludes
     die "Don't know what headers to include for module $module";
 }
 
+sub GetVisibleClassName
+{
+    my $className = shift;
+
+    return "DOMException" if $className eq "DOMCoreException";
+    return $className;
+}
+
 sub AvoidInclusionOfType
 {
     my $type = shift;
@@ -563,6 +571,7 @@ sub GenerateImplementation
     my $hasParent = $hasLegacyParent || $hasRealParent;
     my $parentClassName = GetParentClassName($dataNode);
     my $conditional = $dataNode->extendedAttributes->{"Conditional"};
+    my $visibleClassName = GetVisibleClassName($interfaceName);
 
     # - Add default header template
     @implContentHeader = split("\r", $headerTemplate);
@@ -674,7 +683,7 @@ sub GenerateImplementation
         my $protoClassName;
         $protoClassName = "${className}Prototype";
 
-        push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $dataNode->extendedAttributes->{"CanBeConstructed"}));
+        push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $visibleClassName, $dataNode->extendedAttributes->{"CanBeConstructed"}));
     }
 
     # - Add functions and constants to a hashtable definition
@@ -722,7 +731,7 @@ sub GenerateImplementation
                                \@hashKeys, \@hashValues,
                                \@hashSpecials, \@hashParameters);
 
-    push(@implContent, "const ClassInfo ${className}Prototype::info = { \"${interfaceName}Prototype\", 0, &${className}PrototypeTable };\n\n");
+    push(@implContent, "const ClassInfo ${className}Prototype::info = { \"${visibleClassName}Prototype\", 0, &${className}PrototypeTable };\n\n");
     if ($dataNode->extendedAttributes->{"DoNotCache"}) {
         push(@implContent, "JSObject* ${className}Prototype::self()\n");
         push(@implContent, "{\n");
@@ -753,7 +762,7 @@ sub GenerateImplementation
     }
 
     # - Initialize static ClassInfo object
-    push(@implContent, "const ClassInfo $className" . "::info = { \"$interfaceName\", ");
+    push(@implContent, "const ClassInfo $className" . "::info = { \"${visibleClassName}\", ");
     if ($hasParent) {
         push(@implContent, "&" .$parentClassName . "::info, ");
     } else {
@@ -1734,6 +1743,7 @@ sub constructorFor
     my $className = shift;
     my $protoClassName = shift;
     my $interfaceName = shift;
+    my $visibleClassName = shift;
     my $canConstruct = shift;
 
 my $implContent = << "EOF";
@@ -1762,7 +1772,7 @@ EOF
 $implContent .= << "EOF";
 };
 
-const ClassInfo ${className}Constructor::info = { "${interfaceName}Constructor", 0, &${className}ConstructorTable };
+const ClassInfo ${className}Constructor::info = { "${visibleClassName}Constructor", 0, &${className}ConstructorTable };
 
 bool ${className}Constructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
diff --git a/WebCore/dom/DOMCoreException.cpp b/WebCore/dom/DOMCoreException.cpp
new file mode 100644 (file)
index 0000000..6028c75
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "DOMCoreException.h"
+
+namespace WebCore {
+
+DOMCoreException::DOMCoreException(ExceptionCode ec)
+{
+    ExceptionCodeDescription description;
+    getExceptionCodeDescription(ec, description);
+
+    m_code = description.code;
+
+    if (description.name) {
+        m_name = description.name;
+        m_message = String::format("%s: %s Exception %d", description.name, description.typeName, description.code);
+    } else
+        m_message = String::format("%s Exception %d", description.typeName, description.code);
+}
+
+String DOMCoreException::toString() const
+{
+    return "Error: " + m_message;
+}
+
+} // namespace WebCore
diff --git a/WebCore/dom/DOMCoreException.h b/WebCore/dom/DOMCoreException.h
new file mode 100644 (file)
index 0000000..73aa4e2
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 DOMCoreException_h
+#define DOMCodeException_h
+
+#include "ExceptionCode.h"
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+    class DOMCoreException : public RefCounted<DOMCoreException> {
+    public:
+        DOMCoreException(ExceptionCode);
+
+        // FIXME: this is copied from ExceptionCode.h, it needs to be kept in sync.
+        enum {
+            INDEX_SIZE_ERR = 1,
+            DOMSTRING_SIZE_ERR = 2,
+            HIERARCHY_REQUEST_ERR = 3,
+            WRONG_DOCUMENT_ERR = 4,
+            INVALID_CHARACTER_ERR = 5,
+            NO_DATA_ALLOWED_ERR = 6,
+            NO_MODIFICATION_ALLOWED_ERR = 7,
+            NOT_FOUND_ERR = 8,
+            NOT_SUPPORTED_ERR = 9,
+            INUSE_ATTRIBUTE_ERR = 10,
+
+            // Introduced in DOM Level 2:
+            INVALID_STATE_ERR = 11,
+            SYNTAX_ERR = 12,
+            INVALID_MODIFICATION_ERR = 13,
+            NAMESPACE_ERR = 14,
+            INVALID_ACCESS_ERR = 15,
+
+            // Introduced in DOM Level 3:
+            VALIDATION_ERR = 16,
+            TYPE_MISMATCH_ERR = 17
+        };
+
+        int code() const { return m_code; }
+        String name() const { return m_name; }
+        String message() const { return m_message; }
+
+        String toString() const;
+
+    private:
+        int m_code;
+        String m_name;
+        String m_message;
+    };
+
+} // namespace WebCore
+
+#endif // DOMCoreException_h
diff --git a/WebCore/dom/DOMCoreException.idl b/WebCore/dom/DOMCoreException.idl
new file mode 100644 (file)
index 0000000..2900982
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+module core {
+
+    interface [
+        GenerateConstructor
+    ] DOMCoreException {
+
+        readonly attribute unsigned short   code;
+        readonly attribute DOMString        name;
+        readonly attribute DOMString        message;
+
+#if defined(LANGUAGE_JAVASCRIPT)
+        // Override in a Mozilla compatible format
+        [DontEnum] DOMString toString();
+#endif
+
+        // ExceptionCode
+        const unsigned short      INDEX_SIZE_ERR                 = 1;
+        const unsigned short      DOMSTRING_SIZE_ERR             = 2;
+        const unsigned short      HIERARCHY_REQUEST_ERR          = 3;
+        const unsigned short      WRONG_DOCUMENT_ERR             = 4;
+        const unsigned short      INVALID_CHARACTER_ERR          = 5;
+        const unsigned short      NO_DATA_ALLOWED_ERR            = 6;
+        const unsigned short      NO_MODIFICATION_ALLOWED_ERR    = 7;
+        const unsigned short      NOT_FOUND_ERR                  = 8;
+        const unsigned short      NOT_SUPPORTED_ERR              = 9;
+        const unsigned short      INUSE_ATTRIBUTE_ERR            = 10;
+        // Introduced in DOM Level 2:
+        const unsigned short      INVALID_STATE_ERR              = 11;
+        // Introduced in DOM Level 2:
+        const unsigned short      SYNTAX_ERR                     = 12;
+        // Introduced in DOM Level 2:
+        const unsigned short      INVALID_MODIFICATION_ERR       = 13;
+        // Introduced in DOM Level 2:
+        const unsigned short      NAMESPACE_ERR                  = 14;
+        // Introduced in DOM Level 2:
+        const unsigned short      INVALID_ACCESS_ERR             = 15;
+        // Introduced in DOM Level 3:
+        const unsigned short      VALIDATION_ERR                 = 16;
+        // Introduced in DOM Level 3:
+        const unsigned short      TYPE_MISMATCH_ERR              = 17;
+    };
+}
index 53345522b92255bb8ab4944952ca508028561ec1..1d6812522f8901869f0de6ce9581375c56dcb418 100644 (file)
@@ -153,7 +153,7 @@ module window {
         attribute StyleSheetListConstructor StyleSheetList;
 
         // FIXME: Implement the commented-out global constructors for interfaces listed in DOM Level 3 Core specification.
-//        attribute DOMExceptionConstructor DOMException;
+        attribute DOMCoreExceptionConstructor DOMException;
 //        attribute DOMStringListConstructor DOMStringList;
 //        attribute NameListConstructor NameList;
 //        attribute DOMImplementationListConstructor DOMImplementationList;