Bug 1237081 - remove the getter of userContextId from nsIDocShell, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 06 Jan 2016 15:39:58 +0000
changeset 278840 5435dcc651f0487ec43e1610029f9c0bed1ef04e
parent 278839 1d17f829b46447ddc649294aa32d2684414fa1c6
child 278841 23974693ffc5f51babf58313b1327da89a38e8a1
push id29860
push usercbook@mozilla.com
push dateThu, 07 Jan 2016 10:51:20 +0000
treeherdermozilla-central@e0bcd16e1d4b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1237081
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1237081 - remove the getter of userContextId from nsIDocShell, r=smaug
browser/components/sessionstore/SessionHistory.jsm
browser/components/sessionstore/test/browser_sessionStoreContainer.js
docshell/base/nsDocShell.cpp
docshell/base/nsIDocShell.idl
--- a/browser/components/sessionstore/SessionHistory.jsm
+++ b/browser/components/sessionstore/SessionHistory.jsm
@@ -59,20 +59,22 @@ var SessionHistoryInternal = {
 
   /**
    * Collects session history data for a given docShell.
    *
    * @param docShell
    *        The docShell that owns the session history.
    */
   collect: function (docShell) {
-    let data = {entries: [], userContextId: docShell.userContextId };
+    let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
     let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
     let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
 
+    let data = {entries: [], userContextId: loadContext.originAttributes.userContextId };
+
     if (history && history.count > 0) {
       // Loop over the transaction linked list directly so we can get the
       // persist property for each transaction.
       for (let txn = history.rootTransaction; txn; txn = txn.next) {
         let entry = this.serializeEntry(txn.sHEntry);
         entry.persist = txn.persist;
         data.entries.push(entry);
       }
@@ -249,17 +251,17 @@ var SessionHistoryInternal = {
    * @param tabData
    *        The tabdata including all history entries.
    */
   restore: function (docShell, tabData) {
     let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
     let history = webNavigation.sessionHistory;
 
     if ("userContextId" in tabData) {
-      docShell.userContextId = tabData.userContextId;
+      docShell.setUserContextId(tabData.userContextId);
     }
 
     if (history.count > 0) {
       history.PurgeHistory(history.count);
     }
     history.QueryInterface(Ci.nsISHistoryInternal);
 
     let idMap = { used: {} };
--- a/browser/components/sessionstore/test/browser_sessionStoreContainer.js
+++ b/browser/components/sessionstore/test/browser_sessionStoreContainer.js
@@ -1,15 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function retrieveUserContextId(browser) {
   return ContentTask.spawn(browser, null, function* () {
-    return docShell.userContextId;
+    let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
+    return loadContext.originAttributes.userContextId;
   });
 }
 
 add_task(function() {
   for (let i = 0; i < 3; ++i) {
     let tab = gBrowser.addTab("about:blank");
     let browser = tab.linkedBrowser;
 
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -13832,27 +13832,16 @@ nsDocShell::SetIsBrowserInsideApp(uint32
 NS_IMETHODIMP
 nsDocShell::SetIsSignedPackage(const nsAString& aSignedPkg)
 {
   mSignedPkg = aSignedPkg;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetUserContextId(uint32_t* aUserContextId)
-{
-  if (!aUserContextId) {
-    return NS_ERROR_FAILURE;
-  }
-
-  *aUserContextId = mUserContextId;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsDocShell::SetUserContextId(uint32_t aUserContextId)
 {
   mUserContextId = aUserContextId;
   return NS_OK;
 }
 
 /* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsBrowserElement(bool* aIsBrowser)
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -38,17 +38,17 @@ interface nsIPrincipal;
 interface nsIWebBrowserPrint;
 interface nsIPrivacyTransitionObserver;
 interface nsIReflowObserver;
 interface nsIScrollObserver;
 interface nsITabParent;
 
 typedef unsigned long nsLoadFlags;
 
-[scriptable, builtinclass, uuid(258a8a33-219f-42f8-8fa8-f8f2dcd2358b)]
+[scriptable, builtinclass, uuid(98358234-3936-4b95-b051-fcda4e55b52d)]
 interface nsIDocShell : nsIDocShellTreeItem
 {
   /**
    * Loads a given URI.  This will give priority to loading the requested URI
    * in the object implementing	this interface.  If it can't be loaded here
    * however, the URL dispatcher will go through its normal process of content
    * loading.
    *
@@ -1092,13 +1092,13 @@ interface nsIDocShell : nsIDocShellTreeI
   attribute boolean windowDraggingAllowed;
 
   /**
    * Sets/gets the current scroll restoration mode.
    * @see https://html.spec.whatwg.org/#dom-history-scroll-restoration
   */
   attribute boolean currentScrollRestorationIsManual;
 
-  /**
-   * Sets/gets the user context ID for this docshell.
+  /*
+   * Sets the user context ID for this docshell.
    */
-  attribute unsigned long userContextId;
+  void setUserContextId(in unsigned long aUserContextId);
 };