Reviewed by Maciej.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Jan 2006 10:49:27 +0000 (10:49 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Jan 2006 10:49:27 +0000 (10:49 +0000)
        - http://bugzilla.opendarwin.org/show_bug.cgi?id=6642
          Split XMLHttpRequest class into JS binding and implementation

        * WebCore.xcodeproj/project.pbxproj: Adjusted for moved and renamed files.
        New group "xml" to match directory structure.
        * xml: Added.
        * khtml/ecma/JSXMLHttpRequest.cpp: Added.
        * khtml/ecma/JSXMLHttpRequest.h: Added.
        * khtml/ecma/xmlhttprequest.cpp: Removed.
        * khtml/ecma/xmlhttprequest.h: Removed.
        * xml/xmlhttprequest.cpp: Added.
        * xml/xmlhttprequest.h: Added.
        * khtml/ecma/kjs_binding.cpp:
        (KJS::jsStringOrUndefined): Moved from kjs_events.cpp.
        * khtml/ecma/kjs_binding.h: Added prototype for jsStringOrUndefined().
        * khtml/ecma/kjs_events.cpp: Removed jsStringOrUndefined().
        * khtml/ecma/kjs_window.cpp:
        (KJS::Window::getValueProperty): Use new class name for JSXMLHttpRequest.
        * kwq/KWQSlot.cpp: XMLHttpRequestQObject is now in WebCore, not KJS.
        * page/Frame.cpp:
        (Frame::stopLoading): XMLHttpRequest is now in WebCore, not KJS.

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

12 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/khtml/ecma/JSXMLHttpRequest.cpp [new file with mode: 0644]
WebCore/khtml/ecma/JSXMLHttpRequest.h [new file with mode: 0644]
WebCore/khtml/ecma/kjs_binding.cpp
WebCore/khtml/ecma/kjs_binding.h
WebCore/khtml/ecma/kjs_events.cpp
WebCore/khtml/ecma/kjs_window.cpp
WebCore/kwq/KWQSlot.cpp
WebCore/page/Frame.cpp
WebCore/xml/xmlhttprequest.cpp [moved from WebCore/khtml/ecma/xmlhttprequest.cpp with 59% similarity]
WebCore/xml/xmlhttprequest.h [moved from WebCore/khtml/ecma/xmlhttprequest.h with 61% similarity]

index 4e992c9af0a808f2729ccf0f51b890ba9a6b99c0..bc9c25e29b7eceacddd8db2fa56328fe9285252f 100644 (file)
@@ -1,3 +1,29 @@
+2006-01-22  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Maciej.
+
+        - http://bugzilla.opendarwin.org/show_bug.cgi?id=6642
+          Split XMLHttpRequest class into JS binding and implementation
+
+        * WebCore.xcodeproj/project.pbxproj: Adjusted for moved and renamed files.
+        New group "xml" to match directory structure.
+        * xml: Added.
+        * khtml/ecma/JSXMLHttpRequest.cpp: Added.
+        * khtml/ecma/JSXMLHttpRequest.h: Added.
+        * khtml/ecma/xmlhttprequest.cpp: Removed.
+        * khtml/ecma/xmlhttprequest.h: Removed.
+        * xml/xmlhttprequest.cpp: Added.
+        * xml/xmlhttprequest.h: Added.
+        * khtml/ecma/kjs_binding.cpp:
+        (KJS::jsStringOrUndefined): Moved from kjs_events.cpp.
+        * khtml/ecma/kjs_binding.h: Added prototype for jsStringOrUndefined().
+        * khtml/ecma/kjs_events.cpp: Removed jsStringOrUndefined().
+        * khtml/ecma/kjs_window.cpp: 
+        (KJS::Window::getValueProperty): Use new class name for JSXMLHttpRequest.
+        * kwq/KWQSlot.cpp: XMLHttpRequestQObject is now in WebCore, not KJS.
+        * page/Frame.cpp:
+        (Frame::stopLoading): XMLHttpRequest is now in WebCore, not KJS.
+
 2006-01-22  Alexander Kellett  <lypanov@kde.org>
 
         Reviewed by eseidel.
index aaf20f1644b966b30351702ecb16b9e22791edbe..d1901c064169ec9f15ba4e23adb8b5a7d12b7f92 100644 (file)
                93F199BD08245E59001E9ABC /* KWQAccObjectCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 55998A5C052B59CC0017A6C1 /* KWQAccObjectCache.h */; };
                93F199BE08245E59001E9ABC /* KWQExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A640F00533BB1F0085E777 /* KWQExceptions.h */; settings = {ATTRIBUTES = (); }; };
                93F199BF08245E59001E9ABC /* WebCoreGraphicsBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = BE26F15305517DE000BFA0C3 /* WebCoreGraphicsBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               93F199C008245E59001E9ABC /* xmlhttprequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 654E7EE10569FD4600358BD2 /* xmlhttprequest.h */; };
                93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199C308245E59001E9ABC /* xmlserializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 65912B0E0586921000123A69 /* xmlserializer.h */; };
                93F199C508245E59001E9ABC /* xbl_binding_manager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC41978E059293F30016347F /* xbl_binding_manager.h */; };
                93F19AE008245E59001E9ABC /* KWQAccObjectCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 55998A5D052B59CC0017A6C1 /* KWQAccObjectCache.mm */; };
                93F19AE108245E59001E9ABC /* KWQExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65F80697054D9F86008BF776 /* KWQExceptions.mm */; };
                93F19AE308245E59001E9ABC /* WebCoreGraphicsBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = BE26F15405517DE000BFA0C3 /* WebCoreGraphicsBridge.m */; };
-               93F19AE408245E59001E9ABC /* xmlhttprequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 654E7EE00569FD4600358BD2 /* xmlhttprequest.cpp */; };
                93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */; };
                93F19AE608245E59001E9ABC /* KWQKSSLKeyGen.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B24F056BF15F00D2B771 /* KWQKSSLKeyGen.mm */; };
                93F19AE708245E59001E9ABC /* xmlserializer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65912B0D0586921000123A69 /* xmlserializer.cpp */; };
                A88AD1F90952480A001DD196 /* KWQAccObjectCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 55998A5C052B59CC0017A6C1 /* KWQAccObjectCache.h */; };
                A88AD1FA0952480A001DD196 /* KWQExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A640F00533BB1F0085E777 /* KWQExceptions.h */; settings = {ATTRIBUTES = (); }; };
                A88AD1FB0952480A001DD196 /* WebCoreGraphicsBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = BE26F15305517DE000BFA0C3 /* WebCoreGraphicsBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               A88AD1FC0952480A001DD196 /* xmlhttprequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 654E7EE10569FD4600358BD2 /* xmlhttprequest.h */; };
                A88AD1FD0952480A001DD196 /* WebCoreKeyGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A88AD1FE0952480A001DD196 /* xmlserializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 65912B0E0586921000123A69 /* xmlserializer.h */; };
                A88AD1FF0952480A001DD196 /* xbl_binding_manager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC41978E059293F30016347F /* xbl_binding_manager.h */; };
                A88AD31C0952480A001DD196 /* KWQAccObjectCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 55998A5D052B59CC0017A6C1 /* KWQAccObjectCache.mm */; };
                A88AD31D0952480A001DD196 /* KWQExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65F80697054D9F86008BF776 /* KWQExceptions.mm */; };
                A88AD31F0952480A001DD196 /* WebCoreGraphicsBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = BE26F15405517DE000BFA0C3 /* WebCoreGraphicsBridge.m */; };
-               A88AD3200952480A001DD196 /* xmlhttprequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 654E7EE00569FD4600358BD2 /* xmlhttprequest.cpp */; };
                A88AD3210952480A001DD196 /* WebCoreKeyGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */; };
                A88AD3220952480A001DD196 /* KWQKSSLKeyGen.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B24F056BF15F00D2B771 /* KWQKSSLKeyGen.mm */; };
                A88AD3230952480A001DD196 /* xmlserializer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65912B0D0586921000123A69 /* xmlserializer.cpp */; };
                BCFB2F79097A2E1A00BA703D /* Arena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2F75097A2E1A00BA703D /* Arena.h */; };
                E1EE773708F1086C00166870 /* WebCoreTextDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE773508F1086C00166870 /* WebCoreTextDecoder.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E1EE773808F1086C00166870 /* WebCoreTextDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1EE773608F1086C00166870 /* WebCoreTextDecoder.mm */; };
