mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge again.
This commit is contained in:
commit
e5214fe562
@ -454,39 +454,39 @@ public final class Tab {
|
||||
GeckoApp.mAppContext.loadUrl("about:reader?url=" + Uri.encode(getURL()));
|
||||
}
|
||||
|
||||
public boolean doReload() {
|
||||
public void doReload() {
|
||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Reload", "");
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Our version of nsSHistory::GetCanGoBack
|
||||
public boolean canDoBack() {
|
||||
return (mHistoryIndex < 1 ? false : true);
|
||||
return mHistoryIndex > 0;
|
||||
}
|
||||
|
||||
public boolean doBack() {
|
||||
if (mHistoryIndex < 1) {
|
||||
if (!canDoBack())
|
||||
return false;
|
||||
}
|
||||
|
||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Back", "");
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean doStop() {
|
||||
public void doStop() {
|
||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Stop", "");
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Our version of nsSHistory::GetCanGoForward
|
||||
public boolean canDoForward() {
|
||||
return (mHistoryIndex + 1 < mHistorySize);
|
||||
return mHistoryIndex < mHistorySize - 1;
|
||||
}
|
||||
|
||||
public boolean doForward() {
|
||||
if (mHistoryIndex + 1 >= mHistorySize) {
|
||||
if (!canDoForward())
|
||||
return false;
|
||||
}
|
||||
|
||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Forward", "");
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
return true;
|
||||
@ -531,22 +531,22 @@ public final class Tab {
|
||||
|
||||
void handleSessionHistoryMessage(String event, JSONObject message) throws JSONException {
|
||||
if (event.equals("New")) {
|
||||
final String uri = message.getString("uri");
|
||||
final String url = message.getString("url");
|
||||
mHistoryIndex++;
|
||||
mHistorySize = mHistoryIndex + 1;
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
GlobalHistory.getInstance().add(uri);
|
||||
GlobalHistory.getInstance().add(url);
|
||||
}
|
||||
});
|
||||
} else if (event.equals("Back")) {
|
||||
if (mHistoryIndex - 1 < 0) {
|
||||
if (!canDoBack()) {
|
||||
Log.e(LOGTAG, "Received unexpected back notification");
|
||||
return;
|
||||
}
|
||||
mHistoryIndex--;
|
||||
} else if (event.equals("Forward")) {
|
||||
if (mHistoryIndex + 1 >= mHistorySize) {
|
||||
if (!canDoForward()) {
|
||||
Log.e(LOGTAG, "Received unexpected forward notification");
|
||||
return;
|
||||
}
|
||||
@ -559,14 +559,20 @@ public final class Tab {
|
||||
}
|
||||
mHistoryIndex = index;
|
||||
} else if (event.equals("Purge")) {
|
||||
int numEntries = message.getInt("index");
|
||||
int numEntries = message.getInt("numEntries");
|
||||
if (numEntries > mHistorySize) {
|
||||
Log.e(LOGTAG, "Received unexpectedly large number of history entries to purge");
|
||||
mHistoryIndex = -1;
|
||||
mHistorySize = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
mHistorySize -= numEntries;
|
||||
mHistoryIndex -= numEntries;
|
||||
if (mHistorySize < 0 || mHistoryIndex < -1) {
|
||||
Log.e(LOGTAG, "Unexpected history state: index = " + mHistoryIndex + ", size = " + mHistorySize);
|
||||
mHistorySize = 0;
|
||||
mHistoryIndex = -1;
|
||||
}
|
||||
|
||||
// If we weren't at the last history entry, mHistoryIndex may have become too small
|
||||
if (mHistoryIndex < -1)
|
||||
mHistoryIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2971,33 +2971,37 @@ Tab.prototype = {
|
||||
onStatusChange: function(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
|
||||
},
|
||||
|
||||
_sendHistoryEvent: function(aMessage, aIndex, aUri) {
|
||||
_sendHistoryEvent: function(aMessage, aParams) {
|
||||
let message = {
|
||||
gecko: {
|
||||
type: "SessionHistory:" + aMessage,
|
||||
tabID: this.id,
|
||||
}
|
||||
};
|
||||
if (aIndex != -1) {
|
||||
message.gecko.index = aIndex;
|
||||
}
|
||||
if (aUri != null) {
|
||||
message.gecko.uri = aUri;
|
||||
|
||||
if (aParams) {
|
||||
if ("url" in aParams)
|
||||
message.gecko.url = aParams.url;
|
||||
if ("index" in aParams)
|
||||
message.gecko.index = aParams.index;
|
||||
if ("numEntries" in aParams)
|
||||
message.gecko.numEntries = aParams.numEntries;
|
||||
}
|
||||
|
||||
sendMessageToJava(message);
|
||||
},
|
||||
|
||||
OnHistoryNewEntry: function(aUri) {
|
||||
this._sendHistoryEvent("New", -1, aUri.spec);
|
||||
this._sendHistoryEvent("New", { url: aUri.spec });
|
||||
},
|
||||
|
||||
OnHistoryGoBack: function(aUri) {
|
||||
this._sendHistoryEvent("Back", -1, null);
|
||||
this._sendHistoryEvent("Back");
|
||||
return true;
|
||||
},
|
||||
|
||||
OnHistoryGoForward: function(aUri) {
|
||||
this._sendHistoryEvent("Forward", -1, null);
|
||||
this._sendHistoryEvent("Forward");
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -3008,12 +3012,12 @@ Tab.prototype = {
|
||||
},
|
||||
|
||||
OnHistoryGotoIndex: function(aIndex, aUri) {
|
||||
this._sendHistoryEvent("Goto", aIndex, null);
|
||||
this._sendHistoryEvent("Goto", { index: aIndex });
|
||||
return true;
|
||||
},
|
||||
|
||||
OnHistoryPurge: function(aNumEntries) {
|
||||
this._sendHistoryEvent("Purge", aNumEntries, null);
|
||||
this._sendHistoryEvent("Purge", { numEntries: aNumEntries });
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -39,17 +39,17 @@ let modules = {
|
||||
},
|
||||
blocked: {
|
||||
uri: "chrome://browser/content/blockedSite.xhtml",
|
||||
privileged: true,
|
||||
privileged: false,
|
||||
hide: true
|
||||
},
|
||||
certerror: {
|
||||
uri: "chrome://browser/content/aboutCertError.xhtml",
|
||||
privileged: true,
|
||||
privileged: false,
|
||||
hide: true
|
||||
},
|
||||
home: {
|
||||
uri: "chrome://browser/content/aboutHome.xhtml",
|
||||
privileged: true
|
||||
privileged: false
|
||||
},
|
||||
apps: {
|
||||
uri: "chrome://browser/content/aboutApps.xhtml",
|
||||
|
Loading…
Reference in New Issue
Block a user