Merge backout
authorMs2ger <ms2ger@gmail.com>
Tue, 14 Jun 2011 16:30:03 +0200
changeset 71050 e00f1b19444002f10832cac1439204e259b95895
parent 71049 8ca16e3ff5e0f3290a87ef26d98ef198d5b71b8b (current diff)
parent 71048 3a4b05b2df878bc6a30af30f8a49af02254d8c1e (diff)
child 71051 fafe864d8d8e020690a840534bb9dfd939b51998
push id20477
push userMs2ger@gmail.com
push dateTue, 14 Jun 2011 14:31:31 +0000
treeherdermozilla-central@e00f1b194440 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone7.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
Merge backout
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -59,16 +59,17 @@
 //     to <add> along with the elements provided.
 //
 // Possible options:
 //   id - specifies the groupItem's id; otherwise automatically generated
 //   userSize - see <Item.userSize>; default is null
 //   bounds - a <Rect>; otherwise based on the locations of the provided elements
 //   container - a DOM element to use as the container for this groupItem; otherwise will create
 //   title - the title for the groupItem; otherwise blank
+//   focusTitle - focus the title's input field after creation
 //   dontPush - true if this groupItem shouldn't push away or snap on creation; default is false
 //   immediately - true if we want all placement immediately, not with animation
 function GroupItem(listOfEls, options) {
   if (!options)
     options = {};
 
   this._inited = false;
   this._uninited = false;
@@ -213,22 +214,23 @@ function GroupItem(listOfEls, options) {
       self.lastMouseDownTarget = (Utils.isLeftClick(e) ? e.target : null);
     })
     .mouseup(function(e) {
       var same = (e.target == self.lastMouseDownTarget);
       self.lastMouseDownTarget = null;
       if (!same)
         return;
 
-      if (!self.isDragging) {
-        self.$titleShield.hide();
-        (self.$title)[0].focus();
-      }
+      if (!self.isDragging)
+        self.focusTitle();
     });
 
+  if (options.focusTitle)
+    this.focusTitle();
+
   // ___ Stack Expander
   this.$expander = iQ("<div/>")
     .addClass("stackExpander")
     .appendTo($container)
     .hide();
 
   // ___ app tabs: create app tab tray and populate it
   let appTabTrayContainer = iQ("<div/>")
@@ -400,16 +402,24 @@ GroupItem.prototype = Utils.extend(new I
     // The * 6 multiplier calculation is assuming that characters in the title
     // are approximately 6 pixels wide. Bug 586545
     var css = {width: w};
     this.$title.css(css);
     this.$titleShield.css(css);
   },
 
   // ----------
+  // Function: focusTitle
+  // Hide the title's shield and focus the underlying input field.
+  focusTitle: function GroupItem_focusTitle() {
+    this.$titleShield.hide();
+    this.$title[0].focus();
+  },
+
+  // ----------
   // Function: adjustAppTabTray
   // Used to adjust the appTabTray size, to split the appTabIcons across
   // multiple columns when needed - if the groupItem size is too small.
   //
   // Parameters:
   //   arrangeGroup - rearrange the groupItem if the number of appTab columns
   //   changes. If true, then this.arrange() is called, otherwise not.
   adjustAppTabTray: function GroupItem_adjustAppTabTray(arrangeGroup) {
--- a/browser/base/content/tabview/tabitems.js
+++ b/browser/base/content/tabview/tabitems.js
@@ -119,17 +119,18 @@ function TabItem(tab, options) {
 
     var phantom = $target.data("phantomGroupItem");
 
     var groupItem = drag.info.item.parent;
     if (groupItem) {
       groupItem.add(drag.info.$el);
     } else {
       phantom.removeClass("phantom acceptsDrop");
-      new GroupItem([$target, drag.info.$el], {container:phantom, bounds:phantom.bounds()});
+      let opts = {container:phantom, bounds:phantom.bounds(), focusTitle: true};
+      new GroupItem([$target, drag.info.$el], opts);
     }
   };
 
   this.dropOptions.over = function(e) {
     var $target = this.$container;
     this.isDropTarget = true;
 
     $target.removeClass("acceptsDrop");
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -1316,17 +1316,18 @@ let UI = {
         // to that groupItem.
         var tabs = GroupItems.getOrphanedTabs();
         var insideTabs = [];
         for each(let tab in tabs) {
           if (bounds.contains(tab.bounds))
             insideTabs.push(tab);
         }
 
-        var groupItem = new GroupItem(insideTabs,{bounds:bounds});
+        let opts = {bounds: bounds, focusTitle: true};
+        let groupItem = new GroupItem(insideTabs, opts);
         self.setActive(groupItem);
         phantom.remove();
         dragOutInfo = null;
         gTabView.firstUseExperienced = true;
       } else {
         collapse();
       }
     }
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -80,16 +80,17 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug599626.js \
                  browser_tabview_bug600645.js \
                  browser_tabview_bug600812.js \
                  browser_tabview_bug602432.js \
                  browser_tabview_bug604098.js \
                  browser_tabview_bug604699.js \
                  browser_tabview_bug606657.js \
                  browser_tabview_bug606905.js \
+                 browser_tabview_bug607108.js \
                  browser_tabview_bug608037.js \
                  browser_tabview_bug608184.js \
                  browser_tabview_bug608158.js \
                  browser_tabview_bug608405.js \
                  browser_tabview_bug610208.js \
                  browser_tabview_bug610242.js \
                  browser_tabview_bug612470.js \
                  browser_tabview_bug613541.js \
--- a/browser/base/content/test/tabview/browser_tabview_bug589324.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug589324.js
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
-
 const DUMMY_PAGE_URL = "http://mochi.test:8888/browser/browser/base/content/test/tabview/dummy_page.html";
 const DUMMY_PAGE_URL_2 = "http://mochi.test:8888/";
 
 let state = {
   windows: [{
     tabs: [{
       entries: [{ url: DUMMY_PAGE_URL }],
       hidden: true,
@@ -49,20 +47,17 @@ function test() {
   registerCleanupFunction(function () {
     Services.prefs.clearUserPref("browser.sessionstore.restore_hidden_tabs");
   });
 
   Services.prefs.setBoolPref("browser.sessionstore.restore_hidden_tabs", false);
 
   testTabSwitchAfterRestore(function () {
     Services.prefs.setBoolPref("browser.sessionstore.restore_hidden_tabs", true);
-
-    testTabSwitchAfterRestore(function () {
-      waitForFocus(finish);
-    });
+    testTabSwitchAfterRestore(finish);
   });
 }
 
 function testTabSwitchAfterRestore(callback) {
   newWindowWithState(state, function (win) {
     registerCleanupFunction(function () win.close());
 
     let [firstTab, secondTab] = win.gBrowser.tabs;
@@ -87,35 +82,8 @@ function testTabSwitchAfterRestore(callb
 
       callback();
     }, false);
 
     // switch to another tab
     win.switchToTabHavingURI(DUMMY_PAGE_URL);
   });
 }
-
-function newWindowWithState(state, callback) {
-  let opts = "chrome,all,dialog=no,height=800,width=800";
-  let win = window.openDialog(getBrowserURL(), "_blank", opts);
-
-  whenWindowLoaded(win, function () {
-    ss.setWindowState(win, JSON.stringify(state), true);
-  });
-
-  whenWindowStateReady(win, function () {
-    afterAllTabsLoaded(function () callback(win), win);
-  });
-}
-
-function whenWindowLoaded(win, callback) {
-  win.addEventListener("load", function onLoad() {
-    win.removeEventListener("load", onLoad, false);
-    executeSoon(callback);
-  }, false);
-}
-
-function whenWindowStateReady(win, callback) {
-  win.addEventListener("SSWindowStateReady", function onReady() {
-    win.removeEventListener("SSWindowStateReady", onReady, false);
-    executeSoon(callback);
-  }, false);
-}
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug607108.js
@@ -0,0 +1,88 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+  let cw;
+
+  let assertNumberOfGroupItems = function (num) {
+    let groupItems = cw.GroupItems.groupItems;
+    is(groupItems.length, num, "number of groupItems is " + num);
+  };
+
+  let dragTabOutOfGroup = function (groupItem) {
+    let tabItem = groupItem.getChild(0);
+    let target = tabItem.container;
+
+    EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
+    EventUtils.synthesizeMouse(target, 400, 100, {type: "mousemove"}, cw);
+    EventUtils.synthesizeMouseAtCenter(target, {type: "mouseup"}, cw);
+  };
+
+  let testCreateGroup = function (callback) {
+    let content = cw.document.getElementById("content");
+
+    // drag to create a new group
+    EventUtils.synthesizeMouse(content, 350, 50, {type: "mousedown"}, cw);
+    EventUtils.synthesizeMouse(content, 500, 250, {type: "mousemove"}, cw);
+    EventUtils.synthesizeMouse(content, 500, 250, {type: "mouseup"}, cw);
+
+    // enter a title for the new group
+    EventUtils.synthesizeKey("t", {}, cw);
+    EventUtils.synthesizeKey("VK_RETURN", {}, cw);
+
+    assertNumberOfGroupItems(2);
+
+    let groupItem = cw.GroupItems.groupItems[1];
+    is(groupItem.getTitle(), "t", "new groupItem's title is correct");
+
+    groupItem.addSubscriber(groupItem, "close", function () {
+      groupItem.removeSubscriber(groupItem, "close");
+      executeSoon(callback);
+    });
+
+    groupItem.closeAll();
+  };
+
+  let testDropOnOrphan = function (callback) {
+    assertNumberOfGroupItems(1);
+
+    let groupItem = cw.GroupItems.groupItems[0];
+    dragTabOutOfGroup(groupItem);
+    dragTabOutOfGroup(groupItem);
+    assertNumberOfGroupItems(2);
+
+    // enter a title for the new group
+    EventUtils.synthesizeKey("t", {}, cw);
+    EventUtils.synthesizeKey("VK_RETURN", {}, cw);
+
+    groupItem = cw.GroupItems.groupItems[1];
+    is(groupItem.getTitle(), "t", "new groupItem's title is correct");
+    closeGroupItem(groupItem, callback);
+  };
+
+  let onLoad = function (win) {
+    registerCleanupFunction(function () win.close());
+
+    for (let i = 0; i < 2; i++)
+      win.gBrowser.loadOneTab("about:blank", {inBackground: true});
+  };
+
+  let onShow = function (win) {
+    cw = win.TabView.getContentWindow();
+    assertNumberOfGroupItems(1);
+
+    let groupItem = cw.GroupItems.groupItems[0];
+    groupItem.setSize(200, 600, true);
+
+    waitForFocus(function () {
+      testCreateGroup(function () {
+        testDropOnOrphan(function () {
+          waitForFocus(finish);
+        });
+      });
+    }, cw);
+  };
+
+  waitForExplicitFinish();
+  newWindowWithTabView(onShow, onLoad);
+}
--- a/browser/base/content/test/tabview/browser_tabview_bug627288.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug627288.js
@@ -10,32 +10,34 @@ function test() {
 
     afterAllTabsLoaded(function () {
       let tabItem = tab._tabViewTabItem;
       let data = tabItem.getStorageData(true);
       gBrowser.removeTab(tab);
 
       cw.TabItems.pauseReconnecting();
       tab = gBrowser.loadOneTab('http://mochi.test:8888/', {inBackground: true});
-      cw.Storage.saveTab(tab, data);
 
-      whenTabAttrModified(tab, function () {
+      afterAllTabsLoaded(function () {
         tabItem = tab._tabViewTabItem;
 
-        // Hook into loadedCachedImageData since loading cached thumbnails 
-        // is asynchronous.
-        tabItem.addSubscriber(tabItem, "loadedCachedImageData", function(item) {
-          item.removeSubscriber(item, "loadedCachedImageData");
+        tabItem.addSubscriber(tabItem, "savedCachedImageData", function () {
+          tabItem.removeSubscriber(tabItem, "savedCachedImageData");
+
+          tabItem.addSubscriber(tabItem, "loadedCachedImageData", function () {
+            tabItem.removeSubscriber(tabItem, "loadedCachedImageData");
 
-          ok(tabItem.isShowingCachedData(), 'tabItem shows cached data');
+            ok(tabItem.isShowingCachedData(), 'tabItem shows cached data');
+            testChangeUrlAfterReconnect();
+          });
 
-          testChangeUrlAfterReconnect();
+          cw.TabItems.resumeReconnecting();
         });
 
-        cw.TabItems.resumeReconnecting();
+        cw.Storage.saveTab(tab, data);
       });
     });
   }
 
   let testChangeUrlAfterReconnect = function () {
     tab.linkedBrowser.loadURI('http://mochi.test:8888/browser/');
 
     whenTabAttrModified(tab, function () {
--- a/browser/base/content/test/tabview/head.js
+++ b/browser/base/content/test/tabview/head.js
@@ -285,16 +285,19 @@ function whenWindowStateReady(win, callb
   win.addEventListener("SSWindowStateReady", function onReady() {
     win.removeEventListener("SSWindowStateReady", onReady, false);
     executeSoon(callback);
   }, false);
 }
 
 // ----------
 function newWindowWithState(state, callback) {
+  const ss = Cc["@mozilla.org/browser/sessionstore;1"]
+             .getService(Ci.nsISessionStore);
+
   let opts = "chrome,all,dialog=no,height=800,width=800";
   let win = window.openDialog(getBrowserURL(), "_blank", opts);
 
   whenWindowLoaded(win, function () {
     ss.setWindowState(win, JSON.stringify(state), true);
   });
 
   whenWindowStateReady(win, function () {
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -58,17 +58,22 @@ class RefTest(object):
     self.automation = automation
 
   def getFullPath(self, path):
     "Get an absolute path relative to self.oldcwd."
     return os.path.normpath(os.path.join(self.oldcwd, os.path.expanduser(path)))
 
   def getManifestPath(self, path):
     "Get the path of the manifest, and for remote testing this function is subclassed to point to remote manifest"
-    return self.getFullPath(path)
+    path = self.getFullPath(path)
+    if os.path.isdir(path):
+      defaultManifestPath = os.path.join(path, 'reftest.list')
+      if os.path.exists(defaultManifestPath):
+        path = defaultManifestPath
+    return path
 
   def createReftestProfile(self, options, profileDir, server='localhost'):
     "Sets up a profile for reftest."
 
     self.automation.setupPermissionsDatabase(profileDir,
       {'allowXULXBL': [(server, True), ('<file>', True)]})
 
     # Set preferences for communication between our command line arguments
@@ -125,17 +130,17 @@ class RefTest(object):
     self.leakLogFile = os.path.join(profileDir, "runreftest_leaks.log")
     browserEnv["XPCOM_MEM_BLOAT_LOG"] = self.leakLogFile
     return browserEnv
 
   def cleanup(self, profileDir):
     if profileDir:
       shutil.rmtree(profileDir)
 
-  def runTests(self, manifest, options):
+  def runTests(self, testPath, options):
     debuggerInfo = getDebuggerInfo(self.oldcwd, options.debugger, options.debuggerArgs,
         options.debuggerInteractive);
 
     profileDir = None
     try:
       profileDir = mkdtemp()
       self.copyExtraFilesToProfile(options, profileDir)
       self.createReftestProfile(options, profileDir)
@@ -143,17 +148,17 @@ class RefTest(object):
 
       # browser environment
       browserEnv = self.buildBrowserEnv(options, profileDir)
 
       self.registerExtension(browserEnv, options, profileDir)
 
       # then again to actually run reftest
       self.automation.log.info("REFTEST INFO | runreftest.py | Running tests: start.\n")
-      reftestlist = self.getManifestPath(manifest)
+      reftestlist = self.getManifestPath(testPath)
       status = self.automation.runApp(None, browserEnv, options.app, profileDir,
                                  ["-reftest", reftestlist],
                                  utilityPath = options.utilityPath,
                                  xrePath=options.xrePath,
                                  debuggerInfo=debuggerInfo,
                                  symbolsPath=options.symbolsPath,
                                  # give the JS harness 30 seconds to deal
                                  # with its own timeouts