+               E1F0424609839389006694EA /* xmlhttprequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F0424409839389006694EA /* xmlhttprequest.cpp */; };
+               E1F0424709839389006694EA /* xmlhttprequest.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F0424509839389006694EA /* xmlhttprequest.h */; };
+               E1F0424809839389006694EA /* xmlhttprequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F0424409839389006694EA /* xmlhttprequest.cpp */; };
+               E1F0424909839389006694EA /* xmlhttprequest.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F0424509839389006694EA /* xmlhttprequest.h */; };
+               E1F7F5600981AF570073BE6A /* JSXMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F7F55E0981AF570073BE6A /* JSXMLHttpRequest.cpp */; };
+               E1F7F5610981AF570073BE6A /* JSXMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F7F55F0981AF570073BE6A /* JSXMLHttpRequest.h */; };
+               E1F7F5620981AF570073BE6A /* JSXMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F7F55E0981AF570073BE6A /* JSXMLHttpRequest.cpp */; };
+               E1F7F5630981AF570073BE6A /* JSXMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F7F55F0981AF570073BE6A /* JSXMLHttpRequest.h */; };
                ED048ABC0833F132006E1E67 /* textAreaResizeCorner.tiff in Resources */ = {isa = PBXBuildFile; fileRef = ED048ABB0833F132006E1E67 /* textAreaResizeCorner.tiff */; };
                FAE0418B09759694000540BE /* RenderSVGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418909759694000540BE /* RenderSVGImage.h */; };
                FAE0418C09759694000540BE /* RenderSVGImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE0418A09759694000540BE /* RenderSVGImage.cpp */; };
                6543606E083DB9FB00C20475 /* wrap_contents_in_dummy_span_command.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wrap_contents_in_dummy_span_command.cpp; path = editing/wrap_contents_in_dummy_span_command.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                654D87B50831973B0082DCA1 /* edit_command.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = edit_command.cpp; path = editing/edit_command.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                654D87B60831973B0082DCA1 /* edit_command.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = edit_command.h; path = editing/edit_command.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               654E7EE00569FD4600358BD2 /* xmlhttprequest.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xmlhttprequest.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               654E7EE10569FD4600358BD2 /* xmlhttprequest.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = xmlhttprequest.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                654EC60F097778F500DAB52C /* WebCoreFrameBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreFrameBridge.h; sourceTree = "<group>"; };
                654EC610097778F500DAB52C /* WebCoreFrameBridge.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFrameBridge.mm; sourceTree = "<group>"; };
                6552E7A8096AA11B0006F248 /* WebCoreFrameNamespaces.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreFrameNamespaces.h; sourceTree = "<group>"; };
                BEF7EEA105FF8F0D009717EE /* KWQEditCommand.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQEditCommand.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                E1EE773508F1086C00166870 /* WebCoreTextDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreTextDecoder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                E1EE773608F1086C00166870 /* WebCoreTextDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreTextDecoder.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               E1F0424409839389006694EA /* xmlhttprequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xmlhttprequest.cpp; sourceTree = "<group>"; };
+               E1F0424509839389006694EA /* xmlhttprequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xmlhttprequest.h; sourceTree = "<group>"; };
+               E1F7F55E0981AF570073BE6A /* JSXMLHttpRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequest.cpp; sourceTree = "<group>"; };
+               E1F7F55F0981AF570073BE6A /* JSXMLHttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequest.h; sourceTree = "<group>"; };
                ED048ABB0833F132006E1E67 /* textAreaResizeCorner.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = textAreaResizeCorner.tiff; path = Resources/textAreaResizeCorner.tiff; sourceTree = "<group>"; };
                EDA4AC97076FB89100DD23EC /* edit_actions.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = edit_actions.h; path = editing/edit_actions.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F5117BC902F9FFEF018635CE /* KWQSignal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = KWQSignal.h; path = kwq/KWQSignal.h; sourceTree = SOURCE_ROOT; };
                                BCF1A5BA097832090061A123 /* platform */,
                                F523D2F302DE443B018635CA /* rendering */,
                                F523D16302DE42AE018635CA /* khtml */,
+                               E1F0424309839389006694EA /* xml */,
                                F58785E802DE377601EA4122 /* kwq */,
                                F58785E902DE378A01EA4122 /* WebCore SPI */,
                                A8C0FB51089701F700BA5114 /* kcanvas */,
                        name = editing;
                        sourceTree = "<group>";
                };
