merge in latest m-c to b-s

--HG--
rename : browser/devtools/webconsole/test/browser_gcli_break.html => browser/devtools/shared/test/browser_gcli_break.html
rename : browser/devtools/webconsole/test/browser_gcli_commands.js => browser/devtools/shared/test/browser_gcli_commands.js
rename : browser/devtools/webconsole/test/browser_gcli_inspect.html => browser/devtools/shared/test/browser_gcli_inspect.html
rename : browser/devtools/webconsole/test/browser_gcli_inspect.js => browser/devtools/shared/test/browser_gcli_inspect.js
rename : browser/devtools/webconsole/test/browser_gcli_integrate.js => browser/devtools/shared/test/browser_gcli_integrate.js
rename : browser/devtools/webconsole/test/browser_gcli_require.js => browser/devtools/shared/test/browser_gcli_require.js
rename : browser/devtools/webconsole/test/browser_gcli_web.js => browser/devtools/shared/test/browser_gcli_web.js
This commit is contained in:
Chris AtLee 2012-05-14 15:58:57 -04:00
commit 8ebcaddc5f
1451 changed files with 36565 additions and 46523 deletions

File diff suppressed because it is too large Load Diff

View File

@ -38,31 +38,39 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#define MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#ifndef mozilla_a11y_ApplicationAccessibleWrap_h__
#define mozilla_a11y_ApplicationAccessibleWrap_h__
#include "ApplicationAccessible.h"
namespace mozilla {
namespace a11y {
class ApplicationAccessibleWrap: public ApplicationAccessible
{
public:
static void Unload();
static void PreCreate();
static void Unload();
static void PreCreate();
public:
ApplicationAccessibleWrap();
virtual ~ApplicationAccessibleWrap();
ApplicationAccessibleWrap();
virtual ~ApplicationAccessibleWrap();
// nsAccessNode
virtual bool Init();
// nsAccessNode
virtual bool Init();
// nsAccessible
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
virtual bool AppendChild(nsAccessible* aChild);
virtual bool RemoveChild(nsAccessible* aChild);
// nsAccessible
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
virtual bool AppendChild(nsAccessible* aChild);
virtual bool RemoveChild(nsAccessible* aChild);
// return the atk object for app root accessible
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
/**
* Return the atk object for app root accessible.
*/
NS_IMETHOD GetNativeInterface(void** aOutAccessible);
};
} // namespace a11y
} // namespace mozilla
#endif /* __NS_APP_ROOT_ACCESSIBLE_H__ */

View File

@ -69,18 +69,7 @@ CPPSRCS = \
$(NULL)
EXPORTS = \
ARIAGridAccessibleWrap.h \
AtkSocketAccessible.h \
nsAccessNodeWrap.h \
nsAccessibleWrap.h \
nsDocAccessibleWrap.h \
nsTextAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \
$(NULL)
# we want to force the creation of a static lib.

View File

@ -67,7 +67,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
void nsAccessNodeWrap::InitAccessibility()
{
nsAccessNode::InitXPAccessibility();
}
void nsAccessNodeWrap::ShutdownAccessibility()

View File

@ -75,22 +75,16 @@ refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
}
static gint
getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
getIndexAtCB(AtkTable* aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return -1;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
TableAccessible* table = accWrap->AsTable();
NS_ENSURE_TRUE(table, -1);
PRInt32 index;
nsresult rv = accTable->GetCellIndexAt(aRow, aColumn, &index);
NS_ENSURE_SUCCESS(rv, -1);
return static_cast<gint>(index);
return static_cast<gint>(table->CellIndexAt(aRow, aColumn));
}
static gint

View File

@ -71,6 +71,7 @@ CPPSRCS = \
nsCaretAccessible.cpp \
nsTextAccessible.cpp \
nsTextEquivUtils.cpp \
RoleAsserts.cpp \
StyleInfo.cpp \
TextAttrs.cpp \
TextUpdater.cpp \

View File

