зеркало из https://github.com/mozilla/gecko-dev.git
Merge again.
This commit is contained in:
Коммит
fc92671ba3
|
@ -454,39 +454,39 @@ public final class Tab {
|
||||||
GeckoApp.mAppContext.loadUrl("about:reader?url=" + Uri.encode(getURL()));
|
GeckoApp.mAppContext.loadUrl("about:reader?url=" + Uri.encode(getURL()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doReload() {
|
public void doReload() {
|
||||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Reload", "");
|
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Reload", "");
|
||||||
GeckoAppShell.sendEventToGecko(e);
|
GeckoAppShell.sendEventToGecko(e);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Our version of nsSHistory::GetCanGoBack
|
||||||
public boolean canDoBack() {
|
public boolean canDoBack() {
|
||||||
return (mHistoryIndex < 1 ? false : true);
|
return mHistoryIndex > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doBack() {
|
public boolean doBack() {
|
||||||
if (mHistoryIndex < 1) {
|
if (!canDoBack())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Back", "");
|
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Back", "");
|
||||||
GeckoAppShell.sendEventToGecko(e);
|
GeckoAppShell.sendEventToGecko(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doStop() {
|
public void doStop() {
|
||||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Stop", "");
|
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Stop", "");
|
||||||
GeckoAppShell.sendEventToGecko(e);
|
GeckoAppShell.sendEventToGecko(e);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Our version of nsSHistory::GetCanGoForward
|
||||||
public boolean canDoForward() {
|
public boolean canDoForward() {
|
||||||
return (mHistoryIndex + 1 < mHistorySize);
|
return mHistoryIndex < mHistorySize - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doForward() {
|
public boolean doForward() {
|
||||||
if (mHistoryIndex + 1 >= mHistorySize) {
|
if (!canDoForward())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Forward", "");
|
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Forward", "");
|
||||||
GeckoAppShell.sendEventToGecko(e);
|
GeckoAppShell.sendEventToGecko(e);
|
||||||
return true;
|
return true;
|
||||||
|
@ -531,22 +531,22 @@ public final class Tab {
|
||||||
|
|
||||||
void handleSessionHistoryMessage(String event, JSONObject message) throws JSONException {
|
void handleSessionHistoryMessage(String event, JSONObject message) throws JSONException {
|
||||||
if (event.equals("New")) {
|
if (event.equals("New")) {
|
||||||
final String uri = message.getString("uri");
|
final String url = message.getString("url");
|
||||||
mHistoryIndex++;
|
mHistoryIndex++;
|
||||||
mHistorySize = mHistoryIndex + 1;
|
mHistorySize = mHistoryIndex + 1;
|
||||||
GeckoAppShell.getHandler().post(new Runnable() {
|
GeckoAppShell.getHandler().post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
GlobalHistory.getInstance().add(uri);
|
GlobalHistory.getInstance().add(url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (event.equals("Back")) {
|
} else if (event.equals("Back")) {
|
||||||
if (mHistoryIndex - 1 < 0) {
|
if (!canDoBack()) {
|
||||||
Log.e(LOGTAG, "Received unexpected back notification");
|
Log.e(LOGTAG, "Received unexpected back notification");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mHistoryIndex--;
|
mHistoryIndex--;
|
||||||
} else if (event.equals("Forward")) {
|
} else if (event.equals("Forward")) {
|
||||||
if (mHistoryIndex + 1 >= mHistorySize) {
|
if (!canDoForward()) {
|
||||||
Log.e(LOGTAG, "Received unexpected forward notification");
|
Log.e(LOGTAG, "Received unexpected forward notification");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -559,14 +559,20 @@ public final class Tab {
|
||||||
}
|
}
|
||||||
mHistoryIndex = index;
|
mHistoryIndex = index;
|
||||||
} else if (event.equals("Purge")) {
|
} 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;
|
mHistorySize -= numEntries;
|
||||||
mHistoryIndex -= numEntries;
|
mHistoryIndex -= numEntries;
|
||||||
if (mHistorySize < 0 || mHistoryIndex < -1) {
|
|
||||||
Log.e(LOGTAG, "Unexpected history state: index = " + mHistoryIndex + ", size = " + mHistorySize);
|
// If we weren't at the last history entry, mHistoryIndex may have become too small
|
||||||
mHistorySize = 0;
|
if (mHistoryIndex < -1)
|
||||||
mHistoryIndex = -1;
|
mHistoryIndex = -1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2971,33 +2971,37 @@ Tab.prototype = {
|
||||||
onStatusChange: function(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
|
onStatusChange: function(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
|
||||||
},
|
},
|
||||||
|
|
||||||
_sendHistoryEvent: function(aMessage, aIndex, aUri) {
|
_sendHistoryEvent: function(aMessage, aParams) {
|
||||||
let message = {
|
let message = {
|
||||||
gecko: {
|
gecko: {
|
||||||
type: "SessionHistory:" + aMessage,
|
type: "SessionHistory:" + aMessage,
|
||||||
tabID: this.id,
|
tabID: this.id,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (aIndex != -1) {
|
|
||||||
message.gecko.index = aIndex;
|
if (aParams) {
|
||||||
}
|
if ("url" in aParams)
|
||||||
if (aUri != null) {
|
message.gecko.url = aParams.url;
|
||||||
message.gecko.uri = aUri;
|
if ("index" in aParams)
|
||||||
|
message.gecko.index = aParams.index;
|
||||||
|
if ("numEntries" in aParams)
|
||||||
|
message.gecko.numEntries = aParams.numEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessageToJava(message);
|
sendMessageToJava(message);
|
||||||
},
|
},
|
||||||
|
|
||||||
OnHistoryNewEntry: function(aUri) {
|
OnHistoryNewEntry: function(aUri) {
|
||||||
this._sendHistoryEvent("New", -1, aUri.spec);
|
this._sendHistoryEvent("New", { url: aUri.spec });
|
||||||
},
|
},
|
||||||
|
|
||||||
OnHistoryGoBack: function(aUri) {
|
OnHistoryGoBack: function(aUri) {
|
||||||
this._sendHistoryEvent("Back", -1, null);
|
this._sendHistoryEvent("Back");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
OnHistoryGoForward: function(aUri) {
|
OnHistoryGoForward: function(aUri) {
|
||||||
this._sendHistoryEvent("Forward", -1, null);
|
this._sendHistoryEvent("Forward");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3008,12 +3012,12 @@ Tab.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
OnHistoryGotoIndex: function(aIndex, aUri) {
|
OnHistoryGotoIndex: function(aIndex, aUri) {
|
||||||
this._sendHistoryEvent("Goto", aIndex, null);
|
this._sendHistoryEvent("Goto", { index: aIndex });
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
OnHistoryPurge: function(aNumEntries) {
|
OnHistoryPurge: function(aNumEntries) {
|
||||||
this._sendHistoryEvent("Purge", aNumEntries, null);
|
this._sendHistoryEvent("Purge", { numEntries: aNumEntries });
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -39,17 +39,17 @@ let modules = {
|
||||||
},
|
},
|
||||||
blocked: {
|
blocked: {
|
||||||
uri: "chrome://browser/content/blockedSite.xhtml",
|
uri: "chrome://browser/content/blockedSite.xhtml",
|
||||||
privileged: true,
|
privileged: false,
|
||||||
hide: true
|
hide: true
|
||||||
},
|
},
|
||||||
certerror: {
|
certerror: {
|
||||||
uri: "chrome://browser/content/aboutCertError.xhtml",
|
uri: "chrome://browser/content/aboutCertError.xhtml",
|
||||||
privileged: true,
|
privileged: false,
|
||||||
hide: true
|
hide: true
|
||||||
},
|
},
|
||||||
home: {
|
home: {
|
||||||
uri: "chrome://browser/content/aboutHome.xhtml",
|
uri: "chrome://browser/content/aboutHome.xhtml",
|
||||||
privileged: true
|
privileged: false
|
||||||
},
|
},
|
||||||
apps: {
|
apps: {
|
||||||
uri: "chrome://browser/content/aboutApps.xhtml",
|
uri: "chrome://browser/content/aboutApps.xhtml",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче