Merge mozilla-central and mozilla-inbound in the hope to reopen soon a CLOSED TREE

This commit is contained in:
Marco Bonardo 2011-08-05 17:09:02 +02:00
Родитель 6e99b40d1e 1983ce77e0
Коммит 382a5d28c4
24 изменённых файлов: 225 добавлений и 211 удалений

Просмотреть файл

@ -433,7 +433,8 @@ let UI = {
Utils.assert(item, "item must be given");
if (item.isATabItem) {
GroupItems.setActiveGroupItem(item.parent);
if (item.parent)
GroupItems.setActiveGroupItem(item.parent);
this._setActiveTab(item);
} else {
GroupItems.setActiveGroupItem(item);

Просмотреть файл

@ -22,7 +22,7 @@ function onTabViewLoadedAndShown() {
ok(TabView.isVisible(), "Tab View is visible");
// Establish initial state
contentWindow = document.getElementById("tab-view").contentWindow;
contentWindow = TabView.getContentWindow();
verifyCleanState("start");
// register a clean up for private browsing just in case
@ -50,36 +50,33 @@ function onTabViewLoadedAndShown() {
}
// Create a second tab
gBrowser.loadOneTab("about:robots", { inBackground: false });
gBrowser.addTab("about:robots");
is(gBrowser.tabs.length, 2, "we now have 2 tabs");
registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.tabs[1]);
});
afterAllTabsLoaded(function() {
showTabView(function() {
// Get normal tab urls
for (let a = 0; a < gBrowser.tabs.length; a++)
normalURLs.push(gBrowser.tabs[a].linkedBrowser.currentURI.spec);
// 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() {
whenTabViewIsHidden(function() {
ok(!TabView.isVisible(), "Tab View is no longer visible");
// go into private browsing and make sure Tab View becomes hidden
togglePBAndThen(function() {
whenTabViewIsHidden(function() {
ok(!TabView.isVisible(), "Tab View is no longer visible");
verifyPB();
verifyPB();
// exit private browsing and make sure Tab View is shown again
togglePBAndThen(function() {
whenTabViewIsShown(function() {
ok(TabView.isVisible(), "Tab View is visible again");
verifyNormal();
// exit private browsing and make sure Tab View is shown again
togglePBAndThen(function() {
whenTabViewIsShown(function() {
ok(TabView.isVisible(), "Tab View is visible again");
verifyNormal();
hideTabView(onTabViewHidden);
});
hideTabView(onTabViewHidden);
});
});
});
@ -103,6 +100,8 @@ function onTabViewHidden() {
// end game
ok(!TabView.isVisible(), "we finish with Tab View not visible");
registerCleanupFunction(verifyCleanState); // verify after all cleanups
gBrowser.selectedTab = gBrowser.tabs[0];
finish();
});
});

Просмотреть файл

@ -812,8 +812,10 @@ var PlacesUIUtils = {
}
var loadInBackground = where == "tabshifted" ? true : false;
var replaceCurrentTab = where == "tab" ? false : true;
browserWindow.gBrowser.loadTabs(urls, loadInBackground, replaceCurrentTab);
// For consistency, we want all the bookmarks to open in new tabs, instead
// of having one of them replace the currently focused tab. Hence we call
// loadTabs with aReplace set to false.
browserWindow.gBrowser.loadTabs(urls, loadInBackground, false);
},
/**

Просмотреть файл

@ -92,18 +92,28 @@ Site.prototype = {
* A callback function that takes a favicon image URL as a parameter.
*/
getFavicon: function Site_getFavicon(aCallback) {
let callbackExecuted = false;
function faviconDataCallback(aURI, aDataLen, aData, aMimeType) {
// We don't need a second callback, so we can ignore it to avoid making
// a second database query for the favicon data.
if (callbackExecuted) {
return;
}
try {
aCallback(aURI.spec);
// Use getFaviconLinkForIcon to get image data from the database instead
// of using the favicon URI to fetch image data over the network.
aCallback(gFaviconService.getFaviconLinkForIcon(aURI).spec);
callbackExecuted = true;
} catch (e) {
Cu.reportError("AboutPermissions: " + e);
}
}
// Try to find favicion for both URIs. Callback will only be called if a
// favicon URI is found, so this means we'll always prefer the https favicon.
gFaviconService.getFaviconURLForPage(this.httpURI, faviconDataCallback);
// favicon URI is found. We'll ignore the second callback if it is called,
// so this means we'll always prefer the https favicon.
gFaviconService.getFaviconURLForPage(this.httpsURI, faviconDataCallback);
gFaviconService.getFaviconURLForPage(this.httpURI, faviconDataCallback);
},
/**

Просмотреть файл

@ -503,41 +503,43 @@ PrivateBrowsingService.prototype = {
if (this._currentStatus != STATE_IDLE)
throw Cr.NS_ERROR_FAILURE;
if (val == this._inPrivateBrowsing)
return;
try {
if (val) {
if (!this._canEnterPrivateBrowsingMode())
return;
}
else {
if (!this._canLeavePrivateBrowsingMode())
return;
}
this._ensureCanCloseWindows();
// start the transition now that we know that we can
this._currentStatus = STATE_TRANSITION_STARTED;
if (val != this._inPrivateBrowsing) {
if (val) {
if (!this._canEnterPrivateBrowsingMode())
return;
}
else {
if (!this._canLeavePrivateBrowsingMode())
return;
}
this._autoStarted = this._prefs.getBoolPref("browser.privatebrowsing.autostart");
this._inPrivateBrowsing = val != false;
this._ensureCanCloseWindows();
let data = val ? "enter" : "exit";
this._autoStarted = this._prefs.getBoolPref("browser.privatebrowsing.autostart");
this._inPrivateBrowsing = val != false;
let quitting = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
quitting.data = this._quitting;
let data = val ? "enter" : "exit";
// notify observers of the pending private browsing mode change
this._obs.notifyObservers(quitting, "private-browsing-change-granted", data);
let quitting = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
quitting.data = this._quitting;
// destroy the current session and start initial cleanup
this._onBeforePrivateBrowsingModeChange();
// notify observers of the pending private browsing mode change
this._obs.notifyObservers(quitting, "private-browsing-change-granted", data);
this._obs.notifyObservers(quitting, "private-browsing", data);
// destroy the current session and start initial cleanup
this._onBeforePrivateBrowsingModeChange();
this._obs.notifyObservers(quitting, "private-browsing", data);
// load the appropriate session
this._onAfterPrivateBrowsingModeChange();
}
// load the appropriate session
this._onAfterPrivateBrowsingModeChange();
} catch (ex) {
// We aborted the transition to/from private browsing, we must restore the
// beforeunload handling on all the windows for which we switched it off.

Просмотреть файл

@ -48,12 +48,8 @@ window.onload = function() {
// (for when the tab is closed or the session crashes right again)
var sessionData = document.getElementById("sessionData");
if (!sessionData.value) {
var ss = Cc["@mozilla.org/browser/sessionstartup;1"].getService(Ci.nsISessionStartup);
sessionData.value = ss.state;
if (!sessionData.value) {
document.getElementById("errorTryAgain").disabled = true;
return;
}
document.getElementById("errorTryAgain").disabled = true;
return;
}
// remove unneeded braces (added for compatibility with Firefox 2.0 and 3.0)

Просмотреть файл

@ -7,19 +7,35 @@ function test() {
{entries: [{url: "about:robots"}], hidden: true}
] }] };
let finalState = { windows: [{ tabs: [
{entries: [{url: "about:blank"}]}
] }] };
waitForExplicitFinish();
waitForBrowserState(state, function () {
is(gBrowser.tabs.length, 2, "two tabs were restored");
is(gBrowser.visibleTabs.length, 1, "one tab is visible");
newWindowWithState(state, function (win) {
registerCleanupFunction(function () win.close());
let tab = gBrowser.visibleTabs[0];
is(win.gBrowser.tabs.length, 2, "two tabs were restored");
is(win.gBrowser.visibleTabs.length, 1, "one tab is visible");
let tab = win.gBrowser.visibleTabs[0];
is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "visible tab is about:mozilla");
waitForBrowserState(finalState, finish);
finish();
});
}
function newWindowWithState(state, callback) {
let opts = "chrome,all,dialog=no,height=800,width=800";
let win = window.openDialog(getBrowserURL(), "_blank", opts);
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
executeSoon(function () {
win.addEventListener("SSWindowStateReady", function onReady() {
win.removeEventListener("SSWindowStateReady", onReady, false);
executeSoon(function () callback(win));
}, false);
ss.setWindowState(win, JSON.stringify(state), true);
});
}, false);
}

Просмотреть файл

@ -1,11 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let stateBackup = ss.getBrowserState();
function test() {
waitForExplicitFinish();
let oldState = {
windows: [{
tabs: [
@ -20,24 +16,26 @@ function test() {
};
let state = { windows: [{ tabs: [{ entries: [pageData] }] }] };
// The form data will be restored before SSTabRestored, so we want to listen
// for that on the currently selected tab (it will be reused)
gBrowser.selectedTab.addEventListener("SSTabRestored", onSSTabRestored, true);
waitForExplicitFinish();
ss.setBrowserState(JSON.stringify(state));
newWindowWithState(state, function (win) {
registerCleanupFunction(function () win.close());
is(gBrowser.tabs.length, 1, "The total number of tabs should be 1");
is(gBrowser.visibleTabs.length, 1, "The total number of visible tabs should be 1");
executeSoon(function () {
waitForFocus(function () {
middleClickTest(win);
finish();
}, win);
});
});
}
function onSSTabRestored(aEvent) {
gBrowser.selectedTab.removeEventListener("SSTabRestored", onSSTabRestored, true);
is(gBrowser.tabs.length, 1, "The total number of tabs should be 1");
is(gBrowser.visibleTabs.length, 1, "The total number of visible tabs should be 1");
executeSoon(middleClickTest);
}
function middleClickTest() {
let tree = gBrowser.selectedBrowser.contentDocument.getElementById("tabList");
function middleClickTest(win) {
let browser = win.gBrowser.selectedBrowser;
let tree = browser.contentDocument.getElementById("tabList");
is(tree.view.rowCount, 3, "There should be three items");
let x = {}, y = {}, width = {}, height = {};
@ -45,21 +43,36 @@ function middleClickTest() {
// click on the first tab item
tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[1], "text", x, y, width, height);
EventUtils.synthesizeMouse(tree.body, x.value, y.value, { button: 1 },
gBrowser.selectedBrowser.contentWindow);
browser.contentWindow);
// click on the second tab item
tree.treeBoxObject.getCoordsForCellItem(2, tree.columns[1], "text", x, y, width, height);
EventUtils.synthesizeMouse(tree.body, x.value, y.value, { button: 1 },
gBrowser.selectedBrowser.contentWindow);
browser.contentWindow);
is(gBrowser.tabs.length, 3,
is(win.gBrowser.tabs.length, 3,
"The total number of tabs should be 3 after restoring 2 tabs by middle click.");
is(gBrowser.visibleTabs.length, 3,
is(win.gBrowser.visibleTabs.length, 3,
"The total number of visible tabs should be 3 after restoring 2 tabs by middle click");
cleanup();
}
function cleanup() {
ss.setBrowserState(stateBackup);
executeSoon(finish);
function newWindowWithState(state, callback) {
let opts = "chrome,all,dialog=no,height=800,width=800";
let win = window.openDialog(getBrowserURL(), "_blank", opts);
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
let tab = win.gBrowser.selectedTab;
// The form data will be restored before SSTabRestored, so we want to listen
// for that on the currently selected tab (it will be reused)
tab.addEventListener("SSTabRestored", function onRestored() {
tab.removeEventListener("SSTabRestored", onRestored, true);
callback(win);
}, true);
executeSoon(function () {
ss.setWindowState(win, JSON.stringify(state), true);
});
}, false);
}

Просмотреть файл

@ -186,12 +186,12 @@
<menu id="sp-edit-menu" label="&editMenu.label;"
accesskey="&editMenu.accesskey;">
<menupopup id="sp-menu_editpopup">
<menuitem id="sp-menu_undo"
<menuitem id="sp-menu-undo"
label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"
disabled="true"
oncommand="cmd_undo"/>
command="cmd_undo"/>
<menuitem id="sp-menu-redo"
label="&redoCmd.label;"
key="key_redo"

Просмотреть файл

@ -64,7 +64,7 @@
<!ENTITY enableAddonsUpdate2.label "Add-ons">
<!ENTITY enableAddonsUpdate2.accesskey "n">
<!ENTITY enableSearchUpdate.label "Search Engines">
<!ENTITY enableSearchUpdate.accesskey "h">
<!ENTITY enableSearchUpdate.accesskey "E">
<!ENTITY whenUpdatesFound.label "When updates to &brandShortName; are found:">
<!ENTITY askMe.label "Ask me what I want to do">
<!ENTITY askMe.accesskey "k">

Просмотреть файл

@ -141,10 +141,10 @@
border-right-style: none !important;
}
#toolbar-menubar :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme),
#TabsToolbar[tabsontop=true] :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme),
#navigator-toolbox[tabsontop=false] > #nav-bar :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme),
#nav-bar + #customToolbars + #PersonalToolbar[collapsed=true] + #TabsToolbar[tabsontop=false]:last-child :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme) {
#toolbar-menubar :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme),
#TabsToolbar[tabsontop=true] :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme),
#navigator-toolbox[tabsontop=false] > #nav-bar :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme),
#nav-bar + #customToolbars + #PersonalToolbar[collapsed=true] + #TabsToolbar[tabsontop=false]:last-child :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme) {
list-style-image: url("chrome://browser/skin/Toolbar-inverted.png");
}

Просмотреть файл

@ -674,7 +674,7 @@ menuitem.bookmark-item {
-moz-padding-end: 2px;
}
@navbarLargeIcons@ :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon {
@navbarLargeIcons@ :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon {
list-style-image: url("chrome://browser/skin/Toolbar.png") !important;
}

Просмотреть файл

@ -77,6 +77,12 @@ export:: sqlite-version.h
endif
endif
# XXX Force -O2 optimisation on Mac because using the default -O3 causes
# crashes. See bug 676499.
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
MODULE_OPTIMIZE_FLAGS = -O2
endif
EXPORTS = \
sqlite3.h \
$(NULL)

Просмотреть файл

@ -1351,8 +1351,8 @@ var SelectionHandler = {
this.selectedText = "";
// if this is an iframe, dig down to find the document that was clicked
let x = json.x;
let y = json.y;
let x = json.x - scrollOffset.x;
let y = json.y - scrollOffset.y;
let offset = scrollOffset;
let elem = utils.elementFromPoint(x, y, true, false);
while (elem && (elem instanceof HTMLIFrameElement || elem instanceof HTMLFrameElement)) {
@ -1379,8 +1379,8 @@ var SelectionHandler = {
selection.removeAllRanges();
// Position the caret using a fake mouse click
utils.sendMouseEventToWindow("mousedown", x - scrollOffset.x, y - scrollOffset.y, 0, 1, 0, true);
utils.sendMouseEventToWindow("mouseup", x - scrollOffset.x, y - scrollOffset.y, 0, 1, 0, true);
utils.sendMouseEventToWindow("mousedown", x, y, 0, 1, 0, true);
utils.sendMouseEventToWindow("mouseup", x, y, 0, 1, 0, true);
// Select the word nearest the caret
try {
@ -1423,7 +1423,7 @@ var SelectionHandler = {
try {
// The selection might already be gone
if (this.contentWindow)
this.contentWindow.getSelection().collapseToStart();
this.contentWindow.getSelection().removeAllRanges();
this.contentWindow = null;
} catch(e) {}
@ -1450,19 +1450,24 @@ var SelectionHandler = {
if (elemUnder && elemUnder.ownerDocument.defaultView != this.contentWindow)
return;
// Use fake mouse events to update the selection
if (json.type == "end") {
this.cache.end.x = json.x - scrollOffset.x;
this.cache.end.y = json.y - scrollOffset.y;
utils.sendMouseEventToWindow("mousedown", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
utils.sendMouseEventToWindow("mouseup", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
// Keep the cache in "client" coordinates, but translate for the mouse event
this.cache.end = { x: json.x, y: json.y };
let end = { x: this.cache.end.x - scrollOffset.x, y: this.cache.end.y - scrollOffset.y };
utils.sendMouseEventToWindow("mousedown", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
utils.sendMouseEventToWindow("mouseup", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
} else {
this.cache.start.x = json.x - scrollOffset.x;
this.cache.start.y = json.y - scrollOffset.y;
utils.sendMouseEventToWindow("mousedown", this.cache.start.x, this.cache.start.y, 0, 1, 0, true);
// Don't cause a click. A mousedown is enough to move the caret
//utils.sendMouseEventToWindow("mouseup", this.cache.start.x, this.cache.start.y, 0, 1, 0, true);
utils.sendMouseEventToWindow("mousedown", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
utils.sendMouseEventToWindow("mouseup", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
// Keep the cache in "client" coordinates, but translate for the mouse event
this.cache.start = { x: json.x, y: json.y };
let start = { x: this.cache.start.x - scrollOffset.x, y: this.cache.start.y - scrollOffset.y };
let end = { x: this.cache.end.x - scrollOffset.x, y: this.cache.end.y - scrollOffset.y };
utils.sendMouseEventToWindow("mousedown", start.x, start.y, 0, 0, 0, true);
utils.sendMouseEventToWindow("mouseup", start.x, start.y, 0, 0, 0, true);
utils.sendMouseEventToWindow("mousedown", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
utils.sendMouseEventToWindow("mouseup", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
}
// Cache the selected text since the selection might be gone by the time we get the "end" message
@ -1487,6 +1492,12 @@ var SelectionHandler = {
cache.end.x = rects[i].right + aOffset.x;
cache.end.y = rects[i].bottom + aOffset.y;
}
// Keep the handles from being positioned completely out of the selection range
const HANDLE_VERTICAL_MARGIN = 4;
cache.start.y -= HANDLE_VERTICAL_MARGIN;
cache.end.y -= HANDLE_VERTICAL_MARGIN;
cache.rect = aRange.getBoundingClientRect();
cache.rect.left += aOffset.x;
cache.rect.top += aOffset.y;

Просмотреть файл

@ -227,49 +227,7 @@
</stack>
</xbl:content>
<implementation implements="nsISecurityCheckedComponent">
<!-- nsISecurityCheckedComponent -->
<method name="canCreateWrapper">
<parameter name="aIID"/>
<body>
return "AllAccess";
</body>
</method>
<method name="canCallMethod">
<parameter name="aIID"/>
<parameter name="aMethodName"/>
<body>
return "AllAccess";
</body>
</method>
<method name="canGetProperty">
<parameter name="aIID"/>
<parameter name="aPropertyName"/>
<body>
return "AllAccess";
</body>
</method>
<method name="canSetProperty">
<parameter name="aIID"/>
<parameter name="aPropertyName"/>
<body>
return "AllAccess";
</body>
</method>
<method name="QueryInterface">
<parameter name="aIID"/>
<body>
<![CDATA[
if (!iid.equals(Components.interfaces.nsISecurityCheckedComponent))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
]]>
</body>
</method>
<implementation>
<constructor>
<![CDATA[