@ -0,0 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIAccessibleRole.h"
#include "Role.h"
#include "mozilla/Assertions.h"
using namespace mozilla::a11y;
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
MOZ_STATIC_ASSERT(roles::geckoRole == nsIAccessibleRole::ROLE_ ## geckoRole, "internal and xpcom roles differ!");
#include "RoleMap.h"
#undef ROLE

View File

@ -51,7 +51,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsIStringBundle.h"
#include "nsFocusManager.h"
#include "nsPresContext.h"
#include "mozilla/Services.h"
@ -62,8 +61,6 @@ using namespace mozilla::a11y;
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
nsIStringBundle *nsAccessNode::gStringBundle = 0;
ApplicationAccessible* nsAccessNode::gApplicationAccessible = nsnull;
/*
@ -149,25 +146,12 @@ nsAccessNode::GetApplicationAccessible()
return gApplicationAccessible;
}
void nsAccessNode::InitXPAccessibility()
{
nsCOMPtr<nsIStringBundleService> stringBundleService =
mozilla::services::GetStringBundleService();
if (stringBundleService) {
// Static variables are released in ShutdownAllXPAccessibility();
stringBundleService->CreateBundle(ACCESSIBLE_BUNDLE_URL,
&gStringBundle);
}
}
void nsAccessNode::ShutdownXPAccessibility()
{
// Called by nsAccessibilityService::Shutdown()
// which happens when xpcom is shutting down
// at exit of program
NS_IF_RELEASE(gStringBundle);
// Release gApplicationAccessible after everything else is shutdown
// so we don't accidently create it again while tearing down root accessibles
ApplicationAccessibleWrap::Unload();

View File

@ -53,13 +53,13 @@
#include "nsIStringBundle.h"
#include "nsWeakReference.h"
class ApplicationAccessible;
class nsAccessNode;
class nsDocAccessible;
class nsIAccessibleDocument;
namespace mozilla {
namespace a11y {
class ApplicationAccessible;
class RootAccessible;
}
}
@ -69,9 +69,6 @@ class nsPresContext;
class nsIFrame;
class nsIDocShellTreeItem;
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
class nsAccessNode: public nsISupports
{
public:
@ -79,16 +76,15 @@ public:
nsAccessNode(nsIContent* aContent, nsDocAccessible* aDoc);
virtual ~nsAccessNode();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode)
static void InitXPAccessibility();
static void ShutdownXPAccessibility();
static void ShutdownXPAccessibility();
/**
* Return an application accessible.
*/
static ApplicationAccessible* GetApplicationAccessible();
static mozilla::a11y::ApplicationAccessible* GetApplicationAccessible();
/**
* Return the document accessible for this access node.
@ -164,15 +160,12 @@ protected:
nsCOMPtr<nsIContent> mContent;
nsDocAccessible* mDoc;
// Static data, we do our own refcounting for our static data.
static nsIStringBundle* gStringBundle;
private:
nsAccessNode() MOZ_DELETE;
nsAccessNode(const nsAccessNode&) MOZ_DELETE;
nsAccessNode& operator =(const nsAccessNode&) MOZ_DELETE;
static ApplicationAccessible* gApplicationAccessible;
static mozilla::a11y::ApplicationAccessible* gApplicationAccessible;
};
#endif

View File

@ -82,6 +82,7 @@
#include "nsLayoutUtils.h"
#include "nsIPresShell.h"
#include "nsIStringBundle.h"
#include "nsPresContext.h"
#include "nsIFrame.h"
#include "nsIView.h"
@ -626,12 +627,24 @@ nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
}
void
nsAccessible::TranslateString(const nsAString& aKey, nsAString& aStringOut)
nsAccessible::TranslateString(const nsString& aKey, nsAString& aStringOut)
{
nsXPIDLString xsValue;
nsCOMPtr<nsIStringBundleService> stringBundleService =
services::GetStringBundleService();
if (!stringBundleService)
return;
gStringBundle->GetStringFromName(PromiseFlatString(aKey).get(), getter_Copies(xsValue));
aStringOut.Assign(xsValue);
nsCOMPtr<nsIStringBundle> stringBundle;
stringBundleService->CreateBundle(
"chrome://global-platform/locale/accessible.properties",
getter_AddRefs(stringBundle));
if (!stringBundle)
return;
nsXPIDLString xsValue;
nsresult rv = stringBundle->GetStringFromName(aKey.get(), getter_Copies(xsValue));
if (NS_SUCCEEDED(rv))
aStringOut.Assign(xsValue);
}
PRUint64
@ -2238,6 +2251,9 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
NS_IMETHODIMP
nsAccessible::ScrollTo(PRUint32 aHow)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aHow);
return NS_OK;
}
@ -3290,8 +3306,9 @@ KeyBinding::ToPlatformFormat(nsAString& aValue) const
nsCOMPtr<nsIStringBundleService> stringBundleService =
mozilla::services::GetStringBundleService();
if (stringBundleService)
stringBundleService->CreateBundle(PLATFORM_KEYS_BUNDLE_URL,
getter_AddRefs(keyStringBundle));
stringBundleService->CreateBundle(
"chrome://global-platform/locale/platformKeys.properties",
getter_AddRefs(keyStringBundle));
if (!keyStringBundle)
return;

View File

@ -662,7 +662,7 @@ public:
/**
* Return the localized string for the given key.
*/
static void TranslateString(const nsAString& aKey, nsAString& aStringOut);
static void TranslateString(const nsString& aKey, nsAString& aStringOut);
/**
* Return true if the accessible is defunct.

View File

@ -1083,6 +1083,9 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
if ((aContent->IsXUL() && aAttribute == nsGkAtoms::selected) ||
aAttribute == nsGkAtoms::aria_selected) {
nsAccessible* item = GetAccessible(aContent);
if (!item)
return;
nsAccessible* widget =
nsAccUtils::GetSelectableContainer(item, item->State());
if (widget) {

View File

@ -133,30 +133,6 @@ ARIAGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
return NS_OK;
}
NS_IMETHODIMP
ARIAGridAccessible::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32* aCellIndex)
{
NS_ENSURE_ARG_POINTER(aCellIndex);
*aCellIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aRowIndex >= 0 && aColumnIndex >= 0);
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
NS_ENSURE_ARG(aRowIndex < rowCount);
PRInt32 colsCount = 0;
GetColumnCount(&colsCount);
NS_ENSURE_ARG(aColumnIndex < colsCount);
*aCellIndex = colsCount * aRowIndex + aColumnIndex;
return NS_OK;
}
NS_IMETHODIMP
ARIAGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
PRInt32* aColumnIndex)

View File

@ -40,8 +40,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef MOZILLA_A11Y_APPLICATION_ACCESSIBLE_H__
#define MOZILLA_A11Y_APPLICATION_ACCESSIBLE_H__
#ifndef mozilla_a11y_ApplicationAccessible_h__
#define mozilla_a11y_ApplicationAccessible_h__
#include "nsAccessibleWrap.h"
#include "nsIAccessibleApplication.h"
@ -49,6 +49,9 @@
#include "nsIMutableArray.h"
#include "nsIXULAppInfo.h"
namespace mozilla {
namespace a11y {
/**
* ApplicationAccessible is for the whole application of Mozilla.
* Only one instance of ApplicationAccessible exists for one Mozilla instance.
@ -130,5 +133,8 @@ private:
nsCOMPtr<nsIXULAppInfo> mAppInfo;
};
} // namespace a11y
} // namespace mozilla
#endif

View File

@ -35,3 +35,25 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
LOCAL_INCLUDES += \
-I$(srcdir)/../atk \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
LOCAL_INCLUDES += \
-I$(srcdir)/../msaa \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
LOCAL_INCLUDES += \
-I$(srcdir)/../mac \
$(NULL)
else
LOCAL_INCLUDES += \
-I$(srcdir)/../other \
$(NULL)
endif
endif
endif

View File

@ -51,7 +51,8 @@ public:
/**
* Return the index of the cell at the given row and column.
*/
virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return -1; }
virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx)
{ return ColCount() * aRowIdx + aColIdx; }
/**
* Return the column index of the cell with the given index.

View File

@ -80,3 +80,25 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
LOCAL_INCLUDES += \
-I$(srcdir)/../atk \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
LOCAL_INCLUDES += \
-I$(srcdir)/../msaa \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
LOCAL_INCLUDES += \
-I$(srcdir)/../mac \
$(NULL)
else
LOCAL_INCLUDES += \
-I$(srcdir)/../other \
$(NULL)
endif
endif
endif

View File

@ -265,9 +265,12 @@ nsHTMLSelectOptionAccessible::NativeState()
// because we don't want EDITABLE or SELECTABLE_TEXT
PRUint64 state = nsAccessible::NativeState();
PRUint64 selectState = 0;
nsIContent* selectContent = GetSelectState(&selectState);
if (!selectContent || selectState & states::INVISIBLE)
nsAccessible* select = GetSelect();
if (!select)
return state;
PRUint64 selectState = select->State();
if (selectState & states::INVISIBLE)
return state;
// Focusable and selectable
@ -391,30 +394,6 @@ nsHTMLSelectOptionAccessible::ContainerWidget() const
return mParent && mParent->IsListControl() ? mParent : nsnull;
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLSelectOptionAccessible: private methods
nsIContent*
nsHTMLSelectOptionAccessible::GetSelectState(PRUint64* aState)
{
*aState = 0;
nsIContent* selectNode = mContent;
while (selectNode && selectNode->Tag() != nsGkAtoms::select) {
selectNode = selectNode->GetParent();
}
if (selectNode) {
nsAccessible* select = mDoc->GetAccessible(selectNode);
if (select) {
*aState = select->State();
return selectNode;
}
}
return nsnull;
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLSelectOptGroupAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -133,11 +133,17 @@ public:
private:
/**
* Get Select element's accessible state
* @param aState, Select element state
* @return Select element content, returns null if not avaliable
* Return a select accessible the option belongs to if any.
*/
nsIContent* GetSelectState(PRUint64* aState);
nsAccessible* GetSelect() const
{
if (mParent && mParent->IsListControl()) {
nsAccessible* combobox = mParent->Parent();
return combobox && combobox->IsCombobox() ? combobox : mParent.get();
}
return nsnull;
}
/**
* Return a combobox accessible the option belongs to if any.
@ -146,7 +152,7 @@ private:
{
if (mParent && mParent->IsListControl()) {
nsAccessible* combobox = mParent->Parent();
return combobox->IsCombobox() ? combobox : nsnull;
return combobox && combobox->IsCombobox() ? combobox : nsnull;
}
return nsnull;

View File

@ -900,20 +900,14 @@ nsHTMLTableAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetCellIndexAt(PRInt32 aRow, PRInt32 aColumn,
PRInt32 *aIndex)
PRInt32
nsHTMLTableAccessible::CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx)
{
NS_ENSURE_ARG_POINTER(aIndex);
nsITableLayout* tableLayout = GetTableLayout();
nsITableLayout *tableLayout = GetTableLayout();
NS_ENSURE_STATE(tableLayout);
nsresult rv = tableLayout->GetIndexByRowAndColumn(aRow, aColumn, aIndex);
if (rv == NS_TABLELAYOUT_CELL_NOT_FOUND)
return NS_ERROR_INVALID_ARG;
return NS_OK;
PRInt32 index = -1;
tableLayout->GetIndexByRowAndColumn(aRowIdx, aColIdx, &index);
return index;
}
NS_IMETHODIMP

View File

@ -132,6 +132,7 @@ public:
virtual void Summary(nsString& aSummary);
virtual PRUint32 ColCount();
virtual PRUint32 RowCount();
virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx);
virtual void UnselectCol(PRUint32 aColIdx);
virtual void UnselectRow(PRUint32 aRowIdx);
virtual bool IsProbablyLayoutTable();

View File

@ -48,8 +48,7 @@ var AccessFu = {
} catch (x) {
}
if (this.amINeeded(accessPref))
this.enable();
this.processPreferences(accessPref);
},
/**
@ -57,6 +56,10 @@ var AccessFu = {
* with arrow keys.
*/
enable: function enable() {
if (this._enabled)
return;
this._enabled = true;
dump('AccessFu enable');
this.addPresenter(new VisualPresenter());
@ -77,6 +80,10 @@ var AccessFu = {
* Disable AccessFu and return to default interaction mode.
*/
disable: function disable() {
if (!this._enabled)
return;
this._enabled = false;
dump('AccessFu disable');
this.presenters.forEach(function(p) { p.detach(); });
@ -91,26 +98,29 @@ var AccessFu = {
this.chromeWin.removeEventListener('TabOpen', this, true);
},
amINeeded: function(aPref) {
switch (aPref) {
case ACCESSFU_ENABLE:
return true;
case ACCESSFU_AUTO:
if (Services.appinfo.OS == 'Android') {
let msg = Cc['@mozilla.org/android/bridge;1'].
getService(Ci.nsIAndroidBridge).handleGeckoMessage(
JSON.stringify(
{ gecko: {
type: 'Accessibility:IsEnabled',
eventType: 1,
text: []
}
}));
return JSON.parse(msg).enabled;
processPreferences: function processPreferences(aPref) {
if (Services.appinfo.OS == 'Android') {
if (aPref == ACCESSFU_AUTO) {
if (!this._observingSystemSettings) {
Services.obs.addObserver(this, 'Accessibility:Settings', false);
this._observingSystemSettings = true;
}
default:
return false;
Cc['@mozilla.org/android/bridge;1'].
getService(Ci.nsIAndroidBridge).handleGeckoMessage(
JSON.stringify({ gecko: { type: 'Accessibility:Ready' } }));
return;
}
if (this._observingSystemSettings) {
Services.obs.removeObserver(this, 'Accessibility:Settings');
this._observingSystemSettings = false;
}
}
if (aPref == ACCESSFU_ENABLE)
this.enable();
else
this.disable();
},
addPresenter: function addPresenter(presenter) {
@ -159,13 +169,15 @@ var AccessFu = {
observe: function observe(aSubject, aTopic, aData) {
switch (aTopic) {
case 'Accessibility:Settings':
if (JSON.parse(aData).enabled)
this.enable();
else
this.disable();
break;
case 'nsPref:changed':
if (aData == 'accessfu') {
if (this.amINeeded(this.prefsBranch.getIntPref('accessfu')))
this.enable();
else
this.disable();
}
if (aData == 'accessfu')
this.processPreferences(this.prefsBranch.getIntPref('accessfu'));
break;
case 'accessible-event':
let event;
@ -392,7 +404,13 @@ var AccessFu = {
},
// A hash of documents that don't yet have an accessible tree.
_pendingDocuments: {}
_pendingDocuments: {},
// So we don't enable/disable twice
_enabled: false,
// Observing accessibility settings
_observingSystemSettings: false
};
function getAccessible(aNode) {

View File

@ -38,11 +38,14 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#define MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#ifndef mozilla_a11y_ApplicationAccessibleWrap_h__
#define mozilla_a11y_ApplicationAccessibleWrap_h__
#include "ApplicationAccessible.h"
namespace mozilla {
namespace a11y {
class ApplicationAccessibleWrap: public ApplicationAccessible
{
public:
@ -50,5 +53,8 @@ public:
static void Unload() {}
};
} // namespace a11y
} // namespace mozilla
#endif

View File

@ -60,24 +60,9 @@ CMMSRCS = nsAccessNodeWrap.mm \
RootAccessibleWrap.mm \
$(NULL)
EXPORTS = \
ARIAGridAccessibleWrap.h \
nsAccessNodeWrap.h \
nsTextAccessibleWrap.h \
nsAccessibleWrap.h \
nsDocAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \
mozDocAccessible.h \
mozAccessible.h \
mozAccessibleProtocol.h \
mozActionElements.h \
mozTextAccessible.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

View File

@ -476,10 +476,10 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
{
switch (mRole) {
case roles::LIST:
return NSAccessibilityContentListSubrole;
return @"AXContentList"; // 10.6+ NSAccessibilityContentListSubrole;
case roles::DEFINITION_LIST:
return NSAccessibilityDefinitionListSubrole;
return @"AXDefinitionList"; // 10.6+ NSAccessibilityDefinitionListSubrole;
case roles::TERM:
return @"AXTerm";

View File

@ -67,7 +67,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
void nsAccessNodeWrap::InitAccessibility()
{
nsAccessNode::InitXPAccessibility();
}
void nsAccessNodeWrap::ShutdownAccessibility()

View File

@ -46,6 +46,9 @@
#include "nsIPersistentProperties2.h"
#include "nsServiceManagerUtils.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED0(ApplicationAccessibleWrap,

View File

@ -38,13 +38,16 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#define MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#ifndef mozilla_a11y_ApplicationAccessibleWrap_h__
#define mozilla_a11y_ApplicationAccessibleWrap_h__
#include "ApplicationAccessible.h"
#include "AccessibleApplication.h"
namespace mozilla {
namespace a11y {
class ApplicationAccessibleWrap: public ApplicationAccessible,
public IAccessibleApplication
{
@ -76,5 +79,8 @@ public:
static void Unload();
};
} // namespace a11y
} // namespace mozilla
#endif

View File

@ -78,28 +78,7 @@ CPPSRCS = \
$(NULL)
EXPORTS = \
ARIAGridAccessibleWrap.h \
nsAccessNodeWrap.h \
nsAccessibleWrap.h \
nsTextAccessibleWrap.h \
nsDocAccessibleWrap.h \
nsHTMLWin32ObjectAccessible.h \
nsXULMenuAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \
ia2AccessibleAction.h \
ia2AccessibleComponent.h \
CAccessibleImage.h \
CAccessibleText.h \
CAccessibleEditableText.h \
CAccessibleHyperlink.h \
ia2AccessibleHypertext.h \
CAccessibleTable.h \
CAccessibleTableCell.h \
CAccessibleValue.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

View File

@ -588,8 +588,6 @@ void nsAccessNodeWrap::InitAccessibility()
Compatibility::Init();
nsWinUtils::MaybeStartWindowEmulation();
nsAccessNode::InitXPAccessibility();
}
void nsAccessNodeWrap::ShutdownAccessibility()

View File

@ -38,11 +38,14 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#define MOZILLA_A11Y_APPLICATION_ACCESSIBLE_WRAP_H__
#ifndef mozilla_a11y_ApplicationAccessibleWrap_h__
#define mozilla_a11y_ApplicationAccessibleWrap_h__
#include "ApplicationAccessible.h"
namespace mozilla {
namespace a11y {
class ApplicationAccessibleWrap: public ApplicationAccessible
{
public:
@ -50,5 +53,8 @@ public:
static void Unload() {}
};
} // namespace a11y
} // namespace mozilla
#endif

View File

@ -52,20 +52,6 @@ CPPSRCS = \
nsAccessibleWrap.cpp \
$(NULL)
EXPORTS = \
ARIAGridAccessibleWrap.h \
nsAccessNodeWrap.h \
nsTextAccessibleWrap.h \
nsAccessibleWrap.h \
nsDocAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1

View File

@ -66,7 +66,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
void nsAccessNodeWrap::InitAccessibility()
{
nsAccessNode::InitXPAccessibility();
}
void nsAccessNodeWrap::ShutdownAccessibility()

View File

@ -66,3 +66,24 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../html \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
LOCAL_INCLUDES += \
-I$(srcdir)/../atk \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
LOCAL_INCLUDES += \
-I$(srcdir)/../msaa \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
LOCAL_INCLUDES += \
-I$(srcdir)/../mac \
$(NULL)
else
LOCAL_INCLUDES += \
-I$(srcdir)/../other \
$(NULL)
endif
endif
endif

View File

@ -62,3 +62,25 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../base \
-I$(srcdir)/../generic \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
LOCAL_INCLUDES += \
-I$(srcdir)/../atk \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
LOCAL_INCLUDES += \
-I$(srcdir)/../msaa \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
LOCAL_INCLUDES += \
-I$(srcdir)/../mac \
$(NULL)
else
LOCAL_INCLUDES += \
-I$(srcdir)/../other \
$(NULL)
endif
endif
endif

View File

@ -47,6 +47,24 @@ xpcAccessibleTable::GetRowCount(PRInt32* aRowCount)
return NS_OK;
}
nsresult
xpcAccessibleTable::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32* aCellIndex)
{
NS_ENSURE_ARG_POINTER(aCellIndex);
*aCellIndex = -1;
if (!mTable)
return NS_ERROR_FAILURE;
if (aRowIndex < 0 || aRowIndex >= mTable->RowCount() ||
aColumnIndex < 0 || aColumnIndex >= mTable->ColCount())
return NS_ERROR_INVALID_ARG;
*aCellIndex = mTable->CellIndexAt(aRowIndex, aColumnIndex);
return NS_OK;
}
nsresult
xpcAccessibleTable::GetSummary(nsAString& aSummary)
{

View File

@ -26,6 +26,8 @@ public:
nsresult GetSummary(nsAString& aSummary);
nsresult GetColumnCount(PRInt32* aColumnCount);
nsresult GetRowCount(PRInt32* aRowCount);
nsresult GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32* aCellIndex);
nsresult UnselectColumn(PRInt32 aColIdx);
nsresult UnselectRow(PRInt32 aRowIdx);
nsresult IsProbablyForLayout(bool* aIsForLayout);
@ -44,7 +46,8 @@ protected:
NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32* aRowCount) \
{ return xpcAccessibleTable::GetRowCount(aRowCount); } \
NS_SCRIPTABLE NS_IMETHOD GetCellAt(PRInt32 rowIndex, PRInt32 columnIndex, nsIAccessible * *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetCellIndexAt(PRInt32 rowIndex, PRInt32 columnIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetCellIndexAt(PRInt32 rowIndex, PRInt32 columnIndex, PRInt32 *_retval NS_OUTPARAM) \
{ return xpcAccessibleTable::GetCellIndexAt(rowIndex, columnIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetRowIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetRowAndColumnIndicesAt(PRInt32 cellIndex, PRInt32 *rowIndex NS_OUTPARAM, PRInt32 *columnIndex NS_OUTPARAM); \

View File

@ -78,3 +78,25 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
LOCAL_INCLUDES += \
-I$(srcdir)/../atk \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
LOCAL_INCLUDES += \
-I$(srcdir)/../msaa \
$(NULL)
else
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
LOCAL_INCLUDES += \
-I$(srcdir)/../mac \
$(NULL)
else
LOCAL_INCLUDES += \
-I$(srcdir)/../other \
$(NULL)
endif
endif
endif

View File

@ -307,27 +307,6 @@ nsXULListboxAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetCellIndexAt(PRInt32 aRow, PRInt32 aColumn,
PRInt32 *aIndex)
{
NS_ENSURE_ARG_POINTER(aIndex);
*aIndex = -1;
PRInt32 rowCount = 0;
nsresult rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(0 <= aRow && aRow <= rowCount, NS_ERROR_INVALID_ARG);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(0 <= aColumn && aColumn <= columnCount, NS_ERROR_INVALID_ARG);
*aIndex = aRow * columnCount + aColumn;
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32 *aColumn)
{

View File

@ -356,24 +356,6 @@ nsXULTreeGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32 *aCellIndex)
{
NS_ENSURE_ARG_POINTER(aCellIndex);
*aCellIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCellIndex = aRowIndex * columnCount + aColumnIndex;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
PRInt32 *aColumnIndex)

View File

@ -337,6 +337,118 @@ function testWords(aElement, aWords, aToDoFlag)
}
}
/**
* Remove all selections.
*
* @param aID [in] Id, DOM node, or acc obj
*/
function cleanTextSelections(aID)
{
var acc = getAccessible(aID, [nsIAccessibleText]);
while (acc.selectionCount > 0)
acc.removeSelection(0);
}
/**
* Test addSelection method.
*
* @param aID [in] Id, DOM node, or acc obj
* @param aStartOffset [in] start offset for the new selection
* @param aEndOffset [in] end offset for the new selection
* @param aSelectionsCount [in] expected number of selections after addSelection
*/
function testTextAddSelection(aID, aStartOffset, aEndOffset, aSelectionsCount)
{
var acc = getAccessible(aID, [nsIAccessibleText]);
var text = acc.getText(0, -1);
acc.addSelection(aStartOffset, aEndOffset);
ok(acc.selectionCount, aSelectionsCount,
text + ": failed to add selection from offset '" + aStartOffset +
"' to offset '" + aEndOffset + "': selectionCount after");
}
/**
* Test removeSelection method.
*
* @param aID [in] Id, DOM node, or acc obj
* @param aSelectionIndex [in] index of the selection to be removed
* @param aSelectionsCount [in] expected number of selections after
* removeSelection
*/
function testTextRemoveSelection(aID, aSelectionIndex, aSelectionsCount)
{
var acc = getAccessible(aID, [nsIAccessibleText]);
var text = acc.getText(0, -1);
acc.removeSelection(aSelectionIndex);
ok(acc.selectionCount, aSelectionsCount,
text + ": failed to remove selection at index '" +
aSelectionIndex + "': selectionCount after");
}
/**
* Test setSelectionBounds method.
*
* @param aID [in] Id, DOM node, or acc obj
* @param aStartOffset [in] new start offset for the selection
* @param aEndOffset [in] new end offset for the selection
* @param aSelectionIndex [in] index of the selection to set
* @param aSelectionsCount [in] expected number of selections after
* setSelectionBounds
*/
function testTextSetSelection(aID, aStartOffset, aEndOffset,
aSelectionIndex, aSelectionsCount)
{
var acc = getAccessible(aID, [nsIAccessibleText]);
var text = acc.getText(0, -1);
acc.setSelectionBounds(aSelectionIndex, aStartOffset, aEndOffset);
is(acc.selectionCount, aSelectionsCount,
text + ": failed to set selection at index '" +
aSelectionIndex + "': selectionCount after");
}
/**
* Test selectionCount method.
*
* @param aID [in] Id, DOM node, or acc obj
* @param aCount [in] expected selection count
*/
function testTextSelectionCount(aID, aCount)
{
var acc = getAccessible(aID, [nsIAccessibleText]);
var text = acc.getText(0, -1);
is(acc.selectionCount, aCount, text + ": wrong selectionCount: ");
}
/**
* Test getSelectionBounds method.
*
* @param aID [in] Id, DOM node, or acc obj
* @param aStartOffset [in] expected start offset for the selection
* @param aEndOffset [in] expected end offset for the selection
* @param aSelectionIndex [in] index of the selection to get
*/
function testTextGetSelection(aID, aStartOffset, aEndOffset, aSelectionIndex)
{
var acc = getAccessible(aID, [nsIAccessibleText]);
var text = acc.getText(0, -1);
var startObj = {}, endObj = {};
acc.getSelectionBounds(aSelectionIndex, startObj, endObj);
is(startObj.value, aStartOffset, text + ": wrong start offset for index '" +
aSelectionIndex + "'");
is(endObj.value, aEndOffset, text + ": wrong end offset for index '" +
aSelectionIndex + "'");
}
////////////////////////////////////////////////////////////////////////////////
// Private

View File

@ -50,6 +50,7 @@ _TEST_FILES = \
test_doc.html \
test_hypertext.html \
test_passwords.html \
test_selection.html \
test_singleline.html \
test_whitespaces.html \
test_words.html \

View File

@ -0,0 +1,101 @@
<!DOCTYPE html>
<html>
<head>
<title>Test text selection functions</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../text.js"></script>
<script type="application/javascript">
function doTest()
{
// Test selection count: clean selection / check count.
testTextAddSelection("div0", 0, 2, 1); // |Test selection...
cleanTextSelections("div0");
testTextSelectionCount("div0", 0);
// Test addition: adding two equal selections, the second one should
// not be added.
testTextAddSelection("div1", 7, 9, 1); // Test ad|di|ng two...
testTextAddSelection("div1", 7, 9, 1); // Test ad|di|ng two...
testTextGetSelection("div1", 7, 9, 0);
// Test overlapping selections: adding three selections, one adjacent.
testTextAddSelection("div2", 0, 3, 1); // |Tes|t adding 3...
testTextAddSelection("div2", 7, 9, 2); // |Tes|t ad|di|ng 3...
testTextAddSelection("div2", 3, 4, 3); // |Tes||t| ad|di|ng 3...
testTextGetSelection("div2", 0, 3, 0);
testTextGetSelection("div2", 3, 4, 1);
testTextGetSelection("div2", 7, 9, 2);
// Test selection re-ordering: adding two selections.
// NOTE: removeSelections aSelectionIndex is from start of document.
testTextAddSelection("div3", 0, 3, 1); // |Tes|t adding 2...
testTextAddSelection("div3", 7, 9, 2); // |Tes|t ad|di|ng 2...
testTextRemoveSelection("div3", 4, 1); // Test ad|di|ng 2...
// Test extending existing selection.
// NOTE: setSelectionBounds aSelectionIndex is from start of document.
testTextAddSelection("div4", 4, 5, 1); // Test| |extending...
testTextSetSelection("div4", 4, 9, 6, 1); // Test| exte|nding...
// Test moving an existing selection.
// NOTE: setSelectionBounds aSelectionIndex is from start of document.
testTextAddSelection("div5", 1, 3, 1); // T|es|t moving...
testTextSetSelection("div5", 5, 9, 6, 1); // Test |movi|ng...
// Test adding selections to multiple inner elements.
testTextAddSelection("div71", 0, 3, 1); // |Tes|t adding...
testTextAddSelection("div71", 7, 8, 2); // |Tes|t ad|d|ing...
testTextAddSelection("div72", 4, 6, 1); // Test| a|dding...
testTextAddSelection("div72", 7, 8, 2); // Test| a|d|d|ing...
// Test adding selection to parent element.
// NOTE: If inner elements are represented as embedded chars
// we count their internal selections.
testTextAddSelection("div7", 7, 8, 5); // Test ad|d|ing...
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="div0">Test selection count</div>
</br>
<div id="div1">Test adding two equal selections </div>
<div id="div2">Test adding 3 selections one adjacent </div>
<div id="div3">Test adding 2 selections, remove first one </div>
<div id="div4">Test extending a selection </div>
<div id="div5">Test moving a selection </div>
</br>
<div id="div7">Test adding selections to parent element
<div id="div71">Test adding selections to inner element1 </div>
<div id="div72">Test adding selections to inner element2 </div>
</div>
</body>
</html>

View File

@ -512,3 +512,5 @@ pref("extensions.getAddons.cache.enabled", false);
pref("ui.click_hold_context_menus", true);
pref("ui.click_hold_context_menus.delay", 1000);
// Enable device storage
pref("device.storage.enabled", true);

View File

@ -54,7 +54,7 @@ function addPermissions(urls) {
'indexedDB', 'indexedDB-unlimited', 'webapps-manage', 'offline-app', 'pin-app',
'websettings-read', 'websettings-readwrite',
'content-camera', 'webcontacts-manage', 'wifi-manage', 'desktop-notification',
'geolocation'
'geolocation', 'device-storage'
];
urls.forEach(function(url) {
url = url.trim();
@ -649,7 +649,7 @@ SettingsListener.observe('language.current', 'en-US', function(value) {
['ril.data.apn', 'ril.data.user', 'ril.data.passwd'].forEach(function(key) {
SettingsListener.observe(key, false, function(value) {
Services.prefs.setBoolPref(key, value);
Services.prefs.setCharPref(key, value);
});
});
})();

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1335396801000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
<emItems>
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
<versionRange minVersion="0" maxVersion="*">
@ -23,6 +23,24 @@
</emItem>
<emItem blockID="i43" id="supportaccessplugin@gmail.com">
</emItem>
<emItem blockID="i47" id="youtube@youtube2.com">
</emItem>
<emItem blockID="i88" id="anttoolbar@ant.com">
<versionRange minVersion="2.4.6.4" maxVersion="2.4.6.4" severity="1">
</versionRange>
</emItem>
<emItem blockID="i38" id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
<versionRange minVersion="0.1" maxVersion="3.3.0.*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1" maxVersion="*" />
</targetApplication>
</versionRange>
<versionRange minVersion="3.3.1" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="5.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i65" id="activity@facebook.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
@ -55,10 +73,29 @@
</emItem>
<emItem blockID="i10" id="{8CE11043-9A15-4207-A565-0C94C42D590D}">
</emItem>
<emItem blockID="i1" id="mozilla_cc@internetdownloadmanager.com">
<versionRange minVersion="2.1" maxVersion="3.3">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
<versionRange minVersion=" " maxVersion="6.9.8">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i63" id="youtube@youtuber.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i46" id="{841468a1-d7f4-4bd3-84e6-bb0f13a06c64}">
<versionRange minVersion="0.1" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="9.0a1" maxVersion="9.0" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i18" id="msntoolbar@msn.com">
<versionRange minVersion=" " maxVersion="6.*">
</versionRange>
@ -73,8 +110,18 @@
<versionRange minVersion="3.4.1" maxVersion="3.4.1.194" severity="1">
</versionRange>
</emItem>
<emItem blockID="i77" id="{fa277cfc-1d75-4949-a1f9-4ac8e41b2dfd}">
<versionRange minVersion="0" maxVersion="*">
<emItem blockID="i4" id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
<versionRange minVersion="1.2" maxVersion="1.2">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i75" os="Darwin,Linux" id="firebug@software.joehewitt.com">
<versionRange minVersion="1.9.0" maxVersion="1.9.0" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="9.0a1" maxVersion="9.*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i40" id="{28387537-e3f9-4ed7-860c-11e69af4a8a0}">
@ -97,16 +144,18 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i70" id="psid-vhvxQHMZBOzUZA@jetpack">
<versionRange minVersion="0" maxVersion="*" severity="1">
<emItem blockID="i51" id="admin@youtubeplayer.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i68" id="flashupdate@adobe.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i7" id="{2224e955-00e9-4613-a844-ce69fccaae91}">
</emItem>
<emItem blockID="i90" id="videoplugin@player.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i84" id="pink@rosaplugin.info">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
@ -119,20 +168,35 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i56" id="flash@adobe.com">
<versionRange minVersion="0" maxVersion="*">
<emItem blockID="i23" id="firefox@bandoo.com">
<versionRange minVersion="5.0" maxVersion="5.0" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i55" id="youtube@youtube7.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i47" id="youtube@youtube2.com">
</emItem>
<emItem blockID="i87" os="WINNT" id="afurladvisor@anchorfree.com">
<versionRange minVersion="0" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="13.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i22" id="ShopperReports@ShopperReports.com">
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0">
</versionRange>
</emItem>
<emItem blockID="i2" id="fdm_ffext@freedownloadmanager.org">
<versionRange minVersion="1.0" maxVersion="1.3.1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i44" id="sigma@labs.mozilla">
</emItem>
<emItem blockID="i5" id="support@daemon-tools.cc">
@ -157,6 +221,10 @@
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1">
</versionRange>
</emItem>
<emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
<versionRange minVersion="2.2" maxVersion="2.2">
</versionRange>
</emItem>
<emItem blockID="i76" id="crossriderapp3924@crossrider.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
@ -169,8 +237,19 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
<versionRange minVersion="2.2" maxVersion="2.2">
<emItem blockID="i70" id="psid-vhvxQHMZBOzUZA@jetpack">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i56" id="flash@adobe.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i45" id="{22119944-ED35-4ab1-910B-E619EA06A115}">
<versionRange minVersion="0.1" maxVersion="7.6.1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="8.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i82" id="{8f42fb8b-b6f6-45de-81c0-d6d39f54f971}">
@ -189,31 +268,85 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i51" id="admin@youtubeplayer.com">
<emItem blockID="i7" id="{2224e955-00e9-4613-a844-ce69fccaae91}">
</emItem>
<emItem blockID="i77" id="{fa277cfc-1d75-4949-a1f9-4ac8e41b2dfd}">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i11" id="yslow@yahoo-inc.com">
<versionRange minVersion="2.0.5" maxVersion="2.0.5">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.5.7" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i52" id="ff-ext@youtube">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i24" id="{6E19037A-12E3-4295-8915-ED48BC341614}">
<versionRange minVersion="0.1" maxVersion="1.3.328.4" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i15" id="personas@christopher.beard">
<versionRange minVersion="1.6" maxVersion="1.6">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6" maxVersion="3.6.*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i21" id="support@update-firefox.com">
</emItem>
</emItems>
<pluginItems>
<pluginItem blockID="p26">
<match name="name" exp="^Yahoo Application State Plugin$" /> <match name="description" exp="^Yahoo Application State Plugin$" /> <match name="filename" exp="npYState.dll" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p27">
<match name="name" exp="QuickTime Plug-in 7[.]1[.]" /> <match name="filename" exp="npqtplugin.?[.]dll" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p28">
<match name="filename" exp="NPFFAddOn.dll" /> </pluginItem>
<pluginItem blockID="p31">
<match name="filename" exp="NPMySrch.dll" /> </pluginItem>
<pluginItem blockID="p32">
<match name="filename" exp="npViewpoint.dll" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0" maxVersion="*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p33">
<match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+" /> <match name="filename" exp="npdeploytk.dll" /> <versionRange severity="1"></versionRange>
</pluginItem>
<pluginItem blockID="p34">
<match name="filename" exp="[Nn][Pp][Jj][Pp][Ii]1[56]0_[0-9]+\.[Dd][Ll][Ll]" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p80">
<match name="description" exp="[^\d\._]((0(\.\d+(\.\d+([_\.]\d+)?)?)?)|(1\.(([0-5](\.\d+([_\.]\d+)?)?)|(6(\.0([_\.](0?\d|1\d|2\d|30))?)?)|(7(\.0([_\.][0-2])?)?))))([^\d\._]|$)" /> <match name="filename" exp="(npjp2\.dll)|(libnpjp2\.so)" /> <versionRange severity="1"></versionRange>
<match name="name" exp="\(TM\)" /> <match name="description" exp="[^\d\._]((0(\.\d+(\.\d+([_\.]\d+)?)?)?)|(1\.(([0-5](\.\d+([_\.]\d+)?)?)|(6(\.0([_\.](0?\d|1\d|2\d|30))?)?)|(7(\.0([_\.][0-2])?)?))))([^\d\._]|$)" /> <match name="filename" exp="(npjp2\.dll)|(libnpjp2\.so)" /> <versionRange severity="1"></versionRange>
</pluginItem>
<pluginItem blockID="p85">
<match name="filename" exp="JavaPlugin2_NPAPI\.plugin" /> <versionRange minVersion="0" maxVersion="12.9.0" severity="1"></versionRange>
<match name="filename" exp="JavaPlugin2_NPAPI\.plugin" /> <versionRange minVersion="0" maxVersion="13.6.0" severity="1"></versionRange>
</pluginItem>
<pluginItem os="Darwin" blockID="p89">
<match name="filename" exp="AdobePDFViewerNPAPI\.plugin" /> <versionRange minVersion="0" maxVersion="10.1.3" severity="1"></versionRange>
</pluginItem>
</pluginItems>

View File

@ -631,6 +631,9 @@ pref("browser.preferences.animateFadeIn", true);
pref("browser.preferences.animateFadeIn", false);
#endif
// Toggles between the two Preferences implementations, pop-up window and in-content
pref("browser.preferences.inContent", false);
pref("browser.download.show_plugins_in_list", true);
pref("browser.download.hide_plugins_without_extensions", true);
@ -1039,12 +1042,17 @@ pref("services.sync.prefs.sync.xpinstall.whitelist.required", true);
// Disable the error console
pref("devtools.errorconsole.enabled", false);
// Enable the developer toolbar
pref("devtools.toolbar.enabled", false);
// Enable the Inspector
pref("devtools.inspector.enabled", true);
pref("devtools.inspector.htmlHeight", 112);
pref("devtools.inspector.htmlPanelOpen", false);
pref("devtools.inspector.sidebarOpen", false);
pref("devtools.inspector.activeSidebar", "ruleview");
pref("devtools.inspector.highlighterShowVeil", true);
pref("devtools.inspector.highlighterShowInfobar", true);
// Enable the Layout View
pref("devtools.layoutview.enabled", false);
@ -1085,8 +1093,14 @@ pref("devtools.styleeditor.transitions", true);
// Enable tools for Chrome development.
pref("devtools.chrome.enabled", false);
// Disable the GCLI enhanced command line.
pref("devtools.gcli.enable", false);
// Display the introductory text
pref("devtools.gcli.hideIntro", false);
// How eager are we to show help: never=1, sometimes=2, always=3
pref("devtools.gcli.eagerHelper", 2);
// Do we allow the 'pref set' command
pref("devtools.gcli.allowSet", false);
// The last Web Console height. This is initially 0 which means that the Web
// Console will use the default height next time it shows.

View File

@ -65,6 +65,11 @@
margin: 0 40px;
}
.text-link:-moz-focusring,
.bottom-link:-moz-focusring {
outline: 1px dotted;
}
#currentChannel {
margin: 0;
padding: 0;

View File

@ -153,7 +153,7 @@ function appUpdater()
if (this.isPending) {
this.setupUpdateButton("update.restart." +
(this.isMajor ? "upgradeButton" : "applyButton"));
(this.isMajor ? "upgradeButton" : "updateButton"));
return;
}
@ -542,7 +542,7 @@ appUpdater.prototype =
this.removeDownloadListener();
this.selectPanel("updateButtonBox");
this.setupUpdateButton("update.restart." +
(this.isMajor ? "upgradeButton" : "applyButton"));
(this.isMajor ? "upgradeButton" : "updateButton"));
break;
default:
this.removeDownloadListener();

View File

@ -176,8 +176,14 @@
<menuseparator class="appmenu-menuseparator"/>
<menu id="appmenu_webDeveloper"
label="&appMenuWebDeveloper.label;">
<menupopup id="appmenu_webDeveloper_popup"
onpopupshowing="onWebDeveloperMenuShowing();">
<menupopup id="appmenu_webDeveloper_popup">
<menuitem id="appmenu_devToolbar"
type="checkbox"
autocheck="false"
hidden="true"
label="&devToolbarMenu.label;"
command="Tools:DevToolbar"
key="key_devToolbar"/>
<menuitem id="appmenu_webConsole"
label="&webConsoleCmd.label;"
type="checkbox"
@ -191,6 +197,7 @@
key="key_inspect"/>
<menuitem id="appmenu_debugger"
hidden="true"
type="checkbox"
label="&debuggerMenu.label;"
key="key_debugger"
command="Tools:Debugger"/>

View File

@ -531,8 +531,15 @@
<menu id="webDeveloperMenu"
label="&webDeveloperMenu.label;"
accesskey="&webDeveloperMenu.accesskey;">
<menupopup id="menuWebDeveloperPopup"
onpopupshowing="onWebDeveloperMenuShowing();">
<menupopup id="menuWebDeveloperPopup">
<menuitem id="menu_devToolbar"
type="checkbox"
autocheck="false"
hidden="true"
label="&devToolbarMenu.label;"
accesskey="&devToolbarMenu.accesskey;"
key="key_devToolbar"
command="Tools:DevToolbar"/>
<menuitem id="webConsole"
type="checkbox"
label="&webConsoleCmd.label;"
@ -548,6 +555,7 @@
command="Tools:Inspect"/>
<menuitem id="menu_debugger"
hidden="true"
type="checkbox"
label="&debuggerMenu.label;"
key="key_debugger"
command="Tools:Debugger"/>

View File

@ -725,7 +725,7 @@ HistoryMenu.prototype = {
let placesNode = aEvent.target._placesNode;
if (placesNode) {
PlacesUIUtils.markPageAsTyped(placesNode.uri);
openUILink(placesNode.uri, aEvent, false, true);
openUILink(placesNode.uri, aEvent, { ignoreAlt: true });
}
}
};

View File

@ -126,6 +126,7 @@
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
<command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();" disabled="true"/>
<command id="Tools:WebConsole" oncommand="HUDConsoleUI.toggleHUD();"/>
<command id="Tools:Inspect" oncommand="InspectorUI.toggleInspectorUI();" disabled="true"/>
<command id="Tools:Debugger" oncommand="DebuggerUI.toggleDebugger();" disabled="true"/>
@ -164,6 +165,10 @@
oncommand="InspectorUI.copyOuterHTML();"/>
<command id="Inspector:DeleteNode"
oncommand="InspectorUI.deleteNode();"/>
<command id="Inspector:ToggleVeil"
oncommand="InspectorUI.toggleVeil();"/>
<command id="Inspector:ToggleInfobar"
oncommand="InspectorUI.toggleInfobar();"/>
</commandset>
<broadcasterset id="mainBroadcasterSet">
@ -257,6 +262,13 @@
#endif
<key id="key_openAddons" key="&addons.commandkey;" command="Tools:Addons" modifiers="accel,shift"/>
<key id="key_errorConsole" key="&errorConsoleCmd.commandkey;" oncommand="toJavaScriptConsole();" modifiers="accel,shift" disabled="true"/>
<key id="key_devToolbar" key="&devToolbar.commandkey;" command="Tools:DevToolbar"
#ifdef XP_MACOSX
modifiers="accel,alt"
#else
modifiers="accel,shift"
#endif
/>
<key id="key_webConsole" key="&webConsoleCmd.commandkey;" oncommand="HUDConsoleUI.toggleHUD();"
#ifdef XP_MACOSX
modifiers="accel,alt"

View File

@ -179,6 +179,12 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
}
});
XPCOMUtils.defineLazyGetter(this, "DeveloperToolbar", function() {
let tmp = {};
Cu.import("resource:///modules/devtools/DeveloperToolbar.jsm", tmp);
return new tmp.DeveloperToolbar(window, document.getElementById("developer-toolbar"));
});
XPCOMUtils.defineLazyGetter(this, "InspectorUI", function() {
let tmp = {};
Cu.import("resource:///modules/inspector.jsm", tmp);
@ -1695,6 +1701,16 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
setUrlAndSearchBarWidthForConditionalForwardButton();
});
// Enable developer toolbar?
let devToolbarEnabled = gPrefService.getBoolPref("devtools.toolbar.enabled");
if (devToolbarEnabled) {
document.getElementById("menu_devToolbar").hidden = false;
document.getElementById("Tools:DevToolbar").removeAttribute("disabled");
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_devToolbar").hidden = false;
#endif
}
// Enable Inspector?
let enabled = gPrefService.getBoolPref("devtools.inspector.enabled");
if (enabled) {
@ -1703,6 +1719,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_pageInspect").hidden = false;
#endif
document.getElementById("developer-toolbar-inspector").hidden = false;
}
// Enable Debugger?
@ -1713,6 +1730,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_debugger").hidden = false;
#endif
document.getElementById("developer-toolbar-debugger").hidden = false;
}
// Enable Remote Debugger?
@ -4516,7 +4534,8 @@ var XULBrowserWindow = {
startTime: 0,
statusText: "",
isBusy: false,
inContentWhitelist: ["about:addons", "about:permissions", "about:sync-progress"],
inContentWhitelist: ["about:addons", "about:permissions",
"about:sync-progress", "about:preferences"],
QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsIWebProgressListener) ||
@ -7292,10 +7311,13 @@ var gPluginHandler = {
}
let overlay = doc.getAnonymousElementByAttribute(aPlugin, "class", "mainBox");
overlay.addEventListener("click", function(aEvent) {
if (aEvent.button == 0 && aEvent.isTrusted)
gPluginHandler.activatePlugins(aEvent.target.ownerDocument.defaultView.top);
}, true);
// The overlay is null if the XBL binding is not attached (element is display:none).
if (overlay) {
overlay.addEventListener("click", function(aEvent) {
if (aEvent.button == 0 && aEvent.isTrusted)
gPluginHandler.activatePlugins(aEvent.target.ownerDocument.defaultView.top);
}, true);
}
if (!browser._clickToPlayDoorhangerShown)
gPluginHandler._showClickToPlayNotification(browser);
@ -7347,6 +7369,7 @@ var gPluginHandler = {
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
if (notification)
notification.remove();
gPluginHandler._removeClickToPlayOverlays(contentWindow);
}
}];
let options = { dismissed: true };
@ -7355,6 +7378,16 @@ var gPluginHandler = {
mainAction, secondaryActions, options);
},
_removeClickToPlayOverlays: function PH_removeClickToPlayOverlays(aContentWindow) {
let doc = aContentWindow.document;
let cwu = aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
for (let plugin of cwu.plugins) {
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
overlay.style.visibility = "hidden";
}
},
// event listener for missing/blocklisted/outdated/carbonFailure plugins.
pluginUnavailable: function (plugin, eventType) {
let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument
@ -7843,7 +7876,7 @@ var FeedHandler = {
loadFeed: function(href, event) {
var feeds = gBrowser.selectedBrowser.feeds;
try {
openUILink(href, event, false, true, false, null);
openUILink(href, event, { ignoreAlt: true });
}
finally {
// We might default to a livebookmarks modal dialog,
@ -9309,10 +9342,6 @@ var StyleEditor = {
}
};
function onWebDeveloperMenuShowing() {
document.getElementById("Tools:WebConsole").setAttribute("checked", HUDConsoleUI.getOpenHUD() != null);
}
XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () {
#ifdef XP_WIN

View File

@ -1015,9 +1015,28 @@
hidden="true">
#ifdef XP_MACOSX
<toolbarbutton id="highlighter-closebutton"
class="devtools-closebutton"
oncommand="InspectorUI.closeInspectorUI(false);"
tooltiptext="&inspectCloseButton.tooltiptext;"/>
#endif
<toolbarbutton id="inspector-option-toolbarbutton"
type="menu"
tabindex="0"
tooltiptext="&inspectOptionButton.tooltiptext;">
<menupopup id="inspector-option-popup"
position="before_start">
<menuitem id="inspectorToggleVeil"
type="checkbox"
label="&inspectorToggleVeil.label;"
accesskey="&inspectorToggleVeil.accesskey;"
command="Inspector:ToggleVeil"/>
<menuitem id="inspectorToggleInfobar"
type="checkbox"
label="&inspectorToggleInfobar.label;"
accesskey="&inspectorToggleInfobar.accesskey;"
command="Inspector:ToggleInfobar"/>
</menupopup>
</toolbarbutton>
<toolbarbutton id="inspector-inspect-toolbutton"
class="devtools-toolbarbutton"
command="Inspector:Inspect"/>
@ -1048,10 +1067,46 @@
</hbox>
#ifndef XP_MACOSX
<toolbarbutton id="highlighter-closebutton"
class="devtools-closebutton"
oncommand="InspectorUI.closeInspectorUI(false);"
tooltiptext="&inspectCloseButton.tooltiptext;"/>
#endif
</toolbar>
<toolbar id="developer-toolbar"
class="devtools-toolbar"
hidden="true">
#ifdef XP_MACOSX
<toolbarbutton id="developer-toolbar-closebutton"
oncommand="DeveloperToolbar.hide();"
tooltiptext="&devToolbarCloseButton.tooltiptext;"/>
#endif
<stack class="gclitoolbar-stack-node" flex="1">
<description class="gclitoolbar-prompt">&#187;</description>
<description class="gclitoolbar-complete-node"/>
<textbox class="gclitoolbar-input-node" rows="1"/>
</stack>
<toolbarbutton id="developer-toolbar-webconsole"
label="&webConsoleButton.label;"
class="devtools-toolbarbutton"
command="Tools:WebConsole"/>
<toolbarbutton id="developer-toolbar-inspector"
label="&inspectorButton.label;"
class="devtools-toolbarbutton"
hidden="true"
command="Tools:Inspect"/>
<toolbarbutton id="developer-toolbar-debugger"
label="&scriptsButton.label;"
class="devtools-toolbarbutton"
hidden="true"
command="Tools:Debugger"/>
#ifndef XP_MACOSX
<toolbarbutton id="developer-toolbar-closebutton"
oncommand="DeveloperToolbar.hide();"
tooltiptext="&devToolbarCloseButton.tooltiptext;"/>
#endif
</toolbar>
<toolbar id="addon-bar"
toolbarname="&addonBarCmd.label;" accesskey="&addonBarCmd.accesskey;"
collapsed="true"

View File

@ -12,6 +12,11 @@
overflow: hidden;
}
#highlighter-veil-container:not([dim]) > .highlighter-veil,
#highlighter-veil-container:not([dim]) > hbox > .highlighter-veil {
visibility: hidden;
}
#highlighter-veil-container:not([disable-transitions]) > .highlighter-veil,
#highlighter-veil-container:not([disable-transitions]) > #highlighter-veil-middlebox,
#highlighter-veil-container:not([disable-transitions]) > #highlighter-veil-middlebox > .highlighter-veil,
@ -101,6 +106,10 @@ html|*#highlighter-nodeinfobar-tagname {
display: none;
}
#inspector-option-toolbarbutton > .toolbarbutton-menu-dropmarker {
display: none;
}
#inspector-layoutview-container > iframe {
-moz-transition-property: height;
-moz-transition-duration: 0.1s;

View File

@ -77,8 +77,8 @@ function initFeedTab()
function onSubscribeFeed()
{
var listbox = document.getElementById("feedListbox");
openUILink(listbox.selectedItem.getAttribute("feedURL"),
null, false, true, false, null);
openUILinkIn(listbox.selectedItem.getAttribute("feedURL"), "current",
{ ignoreAlt: true });
}
function addRow(name, type, url)

View File

@ -181,6 +181,7 @@ _BROWSER_FILES = \
browser_bug664672.js \
browser_bug710878.js \
browser_bug719271.js \
browser_bug735471.js \
browser_bug743421.js \
browser_bug749738.js \
browser_canonizeURL.js \

View File

@ -0,0 +1,59 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/.
*/
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
// Reset pref to its default
Services.prefs.clearUserPref("browser.preferences.inContent");
});
// Verify that about:preferences tab is displayed when
// browser.preferences.inContent is set to true
Services.prefs.setBoolPref("browser.preferences.inContent", true);
gBrowser.tabContainer.addEventListener("TabOpen", function(aEvent) {
gBrowser.tabContainer.removeEventListener("TabOpen", arguments.callee, true);
let browser = aEvent.originalTarget.linkedBrowser;
browser.addEventListener("load", function(aEvent) {
browser.removeEventListener("load", arguments.callee, true);
is(Services.prefs.getBoolPref("browser.preferences.inContent"), true, "In-content prefs are enabled");
is(browser.contentWindow.location.href, "about:preferences", "Checking if the preferences tab was opened");
gBrowser.removeCurrentTab();
Services.prefs.setBoolPref("browser.preferences.inContent", false);
openPreferences();
}, true);
}, true);
let observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
windowWatcher.unregisterNotification(observer);
let win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
is(Services.prefs.getBoolPref("browser.preferences.inContent"), false, "In-content prefs are disabled");
is(win.location.href, "chrome://browser/content/preferences/preferences.xul", "Checking if the preferences window was opened");
win.close();
finish();
}, false);
}
}
}
var windowWatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
windowWatcher.registerNotification(observer);
openPreferences();
}

