merge m-c to fx-team
authorTim Taubert <ttaubert@mozilla.com>
Fri, 05 Jul 2013 08:56:02 +0200
changeset 149779 17fe59f6c54a1e4c9ba1cc80488e46cac4d06c57
parent 149770 5796c661ad878c61f6eb3ec18bf8dab6e82e38df (current diff)
parent 149778 9069fff5c78fd371f260367f5dafd322899247c9 (diff)
child 149780 55c907a708a5f9262d96c7abebb4191300bf07a1
child 149829 ac7efbf32f0ffbb3e62af43d379e333af5606c7f
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone25.0a1
first release with
nightly linux32
17fe59f6c54a / 25.0a1 / 20130705031151 / files
nightly linux64
17fe59f6c54a / 25.0a1 / 20130705031151 / files
nightly mac
17fe59f6c54a / 25.0a1 / 20130705031151 / files
nightly win32
17fe59f6c54a / 25.0a1 / 20130705031151 / files
nightly win64
17fe59f6c54a / 25.0a1 / 20130705031151 / 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 m-c to fx-team
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -120,22 +120,16 @@ XPCOMUtils.defineLazyServiceGetter(this,
   "@mozilla.org/xre/app-info;1", "nsICrashReporter");
 #endif
 
 function debug(aMsg) {
   aMsg = ("SessionStore: " + aMsg).replace(/\S{80}/g, "$&\n");
   Services.console.logStringMessage(aMsg);
 }
 
