Merge inbound to m-c
authorWes Kocher <wkocher@mozilla.com>
Fri, 13 Sep 2013 18:14:32 -0700
changeset 147177 53d5e43e23cc12d8d2d48d191e4d0e7685000e3a
parent 147176 cdc22fbf554ea6d69ba5e17991d910d968a380bf (current diff)
parent 147065 da5496557024272d121e9e61d68bc5875bc5e142 (diff)
child 147178 59f890ddd95ffcae16973f5da097201620c0559b
child 147221 81af7a75991debab12ecca41bf4fcf21a0d4d78b
child 147229 13e8f5eb231e8d65c055aa9ce52727a3b176e3ef
child 147233 37452cc13fa16d4d1360ec01cfe3cbeabaaf1d0e
push id33789
push userkwierso@gmail.com
push dateSat, 14 Sep 2013 01:20:42 +0000
treeherdermozilla-inbound@59f890ddd95f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone26.0a1
first release with
nightly linux32
53d5e43e23cc / 26.0a1 / 20130914030203 / files
nightly linux64
53d5e43e23cc / 26.0a1 / 20130914030203 / files
nightly mac
53d5e43e23cc / 26.0a1 / 20130914030203 / files
nightly win32
53d5e43e23cc / 26.0a1 / 20130914030203 / files
nightly win64
53d5e43e23cc / 26.0a1 / 20130914030203 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to m-c
browser/base/content/browser.js
browser/devtools/webconsole/webconsole.js
browser/modules/webappsUI.jsm
--- a/addon-sdk/source/lib/sdk/window/utils.js
+++ b/addon-sdk/source/lib/sdk/window/utils.js
@@ -292,16 +292,17 @@ exports.openDialog = openDialog;
 function windows(type, options) {
   options = options || {};
   let list = [];
   let winEnum = WM.getEnumerator(type);
   while (winEnum.hasMoreElements()) {
     let window = winEnum.getNext().QueryInterface(Ci.nsIDOMWindow);
     // Only add non-private windows when pb permission isn't set,
     // unless an option forces the addition of them.
+    // XXXbz should this be checking window.closed?
     if (options.includePrivate || !isWindowPrivate(window)) {
       list.push(window);
     }
   }
   return list;
 }
 exports.windows = windows;
 
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2172,16 +2172,19 @@ function BrowserPageInfo(doc, initialTab
   var args = {doc: doc, initialTab: initialTab, imageElement: imageElement};
   var windows = Services.wm.getEnumerator("Browser:page-info");
 
   var documentURL = doc ? doc.location : window.content.document.location;
 
   // Check for windows matching the url
   while (windows.hasMoreElements()) {
     var currentWindow = windows.getNext();
+    if (currentWindow.closed) {
+      continue;
+    }
     if (currentWindow.document.documentElement.getAttribute("relatedUrl") == documentURL) {
       currentWindow.focus();
       currentWindow.resetPageInfo(args);
       return currentWindow;
     }
   }
 
   // We didn't find a matching window, so open a new one.
@@ -6035,17 +6038,17 @@ function warnAboutClosingWindow() {
     return gBrowser.warnAboutClosingTabs(gBrowser.closingTabsEnum.ALL);
 
   // Figure out if there's at least one other browser window around.
   let e = Services.wm.getEnumerator("navigator:browser");
   let otherPBWindowExists = false;
   let nonPopupPresent = false;
   while (e.hasMoreElements()) {
     let win = e.getNext();
-    if (win != window) {
+    if (!win.closed && win != window) {
       if (isPBWindow && PrivateBrowsingUtils.isWindowPrivate(win))
         otherPBWindowExists = true;
       if (win.toolbar.visible)
         nonPopupPresent = true;
       // If the current window is not in private browsing mode we don't need to 
       // look for other pb windows, we can leave the loop when finding the 
       // first non-popup window. If however the current window is in private 
       // browsing mode then we need at least one other pb and one non-popup 
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -449,16 +449,19 @@ function isBidiEnabled() {
   return rv;
 }
 
 function openAboutDialog() {
   var enumerator = Services.wm.getEnumerator("Browser:About");
   while (enumerator.hasMoreElements()) {
     // Only open one about window (Bug 599573)
     let win = enumerator.getNext();
+    if (win.closed) {
+      continue;
+    }
     win.focus();
     return;
   }
 
 #ifdef XP_WIN
   var features = "chrome,centerscreen,dependent";
 #elifdef XP_MACOSX
   var features = "chrome,resizable=no,minimizable=no";
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -764,16 +764,17 @@ BrowserGlue.prototype = {
     if (aQuitType == "restart")
       return;
 
     var windowcount = 0;
     var pagecount = 0;
     var browserEnum = Services.wm.getEnumerator("navigator:browser");
     let allWindowsPrivate = true;
     while (browserEnum.hasMoreElements()) {
+      // XXXbz should we skip closed windows here?
       windowcount++;
 
       var browser = browserEnum.getNext();
       if (!PrivateBrowsingUtils.isWindowPrivate(browser))
         allWindowsPrivate = false;
       var tabbrowser = browser.document.getElementById("content");
       if (tabbrowser)
         pagecount += tabbrowser.browsers.length - tabbrowser._numPinnedTabs;
--- a/browser/devtools/webconsole/webconsole.js
+++ b/browser/devtools/webconsole/webconsole.js
@@ -2576,17 +2576,17 @@ WebConsoleFrame.prototype = {
     // Make the location clickable.
     this._addMessageLinkCallback(locationNode, () => {
       if (isScratchpad) {
         let wins = Services.wm.getEnumerator("devtools:scratchpad");
 
         while (wins.hasMoreElements()) {
           let win = wins.getNext();
 
-          if (win.Scratchpad.uniqueName === aSourceURL) {
+          if (!win.closed && win.Scratchpad.uniqueName === aSourceURL) {
             win.focus();
             return;
           }
         }
       }
       else if (locationNode.parentNode.category == CATEGORY_CSS) {
         this.owner.viewSourceInStyleEditor(fullURL, aSourceLine);
       }
--- a/browser/modules/webappsUI.jsm
+++ b/browser/modules/webappsUI.jsm
@@ -76,16 +76,19 @@ this.webappsUI = {
   openURL: function(aUrl, aOrigin) {
     let browserEnumerator = Services.wm.getEnumerator("navigator:browser");
     let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
 
     // Check each browser instance for our URL
     let found = false;
     while (!found && browserEnumerator.hasMoreElements()) {
       let browserWin = browserEnumerator.getNext();
+      if (browserWin.closed) {
+        continue;
+      }
       let tabbrowser = browserWin.gBrowser;
 
       // Check each tab of this browser instance
       let numTabs = tabbrowser.tabs.length;
       for (let index = 0; index < numTabs; index++) {
         let tab = tabbrowser.tabs[index];
         let appURL = ss.getTabValue(tab, "appOrigin");
         if (appURL == aOrigin) {
--- a/dom/bindings/BindingDeclarations.h
+++ b/dom/bindings/BindingDeclarations.h
@@ -253,16 +253,23 @@ public:
   }
 
   template <class T1, class T2>
   void Construct(const T1 &t1, const T2 &t2)
   {
     mImpl.construct(t1, t2);
   }
 
+  void Reset()
+  {
+    if (WasPassed()) {
+      mImpl.destroy();
+    }
+  }
+
   const T& Value() const
   {
     return mImpl.ref();
   }
 
   // Return InternalType here so we can work with it usefully.
   InternalType& Value()
   {
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -8337,42 +8337,82 @@ if (""",
                         if typeNeedsRooting(m.type, self.descriptorProvider)]
 
         body += "\n\n".join(memberTraces)
 
         return ClassMethod("TraceDictionary", "void", [
             Argument("JSTracer*", "trc"),
         ], body=body)
 
+    def assignmentOperator(self):
+        body = CGList([], "\n")
+        if self.dictionary.parent:
+            body.append(CGGeneric(
+                    "%s::operator=(aOther);" %
+                    self.makeClassName(self.dictionary.parent)))
+        for (m, _) in self.memberInfo:
+            memberName = self.makeMemberName(m.identifier.name)
+            if not m.defaultValue:
+                memberAssign = CGIfElseWrapper(
+                    "aOther.%s.WasPassed()" % memberName,
+                    CGGeneric("%s.Construct();\n"
+                              "%s.Value() = aOther.%s.Value();" %
+                              (memberName, memberName, memberName)),
+                    CGGeneric("%s.Reset();" % memberName))
+            else:
+                memberAssign = CGGeneric(
+                    "%s = aOther.%s;" % (memberName, memberName))
+            body.append(memberAssign)
+        return ClassMethod(
+            "operator=", "void", [
+                Argument("const %s&" % self.makeClassName(self.dictionary),
+                         "aOther")
+                ],
+            body=body.define())
+
     def getStructs(self):
         d = self.dictionary
         selfName = self.makeClassName(d)
         members = [ClassMember(self.makeMemberName(m[0].identifier.name),
                                self.getMemberType(m),
                                visibility="public",
                                body=self.getMemberInitializer(m))
                    for m in self.memberInfo]
-        ctor = ClassConstructor([], bodyInHeader=True, visibility="public")
+        ctors = [ClassConstructor([], bodyInHeader=True, visibility="public")]
         methods = []
 
         if self.needToInitIds:
             methods.append(self.initIdsMethod())
 
         methods.append(self.initMethod())
         methods.append(self.initFromJSONMethod())
         methods.append(self.toObjectMethod())
         methods.append(self.traceDictionaryMethod())
 
+        if CGDictionary.isDictionaryCopyConstructible(d):
+            disallowCopyConstruction = False
+            # Note: no base constructors because our operator= will
+            # deal with that.
+            ctors.append(ClassConstructor([Argument("const %s&" % selfName,
+                                                    "aOther")],
+                                          bodyInHeader=True,
+                                          visibility="public",
+                                          explicit=True,
+                                          body="*this = aOther;"))
+            methods.append(self.assignmentOperator())
+        else:
+            disallowCopyConstruction = True
+
         struct = CGClass(selfName,
             bases=[ClassBase(self.base())],
             members=members,
-            constructors=[ctor],
+            constructors=ctors,
             methods=methods,
             isStruct=True,
-            disallowCopyConstruction=True)
+            disallowCopyConstruction=disallowCopyConstruction)
 
 
         initializerCtor = ClassConstructor([],
             visibility="public",
             body=(
                 "// Safe to pass a null context if we pass a null value\n"
                 "Init(nullptr, JS::NullHandleValue);"))
         initializerStruct = CGClass(selfName + "Initializer",
@@ -8575,16 +8615,28 @@ if (""",
     def getDictionaryDependencies(dictionary):
         deps = set();
         if dictionary.parent:
             deps.add(dictionary.parent)
         for member in dictionary.members:
             deps |= CGDictionary.getDictionaryDependenciesFromType(member.type)
         return deps
 
+    @staticmethod
+    def isDictionaryCopyConstructible(dictionary):
+        def isTypeCopyConstructible(type):
+            # Nullable and sequence stuff doesn't affect copy/constructibility
+            type = type.unroll()
+            return (type.isPrimitive() or type.isString() or type.isEnum() or
+                    (type.isDictionary() and
+                     CGDictionary.isDictionaryCopyConstructible(type.inner)))
+        if (dictionary.parent and
+            not CGDictionary.isDictionaryCopyConstructible(dictionary.parent)):
+            return False
+        return all(isTypeCopyConstructible(m.type) for m in dictionary.members)
 
 class CGRegisterProtos(CGAbstractMethod):
     def __init__(self, config):
         CGAbstractMethod.__init__(self, None, 'Register', 'void',
                                   [Argument('nsScriptNameSpaceManager*', 'aNameSpaceManager')])
         self.config = config
 
     def _defineMacro(self):
--- a/gfx/2d/BaseSize.h
+++ b/gfx/2d/BaseSize.h
@@ -1,31 +1,33 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #ifndef MOZILLA_GFX_BASESIZE_H_
 #define MOZILLA_GFX_BASESIZE_H_
 
+#include "mozilla/Attributes.h"
+
 namespace mozilla {
 namespace gfx {
 
 /**
  * Do not use this class directly. Subclass it, pass that subclass as the
  * Sub parameter, and only use that subclass. This allows methods to safely
  * cast 'this' to 'Sub*'.
  */
 template <class T, class Sub>
 struct BaseSize {
   T width, height;
 
   // Constructors
-  BaseSize() : width(0), height(0) {}
-  BaseSize(T aWidth, T aHeight) : width(aWidth), height(aHeight) {}
+  MOZ_CONSTEXPR BaseSize() : width(0), height(0) {}
+  MOZ_CONSTEXPR BaseSize(T aWidth, T aHeight) : width(aWidth), height(aHeight) {}
 
   void SizeTo(T aWidth, T aHeight) { width = aWidth; height = aHeight; }
 
   bool IsEmpty() const {
     return width == 0 || height == 0;
   }
 
   // Note that '=' isn't defined so we'll get the
--- a/gfx/2d/Point.h
+++ b/gfx/2d/Point.h
@@ -70,18 +70,18 @@ IntPointTyped<units> RoundedToInt(const 
 }
 
 template<class units>
 struct IntSizeTyped :
   public BaseSize< int32_t, IntSizeTyped<units> >,
   public units {
   typedef BaseSize< int32_t, IntSizeTyped<units> > Super;
 
-  IntSizeTyped() : Super() {}
-  IntSizeTyped(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
+  MOZ_CONSTEXPR IntSizeTyped() : Super() {}
+  MOZ_CONSTEXPR IntSizeTyped(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
 
   // XXX When all of the code is ported, the following functions to convert to and from
   // unknown types should be removed.
 
   static IntSizeTyped<units> FromUnknownSize(const IntSizeTyped<UnknownUnits>& aSize) {
     return IntSizeTyped<units>(aSize.width, aSize.height);
   }
 
--- a/gfx/2d/ScaleFactor.h
+++ b/gfx/2d/ScaleFactor.h
@@ -1,16 +1,18 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #ifndef MOZILLA_GFX_SCALEFACTOR_H_
 #define MOZILLA_GFX_SCALEFACTOR_H_
 
+#include "mozilla/Attributes.h"
+
 #include "gfxPoint.h"
 
 namespace mozilla {
 namespace gfx {
 
 /*
  * This class represents a scaling factor between two different pixel unit
  * systems. This is effectively a type-safe float, intended to be used in
@@ -21,19 +23,19 @@ namespace gfx {
  * were always expected to be the same, so this class uses only one scale
  * factor for both axes. The two constructors that take two-axis scaling
  * factors check to ensure that this assertion holds.
  */
 template<class src, class dst>
 struct ScaleFactor {
   float scale;
 
-  ScaleFactor() : scale(1.0) {}
-  ScaleFactor(const ScaleFactor<src, dst>& aCopy) : scale(aCopy.scale) {}
-  explicit ScaleFactor(float aScale) : scale(aScale) {}
+  MOZ_CONSTEXPR ScaleFactor() : scale(1.0) {}
+  MOZ_CONSTEXPR ScaleFactor(const ScaleFactor<src, dst>& aCopy) : scale(aCopy.scale) {}
+  explicit MOZ_CONSTEXPR ScaleFactor(float aScale) : scale(aScale) {}
 
   explicit ScaleFactor(float aX, float aY) : scale(aX) {
     MOZ_ASSERT(fabs(aX - aY) < 1e-6);
   }
 
   explicit ScaleFactor(gfxSize aScale) : scale(aScale.width) {
     MOZ_ASSERT(fabs(aScale.width - aScale.height) < 1e-6);
   }
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-placeholder/input/css-text-align.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+  <link rel='stylesheet' type='text/css' href='style.css'>
+  <style>
+    input::-moz-placeholder {
+      text-align: center;
+    }
+  </style>
+  <body>
+    <input placeholder='foo'>
+  </body>
+</html>
--- a/layout/reftests/css-placeholder/input/reftest.list
+++ b/layout/reftests/css-placeholder/input/reftest.list
@@ -19,8 +19,9 @@ needs-focus == placeholder-blur.html pla
 == placeholder-value-unset.html placeholder-simple-ref.html
 == placeholder-value-reset.html placeholder-simple-ref.html
 == placeholder-type-change-1.html placeholder-simple-ref.html
 == placeholder-type-change-2.html placeholder-button-ref.html
 == css-display.html placeholder-simple-ref.html
 # We can't check except by verifying that the output is different.
 # Same reasons as focus issues explained above.
 != css-opacity.html placeholder-simple-ref.html
+!= css-text-align.html placeholder-simple-ref.html
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -2717,17 +2717,17 @@ CSS_PROP_TABLE(
     VARIANT_HK,
     kTableLayoutKTable,
     CSS_PROP_NO_OFFSET,
     eStyleAnimType_None)
 CSS_PROP_TEXT(
     text-align,
     text_align,
     TextAlign,
-    CSS_PROPERTY_PARSE_VALUE,
+    CSS_PROPERTY_PARSE_VALUE | CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
     "",
     // When we support aligning on a string, we can parse text-align
     // as a string....
     VARIANT_HK /* | VARIANT_STRING */,
     kTextAlignKTable,
     CSS_PROP_NO_OFFSET,
     eStyleAnimType_None)
 CSS_PROP_TEXT(
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -914,17 +914,17 @@ var BrowserApp = {
   },
 
   quit: function quit() {
     // Figure out if there's at least one other browser window around.
     let lastBrowser = true;
     let e = Services.wm.getEnumerator("navigator:browser");
     while (e.hasMoreElements() && lastBrowser) {
       let win = e.getNext();
-      if (win != window)
+      if (!win.closed && win != window)
         lastBrowser = false;
     }
 
     if (lastBrowser) {
       // Let everyone know we are closing the last browser window
       let closingCanceled = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
       Services.obs.notifyObservers(closingCanceled, "browser-lastwindow-close-requested", null);
       if (closingCanceled.data)
--- a/toolkit/components/help/content/contextHelp.js
+++ b/toolkit/components/help/content/contextHelp.js
@@ -56,14 +56,14 @@ function locateHelpWindow(contentPack) {
     const iterator = windowManagerInterface.getEnumerator("mozilla:help");
     var topWindow = null;
     var aWindow;
 
 # Loop through help windows looking for one with selected content
 # pack.
     while (iterator.hasMoreElements()) {
         aWindow = iterator.getNext();
-        if (aWindow.getHelpFileURI() == contentPack) {
+        if (!aWindow.closed && aWindow.getHelpFileURI() == contentPack) {
             topWindow = aWindow;
         }
     }
     return topWindow;
 }
--- a/toolkit/components/social/MozSocialAPI.jsm
+++ b/toolkit/components/social/MozSocialAPI.jsm
@@ -297,17 +297,17 @@ function findChromeWindowForChats(prefer
     enumerator = Services.wm.getEnumerator("navigator:browser");
   } else {
     // here we explicitly ask for bottom-to-top so we can use the same logic
     // where BROKEN_WM_Z_ORDER is true.
     enumerator = Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", false);
   }
   while (enumerator.hasMoreElements()) {
     let win = enumerator.getNext();
-    if (win && isWindowGoodForChats(win))
+    if (!win.closed && isWindowGoodForChats(win))
       topMost = win;
   }
   return topMost;
 }
 
 this.openChatWindow =
  function openChatWindow(chromeWindow, provider, url, callback, mode) {
   chromeWindow = findChromeWindowForChats(chromeWindow);
--- a/toolkit/content/globalOverlay.js
+++ b/toolkit/content/globalOverlay.js
@@ -8,16 +8,19 @@ function closeWindow(aClose, aPromptFunc
 #ifndef XP_MACOSX
   var windowCount = 0;
   var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                      .getService(Components.interfaces.nsIWindowMediator);
   var e = wm.getEnumerator(null);
   
   while (e.hasMoreElements()) {
     var w = e.getNext();
+    if (w.closed) {
+      continue;
+    }
     if (++windowCount == 2) 
       break;
   }
   
   // If we're down to the last window and someone tries to shut down, check to make sure we can!
   if (windowCount == 1 && !canQuitApplication("lastwindow"))
     return false;
   else if (windowCount != 1)
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -922,16 +922,19 @@ var gViewController = {
         var optionsURL = aAddon.optionsURL;
         if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_TAB &&
             openOptionsInTab(optionsURL)) {
           return;
         }
         var windows = Services.wm.getEnumerator(null);
         while (windows.hasMoreElements()) {
           var win = windows.getNext();
+          if (win.closed) {
+            continue;
+          }
           if (win.document.documentURI == optionsURL) {
             win.focus();
             return;
           }
         }
         var features = "chrome,titlebar,toolbar,centerscreen";
         try {
           var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
--- a/xpfe/appshell/public/nsIWindowMediator.idl
+++ b/xpfe/appshell/public/nsIWindowMediator.idl
@@ -24,17 +24,19 @@ interface nsIWindowMediatorListener;
 interface nsIWindowMediator: nsISupports
 {
   /** Return an enumerator which iterates over all windows of type aWindowType
     * from the oldest window to the youngest.
     * @param  aWindowType the returned enumerator will enumerate only
     *                     windows of this type. ("type" is the
     *                     |windowtype| attribute of the XML <window> element.)
     *                     If null, all windows will be enumerated.
-    * @return an enumerator of nsIDOMWindows
+    * @return an enumerator of nsIDOMWindows.  Note that windows close
+    *         asynchronously in many cases, so windows returned from this
+    *         enumerator can have .closed set to true.  Caveat enumerator!
     */
   nsISimpleEnumerator getEnumerator(in wstring aWindowType);
 
   /** Identical to getEnumerator except:
     * @return an enumerator of nsIXULWindows
   */
   nsISimpleEnumerator getXULWindowEnumerator(in wstring aWindowType);