View File

@ -187,5 +187,30 @@ function run_http_test4() {
function run_chrome_about_test_4() {
info("Chrome about: tests");
test_url("about:Addons", true, end_test);
test_url("about:Addons", true, run_http_test5);
}
function run_http_test5() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_5);
}
// Should hide the chrome
function run_chrome_about_test_5() {
info("Chrome about: tests");
test_url("about:preferences", true, function(){
info("Tabs on bottom");
TabsOnTop.enabled = false;
run_http_test6();
});
}
function run_http_test6() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_6);
}
function run_chrome_about_test_6() {
info("Chrome about: tests");
test_url("about:preferences", true, end_test);
}

View File

@ -383,6 +383,8 @@ function test13b() {
var plugin = gTestBrowser.contentDocument.getElementById("test");
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 13b, Plugin should not be activated");
var overlay = gTestBrowser.contentDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay.style.visibility == "hidden", "Test 13b, Plugin should not have visible overlay");
gNextTest = test13c;
gTestBrowser.reload();
@ -395,6 +397,8 @@ function test13c() {
var plugin = gTestBrowser.contentDocument.getElementById("test");
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 13c, Plugin should not be activated");
var overlay = gTestBrowser.contentDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay.style.visibility == "hidden", "Test 13c, Plugin should not have visible overlay");
Services.perms.removeAll();
Services.prefs.setBoolPref("plugins.click_to_play", false);

View File

@ -261,7 +261,6 @@ var tests = [
// switch back to the old browser
gBrowser.selectedTab = this.oldSelectedTab;
},
onHidden: function (popup) {
// actually remove the notification to prevent it from reappearing
@ -601,14 +600,10 @@ var tests = [
// Test notification when chrome is hidden
{ // Test #19
run: function () {
this.oldSelectedTab = gBrowser.selectedTab;
gBrowser.selectedTab = gBrowser.addTab("about:blank");
let self = this;
loadURI("about:addons", function() {
self.notifyObj = new basicNotification();
self.notification = showNotification(self.notifyObj);
});
window.locationbar.visible = false;
this.notifyObj = new basicNotification();
this.notification = showNotification(this.notifyObj);
window.locationbar.visible = true;
},
onShown: function (popup) {
checkPopup(popup, this.notifyObj);
@ -619,9 +614,6 @@ var tests = [
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
this.notification.remove();
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.selectedTab = this.oldSelectedTab;
}
},
// Test notification is removed when dismissed if removeOnDismissal is true

View File

@ -495,27 +495,31 @@ function openAboutDialog() {
function openPreferences(paneID, extraArgs)
{
var instantApply = getBoolPref("browser.preferences.instantApply", false);
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
openUILinkIn("about:preferences", "tab");
} else {
var instantApply = getBoolPref("browser.preferences.instantApply", false);
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
if (win) {
win.focus();
if (paneID) {
var pane = win.document.getElementById(paneID);
win.document.documentElement.showPane(pane);
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
if (win) {
win.focus();
if (paneID) {
var pane = win.document.getElementById(paneID);
win.document.documentElement.showPane(pane);
}
if (extraArgs && extraArgs["advancedTab"]) {
var advancedPaneTabs = win.document.getElementById("advancedPrefs");
advancedPaneTabs.selectedTab = win.document.getElementById(extraArgs["advancedTab"]);
}
return win;
}
if (extraArgs && extraArgs["advancedTab"]) {
var advancedPaneTabs = win.document.getElementById("advancedPrefs");
advancedPaneTabs.selectedTab = win.document.getElementById(extraArgs["advancedTab"]);
}
return win;
return openDialog("chrome://browser/content/preferences/preferences.xul",
"Preferences", features, paneID, extraArgs);
}
return openDialog("chrome://browser/content/preferences/preferences.xul",
"Preferences", features, paneID, extraArgs);
}
function openAdvancedPreferences(tabID)

View File

@ -109,6 +109,8 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT },
{ "permissions", "chrome://browser/content/preferences/aboutPermissions.xul",
nsIAboutModule::ALLOW_SCRIPT },
{ "preferences", "chrome://browser/content/preferences/in-content/preferences.xul",
nsIAboutModule::ALLOW_SCRIPT },
};
static const int kRedirTotal = NS_ARRAY_LENGTH(kRedirMap);

View File

@ -139,6 +139,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "preferences", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#if defined(XP_WIN) && !defined(__MINGW32__)
{ NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },
#elif defined(XP_MACOSX)

View File

@ -290,14 +290,33 @@ function openWindow(parent, url, target, features, args, noExternalArgs) {
}
function openPreferences() {
var features = "chrome,titlebar,toolbar,centerscreen,dialog=no";
var url = "chrome://browser/content/preferences/preferences.xul";
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
var sa = Components.classes["@mozilla.org/supports-array;1"]
.createInstance(Components.interfaces.nsISupportsArray);
var win = getMostRecentWindow("Browser:Preferences");
if (win) {
win.focus();
var wuri = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
wuri.data = "about:preferences";
sa.AppendElement(wuri);
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(nsIWindowWatcher);
wwatch.openWindow(null, gBrowserContentHandler.chromeURL,
"_blank",
"chrome,dialog=no,all",
sa);
} else {
openWindow(null, url, "_blank", features);
var features = "chrome,titlebar,toolbar,centerscreen,dialog=no";
var url = "chrome://browser/content/preferences/preferences.xul";
var win = getMostRecentWindow("Browser:Preferences");
if (win) {
win.focus();
} else {
openWindow(null, url, "_blank", features);
}
}
}

View File

@ -43,6 +43,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = \
in-content \
$(NULL)
TEST_DIRS += tests
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,23 @@
# -- This Source Code Form is subject to the terms of the Mozilla Public
# - License, v. 2.0. If a copy of the MPL was not distributed with this file,
# - You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
TEST_DIRS += tests
include $(topsrcdir)/config/rules.mk
DEFINES += \
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-DMOZ_MACBUNDLE_NAME=$(MOZ_MACBUNDLE_NAME) \
$(NULL)
ifneq (,$(filter windows gtk2 cocoa, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DHAVE_SHELL_SERVICE=1
endif

View File

@ -0,0 +1,703 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// Load DownloadUtils module for convertByteUnits
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
var gAdvancedPane = {
_inited: false,
/**
* Brings the appropriate tab to the front and initializes various bits of UI.
*/
init: function ()
{
this._inited = true;
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
if (preference.value !== null)
advancedPrefs.selectedIndex = preference.value;
#ifdef MOZ_UPDATER
this.updateReadPrefs();
#endif
this.updateOfflineApps();
#ifdef MOZ_CRASHREPORTER
this.initSubmitCrashes();
#endif
this.updateActualCacheSize("disk");
this.updateActualCacheSize("offline");
},
/**
* Stores the identity of the current tab in preferences so that the selected
* tab can be persisted between openings of the preferences window.
*/
tabSelectionChanged: function ()
{
if (!this._inited)
return;
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
preference.valueFromPreferences = advancedPrefs.selectedIndex;
},
// GENERAL TAB
/*
* Preferences:
*
* accessibility.browsewithcaret
* - true enables keyboard navigation and selection within web pages using a
* visible caret, false uses normal keyboard navigation with no caret
* accessibility.typeaheadfind
* - when set to true, typing outside text areas and input boxes will
* automatically start searching for what's typed within the current
* document; when set to false, no search action happens
* general.autoScroll
* - when set to true, clicking the scroll wheel on the mouse activates a
* mouse mode where moving the mouse down scrolls the document downward with
* speed correlated with the distance of the cursor from the original
* position at which the click occurred (and likewise with movement upward);
* if false, this behavior is disabled
* general.smoothScroll
* - set to true to enable finer page scrolling than line-by-line on page-up,
* page-down, and other such page movements
* layout.spellcheckDefault
* - an integer:
* 0 disables spellchecking
* 1 enables spellchecking, but only for multiline text fields
* 2 enables spellchecking for all text fields
*/
/**
* Stores the original value of the spellchecking preference to enable proper
* restoration if unchanged (since we're mapping a tristate onto a checkbox).
*/
_storedSpellCheck: 0,
/**
* Returns true if any spellchecking is enabled and false otherwise, caching
* the current value to enable proper pref restoration if the checkbox is
* never changed.
*/
readCheckSpelling: function ()
{
var pref = document.getElementById("layout.spellcheckDefault");
this._storedSpellCheck = pref.value;
return (pref.value != 0);
},
/**
* Returns the value of the spellchecking preference represented by UI,
* preserving the preference's "hidden" value if the preference is
* unchanged and represents a value not strictly allowed in UI.
*/
writeCheckSpelling: function ()
{
var checkbox = document.getElementById("checkSpelling");
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
},
/**
*
*/
initSubmitCrashes: function ()
{
var checkbox = document.getElementById("submitCrashesBox");
try {
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
getService(Components.interfaces.nsICrashReporter);
checkbox.checked = cr.submitReports;
} catch (e) {
checkbox.style.display = "none";
}
},
/**
*
*/
updateSubmitCrashes: function ()
{
var checkbox = document.getElementById("submitCrashesBox");
try {
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
getService(Components.interfaces.nsICrashReporter);
cr.submitReports = checkbox.checked;
} catch (e) { }
},
/**
* When the user toggles the layers.acceleration.disabled pref,
* sync its new value to the gfx.direct2d.disabled pref too.
*/
updateHardwareAcceleration: function()
{
#ifdef XP_WIN
var fromPref = document.getElementById("layers.acceleration.disabled");
var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value;
#endif
},
// NETWORK TAB
/*
* Preferences:
*
* browser.cache.disk.capacity
* - the size of the browser cache in KB
* - Only used if browser.cache.disk.smart_size.enabled is disabled
*/
/**
* Displays a dialog in which proxy settings may be changed.
*/
showConnections: function ()
{
openDialog("chrome://browser/content/preferences/connection.xul",
"mozilla:connectionmanager",
"model=yes",
null);
},
// Retrieves the amount of space currently used by disk or offline cache
updateActualCacheSize: function (device)
{
var visitor = {
visitDevice: function (deviceID, deviceInfo)
{
if (deviceID == device) {
var actualSizeLabel = document.getElementById(device == "disk" ?
"actualDiskCacheSize" :
"actualAppCacheSize");
var sizeStrings = DownloadUtils.convertByteUnits(deviceInfo.totalSize);
var prefStrBundle = document.getElementById("bundlePreferences");
var sizeStr = prefStrBundle.getFormattedString(device == "disk" ?
"actualDiskCacheSize" :
"actualAppCacheSize",
sizeStrings);
actualSizeLabel.value = sizeStr;
}
// Do not enumerate entries
return false;
},
visitEntry: function (deviceID, entryInfo)
{
// Do not enumerate entries.
return false;
}
};
var cacheService =
Components.classes["@mozilla.org/network/cache-service;1"]
.getService(Components.interfaces.nsICacheService);
cacheService.visitEntries(visitor);
},
updateCacheSizeUI: function (smartSizeEnabled)
{
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
},
readSmartSizeEnabled: function ()
{
// The smart_size.enabled preference element is inverted="true", so its
// value is the opposite of the actual pref value
var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
this.updateCacheSizeUI(!disabled);
},
/**
* Converts the cache size from units of KB to units of MB and returns that
* value.
*/
readCacheSize: function ()
{
var preference = document.getElementById("browser.cache.disk.capacity");
return preference.value / 1024;
},
/**
* Converts the cache size as specified in UI (in MB) to KB and returns that
* value.
*/
writeCacheSize: function ()
{
var cacheSize = document.getElementById("cacheSize");
var intValue = parseInt(cacheSize.value, 10);
return isNaN(intValue) ? 0 : intValue * 1024;
},
/**
* Clears the cache.
*/
clearCache: function ()
{
var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
.getService(Components.interfaces.nsICacheService);
try {
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
} catch(ex) {}
this.updateActualCacheSize("disk");
},
/**
* Clears the application cache.
*/
clearOfflineAppCache: function ()
{
Components.utils.import("resource:///modules/offlineAppCache.jsm");
OfflineAppCacheHelper.clear();
this.updateActualCacheSize("offline");
this.updateOfflineApps();
},
readOfflineNotify: function()
{
var pref = document.getElementById("browser.offline-apps.notify");
var button = document.getElementById("offlineNotifyExceptions");
button.disabled = !pref.value;
return pref.value;
},
showOfflineExceptions: function()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible : false,
sessionVisible : false,
allowVisible : false,
prefilledHost : "",
permissionType : "offline-app",
manageCapability : Components.interfaces.nsIPermissionManager.DENY_ACTION,
windowTitle : bundlePreferences.getString("offlinepermissionstitle"),
introText : bundlePreferences.getString("offlinepermissionstext") };
openDialog("chrome://browser/content/preferences/permissions.xul",
"Browser:Permissions",
"model=yes",
params);
},
// XXX: duplicated in browser.js
_getOfflineAppUsage: function (host, groups)
{
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
if (!groups)
groups = cacheService.getGroups();
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var usage = 0;
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
if (uri.asciiHost == host) {
var cache = cacheService.getActiveCache(groups[i]);
usage += cache.usage;
}
}
var storageManager = Components.classes["@mozilla.org/dom/storagemanager;1"].
getService(Components.interfaces.nsIDOMStorageManager);
usage += storageManager.getUsage(host);
return usage;
},
/**
* Updates the list of offline applications
*/
updateOfflineApps: function ()
{
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var list = document.getElementById("offlineAppsList");
while (list.firstChild) {
list.removeChild(list.firstChild);
}
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var groups = cacheService.getGroups();
var bundle = document.getElementById("bundlePreferences");
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
if (perm.type == "offline-app" &&
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
row.setAttribute("host", perm.host);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm.host, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
list.appendChild(row);
}
}
},
offlineAppSelected: function()
{
var removeButton = document.getElementById("offlineAppsListRemove");
var list = document.getElementById("offlineAppsList");
if (list.selectedItem) {
removeButton.setAttribute("disabled", "false");
} else {
removeButton.setAttribute("disabled", "true");
}
},
removeOfflineApp: function()
{
var list = document.getElementById("offlineAppsList");
var item = list.selectedItem;
var host = item.getAttribute("host");
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
var bundle = document.getElementById("bundlePreferences");
var title = bundle.getString("offlineAppRemoveTitle");
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [host]);
var confirm = bundle.getString("offlineAppRemoveConfirm");
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
null, null, null, {});
if (result != 0)
return;
// clear offline cache entries
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
if (uri.asciiHost == host) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
}
}
// send out an offline-app-removed signal. The nsDOMStorage
// service will clear DOM storage for this host.
var obs = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
obs.notifyObservers(null, "offline-app-removed", host);
// remove the permission
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
pm.remove(host, "offline-app",
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
pm.remove(host, "offline-app",
Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
list.removeChild(item);
gAdvancedPane.offlineAppSelected();
this.updateActualCacheSize("offline");
},
// UPDATE TAB
/*
* Preferences:
*
* app.update.enabled
* - true if updates to the application are enabled, false otherwise
* extensions.update.enabled
* - true if updates to extensions and themes are enabled, false otherwise
* browser.search.update
* - true if updates to search engines are enabled, false otherwise
* app.update.auto
* - true if updates should be automatically downloaded and installed,
* possibly with a warning if incompatible extensions are installed (see
* app.update.mode); false if the user should be asked what he wants to do
* when an update is available
* app.update.mode
* - an integer:
* 0 do not warn if an update will disable extensions or themes
* 1 warn if an update will disable extensions or themes
* 2 warn if an update will disable extensions or themes *or* if the
* update is a major update
*/
#ifdef MOZ_UPDATER
/**
* Selects the item of the radiogroup, and sets the warnIncompatible checkbox
* based on the pref values and locked states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* Radiogroup i = app.update.enabled
* Warn before disabling extensions checkbox ii = app.update.auto
* iii = app.update.mode
*
* Disabled states:
* Element pref value locked disabled
* radiogroup i t/f f false
* i t/f *t* *true*
* ii t/f f false
* ii t/f *t* *true*
* iii 0/1/2 t/f false
* warnIncompatible i t f false
* i t *t* *true*
* i *f* t/f *true*
* ii t f false
* ii t *t* *true*
* ii *f* t/f *true*
* iii 0/1/2 f false
* iii 0/1/2 *t* *true*
*/
updateReadPrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual" // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
var modePref = document.getElementById("app.update.mode");
var warnIncompatible = document.getElementById("warnIncompatible");
// the warnIncompatible checkbox value is set by readAddonWarn
warnIncompatible.disabled = radiogroup.disabled || modePref.locked ||
!enabledPref.value || !autoPref.value;
#ifdef MOZ_MAINTENANCE_SERVICE
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch(e) {
}
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
#endif
},
/**
* Sets the pref values based on the selected item of the radiogroup,
* and sets the disabled state of the warnIncompatible checkbox accordingly.
*/
updateWritePrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
}
var warnIncompatible = document.getElementById("warnIncompatible");
var modePref = document.getElementById("app.update.mode");
warnIncompatible.disabled = enabledPref.locked || !enabledPref.value ||
autoPref.locked || !autoPref.value ||
modePref.locked;
},
/**
* Stores the value of the app.update.mode preference, which is a tristate
* integer preference. We store the value here so that we can properly
* restore the preference value if the UI reflecting the preference value
* is in a state which can represent either of two integer values (as
* opposed to only one possible value in the other UI state).
*/
_modePreference: -1,
/**
* Reads the app.update.mode preference and converts its value into a
* true/false value for use in determining whether the "Warn me if this will
* disable extensions or themes" checkbox is checked. We also save the value
* of the preference so that the preference value can be properly restored if
* the user's preferences cannot adequately be expressed by a single checkbox.
*
* app.update.mode Checkbox State Meaning
* 0 Unchecked Do not warn
* 1 Checked Warn if there are incompatibilities
* 2 Checked Warn if there are incompatibilities,
* or the update is major.
*/
readAddonWarn: function ()
{
var preference = document.getElementById("app.update.mode");
var warn = preference.value != 0;
gAdvancedPane._modePreference = warn ? preference.value : 1;
return warn;
},
/**
* Converts the state of the "Warn me if this will disable extensions or
* themes" checkbox into the integer preference which represents it,
* returning that value.
*/
writeAddonWarn: function ()
{
var warnIncompatible = document.getElementById("warnIncompatible");
return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
},
/**
* Displays the history of installed updates.
*/
showUpdates: function ()
{
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.showUpdateHistory(window);
},
#endif
// ENCRYPTION TAB
/*
* Preferences:
*
* security.enable_ssl3
* - true if SSL 3 encryption is enabled, false otherwise
* security.enable_tls
* - true if TLS encryption is enabled, false otherwise
* security.default_personal_cert
* - a string:
* "Select Automatically" select a certificate automatically when a site
* requests one
* "Ask Every Time" present a dialog to the user so he can select
* the certificate to use on a site which
* requests one
*/
/**
* Displays the user's certificates and associated options.
*/
showCertificates: function ()
{
openDialog("chrome://pippki/content/certManager.xul",
"mozilla:certmanager",
"model=yes", null);
},
/**
* Displays a dialog which describes the user's CRLs.
*/
showCRLs: function ()
{
openDialog("chrome://pippki/content/crlManager.xul",
"mozilla:crlmanager",
"model=yes", null);
},
/**
* Displays a dialog in which OCSP preferences can be configured.
*/
showOCSP: function ()
{
openDialog("chrome://mozapps/content/preferences/ocsp.xul",
"mozilla:crlmanager",
"model=yes", null);
},
/**
* Displays a dialog from which the user can manage his security devices.
*/
showSecurityDevices: function ()
{
openDialog("chrome://pippki/content/device_manager.xul",
"mozilla:devicemanager",
"model=yes", null);
}
#ifdef HAVE_SHELL_SERVICE
,
// SYSTEM DEFAULTS
/*
* Preferences:
*
* browser.shell.checkDefault
* - true if a default-browser check (and prompt to make it so if necessary)
* occurs at startup, false otherwise
*/
/**
* Checks whether the browser is currently registered with the operating
* system as the default browser. If the browser is not currently the
* default browser, the user is given the option of making it the default;
* otherwise, the user is informed that this browser already is the browser.
*/
checkNow: function ()
{
var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
.getService(Components.interfaces.nsIShellService);
var brandBundle = document.getElementById("bundleBrand");
var shellBundle = document.getElementById("bundleShell");
var brandShortName = brandBundle.getString("brandShortName");
var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
var promptMessage;
const IPS = Components.interfaces.nsIPromptService;
var psvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(IPS);
if (!shellSvc.isDefaultBrowser(false)) {
promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage",
[brandShortName]);
var rv = psvc.confirmEx(window, promptTitle, promptMessage,
IPS.STD_YES_NO_BUTTONS,
null, null, null, null, { });
if (rv == 0)
shellSvc.setDefaultBrowser(true, false);
}
else {
promptMessage = shellBundle.getFormattedString("alreadyDefaultBrowser",
[brandShortName]);
psvc.alert(window, promptTitle, promptMessage);
}
}
#endif
};

View File

@ -0,0 +1,429 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/advanced.js"/>
<preferences id="advancedPreferences">
<preference id="browser.preferences.advanced.selectedTabIndex"
name="browser.preferences.advanced.selectedTabIndex"
type="int"/>
<!-- General tab -->
<preference id="accessibility.browsewithcaret"
name="accessibility.browsewithcaret"
type="bool"/>
<preference id="accessibility.typeaheadfind"
name="accessibility.typeaheadfind"
type="bool"/>
<preference id="accessibility.blockautorefresh"
name="accessibility.blockautorefresh"
type="bool"/>
<preference id="general.autoScroll"
name="general.autoScroll"
type="bool"/>
<preference id="general.smoothScroll"
name="general.smoothScroll"
type="bool"/>
<preference id="layers.acceleration.disabled"
name="layers.acceleration.disabled"
type="bool"
inverted="true"
onchange="gAdvancedPane.updateHardwareAcceleration()"/>
#ifdef XP_WIN
<preference id="gfx.direct2d.disabled"
name="gfx.direct2d.disabled"
type="bool"
inverted="true"/>
#endif
<preference id="layout.spellcheckDefault"
name="layout.spellcheckDefault"
type="int"/>
#ifdef HAVE_SHELL_SERVICE
<preference id="browser.shell.checkDefaultBrowser"
name="browser.shell.checkDefaultBrowser"
type="bool"/>
<preference id="pref.general.disable_button.default_browser"
name="pref.general.disable_button.default_browser"
type="bool"/>
#endif
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
type="int"/>
<preference id="browser.offline-apps.notify"
name="browser.offline-apps.notify"
type="bool"/>
<preference id="browser.cache.disk.smart_size.enabled"
name="browser.cache.disk.smart_size.enabled"
inverted="true"
type="bool"/>
<!-- Update tab -->
#ifdef MOZ_UPDATER
<preference id="app.update.enabled"
name="app.update.enabled"
type="bool"/>
<preference id="app.update.auto"
name="app.update.auto"
type="bool"/>
<preference id="app.update.mode"
name="app.update.mode"
type="int"/>
<preference id="app.update.disable_button.showUpdateHistory"
name="app.update.disable_button.showUpdateHistory"
type="bool"/>
#ifdef MOZ_MAINTENANCE_SERVICE
<preference id="app.update.service.enabled"
name="app.update.service.enabled"
type="bool"/>
#endif
#endif
<preference id="browser.search.update"
name="browser.search.update"
type="bool"/>
<!-- Encryption tab -->
<preference id="security.enable_ssl3"
name="security.enable_ssl3"
type="bool"/>
<preference id="security.enable_tls"
name="security.enable_tls"
type="bool"/>
<preference id="security.default_personal_cert"
name="security.default_personal_cert"
type="string"/>
<preference id="security.disable_button.openCertManager"
name="security.disable_button.openCertManager"
type="bool"/>
<preference id="security.OCSP.disable_button.managecrl"
name="security.OCSP.disable_button.managecrl"
type="bool"/>
<preference id="security.disable_button.openDeviceManager"
name="security.disable_button.openDeviceManager"
type="bool"/>
</preferences>
#ifdef HAVE_SHELL_SERVICE
<stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
#endif
<hbox class="heading" data-category="paneAdvanced" hidden="true">
<image class="preference-icon" type="advanced"/>
<html:h1>&paneAdvanced.title;</html:h1>
</hbox>
<tabbox id="advancedPrefs" flex="1"
data-category="paneAdvanced" hidden="true"
onselect="gAdvancedPane.tabSelectionChanged();">
<tabs id="tabsElement">
<tab id="generalTab" label="&generalTab.label;" helpTopic="prefs-advanced-general"/>
<tab id="networkTab" label="&networkTab.label;" helpTopic="prefs-advanced-network"/>
<tab id="updateTab" label="&updateTab.label;" helpTopic="prefs-advanced-update"/>
<tab id="encryptionTab" label="&encryptionTab.label;" helpTopic="prefs-advanced-encryption"/>
</tabs>
<tabpanels flex="1">
<!-- General -->
<tabpanel id="generalPanel" orient="vertical">
<!-- Accessibility -->
<groupbox id="accessibilityGroup" align="start">
<caption label="&accessibility.label;"/>
<checkbox id="useCursorNavigation"
label="&useCursorNavigation.label;"
accesskey="&useCursorNavigation.accesskey;"
preference="accessibility.browsewithcaret"/>
<checkbox id="searchStartTyping"
label="&searchStartTyping.label;"
accesskey="&searchStartTyping.accesskey;"
preference="accessibility.typeaheadfind"/>
<checkbox id="blockAutoRefresh"
label="&blockAutoRefresh.label;"
accesskey="&blockAutoRefresh.accesskey;"
preference="accessibility.blockautorefresh"/>
</groupbox>
<!-- Browsing -->
<groupbox id="browsingGroup" align="start">
<caption label="&browsing.label;"/>
<checkbox id="useAutoScroll"
label="&useAutoScroll.label;"
accesskey="&useAutoScroll.accesskey;"
preference="general.autoScroll"/>
<checkbox id="useSmoothScrolling"
label="&useSmoothScrolling.label;"
accesskey="&useSmoothScrolling.accesskey;"
preference="general.smoothScroll"/>
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.disabled"/>
<checkbox id="checkSpelling"
label="&checkSpelling.label;"
accesskey="&checkSpelling.accesskey;"
onsyncfrompreference="return gAdvancedPane.readCheckSpelling();"
onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
preference="layout.spellcheckDefault"/>
</groupbox>
<!-- System Defaults -->
<groupbox id="systemDefaultsGroup" orient="vertical">
<caption label="&systemDefaults.label;"/>
#ifdef HAVE_SHELL_SERVICE
<hbox id="checkDefaultBox" align="center" flex="1">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
flex="1"/>
<button id="checkDefaultButton"
label="&checkNow.label;" accesskey="&checkNow.accesskey;"
oncommand="gAdvancedPane.checkNow()"
preference="pref.general.disable_button.default_browser"/>
</hbox>
#ifdef MOZ_CRASHREPORTER
<checkbox id="submitCrashesBox" flex="1"
oncommand="gAdvancedPane.updateSubmitCrashes();"
label="&submitCrashes.label;" accesskey="&submitCrashes.accesskey;"/>
#endif
#endif
<checkbox id="submitTelemetryBox" flex="1"
preference="toolkit.telemetry.enabled"
label="&submitTelemetry.label;" accesskey="&submitTelemetry.accesskey;"/>
</groupbox>
</tabpanel>
<!-- Network -->
<tabpanel id="networkPanel" orient="vertical">
<!-- Connection -->
<groupbox id="connectionGroup">
<caption label="&connection.label;"/>
<hbox align="center">
<description flex="1" control="connectionSettings">&connectionDesc.label;</description>
<button id="connectionSettings" icon="network" label="&connectionSettings.label;"
accesskey="&connectionSettings.accesskey;"
oncommand="gAdvancedPane.showConnections();"/>
</hbox>
</groupbox>
<!-- Cache -->
<groupbox id="cacheGroup">
<caption label="&httpCache.label;"/>
<hbox align="center">
<label id="actualDiskCacheSize" flex="1"/>
<button id="clearCacheButton" icon="clear"
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
oncommand="gAdvancedPane.clearCache();"/>
</hbox>
<checkbox preference="browser.cache.disk.smart_size.enabled"
id="allowSmartSize" flex="1"
onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
label="&overrideSmartCacheSize.label;"
accesskey="&overrideSmartCacheSize.accesskey;"/>
<hbox align="center" class="indent">
<label id="useCacheBefore" control="cacheSize"
accesskey="&limitCacheSizeBefore.accesskey;"
value="&limitCacheSizeBefore.label;"/>
<textbox id="cacheSize" type="number" size="4" max="1024"
preference="browser.cache.disk.capacity"
onsyncfrompreference="return gAdvancedPane.readCacheSize();"
onsynctopreference="return gAdvancedPane.writeCacheSize();"
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
<label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
</hbox>
</groupbox>
<!-- Offline apps -->
<groupbox id="offlineGroup">
<caption label="&offlineStorage2.label;"/>
<hbox align="center">
<label id="actualAppCacheSize" flex="1"/>
<button id="clearOfflineAppCacheButton" icon="clear"
label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"
oncommand="gAdvancedPane.clearOfflineAppCache();"/>
</hbox>
<hbox align="center">
<checkbox id="offlineNotify" flex="1"
label="&offlineNotify.label;" accesskey="&offlineNotify.accesskey;"
preference="browser.offline-apps.notify"
onsyncfrompreference="return gAdvancedPane.readOfflineNotify();"/>
<button id="offlineNotifyExceptions"
label="&offlineNotifyExceptions.label;"
accesskey="&offlineNotifyExceptions.accesskey;"
oncommand="gAdvancedPane.showOfflineExceptions();"/>
</hbox>
<hbox>
<vbox flex="1">
<label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
<listbox id="offlineAppsList"
style="height: &offlineAppsList.height;;"
flex="1"
aria-labelledby="offlineAppsListLabel"
onselect="gAdvancedPane.offlineAppSelected(event);">
</listbox>
</vbox>
<vbox pack="end">
<button id="offlineAppsListRemove"
disabled="true"
label="&offlineAppsListRemove.label;"
accesskey="&offlineAppsListRemove.accesskey;"
oncommand="gAdvancedPane.removeOfflineApp();"/>
</vbox>
</hbox>
</groupbox>
</tabpanel>
<!-- Update -->
<tabpanel id="updatePanel" orient="vertical">
#ifdef MOZ_UPDATER
<groupbox id="updateApp">
<caption label="&updateApp.label;"/>
<radiogroup id="updateRadioGroup"
oncommand="gAdvancedPane.updateWritePrefs();">
<radio value="auto"
label="&updateAuto.label;"
accesskey="&updateAuto.accesskey;"/>
<hbox class="indent">
<checkbox id="warnIncompatible"
label="&updateAutoAddonWarn.label;"
accesskey="&updateAutoAddonWarn.accesskey;"
preference="app.update.mode"
onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
</hbox>
<radio value="checkOnly"
label="&updateCheck.label;"
accesskey="&updateCheck.accesskey;"/>
<radio value="manual"
label="&updateManual.label;"
accesskey="&updateManual.accesskey;"/>
</radiogroup>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;"
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>
#ifdef MOZ_MAINTENANCE_SERVICE
<checkbox id="useService"
label="&useService.label;"
accesskey="&useService.accesskey;"
preference="app.update.service.enabled"/>
#endif
</groupbox>
#endif
<groupbox id="updateOthers">
<caption label="&updateOthers.label;"/>
<checkbox id="enableSearchUpdate"
label="&enableSearchUpdate.label;"
accesskey="&enableSearchUpdate.accesskey;"
preference="browser.search.update"/>
</groupbox>
</tabpanel>
<!-- Encryption -->
<tabpanel id="encryptionPanel" orient="vertical">
<!-- Protocols -->
<groupbox id="protocolsGroup">
<caption label="&protocols.label;"/>
<grid>
<columns>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<row>
<hbox>
<checkbox id="useSSL3" label="&useSSL3.label;"
accesskey="&useSSL3.accesskey;"
preference="security.enable_ssl3"/>
</hbox>
<hbox>
<checkbox id="useTLS1" label="&useTLS1.label;"
accesskey="&useTLS1.accesskey;"
preference="security.enable_tls"/>
</hbox>
</row>
</rows>
</grid>
</groupbox>
<!-- Certificates -->
<groupbox id="certificatesGroup">
<caption id="CertGroupCaption" label="&certificates.label;"/>
<description id="CertSelectionDesc" control="certSelection">&certSelection.description;</description>
<!--
The values on these radio buttons may look like l12y issues, but
they're not - this preference uses *those strings* as its values.
I KID YOU NOT.
-->
<radiogroup id="certSelection" orient="horizontal" preftype="string"
preference="security.default_personal_cert"
aria-labelledby="CertGroupCaption CertSelectionDesc">
<radio label="&certs.auto;" accesskey="&certs.auto.accesskey;"
value="Select Automatically"/>
<radio label="&certs.ask;" accesskey="&certs.ask.accesskey;"
value="Ask Every Time"/>
</radiogroup>
<separator/>
#ifdef XP_MACOSX
<vbox>
#endif
<hbox>
<button id="viewCertificatesButton"
label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
oncommand="gAdvancedPane.showCertificates();"
preference="security.disable_button.openCertManager"/>
<button id="viewCRLButton"
label="&viewCRLs.label;" accesskey="&viewCRLs.accesskey;"
oncommand="gAdvancedPane.showCRLs();"
preference="security.OCSP.disable_button.managecrl"/>
<button id="verificationButton"
label="&verify2.label;" accesskey="&verify2.accesskey;"
oncommand="gAdvancedPane.showOCSP();"/>
#ifdef XP_MACOSX
</hbox>
<hbox>
#endif
<button id="viewSecurityDevicesButton"
label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
oncommand="gAdvancedPane.showSecurityDevices();"
preference="security.disable_button.openDeviceManager"/>
</hbox>
#ifdef XP_MACOSX
</vbox>
#endif
</groupbox>
</tabpanel>
</tabpanels>
</tabbox>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/applications.js"/>
<preferences id="feedsPreferences">
<preference id="browser.feeds.handler"
name="browser.feeds.handler"
type="string"/>
<preference id="browser.feeds.handler.default"
name="browser.feeds.handler.default"
type="string"/>
<preference id="browser.feeds.handlers.application"
name="browser.feeds.handlers.application"
type="file"/>
<preference id="browser.feeds.handlers.webservice"
name="browser.feeds.handlers.webservice"
type="string"/>
<preference id="browser.videoFeeds.handler"
name="browser.videoFeeds.handler"
type="string"/>
<preference id="browser.videoFeeds.handler.default"
name="browser.videoFeeds.handler.default"
type="string"/>
<preference id="browser.videoFeeds.handlers.application"
name="browser.videoFeeds.handlers.application"
type="file"/>
<preference id="browser.videoFeeds.handlers.webservice"
name="browser.videoFeeds.handlers.webservice"
type="string"/>
<preference id="browser.audioFeeds.handler"
name="browser.audioFeeds.handler"
type="string"/>
<preference id="browser.audioFeeds.handler.default"
name="browser.audioFeeds.handler.default"
type="string"/>
<preference id="browser.audioFeeds.handlers.application"
name="browser.audioFeeds.handlers.application"
type="file"/>
<preference id="browser.audioFeeds.handlers.webservice"
name="browser.audioFeeds.handlers.webservice"
type="string"/>
<preference id="pref.downloads.disable_button.edit_actions"
name="pref.downloads.disable_button.edit_actions"
type="bool"/>
</preferences>
<keyset>
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
<key key="&focusSearch2.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
</keyset>
<hbox class="heading" data-category="paneApplications" hidden="true">
<image class="preference-icon" type="applications"/>
<html:h1>&paneApplications.title;</html:h1>
</hbox>
<vbox data-category="paneApplications" hidden="true" flex="1">
<hbox>
<textbox id="filter" flex="1"
type="search"
placeholder="&filter.emptytext;"
aria-controls="handlersView"
oncommand="gApplicationsPane.filter();"/>
</hbox>
<separator class="thin"/>
<richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
preference="pref.downloads.disable_button.edit_actions"
flex="1"
onselect="gApplicationsPane.onSelectionChanged();">
<listheader equalsize="always" style="border: 0; padding: 0; -moz-appearance: none;">
<treecol id="typeColumn" label="&typeColumn.label;" value="type"
accesskey="&typeColumn.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"
sortDirection="ascending"/>
<treecol id="actionColumn" label="&actionColumn2.label;" value="action"
accesskey="&actionColumn2.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"/>
</listheader>
</richlistbox>
</vbox>