+               E1F0424309839389006694EA /* xml */ = {
+                       isa = PBXGroup;
+                       children = (
+                               E1F0424409839389006694EA /* xmlhttprequest.cpp */,
+                               E1F0424509839389006694EA /* xmlhttprequest.h */,
+                       );
+                       path = xml;
+                       sourceTree = "<group>";
+               };
                F523D15002DE4271018635CA /* other */ = {
                        isa = PBXGroup;
                        children = (
                                F523D20E02DE4369018635CA /* kjs_views.h */,
                                F523D21002DE4369018635CA /* kjs_window.cpp */,
                                F523D21102DE4369018635CA /* kjs_window.h */,
-                               654E7EE00569FD4600358BD2 /* xmlhttprequest.cpp */,
-                               654E7EE10569FD4600358BD2 /* xmlhttprequest.h */,
+                               E1F7F55E0981AF570073BE6A /* JSXMLHttpRequest.cpp */,
+                               E1F7F55F0981AF570073BE6A /* JSXMLHttpRequest.h */,
                                65912B0D0586921000123A69 /* xmlserializer.cpp */,
                                65912B0E0586921000123A69 /* xmlserializer.h */,
                                1A69D380085627410009880D /* domparser.cpp */,
                                93F199BD08245E59001E9ABC /* KWQAccObjectCache.h in Headers */,
                                93F199BE08245E59001E9ABC /* KWQExceptions.h in Headers */,
                                93F199BF08245E59001E9ABC /* WebCoreGraphicsBridge.h in Headers */,
-                               93F199C008245E59001E9ABC /* xmlhttprequest.h in Headers */,
                                93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */,
                                93F199C308245E59001E9ABC /* xmlserializer.h in Headers */,
                                93F199C508245E59001E9ABC /* xbl_binding_manager.h in Headers */,
                                A8DF4AEE0980C42C0052981B /* RenderTableRow.h in Headers */,
                                A8DF4AEF0980C42C0052981B /* RenderTableSection.h in Headers */,
                                A8DF4AF10980C42C0052981B /* RenderTableCol.h in Headers */,
+                               E1F7F5610981AF570073BE6A /* JSXMLHttpRequest.h in Headers */,
+                               E1F0424709839389006694EA /* xmlhttprequest.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A88AD1F90952480A001DD196 /* KWQAccObjectCache.h in Headers */,
                                A88AD1FA0952480A001DD196 /* KWQExceptions.h in Headers */,
                                A88AD1FB0952480A001DD196 /* WebCoreGraphicsBridge.h in Headers */,
-                               A88AD1FC0952480A001DD196 /* xmlhttprequest.h in Headers */,
                                A88AD1FD0952480A001DD196 /* WebCoreKeyGenerator.h in Headers */,
                                A88AD1FE0952480A001DD196 /* xmlserializer.h in Headers */,
                                A88AD1FF0952480A001DD196 /* xbl_binding_manager.h in Headers */,
                                A8DF4AF80980C42C0052981B /* RenderTableRow.h in Headers */,
                                A8DF4AF90980C42C0052981B /* RenderTableSection.h in Headers */,
                                A8DF4AFB0980C42C0052981B /* RenderTableCol.h in Headers */,
+                               E1F7F5630981AF570073BE6A /* JSXMLHttpRequest.h in Headers */,
+                               E1F0424909839389006694EA /* xmlhttprequest.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                932FC0DA0824A337005B3C75 /* KWQColorData.c */,
                                93EA68440824979000687F56 /* libxml2-WebCore */,
                                932FC38F0824BA30005B3C75 /* tokenizer.cpp */,
-                               932FC1710824A913005B3C75 /* xmlhttprequest.lut.h */,
+                               932FC1710824A913005B3C75 /* JSXMLHttpRequest.lut.h */,
                                932FC1730824A919005B3C75 /* xmlserializer.lut.h */,
                                A83C867D0911AA19009BF4A7 /* XSLTProcessor.lut.h */,
                                1A69D387085628650009880D /* domparser.lut.h */,
                                A88AD1110952480A001DD196 /* KWQColorData.c */,
                                A88AD1120952480A001DD196 /* libxml2-WebCore */,
                                A88AD1130952480A001DD196 /* tokenizer.cpp */,
-                               A88AD1140952480A001DD196 /* xmlhttprequest.lut.h */,
+                               A88AD1140952480A001DD196 /* JSXMLHttpRequest.lut.h */,
                                A88AD1150952480A001DD196 /* xmlserializer.lut.h */,
                                A88AD1160952480A001DD196 /* XSLTProcessor.lut.h */,
                                A88AD1170952480A001DD196 /* domparser.lut.h */,
                        shellPath = /bin/sh;
                        shellScript = "\"$CREATE_HASH_TABLE\" khtml/ecma/kjs_window.cpp > \"$DERIVED_FILE_DIR/kjs_window.lut.h\"";
                };
-               932FC1710824A913005B3C75 /* xmlhttprequest.lut.h */ = {
+               932FC1710824A913005B3C75 /* JSXMLHttpRequest.lut.h */ = {
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        inputPaths = (
                                "$(CREATE_HASH_TABLE)",
-                               khtml/ecma/xmlhttprequest.cpp,
+                               khtml/ecma/JSXMLHttpRequest.cpp,
                        );
-                       name = xmlhttprequest.lut.h;
+                       name = JSXMLHttpRequest.lut.h;
                        outputPaths = (
-                               "$(DERIVED_FILE_DIR)/xmlhttprequest.lut.h",
+                               "$(DERIVED_FILE_DIR)/JSXMLHttpRequest.lut.h",
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "\"$CREATE_HASH_TABLE\" khtml/ecma/xmlhttprequest.cpp > \"$DERIVED_FILE_DIR/xmlhttprequest.lut.h\"";
+                       shellScript = "\"$CREATE_HASH_TABLE\" khtml/ecma/JSXMLHttpRequest.cpp > \"$DERIVED_FILE_DIR/JSXMLHttpRequest.lut.h\"";
                };
                932FC1730824A919005B3C75 /* xmlserializer.lut.h */ = {
                        isa = PBXShellScriptBuildPhase;
                        shellPath = /bin/sh;
                        shellScript = "flex -t css/tokenizer.flex | perl css/maketokenizer > \"$DERIVED_FILE_DIR/tokenizer.cpp\"";
                };
-               A88AD1140952480A001DD196 /* xmlhttprequest.lut.h */ = {
+               A88AD1140952480A001DD196 /* JSXMLHttpRequest.lut.h */ = {
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        inputPaths = (
                                "$(CREATE_HASH_TABLE)",
-                               khtml/ecma/xmlhttprequest.cpp,
+                               khtml/ecma/JSXMLHttpRequest.cpp,
                        );
-                       name = xmlhttprequest.lut.h;
+                       name = JSXMLHttpRequest.lut.h;
                        outputPaths = (
-                               "$(DERIVED_FILE_DIR)/xmlhttprequest.lut.h",
+                               "$(DERIVED_FILE_DIR)/JSXMLHttpRequest.lut.h",
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "\"$CREATE_HASH_TABLE\" khtml/ecma/xmlhttprequest.cpp > \"$DERIVED_FILE_DIR/xmlhttprequest.lut.h\"";
+                       shellScript = "\"$CREATE_HASH_TABLE\" khtml/ecma/JSXMLHttpRequest.cpp > \"$DERIVED_FILE_DIR/JSXMLHttpRequest.lut.h\"";
                };
                A88AD1150952480A001DD196 /* xmlserializer.lut.h */ = {
                        isa = PBXShellScriptBuildPhase;
                                93F19AE008245E59001E9ABC /* KWQAccObjectCache.mm in Sources */,
                                93F19AE108245E59001E9ABC /* KWQExceptions.mm in Sources */,
                                93F19AE308245E59001E9ABC /* WebCoreGraphicsBridge.m in Sources */,
-                               93F19AE408245E59001E9ABC /* xmlhttprequest.cpp in Sources */,
                                93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */,
                                93F19AE608245E59001E9ABC /* KWQKSSLKeyGen.mm in Sources */,
                                93F19AE708245E59001E9ABC /* xmlserializer.cpp in Sources */,
                                A8DF4AEC0980C42C0052981B /* RenderTable.cpp in Sources */,
                                A8DF4AED0980C42C0052981B /* RenderTableSection.cpp in Sources */,
                                A8DF4AF00980C42C0052981B /* RenderTableRow.cpp in Sources */,
+                               E1F7F5600981AF570073BE6A /* JSXMLHttpRequest.cpp in Sources */,
+                               E1F0424609839389006694EA /* xmlhttprequest.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A88AD31C0952480A001DD196 /* KWQAccObjectCache.mm in Sources */,
                                A88AD31D0952480A001DD196 /* KWQExceptions.mm in Sources */,
                                A88AD31F0952480A001DD196 /* WebCoreGraphicsBridge.m in Sources */,
-                               A88AD3200952480A001DD196 /* xmlhttprequest.cpp in Sources */,
                                A88AD3210952480A001DD196 /* WebCoreKeyGenerator.m in Sources */,
                                A88AD3220952480A001DD196 /* KWQKSSLKeyGen.mm in Sources */,
                                A88AD3230952480A001DD196 /* xmlserializer.cpp in Sources */,
                                A8DF4AF60980C42C0052981B /* RenderTable.cpp in Sources */,
                                A8DF4AF70980C42C0052981B /* RenderTableSection.cpp in Sources */,
                                A8DF4AFA0980C42C0052981B /* RenderTableRow.cpp in Sources */,
+                               E1F7F5620981AF570073BE6A /* JSXMLHttpRequest.cpp in Sources */,
+                               E1F0424809839389006694EA /* xmlhttprequest.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebCore/khtml/ecma/JSXMLHttpRequest.cpp b/WebCore/khtml/ecma/JSXMLHttpRequest.cpp
new file mode 100644 (file)
index 0000000..822607f
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2004 Apple Computer, Inc.
+ *  Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+#include "JSXMLHttpRequest.h"
+#include "xmlhttprequest.h"
+
+#include "kjs_window.h"
+#include "kjs_events.h"
+
+#include "dom/dom_string.h"
+#include "html/html_documentimpl.h"
+
+#include "Frame.h"
+#include "JSXMLHttpRequest.lut.h"
+
+using namespace WebCore;
+
+
+namespace KJS {
+
+////////////////////// JSXMLHttpRequest Object ////////////////////////
+
+/* Source for JSXMLHttpRequestProtoTable.
+@begin JSXMLHttpRequestProtoTable 7
+  abort                 JSXMLHttpRequest::Abort                   DontDelete|Function 0
+  getAllResponseHeaders JSXMLHttpRequest::GetAllResponseHeaders   DontDelete|Function 0
+  getResponseHeader     JSXMLHttpRequest::GetResponseHeader       DontDelete|Function 1
+  open                  JSXMLHttpRequest::Open                    DontDelete|Function 5
+  overrideMimeType      JSXMLHttpRequest::OverrideMIMEType        DontDelete|Function 1
+  send                  JSXMLHttpRequest::Send                    DontDelete|Function 1
+  setRequestHeader      JSXMLHttpRequest::SetRequestHeader        DontDelete|Function 2
+@end
+*/
+KJS_DEFINE_PROTOTYPE(JSXMLHttpRequestProto)
+KJS_IMPLEMENT_PROTOFUNC(JSXMLHttpRequestProtoFunc)
+KJS_IMPLEMENT_PROTOTYPE("JSXMLHttpRequest", JSXMLHttpRequestProto, JSXMLHttpRequestProtoFunc)
+
+
+JSXMLHttpRequestConstructorImp::JSXMLHttpRequestConstructorImp(ExecState *exec, DocumentImpl *d)
+    : doc(d)
+{
+    putDirect(prototypePropertyName, JSXMLHttpRequestProto::self(exec), DontEnum|DontDelete|ReadOnly);
+}
+
+JSXMLHttpRequestConstructorImp::~JSXMLHttpRequestConstructorImp()
+{
+}
+
+bool JSXMLHttpRequestConstructorImp::implementsConstruct() const
+{
+  return true;
+}
+
+JSObject *JSXMLHttpRequestConstructorImp::construct(ExecState *exec, const List &)
+{
+  return new JSXMLHttpRequest(exec, doc.get());
+}
+
+const ClassInfo JSXMLHttpRequest::info = { "JSXMLHttpRequest", 0, &JSXMLHttpRequestTable, 0 };
+
+/* Source for JSXMLHttpRequestTable.
+@begin JSXMLHttpRequestTable 7
+  readyState            JSXMLHttpRequest::ReadyState              DontDelete|ReadOnly
+  responseText          JSXMLHttpRequest::ResponseText            DontDelete|ReadOnly
+  responseXML           JSXMLHttpRequest::ResponseXML             DontDelete|ReadOnly
+  status                JSXMLHttpRequest::Status                  DontDelete|ReadOnly
+  statusText            JSXMLHttpRequest::StatusText              DontDelete|ReadOnly
+  onreadystatechange    JSXMLHttpRequest::Onreadystatechange      DontDelete
+  onload                JSXMLHttpRequest::Onload                  DontDelete
+@end
+*/
+
+bool JSXMLHttpRequest::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
+{
+  return getStaticValueSlot<JSXMLHttpRequest, DOMObject>(exec, &JSXMLHttpRequestTable, this, propertyName, slot);
+}
+
+JSValue *JSXMLHttpRequest::getValueProperty(ExecState *exec, int token) const
+{
+  switch (token) {
+  case ReadyState:
+    return jsNumber(m_impl->getReadyState());
+  case ResponseText:
+    return jsStringOrNull(m_impl->getResponseText());
+  case ResponseXML: {
+    RefPtr<DocumentImpl> responseXML = m_impl->getResponseXML();
+    if (responseXML.get())
+      return getDOMNode(exec, responseXML.get());
+    else
+      return jsUndefined();
+  }
+  case Status:
+    int status = m_impl->getStatus();
+    return status > 0 ? jsNumber(status) : jsUndefined();
+  case StatusText:
+    return jsStringOrUndefined(m_impl->getStatusText());
+  case Onreadystatechange:
+   JSUnprotectedEventListener* onReadyStateChangeListener = static_cast<JSUnprotectedEventListener*>(m_impl->getOnReadyStateChangeListener().get());
+   if (onReadyStateChangeListener) {
+      JSObject* listenerObj = onReadyStateChangeListener->listenerObj();
+      if (listenerObj)
+        return listenerObj;
+   }
+   return jsNull();
+  case Onload:
+   JSUnprotectedEventListener* onLoadListener = static_cast<JSUnprotectedEventListener*>(m_impl->getOnLoadListener().get());
+   if (onLoadListener) {
+      JSObject* listenerObj = onLoadListener->listenerObj();
+      if (listenerObj)
+        return listenerObj;
+   }
+   return jsNull();
+  default:
+//    kdWarning() << "JSXMLHttpRequest::getValueProperty unhandled token " << token << endl;
+    return NULL;
+  }
+}
+
+void JSXMLHttpRequest::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
+{
+  lookupPut<JSXMLHttpRequest,DOMObject>(exec, propertyName, value, attr, &JSXMLHttpRequestTable, this );
+}
+
+void JSXMLHttpRequest::putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/)
+{
+  switch(token) {
+  case Onreadystatechange:
+    m_impl->setOnReadyStateChangeListener(Window::retrieveActive(exec)->getJSUnprotectedEventListener(value, true));
+    break;
+  case Onload:
+    m_impl->setOnLoadListener(Window::retrieveActive(exec)->getJSUnprotectedEventListener(value, true));
+    break;
+  default:
+      ;
+//    kdWarning() << "HTMLDocument::putValueProperty unhandled token " << token << endl;
+  }
+}
+
+void JSXMLHttpRequest::mark()
+{
+  DOMObject::mark();
+
+  JSUnprotectedEventListener* onReadyStateChangeListener = static_cast<JSUnprotectedEventListener*>(m_impl->getOnReadyStateChangeListener().get());
+  JSUnprotectedEventListener* onLoadListener = static_cast<JSUnprotectedEventListener*>(m_impl->getOnLoadListener().get());
+
+  if (onReadyStateChangeListener)
+    onReadyStateChangeListener->mark();
+
+  if (onLoadListener)
+    onLoadListener->mark();
+}
+
+
+JSXMLHttpRequest::JSXMLHttpRequest(ExecState *exec, DocumentImpl *d)
+  : m_impl(new XMLHttpRequest(d))
+{
+  setPrototype(JSXMLHttpRequestProto::self(exec));
+}
+
+JSXMLHttpRequest::~JSXMLHttpRequest()
+{
+}
+
+JSValue *JSXMLHttpRequestProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
+{
+  if (!thisObj->inherits(&JSXMLHttpRequest::info))
+    return throwError(exec, TypeError);
+
+  JSXMLHttpRequest *request = static_cast<JSXMLHttpRequest *>(thisObj);
+
+  switch (id) {
+  case JSXMLHttpRequest::Abort: {
+    request->m_impl->abort();
+    return jsUndefined();
+  }
+  case JSXMLHttpRequest::GetAllResponseHeaders: {
+    if (args.size() != 0) {
+      return jsUndefined();
+    }
+    
+    return jsStringOrUndefined(request->m_impl->getAllResponseHeaders());
+  }
+  case JSXMLHttpRequest::GetResponseHeader: {
+    if (args.size() != 1) {
+      return jsUndefined();
+    }
+    
+    DOMString header = request->m_impl->getResponseHeader(args[0]->toString(exec).domString());
+
+    if (header.isNull())
+      return jsUndefined();
+
+    return jsString(header);
+  }
+  case JSXMLHttpRequest::Open:
+    {
+      if (args.size() < 2 || args.size() > 5) {
+        return jsUndefined();
+      }
+    
+      DOMString method = args[0]->toString(exec).domString();
+      KURL url = KURL(Window::retrieveActive(exec)->frame()->document()->completeURL(args[1]->toString(exec).qstring()));
+
+      bool async = true;
+      if (args.size() >= 3)
+        async = args[2]->toBoolean(exec);
+    
+      DOMString user;
+      if (args.size() >= 4)
+        user = args[3]->toString(exec).domString();
+      
+      DOMString password;
+      if (args.size() >= 5)
+        password = args[4]->toString(exec).domString();
+
+      request->m_impl->open(method, url, async, user, password);
+
+      return jsUndefined();
+    }
+  case JSXMLHttpRequest::Send:
+    {
+      if (args.size() > 1) {
+        return jsUndefined();
+      }
+
+      DOMString body;
+
+      if (args.size() >= 1) {
+        if (args[0]->toObject(exec)->inherits(&DOMDocument::info)) {
+          DocumentImpl *doc = static_cast<DocumentImpl *>(static_cast<DOMDocument *>(args[0]->toObject(exec))->impl());
+          body = doc->toString().qstring();
+        } else {
+          // converting certain values (like null) to object can set an exception
+          exec->clearException();
+          body = args[0]->toString(exec).domString();
+        }
+      }
+
+      request->m_impl->send(body);
+
+      return jsUndefined();
+    }
+  case JSXMLHttpRequest::SetRequestHeader: {
+    if (args.size() != 2) {
+      return jsUndefined();
+    }
+    
+    request->m_impl->setRequestHeader(args[0]->toString(exec).domString(), args[1]->toString(exec).domString());
+    
+    return jsUndefined();
+  }
+  case JSXMLHttpRequest::OverrideMIMEType: {
+    if (args.size() != 1) {
+      return jsUndefined();
+    }
+    request->m_impl->overrideMIMEType(args[0]->toString(exec).domString());
+    return jsUndefined();
+  }
+  }
+
+  return jsUndefined();
+}
+
+} // end namespace
diff --git a/WebCore/khtml/ecma/JSXMLHttpRequest.h b/WebCore/khtml/ecma/JSXMLHttpRequest.h
new file mode 100644 (file)
index 0000000..ed588db
--- /dev/null
@@ -0,0 +1,69 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2003 Apple Computer, Inc.
+ *  Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef JSXMLHTTPREQUEST_H_
+#define JSXMLHTTPREQUEST_H_
+
+#include <kxmlcore/RefPtr.h>
+#include "kjs_binding.h"
+
+namespace WebCore {
+    class XMLHttpRequest;
+    class DocumentImpl;
+};
+
+
+namespace KJS {
+
+  class JSXMLHttpRequestConstructorImp : public JSObject {
+  public:
+    JSXMLHttpRequestConstructorImp(ExecState *exec, WebCore::DocumentImpl *d);
+    ~JSXMLHttpRequestConstructorImp();
+    virtual bool implementsConstruct() const;
+    virtual JSObject *construct(ExecState *exec, const List &args);
+  private:
+    RefPtr<WebCore::DocumentImpl> doc;
+  };
+
+  class JSXMLHttpRequest : public DOMObject {
+  public:
+    JSXMLHttpRequest(ExecState *, WebCore::DocumentImpl *d);
+    ~JSXMLHttpRequest();
+    virtual const ClassInfo* classInfo() const { return &info; }
+    static const ClassInfo info;
+    enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status,
+        StatusText, Abort, GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader,
+        OverrideMIMEType };
+
+    virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
+    JSValue *getValueProperty(ExecState *exec, int token) const;
+    virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
+    void putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/);
+    virtual bool toBoolean(ExecState *) const { return true; }
+    virtual void mark();
+
+  private:
+    friend class JSXMLHttpRequestProtoFunc;
+    RefPtr<WebCore::XMLHttpRequest> m_impl;
+  };
+} // namespace
+
+#endif
index 433ed22370953dc054788a667beff7c6b16eaa68..9fd604b10f0af9c9fcad5ed23c088e070f7f806a 100644 (file)
@@ -317,6 +317,13 @@ JSValue *jsStringOrNull(const DOMString &s)
     return jsString(s);
 }
 
+JSValue *jsStringOrUndefined(const DOMString &s)
+{
+    if (s.isNull())
+        return jsUndefined();
+    return jsString(s);
+}
+
 DOMString valueToStringWithNullCheck(ExecState *exec, JSValue *val)
 {
     if (val->isNull())
index 63f7f9737d1c05d54a936069537f0936d59a56d2..2d7684b8ebfbe8ce301b96b336f31107797a7fa6 100644 (file)
@@ -154,6 +154,11 @@ namespace KJS {
    */
   JSValue *jsStringOrNull(const DOM::DOMString&);
 
+  /**
+   *  Get a String object, or jsUndefined() if s is null
+   */
+  JSValue *jsStringOrUndefined(const WebCore::DOMString&);
+
   /**
    *  Get a DOMString object or a null DOMString if the value is null
    */
index 249f211503b6b0004689da31d67d6f039983bd2a..42e8126cfd0061673c6a8fd9ff18ebf7d6164c17 100644 (file)
@@ -44,13 +44,6 @@ using namespace HTMLNames;
 
 namespace KJS {
 
-static JSValue* jsStringOrUndefined(const DOMString& str)
-{
-    return str.isNull() ? jsUndefined() : jsString(str);
-}
-
-// -------------------------------------------------------------------------
-
 JSAbstractEventListener::JSAbstractEventListener(bool _html)
     : html(_html)
 {
index 59117e0e399ac36051fb8fb73fecfa62fd54593e..210d4c36d04e13907576bc2da702a78c47f370a6 100644 (file)
@@ -43,7 +43,7 @@
 #include "kjs_traversal.h"
 #include "kjs_css.h"
 #include "kjs_events.h"
-#include "xmlhttprequest.h"
+#include "JSXMLHttpRequest.h"
 #include "xmlserializer.h"
 #ifdef KHTML_XSLT
 #include "XSLTProcessor.h"
@@ -805,7 +805,7 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
     case Option:
       return new OptionConstructorImp(exec, m_frame->document());
     case XMLHttpRequest:
-      return new XMLHttpRequestConstructorImp(exec, m_frame->document());
+      return new JSXMLHttpRequestConstructorImp(exec, m_frame->document());
     case XMLSerializer:
       return new XMLSerializerConstructorImp(exec);
     case DOMParser:
index f39957b3730d6752f7ce9e71cf244f1e98d76c5c..27026f006924776b2729bed13510181195247c01 100644 (file)
@@ -54,7 +54,7 @@ using khtml::RenderWidget;
 using khtml::RenderScrollMediator;
 using KIO::Job;
 using KJS::WindowQObject;
-using KJS::XMLHttpRequestQObject;
+using WebCore::XMLHttpRequestQObject;
 #ifdef SVG_SUPPORT
 using KSVG::TimeScheduler;
 #endif
index ecef9c364df500774b6f93af866b4d4417a060cc..5ecc7bd30521a1248e6ab1b3c7934285eb19a3f7 100644 (file)
@@ -35,6 +35,7 @@
 #include "DocLoader.h"
 #include "EventNames.h"
 #include "FrameView.h"
+#include "NodeListImpl.h"
 #include "HTMLFormElementImpl.h"
 #include "HTMLGenericFormElementImpl.h"
 #include "Frame.h"
@@ -365,7 +366,7 @@ void Frame::stopLoading(bool sendUnload)
   if (DocumentImpl *doc = d->m_doc) {
     if (DocLoader *docLoader = doc->docLoader())
       Cache::loader()->cancelRequests(docLoader);
-    KJS::XMLHttpRequest::cancelRequests(doc);
+      XMLHttpRequest::cancelRequests(doc);
   }
 
   // tell all subframes to stop as well
similarity index 59%
rename from WebCore/khtml/ecma/xmlhttprequest.cpp
rename to WebCore/xml/xmlhttprequest.cpp
index 302de4bfa4d60f1a860210ee1f0951da4ba02ab3..c8ddb8d4a49ee96da1e957fa79d061dd1ffde2e8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  This file is part of the KDE libraries
  *  Copyright (C) 2004 Apple Computer, Inc.
- *  Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
+ *  Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
 #include "config.h"
 #include "xmlhttprequest.h"
 
-#include "kjs_window.h"
-#include "kjs_events.h"
+#include "kjs/protect.h"
 
 #include "dom/dom_exception.h"
 #include "dom/dom_string.h"
+#include "dom/dom2_events.h"
 #include "Cache.h"
 #include "html/html_documentimpl.h"
+#include "misc/formdata.h"
 #include "xml/dom2_eventsimpl.h"
 #include "xml/EventNames.h"
 #include "DOMImplementationImpl.h"
 
-#include "Frame.h"
-
-#include <kdebug.h>
 #include <kio/job.h>
 #include <qobject.h>
 #include <qregexp.h>
 
 #include "KWQLoader.h"
 
-#include "xmlhttprequest.lut.h"
-
-using namespace DOM;
-using namespace DOM::EventNames;
-
-using khtml::Decoder;
+using namespace WebCore::EventNames;
 
 static inline QString getMIMEType(const QString& contentTypeString)
 {
@@ -93,24 +86,7 @@ static QString getCharset(const QString& contentTypeString)
     return QString();
 }
 
-namespace KJS {
-
-////////////////////// XMLHttpRequest Object ////////////////////////
-
-/* Source for XMLHttpRequestProtoTable.
-@begin XMLHttpRequestProtoTable 7
-  abort                 XMLHttpRequest::Abort                   DontDelete|Function 0
-  getAllResponseHeaders XMLHttpRequest::GetAllResponseHeaders   DontDelete|Function 0
-  getResponseHeader     XMLHttpRequest::GetResponseHeader       DontDelete|Function 1
-  open                  XMLHttpRequest::Open                    DontDelete|Function 5
-  overrideMimeType      XMLHttpRequest::OverrideMIMEType        DontDelete|Function 1
-  send                  XMLHttpRequest::Send                    DontDelete|Function 1
-  setRequestHeader      XMLHttpRequest::SetRequestHeader        DontDelete|Function 2
-@end
-*/
-KJS_DEFINE_PROTOTYPE(XMLHttpRequestProto)
-KJS_IMPLEMENT_PROTOFUNC(XMLHttpRequestProtoFunc)
-KJS_IMPLEMENT_PROTOTYPE("XMLHttpRequest",XMLHttpRequestProto,XMLHttpRequestProtoFunc)
+namespace WebCore {
 
 XMLHttpRequestQObject::XMLHttpRequestQObject(XMLHttpRequest *_jsObject) 
 {
@@ -132,56 +108,20 @@ void XMLHttpRequestQObject::slotRedirection( KIO::Job* job, const KURL& url)
   jsObject->slotRedirection( job, url ); 
 }
 
-XMLHttpRequestConstructorImp::XMLHttpRequestConstructorImp(ExecState *exec, DOM::DocumentImpl *d)
-    : doc(d)
-{
-    putDirect(prototypePropertyName, XMLHttpRequestProto::self(exec), DontEnum|DontDelete|ReadOnly);
-}
-
-XMLHttpRequestConstructorImp::~XMLHttpRequestConstructorImp()
-{
-}
-
-bool XMLHttpRequestConstructorImp::implementsConstruct() const
+XMLHttpRequestState XMLHttpRequest::getReadyState() const
 {
-  return true;
+    return state;
 }
 
-JSObject *XMLHttpRequestConstructorImp::construct(ExecState *exec, const List &)
+DOMString XMLHttpRequest::getResponseText() const
 {
-  return new XMLHttpRequest(exec, doc.get());
+    return response;
 }
 
-const ClassInfo XMLHttpRequest::info = { "XMLHttpRequest", 0, &XMLHttpRequestTable, 0 };
-
-/* Source for XMLHttpRequestTable.
-@begin XMLHttpRequestTable 7
-  readyState            XMLHttpRequest::ReadyState              DontDelete|ReadOnly
-  responseText          XMLHttpRequest::ResponseText            DontDelete|ReadOnly
-  responseXML           XMLHttpRequest::ResponseXML             DontDelete|ReadOnly
-  status                XMLHttpRequest::Status                  DontDelete|ReadOnly
-  statusText            XMLHttpRequest::StatusText              DontDelete|ReadOnly
-  onreadystatechange    XMLHttpRequest::Onreadystatechange      DontDelete
-  onload                XMLHttpRequest::Onload                  DontDelete
-@end
-*/
-
-bool XMLHttpRequest::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
-{
-  return getStaticValueSlot<XMLHttpRequest, DOMObject>(exec, &XMLHttpRequestTable, this, propertyName, slot);
-}
-
-JSValue *XMLHttpRequest::getValueProperty(ExecState *exec, int token) const
+PassRefPtr<DocumentImpl> XMLHttpRequest::getResponseXML() const
 {
-  switch (token) {
-  case ReadyState:
-    return jsNumber(state);
-  case ResponseText:
-    return jsStringOrNull(DOM::DOMString(response));
-  case ResponseXML:
-    if (state != Completed) {
-      return jsUndefined();
-    }
+    if (state != Completed)
+      return 0;
 
     if (!createdDocument) {
       if (typeIsXML = responseIsXML()) {
@@ -197,65 +137,33 @@ JSValue *XMLHttpRequest::getValueProperty(ExecState *exec, int token) const
       createdDocument = true;
     }
 
-    if (!typeIsXML) {
-      return jsUndefined();
-    }
+    if (!typeIsXML)
+      return 0;
 
-    return getDOMNode(exec, responseXML.get());
-  case Status:
-    return getStatus();
-  case StatusText:
-    return getStatusText();
-  case Onreadystatechange:
-   if (onReadyStateChangeListener && onReadyStateChangeListener->listenerObj()) {
-     return onReadyStateChangeListener->listenerObj();
-   } else {
-     return jsNull();
-   }
-  case Onload:
-   if (onLoadListener && onLoadListener->listenerObj()) {
-     return onLoadListener->listenerObj();
-   } else {
-     return jsNull();
-   }
-  default:
-    kdWarning() << "XMLHttpRequest::getValueProperty unhandled token " << token << endl;
-    return NULL;
-  }
+    return responseXML;
 }
 
-void XMLHttpRequest::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
+PassRefPtr<EventListener> XMLHttpRequest::getOnReadyStateChangeListener() const
 {
-  lookupPut<XMLHttpRequest,DOMObject>(exec, propertyName, value, attr, &XMLHttpRequestTable, this );
+    return onReadyStateChangeListener;
 }
 
-void XMLHttpRequest::putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/)
+void XMLHttpRequest::setOnReadyStateChangeListener(EventListener* eventListener)
 {
-  switch(token) {
-  case Onreadystatechange:
-    onReadyStateChangeListener = Window::retrieveActive(exec)->getJSUnprotectedEventListener(value, true);
-    break;
-  case Onload:
-    onLoadListener = Window::retrieveActive(exec)->getJSUnprotectedEventListener(value, true);
-    break;
-  default:
-    kdWarning() << "HTMLDocument::putValueProperty unhandled token " << token << endl;
-  }
+    onReadyStateChangeListener = eventListener;
 }
 
-void XMLHttpRequest::mark()
+PassRefPtr<EventListener> XMLHttpRequest::getOnLoadListener() const
 {
-  DOMObject::mark();
-
-  if (onReadyStateChangeListener)
-    onReadyStateChangeListener->mark();
-
-  if (onLoadListener)
-    onLoadListener->mark();
+    return onLoadListener;
 }
 
+void XMLHttpRequest::setOnLoadListener(EventListener* eventListener)
+{
+    onLoadListener = eventListener;
+}
 
-XMLHttpRequest::XMLHttpRequest(ExecState *exec, DOM::DocumentImpl *d)
+XMLHttpRequest::XMLHttpRequest(DocumentImpl *d)
   : qObject(new XMLHttpRequestQObject(this)),
     doc(d),
     async(true),
@@ -264,7 +172,6 @@ XMLHttpRequest::XMLHttpRequest(ExecState *exec, DOM::DocumentImpl *d)
     createdDocument(false),
     aborted(false)
 {
-  setPrototype(XMLHttpRequestProto::self(exec));
 }
 
 XMLHttpRequest::~XMLHttpRequest()
@@ -312,7 +219,7 @@ bool XMLHttpRequest::urlMatchesDocumentDomain(const KURL& _url) const
   return false;
 }
 
-void XMLHttpRequest::open(const QString& _method, const KURL& _url, bool _async)
+void XMLHttpRequest::open(const DOMString& _method, const KURL& _url, bool _async, const DOMString& user, const DOMString& password)
 {
   abort();
   aborted = false;
@@ -334,9 +241,15 @@ void XMLHttpRequest::open(const QString& _method, const KURL& _url, bool _async)
     return;
   }
 
-  
-  method = _method;
   url = _url;
+
+  if (!user.isNull())
+    url.setUser(user.qstring());
+
+  if (!password.isNull())
+    url.setPass(password.qstring());
+
+  method = _method.qstring();
   async = _async;
 
   changeState(Loading);
@@ -347,6 +260,9 @@ void XMLHttpRequest::send(const DOMString& _body)
   if (!doc)
     return;
 
+  if (state != Loading)
+    return;
+  
   // FIXME: Should this abort instead if we already have a job going?
   if (job)
     return;
@@ -382,7 +298,7 @@ void XMLHttpRequest::send(const DOMString& _body)
 
     { // scope
         // avoid deadlock in case the loader wants to use JS on a background thread
-        JSLock::DropAllLocks dropLocks;
+        KJS::JSLock::DropAllLocks dropLocks;
 
         data = KWQServeSynchronousRequest(khtml::Cache::loader(), doc->docLoader(), job, finalURL, headers);
     }
@@ -393,10 +309,7 @@ void XMLHttpRequest::send(const DOMString& _body)
     return;
   }
 
-  {
-    JSLock lock;
-    gcProtect(this);
-  }
+  ref(); // this object should not be deleted while a request is in progress
   
   qObject->connect( job, SIGNAL( result( KIO::Job* ) ),
                     SLOT( slotFinished( KIO::Job* ) ) );
@@ -422,20 +335,23 @@ void XMLHttpRequest::abort()
   decoder = 0;
   aborted = true;
 
-  if (hadJob) {
-    JSLock lock;
-    gcUnprotect(this);
-  }
+  if (hadJob)
+    deref();
 }
 
-void XMLHttpRequest::setRequestHeader(const QString& name, const QString &value)
+void XMLHttpRequest::overrideMIMEType(const DOMString& override)
+{
+  MIMETypeOverride = override.qstring();
+}
+
+void XMLHttpRequest::setRequestHeader(const DOMString& name, const DOMString &value)
 {
   if (requestHeaders.length() > 0) {
     requestHeaders += "\r\n";
   }
-  requestHeaders += name;
+  requestHeaders += name.qstring();
   requestHeaders += ": ";
-  requestHeaders += value;
+  requestHeaders += value.qstring();
 }
 
 QString XMLHttpRequest::getRequestHeader(const QString& name) const
@@ -443,24 +359,24 @@ QString XMLHttpRequest::getRequestHeader(const QString& name) const
   return getSpecificHeader(requestHeaders, name);
 }
 
-JSValue *XMLHttpRequest::getAllResponseHeaders() const
+DOMString XMLHttpRequest::getAllResponseHeaders() const
 {
   if (responseHeaders.isEmpty()) {
-    return jsUndefined();
+    return DOMString();
   }
 
   int endOfLine = responseHeaders.find("\n");
 
   if (endOfLine == -1) {
-    return jsUndefined();
+    return DOMString();
   }
 
-  return jsString(responseHeaders.mid(endOfLine + 1) + "\n");
+  return responseHeaders.mid(endOfLine + 1) + "\n";
 }
 
-QString XMLHttpRequest::getResponseHeader(const QString& name) const
+DOMString XMLHttpRequest::getResponseHeader(const DOMString& name) const
 {
-  return getSpecificHeader(responseHeaders, name);
+  return getSpecificHeader(responseHeaders, name.qstring());
 }
 
 QString XMLHttpRequest::getSpecificHeader(const QString& headers, const QString& name)
@@ -492,43 +408,40 @@ bool XMLHttpRequest::responseIsXML() const
 {
     QString mimeType = getMIMEType(MIMETypeOverride);
     if (mimeType.isEmpty())
-        mimeType = getMIMEType(getResponseHeader("Content-Type"));
+        mimeType = getMIMEType(getResponseHeader("Content-Type").qstring());
     if (mimeType.isEmpty())
       mimeType = "text/xml";
     
     return DOMImplementationImpl::isXMLMIMEType(mimeType);
 }
 
-JSValue *XMLHttpRequest::getStatus() const
+int XMLHttpRequest::getStatus() const
 {
-  if (responseHeaders.isEmpty()) {
-    return jsUndefined();
-  }
+  if (responseHeaders.isEmpty())
+    return -1;
   
   int endOfLine = responseHeaders.find("\n");
   QString firstLine = endOfLine == -1 ? responseHeaders : responseHeaders.left(endOfLine);
   int codeStart = firstLine.find(" ");
   int codeEnd = firstLine.find(" ", codeStart + 1);
   
-  if (codeStart == -1 || codeEnd == -1) {
-    return jsUndefined();
-  }
+  if (codeStart == -1 || codeEnd == -1)
+    return -1;
   
   QString number = firstLine.mid(codeStart + 1, codeEnd - (codeStart + 1));
   
   bool ok = false;
   int code = number.toInt(&ok);
-  if (!ok) {
-    return jsUndefined();
-  }
+  if (!ok)
+    return -1;
 
-  return jsNumber(code);
+  return code;
 }
 
-JSValue *XMLHttpRequest::getStatusText() const
+DOMString XMLHttpRequest::getStatusText() const
 {
   if (responseHeaders.isEmpty()) {
-    return jsUndefined();
+    return DOMString();
   }
   
   int endOfLine = responseHeaders.find("\n");
@@ -537,12 +450,12 @@ JSValue *XMLHttpRequest::getStatusText() const
   int codeEnd = firstLine.find(" ", codeStart + 1);
 
   if (codeStart == -1 || codeEnd == -1) {
-    return jsUndefined();
+    return DOMString();
   }
   
   QString statusText = firstLine.mid(codeEnd + 1, endOfLine - (codeEnd + 1)).stripWhiteSpace();
   
-  return jsString(statusText);
+  return DOMString(statusText);
 }
 
 void XMLHttpRequest::processSyncLoadResults(const ByteArray &data, const KURL &finalURL, const QString &headers)
@@ -581,14 +494,15 @@ void XMLHttpRequest::slotFinished(KIO::Job *)
   if (decoder)
     response += decoder->flush();
 
+  bool hadJob = job;
   removeFromRequestsByDocument();
   job = 0;
 
   changeState(Completed);
   decoder = 0;
 
-  JSLock lock;
-  gcUnprotect(this);
+  if (hadJob)
+    deref();
 }
 
 void XMLHttpRequest::slotRedirection(KIO::Job*, const KURL& url)
@@ -609,7 +523,7 @@ void XMLHttpRequest::slotData(KIO::Job*, const char *data, int len)
   if (!decoder) {
     encoding = getCharset(MIMETypeOverride);
     if (encoding.isEmpty())
-      encoding = getCharset(getResponseHeader("Content-Type"));
+      encoding = getCharset(getResponseHeader("Content-Type").qstring());
     if (encoding.isEmpty() && job)
       encoding = job->queryMetaData("charset");
     
@@ -674,115 +588,10 @@ void XMLHttpRequest::removeFromRequestsByDocument()
   }
 }
 
-void XMLHttpRequest::cancelRequests(DOM::DocumentImpl* d)
+void XMLHttpRequest::cancelRequests(DocumentImpl* d)
 {
   while (RequestsSet* requests = requestsByDocument().get(d))
     (*requests->begin())->abort();
 }
 
-JSValue *XMLHttpRequestProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
-{
-  if (!thisObj->inherits(&XMLHttpRequest::info))
-    return throwError(exec, TypeError);
-
-  XMLHttpRequest *request = static_cast<XMLHttpRequest *>(thisObj);
-
-  switch (id) {
-  case XMLHttpRequest::Abort: {
-    request->abort();
-    return jsUndefined();
-  }
-  case XMLHttpRequest::GetAllResponseHeaders: {
-    if (args.size() != 0) {
-      return jsUndefined();
-    }
-
-    return request->getAllResponseHeaders();
-  }
-  case XMLHttpRequest::GetResponseHeader: {
-    if (args.size() != 1) {
-      return jsUndefined();
-    }
-    
-    QString header = request->getResponseHeader(args[0]->toString(exec).qstring());
-
-    if (header.isNull())
-      return jsUndefined();
-
-    return jsString(header);
-  }
-  case XMLHttpRequest::Open:
-    {
-      if (args.size() < 2 || args.size() > 5) {
-        return jsUndefined();
-      }
-    
-      QString method = args[0]->toString(exec).qstring();
-      KURL url = KURL(Window::retrieveActive(exec)->frame()->document()->completeURL(args[1]->toString(exec).qstring()));
-
-      bool async = true;
-      if (args.size() >= 3) {
-        async = args[2]->toBoolean(exec);
-      }
-    
-      if (args.size() >= 4) {
-        url.setUser(args[3]->toString(exec).qstring());
-      }
-      
-      if (args.size() >= 5) {
-        url.setPass(args[4]->toString(exec).qstring());
-      }
-
-      request->open(method, url, async);
-
-      return jsUndefined();
-    }
-  case XMLHttpRequest::Send:
-    {
-      if (args.size() > 1) {
-        return jsUndefined();
-      }
-
-      if (request->state != Loading) {
-        return jsUndefined();
-      }
-
-      DOMString body;
-
-      if (args.size() >= 1) {
-        if (args[0]->toObject(exec)->inherits(&DOMDocument::info)) {
-          DocumentImpl *doc = static_cast<DocumentImpl *>(static_cast<DOMDocument *>(args[0]->toObject(exec))->impl());
-          body = doc->toString().qstring();
-        } else {
-          // converting certain values (like null) to object can set an exception
-          exec->clearException();
-          body = args[0]->toString(exec).domString();
-        }
-      }
-
-      request->send(body);
-
-      return jsUndefined();
-    }
-  case XMLHttpRequest::SetRequestHeader: {
-    if (args.size() != 2) {
-      return jsUndefined();
-    }
-    
-    request->setRequestHeader(args[0]->toString(exec).qstring(), args[1]->toString(exec).qstring());
-    
-    return jsUndefined();
-  }
-  case XMLHttpRequest::OverrideMIMEType: {
-    if (args.size() != 1) {
-      return jsUndefined();
-    }
-    request->MIMETypeOverride = args[0]->toString(exec).qstring();
-    return jsUndefined();
-  }
-  }
-
-  return jsUndefined();
-}
-
 } // end namespace
