1
0
OBS User autobuild 2009-12-21 13:04:13 +00:00 committed by Git OBS Bridge
parent 273aed5221
commit 7ad23517c3
4 changed files with 12 additions and 424 deletions

View File

@ -1,8 +1,3 @@
-------------------------------------------------------------------
Thu Dec 17 20:06:38 CET 2009 - wr@rosenauer.org
- readded firefox-ui-lockdown.patch (bnc#546158)
-------------------------------------------------------------------
Thu Dec 3 21:53:59 CET 2009 - wr@rosenauer.org

View File

@ -25,7 +25,7 @@ BuildRequires: mozilla-xulrunner191-devel = 1.9.1.6
%if %suse_version > 1020
BuildRequires: fdupes
%endif
License: GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
License: GPL v2 or later ; LGPL v2.1 or later ; MPL 1.1 or later
Provides: web_browser
Provides: firefox
Version: 3.5.6
@ -49,7 +49,6 @@ Patch1: firefox-libxul-sdk.patch
Patch2: firefox-no-update.patch
Patch3: toolkit-download-folder.patch
Patch4: mozilla-linkorder.patch
Patch5: firefox-ui-lockdown.patch
Patch6: firefox-cross-desktop.patch
Patch7: firefox-kde.patch
Patch8: firefox-no-gnomevfs.patch
@ -74,8 +73,11 @@ Requires: %{name}-branding = 3.5
%define releasedate 2009120100
%define progname firefox
%define progdir %{_prefix}/%_lib/%{progname}
%if %suse_version > 1020
%define gnome_dir %{_prefix}
%define gconf_confdir %{_sysconfdir}/gconf
%else
%define gnome_dir /opt/gnome
%endif
### build options
%define branding 1
%define localize 1
@ -88,9 +90,10 @@ plethora of extensions.
%if %localize
%package translations-common
Summary: Common translations for MozillaFirefox
License: GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
License: GPL v2 or later ; LGPL v2.1 or later ; MPL 1.1 or later
Provides: locale(%{name}:ar;ca;cs;da;de;en_GB;es_AR;es_CL;es_ES;fi;fr;hu;it;ja;ko;nb_NO;nl;pl;pt_BR;pt_PT;ru;sv_SE;zh_CN;zh_TW)
Group: System/Localization
PreReq: %{name} = %{version}
@ -103,7 +106,7 @@ of MozillaFirefox.
%package translations-other
Summary: Extra translations for MozillaFirefox
License: GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
License: GPL v2 or later ; LGPL v2.1 or later ; MPL 1.1 or later
Provides: locale(%{name}:af;as;be;bg;bn_BD;bn_IN;cy;el;eo;es_MX;et;eu;fa;fy_NL;ga_IE;gl;gu_IN;he;hi_IN;hr;id;is;ka;kk;kn;ku;lt;lv;mk;ml;mn;mr;nn_NO;oc;or;pa_IN;rm;ro;si;sk;sl;sq;sr;ta;ta_LK;te;th;tr;uk;vi)
Group: System/Localization
PreReq: %{name} = %{version}
@ -117,15 +120,12 @@ of MozillaFirefox.
%endif
%package branding-upstream
License: GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
License: GPL v2 or later ; LGPL v2.1 or later ; MPL
Summary: Upstream branding for MozillaFirefox
Group: Productivity/Networking/Web/Browsers
Provides: %{name}-branding = 3.5
Conflicts: otherproviders(%{name}-branding)
Supplements: packageand(%{name}:branding-upstream)
%if %suse_version > 1020
%gconf_schemas_prereq
%endif
#BRAND: Provide three files -
#BRAND: /usr/lib/firefox/browserconfig.properties that contains the
#BRAND: default homepage and some other default configuration options
@ -149,7 +149,6 @@ cd $RPM_BUILD_DIR/mozilla
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%if %suse_version >= 1110
# copy current files and patch them later to keep them in sync
@ -280,13 +279,6 @@ done
cp -f $RPM_BUILD_ROOT%{progdir}/icons/mozicon50.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/%{progname}.xpm
%endif
%suse_update_desktop_file %{name} Network WebBrowser X-Ximian-Main X-Ximian-Toplevel GTK
# SCHEMA file
mkdir -p $RPM_BUILD_ROOT%{gconf_confdir}/schemas
install -m 644 %{SOURCE5} \
$RPM_BUILD_ROOT%{gconf_confdir}/schemas/
%if %suse_version > 1020
%find_gconf_schemas
%endif
# excludes
rm -f $RPM_BUILD_ROOT%{progdir}/updater.ini
rm -f $RPM_BUILD_ROOT%{progdir}/removed-files
@ -305,14 +297,6 @@ rm -rf $RPM_BUILD_ROOT
rm -rf %{_tmppath}/translations.*
%endif
%if %suse_version > 1020
%pre branding-upstream -f %{name}.schemas_pre
%preun branding-upstream -f %{name}.schemas_preun
%posttrans branding-upstream -f %{name}.schemas_posttrans
%endif
%post
# update mime and desktop database
if [ -f usr/bin/update-mime-database ] ; then
@ -351,7 +335,7 @@ if [ -f opt/gnome/bin/update-mime-database ] ; then
fi
%endif
%files
%files
%defattr(-,root,root)
%dir %{progdir}
%dir %{progdir}/chrome/
@ -388,11 +372,7 @@ fi
%defattr(-,root,root)
%endif
%if %suse_version > 1020
%files branding-upstream -f %{name}.schemas_list
%else
%files branding-upstream
%endif
%files branding-upstream
%defattr(-,root,root)
%{progdir}/browserconfig.properties
%{progdir}/defaults/profile/bookmarks.html

View File

@ -1,387 +0,0 @@
diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -64,21 +64,19 @@
<menuitem id="menu_closeWindow" hidden="true" command="cmd_closeWindow" key="key_closeWindow" label="&closeWindow.label;" accesskey="&closeWindow.accesskey;"/>
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
<menuseparator/>
<menuitem label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;" key="key_savePage" command="Browser:SavePage"
id="menu_savePage" />
<menuitem id="menu_saveFrame" label="&saveFrameCmd.label;" accesskey="&saveFrameCmd.accesskey;" command="Browser:SaveFrame" hidden="true"/>
<menuitem id="menu_sendLink" label="&sendPageCmd.label;" accesskey="&sendPageCmd.accesskey;" command="Browser:SendLink"/>
<menuseparator/>
- <menuitem label="&printSetupCmd.label;" accesskey="&printSetupCmd.accesskey;" command="cmd_pageSetup"
- id="menu_printSetup" />
+ <menuitem id="menu_printSetup" label="&printSetupCmd.label;" accesskey="&printSetupCmd.accesskey;" command="cmd_pageSetup"/>
#ifndef XP_MACOSX
- <menuitem label="&printPreviewCmd.label;" accesskey="&printPreviewCmd.accesskey;" command="cmd_printPreview"
- id="menu_printPreview" />
+ <menuitem id="menu_printPreview" label="&printPreviewCmd.label;" accesskey="&printPreviewCmd.accesskey;" oncommand="PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview);"/>
#endif
<menuitem label="&printCmd.label;" accesskey="&printCmd.accesskey;" key="printKb" command="cmd_print"
id="menu_print" />
<menuseparator/>
<menuitem label="&import.label;" accesskey="&import.accesskey;" oncommand="BrowserImport();"
id="menu_import"/>
#ifndef XP_MACOSX
<menuseparator/>
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1192,32 +1192,186 @@ function prepareForStartup() {
// setup our MozApplicationManifest listener
gBrowser.addEventListener("MozApplicationManifest",
OfflineApps, false);
// setup simple gestures support
gGestureSupport.init(true);
}
+function lockdownElement(ident, disable, hideCompletely)
+{
+ var e = document.getElementById(ident);
+ if (!e) return;
+ if (hideCompletely) {
+ e.setAttribute("style", (disable) ? "display: none;" : "");
+ } else if (disable) {
+ e.setAttribute("disabled", "true");
+ } else {
+ e.removeAttribute("disabled");
+ }
+}
+
+function applyLockdown(isStartup)
+{
+ // It is important to check that Firefox code does not change the
+ // "disabled" state of these UI elements. Fortunately it mostly hides
+ // elements rather than disables them.
+ var disablePrinting = gPrefService.getBoolPref("config.lockdown.printing");
+ var disablePrintSetup = gPrefService.getBoolPref("config.lockdown.printsetup");
+ if (!isStartup || disablePrintSetup || disablePrintSetup) {
+ lockdownElement("cmd_pageSetup", disablePrinting || disablePrintSetup);
+ lockdownElement("menu_printPreview", disablePrinting || disablePrintSetup);
+ lockdownElement("cmd_print", disablePrinting);
+ }
+
+ var disableSave = gPrefService.getBoolPref("config.lockdown.savepage");
+ if (!isStartup || disableSave) {
+ lockdownElement("Browser:SavePage", disableSave);
+ lockdownElement("Browser:SaveFrame", disableSave);
+ lockdownElement("context-savepage", disableSave);
+ lockdownElement("context-saveframe", disableSave);
+ lockdownElement("context-savelink", disableSave);
+ lockdownElement("context-saveimage", disableSave);
+ lockdownElement("View:PageSource", disableSave);
+ lockdownElement("context-viewpartialsource-selection", disableSave);
+ lockdownElement("context-viewpartialsource-mathml", disableSave);
+ lockdownElement("context-viewsource", disableSave);
+ lockdownElement("context-viewframesource", disableSave);
+ lockdownElement("View:PageInfo", disableSave);
+ lockdownElement("context-viewinfo", disableSave);
+ lockdownElement("context-viewframeinfo", disableSave);
+ lockdownElement("Tasks:InspectPage", disableSave); // from DOMInspector extension
+ }
+
+ var disableBookmarks = gPrefService.getBoolPref("config.lockdown.hidebookmark");
+ var disableBookmarkEditing = gPrefService.getBoolPref("config.lockdown.bookmark");
+ if (!isStartup || disableBookmarks || disableBookmarkEditing) {
+ lockdownElement("bookmarksMenu", disableBookmarks, true);
+ lockdownElement("viewBookmarksSidebar", disableBookmarks);
+ lockdownElement("PersonalToolbar", disableBookmarks); // XXX check
+ lockdownElement("Browser:AddBookmarkAs", disableBookmarks || disableBookmarkEditing);
+ lockdownElement("Browser:ShowAllBookmarks", disableBookmarks || disableBookmarkEditing);
+ lockdownElement("manBookmark", disableBookmarks || disableBookmarkEditing);
+ lockdownElement("context-bookmarkpage", disableBookmarks || disableBookmarkEditing);
+ lockdownElement("context-bookmarklink", disableBookmarks || disableBookmarkEditing);
+
+ // hide the personal bookmarks toolbar if necessary
+ if (disableBookmarks) {
+ document.getElementById("PersonalToolbar").setAttribute("collapsed", "true");
+ }
+ }
+
+ var disableHistory = gPrefService.getBoolPref("config.lockdown.history");
+ if (!isStartup || disableHistory) {
+ lockdownElement("history-menu", disableHistory, true);
+ lockdownElement("viewHistorySidebar", disableHistory);
+ lockdownElement("Browser:ShowAllHistory", disableHistory);
+ gURLBar.setAttribute("enablehistory", disableHistory ? "false" : "true");
+ gURLBar.disableAutoComplete = disableHistory;
+ }
+
+ var defaultPrefs = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefService).getDefaultBranch(null);
+ if (isStartup && disableHistory) {
+ if (!defaultPrefs.prefIsLocked("browser.history_expire_days")) {
+ defaultPrefs.setIntPref("browser.history_expire_days", 0);
+ defaultPrefs.lockPref("browser.history_expire_days");
+ }
+ if (!defaultPrefs.prefIsLocked("browser.formfill.enable")) {
+ defaultPrefs.setBoolPref("browser.formfill.enable", false);
+ defaultPrefs.lockPref("browser.formfill.enable");
+ }
+ if (!defaultPrefs.prefIsLocked("browser.download.manager.retention")) {
+ defaultPrefs.setIntPref("browser.download.manager.retention", 0);
+ defaultPrefs.lockPref("browser.download.manager.retention");
+ }
+ gPrefService.setBoolPref("config.lockdown.history.set", true);
+ } else if (isStartup && gPrefService.prefHasUserValue("config.lockdown.history.set")) {
+ if (!defaultPrefs.prefIsLocked("browser.history_expire_days")) {
+ defaultPrefs.clearUserPref("browser.history_expire_days");
+ }
+ if (!defaultPrefs.prefIsLocked("browser.formfill.enable")) {
+ defaultPrefs.clearUserPref("browser.formfill.enable");
+ }
+ if (!defaultPrefs.prefIsLocked("browser.download.manager.retention")) {
+ defaultPrefs.clearUserPref("browser.download.manager.retention");
+ }
+ gPrefService.clearUserPref("config.lockdown.history.set");
+ }
+
+ var disableURLBar = gPrefService.getBoolPref("config.lockdown.urlbar");
+ if (!isStartup || disableURLBar) {
+ lockdownElement("urlbar", disableURLBar);
+ lockdownElement("Browser:OpenLocation", disableURLBar);
+ lockdownElement("Browser:OpenFile", disableURLBar);
+ }
+
+ var disableSearchBar = gPrefService.getBoolPref("config.lockdown.searchbar");
+ if (!isStartup || disableSearchBar) {
+ document.getElementById("search-container")
+ .setAttribute("style", (disableSearchBar) ? "display: none;" : "");
+ }
+
+ var disableToolbarEditing = gPrefService.getBoolPref("config.lockdown.toolbarediting");
+ if (!isStartup || disableToolbarEditing) {
+ var e = document.getElementById("cmd_CustomizeToolbars");
+ if (!e.getAttribute("inCustomization")) {
+ lockdownElement("cmd_CustomizeToolbars", disableToolbarEditing);
+ }
+ }
+
+ // Close sidebar if we disabled the command that's currently in use
+ var sidebarBox = document.getElementById("sidebar-box");
+ var cmd = sidebarBox.getAttribute("sidebarcommand");
+ if (cmd) {
+ var elt = document.getElementById(cmd);
+ if (elt && elt.getAttribute("disabled") == "true") {
+ toggleSidebar(cmd, false);
+ gMustLoadSidebar = false;
+ }
+ }
+}
+
+var lockdownObserver = {
+ observe: function(aSubject, aTopic, aPrefName)
+ {
+ try {
+ applyLockdown(false);
+ } catch (ex) {
+ dump("Failed lockdown: " + ex + "\n");
+ }
+ }
+};
+
function delayedStartup(isLoadingBlank, mustLoadSidebar) {
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
os.addObserver(gXPInstallObserver, "xpinstall-install-blocked", false);
+ try {
+ // do lockdown stuff in an exception handler so that if it fails
+ // catastrophically, the browser should still come up and function
+ applyLockdown(true);
+ gPrefService.addObserver("config.lockdown.", lockdownObserver, false);
+ } catch (ex) {
+ dump("Failed lockdown: " + ex + "\n");
+ }
+
BrowserOffline.init();
OfflineApps.init();
gBrowser.addEventListener("pageshow", function(evt) { setTimeout(pageShowEventHandlers, 0, evt); }, true);
// Ensure login manager is up and running.
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
if (mustLoadSidebar) {
+ let sidebarBox = document.getElementById("sidebar-box");
let sidebar = document.getElementById("sidebar");
- let sidebarBox = document.getElementById("sidebar-box");
sidebar.setAttribute("src", sidebarBox.getAttribute("src"));
}
UpdateUrlbarSearchSplitterState();
PlacesStarButton.init();
// called when we go into full screen, even if it is
@@ -1401,16 +1555,18 @@ function BrowserShutdown()
Components.utils.reportError(ex);
}
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history");
os.removeObserver(gXPInstallObserver, "xpinstall-install-blocked");
+ gPrefService.removeObserver("config.lockdown.", lockdownObserver);
+
try {
gBrowser.removeProgressListener(window.XULBrowserWindow);
gBrowser.removeTabsProgressListener(window.TabsProgressListener);
} catch (ex) {
}
PlacesStarButton.uninit();
@@ -3200,16 +3356,22 @@ const BrowserSearch = {
function FillHistoryMenu(aParent) {
// Remove old entries if any
var children = aParent.childNodes;
for (var i = children.length - 1; i >= 0; --i) {
if (children[i].hasAttribute("index"))
aParent.removeChild(children[i]);
}
+ // lockdown. Don't display anything if locked down.
+ var disableHistory = gPrefService.getBoolPref("config.lockdown.history");
+ if (disableHistory) {
+ return false;
+ }
+
var webNav = getWebNavigation();
var sessionHistory = webNav.sessionHistory;
var bundle_browser = document.getElementById("bundle_browser");
var count = sessionHistory.count;
var index = sessionHistory.index;
var end;
@@ -3346,16 +3508,17 @@ function BrowserCustomizeToolbar()
{
// Disable the toolbar context menu items
var menubar = document.getElementById("main-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
menubar.childNodes[i].setAttribute("disabled", true);
var cmd = document.getElementById("cmd_CustomizeToolbars");
cmd.setAttribute("disabled", "true");
+ cmd.setAttribute("inCustomization", "true");
var splitter = document.getElementById("urlbar-search-splitter");
if (splitter)
splitter.parentNode.removeChild(splitter);
var customizeURL = "chrome://global/content/customizeToolbar.xul";
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
@@ -3381,16 +3544,25 @@ function BrowserCustomizeToolbar()
#else
window.openDialog(customizeURL,
"CustomizeToolbar",
"chrome,titlebar,toolbar,location,resizable,dependent",
gNavToolbox);
#endif
}
+function BrowserRestoreCustomizationDisabledState()
+{
+ var cmd = document.getElementById("cmd_CustomizeToolbars");
+ if (!gPrefService.getBoolPref("config.lockdown.toolbarediting")) {
+ cmd.removeAttribute("disabled", "true");
+ }
+ cmd.removeAttribute("inCustomization");
+}
+
function BrowserToolboxCustomizeDone(aToolboxChanged) {
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
document.getElementById("customizeToolbarSheetIFrame").hidden = true;
document.getElementById("customizeToolbarSheetPopup").hidePopup();
#endif
// Update global UI elements that may have been added or removed
if (aToolboxChanged) {
@@ -3398,16 +3570,23 @@ function BrowserToolboxCustomizeDone(aTo
if (gURLBar)
gURLBar.emptyText = gURLBarEmptyText.value;
gProxyFavIcon = document.getElementById("page-proxy-favicon");
gHomeButton.updateTooltip();
gIdentityHandler._cacheElements();
window.XULBrowserWindow.init();
+ // make sure the search bar is not put back if locked down
+ var disableSearchBar = gPrefService.getBoolPref("config.lockdown.searchbar");
+ if (disableSearchBar) {
+ document.getElementById("search-container")
+ .setAttribute("style", (disableSearchBar) ? "display: none;" : "");
+ }
+
var backForwardDropmarker = document.getElementById("back-forward-dropmarker");
if (backForwardDropmarker)
backForwardDropmarker.disabled =
document.getElementById('Browser:Back').hasAttribute('disabled') &&
document.getElementById('Browser:Forward').hasAttribute('disabled');
// support downgrading to Firefox 2.0
var navBar = document.getElementById("nav-bar");
@@ -3432,18 +3611,17 @@ function BrowserToolboxCustomizeDone(aTo
XULBrowserWindow.asyncUpdateUI();
PlacesStarButton.updateState();
}
// Re-enable parts of the UI we disabled during the dialog
var menubar = document.getElementById("main-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
menubar.childNodes[i].setAttribute("disabled", false);
- var cmd = document.getElementById("cmd_CustomizeToolbars");
- cmd.removeAttribute("disabled");
+ BrowserRestoreCustomizationDisabledState();
// XXXmano bug 287105: wallpaper to bug 309953,
// the reload button isn't in sync with the reload command.
var reloadButton = document.getElementById("reload-button");
if (reloadButton) {
reloadButton.disabled =
document.getElementById("Browser:Reload").getAttribute("disabled") == "true";
}
@@ -4568,16 +4746,19 @@ function onViewToolbarsPopupShowing(aEve
var toolbar = gNavToolbox.childNodes[i];
var toolbarName = toolbar.getAttribute("toolbarname");
var type = toolbar.getAttribute("type");
if (toolbarName && type != "menubar") {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("toolbarindex", i);
menuItem.setAttribute("type", "checkbox");
menuItem.setAttribute("label", toolbarName);
+ if (toolbar.getAttribute("disabled") == "true") {
+ menuItem.setAttribute("disabled", "true");
+ }
menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey"));
menuItem.setAttribute("checked", toolbar.getAttribute("collapsed") != "true");
popup.insertBefore(menuItem, firstMenuItem);
menuItem.addEventListener("command", onViewToolbarCommand, false);
}
toolbar = toolbar.nextSibling;
}
@@ -6521,17 +6702,17 @@ BookmarkAllTabsHandler.prototype = {
_updateCommandState: function BATH__updateCommandState(aTabClose) {
var numTabs = gBrowser.tabContainer.childNodes.length;
// The TabClose event is fired before the tab is removed from the DOM
if (aTabClose)
numTabs--;
- if (numTabs > 1)
+ if (numTabs > 1 && !gPrefService.getBoolPref("config.lockdown.bookmark"))
this._command.removeAttribute("disabled");
else
this._command.setAttribute("disabled", "true");
},
doCommand: function BATH_doCommand() {
PlacesCommandHook.bookmarkCurrentPages();
},

View File

@ -137,7 +137,7 @@
<applyto>/apps/firefox/general/homepage_url</applyto>
<owner>firefox</owner>
<type>string</type>
<default>www.mozilla.com</default>
<default>www.novell.com/linux</default>
<locale name="C">
<short>Home Page URL</short>
<long>Home Page URL</long>