зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central and mozilla-inbound in the hope to reopen soon a CLOSED TREE
This commit is contained in:
Коммит
382a5d28c4
|
@ -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,40 +50,37 @@ 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;
|
||||
|
|
|
@ -114,7 +114,7 @@ interface nsILoginManager : nsISupports {
|
|||
* The number of elements in the array. JS callers can simply use
|
||||
* the array's .length property and omit this param.
|
||||
* @param logins
|
||||
* An array of nsILoginInfo objects.
|
||||
* An array of nsILoginInfo objects.
|
||||
*
|
||||
* NOTE: This can be called from JS as:
|
||||
* var logins = pwmgr.getAllLogins();
|
||||
|
@ -123,7 +123,7 @@ interface nsILoginManager : nsISupports {
|
|||
void getAllLogins([optional] out unsigned long count,
|
||||
[retval, array, size_is(count)] out nsILoginInfo logins);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a list of all hosts for which password saving is disabled.
|
||||
*
|
||||
|
@ -190,7 +190,7 @@ interface nsILoginManager : nsISupports {
|
|||
* specify null.
|
||||
* An empty string ("") will match any value (except null).
|
||||
* @param logins
|
||||
* An array of nsILoginInfo objects.
|
||||
* An array of nsILoginInfo objects.
|
||||
*
|
||||
* NOTE: This can be called from JS as:
|
||||
* var logins = pwmgr.findLogins({}, hostname, ...);
|
||||
|
|
|
@ -85,7 +85,7 @@ interface nsILoginManagerPrompter : nsISupports {
|
|||
* @param count
|
||||
* (length of the array)
|
||||
* @param aNewLogin
|
||||
* The new login.
|
||||
* The new login.
|
||||
*
|
||||
* Note: Because the caller does not know the username of the login
|
||||
* to be changed, aNewLogin.username and aNewLogin.usernameField
|
||||
|
|
|
@ -68,7 +68,7 @@ interface nsILoginManagerStorage : nsISupports {
|
|||
* If non-null, file to output logins to.
|
||||
*
|
||||
*/
|
||||
void initWithFile(in nsIFile aInputFile, in nsIFile aOutputFile);
|
||||
void initWithFile(in nsIFile aInputFile, in nsIFile aOutputFile);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -137,7 +137,7 @@ interface nsILoginManagerStorage : nsISupports {
|
|||
* The number of elements in the array. JS callers can simply use
|
||||
* the array's .length property and omit this param.
|
||||
* @param logins
|
||||
* An array of nsILoginInfo objects.
|
||||
* An array of nsILoginInfo objects.
|
||||
*
|
||||
* NOTE: This can be called from JS as:
|
||||
* var logins = pwmgr.getAllLogins();
|
||||
|
@ -156,7 +156,7 @@ interface nsILoginManagerStorage : nsISupports {
|
|||
* The number of elements in the array. JS callers can simply use
|
||||
* the array's .length property and omit this param.
|
||||
* @param logins
|
||||
* An array of nsILoginInfo objects.
|
||||
* An array of nsILoginInfo objects.
|
||||
*
|
||||
* NOTE: This can be called from JS as:
|
||||
* var logins = pwmgr.getAllEncryptedLogins();
|
||||
|
@ -251,7 +251,7 @@ interface nsILoginManagerStorage : nsISupports {
|
|||
* WWW-Authenticate header. See RFC2617. For form logins,
|
||||
* specify null.
|
||||
* @param logins
|
||||
* An array of nsILoginInfo objects.
|
||||
* An array of nsILoginInfo objects.
|
||||
*
|
||||
* NOTE: This can be called from JS as:
|
||||
* var logins = pwmgr.findLogins({}, hostname, ...);
|
||||
|
|
|
@ -45,7 +45,7 @@ function nsLoginInfo() {}
|
|||
nsLoginInfo.prototype = {
|
||||
|
||||
classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
|
||||
|
||||
// Allow storage-Legacy.js to get at the JS object so it can
|
||||
// slap on a few extra properties for internal use.
|
||||
|
|
|
@ -206,7 +206,7 @@ LoginManager.prototype = {
|
|||
_observer : {
|
||||
_pwmgr : null,
|
||||
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
Ci.nsIFormSubmitObserver,
|
||||
Ci.nsISupportsWeakReference]),
|
||||
|
||||
|
@ -235,7 +235,7 @@ LoginManager.prototype = {
|
|||
this._pwmgr.log("got change to " + prefName + " preference");
|
||||
|
||||
if (prefName == "debug") {
|
||||
this._pwmgr._debug =
|
||||
this._pwmgr._debug =
|
||||
this._pwmgr._prefBranch.getBoolPref("debug");
|
||||
} else if (prefName == "rememberSignons") {
|
||||
this._pwmgr._remember =
|
||||
|
@ -718,7 +718,7 @@ LoginManager.prototype = {
|
|||
// Locate the username field in the form by searching backwards
|
||||
// from the first passwordfield, assume the first text field is the
|
||||
// username. We might not find a username field if the user is
|
||||
// already logged in to the site.
|
||||
// already logged in to the site.
|
||||
for (var i = pwFields[0].index - 1; i >= 0; i--) {
|
||||
var element = form.elements[i];
|
||||
var fieldType = (element.hasAttribute("type") ?
|
||||
|
@ -916,7 +916,7 @@ LoginManager.prototype = {
|
|||
// if the passwords differ.
|
||||
if (!login.username && formLogin.username) {
|
||||
var restoreMe = formLogin.username;
|
||||
formLogin.username = "";
|
||||
formLogin.username = "";
|
||||
same = formLogin.matches(login, false);
|
||||
formLogin.username = restoreMe;
|
||||
} else if (!formLogin.username && login.username) {
|
||||
|
@ -1112,7 +1112,7 @@ LoginManager.prototype = {
|
|||
|
||||
// Need to get a list of logins if we weren't given them
|
||||
if (foundLogins == null) {
|
||||
var formOrigin =
|
||||
var formOrigin =
|
||||
this._getPasswordOrigin(form.ownerDocument.documentURI);
|
||||
var actionOrigin = this._getActionOrigin(form);
|
||||
foundLogins = this.findLogins({}, formOrigin, actionOrigin, null);
|
||||
|
|
|
@ -83,7 +83,7 @@ nsFormFillController::nsFormFillController() :
|
|||
mTimeout(50),
|
||||
mMinResultsForPopup(1),
|
||||
mMaxRows(0),
|
||||
mDisableAutoComplete(PR_FALSE),
|
||||
mDisableAutoComplete(PR_FALSE),
|
||||
mCompleteDefaultIndex(PR_FALSE),
|
||||
mCompleteSelectedIndex(PR_FALSE),
|
||||
mForceComplete(PR_FALSE),
|
||||
|
@ -188,10 +188,10 @@ NS_IMETHODIMP
|
|||
nsFormFillController::AttachToBrowser(nsIDocShell *aDocShell, nsIAutoCompletePopup *aPopup)
|
||||
{
|
||||
NS_ENSURE_TRUE(aDocShell && aPopup, NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
|
||||
mDocShells->AppendElement(aDocShell);
|
||||
mPopups->AppendElement(aPopup);
|
||||
|
||||
|
||||
// Listen for focus events on the domWindow of the docShell
|
||||
nsCOMPtr<nsIDOMWindow> domWindow = GetWindowForDocShell(aDocShell);
|
||||
AddWindowListeners(domWindow);
|
||||
|
@ -204,16 +204,16 @@ nsFormFillController::DetachFromBrowser(nsIDocShell *aDocShell)
|
|||
{
|
||||
PRInt32 index = GetIndexOfDocShell(aDocShell);
|
||||
NS_ENSURE_TRUE(index >= 0, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
// Stop listening for focus events on the domWindow of the docShell
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
mDocShells->GetElementAt(index, getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsIDOMWindow> domWindow = GetWindowForDocShell(docShell);
|
||||
RemoveWindowListeners(domWindow);
|
||||
|
||||
|
||||
mDocShells->RemoveElementAt(index);
|
||||
mPopups->RemoveElementAt(index);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -424,13 +424,13 @@ nsFormFillController::GetSearchParam(nsAString &aSearchParam)
|
|||
{
|
||||
if (!mFocusedInput) {
|
||||
NS_WARNING("mFocusedInput is null for some reason! avoiding a crash. should find out why... - ben");
|
||||
return NS_ERROR_FAILURE; // XXX why? fix me.
|
||||
return NS_ERROR_FAILURE; // XXX why? fix me.
|
||||
}
|
||||
|
||||
|
||||
mFocusedInput->GetName(aSearchParam);
|
||||
if (aSearchParam.IsEmpty())
|
||||
mFocusedInput->GetId(aSearchParam);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -612,8 +612,8 @@ nsFormFillController::StartSearch(const nsAString &aSearchString, const nsAStrin
|
|||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aListener->OnSearchResult(this, result);
|
||||
|
||||
aListener->OnSearchResult(this, result);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ nsFormFillController::HandleEvent(nsIDOMEvent* aEvent)
|
|||
mPwmgrInputs.Enumerate(RemoveForDOMDocumentEnumerator, domDoc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -751,7 +751,7 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent)
|
|||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aEvent->GetTarget(getter_AddRefs(target));
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(target);
|
||||
if (!input)
|
||||
return NS_OK;
|
||||
|
@ -772,19 +772,19 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent)
|
|||
!isReadOnly || isPwmgrInput) {
|
||||
StartControllingInput(input);
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
PRBool
|
||||
nsFormFillController::IsInputAutoCompleteOff()
|
||||
{
|
||||
PRBool autoCompleteOff = PR_FALSE;
|
||||
|
||||
if (mFocusedInput) {
|
||||
nsAutoString autocomplete;
|
||||
nsAutoString autocomplete;
|
||||
mFocusedInput->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
|
||||
|
||||
|
||||
// Check the input for autocomplete="off", then the form
|
||||
if (autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
autoCompleteOff = PR_TRUE;
|
||||
|
@ -866,11 +866,11 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
|
|||
mController->HandleEnter(PR_FALSE, &cancel);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (cancel) {
|
||||
aEvent->PreventDefault();
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -963,7 +963,7 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
|
|||
return;
|
||||
|
||||
StopControllingInput();
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
mPwmgrInputs.Enumerate(RemoveForDOMDocumentEnumerator, domDoc);
|
||||
|
@ -972,7 +972,7 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
|
|||
nsIDOMEventTarget* target = nsnull;
|
||||
if (privateDOMWindow)
|
||||
target = privateDOMWindow->GetChromeEventHandler();
|
||||
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
|
@ -1014,17 +1014,17 @@ void
|
|||
nsFormFillController::StartControllingInput(nsIDOMHTMLInputElement *aInput)
|
||||
{
|
||||
// Make sure we're not still attached to an input
|
||||
StopControllingInput();
|
||||
StopControllingInput();
|
||||
|
||||
// Find the currently focused docShell
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellForInput(aInput);
|
||||
PRInt32 index = GetIndexOfDocShell(docShell);
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
|
||||
// Cache the popup for the focused docShell
|
||||
mPopups->GetElementAt(index, getter_AddRefs(mFocusedPopup));
|
||||
|
||||
|
||||
AddKeyListener(aInput);
|
||||
mFocusedInput = aInput;
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ nsFormFillController::GetIndexOfDocShell(nsIDocShell *aDocShell)
|
|||
nsCOMPtr<nsIDocShell> parentShell = do_QueryInterface(parentItem);
|
||||
return GetIndexOfDocShell(parentShell);
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,16 +81,16 @@ public:
|
|||
protected:
|
||||
void AddWindowListeners(nsIDOMWindow *aWindow);
|
||||
void RemoveWindowListeners(nsIDOMWindow *aWindow);
|
||||
|
||||
|
||||
void AddKeyListener(nsIDOMHTMLInputElement *aInput);
|
||||
void RemoveKeyListener();
|
||||
|
||||
|
||||
void StartControllingInput(nsIDOMHTMLInputElement *aInput);
|
||||
void StopControllingInput();
|
||||
|
||||
|
||||
void RevalidateDataList();
|
||||
PRBool RowMatch(nsFormHistory *aHistory, PRUint32 aIndex, const nsAString &aInputName, const nsAString &aInputValue);
|
||||
|
||||
|
||||
inline nsIDocShell *GetDocShellForInput(nsIDOMHTMLInputElement *aInput);
|
||||
inline nsIDOMWindow *GetWindowForDocShell(nsIDocShell *aDocShell);
|
||||
inline PRInt32 GetIndexOfDocShell(nsIDocShell *aDocShell);
|
||||
|
@ -120,7 +120,7 @@ protected:
|
|||
PRUint32 mTimeout;
|
||||
PRUint32 mMinResultsForPopup;
|
||||
PRUint32 mMaxRows;
|
||||
PRPackedBool mDisableAutoComplete;
|
||||
PRPackedBool mDisableAutoComplete;
|
||||
PRPackedBool mCompleteDefaultIndex;
|
||||
PRPackedBool mCompleteSelectedIndex;
|
||||
PRPackedBool mForceComplete;
|
||||
|
|
|
@ -60,7 +60,7 @@ interface nsIFormFillController : nsISupports
|
|||
* @param popup - The popup to show when autocomplete results are available
|
||||
*/
|
||||
void attachToBrowser(in nsIDocShell docShell, in nsIAutoCompletePopup popup);
|
||||
|
||||
|
||||
/*
|
||||
* Stop controlling form fill behavior for the given browser
|
||||
*
|
||||
|
|
|
@ -57,7 +57,7 @@ interface nsIFormHistory2 : nsISupports
|
|||
* Returns true if the form history has any entries.
|
||||
*/
|
||||
readonly attribute boolean hasEntries;
|
||||
|
||||
|
||||
/**
|
||||
* Adds a name and value pair to the form history.
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ interface nsIFormHistory2 : nsISupports
|
|||
* Removes all entries that are paired with a name.
|
||||
*/
|
||||
void removeEntriesForName(in AString name);
|
||||
|
||||
|
||||
/**
|
||||
* Removes all entries in the entire form history.
|
||||
*/
|
||||
|
|
|
@ -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[
|
||||
|
|
Загрузка…
Ссылка в новой задаче