similarity index 61%
rename from WebCore/khtml/ecma/xmlhttprequest.h
rename to WebCore/xml/xmlhttprequest.h
index 5a13ce6ed9bc1648a74bd891d2af0fa99584d586..223adcc5b4fb2f96aa6d3a650b0620b0a05e82df 100644 (file)
@@ -2,7 +2,7 @@
 /*
  *  This file is part of the KDE libraries
  *  Copyright (C) 2003 Apple Computer, Inc.
- *  Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
+ *  Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
 #ifndef XMLHTTPREQUEST_H_
 #define XMLHTTPREQUEST_H_
 
-#include "kjs_dom.h"
 #include <kurl.h>
+#include <kxmlcore/PassRefPtr.h>
 #include <kxmlcore/HashSet.h>
 #include <kxmlcore/HashMap.h>
 #include <qguardedptr.h>
 #include <qobject.h>
 
-namespace khtml {
-    class Decoder;
-}
-
 namespace KIO {
     class Job;
     class TransferJob;
 }
 
-namespace KJS {
+namespace WebCore {
 
-  class JSUnprotectedEventListener;
+  class Decoder;
+  class DocumentImpl;
+  class EventListener;
   class XMLHttpRequestQObject;
 
   // these exact numeric values are important because JS expects them
@@ -52,41 +50,35 @@ namespace KJS {
     Completed = 4       // Finished with all operations
   };
 
-  class XMLHttpRequestConstructorImp : public JSObject {
-  public:
-    XMLHttpRequestConstructorImp(ExecState *exec, DOM::DocumentImpl *d);
-    ~XMLHttpRequestConstructorImp();
-    virtual bool implementsConstruct() const;
-    virtual JSObject *construct(ExecState *exec, const List &args);
-  private:
-    RefPtr<DOM::DocumentImpl> doc;
-  };
-
-  class XMLHttpRequest : public DOMObject {
+  class XMLHttpRequest : public Shared<XMLHttpRequest> {
   public:
-    XMLHttpRequest(ExecState *, DOM::DocumentImpl *d);
+    XMLHttpRequest(DocumentImpl* d);
     ~XMLHttpRequest();
-    virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
-    JSValue *getValueProperty(ExecState *exec, int token) const;
-    virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
-    void putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/);
-    virtual bool toBoolean(ExecState *) const { return true; }
-    virtual void mark();
 
-    virtual const ClassInfo* classInfo() const { return &info; }
-    static const ClassInfo info;
-    enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status,
-        StatusText, Abort, GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader,
-        OverrideMIMEType };
+    static void cancelRequests(DocumentImpl *d);
 
-    static void cancelRequests(DOM::DocumentImpl *d);
+    DOMString getStatusText() const;
+    int getStatus() const;
+    XMLHttpRequestState getReadyState() const;
+    void open(const DOMString& method, const KURL& url, bool async, const DOMString& user, const DOMString& password);
+    void send(const DOMString& _body);
+    void abort();
+    void setRequestHeader(const DOMString& name, const DOMString &value);
+    void overrideMIMEType(const DOMString& override);
+    DOMString getAllResponseHeaders() const;
+    DOMString getResponseHeader(const DOMString& name) const;
+    DOMString getResponseText() const;
+    PassRefPtr<DocumentImpl> getResponseXML() const;
+
+    void setOnReadyStateChangeListener(EventListener* eventListener);
+    PassRefPtr<EventListener> getOnReadyStateChangeListener() const;
+    void setOnLoadListener(EventListener* eventListener);
+    PassRefPtr<EventListener> getOnLoadListener() const;
 
   private:
     friend class XMLHttpRequestProtoFunc;
     friend class XMLHttpRequestQObject;
 
-    JSValue *getStatusText() const;
-    JSValue *getStatus() const;
     bool urlMatchesDocumentDomain(const KURL&) const;
 
     XMLHttpRequestQObject *qObject;
@@ -97,26 +89,22 @@ namespace KJS {
 
     void processSyncLoadResults(const ByteArray &data, const KURL &finalURL, const QString &headers);
 
-    void open(const QString& _method, const KURL& _url, bool _async);
-    void send(const DOM::DOMString& _body);
-    void abort();
-    void setRequestHeader(const QString& name, const QString &value);
-    QString getRequestHeader(const QString& name) const;
-    JSValue *getAllResponseHeaders() const;
-    QString getResponseHeader(const QString& name) const;
     bool responseIsXML() const;
     
+    QString getRequestHeader(const QString& name) const;
     static QString getSpecificHeader(const QString& headers, const QString& name);
 
     void changeState(XMLHttpRequestState newState);
 
     typedef HashSet<XMLHttpRequest*, PointerHash<XMLHttpRequest*> > RequestsSet;
-    typedef HashMap<DOM::DocumentImpl*, RequestsSet*, PointerHash<DOM::DocumentImpl*> > RequestsMap;
+    typedef HashMap<DocumentImpl*, RequestsSet*, PointerHash<DocumentImpl*> > RequestsMap;
     static RequestsMap &requestsByDocument();
     void addToRequestsByDocument();
     void removeFromRequestsByDocument();
 
-    QGuardedPtr<DOM::DocumentImpl> doc;
+    QGuardedPtr<DocumentImpl> doc;
+    RefPtr<EventListener> onReadyStateChangeListener;
+    RefPtr<EventListener> onLoadListener;
 
     KURL url;
     QString method;
@@ -126,8 +114,6 @@ namespace KJS {
     KIO::TransferJob * job;
 
     XMLHttpRequestState state;
-    RefPtr<JSUnprotectedEventListener> onReadyStateChangeListener;
-    RefPtr<JSUnprotectedEventListener> onLoadListener;
 
     RefPtr<khtml::Decoder> decoder;
     QString encoding;
@@ -137,7 +123,7 @@ namespace KJS {
     QString response;
     mutable bool createdDocument;
     mutable bool typeIsXML;
-    mutable RefPtr<DOM::DocumentImpl> responseXML;
+    mutable RefPtr<DocumentImpl> responseXML;
 
     bool aborted;
   };