Fixes Issue 3608. XMLHttpRequest now does "new $wnd.XMLHttpRequest"
rather than a bare "new XMLHttpRequest". Also, it tolerates libraries
that install a non-function as $wnd.XMLHttpRequest on IE6.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7676 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/xhr/client/XMLHttpRequest.java b/user/src/com/google/gwt/xhr/client/XMLHttpRequest.java
index f18cc85..08adeb6 100644
--- a/user/src/com/google/gwt/xhr/client/XMLHttpRequest.java
+++ b/user/src/com/google/gwt/xhr/client/XMLHttpRequest.java
@@ -82,22 +82,14 @@
*/
public static native XMLHttpRequest create() /*-{
if ($wnd.XMLHttpRequest) {
+ return new XMLHttpRequest();
+ } else {
try {
- return new $wnd.XMLHttpRequest;
- } catch(e) {
- // Some third-party libraries define it but not as a function.
- // See Issue 3608.
- // Fall through to alternatives.
+ return new ActiveXObject('MSXML2.XMLHTTP.3.0');
+ } catch (e) {
+ return new ActiveXObject("Microsoft.XMLHTTP");
}
}
-
- try {
- // some IE6 installations can use this
- return new ActiveXObject('MSXML2.XMLHTTP.3.0');
- } catch (e) {
- // other IE6 installations need this
- return new ActiveXObject("Microsoft.XMLHTTP");
- }
}-*/;
protected XMLHttpRequest() {