View File

@ -0,0 +1,243 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var gContentPane = {
/**
* Initializes the fonts dropdowns displayed in this pane.
*/
init: function ()
{
this._rebuildFonts();
var menulist = document.getElementById("defaultFont");
if (menulist.selectedIndex == -1) {
menulist.insertItemAt(0, "", "", "");
menulist.selectedIndex = 0;
}
},
// UTILITY FUNCTIONS
/**
* Utility function to enable/disable the button specified by aButtonID based
* on the value of the Boolean preference specified by aPreferenceID.
*/
updateButtons: function (aButtonID, aPreferenceID)
{
var button = document.getElementById(aButtonID);
var preference = document.getElementById(aPreferenceID);
button.disabled = preference.value != true;
return undefined;
},
/**
* The exceptions types which may be passed to this._showExceptions().
*/
_exceptionsParams: {
popup: { blockVisible: false, sessionVisible: false, allowVisible: true,
prefilledHost: "", permissionType: "popup" },
image: { blockVisible: true, sessionVisible: false, allowVisible: true,
prefilledHost: "", permissionType: "image" }
},
/**
* Displays the exceptions dialog of the given type, where types map onto the
* the fields in this._exceptionsParams.
*/
_showExceptions: function (aPermissionType)
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = this._exceptionsParams[aPermissionType];
params.windowTitle = bundlePreferences.getString(aPermissionType + "permissionstitle");
params.introText = bundlePreferences.getString(aPermissionType + "permissionstext");
openDialog("chrome://browser/content/preferences/permissions.xul",
"Browser:Permissions", "resizable=yes", params);
},
// BEGIN UI CODE
/*
* Preferences:
*
* dom.disable_open_during_load
* - true if popups are blocked by default, false otherwise
* permissions.default.image
* - an integer:
* 1 all images should be loaded,
* 2 no images should be loaded,
* 3 load only images from the site on which the current page resides
* (i.e., if viewing foo.example.com, foo.example.com/foo.jpg and
* bar.foo.example.com/bar.jpg load but example.com/quux.jpg does not)
* javascript.enabled
* - true if JavaScript is enabled, false otherwise
*/
// POP-UPS
/**
* Displays the popup exceptions dialog where specific site popup preferences
* can be set.
*/
showPopupExceptions: function ()
{
this._showExceptions("popup");
},
// IMAGES
/**
* Converts the value of the permissions.default.image preference into a
* Boolean value for use in determining the state of the "load images"
* checkbox, returning true if images should be loaded and false otherwise.
*/
readLoadImages: function ()
{
var pref = document.getElementById("permissions.default.image");
return (pref.value == 1 || pref.value == 3);
},
/**
* Returns the "load images" preference value which maps to the state of the
* preferences UI.
*/
writeLoadImages: function ()
{
return (document.getElementById("loadImages").checked) ? 1 : 2;
},
/**
* Displays image exception preferences for which websites can and cannot
* load images.
*/
showImageExceptions: function ()
{
this._showExceptions("image");
},
// JAVASCRIPT
/**
* Displays the advanced JavaScript preferences for enabling or disabling
* various annoying behaviors.
*/
showAdvancedJS: function ()
{
openDialog("chrome://browser/content/preferences/advanced-scripts.xul",
"Browser:AdvancedScripts", null);
},
// FONTS
/**
* Populates the default font list in UI.
*/
_rebuildFonts: function ()
{
var langGroupPref = document.getElementById("font.language.group");
this._selectDefaultLanguageGroup(langGroupPref.value,
this._readDefaultFontTypeForLanguage(langGroupPref.value) == "serif");
},
/**
*
*/
_selectDefaultLanguageGroup: function (aLanguageGroup, aIsSerif)
{
const kFontNameFmtSerif = "font.name.serif.%LANG%";
const kFontNameFmtSansSerif = "font.name.sans-serif.%LANG%";
const kFontNameListFmtSerif = "font.name-list.serif.%LANG%";
const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
const kFontSizeFmtVariable = "font.size.variable.%LANG%";
var prefs = [{ format : aIsSerif ? kFontNameFmtSerif : kFontNameFmtSansSerif,
type : "fontname",
element : "defaultFont",
fonttype : aIsSerif ? "serif" : "sans-serif" },
{ format : aIsSerif ? kFontNameListFmtSerif : kFontNameListFmtSansSerif,
type : "unichar",
element : null,
fonttype : aIsSerif ? "serif" : "sans-serif" },
{ format : kFontSizeFmtVariable,
type : "int",
element : "defaultFontSize",
fonttype : null }];
var preferences = document.getElementById("contentPreferences");
for (var i = 0; i < prefs.length; ++i) {
var preference = document.getElementById(prefs[i].format.replace(/%LANG%/, aLanguageGroup));
if (!preference) {
preference = document.createElement("preference");
var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
preference.id = name;
preference.setAttribute("name", name);
preference.setAttribute("type", prefs[i].type);
preferences.appendChild(preference);
}
if (!prefs[i].element)
continue;
var element = document.getElementById(prefs[i].element);
if (element) {
element.setAttribute("preference", preference.id);
if (prefs[i].fonttype)
FontBuilder.buildFontList(aLanguageGroup, prefs[i].fonttype, element);
preference.setElementValue(element);
}
}
},
/**
* Returns the type of the current default font for the language denoted by
* aLanguageGroup.
*/
_readDefaultFontTypeForLanguage: function (aLanguageGroup)
{
const kDefaultFontType = "font.default.%LANG%";
var defaultFontTypePref = kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
var preference = document.getElementById(defaultFontTypePref);
if (!preference) {
preference = document.createElement("preference");
preference.id = defaultFontTypePref;
preference.setAttribute("name", defaultFontTypePref);
preference.setAttribute("type", "string");
preference.setAttribute("onchange", "gContentPane._rebuildFonts();");
document.getElementById("contentPreferences").appendChild(preference);
}
return preference.value;
},
/**
* Displays the fonts dialog, where web page font names and sizes can be
* configured.
*/
configureFonts: function ()
{
openDialog("chrome://browser/content/preferences/fonts.xul",
"Browser:FontPreferences", null);
},
/**
* Displays the colors dialog, where default web page/link/etc. colors can be
* configured.
*/
configureColors: function ()
{
openDialog("chrome://browser/content/preferences/colors.xul",
"Browser:ColorPreferences", null);
},
// LANGUAGES
/**
* Shows a dialog in which the preferred language for web content may be set.
*/
showLanguages: function ()
{
openDialog("chrome://browser/content/preferences/languages.xul",
"Browser:LanguagePreferences", null);
}
};

View File

@ -0,0 +1,165 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<preferences id="contentPreferences">
<!-- Popups, images, and JavaScript -->
<preference id="dom.disable_open_during_load"
name="dom.disable_open_during_load"
type="bool"/>
<preference id="permissions.default.image"
name="permissions.default.image"
type="int"/>
<preference id="javascript.enabled"
name="javascript.enabled"
type="bool"/>
<preference id="pref.advanced.images.disable_button.view_image"
name="pref.advanced.images.disable_button.view_image"
type="bool"/>
<preference id="pref.advanced.javascript.disable_button.advanced"
name="pref.advanced.javascript.disable_button.advanced"
type="bool"/>
<!-- Fonts -->
<preference id="font.language.group"
name="font.language.group"
type="wstring"
onchange="gContentPane._rebuildFonts();"/>
</preferences>
<script type="application/javascript"
src="chrome://mozapps/content/preferences/fontbuilder.js"/>
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/content.js"/>
<hbox class="heading" data-category="paneContent" hidden="true">
<image class="preference-icon" type="content"/>
<html:h1>&paneContent.title;</html:h1>
</hbox>
<groupbox id="miscGroup" data-category="paneContent" hidden="true">
<grid id="contentGrid">
<columns>
<column flex="1"/>
<column/>
</columns>
<rows id="contentRows-1">
<row id="popupPolicyRow">
<vbox align="start">
<checkbox id="popupPolicy" preference="dom.disable_open_during_load"
label="&blockPopups.label;" accesskey="&blockPopups.accesskey;"
onsyncfrompreference="return gContentPane.updateButtons('popupPolicyButton',
'dom.disable_open_during_load');"/>
</vbox>
<button id="popupPolicyButton" label="&popupExceptions.label;"
oncommand="gContentPane.showPopupExceptions();"
accesskey="&popupExceptions.accesskey;"/>
</row>
<row id="enableImagesRow">
<vbox align="start">
<checkbox id="loadImages"
label="&loadImages.label;"
accesskey="&loadImages.accesskey;"
preference="permissions.default.image"
onsyncfrompreference="return gContentPane.readLoadImages();"
onsynctopreference="return gContentPane.writeLoadImages();"/>
</vbox>
<vbox>
<button label="&exceptions.label;"
accesskey="&exceptions.accesskey;"
oncommand="gContentPane.showImageExceptions();"
preference="pref.advanced.images.disable_button.view_image"/>
</vbox>
</row>
<row id="enableJavaScriptRow">
<vbox align="start">
<checkbox id="enableJavaScript" preference="javascript.enabled"
label="&enableJavaScript.label;" accesskey="&enableJavaScript.accesskey;"
onsyncfrompreference="return gContentPane.updateButtons('advancedJSButton',
'javascript.enabled');"/>
</vbox>
<vbox>
<button id="advancedJSButton" label="&advancedJS.label;"
accesskey="&advancedJS.accesskey;"
oncommand="gContentPane.showAdvancedJS();"
preference="pref.advanced.javascript.disable_button.advanced"/>
</vbox>
</row>
</rows>
</grid>
</groupbox>
<!-- Fonts and Colors -->
<groupbox id="fontsGroup" data-category="paneContent" hidden="true">
<caption label="&fontsAndColors.label;"/>
<grid id="fontsGrid">
<columns>
<column flex="1"/>
<column/>
</columns>
<rows id="fontsRows">
<row id="fontRow">
<hbox align="center">
<label control="defaultFont" accesskey="&defaultFont.accesskey;">&defaultFont.label;</label>
<menulist id="defaultFont" />
<label control="defaultFontSize" accesskey="&defaultSize.accesskey;">&defaultSize.label;</label>
<menulist id="defaultFontSize">
<menupopup>
<menuitem value="9" label="9"/>
<menuitem value="10" label="10"/>
<menuitem value="11" label="11"/>
<menuitem value="12" label="12"/>
<menuitem value="13" label="13"/>
<menuitem value="14" label="14"/>
<menuitem value="15" label="15"/>
<menuitem value="16" label="16"/>
<menuitem value="17" label="17"/>
<menuitem value="18" label="18"/>
<menuitem value="20" label="20"/>
<menuitem value="22" label="22"/>
<menuitem value="24" label="24"/>
<menuitem value="26" label="26"/>
<menuitem value="28" label="28"/>
<menuitem value="30" label="30"/>
<menuitem value="32" label="32"/>
<menuitem value="34" label="34"/>
<menuitem value="36" label="36"/>
<menuitem value="40" label="40"/>
<menuitem value="44" label="44"/>
<menuitem value="48" label="48"/>
<menuitem value="56" label="56"/>
<menuitem value="64" label="64"/>
<menuitem value="72" label="72"/>
</menupopup>
</menulist>
</hbox>
<button id="advancedFonts" icon="select-font"
label="&advancedFonts.label;"
accesskey="&advancedFonts.accesskey;"
oncommand="gContentPane.configureFonts();"/>
</row>
<row id="colorsRow">
<hbox/>
<button id="colors" icon="select-color"
label="&colors.label;"
accesskey="&colors.accesskey;"
oncommand="gContentPane.configureColors();"/>
</row>
</rows>
</grid>
</groupbox>
<!-- Languages -->
<groupbox id="languagesGroup" data-category="paneContent" hidden="true">
<caption label="&languages.label;"/>
<hbox id="languagesBox" align="center">
<description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
<button id="chooseLanguage"
label="&chooseButton.label;"
accesskey="&chooseButton.accesskey;"
oncommand="gContentPane.showLanguages();"/>
</hbox>
</groupbox>

View File

@ -0,0 +1,20 @@
browser.jar:
* content/browser/preferences/in-content/preferences.js
content/browser/preferences/in-content/landing.xul
* content/browser/preferences/in-content/preferences.xul
* content/browser/preferences/in-content/main.xul
content/browser/preferences/in-content/main.js
* content/browser/preferences/in-content/tabs.xul
* content/browser/preferences/in-content/tabs.js
content/browser/preferences/in-content/privacy.xul
content/browser/preferences/in-content/privacy.js
* content/browser/preferences/in-content/advanced.xul
* content/browser/preferences/in-content/advanced.js
* content/browser/preferences/in-content/applications.xul
* content/browser/preferences/in-content/applications.js
content/browser/preferences/in-content/content.xul
content/browser/preferences/in-content/content.js
content/browser/preferences/in-content/sync.xul
content/browser/preferences/in-content/sync.js
content/browser/preferences/in-content/security.xul
content/browser/preferences/in-content/security.js

View File

@ -0,0 +1,59 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<vbox data-category="landing">
<html:h1 class="indent-small">&brandShortName;</html:h1>
<hbox id="preferences-home" flex="1">
<button label="&paneGeneral.title;" class="landingButton"
oncommand="gotoPref('paneGeneral');">
<image class="landingButton-icon" type="general"/>
<label class="landingButton-label">&paneGeneral.title;</label>
</button>
<button label="&paneTabs.title;" class="landingButton"
oncommand="gotoPref('paneTabs');">
<image class="landingButton-icon" type="tabs"/>
<label class="landingButton-label">&paneTabs.title;</label>
</button>
<button label="&paneContent.title;" class="landingButton"
oncommand="gotoPref('paneContent');">
<image class="landingButton-icon" type="content"/>
<label class="landingButton-label">&paneContent.title;</label>
</button>
<button label="&paneApplications.title;" class="landingButton"
oncommand="gotoPref('paneApplications');">
<image class="landingButton-icon" type="applications"/>
<label class="landingButton-label">&paneApplications.title;</label>
</button>
<button label="&panePrivacy.title;" class="landingButton"
oncommand="gotoPref('panePrivacy');">
<image class="landingButton-icon" type="privacy"/>
<label class="landingButton-label">&panePrivacy.title;</label>
</button>
<button label="&paneSecurity.title;" class="landingButton"
oncommand="gotoPref('paneSecurity');">
<image class="landingButton-icon" type="security"/>
<label class="landingButton-label">&paneSecurity.title;</label>
</button>
<button label="&paneSync.title;" class="landingButton"
oncommand="gotoPref('paneSync');">
<image class="landingButton-icon" type="sync"/>
<label class="landingButton-label">&paneSync.title;</label>
</button>
<button label="&paneAdvanced.title;" class="landingButton"
oncommand="gotoPref('paneAdvanced');">
<image class="landingButton-icon" type="advanced"/>
<label class="landingButton-label">&paneAdvanced.title;</label>
</button>
</hbox>
</vbox>

View File

@ -0,0 +1,481 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var gMainPane = {
_pane: null,
/**
* Initialization of this.
*/
init: function ()
{
this._pane = document.getElementById("paneMain");
// set up the "use current page" label-changing listener
this._updateUseCurrentButton();
window.addEventListener("focus", this._updateUseCurrentButton.bind(this), false);
this.updateBrowserStartupLastSession();
this.startupPagePrefChanged();
// Notify observers that the UI is now ready
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(window, "main-pane-loaded", null);
},
// HOME PAGE
/*
* Preferences:
*
* browser.startup.homepage
* - the user's home page, as a string; if the home page is a set of tabs,
* this will be those URLs separated by the pipe character "|"
* browser.startup.page
* - what page(s) to show when the user starts the application, as an integer:
*
* 0: a blank page
* 1: the home page (as set by the browser.startup.homepage pref)
* 2: the last page the user visited (DEPRECATED)
* 3: windows and tabs from the last session (a.k.a. session restore)
*
* The deprecated option is not exposed in UI; however, if the user has it
* selected and doesn't change the UI for this preference, the deprecated
* option is preserved.
*/
/**
* Enables/Disables the restore on demand checkbox.
*/
startupPagePrefChanged: function ()
{
let startupPref = document.getElementById("browser.startup.page");
let restoreOnDemandPref = document.getElementById("browser.sessionstore.restore_on_demand");
restoreOnDemandPref.disabled = startupPref.value != 3;
},
syncFromHomePref: function ()
{
let homePref = document.getElementById("browser.startup.homepage");
// If the pref is set to about:home, set the value to "" to show the
// placeholder text (about:home title).
if (homePref.value.toLowerCase() == "about:home")
return "";
// If the pref is actually "", show about:blank. The actual home page
// loading code treats them the same, and we don't want the placeholder text
// to be shown.
if (homePref.value == "")
return "about:blank";
// Otherwise, show the actual pref value.
return undefined;
},
syncToHomePref: function (value)
{
// If the value is "", use about:home.
if (value == "")
return "about:home";
// Otherwise, use the actual textbox value.
return undefined;
},
/**
* Sets the home page to the current displayed page (or frontmost tab, if the
* most recent browser window contains multiple tabs), updating preference
* window UI to reflect this.
*/
setHomePageToCurrent: function ()
{
let homePage = document.getElementById("browser.startup.homepage");
let tabs = this._getTabsForHomePage();
function getTabURI(t) t.linkedBrowser.currentURI.spec;
// FIXME Bug 244192: using dangerous "|" joiner!
if (tabs.length)
homePage.value = tabs.map(getTabURI).join("|");
},
/**
* Displays a dialog in which the user can select a bookmark to use as home
* page. If the user selects a bookmark, that bookmark's name is displayed in
* UI and the bookmark's address is stored to the home page preference.
*/
setHomePageToBookmark: function ()
{
var rv = { urls: null, names: null };
openDialog("chrome://browser/content/preferences/selectBookmark.xul",
"Select Bookmark", "resizable=yes, modal=yes", rv);
if (rv.urls && rv.names) {
var homePage = document.getElementById("browser.startup.homepage");
// XXX still using dangerous "|" joiner!
homePage.value = rv.urls.join("|");
}
},
/**
* Switches the "Use Current Page" button between its singular and plural
* forms.
*/
_updateUseCurrentButton: function () {
let useCurrent = document.getElementById("useCurrent");
let tabs = this._getTabsForHomePage();
if (tabs.length > 1)
useCurrent.label = useCurrent.getAttribute("label2");
else
useCurrent.label = useCurrent.getAttribute("label1");
// In this case, the button's disabled state is set by preferences.xml.
if (document.getElementById
("pref.browser.homepage.disable_button.current_page").locked)
return;
useCurrent.disabled = !tabs.length
},
_getTabsForHomePage: function ()
{
var win;
var tabs = [];
const Cc = Components.classes, Ci = Components.interfaces;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
win = wm.getMostRecentWindow("navigator:browser");
if (win && win.document.documentElement
.getAttribute("windowtype") == "navigator:browser") {
// We should only include visible & non-pinned tabs
tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs);
tabs = tabs.filter(this.isAboutPreferences);
}
return tabs;
},
/**
* Check to see if a tab is not about:preferences
*/
isAboutPreferences: function (aElement, aIndex, aArray)
{
return (aElement.linkedBrowser.currentURI.spec != "about:preferences");
},
/**
* Restores the default home page as the user's home page.
*/
restoreDefaultHomePage: function ()
{
var homePage = document.getElementById("browser.startup.homepage");
homePage.value = homePage.defaultValue;
},
// DOWNLOADS
/*
* Preferences:
*
* browser.download.showWhenStarting - bool
* True if the Download Manager should be opened when a download is
* started, false if it shouldn't be opened.
* browser.download.closeWhenDone - bool
* True if the Download Manager should be closed when all downloads
* complete, false if it should be left open.
* browser.download.useDownloadDir - bool
* True - Save files directly to the folder configured via the
* browser.download.folderList preference.
* False - Always ask the user where to save a file and default to
* browser.download.lastDir when displaying a folder picker dialog.
* browser.download.dir - local file handle
* A local folder the user may have selected for downloaded files to be
* saved. Migration of other browser settings may also set this path.
* This folder is enabled when folderList equals 2.
* browser.download.lastDir - local file handle
* May contain the last folder path accessed when the user browsed
* via the file save-as dialog. (see contentAreaUtils.js)
* browser.download.folderList - int
* Indicates the location users wish to save downloaded files too.
* It is also used to display special file labels when the default
* download location is either the Desktop or the Downloads folder.
* Values:
* 0 - The desktop is the default download location.
* 1 - The system's downloads folder is the default download location.
* 2 - The default download location is elsewhere as specified in
* browser.download.dir.
* browser.download.downloadDir
* deprecated.
* browser.download.defaultFolder
* deprecated.
*/
/**
* Updates preferences which depend upon the value of the preference which
* determines whether the Downloads manager is opened at the start of a
* download.
*/
readShowDownloadsWhenStarting: function ()
{
this.showDownloadsWhenStartingPrefChanged();
// don't override the preference's value in UI
return undefined;
},
/**
* Enables or disables the "close Downloads manager when downloads finished"
* preference element, consequently updating the associated UI.
*/
showDownloadsWhenStartingPrefChanged: function ()
{
var showWhenStartingPref = document.getElementById("browser.download.manager.showWhenStarting");
var closeWhenDonePref = document.getElementById("browser.download.manager.closeWhenDone");
closeWhenDonePref.disabled = !showWhenStartingPref.value;
},
/**
* Enables/disables the folder field and Browse button based on whether a
* default download directory is being used.
*/
readUseDownloadDir: function ()
{
var downloadFolder = document.getElementById("downloadFolder");
var chooseFolder = document.getElementById("chooseFolder");
var preference = document.getElementById("browser.download.useDownloadDir");
downloadFolder.disabled = !preference.value;
chooseFolder.disabled = !preference.value;
// don't override the preference's value in UI
return undefined;
},
/**
* Displays a file picker in which the user can choose the location where
* downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made.
*/
chooseFolder: function ()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsILocalFile = Components.interfaces.nsILocalFile;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
var bundlePreferences = document.getElementById("bundlePreferences");
var title = bundlePreferences.getString("chooseDownloadFolderTitle");
fp.init(window, title, nsIFilePicker.modeGetFolder);
fp.appendFilters(nsIFilePicker.filterAll);
var folderListPref = document.getElementById("browser.download.folderList");
var currentDirPref = this._indexToFolder(folderListPref.value); // file
var defDownloads = this._indexToFolder(1); // file
// First try to open what's currently configured
if (currentDirPref && currentDirPref.exists()) {
fp.displayDirectory = currentDirPref;
} // Try the system's download dir
else if (defDownloads && defDownloads.exists()) {
fp.displayDirectory = defDownloads;
} // Fall back to Desktop
else {
fp.displayDirectory = this._indexToFolder(0);
}
if (fp.show() == nsIFilePicker.returnOK) {
var file = fp.file.QueryInterface(nsILocalFile);
var currentDirPref = document.getElementById("browser.download.dir");
currentDirPref.value = file;
var folderListPref = document.getElementById("browser.download.folderList");
folderListPref.value = this._folderToIndex(file);
// Note, the real prefs will not be updated yet, so dnld manager's
// userDownloadsDirectory may not return the right folder after
// this code executes. displayDownloadDirPref will be called on
// the assignment above to update the UI.
}
},
/**
* Initializes the download folder display settings based on the user's
* preferences.
*/
displayDownloadDirPref: function ()
{
var folderListPref = document.getElementById("browser.download.folderList");
var bundlePreferences = document.getElementById("bundlePreferences");
var downloadFolder = document.getElementById("downloadFolder");
var currentDirPref = document.getElementById("browser.download.dir");
// Used in defining the correct path to the folder icon.
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fph = ios.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var iconUrlSpec;
// Display a 'pretty' label or the path in the UI.
if (folderListPref.value == 2) {
// Custom path selected and is configured
downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
} else if (folderListPref.value == 1) {
// 'Downloads'
// In 1.5, this pointed to a folder we created called 'My Downloads'
// and was available as an option in the 1.5 drop down. On XP this
// was in My Documents, on OSX it was in User Docs. In 2.0, we did
// away with the drop down option, although the special label was
// still supported for the folder if it existed. Because it was
// not exposed it was rarely used.
// With 3.0, a new desktop folder - 'Downloads' was introduced for
// platforms and versions that don't support a default system downloads
// folder. See nsDownloadManager for details.
downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
iconUrlSpec = fph.getURLSpecFromFile(this._indexToFolder(1));
} else {
// 'Desktop'
downloadFolder.label = bundlePreferences.getString("desktopFolderName");
iconUrlSpec = fph.getURLSpecFromFile(desk);
}
downloadFolder.image = "moz-icon://" + iconUrlSpec + "?size=16";
// don't override the preference's value in UI
return undefined;
},
/**
* Returns the textual path of a folder in readable form.
*/
_getDisplayNameOfFile: function (aFolder)
{
// TODO: would like to add support for 'Downloads on Macintosh HD'
// for OS X users.
return aFolder ? aFolder.path : "";
},
/**
* Returns the Downloads folder. If aFolder is "Desktop", then the Downloads
* folder returned is the desktop folder; otherwise, it is a folder whose name
* indicates that it is a download folder and whose path is as determined by
* the XPCOM directory service via the download manager's attribute
* defaultDownloadsDirectory.
*
* @throws if aFolder is not "Desktop" or "Downloads"
*/
_getDownloadsFolder: function (aFolder)
{
switch (aFolder) {
case "Desktop":
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
break;
case "Downloads":
var dnldMgr = Components.classes["@mozilla.org/download-manager;1"]
.getService(Components.interfaces.nsIDownloadManager);
return dnldMgr.defaultDownloadsDirectory;
break;
}
throw "ASSERTION FAILED: folder type should be 'Desktop' or 'Downloads'";
},
/**
* Determines the type of the given folder.
*
* @param aFolder
* the folder whose type is to be determined
* @returns integer
* 0 if aFolder is the Desktop or is unspecified,
* 1 if aFolder is the Downloads folder,
* 2 otherwise
*/
_folderToIndex: function (aFolder)
{
if (!aFolder || aFolder.equals(this._getDownloadsFolder("Desktop")))
return 0;
else if (aFolder.equals(this._getDownloadsFolder("Downloads")))
return 1;
return 2;
},
/**
* Converts an integer into the corresponding folder.
*
* @param aIndex
* an integer
* @returns the Desktop folder if aIndex == 0,
* the Downloads folder if aIndex == 1,
* the folder stored in browser.download.dir
*/
_indexToFolder: function (aIndex)
{
switch (aIndex) {
case 0:
return this._getDownloadsFolder("Desktop");
case 1:
return this._getDownloadsFolder("Downloads");
}
var currentDirPref = document.getElementById("browser.download.dir");
return currentDirPref.value;
},
/**
* Returns the value for the browser.download.folderList preference.
*/
getFolderListPref: function ()
{
var folderListPref = document.getElementById("browser.download.folderList");
switch (folderListPref.value) {
case 0: // Desktop
case 1: // Downloads
return folderListPref.value;
break;
case 2: // Custom
var currentDirPref = document.getElementById("browser.download.dir");
if (currentDirPref.value) {
// Resolve to a known location if possible. We are writing out
// to prefs on this call, so now would be a good time to do it.
return this._folderToIndex(currentDirPref.value);
}
return 0;
break;
}
},
/**
* Displays the Add-ons Manager.
*/
showAddonsMgr: function ()
{
openUILinkIn("about:addons", "tab");
},
/**
* Hide/show the "Show my windows and tabs from last time" option based
* on the value of the browser.privatebrowsing.autostart pref.
*/
updateBrowserStartupLastSession: function()
{
let pbAutoStartPref = document.getElementById("browser.privatebrowsing.autostart");
let startupPref = document.getElementById("browser.startup.page");
let menu = document.getElementById("browserStartupPage");
let option = document.getElementById("browserStartupLastSession");
if (pbAutoStartPref.value) {
option.setAttribute("disabled", "true");
if (option.selected) {
menu.selectedItem = document.getElementById("browserStartupHomePage");
}
} else {
option.removeAttribute("disabled");
startupPref.updateElements(); // select the correct index in the startup menulist
}
}
};

View File

@ -0,0 +1,198 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/main.js"/>
<preferences id="mainPreferences">
<!-- Startup -->
<preference id="browser.startup.page"
name="browser.startup.page"
type="int"
onchange="gMainPane.startupPagePrefChanged();"/>
<preference id="browser.sessionstore.restore_on_demand"
name="browser.sessionstore.restore_on_demand"
type="bool"/>
<preference id="browser.startup.homepage"
name="browser.startup.homepage"
type="wstring"/>
<preference id="pref.browser.homepage.disable_button.current_page"
name="pref.browser.homepage.disable_button.current_page"
type="bool"/>
<preference id="pref.browser.homepage.disable_button.bookmark_page"
name="pref.browser.homepage.disable_button.bookmark_page"
type="bool"/>
<preference id="pref.browser.homepage.disable_button.restore_default"
name="pref.browser.homepage.disable_button.restore_default"
type="bool"/>
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
type="bool"
onchange="gMainPane.updateBrowserStartupLastSession();"/>
<!-- Downloads -->
<preference id="browser.download.manager.showWhenStarting"
name="browser.download.manager.showWhenStarting"
type="bool"
onchange="gMainPane.showDownloadsWhenStartingPrefChanged();"/>
<preference id="browser.download.manager.closeWhenDone"
name="browser.download.manager.closeWhenDone"
type="bool"/>
<preference id="browser.download.useDownloadDir"
name="browser.download.useDownloadDir"
type="bool"/>
<preference id="browser.download.dir"
name="browser.download.dir"
type="file"
onchange="gMainPane.displayDownloadDirPref();"/>
<preference id="browser.download.folderList"
name="browser.download.folderList"
type="int"/>
</preferences>
<hbox class="heading" data-category="paneGeneral" hidden="true">
<image class="preference-icon" type="general"/>
<html:h1>&paneGeneral.title;</html:h1>
</hbox>
<!-- Startup -->
<groupbox id="startupGroup" data-category="paneGeneral" hidden="true">
<caption label="&startup.label;"/>
<hbox align="center">
<label value="&startupPage.label;"
accesskey="&startupPage.accesskey;"
control="browserStartupPage"/>
<menulist id="browserStartupPage"
preference="browser.startup.page">
<menupopup>
<menuitem label="&startupHomePage.label;"
value="1"
id="browserStartupHomePage"/>
<menuitem label="&startupBlankPage.label;"
value="0"
id="browserStartupBlank"/>
<menuitem label="&startupLastSession.label;"
value="3"
id="browserStartupLastSession"/>
</menupopup>
</menulist>
</hbox>
<hbox align="center">
<checkbox id="restoreOnDemand"
label="&restoreOnDemand.label;"
accesskey="&restoreOnDemand.accesskey;"
class="indent"
preference="browser.sessionstore.restore_on_demand"/>
</hbox>
<separator class="thin"/>
<hbox align="center">
<label value="&homepage.label;"
accesskey="&homepage.accesskey;"
control="browserHomePage"/>
<textbox id="browserHomePage"
class="padded uri-element"
flex="1"
type="autocomplete"
autocompletesearch="history"
onsyncfrompreference="return gMainPane.syncFromHomePref();"
onsynctopreference="return gMainPane.syncToHomePref(this.value);"
placeholder="&abouthome.pageTitle;"
preference="browser.startup.homepage"/>
</hbox>
<hbox align="center" pack="end">
<button label=""
accesskey="&useCurrentPage.accesskey;"
label1="&useCurrentPage.label;"
label2="&useMultiple.label;"
oncommand="gMainPane.setHomePageToCurrent();"
id="useCurrent"
preference="pref.browser.homepage.disable_button.current_page"/>
<button label="&chooseBookmark.label;"
accesskey="&chooseBookmark.accesskey;"
oncommand="gMainPane.setHomePageToBookmark();"
id="useBookmark"
preference="pref.browser.homepage.disable_button.bookmark_page"/>
<button label="&restoreDefault.label;"
accesskey="&restoreDefault.accesskey;"
oncommand="gMainPane.restoreDefaultHomePage();"
id="restoreDefaultHomePage"
preference="pref.browser.homepage.disable_button.restore_default"/>
</hbox>
</groupbox>
<!-- Downloads -->
<groupbox id="downloadsGroup" data-category="paneGeneral" hidden="true">
<caption label="&downloads.label;"/>
<checkbox id="showWhenDownloading"
label="&showWhenDownloading.label;"
accesskey="&showWhenDownloading.accesskey;"
preference="browser.download.manager.showWhenStarting"
onsyncfrompreference="return gMainPane.readShowDownloadsWhenStarting();"/>
<checkbox id="closeWhenDone"
label="&closeWhenDone.label;"
accesskey="&closeWhenDone.accesskey;"
class="indent"
preference="browser.download.manager.closeWhenDone"/>
<separator class="thin"/>
<radiogroup id="saveWhere"
preference="browser.download.useDownloadDir"
onsyncfrompreference="return gMainPane.readUseDownloadDir();">
<hbox id="saveToRow">
<radio id="saveTo"
value="true"
label="&saveTo.label;"
accesskey="&saveTo.accesskey;"
aria-labelledby="saveTo downloadFolder"/>
<filefield id="downloadFolder"
flex="1"
preference="browser.download.folderList"
preference-editable="true"
aria-labelledby="saveTo"
onsyncfrompreference="return gMainPane.displayDownloadDirPref();"
onsynctopreference="return gMainPane.getFolderListPref()"/>
<button id="chooseFolder"
oncommand="gMainPane.chooseFolder();"
#ifdef XP_MACOSX
accesskey="&chooseFolderMac.accesskey;"
label="&chooseFolderMac.label;"
#else
accesskey="&chooseFolderWin.accesskey;"
label="&chooseFolderWin.label;"
#endif
preference="browser.download.folderList"
onsynctopreference="return gMainPane.getFolderListPref();"/>
</hbox>
<radio id="alwaysAsk"
value="false"
label="&alwaysAsk.label;"
accesskey="&alwaysAsk.accesskey;"/>
</radiogroup>
</groupbox>
<hbox class="bottomBox" data-category="paneGeneral" hidden="true">
<groupbox id="addonsMgrGroup"
orient="horizontal"
flex="1">
<caption label="&addonsMgr.label;"/>
<description control="manageAddons"
#ifdef XP_WIN
flex="1">&manageAddonsDescWin.label;</description>
#else
flex="1">&manageAddonsDescUnix2.label;</description>
#endif
<button id="manageAddons"
label="&manageAddons.label;"
accesskey="&manageAddons.accesskey;"
oncommand="gMainPane.showAddonsMgr();"/>
</groupbox>
</hbox>

View File

@ -0,0 +1,77 @@
/* - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
function init_all() {
document.documentElement.instantApply = true;
window.history.replaceState("landing", document.title);
window.addEventListener("popstate", onStatePopped, true);
updateCommands();
gMainPane.init();
#ifdef XP_WIN
gTabsPane.init();
#endif
gPrivacyPane.init();
gAdvancedPane.init();
gApplicationsPane.init();
gContentPane.init();
gSyncPane.init();
gSecurityPane.init();
var initFinished = document.createEvent("Event");
initFinished.initEvent("Initialized", true, true);
document.dispatchEvent(initFinished);
}
function gotoPref(page) {
search(page, "data-category");
window.history.pushState(page, document.title);
updateCommands();
}
function cmd_back() {
window.history.back();
}
function cmd_forward() {
window.history.forward();
}
function onStatePopped(aEvent) {
updateCommands();
search(aEvent.state, "data-category");
}
function updateCommands() {
document.getElementById("back-btn").disabled = !canGoBack();
document.getElementById("forward-btn").disabled = !canGoForward();
}
function canGoBack() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.canGoBack;
}
function canGoForward() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.canGoForward;
}
function search(aQuery, aAttribute) {
let elements = document.getElementById("mainPrefPane").children;
for (let element of elements) {
let attributeValue = element.getAttribute(aAttribute);
element.hidden = (attributeValue != aQuery);
}
}

View File

@ -0,0 +1,106 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet
href="chrome://browser/skin/preferences/in-content/preferences.css"?>
<?xml-stylesheet
href="chrome://browser/content/preferences/handlers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
<!DOCTYPE page [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % preferencesDTD SYSTEM
"chrome://browser/locale/preferences/preferences.dtd">
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
<!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences/tabs.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
<!ENTITY % securityDTD SYSTEM
"chrome://browser/locale/preferences/security.dtd">
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
<!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences/main.dtd">
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
<!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences/content.dtd">
<!ENTITY % applicationsDTD SYSTEM
"chrome://browser/locale/preferences/applications.dtd">
<!ENTITY % advancedDTD SYSTEM
"chrome://browser/locale/preferences/advanced.dtd">
%brandDTD;
%preferencesDTD;
%privacyDTD;
%tabsDTD;
%syncBrandDTD;
%syncDTD;
%securityDTD;
%sanitizeDTD;
%mainDTD;
%aboutHomeDTD;
%contentDTD;
%applicationsDTD;
%advancedDTD;
]>
#ifdef XP_WIN
#define USE_WIN_TITLE_STYLE
#endif
#ifdef XP_OS2
#define USE_WIN_TITLE_STYLE
#endif
<page onload="init_all();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
#ifdef USE_WIN_TITLE_STYLE
title="&prefWindow.titleWin;">
#else
title="&prefWindow.titleGNOME;">
#endif
<script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/preferences.js"/>
<stringbundle id="bundleBrand"
src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundlePreferences"
src="chrome://browser/locale/preferences/preferences.properties"/>
<stringbundleset id="appManagerBundleset">
<stringbundle id="appManagerBundle"
src="chrome://browser/locale/preferences/applicationManager.properties"/>
</stringbundleset>
<hbox id="header">
<toolbarbutton id="back-btn" class="nav-button header-button"
oncommand="cmd_back()" tooltiptext="&buttonBack.tooltip;"
disabled="true"/>
<toolbarbutton id="forward-btn" class="nav-button header-button"
oncommand="cmd_forward()" tooltiptext="&buttonForward.tooltip;"
disabled="true"/>
</hbox>
<hbox class="main-content" flex="1">
<prefpane flex="1" id="mainPrefPane">
#include landing.xul
#include main.xul
#include tabs.xul
#include privacy.xul
#include advanced.xul
#include applications.xul
#include content.xul
#include security.xul
#ifdef MOZ_SERVICES_SYNC
#include sync.xul
#endif
</prefpane>
</hbox>
</page>

View File

@ -0,0 +1,435 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var gPrivacyPane = {
/**
* Whether the use has selected the auto-start private browsing mode in the UI.
*/
_autoStartPrivateBrowsing: false,
/**
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
*/
init: function ()
{
this._updateSanitizeSettingsButton();
this.initializeHistoryMode();
this.updateHistoryModePane();
this.updatePrivacyMicroControls();
this.initAutoStartPrivateBrowsingObserver();
window.addEventListener("unload", this.removeASPBObserver.bind(this), false);
},
// HISTORY MODE
/**
* The list of preferences which affect the initial history mode settings.
* If the auto start private browsing mode pref is active, the initial
* history mode would be set to "Don't remember anything".
* If all of these preferences have their default values, and the auto-start
* private browsing mode is not active, the initial history mode would be
* set to "Remember everything".
* Otherwise, the initial history mode would be set to "Custom".
*
* Extensions adding their own preferences can append their IDs to this array if needed.
*/
prefsForDefault: [
"places.history.enabled",
"browser.formfill.enable",
"network.cookie.cookieBehavior",
"network.cookie.lifetimePolicy",
"privacy.sanitize.sanitizeOnShutdown"
],
/**
* The list of control IDs which are dependent on the auto-start private
* browsing setting, such that in "Custom" mode they would be disabled if
* the auto-start private browsing checkbox is checked, and enabled otherwise.
*
* Extensions adding their own controls can append their IDs to this array if needed.
*/
dependentControls: [
"rememberHistory",
"rememberForms",
"keepUntil",
"keepCookiesUntil",
"alwaysClear",
"clearDataSettings"
],
/**
* Check whether all the preferences values are set to their default values
*
* @param aPrefs an array of pref names to check for
* @returns boolean true if all of the prefs are set to their default values,
* false otherwise
*/
_checkDefaultValues: function(aPrefs) {
for (let i = 0; i < aPrefs.length; ++i) {
let pref = document.getElementById(aPrefs[i]);
if (pref.value != pref.defaultValue)
return false;
}
return true;
},
/**
* Initialize the history mode menulist based on the privacy preferences
*/
initializeHistoryMode: function PPP_initializeHistoryMode()
{
let mode;
let getVal = function (aPref)
document.getElementById(aPref).value;
if (this._checkDefaultValues(this.prefsForDefault)) {
if (getVal("browser.privatebrowsing.autostart"))
mode = "dontremember";
else
mode = "remember";
}
else
mode = "custom";
document.getElementById("historyMode").value = mode;
},
/**
* Update the selected pane based on the history mode menulist
*/
updateHistoryModePane: function PPP_updateHistoryModePane()
{
let selectedIndex = -1;
switch (document.getElementById("historyMode").value) {
case "remember":
selectedIndex = 0;
break;
case "dontremember":
selectedIndex = 1;
break;
case "custom":
selectedIndex = 2;
break;
}
document.getElementById("historyPane").selectedIndex = selectedIndex;
},
/**
* Update the private browsing auto-start pref and the history mode
* micro-management prefs based on the history mode menulist
*/
updateHistoryModePrefs: function PPP_updateHistoryModePrefs()
{
let pref = document.getElementById("browser.privatebrowsing.autostart");
switch (document.getElementById("historyMode").value) {
case "remember":
pref.value = false;
// select the remember history option if needed
let rememberHistoryCheckbox = document.getElementById("rememberHistory");
if (!rememberHistoryCheckbox.checked)
rememberHistoryCheckbox.checked = true;
// select the remember forms history option
document.getElementById("browser.formfill.enable").value = true;
// select the accept cookies option
document.getElementById("network.cookie.cookieBehavior").value = 0;
// select the cookie lifetime policy option
document.getElementById("network.cookie.lifetimePolicy").value = 0;
// select the clear on close option
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value = false;
break;
case "dontremember":
pref.value = true;
break;
}
},
/**
* Update the privacy micro-management controls based on the
* value of the private browsing auto-start checkbox.
*/
updatePrivacyMicroControls: function PPP_updatePrivacyMicroControls()
{
if (document.getElementById("historyMode").value == "custom") {
let disabled = this._autoStartPrivateBrowsing =
document.getElementById("privateBrowsingAutoStart").checked;
this.dependentControls
.forEach(function (aElement)
document.getElementById(aElement).disabled = disabled);
// adjust the cookie controls status
this.readAcceptCookies();
document.getElementById("keepCookiesUntil").value = disabled ? 2 :
document.getElementById("network.cookie.lifetimePolicy").value;
// adjust the checked state of the sanitizeOnShutdown checkbox
document.getElementById("alwaysClear").checked = disabled ? false :
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value;
// adjust the checked state of the remember history checkboxes
document.getElementById("rememberHistory").checked = disabled ? false :
document.getElementById("places.history.enabled").value;
document.getElementById("rememberForms").checked = disabled ? false :
document.getElementById("browser.formfill.enable").value;
if (!disabled) {
// adjust the Settings button for sanitizeOnShutdown
this._updateSanitizeSettingsButton();
}
}
},
// PRIVATE BROWSING
/**
* Install the observer for the auto-start private browsing mode pref.
*/
initAutoStartPrivateBrowsingObserver: function PPP_initAutoStartPrivateBrowsingObserver()
{
let prefService = document.getElementById("privacyPreferences")
.service
.QueryInterface(Components.interfaces.nsIPrefBranch);
prefService.addObserver("browser.privatebrowsing.autostart",
this.autoStartPrivateBrowsingObserver,
false);
},
/**
* Install the observer for the auto-start private browsing mode pref.
*/
removeASPBObserver: function PPP_removeASPBObserver()
{
let prefService = document.getElementById("privacyPreferences")
.service
.QueryInterface(Components.interfaces.nsIPrefBranch);
prefService.removeObserver("browser.privatebrowsing.autostart",
this.autoStartPrivateBrowsingObserver);
},
autoStartPrivateBrowsingObserver:
{
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver]),
observe: function PPP_observe(aSubject, aTopic, aData)
{
let privateBrowsingService = Components.classes["@mozilla.org/privatebrowsing;1"].
getService(Components.interfaces.nsIPrivateBrowsingService);
// Toggle the private browsing mode without switching the session
let prefValue = document.getElementById("browser.privatebrowsing.autostart").value;
let keepCurrentSession = document.getElementById("browser.privatebrowsing.keep_current_session");
keepCurrentSession.value = true;
// If activating from within the private browsing mode, reset the
// private session
if (prefValue && privateBrowsingService.privateBrowsingEnabled)
privateBrowsingService.privateBrowsingEnabled = false;
privateBrowsingService.privateBrowsingEnabled = prefValue;
keepCurrentSession.reset();
}
},
// HISTORY
/**
* Read the location bar enabled and suggestion prefs
* @return Int value for suggestion menulist
*/
readSuggestionPref: function PPP_readSuggestionPref()
{
let getVal = function(aPref)
document.getElementById("browser.urlbar." + aPref).value;
// Suggest nothing if autocomplete is not enabled
if (!getVal("autocomplete.enabled"))
return -1;
// Bottom 2 bits of default.behavior specify history/bookmark
return getVal("default.behavior") & 3;
},
/**
* Write the location bar enabled and suggestion prefs when necessary
* @return Bool value for enabled pref
*/
writeSuggestionPref: function PPP_writeSuggestionPref()
{
let menuVal = document.getElementById("locationBarSuggestion").value;
let enabled = menuVal != -1;
// Only update default.behavior if we're giving suggestions
if (enabled) {
// Put the selected menu item's value directly into the bottom 2 bits
let behavior = document.getElementById("browser.urlbar.default.behavior");
behavior.value = behavior.value >> 2 << 2 | menuVal;
}
// Always update the enabled pref
return enabled;
},
/*
* Preferences:
*
* places.history.enabled
* - whether history is enabled or not
* browser.formfill.enable
* - true if entries in forms and the search bar should be saved, false
* otherwise
*/
// COOKIES
/*
* Preferences:
*
* network.cookie.cookieBehavior
* - determines how the browser should handle cookies:
* 0 means enable all cookies
* 1 means reject third party cookies; see
* netwerk/cookie/src/nsCookieService.cpp for a hairier definition
* 2 means disable all cookies
* network.cookie.lifetimePolicy
* - determines how long cookies are stored:
* 0 means keep cookies until they expire
* 1 means ask how long to keep each cookie
* 2 means keep cookies until the browser is closed
*/
/**
* Reads the network.cookie.cookieBehavior preference value and
* enables/disables the rest of the cookie UI accordingly, returning true
* if cookies are enabled.
*/
readAcceptCookies: function ()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
var acceptThirdParty = document.getElementById("acceptThirdParty");
var keepUntil = document.getElementById("keepUntil");
var menu = document.getElementById("keepCookiesUntil");
// enable the rest of the UI for anything other than "disable all cookies"
var acceptCookies = (pref.value != 2);
acceptThirdParty.disabled = !acceptCookies;
keepUntil.disabled = menu.disabled = this._autoStartPrivateBrowsing || !acceptCookies;
return acceptCookies;
},
readAcceptThirdPartyCookies: function ()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
return pref.value == 0;
},
/**
* Enables/disables the "keep until" label and menulist in response to the
* "accept cookies" checkbox being checked or unchecked.
*/
writeAcceptCookies: function ()
{
var accept = document.getElementById("acceptCookies");
var acceptThirdParty = document.getElementById("acceptThirdParty");
// if we're enabling cookies, automatically check 'accept third party'
if (accept.checked)
acceptThirdParty.checked = true;
return accept.checked ? (acceptThirdParty.checked ? 0 : 1) : 2;
},
writeAcceptThirdPartyCookies: function ()
{
var accept = document.getElementById("acceptCookies");
var acceptThirdParty = document.getElementById("acceptThirdParty");
return accept.checked ? (acceptThirdParty.checked ? 0 : 1) : 2;
},
/**
* Displays fine-grained, per-site preferences for cookies.
*/
showCookieExceptions: function ()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible : true,
sessionVisible : true,
allowVisible : true,
prefilledHost : "",
permissionType : "cookie",
windowTitle : bundlePreferences.getString("cookiepermissionstitle"),
introText : bundlePreferences.getString("cookiepermissionstext") };
openDialog("chrome://browser/content/preferences/permissions.xul",
"Browser:Permissions",
"model=yes", params);
},
/**
* Displays all the user's cookies in a dialog.
*/
showCookies: function (aCategory)
{
openDialog("chrome://browser/content/preferences/cookies.xul",
"Browser:Cookies",
"model=yes", null);
},
// CLEAR PRIVATE DATA
/*
* Preferences:
*
* privacy.sanitize.sanitizeOnShutdown
* - true if the user's private data is cleared on startup according to the
* Clear Private Data settings, false otherwise
*/
/**
* Displays the Clear Private Data settings dialog.
*/
showClearPrivateDataSettings: function ()
{
openDialog("chrome://browser/content/preferences/sanitize.xul",
"model=yes", null);
},
/**
* Displays a dialog from which individual parts of private data may be
* cleared.
*/
clearPrivateDataNow: function (aClearEverything)
{
var ts = document.getElementById("privacy.sanitize.timeSpan");
var timeSpanOrig = ts.value;
if (aClearEverything)
ts.value = 0;
const Cc = Components.classes, Ci = Components.interfaces;
var glue = Cc["@mozilla.org/browser/browserglue;1"]
.getService(Ci.nsIBrowserGlue);
glue.sanitize(window);
// reset the timeSpan pref
if (aClearEverything)
ts.value = timeSpanOrig;
},
/**
* Enables or disables the "Settings..." button depending
* on the privacy.sanitize.sanitizeOnShutdown preference value
*/
_updateSanitizeSettingsButton: function () {
var settingsButton = document.getElementById("clearDataSettings");
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
settingsButton.disabled = !sanitizeOnShutdownPref.value;
}
};

