From ff139e8ef92505396c51b81e9c00f0ea393c3037 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Wed, 3 Aug 2011 11:09:10 -0700 Subject: [PATCH 01/14] Bug 670341 - about:permissions queries hosts for favicons, r=mak --- .../components/preferences/aboutPermissions.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/browser/components/preferences/aboutPermissions.js b/browser/components/preferences/aboutPermissions.js index c9a9e12aeee2..1299064655fb 100644 --- a/browser/components/preferences/aboutPermissions.js +++ b/browser/components/preferences/aboutPermissions.js @@ -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); }, /** From 8601425c1dc2abd807f5b4ea35d770b885f5d0fa Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Wed, 3 Aug 2011 11:16:09 -0700 Subject: [PATCH 02/14] Bug 625018 - Duplicated access key for search engines entry in update panel, r=gavin --- browser/locales/en-US/chrome/browser/preferences/advanced.dtd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd index 64c8ccbc5464..ba3421e6db15 100644 --- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd +++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd @@ -64,7 +64,7 @@ - + From e25e877eea648d1aec34b345a923bac837a6f1d6 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Wed, 3 Aug 2011 11:19:55 -0700 Subject: [PATCH 03/14] Bug 440098 - Bookmarks opened via "Open All in Tabs" should not replace current tab. r=mak --- browser/components/places/src/PlacesUIUtils.jsm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/browser/components/places/src/PlacesUIUtils.jsm b/browser/components/places/src/PlacesUIUtils.jsm index 544822740929..e9e34d024e4b 100644 --- a/browser/components/places/src/PlacesUIUtils.jsm +++ b/browser/components/places/src/PlacesUIUtils.jsm @@ -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); }, /** From 0d16e3784a6c8d9bffac22c591260bd61d7697fb Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Wed, 3 Aug 2011 11:20:32 -0700 Subject: [PATCH 04/14] Bug 675359 - Follow-up fix for bug 588506: Remove unused code. r=zpao --- .../sessionstore/content/aboutSessionRestore.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/browser/components/sessionstore/content/aboutSessionRestore.js b/browser/components/sessionstore/content/aboutSessionRestore.js index bbbe87b08d17..dc98407a44b1 100644 --- a/browser/components/sessionstore/content/aboutSessionRestore.js +++ b/browser/components/sessionstore/content/aboutSessionRestore.js @@ -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) From 1cdd084ef554ce288daec44b42fc44cf62e26a83 Mon Sep 17 00:00:00 2001 From: Teddy Ni Date: Wed, 3 Aug 2011 16:42:44 -0300 Subject: [PATCH 05/14] Bug 653423 - Undo option is grayed out although action is applicable in Scratchpad; r=rcampbell,gavin.sharp approval-mozilla-aurora=gavin.sharp --- browser/devtools/scratchpad/scratchpad.xul | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/devtools/scratchpad/scratchpad.xul b/browser/devtools/scratchpad/scratchpad.xul index eca6ee9de80e..8ab59a707b7e 100644 --- a/browser/devtools/scratchpad/scratchpad.xul +++ b/browser/devtools/scratchpad/scratchpad.xul @@ -186,12 +186,12 @@ - + command="cmd_undo"/> Date: Wed, 3 Aug 2011 17:52:45 -0700 Subject: [PATCH 06/14] Bug 669217 - Remove nsISecurityCheckedComponent from videocontrols. r=mrbkap --- toolkit/content/widgets/videocontrols.xml | 44 +---------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index 5d78c3841a6f..cbbb04ce1699 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -227,49 +227,7 @@ - - - - - - return "AllAccess"; - - - - - - - - return "AllAccess"; - - - - - - - - return "AllAccess"; - - - - - - - - return "AllAccess"; - - - - - - - - - + Date: Wed, 3 Aug 2011 17:52:47 -0700 Subject: [PATCH 07/14] Remove trailing whitespace from login manager and satchel. b=none --- .../passwordmgr/nsILoginManager.idl | 6 +-- .../passwordmgr/nsILoginManagerPrompter.idl | 2 +- .../passwordmgr/nsILoginManagerStorage.idl | 8 +-- toolkit/components/passwordmgr/nsLoginInfo.js | 2 +- .../components/passwordmgr/nsLoginManager.js | 10 ++-- .../satchel/nsFormFillController.cpp | 50 +++++++++---------- .../components/satchel/nsFormFillController.h | 10 ++-- .../satchel/nsIFormFillController.idl | 2 +- toolkit/components/satchel/nsIFormHistory.idl | 4 +- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/toolkit/components/passwordmgr/nsILoginManager.idl b/toolkit/components/passwordmgr/nsILoginManager.idl index 8b50fd195f32..a15e3997be38 100644 --- a/toolkit/components/passwordmgr/nsILoginManager.idl +++ b/toolkit/components/passwordmgr/nsILoginManager.idl @@ -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, ...); diff --git a/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl b/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl index c3a4a49881f8..a47dfac73123 100644 --- a/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl +++ b/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl @@ -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 diff --git a/toolkit/components/passwordmgr/nsILoginManagerStorage.idl b/toolkit/components/passwordmgr/nsILoginManagerStorage.idl index 1a24dab707ba..fa47721ab1a8 100644 --- a/toolkit/components/passwordmgr/nsILoginManagerStorage.idl +++ b/toolkit/components/passwordmgr/nsILoginManagerStorage.idl @@ -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, ...); diff --git a/toolkit/components/passwordmgr/nsLoginInfo.js b/toolkit/components/passwordmgr/nsLoginInfo.js index f771ad458735..3519affd200f 100644 --- a/toolkit/components/passwordmgr/nsLoginInfo.js +++ b/toolkit/components/passwordmgr/nsLoginInfo.js @@ -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. diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/nsLoginManager.js index 30aef10e3001..78ca963cc338 100644 --- a/toolkit/components/passwordmgr/nsLoginManager.js +++ b/toolkit/components/passwordmgr/nsLoginManager.js @@ -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); diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index 8ccc5058a966..09a9a83ae4d6 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -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 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 docShell; mDocShells->GetElementAt(index, getter_AddRefs(docShell)); nsCOMPtr 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 target; aEvent->GetTarget(getter_AddRefs(target)); - + nsCOMPtr 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 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 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 parentShell = do_QueryInterface(parentItem); return GetIndexOfDocShell(parentShell); } - + return -1; } diff --git a/toolkit/components/satchel/nsFormFillController.h b/toolkit/components/satchel/nsFormFillController.h index 173e3b9d4f49..dd3ae5d38728 100644 --- a/toolkit/components/satchel/nsFormFillController.h +++ b/toolkit/components/satchel/nsFormFillController.h @@ -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; diff --git a/toolkit/components/satchel/nsIFormFillController.idl b/toolkit/components/satchel/nsIFormFillController.idl index 4f4d5b2217b6..ba3f85587880 100644 --- a/toolkit/components/satchel/nsIFormFillController.idl +++ b/toolkit/components/satchel/nsIFormFillController.idl @@ -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 * diff --git a/toolkit/components/satchel/nsIFormHistory.idl b/toolkit/components/satchel/nsIFormHistory.idl index 42de14536a85..b17d7410309b 100644 --- a/toolkit/components/satchel/nsIFormHistory.idl +++ b/toolkit/components/satchel/nsIFormHistory.idl @@ -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. */ From 61f4f2941724bf020981fa7e6540e31c8ddd2dfc Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Thu, 4 Aug 2011 03:49:38 +0200 Subject: [PATCH 08/14] Bug 651643 - Private browsing service executes transition even when no mode switch required; r=ehsan,zpao --- browser/base/content/tabview/ui.js | 3 +- .../browser_tabview_privatebrowsing.js | 2 + .../src/nsPrivateBrowsingService.js | 54 ++++++++------- .../test/browser/browser_588426.js | 34 ++++++--- .../test/browser/browser_590563.js | 69 +++++++++++-------- 5 files changed, 98 insertions(+), 64 deletions(-) diff --git a/browser/base/content/tabview/ui.js b/browser/base/content/tabview/ui.js index ed2740ac5985..d9e18083bd0a 100644 --- a/browser/base/content/tabview/ui.js +++ b/browser/base/content/tabview/ui.js @@ -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); diff --git a/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js b/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js index a6f6ae278617..aae8979f1497 100644 --- a/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js +++ b/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js @@ -103,6 +103,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(); }); }); diff --git a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js index 42fdf81d1906..484482f24b13 100644 --- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js +++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js @@ -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. diff --git a/browser/components/sessionstore/test/browser/browser_588426.js b/browser/components/sessionstore/test/browser/browser_588426.js index 1e414e5f2821..fc9146e72657 100644 --- a/browser/components/sessionstore/test/browser/browser_588426.js +++ b/browser/components/sessionstore/test/browser/browser_588426.js @@ -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); +} diff --git a/browser/components/sessionstore/test/browser/browser_590563.js b/browser/components/sessionstore/test/browser/browser_590563.js index c30c901da935..1fefc4c63d6f 100644 --- a/browser/components/sessionstore/test/browser/browser_590563.js +++ b/browser/components/sessionstore/test/browser/browser_590563.js @@ -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); } From 9abc15c2e5d20074c62d896900bb42f5d1c298fa Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Thu, 4 Aug 2011 03:49:43 +0200 Subject: [PATCH 09/14] Bug 666475 - Intermittent browser_tabview_privatebrowsing.js | Test timed out; r=ehsan --- .../browser_tabview_privatebrowsing.js | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js b/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js index aae8979f1497..4160fd1c5907 100644 --- a/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js +++ b/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js @@ -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); }); }); }); - }); + }); }); } From ad6520ab667a3316291316aaebe56915e7b34dd4 Mon Sep 17 00:00:00 2001 From: Joshua M Date: Thu, 4 Aug 2011 13:50:12 +0200 Subject: [PATCH 10/14] Bug 673164 - Sync button in tab bar changes to Back button while syncing. r=dao --- browser/themes/winstripe/browser/browser-aero.css | 8 ++++---- browser/themes/winstripe/browser/browser.css | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/browser/themes/winstripe/browser/browser-aero.css b/browser/themes/winstripe/browser/browser-aero.css index 8cd0b7e2272b..58774e42f0e0 100644 --- a/browser/themes/winstripe/browser/browser-aero.css +++ b/browser/themes/winstripe/browser/browser-aero.css @@ -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"); } diff --git a/browser/themes/winstripe/browser/browser.css b/browser/themes/winstripe/browser/browser.css index 87ebad77ed67..809757318462 100644 --- a/browser/themes/winstripe/browser/browser.css +++ b/browser/themes/winstripe/browser/browser.css @@ -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; } From 1da3bff21393c9820ebd052b27ba71c79d411f0d Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Thu, 4 Aug 2011 14:27:30 +0200 Subject: [PATCH 11/14] back out 6458c6116c97 (pushed with the wrong bug number) --- browser/components/places/src/PlacesUIUtils.jsm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/browser/components/places/src/PlacesUIUtils.jsm b/browser/components/places/src/PlacesUIUtils.jsm index e9e34d024e4b..544822740929 100644 --- a/browser/components/places/src/PlacesUIUtils.jsm +++ b/browser/components/places/src/PlacesUIUtils.jsm @@ -812,10 +812,8 @@ var PlacesUIUtils = { } var loadInBackground = where == "tabshifted" ? true : false; - // 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); + var replaceCurrentTab = where == "tab" ? false : true; + browserWindow.gBrowser.loadTabs(urls, loadInBackground, replaceCurrentTab); }, /** From b25428c77bbab34c9a11dddd81ec0acaaf1e9e34 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Thu, 4 Aug 2011 14:34:02 +0200 Subject: [PATCH 12/14] Bug 440093 - Bookmarks opened via "Open All in Tabs" should not replace current tab. r=mak --- browser/components/places/src/PlacesUIUtils.jsm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/browser/components/places/src/PlacesUIUtils.jsm b/browser/components/places/src/PlacesUIUtils.jsm index 544822740929..e9e34d024e4b 100644 --- a/browser/components/places/src/PlacesUIUtils.jsm +++ b/browser/components/places/src/PlacesUIUtils.jsm @@ -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); }, /** From 2fcee5861236742b45230b761469a2e93f77e4b9 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 4 Aug 2011 14:50:41 +0100 Subject: [PATCH 13/14] Bug 676499 - Mac 64 bit crash [@ fts3SegReaderNext] in Thunderbird's gloda tests following change to optimisation levels in sqlite - switch Mac back to -O2 optimisation for sqlite for now; r=glandium --- db/sqlite3/src/Makefile.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/sqlite3/src/Makefile.in b/db/sqlite3/src/Makefile.in index b1cbce468932..c1f0f853cbbd 100644 --- a/db/sqlite3/src/Makefile.in +++ b/db/sqlite3/src/Makefile.in @@ -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) From 1983ce77e0b5edbce05e7df24df01c4ababd5335 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Thu, 4 Aug 2011 15:26:42 -0400 Subject: [PATCH 14/14] Bug 674791 - dragging the left text selection marker down selects to the bottom of the page [r=wjohnston] --- mobile/chrome/content/content.js | 43 ++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js index b6a6f981143d..ed9af7b1e960 100644 --- a/mobile/chrome/content/content.js +++ b/mobile/chrome/content/content.js @@ -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;