Commit 81ed4494 authored by weinig@apple.com's avatar weinig@apple.com

WebCore:

2008-04-17  Sam Weinig  <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Autogenerate the XMLHttpRequest javascript binding.

        * GNUmakefile.am:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCoreSources.bkl:
        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSDOMWindowBase.cpp:
        * bindings/js/JSXMLHttpRequest.cpp: Removed.
        * bindings/js/JSXMLHttpRequest.h: Removed.
        * bindings/js/JSXMLHttpRequestConstructor.cpp: Added.
        (WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
        (WebCore::JSXMLHttpRequestConstructor::implementsConstruct):
        (WebCore::JSXMLHttpRequestConstructor::construct):
        * bindings/js/JSXMLHttpRequestConstructor.h: Added.
        (WebCore::JSXMLHttpRequestConstructor::classInfo):
        * bindings/js/JSXMLHttpRequestCustom.cpp: Added.
        (WebCore::JSXMLHttpRequest::mark):
        (WebCore::JSXMLHttpRequest::onreadystatechange):
        (WebCore::JSXMLHttpRequest::setOnreadystatechange):
        (WebCore::JSXMLHttpRequest::onload):
        (WebCore::JSXMLHttpRequest::setOnload):
        (WebCore::JSXMLHttpRequest::responseXML):
        (WebCore::JSXMLHttpRequest::open):
        (WebCore::JSXMLHttpRequest::setRequestHeader):
        (WebCore::JSXMLHttpRequest::send):
        (WebCore::JSXMLHttpRequest::getResponseHeader):
        (WebCore::JSXMLHttpRequest::overrideMimeType):
        (WebCore::JSXMLHttpRequest::addEventListener):
        (WebCore::JSXMLHttpRequest::removeEventListener):
        (WebCore::JSXMLHttpRequest::dispatchEvent):
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::readyState):
        (WebCore::XMLHttpRequest::responseText):
        * xml/XMLHttpRequest.h:
        * xml/XMLHttpRequest.idl: Added.

LayoutTests:

2008-04-17  Sam Weinig  <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Update test result for additon of XMLHttpRequest constants.

        * fast/dom/Window/window-properties-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 049517f5
2008-04-17 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Update test result for additon of XMLHttpRequest constants.
* fast/dom/Window/window-properties-expected.txt:
2008-04-17 Anders Carlsson <andersca@apple.com>
Add applicationCache object.
......@@ -1148,6 +1148,11 @@ window.WheelEvent.prototype [printed above as window.Event.prototype]
window.XMLDocument [printed above as window.Document]
window.XMLHttpRequest [object XMLHttpRequestConstructor]
window.XMLHttpRequest.prototype [object XMLHttpRequestPrototype]
window.XMLHttpRequest.prototype.DONE [number]
window.XMLHttpRequest.prototype.HEADERS_RECEIVED [number]
window.XMLHttpRequest.prototype.LOADING [number]
window.XMLHttpRequest.prototype.OPENED [number]
window.XMLHttpRequest.prototype.UNSENT [number]
window.XMLHttpRequest.prototype.abort [function]
window.XMLHttpRequest.prototype.addEventListener [function]
window.XMLHttpRequest.prototype.dispatchEvent [function]
......
2008-04-17 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Autogenerate the XMLHttpRequest javascript binding.
* GNUmakefile.am:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCoreSources.bkl:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSXMLHttpRequest.cpp: Removed.
* bindings/js/JSXMLHttpRequest.h: Removed.
* bindings/js/JSXMLHttpRequestConstructor.cpp: Added.
(WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
(WebCore::JSXMLHttpRequestConstructor::implementsConstruct):
(WebCore::JSXMLHttpRequestConstructor::construct):
* bindings/js/JSXMLHttpRequestConstructor.h: Added.
(WebCore::JSXMLHttpRequestConstructor::classInfo):
* bindings/js/JSXMLHttpRequestCustom.cpp: Added.
(WebCore::JSXMLHttpRequest::mark):
(WebCore::JSXMLHttpRequest::onreadystatechange):
(WebCore::JSXMLHttpRequest::setOnreadystatechange):
(WebCore::JSXMLHttpRequest::onload):
(WebCore::JSXMLHttpRequest::setOnload):
(WebCore::JSXMLHttpRequest::responseXML):
(WebCore::JSXMLHttpRequest::open):
(WebCore::JSXMLHttpRequest::setRequestHeader):
(WebCore::JSXMLHttpRequest::send):
(WebCore::JSXMLHttpRequest::getResponseHeader):
(WebCore::JSXMLHttpRequest::overrideMimeType):
(WebCore::JSXMLHttpRequest::addEventListener):
(WebCore::JSXMLHttpRequest::removeEventListener):
(WebCore::JSXMLHttpRequest::dispatchEvent):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::readyState):
(WebCore::XMLHttpRequest::responseText):
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequest.idl: Added.
2008-04-17 Brady Eidson <beidson@apple.com>
Reviewed by Anders
......@@ -338,6 +338,7 @@ DOM_CLASSES = \
UIEvent \
VoidCallback \
WheelEvent \
XMLHttpRequest \
XMLHttpRequestException \
XMLSerializer \
XPathEvaluator \
......@@ -355,7 +356,6 @@ all : \
JSDOMWindowBase.lut.h \
JSEventTargetBase.lut.h \
JSRGBColor.lut.h \
JSXMLHttpRequest.lut.h \
JSXSLTProcessor.lut.h \
\
JSHTMLInputElementBaseTable.cpp \
......
......@@ -51,7 +51,6 @@ webcore_built_nosources += \
WebCore/bindings/js/JSDOMWindowBase.lut.h \
WebCore/bindings/js/JSEventTargetBase.lut.h \
WebCore/bindings/js/JSRGBColor.lut.h \
WebCore/bindings/js/JSXMLHttpRequest.lut.h \
WebCore/bindings/js/JSXSLTProcessor.lut.h \
WebCore/bindings/js/JSHTMLInputElementBaseTable.cpp
......@@ -197,6 +196,7 @@ webcore_built_sources += \
DerivedSources/JSTreeWalker.h \
DerivedSources/JSUIEvent.h \
DerivedSources/JSWheelEvent.h \
DerivedSources/JSXMLHttpRequest.h \
DerivedSources/JSXMLHttpRequestException.h \
DerivedSources/JSXMLSerializer.h \
DerivedSources/JSAttr.cpp \
......@@ -329,6 +329,7 @@ webcore_built_sources += \
DerivedSources/JSTreeWalker.cpp \
DerivedSources/JSUIEvent.cpp \
DerivedSources/JSWheelEvent.cpp \
DerivedSources/JSXMLHttpRequest.cpp \
DerivedSources/JSXMLHttpRequestException.cpp \
DerivedSources/JSXMLSerializer.cpp
......@@ -461,6 +462,7 @@ IDL_BINDINGS += \
WebCore/plugins/Plugin.idl \
WebCore/plugins/PluginArray.idl \
WebCore/xml/DOMParser.idl \
WebCore/xml/XMLHttpRequest.idl \
WebCore/xml/XMLHttpRequestException.idl \
WebCore/xml/XMLSerializer.idl
......@@ -523,7 +525,8 @@ webcore_sources += \
WebCore/bindings/js/JSStyleSheetCustom.cpp \
WebCore/bindings/js/JSStyleSheetListCustom.cpp \
WebCore/bindings/js/JSTreeWalkerCustom.cpp \
WebCore/bindings/js/JSXMLHttpRequest.cpp \
WebCore/bindings/js/JSXMLHttpRequestCustom.cpp \
WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp \
WebCore/bindings/js/JSXSLTProcessor.cpp \
WebCore/bindings/js/kjs_binding.cpp \
WebCore/bindings/js/kjs_events.cpp \
......@@ -552,9 +555,9 @@ webcore_sources += \
WebCore/css/CSSFontFaceSrcValue.cpp \
WebCore/css/CSSFontSelector.cpp \
WebCore/css/CSSFontFaceSource.cpp \
WebCore/css/CSSGradientValue.cpp \
WebCore/css/CSSGradientValue.cpp \
WebCore/css/CSSHelper.cpp \
WebCore/css/CSSImageGeneratorValue.cpp \
WebCore/css/CSSImageGeneratorValue.cpp \
WebCore/css/CSSImageValue.cpp \
WebCore/css/CSSImportRule.cpp \
WebCore/css/CSSInheritedValue.cpp \
......@@ -2190,6 +2193,5 @@ CLEANFILES += \
WebCore/bindings/js/JSHTMLInputElementBaseTable.cpp \
JSDOMWindowBase.lut.h \
JSRGBColor.lut.h \
JSXMLHttpRequest.lut.h \
JSXSLTProcessor.lut.h
......@@ -256,7 +256,6 @@ LUT_FILES += \
bindings/js/JSDOMWindowBase.cpp \
bindings/js/JSEventTargetBase.cpp \
bindings/js/JSRGBColor.cpp \
bindings/js/JSXMLHttpRequest.cpp \
bindings/js/JSXSLTProcessor.cpp
LUT_TABLE_FILES += \
......@@ -395,6 +394,7 @@ IDL_BINDINGS += \
plugins/PluginArray.idl \
plugins/MimeTypeArray.idl \
xml/DOMParser.idl \
xml/XMLHttpRequest.idl \
xml/XMLHttpRequestException.idl \
xml/XMLSerializer.idl
......@@ -452,7 +452,8 @@ SOURCES += \
bindings/js/JSStyleSheetCustom.cpp \
bindings/js/JSStyleSheetListCustom.cpp \
bindings/js/JSTreeWalkerCustom.cpp \
bindings/js/JSXMLHttpRequest.cpp \
bindings/js/JSXMLHttpRequestConstructor.cpp \
bindings/js/JSXMLHttpRequestCustom.cpp \
bindings/js/JSXSLTProcessor.cpp \
bindings/js/JSPluginCustom.cpp \
bindings/js/JSPluginArrayCustom.cpp \
......
......@@ -2813,6 +2813,14 @@
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSWheelEvent.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSXMLHttpRequest.cpp"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSXMLHttpRequest.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSXMLHttpRequestException.cpp"
>
......@@ -13535,11 +13543,15 @@
>
</File>
<File
RelativePath="..\bindings\js\JSXMLHttpRequest.cpp"
RelativePath="..\bindings\js\JSXMLHttpRequestConstructor.cpp"
>
</File>
<File
RelativePath="..\bindings\js\JSXMLHttpRequestConstructor.h"
>
</File>
<File
RelativePath="..\bindings\js\JSXMLHttpRequest.h"
RelativePath="..\bindings\js\JSXMLHttpRequestCustom.cpp"
>
</File>
<File
......
......@@ -584,7 +584,6 @@
656580F409D12B20000E61D7 /* CSSPropertyNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 656580EF09D12B20000E61D7 /* CSSPropertyNames.h */; };
6565815109D13043000E61D7 /* CSSValueKeywords.h in Headers */ = {isa = PBXBuildFile; fileRef = 6565814809D13043000E61D7 /* CSSValueKeywords.h */; };
656581B209D14EE6000E61D7 /* UserAgentStyleSheets.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581AE09D14EE6000E61D7 /* UserAgentStyleSheets.h */; };
656581EE09D1508D000E61D7 /* JSXMLHttpRequest.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581D709D1508D000E61D7 /* JSXMLHttpRequest.lut.h */; };
656581F009D1508D000E61D7 /* JSXSLTProcessor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581D909D1508D000E61D7 /* JSXSLTProcessor.lut.h */; };
656581F509D1508D000E61D7 /* kjs_navigator.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */; };
656581FE09D1508D000E61D7 /* SVGElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581E709D1508D000E61D7 /* SVGElementFactory.h */; };
......@@ -1694,8 +1693,6 @@
93B6A0E60B0BCA5C00F5027A /* ContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B6A0E50B0BCA5C00F5027A /* ContextMenu.h */; settings = {ATTRIBUTES = (Private, ); }; };
93B6A0E80B0BCA6700F5027A /* ContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */; };
93B6A0EA0B0BCA8400F5027A /* ContextMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B6A0E90B0BCA8400F5027A /* ContextMenuMac.mm */; };
93B70D5D09EB0C7C009D8468 /* JSXMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4109EB0C7C009D8468 /* JSXMLHttpRequest.cpp */; };
93B70D5E09EB0C7C009D8468 /* JSXMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D4209EB0C7C009D8468 /* JSXMLHttpRequest.h */; };
93B70D6109EB0C7C009D8468 /* JSXSLTProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4509EB0C7C009D8468 /* JSXSLTProcessor.cpp */; };
93B70D6209EB0C7C009D8468 /* JSXSLTProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D4609EB0C7C009D8468 /* JSXSLTProcessor.h */; };
93B70D6309EB0C7C009D8468 /* kjs_binding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4709EB0C7C009D8468 /* kjs_binding.cpp */; };
......@@ -3575,6 +3572,12 @@
BC3452430D7E00EA0016574A /* JSRGBColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3452410D7E00EA0016574A /* JSRGBColor.cpp */; };
BC3452440D7E00EA0016574A /* JSRGBColor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3452420D7E00EA0016574A /* JSRGBColor.h */; };
BC3452560D7E02850016574A /* JSRGBColor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3452550D7E02850016574A /* JSRGBColor.lut.h */; };
BC348BA80DB7F1B8004ABAB9 /* XMLHttpRequest.idl in Resources */ = {isa = PBXBuildFile; fileRef = BC348BA70DB7F1B8004ABAB9 /* XMLHttpRequest.idl */; };
BC348BBE0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */; };
BC348BD30DB7F804004ABAB9 /* JSXMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BD10DB7F804004ABAB9 /* JSXMLHttpRequest.cpp */; };
BC348BD40DB7F804004ABAB9 /* JSXMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC348BD20DB7F804004ABAB9 /* JSXMLHttpRequest.h */; };
BC348BE90DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BE70DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp */; };
BC348BEA0DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC348BE80DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h */; };
BC3A9E880DA2E18200A05E6A /* JSDOMWindowWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3A9E860DA2E18200A05E6A /* JSDOMWindowWrapper.cpp */; };
BC3A9E890DA2E18200A05E6A /* JSDOMWindowWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3A9E870DA2E18200A05E6A /* JSDOMWindowWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */; };
......@@ -5047,7 +5050,6 @@
656581AD09D14EE6000E61D7 /* ColorData.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ColorData.c; sourceTree = "<group>"; };
656581AE09D14EE6000E61D7 /* UserAgentStyleSheets.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = UserAgentStyleSheets.h; sourceTree = "<group>"; };
656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = UserAgentStyleSheetsData.cpp; sourceTree = "<group>"; };
656581D709D1508D000E61D7 /* JSXMLHttpRequest.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequest.lut.h; sourceTree = "<group>"; };
656581D909D1508D000E61D7 /* JSXSLTProcessor.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXSLTProcessor.lut.h; sourceTree = "<group>"; };
656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_navigator.lut.h; sourceTree = "<group>"; };
656581E609D1508D000E61D7 /* SVGElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGElementFactory.cpp; sourceTree = "<group>"; };
......@@ -6109,8 +6111,6 @@
93B6A0E50B0BCA5C00F5027A /* ContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContextMenu.h; sourceTree = "<group>"; };
93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ContextMenu.cpp; sourceTree = "<group>"; };
93B6A0E90B0BCA8400F5027A /* ContextMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuMac.mm; sourceTree = "<group>"; };
93B70D4109EB0C7C009D8468 /* JSXMLHttpRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequest.cpp; sourceTree = "<group>"; };
93B70D4209EB0C7C009D8468 /* JSXMLHttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequest.h; sourceTree = "<group>"; };
93B70D4509EB0C7C009D8468 /* JSXSLTProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXSLTProcessor.cpp; sourceTree = "<group>"; };
93B70D4609EB0C7C009D8468 /* JSXSLTProcessor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXSLTProcessor.h; sourceTree = "<group>"; };
93B70D4709EB0C7C009D8468 /* kjs_binding.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_binding.cpp; sourceTree = "<group>"; };
......@@ -7857,6 +7857,12 @@
BC3452410D7E00EA0016574A /* JSRGBColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRGBColor.cpp; sourceTree = "<group>"; };
BC3452420D7E00EA0016574A /* JSRGBColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRGBColor.h; sourceTree = "<group>"; };
BC3452550D7E02850016574A /* JSRGBColor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRGBColor.lut.h; sourceTree = "<group>"; };
BC348BA70DB7F1B8004ABAB9 /* XMLHttpRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLHttpRequest.idl; sourceTree = "<group>"; };
BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestCustom.cpp; sourceTree = "<group>"; };
BC348BD10DB7F804004ABAB9 /* JSXMLHttpRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequest.cpp; sourceTree = "<group>"; };
BC348BD20DB7F804004ABAB9 /* JSXMLHttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequest.h; sourceTree = "<group>"; };
BC348BE70DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestConstructor.cpp; sourceTree = "<group>"; };
BC348BE80DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestConstructor.h; sourceTree = "<group>"; };
BC3A9E860DA2E18200A05E6A /* JSDOMWindowWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowWrapper.cpp; sourceTree = "<group>"; };
BC3A9E870DA2E18200A05E6A /* JSDOMWindowWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowWrapper.h; sourceTree = "<group>"; };
BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaList.cpp; sourceTree = "<group>"; };
......@@ -11090,6 +11096,7 @@
14E8378D09F85D4F00B85AE4 /* JSEvent.h */,
BC60D9BD0D2A269A00B9918F /* JSEventException.cpp */,
BC60D9BE0D2A269A00B9918F /* JSEventException.h */,
B28BC3190D135E5400CDBA27 /* JSEventTargetBase.lut.h */,
A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */,
A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */,
75793EC60D0CE72D007FC0AC /* JSMessageEvent.cpp */,
......@@ -11136,8 +11143,8 @@
children = (
1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */,
1ACE53DE0A8D18810022947D /* JSDOMParser.h */,
B28BC3190D135E5400CDBA27 /* JSEventTargetBase.lut.h */,
656581D709D1508D000E61D7 /* JSXMLHttpRequest.lut.h */,
BC348BD10DB7F804004ABAB9 /* JSXMLHttpRequest.cpp */,
BC348BD20DB7F804004ABAB9 /* JSXMLHttpRequest.h */,
BC60DA370D2A302800B9918F /* JSXMLHttpRequestException.cpp */,
BC60DA380D2A302800B9918F /* JSXMLHttpRequestException.h */,
1ACE53F40A8D19470022947D /* JSXMLSerializer.cpp */,
......@@ -12040,8 +12047,8 @@
B22277AF0D00BEDC0071B782 /* JSSVGLazyEventListener.cpp */,
B22277B00D00BEDC0071B782 /* JSSVGLazyEventListener.h */,
B21127A50B3186770009BE53 /* JSSVGPODTypeWrapper.h */,
93B70D4109EB0C7C009D8468 /* JSXMLHttpRequest.cpp */,
93B70D4209EB0C7C009D8468 /* JSXMLHttpRequest.h */,
BC348BE70DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp */,
BC348BE80DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h */,
93B70D4509EB0C7C009D8468 /* JSXSLTProcessor.cpp */,
93B70D4609EB0C7C009D8468 /* JSXSLTProcessor.h */,
93B70D4709EB0C7C009D8468 /* kjs_binding.cpp */,
......@@ -12164,6 +12171,7 @@
B2D3FC890C2212CB00CF3618 /* JSSVGTransformListCustom.cpp */,
516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
A766F3520D6BDE3500ABDDB3 /* JSCanvasPixelArrayCustom.cpp */,
BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */,
);
name = Custom;
sourceTree = "<group>";
......@@ -12377,6 +12385,7 @@
A833C7F60A2CF1D800D57664 /* xmlattrs.in */,
BC772C440C4EB2C60083285F /* XMLHttpRequest.cpp */,
BC772C450C4EB2C60083285F /* XMLHttpRequest.h */,
BC348BA70DB7F1B8004ABAB9 /* XMLHttpRequest.idl */,
BC60D9C70D2A29E500B9918F /* XMLHttpRequestException.h */,
BC60D9C80D2A29E500B9918F /* XMLHttpRequestException.idl */,
1ACE53E40A8D18E70022947D /* XMLSerializer.cpp */,
......@@ -14275,8 +14284,6 @@
A86629CF09DA2B47009633A5 /* JSUIEvent.h in Headers */,
BC82432C0D0CE8A200460C8F /* JSVoidCallback.h in Headers */,
65DF320609D1CC60000BE325 /* JSWheelEvent.h in Headers */,
93B70D5E09EB0C7C009D8468 /* JSXMLHttpRequest.h in Headers */,
656581EE09D1508D000E61D7 /* JSXMLHttpRequest.lut.h in Headers */,
1ACE53F70A8D19470022947D /* JSXMLSerializer.h in Headers */,
1A762C740A074F2600989F5B /* JSXPathEvaluator.h in Headers */,
1A762C760A074F2600989F5B /* JSXPathExpression.h in Headers */,
......@@ -14929,6 +14936,8 @@
1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */,
514B49DB0DB6D6AD001C3770 /* LocalStorageArea.h in Headers */,
514B49DF0DB6D6B6001C3770 /* SessionStorageArea.h in Headers */,
BC348BD40DB7F804004ABAB9 /* JSXMLHttpRequest.h in Headers */,
BC348BEA0DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -15053,6 +15062,7 @@
519FE0A30DAD446E00A08F21 /* HTMLAttributeNames.in in Resources */,
519FE0A40DAD446E00A08F21 /* HTMLTagNames.in in Resources */,
1A8F6BC40DB55CDC001DB794 /* DOMApplicationCache.idl in Resources */,
BC348BA80DB7F1B8004ABAB9 /* XMLHttpRequest.idl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -16003,7 +16013,6 @@
A86629D009DA2B48009633A5 /* JSUIEvent.cpp in Sources */,
BC82432B0D0CE8A200460C8F /* JSVoidCallback.cpp in Sources */,
65DF320509D1CC60000BE325 /* JSWheelEvent.cpp in Sources */,
93B70D5D09EB0C7C009D8468 /* JSXMLHttpRequest.cpp in Sources */,
1ACE53F60A8D19470022947D /* JSXMLSerializer.cpp in Sources */,
1A762C730A074F2600989F5B /* JSXPathEvaluator.cpp in Sources */,
1A762C750A074F2600989F5B /* JSXPathExpression.cpp in Sources */,
......@@ -16633,6 +16642,9 @@
1AC226170DB69F740089B669 /* JSDOMApplicationCacheCustom.cpp in Sources */,
514B49DC0DB6D6AD001C3770 /* LocalStorageArea.cpp in Sources */,
514B49E00DB6D6B6001C3770 /* SessionStorageArea.cpp in Sources */,
BC348BBE0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp in Sources */,
BC348BD30DB7F804004ABAB9 /* JSXMLHttpRequest.cpp in Sources */,
BC348BE90DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -97,7 +97,8 @@ This file contains the list of files needed to build WebCore.
bindings/js/JSStyleSheetCustom.cpp
bindings/js/JSStyleSheetListCustom.cpp
bindings/js/JSTreeWalkerCustom.cpp
bindings/js/JSXMLHttpRequest.cpp
bindings/js/JSXMLHttpRequestConstructor.cpp
bindings/js/JSXMLHttpRequestCustom.cpp
bindings/js/JSXSLTProcessor.cpp
bindings/js/kjs_binding.cpp
bindings/js/kjs_events.cpp
......@@ -314,6 +315,7 @@ This file contains the list of files needed to build WebCore.
DerivedSources/WebCore/JSTreeWalker.cpp
DerivedSources/WebCore/JSUIEvent.cpp
DerivedSources/WebCore/JSWheelEvent.cpp
DerivedSources/WebCore/JSXMLHttpRequest.cpp
DerivedSources/WebCore/JSXMLHttpRequestException.cpp
DerivedSources/WebCore/JSXMLSerializer.cpp
DerivedSources/WebCore/JSXPathEvaluator.cpp
......
......@@ -45,7 +45,7 @@
#include "JSHTMLOptionElementConstructor.h"
#include "JSImageConstructor.h"
#include "JSNode.h"
#include "JSXMLHttpRequest.h"
#include "JSXMLHttpRequestConstructor.h"
#include "Logging.h"
#include "MediaPlayer.h"
#include "Page.h"
......
/*
* Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "JSXMLHttpRequest.h"
#include "DOMWindow.h"
#include "Event.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLDocument.h"
#include "JSDOMWindow.h"
#include "JSDocument.h"
#include "JSEvent.h"
#include "XMLHttpRequest.h"
#include "kjs_events.h"
using namespace KJS;
using namespace WebCore;
#include "JSXMLHttpRequest.lut.h"
namespace WebCore {
/* Source for JSXMLHttpRequestPrototypeTable.
@begin JSXMLHttpRequestPrototypeTable 7
abort jsXMLHttpRequestPrototypeFunctionAbort DontDelete|Function 0
getAllResponseHeaders jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders DontDelete|Function 0
getResponseHeader jsXMLHttpRequestPrototypeFunctionGetResponseHeader DontDelete|Function 1
open jsXMLHttpRequestPrototypeFunctionOpen DontDelete|Function 5
overrideMimeType jsXMLHttpRequestPrototypeFunctionOverrideMIMEType DontDelete|Function 1
send jsXMLHttpRequestPrototypeFunctionSend DontDelete|Function 1
setRequestHeader jsXMLHttpRequestPrototypeFunctionSetRequestHeader DontDelete|Function 2
# from the EventTarget interface
# FIXME: add DOM3 EventTarget methods (addEventListenerNS, removeEventListenerNS).
addEventListener jsXMLHttpRequestPrototypeFunctionAddEventListener DontDelete|Function 3
removeEventListener jsXMLHttpRequestPrototypeFunctionRemoveEventListener DontDelete|Function 3
dispatchEvent jsXMLHttpRequestPrototypeFunctionDispatchEvent DontDelete|Function 1
@end
*/
KJS_DEFINE_PROTOTYPE(JSXMLHttpRequestPrototype)
KJS_IMPLEMENT_PROTOTYPE("XMLHttpRequest", JSXMLHttpRequestPrototype)
const ClassInfo JSXMLHttpRequestConstructor::s_info = { "XMLHttpRequestConstructor", 0, 0 };
JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, Document* document)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
, m_document(document)
{
putDirect(exec->propertyNames().prototype, JSXMLHttpRequestPrototype::self(exec), None);
}
bool JSXMLHttpRequestConstructor::implementsConstruct() const
{
return true;
}
JSObject* JSXMLHttpRequestConstructor::construct(ExecState* exec, const List&)
{
return new JSXMLHttpRequest(JSXMLHttpRequestPrototype::self(exec), m_document.get());
}
const ClassInfo JSXMLHttpRequest::s_info = { "XMLHttpRequest", 0, &JSXMLHttpRequestTable };
/* 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
{
ExceptionCode ec = 0;
switch (token) {
case ReadyState:
return jsNumber(m_impl->getReadyState());
case ResponseText: {
JSValue* result = jsOwnedStringOrNull(m_impl->getResponseText(ec));
setDOMException(exec, ec);
return result;
}
case ResponseXML: {
Document* responseXML = m_impl->getResponseXML(ec);
setDOMException(exec, ec);
if (responseXML)
return toJS(exec, responseXML);
return jsNull();
}
case Status: {
JSValue* result = jsNumber(m_impl->getStatus(ec));
setDOMException(exec, ec);
return result;
}
case StatusText: {
JSValue* result = jsString(m_impl->getStatusText(ec));
setDOMException(exec, ec);
return result;
}
case Onreadystatechange:
if (JSUnprotectedEventListener* listener = static_cast<JSUnprotectedEventListener*>(m_impl->onReadyStateChangeListener()))
if (JSObject* listenerObj = listener->listenerObj())
return listenerObj;
return jsNull();
case Onload:
if (JSUnprotectedEventListener* listener = static_cast<JSUnprotectedEventListener*>(m_impl->onLoadListener()))
if (JSObject* listenerObj = listener->listenerObj())
return listenerObj;
return jsNull();
default:
return 0;
}
}
void JSXMLHttpRequest::put(ExecState* exec, const Identifier& propertyName, JSValue* value)
{
lookupPut<JSXMLHttpRequest, DOMObject>(exec, propertyName, value, &JSXMLHttpRequestTable, this);
}
void JSXMLHttpRequest::putValueProperty(ExecState* exec, int token, JSValue* value)
{
switch (token) {
case Onreadystatechange: {
Document* doc = m_impl->document();
if (!doc)
return;
Frame* frame = doc->frame();
if (!frame)
return;
m_impl->setOnReadyStateChangeListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
break;
}
case Onload: {
Document* doc = m_impl->document();
if (!doc)
return;
Frame* frame = doc->frame();
if (!frame)
return;
m_impl->setOnLoadListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
break;
}
}
}
void JSXMLHttpRequest::mark()
{
DOMObject::mark();
JSUnprotectedEventListener* onReadyStateChangeListener = static_cast<JSUnprotectedEventListener*>(m_impl->onReadyStateChangeListener());
JSUnprotectedEventListener* onLoadListener = static_cast<JSUnprotectedEventListener*>(m_impl->onLoadListener());
if (onReadyStateChangeListener)
onReadyStateChangeListener->mark();
if (onLoadListener)
onLoadListener->mark();
typedef XMLHttpRequest::EventListenersMap EventListenersMap;
typedef XMLHttpRequest::ListenerVector ListenerVector;
EventListenersMap& eventListeners = m_impl->eventListeners();
for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) {
for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) {
JSUnprotectedEventListener* listener = static_cast<JSUnprotectedEventListener*>(vecIter->get());
listener->mark();
}
}
}
JSXMLHttpRequest::JSXMLHttpRequest(JSObject* prototype, Document* d)
: DOMObject(prototype)
, m_impl(XMLHttpRequest::create(d))
{
ScriptInterpreter::putDOMObject(m_impl.get(), this);
}
JSXMLHttpRequest::~JSXMLHttpRequest()
{
m_impl->setOnReadyStateChangeListener(0);
m_impl->setOnLoadListener(0);
m_impl->eventListeners().clear();
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
JSValue* jsXMLHttpRequestPrototypeFunctionAbort(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSXMLHttpRequest::s_info))
return throwError(exec, TypeError);
JSXMLHttpRequest* request = static_cast<JSXMLHttpRequest*>(thisObj);
request->impl()->abort();
return jsUndefined();
}
JSValue* jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSXMLHttpRequest::s_info))
return throwError(exec, TypeError);
JSXMLHttpRequest* request = static_cast<JSXMLHttpRequest*>(thisObj);
ExceptionCode ec = 0;
JSValue* headers = jsStringOrUndefined(request->impl()->getAllResponseHeaders(ec));
setDOMException(exec, ec);
return headers;
}
JSValue* jsXMLHttpRequestPrototypeFunctionGetResponseHeader(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSXMLHttpRequest::s_info))
return throwError(exec, TypeError);
JSXMLHttpRequest* request = static_cast<JSXMLHttpRequest*>(thisObj);
ExceptionCode ec = 0;
if (args.size() < 1)
return throwError(exec, SyntaxError, "Not enough arguments");
JSValue* header = jsStringOrNull(request->impl()->getResponseHeader(args[0]->toString(exec), ec));
setDOMException(exec, ec);
return header;
}
JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSXMLHttpRequest::s_info))
return throwError(exec, TypeError);
JSXMLHttpRequest* request = static_cast<JSXMLHttpRequest*>(thisObj);
ExceptionCode ec = 0;
if (args.size() < 2)
return throwError(exec, SyntaxError, "Not enough arguments");
String method = args[0]->toString(exec);
Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)