View File

@ -0,0 +1,223 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/privacy.js"/>
<preferences id="privacyPreferences">
<!-- Tracking -->
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
<!-- XXX button prefs -->
<preference id="pref.privacy.disable_button.cookie_exceptions"
name="pref.privacy.disable_button.cookie_exceptions"
type="bool"/>
<preference id="pref.privacy.disable_button.view_cookies"
name="pref.privacy.disable_button.view_cookies"
type="bool"/>
<!-- Location Bar -->
<preference id="browser.urlbar.autocomplete.enabled"
name="browser.urlbar.autocomplete.enabled"
type="bool"/>
<preference id="browser.urlbar.default.behavior"
name="browser.urlbar.default.behavior"
type="int"
onchange="document.getElementById('browser.urlbar.autocomplete.enabled').updateElements();"/>
<!-- History -->
<preference id="places.history.enabled"
name="places.history.enabled"
type="bool"/>
<preference id="browser.formfill.enable"
name="browser.formfill.enable"
type="bool"/>
<!-- Cookies -->
<preference id="network.cookie.cookieBehavior"
name="network.cookie.cookieBehavior"
type="int"/>
<preference id="network.cookie.lifetimePolicy"
name="network.cookie.lifetimePolicy"
type="int"/>
<preference id="network.cookie.blockFutureCookies"
name="network.cookie.blockFutureCookies"
type="bool"/>
<!-- Clear Private Data -->
<preference id="privacy.sanitize.sanitizeOnShutdown"
name="privacy.sanitize.sanitizeOnShutdown"
onchange="gPrivacyPane._updateSanitizeSettingsButton();"
type="bool"/>
<preference id="privacy.sanitize.timeSpan"
name="privacy.sanitize.timeSpan"
type="int"/>
<!-- Private Browsing -->
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
onchange="gPrivacyPane.updatePrivacyMicroControls();"
type="bool"/>
<preference id="browser.privatebrowsing.keep_current_session"
name="browser.privatebrowsing.keep_current_session"
instantApply="true"
type="bool"/>
</preferences>
<hbox class="heading" data-category="panePrivacy" hidden="true">
<image class="preference-icon" type="privacy"/>
<html:h1>&panePrivacy.title;</html:h1>
</hbox>
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
<caption label="&tracking.label;"/>
<checkbox id="privacyDoNotTrackPrefs"
label="&doNotTrack.label;"
accesskey="&doNotTrack.accesskey;"
preference="privacy.donottrackheader.enabled"/>
</groupbox>
<!-- History -->
<groupbox id="historyGroup" data-category="panePrivacy" hidden="true">
<caption label="&history.label;"/>
<hbox align="center">
<label id="historyModeLabel"
control="historyMode"
accesskey="&historyHeader.pre.accesskey;">&historyHeader.pre.label;
</label>
<menulist id="historyMode"
oncommand="gPrivacyPane.updateHistoryModePane();
gPrivacyPane.updateHistoryModePrefs();
gPrivacyPane.updatePrivacyMicroControls();">
<menupopup>
<menuitem label="&historyHeader.remember.label;" value="remember"/>
<menuitem label="&historyHeader.dontremember.label;" value="dontremember"/>
<menuitem label="&historyHeader.custom.label;" value="custom"/>
</menupopup>
</menulist>
<label>&historyHeader.post.label;</label>
</hbox>
<deck id="historyPane">
<vbox align="center" id="historyRememberPane">
<hbox align="center" flex="1">
<spacer flex="1" class="indent"/>
<vbox flex="2">
<description>&rememberDescription.label;</description>
<separator/>
<description>&rememberActions.pre.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.clearPrivateDataNow(false); return false;"
>&rememberActions.clearHistory.label;</html:a>&rememberActions.middle.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.showCookies(); return false;"
>&rememberActions.removeCookies.label;</html:a>&rememberActions.post.label;</description>
</vbox>
<spacer flex="1" class="indent"/>
</hbox>
</vbox>
<vbox align="center" id="historyDontRememberPane">
<hbox align="center" flex="1">
<spacer flex="1" class="indent"/>
<vbox flex="2">
<description>&dontrememberDescription.label;</description>
<separator/>
<description>&dontrememberActions.pre.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.clearPrivateDataNow(true); return false;"
>&dontrememberActions.clearHistory.label;</html:a>&dontrememberActions.post.label;</description>
</vbox>
<spacer flex="1" class="indent"/>
</hbox>
</vbox>
<vbox id="historyCustomPane">
<separator class="thin"/>
<vbox class="indent">
<checkbox id="privateBrowsingAutoStart"
label="&privateBrowsingPermanent2.label;"
accesskey="&privateBrowsingPermanent2.accesskey;"
preference="browser.privatebrowsing.autostart"/>
<vbox class="indent">
<checkbox id="rememberHistory"
label="&rememberHistory2.label;"
accesskey="&rememberHistory2.accesskey;"
preference="places.history.enabled"/>
<checkbox id="rememberForms"
label="&rememberSearchForm.label;"
accesskey="&rememberSearchForm.accesskey;"
preference="browser.formfill.enable"/>
<hbox id="cookiesBox">
<checkbox id="acceptCookies" label="&acceptCookies.label;" flex="1"
preference="network.cookie.cookieBehavior"
accesskey="&acceptCookies.accesskey;"
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"/>
<button id="cookieExceptions" oncommand="gPrivacyPane.showCookieExceptions();"
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
preference="pref.privacy.disable_button.cookie_exceptions"/>
</hbox>
<checkbox id="acceptThirdParty" label="&acceptThirdParty.label;" class="indent"
preference="network.cookie.cookieBehavior"
accesskey="&acceptThirdParty.accesskey;"
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();"/>
<hbox id="keepRow" class="indent">
<label id="keepUntil"
control="keepCookiesUntil"
accesskey="&keepUntil.accesskey;">&keepUntil.label;</label>
<menulist id="keepCookiesUntil"
preference="network.cookie.lifetimePolicy">
<menupopup>
<menuitem label="&expire.label;" value="0"/>
<menuitem label="&close.label;" value="2"/>
<menuitem label="&askEachTime.label;" value="1"/>
</menupopup>
</menulist>
</hbox>
<hbox flex="1">
<button id="showCookiesButton"
label="&showCookies.label;" accesskey="&showCookies.accesskey;"
oncommand="gPrivacyPane.showCookies();"
preference="pref.privacy.disable_button.view_cookies"/>
</hbox>
<hbox id="clearDataBox" align="center">
<checkbox id="alwaysClear" flex="1"
preference="privacy.sanitize.sanitizeOnShutdown"
label="&clearOnClose.label;"
accesskey="&clearOnClose.accesskey;"/>
<button id="clearDataSettings" label="&clearOnCloseSettings.label;"
accesskey="&clearOnCloseSettings.accesskey;"
oncommand="gPrivacyPane.showClearPrivateDataSettings();"/>
</hbox>
</vbox>
</vbox>
</vbox>
</deck>
</groupbox>
<!-- Location Bar -->
<groupbox id="locationBarGroup" data-category="panePrivacy" hidden="true">
<caption label="&locationBar.label;"/>
<hbox align="center">
<label id="locationBarSuggestionLabel"
control="locationBarSuggestion"
accesskey="&locbar.pre.accessKey;">&locbar.pre.label;</label>
<menulist id="locationBarSuggestion"
preference="browser.urlbar.autocomplete.enabled"
onsyncfrompreference="return gPrivacyPane.readSuggestionPref();"
onsynctopreference="return gPrivacyPane.writeSuggestionPref();">
<menupopup>
<menuitem label="&locbar.both.label;" value="0"/>
<menuitem label="&locbar.history.label;" value="1"/>
<menuitem label="&locbar.bookmarks.label;" value="2"/>
<menuitem label="&locbar.nothing.label;" value="-1"/>
</menupopup>
</menulist>
<label>&locbar.post.label;</label>
</hbox>
</groupbox>

View File

@ -0,0 +1,215 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var gSecurityPane = {
_pane: null,
/**
* Initializes master password UI.
*/
init: function ()
{
this._pane = document.getElementById("paneSecurity");
this._initMasterPasswordUI();
},
// ADD-ONS
/*
* Preferences:
*
* xpinstall.whitelist.required
* - true if a site must be added to a site whitelist before extensions
* provided by the site may be installed from it, false if the extension
* may be directly installed after a confirmation dialog
*/
/**
* Enables/disables the add-ons Exceptions button depending on whether
* or not add-on installation warnings are displayed.
*/
readWarnAddonInstall: function ()
{
var warn = document.getElementById("xpinstall.whitelist.required");
var exceptions = document.getElementById("addonExceptions");
exceptions.disabled = !warn.value;
// don't override the preference value
return undefined;
},
/**
* Displays the exceptions lists for add-on installation warnings.
*/
showAddonExceptions: function ()
{
var bundlePrefs = document.getElementById("bundlePreferences");
var params = this._addonParams;
if (!params.windowTitle || !params.introText) {
params.windowTitle = bundlePrefs.getString("addons_permissions_title");
params.introText = bundlePrefs.getString("addonspermissionstext");
}
openDialog("chrome://browser/content/preferences/permissions.xul",
"Browser:Permissions",
"model=yes",
params);
},
/**
* Parameters for the add-on install permissions dialog.
*/
_addonParams:
{
blockVisible: false,
sessionVisible: false,
allowVisible: true,
prefilledHost: "",
permissionType: "install"
},
// PASSWORDS
/*
* Preferences:
*
* signon.rememberSignons
* - true if passwords are remembered, false otherwise
*/
/**
* Enables/disables the Exceptions button used to configure sites where
* passwords are never saved.
*/
readSavePasswords: function ()
{
var pref = document.getElementById("signon.rememberSignons");
var excepts = document.getElementById("passwordExceptions");
excepts.disabled = !pref.value;
// don't override pref value in UI
return undefined;
},
/**
* Displays a dialog in which the user can view and modify the list of sites
* where passwords are never saved.
*/
showPasswordExceptions: function ()
{
openDialog("chrome://passwordmgr/content/passwordManagerExceptions.xul",
"Toolkit:PasswordManagerExceptions",
"model=yes",
null);
},
/**
* Initializes master password UI: the "use master password" checkbox, selects
* the master password button to show, and enables/disables it as necessary.
* The master password is controlled by various bits of NSS functionality, so
* the UI for it can't be controlled by the normal preference bindings.
*/
_initMasterPasswordUI: function ()
{
var noMP = !this._masterPasswordSet();
var button = document.getElementById("changeMasterPassword");
button.disabled = noMP;
var checkbox = document.getElementById("useMasterPassword");
checkbox.checked = !noMP;
},
/**
* Returns true if the user has a master password set and false otherwise.
*/
_masterPasswordSet: function ()
{
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
var slot = secmodDB.findSlotByName("");
if (slot) {
var status = slot.status;
var hasMP = status != Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED &&
status != Ci.nsIPKCS11Slot.SLOT_READY;
return hasMP;
} else {
// XXX I have no bloody idea what this means
return false;
}
},
/**
* Enables/disables the master password button depending on the state of the
* "use master password" checkbox, and prompts for master password removal if
* one is set.
*/
updateMasterPasswordButton: function ()
{
var checkbox = document.getElementById("useMasterPassword");
var button = document.getElementById("changeMasterPassword");
button.disabled = !checkbox.checked;
// unchecking the checkbox should try to immediately remove the master
// password, because it's impossible to non-destructively remove the master
// password used to encrypt all the passwords without providing it (by
// design), and it would be extremely odd to pop up that dialog when the
// user closes the prefwindow and saves his settings
if (!checkbox.checked)
this._removeMasterPassword();
else
this.changeMasterPassword();
this._initMasterPasswordUI();
},
/**
* Displays the "remove master password" dialog to allow the user to remove
* the current master password. When the dialog is dismissed, master password
* UI is automatically updated.
*/
_removeMasterPassword: function ()
{
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
if (secmodDB.isFIPSEnabled) {
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService);
var bundle = document.getElementById("bundlePreferences");
promptService.alert(window,
bundle.getString("pw_change_failed_title"),
bundle.getString("pw_change2empty_in_fips_mode"));
}
else {
openDialog("chrome://mozapps/content/preferences/removemp.xul",
"Toolkit:RemoveMasterPassword", "modal=yes", null);
}
this._initMasterPasswordUI();
},
/**
* Displays a dialog in which the master password may be changed.
*/
changeMasterPassword: function ()
{
openDialog("chrome://mozapps/content/preferences/changemp.xul",
"Toolkit:ChangeMasterPassword", "modal=yes", null);
this._initMasterPasswordUI();
},
/**
* Shows the sites where the user has saved passwords and the associated login
* information.
*/
showPasswords: function ()
{
openDialog("chrome://passwordmgr/content/passwordManager.xul",
"Toolkit:PasswordManager",
"modal=yes", null);
}
};

View File

@ -0,0 +1,96 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/security.js"/>
<preferences id="securityPreferences">
<!-- XXX buttons -->
<preference id="pref.privacy.disable_button.view_passwords"
name="pref.privacy.disable_button.view_passwords"
type="bool"/>
<preference id="pref.privacy.disable_button.view_passwords_exceptions"
name="pref.privacy.disable_button.view_passwords_exceptions"
type="bool"/>
<!-- Add-ons, malware, phishing -->
<preference id="xpinstall.whitelist.required"
name="xpinstall.whitelist.required"
type="bool"/>
<preference id="browser.safebrowsing.malware.enabled"
name="browser.safebrowsing.malware.enabled"
type="bool"/>
<preference id="browser.safebrowsing.enabled"
name="browser.safebrowsing.enabled"
type="bool"/>
<!-- Passwords -->
<preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
</preferences>
<hbox class="heading" data-category="paneSecurity" hidden="true">
<image class="preference-icon" type="security"/>
<html:h1>&paneSecurity.title;</html:h1>
</hbox>
<!-- addons, forgery (phishing) UI -->
<groupbox id="addonsPhishingGroup" data-category="paneSecurity" hidden="true">
<hbox id="addonInstallBox">
<checkbox id="warnAddonInstall" flex="1"
label="&warnAddonInstall.label;"
accesskey="&warnAddonInstall.accesskey;"
preference="xpinstall.whitelist.required"
onsyncfrompreference="return gSecurityPane.readWarnAddonInstall();"/>
<button id="addonExceptions"
label="&addonExceptions.label;"
accesskey="&addonExceptions.accesskey;"
oncommand="gSecurityPane.showAddonExceptions();"/>
</hbox>
<separator class="thin"/>
<checkbox id="blockAttackSites"
label="&blockAttackSites.label;"
accesskey="&blockAttackSites.accesskey;"
preference="browser.safebrowsing.malware.enabled" />
<checkbox id="blockWebForgeries"
label="&blockWebForgeries.label;"
accesskey="&blockWebForgeries.accesskey;"
preference="browser.safebrowsing.enabled" />
</groupbox>
<!-- Passwords -->
<groupbox id="passwordsGroup" orient="vertical" data-category="paneSecurity" hidden="true">
<caption label="&passwords.label;"/>
<hbox id="savePasswordsBox">
<checkbox id="savePasswords" flex="1"
label="&rememberPasswords.label;" accesskey="&rememberPasswords.accesskey;"
preference="signon.rememberSignons"
onsyncfrompreference="return gSecurityPane.readSavePasswords();"/>
<button id="passwordExceptions"
label="&passwordExceptions.label;"
accesskey="&passwordExceptions.accesskey;"
oncommand="gSecurityPane.showPasswordExceptions();"
preference="pref.privacy.disable_button.view_passwords_exceptions"/>
</hbox>
<hbox id="masterPasswordBox">
<checkbox id="useMasterPassword" flex="1"
oncommand="gSecurityPane.updateMasterPasswordButton();"
label="&useMasterPassword.label;"
accesskey="&useMasterPassword.accesskey;"/>
<button id="changeMasterPassword"
label="&changeMasterPassword.label;"
accesskey="&changeMasterPassword.accesskey;"
oncommand="gSecurityPane.changeMasterPassword();"/>
</hbox>
<hbox id="showPasswordsBox">
<spacer flex="1"/>
<button id="showPasswords"
label="&savedPasswords.label;" accesskey="&savedPasswords.accesskey;"
oncommand="gSecurityPane.showPasswords();"
preference="pref.privacy.disable_button.view_passwords"/>
</hbox>
</groupbox>

