зеркало из https://github.com/mozilla/pjs.git
bug 304403 - better safe mode UE, part 1, a=chase
This commit is contained in:
Родитель
735566c607
Коммит
b06d2b9634
|
@ -919,6 +919,11 @@ function delayedStartup()
|
|||
}
|
||||
|
||||
FeedHandler.init();
|
||||
|
||||
var app = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo)
|
||||
.QueryInterface(Components.interfaces.nsIXULRuntime);
|
||||
if (app.inSafeMode)
|
||||
window.openDialog("chrome://browser/content/safeMode.xul", "_blank", "chrome,centerscreen,dependent,resizable=no");
|
||||
}
|
||||
|
||||
function BrowserShutdown()
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# 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 mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mike Connor.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mike Connor <mconnor@steelgryphon.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either 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 *****
|
||||
|
||||
|
||||
function restartApp() {
|
||||
var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(Components.interfaces.nsIAppStartup);
|
||||
appStartup.quit(appStartup.eAttemptQuit | appStartup.eRestart);
|
||||
}
|
||||
|
||||
function clearAllPrefs() {
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
prefService.resetUserPrefs();
|
||||
}
|
||||
|
||||
function restoreDefaultBookmarks() {
|
||||
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
prefBranch.setBoolPref("browser.bookmarks.restore_default_bookmarks", true);
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
if (document.getElementById("resetUserPrefs").checked)
|
||||
clearAllPrefs();
|
||||
|
||||
if (document.getElementById("resetBookmarks").checked)
|
||||
restoreDefaultBookmarks();
|
||||
|
||||
restartApp();
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# 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 mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mike Connor.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mike Connor <mconnor@steelgryphon.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either 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 *****
|
||||
|
||||
<!DOCTYPE prefwindow [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % safeModeDTD SYSTEM "chrome://browser/locale/safeMode.dtd" >
|
||||
%safeModeDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
|
||||
<dialog id="safeModeDialog"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&safeModeDialog.title;"
|
||||
buttons="accept,cancel"
|
||||
buttonlabelaccept="&changeAndRestartButton.label;"
|
||||
buttonlabelcancel="&continueButton.label;"
|
||||
width="&window.width;"
|
||||
ondialogaccept="onOK()">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/safeMode.js"/>
|
||||
|
||||
<stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
|
||||
<description>&safeModeDescription.label;</description>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<label value="&safeModeDescription2.label;"/>
|
||||
<vbox>
|
||||
<checkbox id="disableThemes" label="&disableThemes.label;" accesskey="&disableThemes.accesskey;" disabled="true"/>
|
||||
<checkbox id="resetToolbars" label="&resetToolbars.label;" accesskey="&resetToolbars.accesskey;" disabled="true"/>
|
||||
<checkbox id="resetBookmarks" label="&resetBookmarks.label;" accesskey="&resetBookmarks.accesskey;"/>
|
||||
<checkbox id="resetUserPrefs" label="&resetUserPrefs.label;" accesskey="&resetUserPrefs.accesskey;"/>
|
||||
</vbox>
|
||||
|
||||
<separator class="thin"/>
|
||||
</dialog>
|
|
@ -28,6 +28,8 @@ browser.jar:
|
|||
* content/browser/pageReport.js (content/pageReport.js)
|
||||
* content/browser/pageReport.xul (content/pageReport.xul)
|
||||
* content/browser/pageReportFirstTime.xul (content/pageReportFirstTime.xul)
|
||||
* content/browser/safeMode.js (content/safeMode.js)
|
||||
* content/browser/safeMode.xul (content/safeMode.xul)
|
||||
* content/browser/sanitize.js (content/sanitize.js)
|
||||
* content/browser/sanitize.xul (content/sanitize.xul)
|
||||
* content/browser/search.xml (content/search.xml)
|
||||
|
|
|
@ -4473,6 +4473,39 @@ nsBookmarksService::LoadBookmarks()
|
|||
// Lack of Bookmarks file is non-fatal
|
||||
if (NS_FAILED(rv)) return NS_OK;
|
||||
|
||||
PRBool restoreDefaultBookmarks = PR_FALSE;
|
||||
if (mBookmarksPrefs)
|
||||
mBookmarksPrefs->GetBoolPref("restore_default_bookmarks", &restoreDefaultBookmarks);
|
||||
|
||||
if (restoreDefaultBookmarks)
|
||||
{
|
||||
nsCOMPtr<nsIFile> defaults;
|
||||
rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR,
|
||||
getter_AddRefs(defaults));
|
||||
nsDependentCString leafStr("bookmarks.html");
|
||||
defaults->AppendNative(leafStr);
|
||||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
|
||||
getter_AddRefs(profileDir));
|
||||
|
||||
nsDependentCString backupFilename("bookmarks-backup.html");
|
||||
PRBool exists;
|
||||
bookmarksFile->Exists(&exists);
|
||||
if (exists) {
|
||||
bookmarksFile->CopyToNative(nsnull, backupFilename);
|
||||
bookmarksFile->Remove(PR_FALSE);
|
||||
}
|
||||
|
||||
defaults->CopyToNative(profileDir, leafStr);
|
||||
|
||||
bookmarksFile->Exists(&exists);
|
||||
if (!exists)
|
||||
return NS_OK;
|
||||
|
||||
mBookmarksPrefs->SetBoolPref("restore_default_bookmarks", PR_FALSE);
|
||||
}
|
||||
|
||||
PRBool foundIERoot = PR_FALSE;
|
||||
|
||||
#ifdef DEBUG_varga
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
#if 0
|
||||
- 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 mozilla.org Code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Mike Connor.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Mike Connor <mconnor@steelgryphon.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either 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 LGPL or the GPL. 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.
|
||||
-
|
||||
#endif
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!ENTITY safeModeDialog.title "&brandShortName; Safe Mode">
|
||||
<!ENTITY window.width "37em">
|
||||
|
||||
<!ENTITY safeModeDescription.label "&brandShortName; is now running in Safe Mode, which temporarily disables your custom settings, themes, and extensions.">
|
||||
<!ENTITY safeModeDescription2.label "You can make some or all of these changes permanent:">
|
||||
|
||||
<!ENTITY disableThemes.label "Disable all themes and extensions">
|
||||
<!ENTITY disableThemes.accesskey "D">
|
||||
|
||||
<!ENTITY resetToolbars.label "Reset toolbars and controls">
|
||||
<!ENTITY resetToolbars.accesskey "R">
|
||||
|
||||
<!ENTITY resetBookmarks.label "Reset bookmarks to &brandShortName; defaults">
|
||||
<!ENTITY resetBookmarks.accesskey "b">
|
||||
|
||||
<!ENTITY resetUserPrefs.label "Reset all user preferences to &brandShortName; defaults">
|
||||
<!ENTITY resetUserPrefs.accesskey "p">
|
||||
|
||||
<!ENTITY changeAndRestartButton.label "Make Changes and Restart">
|
||||
<!ENTITY continueButton.label "Continue in Safe Mode">
|
|
@ -16,6 +16,7 @@
|
|||
locale/browser/pageInfo.properties (%chrome/browser/pageInfo.properties)
|
||||
locale/browser/pageReport.dtd (%chrome/browser/pageReport.dtd)
|
||||
locale/browser/pageReportFirstTime.dtd (%chrome/browser/pageReportFirstTime.dtd)
|
||||
* locale/browser/safeMode.dtd (%chrome/browser/safeMode.dtd)
|
||||
locale/browser/sanitize.dtd (%chrome/browser/sanitize.dtd)
|
||||
locale/browser/searchbar.properties (%chrome/browser/searchbar.properties)
|
||||
locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd)
|
||||
|
|
Загрузка…
Ссылка в новой задаче