Fixed a bug in HistoryImplIE6 where a static method initUrlCheckTimer() made a call to an instance method in HistoryImpl, which threw an error and caused the page to refresh continuously. The static method has been changed to an instance method, so "this" is now defined.
Patch by: jlabanca, ajr
Review by: ajr (pair programming)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2841 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java b/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
index 14343f8..72b54e9 100644
--- a/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
+++ b/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
@@ -36,34 +36,6 @@
DOM.setInnerText(div, maybeHtml);
return DOM.getInnerHTML(div);
}
-
- private static native void initUrlCheckTimer() /*-{
- // This is the URL check timer. It detects when an unexpected change
- // occurs in the document's URL (e.g. when the user enters one manually
- // or selects a 'favorite', but only the #hash part changes). When this
- // occurs, we _must_ reload the page. This is because IE has a really
- // nasty bug that totally mangles its history stack and causes the location
- // bar in the UI to stop working under these circumstances.
- var urlChecker = function() {
- var hash = $wnd.location.hash;
- if (hash.length > 0) {
- var token = '';
- try {
- token = this.@com.google.gwt.user.client.impl.HistoryImpl::decodeFragment(Ljava/lang/String;)(hash.substring(1));
- } catch (e) {
- // If there's a bad hash, always reload. This could only happen if
- // if someone entered or linked to a bad url.
- $wnd.location.reload();
- }
-
- if ($wnd.__gwt_historyToken && (token != $wnd.__gwt_historyToken)) {
- $wnd.location.reload();
- }
- }
- $wnd.setTimeout(urlChecker, 250);
- };
- urlChecker();
- }-*/;
@Override
public boolean init() {
@@ -128,4 +100,33 @@
doc.close();
}
}-*/;
+
+ private native void initUrlCheckTimer() /*-{
+ // This is the URL check timer. It detects when an unexpected change
+ // occurs in the document's URL (e.g. when the user enters one manually
+ // or selects a 'favorite', but only the #hash part changes). When this
+ // occurs, we _must_ reload the page. This is because IE has a really
+ // nasty bug that totally mangles its history stack and causes the location
+ // bar in the UI to stop working under these circumstances.
+ var historyImplRef = this;
+ var urlChecker = function() {
+ var hash = $wnd.location.hash;
+ if (hash.length > 0) {
+ var token = '';
+ try {
+ token = historyImplRef.@com.google.gwt.user.client.impl.HistoryImpl::decodeFragment(Ljava/lang/String;)(hash.substring(1));
+ } catch (e) {
+ // If there's a bad hash, always reload. This could only happen if
+ // if someone entered or linked to a bad url.
+ $wnd.location.reload();
+ }
+
+ if ($wnd.__gwt_historyToken && (token != $wnd.__gwt_historyToken)) {
+ $wnd.location.reload();
+ }
+ }
+ $wnd.setTimeout(urlChecker, 250);
+ };
+ urlChecker();
+ }-*/;
}