View File

@ -0,0 +1,155 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://services-sync/service.js");
const PAGE_NO_ACCOUNT = 0;
const PAGE_HAS_ACCOUNT = 1;
const PAGE_NEEDS_UPDATE = 2;
let gSyncPane = {
_stringBundle: null,
prefArray: ["engine.bookmarks", "engine.passwords", "engine.prefs",
"engine.tabs", "engine.history"],
get page() {
return document.getElementById("weavePrefsDeck").selectedIndex;
},
set page(val) {
document.getElementById("weavePrefsDeck").selectedIndex = val;
},
get _usingCustomServer() {
return Weave.Svc.Prefs.isSet("serverURL");
},
needsUpdate: function () {
this.page = PAGE_NEEDS_UPDATE;
let label = document.getElementById("loginError");
label.value = Weave.Utils.getErrorString(Weave.Status.login);
label.className = "error";
},
init: function () {
let topics = ["weave:service:login:error",
"weave:service:login:finish",
"weave:service:start-over",
"weave:service:setup-complete",
"weave:service:logout:finish"];
// Add the observers now and remove them on unload
//XXXzpao This should use Services.obs.* but Weave's Obs does nice handling
// of `this`. Fix in a followup. (bug 583347)
topics.forEach(function (topic) {
Weave.Svc.Obs.add(topic, this.updateWeavePrefs, this);
}, this);
window.addEventListener("unload", function() {
topics.forEach(function (topic) {
Weave.Svc.Obs.remove(topic, this.updateWeavePrefs, this);
}, gSyncPane);
}, false);
this._stringBundle =
Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");
this.updateWeavePrefs();
},
updateWeavePrefs: function () {
if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED ||
Weave.Svc.Prefs.get("firstSync", "") == "notReady") {
this.page = PAGE_NO_ACCOUNT;
} else if (Weave.Status.login == Weave.LOGIN_FAILED_INVALID_PASSPHRASE ||
Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
this.needsUpdate();
} else {
this.page = PAGE_HAS_ACCOUNT;
document.getElementById("accountName").value = Weave.Service.account;
document.getElementById("syncComputerName").value = Weave.Clients.localName;
document.getElementById("tosPP").hidden = this._usingCustomServer;
}
},
startOver: function (showDialog) {
if (showDialog) {
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL +
Services.prompt.BUTTON_POS_1_DEFAULT;
let buttonChoice =
Services.prompt.confirmEx(window,
this._stringBundle.GetStringFromName("syncUnlink.title"),
this._stringBundle.GetStringFromName("syncUnlink.label"),
flags,
this._stringBundle.GetStringFromName("syncUnlinkConfirm.label"),
null, null, null, {});
// If the user selects cancel, just bail
if (buttonChoice == 1)
return;
}
Weave.Service.startOver();
this.updateWeavePrefs();
},
updatePass: function () {
if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED)
gSyncUtils.changePassword();
else
gSyncUtils.updatePassphrase();
},
resetPass: function () {
if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED)
gSyncUtils.resetPassword();
else
gSyncUtils.resetPassphrase();
},
/**
* Invoke the Sync setup wizard.
*
* @param wizardType
* Indicates type of wizard to launch:
* null -- regular set up wizard
* "pair" -- pair a device first
* "reset" -- reset sync
*/
openSetup: function (wizardType) {
var win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
if (win)
win.focus();
else {
window.openDialog("chrome://browser/content/sync/setup.xul",
"weaveSetup", "centerscreen,chrome,resizable=no",
wizardType);
}
},
openQuotaDialog: function () {
let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
if (win)
win.focus();
else
window.openDialog("chrome://browser/content/sync/quota.xul", "",
"centerscreen,chrome,dialog,modal");
},
openAddDevice: function () {
if (!Weave.Utils.ensureMPUnlocked())
return;
let win = Services.wm.getMostRecentWindow("Sync:AddDevice");
if (win)
win.focus();
else
window.openDialog("chrome://browser/content/sync/addDevice.xul",
"syncAddDevice", "centerscreen,chrome,resizable=no");
},
resetSync: function () {
this.openSetup("reset");
}
}

View File

@ -0,0 +1,173 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<preferences>
<preference id="engine.addons"
name="services.sync.engine.addons"
type="bool"/>
<preference id="engine.bookmarks"
name="services.sync.engine.bookmarks"
type="bool"/>
<preference id="engine.history"
name="services.sync.engine.history"
type="bool"/>
<preference id="engine.tabs"
name="services.sync.engine.tabs"
type="bool"/>
<preference id="engine.prefs"
name="services.sync.engine.prefs"
type="bool"/>
<preference id="engine.passwords"
name="services.sync.engine.passwords"
type="bool"/>
</preferences>
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/sync.js"/>
<script type="application/javascript"
src="chrome://browser/content/sync/utils.js"/>
<hbox class="heading" data-category="paneSync" hidden="true">
<image class="preference-icon" type="sync"/>
<html:h1>&paneSync.title;</html:h1>
</hbox>
<deck id="weavePrefsDeck" data-category="paneSync" hidden="true">
<vbox id="noAccount" align="center">
<spacer flex="1"/>
<description id="syncDesc">
&weaveDesc.label;
</description>
<separator/>
<label class="text-link"
onclick="event.stopPropagation(); gSyncPane.openSetup(null);"
value="&setupButton.label;"/>
<separator/>
<label class="text-link"
onclick="event.stopPropagation(); gSyncPane.openSetup('pair');"
value="&pairDevice.label;"/>
<spacer flex="3"/>
</vbox>
<vbox id="hasAccount">
<groupbox class="syncGroupBox">
<!-- label is set to account name -->
<caption id="accountCaption" align="center">
<image id="accountCaptionImage"/>
<label id="accountName" value=""/>
</caption>
<hbox>
<button type="menu"
label="&manageAccount.label;"
accesskey="&manageAccount.accesskey;">
<menupopup>
<menuitem label="&viewQuota.label;"
oncommand="gSyncPane.openQuotaDialog();"/>
<menuseparator/>
<menuitem label="&changePassword2.label;"
oncommand="gSyncUtils.changePassword();"/>
<menuitem label="&myRecoveryKey.label;"
oncommand="gSyncUtils.resetPassphrase();"/>
<menuseparator/>
<menuitem label="&resetSync2.label;"
oncommand="gSyncPane.resetSync();"/>
</menupopup>
</button>
</hbox>
<hbox>
<label id="syncAddDeviceLabel"
class="text-link"
onclick="gSyncPane.openAddDevice(); return false;"
value="&pairDevice.label;"/>
</hbox>
<vbox>
<label value="&syncMy.label;" />
<richlistbox id="syncEnginesList"
orient="vertical"
onselect="if (this.selectedCount) this.clearSelection();">
<richlistitem>
<checkbox label="&engine.addons.label;"
accesskey="&engine.addons.accesskey;"
preference="engine.addons"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.bookmarks.label;"
accesskey="&engine.bookmarks.accesskey;"
preference="engine.bookmarks"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.passwords.label;"
accesskey="&engine.passwords.accesskey;"
preference="engine.passwords"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.prefs.label;"
accesskey="&engine.prefs.accesskey;"
preference="engine.prefs"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.history.label;"
accesskey="&engine.history.accesskey;"
preference="engine.history"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.tabs.label;"
accesskey="&engine.tabs.accesskey;"
preference="engine.tabs"/>
</richlistitem>
</richlistbox>
</vbox>
</groupbox>
<groupbox class="syncGroupBox">
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&syncComputerName.label;"
accesskey="&syncComputerName.accesskey;"
control="syncComputerName"/>
<textbox id="syncComputerName"
onchange="gSyncUtils.changeName(this)"/>
</row>
</rows>
</grid>
<hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;"
value="&unlinkDevice.label;"/>
</hbox>
</groupbox>
<hbox id="tosPP" pack="center">
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openToS();"
value="&prefs.tosLink.label;"/>
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openPrivacyPolicy();"
value="&prefs.ppLink.label;"/>
</hbox>
</vbox>
<vbox id="needsUpdate" align="center" pack="center">
<hbox>
<label id="loginError" value=""/>
<label class="text-link"
onclick="gSyncPane.updatePass(); return false;"
value="&updatePass.label;"/>
<label class="text-link"
onclick="gSyncPane.resetPass(); return false;"
value="&resetPass.label;"/>
</hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;"
value="&unlinkDevice.label;"/>
</vbox>
</deck>

View File

@ -0,0 +1,66 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var gTabsPane = {
/*
* Preferences:
*
* browser.link.open_newwindow
* - determines where pages which would open in a new window are opened:
* 1 opens such links in the most recent window or tab,
* 2 opens such links in a new window,
* 3 opens such links in a new tab
* browser.tabs.autoHide
* - true if the tab bar is hidden when only one tab is open, false to always
* show it
* browser.tabs.loadInBackground
* - true if display should switch to a new tab which has been opened from a
* link, false if display shouldn't switch
* browser.tabs.warnOnClose
* - true if when closing a window with multiple tabs the user is warned and
* allowed to cancel the action, false to just close the window
* browser.tabs.warnOnOpen
* - true if the user should be warned if he attempts to open a lot of tabs at
* once (e.g. a large folder of bookmarks), false otherwise
* browser.taskbar.previews.enable
* - true if tabs are to be shown in the Windows 7 taskbar
*/
#ifdef XP_WIN
/**
* Initialize any platform-specific UI.
*/
init: function () {
try {
let sysInfo = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2);
let ver = parseFloat(sysInfo.getProperty("version"));
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
showTabsInTaskbar.hidden = ver < 6.1 || (ver >= 6.1 && history.state != "tabs");
} catch (ex) {}
},
#endif
/**
* Determines where a link which opens a new window will open.
*
* @returns |true| if such links should be opened in new tabs
*/
readLinkTarget: function() {
var openNewWindow = document.getElementById("browser.link.open_newwindow");
return openNewWindow.value != 2;
},
/**
* Determines where a link which opens a new window will open.
*
* @returns 2 if such links should be opened in new windows,
* 3 if such links should be opened in new tabs
*/
writeLinkTarget: function() {
var linkTargeting = document.getElementById("linkTargeting");
return linkTargeting.checked ? 3 : 2;
}
};

View File

@ -0,0 +1,76 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public License,
- v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/tabs.js"/>
<preferences id="tabsPreferences">
<preference id="browser.link.open_newwindow"
name="browser.link.open_newwindow"
type="int"/>
<preference id="browser.tabs.autoHide"
name="browser.tabs.autoHide"
type="bool"
inverted="true"/>
<preference id="browser.tabs.loadInBackground"
name="browser.tabs.loadInBackground"
type="bool"
inverted="true"/>
<preference id="browser.tabs.warnOnClose"
name="browser.tabs.warnOnClose"
type="bool"/>
<preference id="browser.tabs.warnOnOpen"
name="browser.tabs.warnOnOpen"
type="bool"/>
#ifdef XP_WIN
<preference id="browser.taskbar.previews.enable"
name="browser.taskbar.previews.enable"
type="bool"/>
#endif
</preferences>
<hbox class="heading" data-category="paneTabs" hidden="true">
<image class="preference-icon" type="tabs"/>
<html:h1>&paneTabs.title;</html:h1>
</hbox>
<checkbox id="linkTargeting" label="&newWindowsAsTabs.label;"
data-category="paneTabs" hidden="true"
accesskey="&newWindowsAsTabs.accesskey;"
preference="browser.link.open_newwindow"
onsyncfrompreference="return gTabsPane.readLinkTarget();"
onsynctopreference="return gTabsPane.writeLinkTarget();"
class="indent"/>
<checkbox id="warnCloseMultiple" label="&warnCloseMultipleTabs.label;"
data-category="paneTabs" hidden="true"
accesskey="&warnCloseMultipleTabs.accesskey;"
preference="browser.tabs.warnOnClose"
class="indent"/>
<checkbox id="warnOpenMany" label="&warnOpenManyTabs.label;"
data-category="paneTabs" hidden="true"
accesskey="&warnOpenManyTabs.accesskey;"
preference="browser.tabs.warnOnOpen"
class="indent"/>
<checkbox id="showTabBar" label="&showTabBar.label;"
data-category="paneTabs" hidden="true"
accesskey="&showTabBar.accesskey;"
preference="browser.tabs.autoHide"
class="indent"/>
<checkbox id="switchToNewTabs" label="&switchToNewTabs.label;"
data-category="paneTabs" hidden="true"
accesskey="&switchToNewTabs.accesskey;"
preference="browser.tabs.loadInBackground"
class="indent"/>
#ifdef XP_WIN
<checkbox id="showTabsInTaskbar" label="&showTabsInTaskbar.label;"
data-category="paneTabs" hidden="true"
accesskey="&showTabsInTaskbar.accesskey;"
preference="browser.taskbar.previews.enable"
class="indent"/>
#endif

View File

@ -0,0 +1,31 @@
# -- This Source Code Form is subject to the terms of the Mozilla Public
# - License, v. 2.0. If a copy of the MPL was not distributed with this file,
# - You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/components/preferences/in-content/tests
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_FILES = \
head.js \
browser_bug410900.js \
browser_bug567487.js \
browser_bug731866.js \
privacypane_tests.js \
browser_privacypane_1.js \
browser_privacypane_2.js \
browser_privacypane_3.js \
browser_privacypane_4.js \
browser_privacypane_5.js \
browser_privacypane_6.js \
browser_privacypane_7.js \
browser_privacypane_8.js \
$(NULL)
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

View File

@ -0,0 +1,58 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
function test() {
waitForExplicitFinish();
// Setup a phony handler to ensure the app pane will be populated.
var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].
createInstance(Ci.nsIWebHandlerApp);
handler.name = "App pane alive test";
handler.uriTemplate = "http://test.mozilla.org/%s";
var extps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
getService(Ci.nsIExternalProtocolService);
var info = extps.getProtocolHandlerInfo("apppanetest");
info.possibleApplicationHandlers.appendElement(handler, false);
var hserv = Cc["@mozilla.org/uriloader/handler-service;1"].
getService(Ci.nsIHandlerService);
hserv.store(info);
function observer(win, topic, data) {
if (topic != "app-handler-pane-loaded")
return;
Services.obs.removeObserver(observer, "app-handler-pane-loaded");
runTest(win);
}
Services.obs.addObserver(observer, "app-handler-pane-loaded", false);
gBrowser.selectedTab = gBrowser.addTab("about:preferences");
}
function runTest(win) {
win.gotoPref("applications");
var sel = win.history.state;
ok(sel == "applications", "Specified pane was opened");
var rbox = win.document.getElementById("handlersView");
ok(rbox, "handlersView is present");
var items = rbox && rbox.getElementsByTagName("richlistitem");
ok(items && items.length > 0, "App handler list populated");
var handlerAdded = false;
for (let i = 0; i < items.length; i++) {
if (items[i].getAttribute('type') == "apppanetest")
handlerAdded = true;
}
ok(handlerAdded, "apppanetest protocol handler was successfully added");
gBrowser.removeCurrentTab();
win.close();
finish();
}

View File

@ -0,0 +1,73 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
resetPreferences();
function observer(win, topic, data) {
if (topic != "main-pane-loaded")
return;
Services.obs.removeObserver(observer, "main-pane-loaded");
runTest(win);
}
Services.obs.addObserver(observer, "main-pane-loaded", false);
gBrowser.selectedTab = gBrowser.addTab("about:preferences");
}
function runTest(win) {
win.gotoPref("general");
let doc = win.document;
let pbAutoStartPref = doc.getElementById("browser.privatebrowsing.autostart");
let startupPref = doc.getElementById("browser.startup.page");
let menu = doc.getElementById("browserStartupPage");
let option = doc.getElementById("browserStartupLastSession");
let defOption = doc.getElementById("browserStartupHomePage");
let otherOption = doc.getElementById("browserStartupBlank");
ok(!pbAutoStartPref.value, "Sanity check");
is(startupPref.value, startupPref.defaultValue, "Sanity check");
// First, check to make sure that setting pbAutoStartPref disables the menu item
pbAutoStartPref.value = true;
is(option.getAttribute("disabled"), "true", "Setting private browsing to autostart " +
"should disable the 'Show my tabs and windows from last time' option");
pbAutoStartPref.value = false;
// Now ensure the correct behavior when pbAutoStartPref is set with option enabled
startupPref.value = option.getAttribute("value");
is(menu.selectedItem, option, "Sanity check");
pbAutoStartPref.value = true;
is(option.getAttribute("disabled"), "true", "Setting private browsing to autostart " +
"should disable the 'Show my tabs and windows from last time' option");
is(menu.selectedItem, defOption, "The 'Show home page' option should be selected");
is(startupPref.value, option.getAttribute("value"), "But the value of the startup " +
"pref itself shouldn't change");
menu.selectedItem = otherOption;
menu.doCommand();
is(startupPref.value, otherOption.getAttribute("value"), "And we should be able to " +
"chnage it!");
pbAutoStartPref.value = false;
// Now, ensure that with 'Show my windows and tabs from last time' enabled, toggling
// pbAutoStartPref would restore that value in the menulist.
startupPref.value = option.getAttribute("value");
is(menu.selectedItem, option, "Sanity check");
pbAutoStartPref.value = true;
is(menu.selectedItem, defOption, "The 'Show home page' option should be selected");
pbAutoStartPref.value = false;
is(menu.selectedItem, option, "The correct value should be restored");
// cleanup
resetPreferences();
gBrowser.removeCurrentTab();
win.close();
finish();
}
function resetPreferences() {
Services.prefs.clearUserPref("browser.startup.page");
Services.prefs.clearUserPref("browser.privatebrowsing.autostart");
}

View File

@ -0,0 +1,113 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
function test() {
waitForExplicitFinish();
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab = gBrowser.addTab("about:preferences"));
newTabBrowser.addEventListener("load", function () {
newTabBrowser.removeEventListener("load", arguments.callee, true);
runTest(gBrowser.contentWindow);
}, true);
}
function runTest(win) {
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
let tab = win.document;
let elements = tab.getElementById("mainPrefPane").children;
//Test if general pane is opened correctly
win.gotoPref("paneGeneral");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneGeneral") {
is_element_visible(element, "General elements should be visible");
} else {
is_element_hidden(element, "Non-General elements should be hidden");
}
}
//Test if tabs pane is opened correctly
win.gotoPref("paneTabs");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneTabs") {
is_element_visible(element, "Tab elements should be visible");
} else {
is_element_hidden(element, "Non-Tab elements should be hidden");
}
}
//Test if content pane is opened correctly
win.gotoPref("paneContent");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneContent") {
is_element_visible(element, "Content elements should be visible");
} else {
is_element_hidden(element, "Non-Content elements should be hidden");
}
}
//Test if applications pane is opened correctly
win.gotoPref("paneApplications");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneApplications") {
is_element_visible(element, "Application elements should be visible");
} else {
is_element_hidden(element, "Non-Application elements should be hidden");
}
}
//Test if privacy pane is opened correctly
win.gotoPref("panePrivacy");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "panePrivacy") {
is_element_visible(element, "Privacy elements should be visible");
} else {
is_element_hidden(element, "Non-Privacy elements should be hidden");
}
}
//Test if security pane is opened correctly
win.gotoPref("paneSecurity");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneSecurity") {
is_element_visible(element, "Security elements should be visible");
} else {
is_element_hidden(element, "Non-Security elements should be hidden");
}
}
//Test if sync pane is opened correctly
win.gotoPref("paneSync");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneSync") {
is_element_visible(element, "Sync elements should be visible");
} else {
is_element_hidden(element, "Non-Sync elements should be hidden");
}
}
//Test if advanced pane is opened correctly
win.gotoPref("paneAdvanced");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneAdvanced") {
is_element_visible(element, "Advanced elements should be visible");
} else {
is_element_hidden(element, "Non-Advanced elements should be hidden");
}
}
gBrowser.removeCurrentTab();
win.close();
finish();
}

View File

@ -0,0 +1,26 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_pane_visibility,
test_dependent_elements,
test_dependent_cookie_elements,
test_dependent_clearonclose_elements,
test_dependent_prefs,
// reset all preferences to their default values once we're done
reset_preferences
]);
}

View File

@ -0,0 +1,29 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_historymode_retention("remember", undefined),
test_historymode_retention("dontremember", "remember"),
test_historymode_retention("custom", "dontremember"),
// custom without any micro-prefs changed won't retain
test_historymode_retention("remember", "dontremember"),
test_historymode_retention("custom", "remember"),
// custom without any micro-prefs changed won't retain
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

View File

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_custom_retention("rememberHistory", "remember"),
test_custom_retention("rememberHistory", "custom"),
test_custom_retention("rememberForms", "remember"),
test_custom_retention("rememberForms", "custom"),
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

View File

@ -0,0 +1,30 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_custom_retention("acceptCookies", "remember"),
test_custom_retention("acceptCookies", "custom"),
test_custom_retention("acceptThirdParty", "remember"),
test_custom_retention("acceptThirdParty", "custom"),
test_custom_retention("keepCookiesUntil", "remember", 1),
test_custom_retention("keepCookiesUntil", "custom", 2),
test_custom_retention("keepCookiesUntil", "custom", 0),
test_custom_retention("alwaysClear", "remember"),
test_custom_retention("alwaysClear", "custom"),
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

View File

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_locbar_suggestion_retention(-1, undefined),
test_locbar_suggestion_retention(1, -1),
test_locbar_suggestion_retention(2, 1),
test_locbar_suggestion_retention(0, 2),
test_locbar_suggestion_retention(0, 0),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

View File

@ -0,0 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_privatebrowsing_toggle,
enter_private_browsing, // once again, test with PB initially enabled
test_privatebrowsing_toggle,
// don't reset preferences, will pick up where we left off in browser_privacypane_7.js
]);
}

View File

@ -0,0 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_privatebrowsing_ui,
enter_private_browsing, // once again, test with PB initially enabled
test_privatebrowsing_ui,
// reset all preferences to their default values once we're done
reset_preferences
]);
}

View File

@ -0,0 +1,34 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
// history mode should be initialized to remember
test_historymode_retention("remember", undefined),
// history mode should remain remember; toggle acceptCookies checkbox
test_custom_retention("acceptCookies", "remember"),
// history mode should now be custom; set history mode to dontremember
test_historymode_retention("dontremember", "custom"),
// history mode should remain custom; set history mode to remember
test_historymode_retention("remember", "custom"),
// history mode should now be remember
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

Some files were not shown because too many files have changed in this diff Show More