Bug 1322414 - part 3: use primary attribute in frontend, r?mconley draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 08 Dec 2016 11:42:11 -1000
changeset 448283 df74e2409a1528c09d567aca88b489673cf3f41d
parent 448282 bec2276053b06534ae9b4bae5d485273c39d02a4
child 448284 3b466ce34b5553d24ab362754ffa58414eb6243e
push id38300
push usergijskruitbosch@gmail.com
push dateFri, 09 Dec 2016 19:26:07 +0000
reviewersmconley
bugs1322414
milestone53.0a1
Bug 1322414 - part 3: use primary attribute in frontend, r?mconley MozReview-Commit-ID: IGRf35cXURu
browser/base/content/tabbrowser.xml
mobile/android/chrome/content/browser.js
mobile/android/chrome/content/geckoview.xul
toolkit/components/printing/content/printUtils.js
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -19,17 +19,18 @@
       <xul:tabbox anonid="tabbox" class="tabbrowser-tabbox"
                   flex="1" eventnode="document" xbl:inherits="handleCtrlPageUpDown"
                   onselect="if (event.target.localName == 'tabpanels') this.parentNode.updateCurrentBrowser();">
         <xul:tabpanels flex="1" class="plain" selectedIndex="0" anonid="panelcontainer">
           <xul:notificationbox flex="1" notificationside="top">
             <xul:hbox flex="1" class="browserSidebarContainer">
               <xul:vbox flex="1" class="browserContainer">
                 <xul:stack flex="1" class="browserStack" anonid="browserStack">
-                  <xul:browser anonid="initialBrowser" type="content-primary" message="true" messagemanagergroup="browsers"
+                  <xul:browser anonid="initialBrowser" type="content" message="true" messagemanagergroup="browsers"
+                               primary="true"
                                xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,selectmenulist,datetimepicker"/>
                 </xul:stack>
               </xul:vbox>
             </xul:hbox>
           </xul:notificationbox>
         </xul:tabpanels>
       </xul:tabbox>
       <children/>
@@ -1087,19 +1088,19 @@
               if (!this._lastRelatedTab.selected)
                 this._lastRelatedTab.owner = null;
               this._lastRelatedTab = null;
             }
 
             var oldBrowser = this.mCurrentBrowser;
 
             if (!gMultiProcessBrowser) {
-              oldBrowser.setAttribute("type", "content");
+              oldBrowser.removeAttribute("primary");
               oldBrowser.docShellIsActive = false;
-              newBrowser.setAttribute("type", "content-primary");
+              newBrowser.setAttribute("primary", "true");
               newBrowser.docShellIsActive =
                 (window.windowState != window.STATE_MINIMIZED);
             }
 
             var updateBlockedPopups = false;
             if ((oldBrowser.blockedPopups && !newBrowser.blockedPopups) ||
                 (!oldBrowser.blockedPopups && newBrowser.blockedPopups))
               updateBlockedPopups = true;
@@ -2609,17 +2610,17 @@
 
             if (browser.registeredOpenURI && !aAdoptedByTab) {
               this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI,
                                                        browser.getAttribute("usercontextid") || 0);
               delete browser.registeredOpenURI;
             }
 
             // We are no longer the primary content area.
-            browser.setAttribute("type", "content");
+            browser.removeAttribute("primary");
 
             // Remove this tab as the owner of any other tabs, since it's going away.
             for (let tab of this.tabs) {
               if ("owner" in tab && tab.owner == aTab)
                 // |tab| is a child of the tab we're removing, make it an orphan
                 tab.owner = null;
             }
 
@@ -3726,26 +3727,26 @@
               this.assert(!this.loadTimer);
               this.assert(!this.loadingTab);
               this.assert(this.lastVisibleTab === this.requestedTab);
               this.assert(this.minimized || this.getTabState(this.requestedTab) == this.STATE_LOADED);
 
               this.destroy();
 
               let toBrowser = this.requestedTab.linkedBrowser;
-              toBrowser.setAttribute("type", "content-primary");
+              toBrowser.setAttribute("primary", "true");
 
               this.tabbrowser._adjustFocusAfterTabSwitch(this.requestedTab);
 
               let fromBrowser = this.originalTab.linkedBrowser;
               // It's possible that the tab we're switching from closed
               // before we were able to finalize, in which case, fromBrowser
               // doesn't exist.
               if (fromBrowser) {
-                fromBrowser.setAttribute("type", "content");
+                fromBrowser.removeAttribute("primary");
               }
 
               let event = new CustomEvent("TabSwitchDone", {
                 bubbles: true,
                 cancelable: true
               });
               this.tabbrowser.dispatchEvent(event);
             },
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3666,23 +3666,23 @@ Tab.prototype = {
   // This should be called to update the browser when the tab gets selected/unselected
   setActive: function setActive(aActive) {
     if (!this.browser || !this.browser.docShell)
       return;
 
     this.lastTouchedAt = Date.now();
 
     if (aActive) {
-      this.browser.setAttribute("type", "content-primary");
+      this.browser.setAttribute("primary", "true");
       this.browser.focus();
       this.browser.docShellIsActive = true;
       Reader.updatePageAction(this);
       ExternalApps.updatePageAction(this.browser.currentURI, this.browser.contentDocument);
     } else {
-      this.browser.setAttribute("type", "content");
+      this.browser.removeAttribute("primary");
       this.browser.docShellIsActive = false;
       this.browser.blur();
     }
   },
 
   getActive: function getActive() {
     return this.browser.docShellIsActive;
   },
--- a/mobile/android/chrome/content/geckoview.xul
+++ b/mobile/android/chrome/content/geckoview.xul
@@ -5,12 +5,12 @@
 
 <?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
 
 <window id="main-window"
         onload="startup();"
         windowtype="navigator:browser"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-  <browser id="content" type="content-primary" src="https://mozilla.com" flex="1" remote="true"/>
+  <browser id="content" type="content" primary="true" src="https://mozilla.com" flex="1" remote="true"/>
 
   <script type="application/javascript" src="chrome://browser/content/geckoview.js"/>
 </window>
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -15,17 +15,17 @@
  *
  * To compound that, we need to support remote browsers, and that means
  * kicking off the print jobs in the content process. This means we send
  * messages back and forth to that process. browser-content.js contains
  * the object that listens and responds to the messages that PrintUtils
  * sends.
  *
  * This also means that <xul:browser>'s that hope to use PrintUtils must have
- * their type attribute set to either "content" or "content-primary".
+ * their type attribute set to "content".
  *
  * PrintUtils sends messages at different points in its implementation, but
  * their documentation is consolidated here for ease-of-access.
  *
  *
  * Messages sent:
  *
  *   Printing:Print
@@ -160,23 +160,22 @@ var PrintUtils = {
   /**
    * Initializes print preview.
    *
    * @param aListenerObj
    *        An object that defines the following functions:
    *
    *        getPrintPreviewBrowser:
    *          Returns the <xul:browser> to display the print preview in. This
-   *          <xul:browser> must have its type attribute set to "content" or
-   *          "content-primary".
+   *          <xul:browser> must have its type attribute set to "content".
    *
    *        getSourceBrowser:
    *          Returns the <xul:browser> that contains the document being
    *          printed. This <xul:browser> must have its type attribute set to
-   *          "content" or "content-primary".
+   *          "content".
    *
    *        getNavToolbox:
    *          Returns the primary toolbox for this window.
    *
    *        onEnter:
    *          Called upon entering print preview.
    *
    *        onExit: