Merge backout of bug 632404, bug 552864, bug 658995

This commit is contained in:
Matt Brubeck 2011-06-15 09:01:28 -07:00
commit 24b42b347c
41 changed files with 312 additions and 257 deletions

View File

@ -86,10 +86,6 @@ function GroupItem(listOfEls, options) {
this.keepProportional = false;
this._frozenItemSizeData = {};
// Double click tracker
this._lastClick = 0;
this._lastClickPositions = null;
// Variable: _activeTab
// The <TabItem> for the groupItem's active tab.
this._activeTab = null;
@ -786,7 +782,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
return (groupItem != self && !groupItem.getChildren().length);
});
let group = (emptyGroups.length ? emptyGroups[0] : GroupItems.newGroup());
group.newTab();
group.newTab(null, { closedLastTab: true });
}
this.destroy();
@ -1651,28 +1647,6 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
_addHandlers: function GroupItem__addHandlers(container) {
let self = this;
// Create new tab and zoom in on it after a double click
container.mousedown(function(e) {
if (!Utils.isLeftClick(e) || self.$titlebar[0] == e.target ||
self.$titlebar.contains(e.target)) {
self._lastClick = 0;
self._lastClickPositions = null;
return;
}
if (Date.now() - self._lastClick <= UI.DBLCLICK_INTERVAL &&
(self._lastClickPositions.x - UI.DBLCLICK_OFFSET) <= e.clientX &&
(self._lastClickPositions.x + UI.DBLCLICK_OFFSET) >= e.clientX &&
(self._lastClickPositions.y - UI.DBLCLICK_OFFSET) <= e.clientY &&
(self._lastClickPositions.y + UI.DBLCLICK_OFFSET) >= e.clientY) {
self.newTab();
self._lastClick = 0;
self._lastClickPositions = null;
} else {
self._lastClick = Date.now();
self._lastClickPositions = new Point(e.clientX, e.clientY);
}
});
var dropIndex = false;
var dropSpaceTimer = null;
@ -1791,14 +1765,16 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// ----------
// Function: newTab
// Creates a new tab within this groupItem.
newTab: function GroupItem_newTab(url) {
UI.setActive(this, { dontSetActiveTabInGroup: true });
let newTab = gBrowser.loadOneTab(url || "about:blank", {inBackground: true});
// Parameters:
// url - the new tab should open this url as well
// options - the options object
// closedLastTab - boolean indicates the last tab has just been closed
newTab: function GroupItem_newTab(url, options) {
if (options && options.closedLastTab)
UI.closedLastTabInTabView = true;
// TabItems will have handled the new tab and added the tabItem property.
// We don't have to check if it's an app tab (and therefore wouldn't have a
// TabItem), since we've just created it.
newTab._tabViewTabItem.zoomIn(!url);
UI.setActive(this, { dontSetActiveTabInGroup: true });
gBrowser.loadOneTab(url || "about:blank", { inBackground: false });
},
// ----------

View File

@ -380,7 +380,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
}
} else {
// create tab by double click is handled in UI_init().
if (!TabItems.creatingNewOrphanTab)
if (!UI.creatingNewOrphanTab)
GroupItems.newTab(self, {immediately: true});
}
@ -564,7 +564,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
});
group = (emptyGroups.length ? emptyGroups[0] : GroupItems.newGroup());
}
group.newTab();
group.newTab(null, { closedLastTab: true });
}
// when "TabClose" event is fired, the browser tab is about to close and our
// item "close" is fired before the browser tab actually get closed.
@ -666,6 +666,8 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
}
if (self.parent && self.parent.expanded)
self.parent.collapse();
self._sendToSubscribers("zoomedIn");
}
let animateZoom = gPrefBranch.getBoolPref("animate_zoom");
@ -804,7 +806,6 @@ let TabItems = {
_lastUpdateTime: Date.now(),
_eventListeners: [],
_pauseUpdateForTest: false,
creatingNewOrphanTab: false,
tempCanvas: null,
_reconnectingPaused: false,
tabItemPadding: {},

View File

@ -139,6 +139,14 @@ let UI = {
// Used to prevent keypress being handled after quitting search mode.
ignoreKeypressForSearch: false,
// Variable: creatingNewOrphanTab
// Used to keep track of whether we are creating a new oprhan tab or not.
creatingNewOrphanTab: false,
// Variable: _lastOpenedTab
// Used to keep track of the last opened tab.
_lastOpenedTab: null,
// ----------
// Function: toString
// Prints [UI] for debug use
@ -196,20 +204,21 @@ let UI = {
(self._lastClickPositions.y - self.DBLCLICK_OFFSET) <= e.clientY &&
(self._lastClickPositions.y + self.DBLCLICK_OFFSET) >= e.clientY) {
self.setActive(null);
TabItems.creatingNewOrphanTab = true;
let newTab =
gBrowser.loadOneTab("about:blank", { inBackground: true });
self.creatingNewOrphanTab = true;
let box =
new Rect(e.clientX - Math.floor(TabItems.tabWidth/2),
e.clientY - Math.floor(TabItems.tabHeight/2),
TabItems.tabWidth, TabItems.tabHeight);
let newTab =
gBrowser.loadOneTab("about:blank", { inBackground: false });
newTab._tabViewTabItem.setBounds(box, true);
newTab._tabViewTabItem.pushAway(true);
self.setActive(newTab._tabViewTabItem);
TabItems.creatingNewOrphanTab = false;
self.creatingNewOrphanTab = false;
// the bounds of tab item is set and we can zoom in now.
newTab._tabViewTabItem.zoomIn(true);
self._lastClick = 0;
@ -727,6 +736,8 @@ let UI = {
// if it's an app tab, add it to all the group items
if (tab.pinned)
GroupItems.addAppTab(tab);
else if (self.isTabViewVisible())
self._lastOpenedTab = tab;
};
// TabClose
@ -861,30 +872,40 @@ let UI = {
// Function: onTabSelect
// Called when the user switches from one tab to another outside of the TabView UI.
onTabSelect: function UI_onTabSelect(tab) {
let currentTab = this._currentTab;
this._currentTab = tab;
// if the last visible tab has just been closed, don't show the chrome UI.
if (this.isTabViewVisible() &&
(this._closedLastVisibleTab || this._closedSelectedTabInTabView ||
this.restoredClosedTab)) {
if (this.restoredClosedTab) {
// when the tab view UI is being displayed, update the thumb for the
// restored closed tab after the page load
tab.linkedBrowser.addEventListener("load", function (event) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
TabItems._update(tab);
}, true);
if (this.isTabViewVisible()) {
if (!this.restoredClosedTab && this._lastOpenedTab == tab &&
tab._tabViewTabItem) {
if (!this.creatingNewOrphanTab)
tab._tabViewTabItem.zoomIn(true);
this._lastOpenedTab = null;
return;
}
if (this._closedLastVisibleTab ||
(this._closedSelectedTabInTabView && !this.closedLastTabInTabView) ||
this.restoredClosedTab) {
if (this.restoredClosedTab) {
// when the tab view UI is being displayed, update the thumb for the
// restored closed tab after the page load
tab.linkedBrowser.addEventListener("load", function (event) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
TabItems._update(tab);
}, true);
}
this._closedLastVisibleTab = false;
this._closedSelectedTabInTabView = false;
this.closedLastTabInTabView = false;
this.restoredClosedTab = false;
return;
}
this._closedLastVisibleTab = false;
this._closedSelectedTabInTabView = false;
this.restoredClosedTab = false;
return;
}
// reset these vars, just in case.
this._closedLastVisibleTab = false;
this._closedSelectedTabInTabView = false;
this.closedLastTabInTabView = false;
this.restoredClosedTab = false;
this._lastOpenedTab = null;
// if TabView is visible but we didn't just close the last tab or
// selected tab, show chrome.
@ -896,12 +917,7 @@ let UI = {
if (this._currentTab != tab)
return;
let oldItem = null;
let newItem = null;
if (currentTab && currentTab._tabViewTabItem)
oldItem = currentTab._tabViewTabItem;
// update the tab bar for the new tab's group
if (tab && tab._tabViewTabItem) {
if (!TabItems.reconnectingPaused()) {
@ -1499,14 +1515,14 @@ let UI = {
return (!groupItem.hidden && groupItem.getChildren().length > 0);
});
// no pinned tabs, no visible groups and no orphaned tabs: open a new
// group. open a blank tab and return
// group, a blank tab and return
if (!unhiddenGroups.length && !GroupItems.getOrphanedTabs().length) {
let emptyGroups = GroupItems.groupItems.filter(function (groupItem) {
return (!groupItem.hidden && !groupItem.getChildren().length);
});
let group = (emptyGroups.length ? emptyGroups[0] : GroupItems.newGroup());
if (!gBrowser._numPinnedTabs) {
group.newTab();
group.newTab(null, { closedLastTab: true });
return;
}
}

View File

@ -36,20 +36,23 @@ function test3() {
ok(!contentWindow.isSearchEnabled(), "The search is disabled")
is(gBrowser.tabs.length, 1, "There is one tab before cmd/ctrl + t is pressed");
EventUtils.synthesizeKey("t", { accelKey: true }, contentWindow);
is(gBrowser.tabs.length, 2, "There are two tabs after cmd/ctrl + t is pressed");
gBrowser.tabs[0].linkedBrowser.loadURI("about:robots");
gBrowser.tabs[1].linkedBrowser.loadURI("http://example.com/");
whenTabViewIsHidden(function() {
is(gBrowser.tabs.length, 2, "There are two tabs after cmd/ctrl + t is pressed");
afterAllTabsLoaded(function () {
showTabView(test4);
gBrowser.tabs[0].linkedBrowser.loadURI("about:robots");
gBrowser.tabs[1].linkedBrowser.loadURI("http://example.com/");
afterAllTabsLoaded(function () {
showTabView(test4);
});
});
EventUtils.synthesizeKey("t", { accelKey: true }, contentWindow);
}
function test4() {
is(gBrowser.tabs.length, 2, "There are two tabs");
let onTabClose = function() {
gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, true);
executeSoon(function() {
@ -59,7 +62,7 @@ function test4() {
is(gBrowser.tabs.length, 2, "There are two tabs after restoring one");
gBrowser.tabs[0].linkedBrowser.loadURI("about:blank");
gBrowser.removeTab(gBrowser.tabs[1]);
gBrowser.selectedTab = gBrowser.tabs[0];
test8();
});
};
@ -69,14 +72,14 @@ function test4() {
// below key combination shouldn't trigger actions in tabview UI
function test8() {
let newTab = gBrowser.loadOneTab("about:blank", { inBackground: true });
showTabView(function() {
is(gBrowser.tabs.length, 2, "There are two tabs before cmd/ctrl + w is pressed");
EventUtils.synthesizeKey("w", { accelKey: true }, contentWindow);
is(gBrowser.tabs.length, 2, "There are two tabs after cmd/ctrl + w is pressed");
is(gBrowser.tabs.length, 2, "There are two tabs before cmd/ctrl + w is pressed");
EventUtils.synthesizeKey("w", { accelKey: true }, contentWindow);
is(gBrowser.tabs.length, 2, "There are two tabs after cmd/ctrl + w is pressed");
gBrowser.removeTab(newTab);
test9();
gBrowser.removeTab(gBrowser.tabs[1]);
test9();
});
}
function test9() {

View File

@ -69,6 +69,6 @@ function test() {
finish();
}
newWin.addEventListener("tabviewshown", onTabViewShow, false);
newWin.TabView.toggle();
waitForFocus(function() { newWin.TabView.toggle(); });
}, false);
}

View File

@ -9,6 +9,12 @@ let contentElement;
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
if (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
hideTabView(function() {});
});
showTabView(function() {
contentWindow = TabView.getContentWindow();
contentElement = contentWindow.document.getElementById("content");
@ -24,9 +30,10 @@ function test1() {
showTabView(function() {
is(contentWindow.GroupItems.getOrphanedTabs().length, 1,
"An orphaned tab is created");
orphanedTab = contentWindow.GroupItems.getOrphanedTabs()[0].tab;
test2();
hideTabView(function() {
gBrowser.selectedTab = originalTab;
finish();
});
});
});
@ -36,29 +43,10 @@ function test1() {
mouseClick(contentElement, 0);
}
function test2() {
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200);
is(groupItem.getChildren().length, 0, "The group is empty");
hideTabView(function() {
is(groupItem.getChildren().length, 1, "A tab is created inside the group");
gBrowser.selectedTab = originalTab;
gBrowser.removeTab(orphanedTab);
gBrowser.removeTab(groupItem.getChildren()[0].tab);
finish();
});
// first click
mouseClick(groupItem.container, 0);
// second click
mouseClick(groupItem.container, 0);
}
function mouseClick(targetElement, buttonCode) {
EventUtils.sendMouseEvent(
{ type: "mousedown", button: buttonCode }, targetElement, contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup", button: buttonCode }, targetElement, contentWindow);
}

View File

@ -64,11 +64,8 @@ function part1(win) {
ok(!contentWindow.UI.getActiveOrphanTab(), "There is no active orphan tab.");
ok(win.TabView.isVisible(), "Tab View is visible.");
win.gBrowser.tabContainer.addEventListener("TabSelect", function() {
win.gBrowser.tabContainer.removeEventListener("TabSelect", arguments.callee, false);
executeSoon(part4);
}, false);
whenTabViewIsHidden(part4, win);
win.document.getElementById("cmd_newNavigatorTab").doCommand();
}

View File

@ -35,7 +35,6 @@ function test() {
let tabItem = gBrowser.tabs[0]._tabViewTabItem;
cw.GroupItems.updateActiveGroupItemAndTabBar(tabItem);
gBrowser.removeTab(gBrowser.tabs[1]);
assertNumberOfGroups(1);
assertNumberOfTabs(1);
@ -69,9 +68,10 @@ function test() {
// simulate double click with left mouse button
let container = groupItem.container;
simulateDoubleClick(container);
assertNumberOfTabs(2);
assertNumberOfTabs(1);
whenTabViewIsHidden(finishTest);
groupItem.close();
hideTabView(finishTest);
}
waitForExplicitFinish();

View File

@ -0,0 +1,86 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let origTab = gBrowser.visibleTabs[0];
let contentWindow;
function test() {
waitForExplicitFinish();
test1();
}
// Open a new tab when the active tab item belongs to a group item.
function test1() {
registerCleanupFunction(function () TabView.hide());
showTabView(function() {
ok(origTab._tabViewTabItem.parent, "The original tab belongs to a group");
contentWindow = TabView.getContentWindow();
contentWindow.UI.setActive(origTab._tabViewTabItem);
testCreateTabAndThen(test2);
});
}
// Open a new tab when the active tab item is nothing.
function test2() {
showTabView(function() {
contentWindow.UI.setActive(null, { onlyRemoveActiveTab: true });
testCreateTabAndThen(test3);
});
}
// Open a new tab when the active tab item is an orphan tab.
function test3() {
showTabView(function() {
let groupItem = origTab._tabViewTabItem.parent;
let tabItems = groupItem.getChildren();
is(tabItems.length, 3, "There are 3 tab items in the group");
let lastTabItem = tabItems[tabItems.length - 1];
groupItem.remove(lastTabItem);
let orphanedTabs = contentWindow.GroupItems.getOrphanedTabs();
is(orphanedTabs.length, 1, "There should be 1 orphan tab");
is(orphanedTabs[0], lastTabItem, "The tab item is the same as the orphan tab");
contentWindow.UI.setActive(lastTabItem);
testCreateTabAndThen(function() {
hideTabView(finish);
});
});
}
function testCreateTabAndThen(callback) {
ok(TabView.isVisible(), "Tab View is visible");
// detect tab open and zoomed in event.
let onTabOpen = function(event) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, false);
// ensure that the default tabview listener is called before so the
// tab._tabViewTabItem exists
executeSoon(function() {
let tab = event.target;
tabItem = tab._tabViewTabItem;
ok(tabItem, "Tab item is available after tab open");
registerCleanupFunction(function () gBrowser.removeTab(tab))
tabItem.addSubscriber(tabItem, "zoomedIn", function() {
tabItem.removeSubscriber(tabItem, "zoomedIn");
is(gBrowser.selectedTab, tab,
"The selected tab is the same as the newly opened tab");
executeSoon(callback);
});
});
}
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, false);
// use the menu item (the same as pressing cmd/ctrl + t)
document.getElementById("menu_newNavigatorTab").doCommand();
}

View File

@ -50,33 +50,35 @@ function onTabViewLoadedAndShown() {
}
// Create a second tab
gBrowser.addTab("about:robots");
gBrowser.loadOneTab("about:robots", { inBackground: false });
is(gBrowser.tabs.length, 2, "we now have 2 tabs");
registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.tabs[1]);
});
afterAllTabsLoaded(function() {
// Get normal tab urls
for (let a = 0; a < gBrowser.tabs.length; a++)
normalURLs.push(gBrowser.tabs[a].linkedBrowser.currentURI.spec);
showTabView(function() {
// Get normal tab urls
for (let a = 0; a < gBrowser.tabs.length; a++)
normalURLs.push(gBrowser.tabs[a].linkedBrowser.currentURI.spec);
// verify that we're all set up for our test
verifyNormal();
// verify that we're all set up for our test
verifyNormal();
// go into private browsing and make sure Tab View becomes hidden
togglePBAndThen(function() {
ok(!TabView.isVisible(), "Tab View is no longer visible");
verifyPB();
// exit private browsing and make sure Tab View is shown again
// go into private browsing and make sure Tab View becomes hidden
togglePBAndThen(function() {
ok(TabView.isVisible(), "Tab View is visible again");
verifyNormal();
ok(!TabView.isVisible(), "Tab View is no longer visible");
verifyPB();
hideTabView(onTabViewHidden);
// exit private browsing and make sure Tab View is shown again
togglePBAndThen(function() {
ok(TabView.isVisible(), "Tab View is visible again");
verifyNormal();
hideTabView(onTabViewHidden);
});
});
});
});
});
}

View File

@ -315,6 +315,7 @@ WARNINGS_AS_ERRORS = @WARNINGS_AS_ERRORS@
MOZ_OPTIMIZE = @MOZ_OPTIMIZE@
MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@
MOZ_PGO_OPTIMIZE_FLAGS = @MOZ_PGO_OPTIMIZE_FLAGS@
MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@
MOZ_OPTIMIZE_SIZE_TWEAK = @MOZ_OPTIMIZE_SIZE_TWEAK@

View File

@ -422,8 +422,13 @@ ifdef MODULE_OPTIMIZE_FLAGS
CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
else
ifneq (,$(if $(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE),$(MOZ_PGO_OPTIMIZE_FLAGS)))
CFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
CXXFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
else
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
endif # MODULE_OPTIMIZE_FLAGS
else
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)

View File

@ -2224,10 +2224,12 @@ ia64*-hpux*)
esac
# If we're building with --enable-profiling, we need a frame pointer.
if test -z "$MOZ_PROFILING"; then
MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
MOZ_FRAMEPTR_FLAGS="-fomit-frame-pointer"
else
MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
MOZ_FRAMEPTR_FLAGS="-fno-omit-frame-pointer"
fi
MOZ_PGO_OPTIMIZE_FLAGS="-O3 $MOZ_FRAMEPTR_FLAGS"
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK $MOZ_FRAMEPTR_FLAGS"
MOZ_DEBUG_FLAGS="-g"
fi
@ -7275,6 +7277,7 @@ AC_SUBST(MOZ_OPTIMIZE)
AC_SUBST(MOZ_OPTIMIZE_FLAGS)
AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
dnl ========================================================
dnl = Enable generation of debug symbols

View File

@ -77,6 +77,8 @@
#endif
#endif
using namespace mozilla;
#ifdef CAIRO_HAS_D2D_SURFACE
#include "gfxD2DSurface.h"
@ -85,8 +87,6 @@
#include "nsIMemoryReporter.h"
#include "nsMemory.h"
using namespace mozilla;
class D2DCacheReporter :
public nsIMemoryReporter
{

View File

@ -145,6 +145,7 @@ FAIL_ON_WARNINGS = @FAIL_ON_WARNINGS@
MOZ_OPTIMIZE = @MOZ_OPTIMIZE@
MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@
MOZ_PGO_OPTIMIZE_FLAGS = @MOZ_PGO_OPTIMIZE_FLAGS@
MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@
MOZ_OPTIMIZE_SIZE_TWEAK = @MOZ_OPTIMIZE_SIZE_TWEAK@

View File

@ -422,8 +422,13 @@ ifdef MODULE_OPTIMIZE_FLAGS
CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
else
ifneq (,$(if $(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE),$(MOZ_PGO_OPTIMIZE_FLAGS)))
CFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
CXXFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
else
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
endif # MODULE_OPTIMIZE_FLAGS
else
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)

View File

@ -2140,10 +2140,12 @@ ia64*-hpux*)
esac
# If we're building with --enable-profiling, we need a frame pointer.
if test -z "$MOZ_PROFILING"; then
MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
MOZ_FRAMEPTR_FLAGS="-fomit-frame-pointer"
else
MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
MOZ_FRAMEPTR_FLAGS="-fno-omit-frame-pointer"
fi
MOZ_PGO_OPTIMIZE_FLAGS="-O3 $MOZ_FRAMEPTR_FLAGS"
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK $MOZ_FRAMEPTR_FLAGS"
MOZ_DEBUG_FLAGS="-g"
fi
@ -4729,6 +4731,7 @@ AC_SUBST(MOZ_OPTIMIZE)
AC_SUBST(MOZ_OPTIMIZE_FLAGS)
AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
dnl ========================================================
dnl = Enable generation of debug symbols

View File

@ -59,8 +59,8 @@ var MenuListHelperUI = {
}
window.addEventListener("resize", this, true);
this.sizeToContent();
container.hidden = false;
this.sizeToContent();
BrowserUI.pushPopup(this, [this._popup]);
},
@ -86,8 +86,7 @@ var MenuListHelperUI = {
},
sizeToContent: function sizeToContent() {
let style = document.defaultView.getComputedStyle(this._container, null);
this._popup.width = window.innerWidth - (parseInt(style.paddingLeft) + parseInt(style.paddingRight));
this._popup.width = window.innerWidth * 0.8;
},
handleEvent: function handleEvent(aEvent) {

View File

@ -2734,18 +2734,13 @@ Tab.prototype = {
if ("delayLoad" in aParams && aParams.delayLoad)
return;
// Give the browser binding a chance to attach completely before trying to
// load. Trying to load an invalid about: page from a remote browser causes
// a crash when trying to display the warning dialog.
setTimeout(function() {
try {
let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let postData = aParams.postData ? aParams.postData.value : null;
browser.loadURIWithFlags(aURI, flags, aParams.referrerURI, aParams.charset, postData);
} catch(e) {
dump("Error: " + e + "\n");
}
}, 0);
try {
let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let postData = aParams.postData ? aParams.postData.value : null;
browser.loadURIWithFlags(aURI, flags, aParams.referrerURI, aParams.charset, postData);
} catch(e) {
dump("Error: " + e + "\n");
}
},
destroy: function destroy() {

View File

@ -597,7 +597,7 @@
</vbox>
</vbox>
<hbox id="context-container" class="window-width window-height context-block" top="0" left="0" hidden="true" flex="1">
<hbox id="context-container" class="window-width window-height context-block" top="0" left="0" hidden="true">
<vbox id="context-popup" class="dialog-dark">
<hbox id="context-header">
<label id="context-hint" crop="center" flex="1"/>

View File

@ -1189,11 +1189,11 @@ var ContextHelper = {
let label = document.getElementById("context-hint");
label.value = this.popupState.label || "";
this.sizeToContent();
this._panel.hidden = false;
window.addEventListener("resize", this, true);
window.addEventListener("keypress", this, true);
this.sizeToContent();
BrowserUI.pushPopup(this, [this._popup]);
let event = document.createEvent("Events");
@ -1215,8 +1215,7 @@ var ContextHelper = {
},
sizeToContent: function sizeToContent() {
let style = document.defaultView.getComputedStyle(this._panel, null);
this._popup.width = window.innerWidth - (parseInt(style.paddingLeft) + parseInt(style.paddingRight));
this._popup.maxWidth = window.innerWidth * 0.75;
},
handleEvent: function handleEvent(aEvent) {

View File

@ -1021,7 +1021,7 @@ var FormSubmitObserver = {
addMessageListener("Browser:TabClose", this);
},
receiveMessage: function receiveMessage(aMessage) {
receiveMessage: function findHandlerReceiveMessage(aMessage) {
let json = aMessage.json;
switch (aMessage.name) {
case "Browser:TabOpen":

View File

@ -96,7 +96,7 @@ SSLExceptions.prototype = {
var req = new XMLHttpRequest();
try {
if (aURI) {
if(aURI) {
req.open("GET", aURI.prePath, false);
req.channel.notificationCallbacks = this;
req.send(null);

View File

@ -1082,17 +1082,9 @@ documenttab[reload="true"] > stack > .documenttab-reload {
border-top: @border_width_tiny@ solid rgb(205,205,205);
padding: 0;
-moz-user-focus: ignore;
}
.action-buttons,
#pageactions-container {
display: inline-block;
}
#context-commands {
display: -moz-box;
}
.action-button,
.context-command,
pageaction {

View File

@ -17,7 +17,6 @@
%define touch_action_minwidth 21.17mozmm
%define touch_normal 6.77mozmm
%define margin_context_popup 3.39mozmm
%define margin_large 2.54mozmm
%define margin_xxxnormal 1.69mozmm
%define margin_xnormal 1.06mozmm
@ -105,7 +104,6 @@
%define touch_action_minwidth 200px
%define touch_normal 64px
%define margin_context_popup 32px
%define margin_large 24px
%define margin_xxxnormal 16px
%define margin_xnormal 10px

View File

@ -1048,17 +1048,9 @@ documenttab[reload="true"] > stack > .documenttab-reload {
border-top: @border_width_tiny@ solid rgb(205,205,205);
padding: 0;
-moz-user-focus: ignore;
}
.action-buttons,
#pageactions-container {
display: inline-block;
}
#context-commands {
display: -moz-box;
}
.action-button,
.context-command,
pageaction {
@ -1162,13 +1154,8 @@ pageaction:not([image]) > hbox >.pageaction-image {
display: none;
}
#context-header {
background-color: @color_background_default@;
}
#share-title,
#context-hint {
color: @color_text_default@;
font-size: @font_small@;
padding: @padding_small@;
}

View File

@ -43,7 +43,6 @@
%define touch_action_minwidth 21.17mozmm
%define touch_normal 6.77mozmm
%define margin_context_popup 3.39mozmm
%define margin_large 2.54mozmm
%define margin_xxxnormal 1.69mozmm
%define margin_xnormal 1.06mozmm
@ -133,7 +132,6 @@
%define touch_action_minwidth 200px
%define touch_normal 64px
%define margin_context_popup 32px
%define margin_large 24px
%define margin_xxxnormal 16px
%define margin_xnormal 10px

View File

@ -118,14 +118,14 @@ textbox[disabled="true"] {
}
.context-block {
padding: @margin_context_popup@;
padding: @touch_normal@;
}
.dialog-dark,
.panel-arrowcontent {
background-color: @color_background_inverse@;
box-shadow: black 0 @border_radius_tiny@ @border_radius_tiny@, black 0 -@border_radius_tiny@ @border_radius_tiny@;
padding: 0;
padding: @padding_normal@ 0; /* core spacing */
}
@media (max-width: 499px) {
@ -613,12 +613,12 @@ dialog {
.panel-arrow[side="top"] {
list-style-image: url("chrome://browser/skin/images/arrowbox-up.png");
margin-bottom: -@margin_snormal@;
margin-bottom: -@margin_normal@;
}
.panel-arrow[side="bottom"] {
list-style-image: url("chrome://browser/skin/images/arrowbox-down.png");
margin-top: -@margin_snormal@;
margin-top: -@margin_normal@;
}
.panel-arrow[side="left"] {

View File

@ -120,7 +120,7 @@ textbox[disabled="true"] {
}
.context-block {
padding: @margin_context_popup@;
padding: @touch_normal@;
}
.dialog-dark,

View File

@ -3151,9 +3151,9 @@ pref("image.http.accept", "image/png,image/*;q=0.8,*/*;q=0.5");
// compressed data.
pref("image.mem.discardable", true);
// Prevents images from automatically being decoded when loaded in background
// tabs, instead allowing them to be decoded on demand when they are drawn.
pref("image.mem.decodeondraw", true);
// Prevents images from automatically being decoded on load, instead allowing
// them to be decoded on demand when they are drawn.
pref("image.mem.decodeondraw", false);
// Minimum timeout for image discarding (in milliseconds). The actual time in
// which an image must inactive for it to be discarded will vary between this

View File

@ -51,7 +51,7 @@ native PRNetAddr(union PRNetAddr);
* NOTE: This is a free-threaded interface, meaning that the methods on
* this interface may be called from any thread.
*/
[scriptable, uuid(bbee8fef-6ac2-4819-9089-61169bdf5074)]
[scriptable, uuid(19c37caa-fb41-4c32-bbf1-c6b31b75d789)]
interface nsISocketTransport : nsITransport
{
/**
@ -95,12 +95,8 @@ interface nsISocketTransport : nsITransport
/**
* Test if this socket transport is (still) connected.
*
* @param aPassive indicates that the IsAlive() method should not
* read, even non-destructively, from the network.
* SSL based transports may deadlock if called without this.
*/
boolean isAlive(in boolean aPassive);
boolean isAlive();
/**
* Socket timeouts in seconds. To specify no timeout, pass PR_UINT32_MAX

View File

@ -1833,7 +1833,7 @@ nsSocketTransport::SetEventSink(nsITransportEventSink *sink,
}
NS_IMETHODIMP
nsSocketTransport::IsAlive(PRBool aPassive, PRBool *result)
nsSocketTransport::IsAlive(PRBool *result)
{
*result = PR_FALSE;
@ -1849,32 +1849,12 @@ nsSocketTransport::IsAlive(PRBool aPassive, PRBool *result)
// XXX do some idle-time based checks??
if (aPassive) {
*result = PR_TRUE; /* presume true */
char c;
PRInt32 rval = PR_Recv(fd, &c, 1, PR_MSG_PEEK, 0);
PRPollDesc desc;
desc.fd = mFD;
if ((rval > 0) || (rval < 0 && PR_GetError() == PR_WOULD_BLOCK_ERROR))
*result = PR_TRUE;
// include POLL_READ in the in_flags in order to take
// conditions PK11LoggedOut / AlreadyShutDown into account on SSL
// sockets as a workaround for bug 658138
desc.in_flags = PR_POLL_READ | PR_POLL_EXCEPT;
desc.out_flags = 0;
if ((PR_Poll(&desc, 1, 0) == 1) &&
(desc.out_flags &
(PR_POLL_EXCEPT | PR_POLL_ERR | PR_POLL_NVAL | PR_POLL_HUP))) {
*result = PR_FALSE;
}
}
else {
char c;
PRInt32 rval = PR_Recv(fd, &c, 1, PR_MSG_PEEK, 0);
if ((rval > 0) || (rval < 0 && PR_GetError() == PR_WOULD_BLOCK_ERROR))
*result = PR_TRUE;
}
{
MutexAutoLock lock(mLock);
ReleaseFD_Locked(fd);

View File

@ -593,19 +593,6 @@ NS_IMETHODIMP
nsSocketTransportService::OnProcessNextEvent(nsIThreadInternal *thread,
PRBool mayWait, PRUint32 depth)
{
// DoPollIteration doesn't support being called recursively. This case
// should only happen when someone (e.g., PSM) is issuing a synchronous
// proxy call from this thread to the main thread.
if (depth > 1)
return NS_OK;
// Favor processing existing sockets before other events.
DoPollIteration(PR_FALSE);
PRBool val;
while (mayWait && NS_SUCCEEDED(thread->HasPendingEvents(&val)) && !val)
DoPollIteration(PR_TRUE);
return NS_OK;
}
@ -635,8 +622,24 @@ nsSocketTransportService::Run()
threadInt->SetObserver(this);
for (;;) {
// process all pending events
NS_ProcessPendingEvents(thread);
PRBool pendingEvents = PR_FALSE;
thread->HasPendingEvents(&pendingEvents);
do {
// If there are pending events for this thread then
// DoPollIteration() should service the network without blocking.
DoPollIteration(!pendingEvents);
// If nothing was pending before the poll, it might be now
if (!pendingEvents)
thread->HasPendingEvents(&pendingEvents);
if (pendingEvents) {
NS_ProcessNextEvent(thread);
pendingEvents = PR_FALSE;
thread->HasPendingEvents(&pendingEvents);
}
} while (pendingEvents);
// now that our event queue is empty, check to see if we should exit
{
@ -644,9 +647,6 @@ nsSocketTransportService::Run()
if (mShuttingDown)
break;
}
// wait for and process the next pending event
NS_ProcessNextEvent(thread);
}
SOCKET_LOG(("STS shutting down thread\n"));

View File

@ -1428,8 +1428,7 @@ nsFtpState::R_pasv() {
if (NS_SUCCEEDED(rv)) {
if (oldPort == port) {
PRBool isAlive;
if (NS_SUCCEEDED(strans->IsAlive(PR_FALSE, &isAlive)) &&
isAlive)
if (NS_SUCCEEDED(strans->IsAlive(&isAlive)) && isAlive)
newDataConn = PR_FALSE;
}
}

View File

@ -116,7 +116,7 @@ nsFtpControlConnection::IsAlive()
return PR_FALSE;
PRBool isAlive = PR_FALSE;
mSocket->IsAlive(PR_FALSE, &isAlive);
mSocket->IsAlive(&isAlive);
return isAlive;
}
nsresult

View File

@ -260,8 +260,6 @@ HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead,
mCacheEntryAvailable = cacheEntryAvailable;
mCacheExpirationTime = cacheExpirationTime;
mCachedCharset = cachedCharset;
mSelfAddr = selfAddr;
mPeerAddr = peerAddr;
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
@ -288,6 +286,9 @@ HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead,
rv = ApplyContentConversions();
if (NS_FAILED(rv))
Cancel(rv);
mSelfAddr = selfAddr;
mPeerAddr = peerAddr;
}
class TransportAndDataEvent : public ChannelEvent
@ -1084,6 +1085,36 @@ HttpChannelChild::SetupFallbackChannel(const char *aFallbackKey)
DROP_DEAD();
}
// The next four _should_ be implemented, but we need to figure out how
// to transfer the data from the chrome process first.
NS_IMETHODIMP
HttpChannelChild::GetRemoteAddress(nsACString & _result)
{
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
HttpChannelChild::GetRemotePort(PRInt32 * _result)
{
NS_ENSURE_ARG_POINTER(_result);
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
HttpChannelChild::GetLocalAddress(nsACString & _result)
{
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
HttpChannelChild::GetLocalPort(PRInt32 * _result)
{
NS_ENSURE_ARG_POINTER(_result);
return NS_ERROR_NOT_AVAILABLE;
}
//-----------------------------------------------------------------------------
// HttpChannelChild::nsICacheInfoChannel
//-----------------------------------------------------------------------------

View File

@ -106,6 +106,10 @@ public:
PRBool aMerge);
// nsIHttpChannelInternal
NS_IMETHOD SetupFallbackChannel(const char *aFallbackKey);
NS_IMETHOD GetLocalAddress(nsACString& addr);
NS_IMETHOD GetLocalPort(PRInt32* port);
NS_IMETHOD GetRemoteAddress(nsACString& addr);
NS_IMETHOD GetRemotePort(PRInt32* port);
// nsISupportsPriority
NS_IMETHOD SetPriority(PRInt32 value);
// nsIResumableChannel

View File

@ -79,7 +79,6 @@ nsHttpConnection::nsHttpConnection()
, mKeepAliveMask(PR_TRUE)
, mSupportsPipelining(PR_FALSE) // assume low-grade server
, mIsReused(PR_FALSE)
, mIsActivated(PR_FALSE)
, mCompletedProxyConnect(PR_FALSE)
, mLastTransactionExpectedNoContent(PR_FALSE)
, mIdleMonitoring(PR_FALSE)
@ -169,7 +168,6 @@ nsHttpConnection::Activate(nsAHttpTransaction *trans, PRUint8 caps)
// take ownership of the transaction
mTransaction = trans;
mIsActivated = PR_TRUE;
NS_ABORT_IF_FALSE(!mIdleMonitoring,
"Activating a connection with an Idle Monitor");
@ -278,15 +276,8 @@ nsHttpConnection::IsAlive()
if (!mSocketTransport)
return PR_FALSE;
// Calling IsAlive() non passively on an SSL socket transport that has
// not yet completed the SSL handshake can result
// in the event loop being run. All code that calls
// nsHttpConnection::IsAlive() is not re-entrant so we need to avoid
// having IsAlive() trigger a real SSL read in that circumstance.
PRBool alive;
PRBool passiveRead = mConnInfo->UsingSSL() && !mIsActivated;
nsresult rv = mSocketTransport->IsAlive(passiveRead, &alive);
nsresult rv = mSocketTransport->IsAlive(&alive);
if (NS_FAILED(rv))
alive = PR_FALSE;

View File

@ -200,7 +200,6 @@ private:
PRPackedBool mKeepAliveMask;
PRPackedBool mSupportsPipelining;
PRPackedBool mIsReused;
PRPackedBool mIsActivated;
PRPackedBool mCompletedProxyConnect;
PRPackedBool mLastTransactionExpectedNoContent;
PRPackedBool mIdleMonitoring;

View File

@ -22,14 +22,14 @@ TracingListener.prototype = {
request.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
// local/remote addresses broken in e10s: disable for now
/*
do_check_eq(request.localAddress, "127.0.0.1");
do_check_eq(request.localPort > 0, true);
do_check_neq(request.localPort, 4444);
do_check_eq(request.remoteAddress, "127.0.0.1");
do_check_eq(request.remotePort, 4444);
request.QueryInterface(Components.interfaces.nsISupportsPriority);
request.priority = Ci.nsISupportsPriority.PRIORITY_LOW;
*/
// Make sure listener can't be replaced after OnStartRequest was called.
request.QueryInterface(Components.interfaces.nsITraceableChannel);

View File

@ -51,7 +51,7 @@ MOZILLA_INTERNAL_API = 1
# work around bug 408258
ifdef GNU_CC
ifneq ($(OS_ARCH), Darwin)
MODULE_OPTIMIZE_FLAGS = -O3 -fno-strict-aliasing
MODULE_OPTIMIZE_FLAGS = $(MOZ_OPTIMIZE_FLAGS) -fno-strict-aliasing
endif
endif