mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1233803 - Add RemoteWebNavigation sessionHistory shim for addons. r=krizsa
This commit is contained in:
parent
3a8712ea2c
commit
1f5f37be76
@ -955,6 +955,34 @@ ChromeWindowInterposition.getters._content = function(addon, target) {
|
||||
return browser.contentWindowAsCPOW;
|
||||
};
|
||||
|
||||
var RemoteWebNavigationInterposition = new Interposition("RemoteWebNavigation");
|
||||
|
||||
RemoteWebNavigationInterposition.getters.sessionHistory = function(addon, target) {
|
||||
CompatWarning.warn("Direct access to browser.sessionHistory will no longer work in the chrome process.",
|
||||
addon, CompatWarning.warnings.content);
|
||||
|
||||
if (target instanceof Ci.nsIDocShell) {
|
||||
// We must have a non-remote browser, so we can go ahead
|
||||
// and just return the real sessionHistory.
|
||||
return target.sessionHistory;
|
||||
}
|
||||
|
||||
let impl = target.wrappedJSObject;
|
||||
if (!impl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let browser = impl._browser;
|
||||
|
||||
let remoteChromeGlobal = RemoteAddonsParent.browserToGlobal.get(browser);
|
||||
if (!remoteChromeGlobal) {
|
||||
CompatWarning.warn("CPOW for the remote browser docShell hasn't been received yet.");
|
||||
// We may not have any messages from this tab yet.
|
||||
return null;
|
||||
}
|
||||
return remoteChromeGlobal.docShell.sessionHistory;
|
||||
}
|
||||
|
||||
var RemoteAddonsParent = {
|
||||
init: function() {
|
||||
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
|
||||
@ -977,6 +1005,7 @@ var RemoteAddonsParent = {
|
||||
register(Ci.nsIComponentRegistrar, ComponentRegistrarInterposition);
|
||||
register(Ci.nsIObserverService, ObserverInterposition);
|
||||
register(Ci.nsIXPCComponents_Utils, ComponentsUtilsInterposition);
|
||||
register(Ci.nsIWebNavigation, RemoteWebNavigationInterposition);
|
||||
|
||||
return result;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user