aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2014-01-27 11:42:34 +0100
committerManolo Carrasco <manolo@apache.org>2014-01-27 11:42:34 +0100
commitb92bd078148e700bd188308724713f5f6c7d44eb (patch)
treeb77c3c4f27dd4b076b11d49a66e32ddce84fe1a2
parent6df7c6a8f2461d918d305c883985023d9d05b43d (diff)
parent2b45e352a6e115915944a164eb14cc677630d3f0 (diff)
downloadgwtquery-b92bd078148e700bd188308724713f5f6c7d44eb.tar.gz
gwtquery-b92bd078148e700bd188308724713f5f6c7d44eb.zip
merge
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/ConsoleBrowser.java16
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/PromiseReqBuilder.java24
2 files changed, 20 insertions, 20 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/ConsoleBrowser.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/ConsoleBrowser.java
index 985e3a03..dd67bd1a 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/ConsoleBrowser.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/ConsoleBrowser.java
@@ -43,13 +43,13 @@ public class ConsoleBrowser implements Console {
* See: http://whattheheadsaid.com/2011/04/internet-explorer-9s-problematic-console-object
*/
private static class ConsoleIe9 extends ConsoleImpl {
-
+
private boolean initialized = false;
-
+
public ConsoleIe9(){
init();
}
-
+
protected native void init()/*-{
try {
[ "log", "info", "warn", "error", "dir", "clear", "profile", "profileEnd" ]
@@ -60,7 +60,7 @@ public class ConsoleBrowser implements Console {
} catch(e) {
}
}-*/;
-
+
@Override
public void clear() {
if (initialized) super.clear();
@@ -102,7 +102,7 @@ public class ConsoleBrowser implements Console {
@Override
public void timeEnd(String title) {}
}
-
+
/**
* Default implementation: webkit, opera, FF, ie10
*/
@@ -163,9 +163,9 @@ public class ConsoleBrowser implements Console {
$wnd.console.warn(arg);
}-*/;
}
-
+
private ConsoleImpl impl;
-
+
public ConsoleBrowser() {
impl = GQuery.browser.ie8? new ConsoleIe8(): GQuery.browser.ie9? new ConsoleIe9(): new ConsoleImpl();
}
@@ -239,7 +239,7 @@ public class ConsoleBrowser implements Console {
public void warn(Object arg) {
impl.warn(toJs(arg));
}
-
+
/**
* Don't pass GWT Objects to JS methods
*/
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/PromiseReqBuilder.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/PromiseReqBuilder.java
index 1d1bf013..4aec8a37 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/PromiseReqBuilder.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/PromiseReqBuilder.java
@@ -35,7 +35,7 @@ import com.google.gwt.xhr.client.XMLHttpRequest;
* <pre>
* RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, "http://127.0.0.1:8888/whatever");
* PromiseRequest gettingResponse = new PromiseReqBuilder(builder);
- *
+ *
* gettingResponse.fail(new Function() {
* public void f() {
* Throwable exception = arguments(0);
@@ -48,7 +48,7 @@ import com.google.gwt.xhr.client.XMLHttpRequest;
* </pre>
*/
public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCallback {
-
+
public PromiseReqBuilder(RequestBuilder builder) {
builder.setCallback(this);
try {
@@ -57,7 +57,7 @@ public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCal
onError(null, e);
}
}
-
+
/**
* Using this constructor we access to some things in the xmlHttpRequest
* which are not available in GWT, like adding progress handles or sending
@@ -69,7 +69,7 @@ public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCal
Binder data = settings.getData();
String ctype = settings.getContentType();
Boolean isFormData = data != null && data.getBound() instanceof JavaScriptObject && JsUtils.isFormData(data.<JavaScriptObject>getBound());
-
+
XMLHttpRequest xmlHttpRequest = XMLHttpRequest.create();
try {
if (settings.getUsername() != null && settings.getPassword() != null) {
@@ -85,7 +85,7 @@ public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCal
onError(null, e);
return;
}
-
+
JsUtils.prop(xmlHttpRequest, "onprogress", JsUtils.wrapFunction(new Function() {
public void f() {
JsCache p = arguments(0);
@@ -95,7 +95,7 @@ public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCal
dfd.notify(total, loaded, percent, "download");
}
}));
-
+
JavaScriptObject upload = JsUtils.prop(xmlHttpRequest, "upload");
JsUtils.prop(upload, "onprogress", JsUtils.wrapFunction(new Function() {
public void f() {
@@ -106,14 +106,14 @@ public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCal
dfd.notify(total, loaded, percent, "upload");
}
}));
-
+
Binder headers = settings.getHeaders();
if (headers != null) {
for (String headerKey : headers.getFieldNames()) {
xmlHttpRequest.setRequestHeader(headerKey, String.valueOf(headers.get(headerKey)));
}
}
-
+
if (data != null && !isFormData && !"GET".equalsIgnoreCase(httpMethod)) {
xmlHttpRequest.setRequestHeader("Content-Type", ctype);
}
@@ -121,9 +121,9 @@ public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCal
// Using gQuery to set credentials since this method was added in 2.5.1
// xmlHttpRequest.setWithCredentials(true);
JsUtils.prop(xmlHttpRequest, "withCredentials", settings.getWithCredentials());
-
+
final Request request = createRequestVltr(xmlHttpRequest, settings.getTimeout(), this);
-
+
xmlHttpRequest.setOnReadyStateChange(new ReadyStateChangeHandler() {
public void onReadyStateChange(XMLHttpRequest xhr) {
if (xhr.getReadyState() == XMLHttpRequest.DONE) {
@@ -153,14 +153,14 @@ public class PromiseReqBuilder extends DeferredPromiseImpl implements RequestCal
dfd.resolve(response, request);
}
}
-
+
/**
* Using violator pattern to execute private method
*/
private native void fireOnResponseReceivedVltr(Request rq, RequestCallback cb) /*-{
rq.@com.google.gwt.http.client.Request::fireOnResponseReceived(Lcom/google/gwt/http/client/RequestCallback;)(cb);
}-*/;
-
+
/**
* Using violator pattern to use protected constructor
*/