author | Dão Gottwald <dao@mozilla.com> |
Sat, 12 Feb 2011 11:57:29 +0100 | |
changeset 62467 | 14cb959af2458bfeb2f8578546f167067ed82245 |
parent 62465 | 19f13dea4d4a9a9506ac72f2a9d1c1c7409b9365 (current diff) |
parent 62466 | c9331bfef5b6fd724c97538b2b3fe69a1d1be7b7 (diff) |
child 62468 | 95feb77222f25837b34267bb51da9b662b92ffa4 |
push id | 18732 |
push user | dgottwald@mozilla.com |
push date | Sat, 12 Feb 2011 10:58:05 +0000 |
treeherder | mozilla-central@14cb959af245 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
milestone | 2.0b12pre |
first release with | nightly win64
14cb959af245
/
4.0b12pre
/
20110212030202
/
files
nightly linux32
nightly linux64
nightly mac
nightly win32
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly win64
4.0b12pre
/
20110212030202
/
pushlog to previous
|
--- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -103,16 +103,23 @@ command="cmd_printPreview"/> #endif <menuitem id="menu_print" label="&printCmd.label;" accesskey="&printCmd.accesskey;" key="printKb" command="cmd_print"/> <menuseparator/> + <menuitem id="menu_import" + label="&import.label;" + accesskey="&import.accesskey;" + oncommand="BrowserImport();"/> +#ifndef XP_MACOSX + <menuseparator/> +#endif #endif <menuitem id="goOfflineMenuitem" label="&goOfflineCmd.label;" accesskey="&goOfflineCmd.accesskey;" type="checkbox" observes="workOfflineMenuitemState" oncommand="BrowserOffline.toggleOfflineStatus();"/> <menuitem id="menu_FileQuitItem"
--- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2548,16 +2548,34 @@ function PageProxyClearIcon () } function PageProxyClickHandler(aEvent) { if (aEvent.button == 1 && gPrefService.getBoolPref("middlemouse.paste")) middleMousePaste(aEvent); } +function BrowserImport() +{ +#ifdef XP_MACOSX + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + var win = wm.getMostRecentWindow("Browser:MigrationWizard"); + if (win) + win.focus(); + else { + window.openDialog("chrome://browser/content/migration/migration.xul", + "migration", "centerscreen,chrome,resizable=no"); + } +#else + window.openDialog("chrome://browser/content/migration/migration.xul", + "migration", "modal,centerscreen,chrome,resizable=no"); +#endif +} + /** * Handle load of some pages (about:*) so that we can make modifications * to the DOM for unprivileged pages. */ function BrowserOnAboutPageLoad(document) { if (/^about:home$/i.test(document.documentURI)) { let ss = Components.classes["@mozilla.org/browser/sessionstore;1"]. getService(Components.interfaces.nsISessionStore); @@ -8050,16 +8068,18 @@ let gPrivateBrowsingUI = { if (BrowserSearch.searchBar) this._searchBarValue = BrowserSearch.searchBar.textbox.value; if (gFindBarInitialized) this._findBarValue = gFindBar.getElement("findbar-textbox").value; this._setPBMenuTitle("stop"); + document.getElementById("menu_import").setAttribute("disabled", "true"); + // Disable the Clear Recent History... menu item when in PB mode // temporary fix until bug 463607 is fixed document.getElementById("Tools:Sanitize").setAttribute("disabled", "true"); let docElement = document.documentElement; if (this._privateBrowsingService.autoStarted) { // Disable the menu item in auto-start mode document.getElementById("privateBrowsingItem") @@ -8097,16 +8117,18 @@ let gPrivateBrowsingUI = { this._searchBarValue = null; } } if (gURLBar) { gURLBar.editor.transactionManager.clear(); } + document.getElementById("menu_import").removeAttribute("disabled"); + // Re-enable the Clear Recent History... menu item on exit of PB mode // temporary fix until bug 463607 is fixed document.getElementById("Tools:Sanitize").removeAttribute("disabled"); if (gFindBarInitialized) { let findbox = gFindBar.getElement("findbar-textbox"); findbox.reset(); if (this._findBarValue) {
--- a/browser/components/places/content/places.js +++ b/browser/components/places/content/places.js @@ -359,34 +359,29 @@ var PlacesOrganizer = { * Returns the queries associated with the query currently loaded in the * main places pane. */ getCurrentQueries: function PO_getCurrentQueries() { return PlacesUtils.asQuery(this._content.result.root).getQueries(); }, /** - * Show the migration wizard for importing passwords, - cookies, history, preferences, and bookmarks. + * Show the migration wizard for importing from a file. */ - browserImport: function PO_browserImport() { -#ifdef XP_MACOSX - var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - .getService(Ci.nsIWindowMediator); - var win = wm.getMostRecentWindow("Browser:MigrationWizard"); - if (win) - win.focus(); - else { - window.openDialog("chrome://browser/content/migration/migration.xul", - "migration", "centerscreen,chrome,resizable=no"); - } -#else - window.openDialog("chrome://browser/content/migration/migration.xul", - "migration", "modal,centerscreen,chrome,resizable=no"); -#endif + importBookmarks: function PO_import() { + // XXX: ifdef it to be non-modal (non-"sheet") on mac (see bug 259039) + var features = "modal,centerscreen,chrome,resizable=no"; + + // The migrator window will set this to true when it closes, if the user + // chose to migrate from a specific file. + window.fromFile = false; + openDialog("chrome://browser/content/migration/migration.xul", + "migration", features, "bookmarks"); + if (window.fromFile) + this.importFromFile(); }, /** * Open a file-picker and import the selected file into the bookmarks store */ importFromFile: function PO_importFromFile() { var fp = Cc["@mozilla.org/filepicker;1"]. createInstance(Ci.nsIFilePicker);
--- a/browser/components/places/content/places.xul +++ b/browser/components/places/content/places.xul @@ -104,19 +104,17 @@ oncommand="PlacesSearchBox.findAll();"/> <command id="OrganizerCommand_find:current" label="&cmd.findCurrent.label;" accesskey="&cmd.findCurrent.accesskey;" oncommand="PlacesSearchBox.findCurrent();"/> <command id="OrganizerCommand_export" oncommand="PlacesOrganizer.exportBookmarks();"/> <command id="OrganizerCommand_import" - oncommand="PlacesOrganizer.importFromFile();"/> - <command id="OrganizerCommand_browserImport" - oncommand="PlacesOrganizer.browserImport();"/> + oncommand="PlacesOrganizer.importBookmarks();"/> <command id="OrganizerCommand_backup" oncommand="PlacesOrganizer.backupBookmarks();"/> <command id="OrganizerCommand_restoreFromFile" oncommand="PlacesOrganizer.onRestoreBookmarksFromFile();"/> <command id="OrganizerCommand_search:save" oncommand="PlacesOrganizer.saveSearch();"/> <command id="OrganizerCommand_search:moreCriteria" oncommand="PlacesQueryBuilder.addRow();"/> @@ -344,21 +342,16 @@ <menuitem id="fileImport" command="OrganizerCommand_import" label="&cmd.importHTML.label;" accesskey="&cmd.importHTML.accesskey;"/> <menuitem id="fileExport" command="OrganizerCommand_export" label="&cmd.exportHTML.label;" accesskey="&cmd.exportHTML.accesskey;"/> - <menuseparator/> - <menuitem id="browserImport" - command="OrganizerCommand_browserImport" - label="&import.label;" - accesskey="&import.accesskey;"/> </menupopup> #ifdef XP_MACOSX </toolbarbutton> #else </menu> </menubar> #endif
--- a/browser/components/privatebrowsing/test/browser/Makefile.in +++ b/browser/components/privatebrowsing/test/browser/Makefile.in @@ -50,16 +50,17 @@ include $(topsrcdir)/config/rules.mk browser_privatebrowsing_certexceptionsui.js \ browser_privatebrowsing_commandline_toggle.js \ browser_privatebrowsing_crh.js \ browser_privatebrowsing_fastswitch.js \ browser_privatebrowsing_findbar.js \ browser_privatebrowsing_forgetthissite.js \ browser_privatebrowsing_geoprompt.js \ browser_privatebrowsing_geoprompt_page.html \ + browser_privatebrowsing_import.js \ browser_privatebrowsing_newwindow_stopcmd.js \ browser_privatebrowsing_opendir.js \ browser_privatebrowsing_openlocation.js \ browser_privatebrowsing_pageinfo.js \ browser_privatebrowsing_placestitle.js \ browser_privatebrowsing_popupblocker.js \ browser_privatebrowsing_popupmode.js \ browser_privatebrowsing_protocolhandler.js \
new file mode 100644 --- /dev/null +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_import.js @@ -0,0 +1,67 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Private Browsing Tests. + * + * The Initial Developer of the Original Code is + * Ehsan Akhgari. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// This test makes sure that the File->Import menu item is disabled inside the +// private browsing mode. + +function test() { + // initialization + gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true); + let pb = Cc["@mozilla.org/privatebrowsing;1"]. + getService(Ci.nsIPrivateBrowsingService); + + let importMenuItem = document.getElementById("menu_import"); + + // make sure the menu item is not disabled to begin with + ok(!importMenuItem.hasAttribute("disabled"), + "File->Import menu item should not be disabled outside of the private browsing mode"); + + // enter private browsing mode + pb.privateBrowsingEnabled = true; + + ok(importMenuItem.hasAttribute("disabled"), + "File->Import menu item should be disabled inside of the private browsing mode"); + + // leave private browsing mode + pb.privateBrowsingEnabled = false; + + ok(!importMenuItem.hasAttribute("disabled"), + "File->Import menu item should not be disabled after leaving the private browsing mode"); + + // cleanup + gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session"); +}