-function notifyAsync(aTopic) {
-  Services.tm.mainThread.dispatch(() => {
-    Services.obs.notifyObservers(null, aTopic, "");
-  }, Ci.nsIThread.DISPATCH_NORMAL);
-}
-
 this.SessionStore = {
   get promiseInitialized() {
     return SessionStoreInternal.promiseInitialized.promise;
   },
 
   get canRestoreLastSession() {
     return SessionStoreInternal.canRestoreLastSession;
   },
@@ -765,17 +759,17 @@ let SessionStoreInternal = {
         if (isPrivateWindow) {
           // We're starting with a single private window. Save the state we
           // actually wanted to restore so that we can do it later in case
           // the user opens another, non-private window.
           this._deferredInitialState = this._initialState;
           this._initialState = null;
 
           // Nothing to restore now, notify observers things are complete.
-          notifyAsync(NOTIFY_WINDOWS_RESTORED);
+          Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
         } else {
           TelemetryTimestamps.add("sessionRestoreRestoring");
           // make sure that the restored tabs are first in the window
           this._initialState._firstTabs = true;
           this._restoreCount = this._initialState.windows ? this._initialState.windows.length : 0;
           this.restoreWindow(aWindow, this._initialState,
                              this._isCmdLineEmpty(aWindow, this._initialState));
 
@@ -783,17 +777,17 @@ let SessionStoreInternal = {
           // force a save operation so that crashes happening during startup are correctly counted
           this._initialState.session.state = STATE_RUNNING_STR;
           this._saveStateObject(this._initialState);
           this._initialState = null;
         }
       }
       else {
         // Nothing to restore, notify observers things are complete.
-        notifyAsync(NOTIFY_WINDOWS_RESTORED);
+        Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
 
         // the next delayed save request should execute immediately
         this._lastSaveTime -= this._interval;
       }
     }
     // this window was opened by _openWindowWithState
     else if (!this._isWindowLoaded(aWindow)) {
       let followUp = this._statesToRestore[aWindow.__SS_restoreID].windows.length == 1;
@@ -4318,18 +4312,19 @@ let SessionStoreInternal = {
       return;
     }
 
     // observers were already notified
     if (this._restoreCount == -1)
       return;
 
     // This was the last window restored at startup, notify observers.
-    notifyAsync(this._browserSetState ? NOTIFY_BROWSER_STATE_RESTORED :
-                                        NOTIFY_WINDOWS_RESTORED);
+    Services.obs.notifyObservers(null,
+      this._browserSetState ? NOTIFY_BROWSER_STATE_RESTORED : NOTIFY_WINDOWS_RESTORED,
+      "");
 
     this._browserSetState = false;
     this._restoreCount = -1;
   },
 
    /**
    * Set the given window's busy state
    * @param aWindow the window
--- a/browser/devtools/framework/toolbox-options.js
+++ b/browser/devtools/framework/toolbox-options.js
@@ -176,29 +176,25 @@ OptionsPanel.prototype = {
         data.oldValue = Services.prefs.getCharPref(data.pref);
         Services.prefs.setCharPref(data.pref, data.newValue);
         gDevTools.emit("pref-changed", data);
       }.bind(radiogroup));
     }
   },
 
   /**
-   * Hides any label in a box with class "hidden-labels-box" at page load. The
-   * labels are shown again when the user click on the checkbox in the box.
+   * Handles checkbox click inside hbox with class "hidden-labels-box". The
+   * labels inside the hbox are shown again when the user click on the checkbox
+   * in the box.
    */
   prepareRestartPreferences: function() {
-    let labels = this.panelDoc.querySelectorAll(".hidden-labels-box > label");
-    for (let label of labels) {
-      label.style.display = "none";
-    }
     let checkboxes = this.panelDoc.querySelectorAll(".hidden-labels-box > checkbox");
     for (let checkbox of checkboxes) {
       checkbox.addEventListener("command", function(target) {
-        target.nextSibling.style.display = "";
-        target.nextSibling.nextSibling.style.display = "";
+        target.parentNode.classList.toggle("visible");
       }.bind(null, checkbox));
     }
   },
 
   restart: function() {
     let canceled = Cc["@mozilla.org/supports-PRBool;1"]
                      .createInstance(Ci.nsISupportsPRBool);
     Services.obs.notifyObservers(canceled, "quit-application-requested", "restart");
--- a/browser/devtools/inspector/highlighter.js
+++ b/browser/devtools/inspector/highlighter.js
@@ -90,16 +90,17 @@ exports.Highlighter = Highlighter;
 
 Highlighter.prototype = {
   get selection() {
     return this.inspector.selection;
   },
 
   _init: function Highlighter__init()
   {
+    this.toggleLockState = this.toggleLockState.bind(this);
     this.unlockAndFocus = this.unlockAndFocus.bind(this);
     this.updateInfobar = this.updateInfobar.bind(this);
     this.highlight = this.highlight.bind(this);
 
     let stack = this.browser.parentNode;
     this.win = this.browser.contentWindow;
     this._highlighting = false;
 
@@ -314,16 +315,29 @@ Highlighter.prototype = {
     if (this.selection.isElementNode() &&
         this.selection.isConnected()) {
       this.showOutline();
     }
     this.emit("unlocked");
   },
 
   /**
+   * Toggle between locked and unlocked
+   */
+  toggleLockState: function() {
+    if (this.locked) {
+      this.startNode = this.selection.node;
+      this.unlockAndFocus();
+    } else {
+      this.selection.setNode(this.startNode);
+      this.lock();
+    }
+  },
+
+  /**
    * Focus the browser before unlocking.
    */
   unlockAndFocus: function Highlighter_unlockAndFocus() {
     if (this.locked === false) return;
     this.chromeWin.focus();
     this.unlock();
   },
 
@@ -412,17 +426,17 @@ Highlighter.prototype = {
     pseudoClassesBox.textContent = "&nbsp;";
 
     // Create buttons
 
     this.inspectButton = this.chromeDoc.createElement("toolbarbutton");
     this.inspectButton.className = "highlighter-nodeinfobar-button highlighter-nodeinfobar-inspectbutton"
     let toolbarInspectButton = this.inspector.panelDoc.getElementById("inspector-inspect-toolbutton");
     this.inspectButton.setAttribute("tooltiptext", toolbarInspectButton.getAttribute("tooltiptext"));
-    this.inspectButton.addEventListener("command", this.unlockAndFocus);
+    this.inspectButton.addEventListener("command", this.toggleLockState);
 
     let nodemenu = this.chromeDoc.createElement("toolbarbutton");
     nodemenu.setAttribute("type", "menu");
     nodemenu.className = "highlighter-nodeinfobar-button highlighter-nodeinfobar-menu"
     nodemenu.setAttribute("tooltiptext",
                           this.strings.GetStringFromName("nodeMenu.tooltiptext"));
 
     nodemenu.onclick = function() {
--- a/browser/devtools/inspector/inspector.xul
+++ b/browser/devtools/inspector/inspector.xul
@@ -67,17 +67,17 @@
     <vbox flex="1">
       <toolbar id="inspector-toolbar"
         class="devtools-toolbar"
         nowindowdrag="true">
         <toolbarbutton id="inspector-inspect-toolbutton"
           tooltiptext="&inspector.selectButton.tooltip;"
           class="devtools-toolbarbutton"
           hidden="true"
-          oncommand="inspector.highlighter.unlockAndFocus()"/>
+          oncommand="inspector.highlighter.toggleLockState()"/>
         <arrowscrollbox id="inspector-breadcrumbs"
           class="breadcrumbs-widget-container"
           flex="1" orient="horizontal"
           clicktoscroll="true"/>
         <textbox id="inspector-searchbox"
           type="search"
           timeout="50"
           class="devtools-searchinput"
--- a/browser/devtools/inspector/test/browser_inspector_highlighter.js
+++ b/browser/devtools/inspector/test/browser_inspector_highlighter.js
@@ -52,20 +52,41 @@ function createDocument()
 }
 
 function setupHighlighterTests()
 {
   h1 = doc.querySelector("h1");
   ok(h1, "we have the header");
 
   let i = getActiveInspector();
+  i.selection.setNode(div);
   i.highlighter.unlockAndFocus();
   i.highlighter.outline.setAttribute("disable-transitions", "true");
 
   executeSoon(function() {
+    i.selection.once("new-node", performToggleComparisons);
+    EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
+  });
+}
+
+function performToggleComparisons(evt)
+{
+  let i = getActiveInspector();
+
+  i.highlighter.toggleLockState();
+  ok(i.highlighter.locked, "highlighter locks");
+  is(i.selection.node, div);
+  i.highlighter.toggleLockState();
+  ok(!i.highlighter.locked, "highlighter unlocks");
+
+  i.highlighter.toggleLockState();
+  ok(i.highlighter.locked, "highlighter locks if selection is unchanged");
+  i.highlighter.toggleLockState();
+
+  executeSoon(function() {
     i.selection.once("new-node", performTestComparisons);
     EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
   });
 }
 
 function performTestComparisons(evt)
 {
   let i = getActiveInspector();
--- a/browser/devtools/markupview/markup-view.js
+++ b/browser/devtools/markupview/markup-view.js
@@ -307,21 +307,23 @@ MarkupView.prototype = {
 
     let walker = documentWalker(aNode);
     let parent = walker.parentNode();
     if (parent) {
       var container = new MarkupContainer(this, aNode);
     } else {
       var container = new RootContainer(this, aNode);
       this._elt.appendChild(container.elt);
+
+      if (this._rootNode) {
+        this._rootNode.removeEventListener("load", this, true);
+      }
+
       this._rootNode = aNode;
-      aNode.addEventListener("load", function MP_watch_contentLoaded(aEvent) {
-        // Fake a childList mutation here.
-        this._mutationObserver([{target: aEvent.target, type: "childList"}]);
-      }.bind(this), true);
+      aNode.addEventListener("load", this, true);
     }
 
     this._containers.set(aNode, container);
     // FIXME: set an expando to prevent the the wrapper from disappearing
     // See bug 819131 for details.
     aNode.__preserveHack = true;
     container.expanded = aExpand;
 
@@ -329,16 +331,21 @@ MarkupView.prototype = {
     this._updateChildren(container);
 
     if (parent) {
       this.importNode(parent, true);
     }
     return container;
   },
 
+  handleEvent: function MT_handleEvent(aEvent) {
+    // Fake a childList mutation here.
+    this._mutationObserver([{target: aEvent.target, type: "childList"}]);
+  },
+
   /**
    * Mutation observer used for included nodes.
    */
   _mutationObserver: function MT__mutationObserver(aMutations)
   {
     for (let mutation of aMutations) {
       let container = this._containers.get(mutation.target);
       if (!container) {
@@ -643,27 +650,32 @@ MarkupView.prototype = {
     delete this._boundFocus;
 
     this._frame.contentWindow.removeEventListener("scroll", this._boundUpdatePreview, true);
     this._frame.contentWindow.removeEventListener("resize", this._boundResizePreview, true);
     this._frame.contentWindow.removeEventListener("overflow", this._boundResizePreview, true);
     this._frame.contentWindow.removeEventListener("underflow", this._boundResizePreview, true);
     delete this._boundUpdatePreview;
 
-    this._frame.contentWindow.removeEventListener("keydown", this._boundKeyDown, true);
+    this._frame.contentWindow.removeEventListener("keydown", this._boundKeyDown, false);
     delete this._boundKeyDown;
 
     this._inspector.selection.off("new-node", this._boundOnNewSelection);
     delete this._boundOnNewSelection;
 
     delete this._elt;
 
     delete this._containers;
     this._observer.disconnect();
     delete this._observer;
+
+    if (this._rootNode) {
+      this._rootNode.removeEventListener("load", this, true);
+      delete this._rootNode;
+    }
   },
 
   /**
    * Initialize the preview panel.
    */
   _initPreview: function MT_initPreview()
   {
     if (!Services.prefs.getBoolPref("devtools.inspector.markupPreview")) {
--- a/browser/devtools/responsivedesign/test/browser_responsiveui.js
+++ b/browser/devtools/responsivedesign/test/browser_responsiveui.js
@@ -116,21 +116,27 @@ function test() {
     is(content.innerHeight, initialWidth, "The height is now the width.");
     let [width, height] = extractSizeFromString(instance.menulist.firstChild.firstChild.getAttribute("label"));
     is(width, initialHeight, "Label updated (width).");
     is(height, initialWidth, "Label updated (height).");
 
     widthBeforeClose = content.innerWidth;
     heightBeforeClose = content.innerHeight;
 
-    mgr.once("off", function() {executeSoon(restart)});
+    info("XXX BUG 851296: instance.closing: " + !!instance.closing);
+
+    mgr.once("off", function() {
+      info("XXX BUG 851296: 'off' received.");
+      executeSoon(restart);
+    });
     EventUtils.synthesizeKey("VK_ESCAPE", {});
   }
 
   function restart() {
+    info("XXX BUG 851296: restarting.");
     mgr.once("on", function() {executeSoon(onUIOpen2)});
     synthesizeKeyFromKeyTag("key_responsiveUI");
   }
 
   function onUIOpen2() {
     let container = gBrowser.getBrowserContainer();
     is(container.getAttribute("responsivemode"), "true", "In responsive mode.");
 
--- a/browser/themes/linux/devtools/toolbox.css
+++ b/browser/themes/linux/devtools/toolbox.css
@@ -248,30 +248,30 @@
   visibility: collapse;
 }
 
 #options-panel {
   background-image: url("chrome://browser/skin/newtab/noise.png");
 }
 
 .options-vertical-pane {
-  margin: 15px;
+  margin: 5px;
   width: calc(50% - 30px);
   min-width: 400px;
   -moz-padding-start: 5px;
 }
 
 .options-vertical-pane > label {
-  padding: 5px 0;
+  padding: 2px 0;
   font-size: 1.4rem;
 }
 
 .options-groupbox {
   -moz-margin-start: 15px;
-  padding: 4px;
+  padding: 2px;
 }
 
 .options-groupbox > * {
   padding: 2px;
 }
 
 .options-citation-label {
   font-size: 1rem !important;
@@ -280,8 +280,13 @@
   padding: 4px 0 0; /* To align it with the checkbox */
   color: #444;
 }
 
 .options-citation-label + label {
   padding: 3px 0 0 !important; /* To align it with the checkbox */
   font-style: italic;
 }
+
+.hidden-labels-box:not(.visible) > label,
+.hidden-labels-box.visible ~ .hidden-labels-box > label:last-child {
+  display: none;
+}
--- a/browser/themes/osx/devtools/toolbox.css
+++ b/browser/themes/osx/devtools/toolbox.css
@@ -234,30 +234,30 @@
   visibility: collapse;
 }
 
 #options-panel {
   background-image: url("chrome://browser/skin/newtab/noise.png");
 }
 
 .options-vertical-pane {
-  margin: 15px;
+  margin: 5px;
   width: calc(50% - 30px);
   min-width: 400px;
   -moz-padding-start: 5px;
 }
 
 .options-vertical-pane > label {
-  padding: 5px 0;
+  padding: 2px 0;
   font-size: 1.4rem;
 }
 
 .options-groupbox {
   -moz-margin-start: 15px;
-  padding: 4px;
+  padding: 2px;
 }
 
 .options-groupbox > * {
   padding: 2px;
 }
 
 .options-citation-label {
   font-size: 1rem !important;
@@ -266,8 +266,13 @@
   padding: 4px 0 0; /* To align it with the checkbox */
   color: #444;
 }
 
 .options-citation-label + label {
   padding: 3px 0 0 !important; /* To align it with the checkbox */
   font-style: italic;
 }
+
+.hidden-labels-box:not(.visible) > label,
+.hidden-labels-box.visible ~ .hidden-labels-box > label:last-child {
+  display: none;
+}
--- a/browser/themes/windows/devtools/toolbox.css
+++ b/browser/themes/windows/devtools/toolbox.css
@@ -243,30 +243,30 @@
   visibility: collapse;
 }
 
 #options-panel {
   background-image: url("chrome://browser/skin/newtab/noise.png");
 }
 
 .options-vertical-pane {
-  margin: 15px;
+  margin: 5px;
   width: calc(50% - 30px);
   min-width: 400px;
   -moz-padding-start: 5px;
 }
 
 .options-vertical-pane > label {
-  padding: 5px 0;
+  padding: 2px 0;
   font-size: 1.4rem;
 }
 
 .options-groupbox {
   -moz-margin-start: 15px;
-  padding: 4px;
+  padding: 2px;
 }
 
 .options-groupbox > * {
   padding: 2px;
 }
 
 .options-citation-label {
   font-size: 1rem !important;
@@ -275,8 +275,13 @@
   padding: 4px 0 0; /* To align it with the checkbox */
   color: #444;
 }
 
 .options-citation-label + label {
   padding: 3px 0 0 !important; /* To align it with the checkbox */
   font-style: italic;
 }
+
+.hidden-labels-box:not(.visible) > label,
+.hidden-labels-box.visible ~ .hidden-labels-box > label:last-child {
+  display: none;
+}
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1741,16 +1741,18 @@ nsDOMWindowUtils::DispatchDOMEventViaPre
   if (content->OwnerDoc()->GetWindow() != window) {
     return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
   }
   nsCOMPtr<nsIDocument> targetDoc = content->GetCurrentDoc();
   NS_ENSURE_STATE(targetDoc);
   nsRefPtr<nsIPresShell> targetShell = targetDoc->GetShell();
   NS_ENSURE_STATE(targetShell);
 
+  targetDoc->FlushPendingNotifications(Flush_Layout);
+
   nsEventStatus status = nsEventStatus_eIgnore;
   targetShell->HandleEventWithTarget(internalEvent, nullptr, content, &status);
   *aRetVal = (status != nsEventStatus_eConsumeNoDefault);
   return NS_OK;
 }
 
 static void
 InitEvent(nsGUIEvent &aEvent, nsIntPoint *aPt = nullptr)
--- a/toolkit/components/osfile/osfile_async_front.jsm
+++ b/toolkit/components/osfile/osfile_async_front.jsm
@@ -713,16 +713,19 @@ let DirectoryIterator = function Directo
    */
   this._itmsg = Scheduler.post(
     "new_DirectoryIterator", [Type.path.toMsg(path), options],
     path
   );
   this._isClosed = false;
 };
 DirectoryIterator.prototype = {
+  iterator: function () this,
+  __iterator__: function () this,
+
   /**
    * Determine whether the directory exists.
    *
    * @resolves {boolean}
    */
   exists: function exists() {
     return this._itmsg.then(
       function onSuccess(iterator) {
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -275,20 +275,17 @@ ThreadActor.prototype = {
       let packet = this._paused(aFrame);
       if (!packet) {
         return undefined;
       }
       packet.why = aReason;
       resolve(onPacket(packet)).then(this.conn.send.bind(this.conn));
       return this._nest();
     } catch(e) {
-      let msg = "Got an exception during TA__pauseAndRespond: " + e +
-                ": " + e.stack;
-      Cu.reportError(msg);
-      dumpn(msg);
+      reportError(e, "Got an exception during TA__pauseAndRespond: ");
       return undefined;
     }
   },
 
   /**
    * Handle a protocol request to resume execution of the debuggee.
    */
   onResume: function TA_onResume(aRequest) {
@@ -1236,18 +1233,17 @@ ThreadActor.prototype = {
         return undefined;
       }
 
       packet.why = { type: "exception",
                      exception: this.createValueGrip(aValue) };
       this.conn.send(packet);
       return this._nest();
     } catch(e) {
-      Cu.reportError("Got an exception during TA_onExceptionUnwind: " + e +
-                     ": " + e.stack);
+      reportError(e, "Got an exception during TA_onExceptionUnwind: ");
       return undefined;
     }
   },
 
   /**
    * A function that the engine calls when a new script has been loaded into the
    * scope of the specified debuggee global.
    *
@@ -1485,20 +1481,17 @@ SourceActor.prototype = {
           aSource, this.threadActor.threadLifetimePool);
       })
       .then((aSourceGrip) => {
         return {
           from: this.actorID,
           source: aSourceGrip
         };
       }, (aError) => {
-        let msg = "Got an exception during SA_onSource: " + aError +
-          "\n" + aError.stack;
-        Cu.reportError(msg);
-        dumpn(msg);
+        reportError(aError, "Got an exception during SA_onSource: ");
         return {
           "from": this.actorID,
           "error": "loadSourceError",
           "message": "Could not load the source for " + this._url + "."
         };
       });
   },
 
@@ -2919,13 +2912,19 @@ function convertToUnicode(aString, aChar
     return converter.ConvertToUnicode(aString);
   } catch(e) {
     return aString;
   }
 }
 
 /**
  * Report the given error in the error console and to stdout.
+ *
+ * @param Error aError
+ *        The error object you wish to report.
+ * @param String aPrefix
+ *        An optional prefix for the reported error message.
  */
-function reportError(aError) {
-  Cu.reportError(aError);
-  dumpn(aError.message + ":\n" + aError.stack);
+function reportError(aError, aPrefix="") {
+  let msg = prefix + aError.message + ":\n" + aError.stack;
+  Cu.reportError(msg);
+  dumpn(msg);
 }