Bug 1256468 - sessionHistory shim should QI DocShell to nsIWebNavigation automatically. r?gkrizsanits draft
authorMike Conley <mconley@mozilla.com>
Tue, 15 Mar 2016 19:05:24 -0400
changeset 340748 5c8f982166be1a6573b56fb4f549267b38cb8925
parent 340493 5e14887312d4523ab59c3f6c6c94a679cf42b496
child 516264 a6cbfee1b85ae7856c1fdbd3b6ad07406205d1a2
push id13054
push usermconley@mozilla.com
push dateTue, 15 Mar 2016 23:06:29 +0000
reviewersgkrizsanits
bugs1256468
milestone48.0a1
Bug 1256468 - sessionHistory shim should QI DocShell to nsIWebNavigation automatically. r?gkrizsanits MozReview-Commit-ID: 8benvQvcfLO
toolkit/components/addoncompat/RemoteAddonsParent.jsm
toolkit/components/addoncompat/tests/addon/bootstrap.js
--- a/toolkit/components/addoncompat/RemoteAddonsParent.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsParent.jsm
@@ -858,17 +858,17 @@ function getContentDocument(addon, brows
 
 function getSessionHistory(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;
+  return remoteChromeGlobal.docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
 }
 
 RemoteBrowserElementInterposition.getters.contentDocument = function(addon, target) {
   CompatWarning.warn("Direct access to browser.contentDocument will no longer work in the chrome process.",
                      addon, CompatWarning.warnings.content);
 
   return getContentDocument(addon, target);
 };
--- a/toolkit/components/addoncompat/tests/addon/bootstrap.js
+++ b/toolkit/components/addoncompat/tests/addon/bootstrap.js
@@ -56,16 +56,17 @@ function testContentWindow()
     let tab = gBrowser.addTab(url);
     gBrowser.selectedTab = tab;
     let browser = tab.linkedBrowser;
     addLoadListener(browser, function handler() {
       ok(gWin.content, "content is defined on chrome window");
       ok(browser.contentWindow, "contentWindow is defined");
       ok(browser.contentDocument, "contentWindow is defined");
       is(gWin.content, browser.contentWindow, "content === contentWindow");
+      ok(browser.webNavigation.sessionHistory, "sessionHistory is defined");
 
       ok(browser.contentDocument.getElementById("link"), "link present in document");
 
       // FIXME: Waiting on bug 1073631.
       //is(browser.contentWindow.wrappedJSObject.global, 3, "global available on document");
 
       removeTab(tab, resolve);
     });