Commit 3675f244 authored by Ryan Hunt's avatar Ryan Hunt
Browse files

Bug 1534395 - Rename nsITabParent to nsIRemoteTab. r=nika,mconley

nsITabParent is exposed to frontend code and is generally used as a representation of a remote tab. We could just rename the interface to nsIBrowserParent and worry about it later, but I think it's better to rename the interface to nsIRemoteTab so that we can later work on splitting the interface away from the PBrowser protocol.

Note: Some frontend code refers to a TabParentId. This commit renames this to RemoteTabId. We need to figure out the purpose of TabId with fission.

Differential Revision: https://phabricator.services.mozilla.com/D28132

--HG--
rename : dom/interfaces/base/nsITabParent.idl => dom/interfaces/base/nsIRemoteTab.idl
extra : rebase_source : 9d8a1790a7bb10195ad063644d1a93d63b2afb72
parent a964b8a7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -669,8 +669,8 @@ ProxyAccessible* RootAccessible::GetPrimaryRemoteTopLevelContentDoc() const {
  mDocumentNode->GetDocShell()->GetTreeOwner(getter_AddRefs(owner));
  NS_ENSURE_TRUE(owner, nullptr);

  nsCOMPtr<nsITabParent> tabParent;
  owner->GetPrimaryTabParent(getter_AddRefs(tabParent));
  nsCOMPtr<nsIRemoteTab> tabParent;
  owner->GetPrimaryRemoteTab(getter_AddRefs(tabParent));
  if (!tabParent) {
    return nullptr;
  }
+8 −8
Original line number Diff line number Diff line
@@ -5646,7 +5646,7 @@ nsBrowserAccess.prototype = {
                   aIsExternal, aForceNotRemote = false,
                   aUserContextId = Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID,
                   aOpenerWindow = null, aOpenerBrowser = null,
                   aTriggeringPrincipal = null, aNextTabParentId = 0, aName = "", aCsp = null) {
                   aTriggeringPrincipal = null, aNextRemoteTabId = 0, aName = "", aCsp = null) {
    let win, needToFocusWin;

    // try the current window.  if we're in a popup, fall back on the most recent browser window
@@ -5679,7 +5679,7 @@ nsBrowserAccess.prototype = {
                                      forceNotRemote: aForceNotRemote,
                                      opener: aOpenerWindow,
                                      openerBrowser: aOpenerBrowser,
                                      nextTabParentId: aNextTabParentId,
                                      nextRemoteTabId: aNextRemoteTabId,
                                      name: aName,
                                      csp: aCsp,
                                      });
@@ -5818,22 +5818,22 @@ nsBrowserAccess.prototype = {
  },

  createContentWindowInFrame: function browser_createContentWindowInFrame(
                              aURI, aParams, aWhere, aFlags, aNextTabParentId,
                              aURI, aParams, aWhere, aFlags, aNextRemoteTabId,
                              aName) {
    // Passing a null-URI to only create the content window.
    return this.getContentWindowOrOpenURIInFrame(null, aParams, aWhere, aFlags,
                                                 aNextTabParentId, aName);
                                                 aNextRemoteTabId, aName);
  },

  openURIInFrame: function browser_openURIInFrame(aURI, aParams, aWhere, aFlags,
                                                  aNextTabParentId, aName) {
                                                  aNextRemoteTabId, aName) {
    return this.getContentWindowOrOpenURIInFrame(aURI, aParams, aWhere, aFlags,
                                                 aNextTabParentId, aName);
                                                 aNextRemoteTabId, aName);
  },

  getContentWindowOrOpenURIInFrame: function browser_getContentWindowOrOpenURIInFrame(
                                    aURI, aParams, aWhere, aFlags,
                                    aNextTabParentId, aName) {
                                    aNextRemoteTabId, aName) {
    if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
      dump("Error: openURIInFrame can only open in new tabs");
      return null;
@@ -5852,7 +5852,7 @@ nsBrowserAccess.prototype = {
                                 isExternal, false,
                                 userContextId, null, aParams.openerBrowser,
                                 aParams.triggeringPrincipal,
                                 aNextTabParentId, aName, aParams.csp);
                                 aNextRemoteTabId, aName, aParams.csp);
  },

  isTabContentWindow(aWindow) {
+12 −12
Original line number Diff line number Diff line
@@ -1403,7 +1403,7 @@ window._gBrowser = {
    var aOpener;
    var aOpenerBrowser;
    var aCreateLazyBrowser;
    var aNextTabParentId;
    var aNextRemoteTabId;
    var aFocusUrlBar;
    var aName;
    var aCsp;
@@ -1430,7 +1430,7 @@ window._gBrowser = {
      aOpener = params.opener;
      aOpenerBrowser = params.openerBrowser;
      aCreateLazyBrowser = params.createLazyBrowser;
      aNextTabParentId = params.nextTabParentId;
      aNextRemoteTabId = params.nextRemoteTabId;
      aFocusUrlBar = params.focusUrlBar;
      aName = params.name;
      aCsp = params.csp;
@@ -1465,7 +1465,7 @@ window._gBrowser = {
      sameProcessAsFrameLoader: aSameProcessAsFrameLoader,
      opener: aOpener,
      openerBrowser: aOpenerBrowser,
      nextTabParentId: aNextTabParentId,
      nextRemoteTabId: aNextRemoteTabId,
      focusUrlBar: aFocusUrlBar,
      name: aName,
      csp: aCsp,
@@ -1824,7 +1824,7 @@ window._gBrowser = {
  createBrowser({
    isPreloadBrowser,
    name,
    nextTabParentId,
    nextRemoteTabId,
    openerWindow,
    recordExecution,
    remoteType,
@@ -1903,12 +1903,12 @@ window._gBrowser = {
      b.setAttribute("preloadedState", "preloaded");
    }

    if (nextTabParentId) {
    if (nextRemoteTabId) {
      if (!remoteType) {
        throw new Error("Cannot have nextTabParentId without a remoteType");
        throw new Error("Cannot have nextRemoteTabId without a remoteType");
      }
      // Gecko is going to read this attribute and use it.
      b.setAttribute("nextTabParentId", nextTabParentId.toString());
      b.setAttribute("nextRemoteTabId", nextRemoteTabId.toString());
    }

    if (sameProcessAsFrameLoader) {
@@ -2257,7 +2257,7 @@ window._gBrowser = {
    index,
    lazyTabTitle,
    name,
    nextTabParentId,
    nextRemoteTabId,
    noInitialLabel,
    opener,
    openerBrowser,
@@ -2482,7 +2482,7 @@ window._gBrowser = {
          userContextId,
          sameProcessAsFrameLoader,
          openerWindow: opener,
          nextTabParentId,
          nextRemoteTabId,
          name,
          recordExecution,
          replayExecution,
@@ -2860,8 +2860,8 @@ window._gBrowser = {
  _hasBeforeUnload(aTab) {
    let browser = aTab.linkedBrowser;
    return browser.isRemoteBrowser && browser.frameLoader &&
           browser.frameLoader.tabParent &&
           browser.frameLoader.tabParent.hasBeforeUnload;
           browser.frameLoader.remoteTab &&
           browser.frameLoader.remoteTab.hasBeforeUnload;
  },

  _beginRemoveTab(aTab, {
@@ -4265,7 +4265,7 @@ window._gBrowser = {
        if (tab.linkedBrowser &&
            tab.linkedBrowser.isRemoteBrowser &&
            tab.linkedBrowser.frameLoader) {
          label += " (pid " + tab.linkedBrowser.frameLoader.tabParent.osPid + ")";
          label += " (pid " + tab.linkedBrowser.frameLoader.remoteTab.osPid + ")";

          if (window.docShell.QueryInterface(Ci.nsILoadContext).useRemoteSubframes) {
            label += " [F]";
+8 −8
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ add_task(async function activity_stream_in_privileged_content_process() {
    checkBrowserRemoteType(browser1, E10SUtils.PRIVILEGED_REMOTE_TYPE);

    // Note the processID for about:newtab for comparison later.
    let privilegedPid = browser1.frameLoader.tabParent.osPid;
    let privilegedPid = browser1.frameLoader.remoteTab.osPid;

    for (let url of [
      ABOUT_NEWTAB,
@@ -80,7 +80,7 @@ add_task(async function activity_stream_in_privileged_content_process() {
      `${ABOUT_HOME}?q=baz`,
    ]) {
      await BrowserTestUtils.withNewTab(url, async function(browser2) {
        is(browser2.frameLoader.tabParent.osPid, privilegedPid,
        is(browser2.frameLoader.remoteTab.osPid, privilegedPid,
          "Check that about:newtab tabs are in the same privileged content process.");
      });
    }
@@ -142,7 +142,7 @@ add_task(async function process_switching_through_navigation_features() {
    checkBrowserRemoteType(browser, E10SUtils.PRIVILEGED_REMOTE_TYPE);

    // Note the processID for about:newtab for comparison later.
    let privilegedPid = browser.frameLoader.tabParent.osPid;
    let privilegedPid = browser.frameLoader.remoteTab.osPid;

    // Check that about:newtab opened from JS in about:newtab page is in the same process.
    let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, ABOUT_NEWTAB, true);
@@ -154,13 +154,13 @@ add_task(async function process_switching_through_navigation_features() {
      BrowserTestUtils.removeTab(newTab);
    });
    browser = newTab.linkedBrowser;
    is(browser.frameLoader.tabParent.osPid, privilegedPid,
    is(browser.frameLoader.remoteTab.osPid, privilegedPid,
      "Check that new tab opened from about:newtab is loaded in privileged content process.");

    // Check that reload does not break the privileged content process affinity.
    BrowserReload();
    await BrowserTestUtils.browserLoaded(browser, false, ABOUT_NEWTAB);
    is(browser.frameLoader.tabParent.osPid, privilegedPid,
    is(browser.frameLoader.remoteTab.osPid, privilegedPid,
      "Check that about:newtab is still in privileged content process after reload.");

    // Load http webpage
@@ -175,7 +175,7 @@ add_task(async function process_switching_through_navigation_features() {
    // We will need to ensure that the process flip has fully completed so that
    // the navigation history data will be available when we do browser.goForward();
    await BrowserTestUtils.waitForEvent(newTab, "SSTabRestored");
    is(browser.frameLoader.tabParent.osPid, privilegedPid,
    is(browser.frameLoader.remoteTab.osPid, privilegedPid,
      "Check that about:newtab is still in privileged content process after history goBack.");

    // Check that using the history forward feature switches back to the web content process.
@@ -192,7 +192,7 @@ add_task(async function process_switching_through_navigation_features() {
    promiseLocation = BrowserTestUtils.waitForLocationChange(gBrowser, ABOUT_NEWTAB);
    browser.gotoIndex(0);
    await promiseLocation;
    is(browser.frameLoader.tabParent.osPid, privilegedPid,
    is(browser.frameLoader.remoteTab.osPid, privilegedPid,
      "Check that about:newtab is in privileged content process after history gotoIndex.");

    BrowserTestUtils.loadURI(browser, TEST_HTTP);
@@ -204,7 +204,7 @@ add_task(async function process_switching_through_navigation_features() {
      content.location = uri;
    });
    await BrowserTestUtils.browserLoaded(browser, false, ABOUT_NEWTAB);
    is(browser.frameLoader.tabParent.osPid, privilegedPid,
    is(browser.frameLoader.remoteTab.osPid, privilegedPid,
      "Check that about:newtab is in privileged content process after location change.");
  });

+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ async function testProbe(aProbe) {
  let hangTab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
  let hangBrowser = hangTab.linkedBrowser;
  ok(hangBrowser.isRemoteBrowser, "New tab should be remote.");
  ok(hangBrowser.frameLoader.tabParent.hasPresented, "New tab has presented.");
  ok(hangBrowser.frameLoader.remoteTab.hasPresented, "New tab has presented.");

  // Now switch back to the original tab and set up our hang.
  await BrowserTestUtils.switchTab(gBrowser, origTab);
Loading